// Code generated for linux/arm by 'ccgo Img-2.0.1/base/tkimgIO.o.go Img-2.0.1/base/tkimgMap.o.go Img-2.0.1/base/tkimg.o.go Img-2.0.1/base/tkimgStubInit.o.go Img-2.0.1/base/tkimgStubLib.o.go Img-2.0.1/base/tkimgUtils.o.go Img-2.0.1/bmp/bmp.o.go Img-2.0.1/dted/dted.o.go Img-2.0.1/flir/flir.o.go Img-2.0.1/gif/gif.o.go Img-2.0.1/ico/ico.o.go Img-2.0.1/jpeg/jpeg.o.go Img-2.0.1/libjpeg/jaricom.o.go Img-2.0.1/libjpeg/jcapimin.o.go Img-2.0.1/libjpeg/jcapistd.o.go Img-2.0.1/libjpeg/jcarith.o.go Img-2.0.1/libjpeg/jccoefct.o.go Img-2.0.1/libjpeg/jccolor.o.go Img-2.0.1/libjpeg/jcdctmgr.o.go Img-2.0.1/libjpeg/jcinit.o.go Img-2.0.1/libjpeg/jcmainct.o.go Img-2.0.1/libjpeg/jcmarker.o.go Img-2.0.1/libjpeg/jcmaster.o.go Img-2.0.1/libjpeg/jcomapi.o.go Img-2.0.1/libjpeg/jcparam.o.go Img-2.0.1/libjpeg/jcprepct.o.go Img-2.0.1/libjpeg/jcsample.o.go Img-2.0.1/libjpeg/jctrans.o.go Img-2.0.1/libjpeg/jdapimin.o.go Img-2.0.1/libjpeg/jdapistd.o.go Img-2.0.1/libjpeg/jdarith.o.go Img-2.0.1/libjpeg/jdatadst.o.go Img-2.0.1/libjpeg/jdatasrc.o.go Img-2.0.1/libjpeg/jdcoefct.o.go Img-2.0.1/libjpeg/jdcolor.o.go Img-2.0.1/libjpeg/jddctmgr.o.go Img-2.0.1/libjpeg/jdhuff.o.go Img-2.0.1/libjpeg/jdinput.o.go Img-2.0.1/libjpeg/jdmainct.o.go Img-2.0.1/libjpeg/jdmarker.o.go Img-2.0.1/libjpeg/jdmaster.o.go Img-2.0.1/libjpeg/jdmerge.o.go Img-2.0.1/libjpeg/jdpostct.o.go Img-2.0.1/libjpeg/jdsample.o.go Img-2.0.1/libjpeg/jdtrans.o.go Img-2.0.1/libjpeg/jerror.o.go Img-2.0.1/libjpeg/jfdctflt.o.go Img-2.0.1/libjpeg/jfdctfst.o.go Img-2.0.1/libjpeg/jfdctint.o.go Img-2.0.1/libjpeg/jchuff.o.go Img-2.0.1/libjpeg/jidctflt.o.go Img-2.0.1/libjpeg/jidctfst.o.go Img-2.0.1/libjpeg/jidctint.o.go Img-2.0.1/libjpeg/jmemansi.o.go Img-2.0.1/libjpeg/jmemmgr.o.go Img-2.0.1/libjpeg/jpegtcl.o.go Img-2.0.1/libjpeg/jpegtclStubInit.o.go Img-2.0.1/libjpeg/jpegtclStubLib.o.go Img-2.0.1/libjpeg/jquant1.o.go Img-2.0.1/libjpeg/jquant2.o.go Img-2.0.1/libjpeg/jutils.o.go Img-2.0.1/libpng/arm_init.o.go Img-2.0.1/libpng/filter_neon_intrinsics.o.go Img-2.0.1/libpng/palette_neon_intrinsics.o.go Img-2.0.1/libpng/pngerror.o.go Img-2.0.1/libpng/pngget.o.go Img-2.0.1/libpng/pngmem.o.go Img-2.0.1/libpng/png.o.go Img-2.0.1/libpng/pngpread.o.go Img-2.0.1/libpng/pngread.o.go Img-2.0.1/libpng/pngrio.o.go Img-2.0.1/libpng/pngrtran.o.go Img-2.0.1/libpng/pngrutil.o.go Img-2.0.1/libpng/pngset.o.go Img-2.0.1/libpng/pngtcl.o.go Img-2.0.1/libpng/pngtclStubInit.o.go Img-2.0.1/libpng/pngtclStubLib.o.go Img-2.0.1/libpng/pngtrans.o.go Img-2.0.1/libpng/pngwio.o.go Img-2.0.1/libpng/pngwrite.o.go Img-2.0.1/libpng/pngwtran.o.go Img-2.0.1/libpng/pngwutil.o.go Img-2.0.1/libtiff/tif_aux.o.go Img-2.0.1/libtiff/tif_close.o.go Img-2.0.1/libtiff/tif_codec.o.go Img-2.0.1/libtiff/tif_color.o.go Img-2.0.1/libtiff/tif_compress.o.go Img-2.0.1/libtiff/tif_dirinfo.o.go Img-2.0.1/libtiff/tif_dir.o.go Img-2.0.1/libtiff/tif_dirread.o.go Img-2.0.1/libtiff/tif_dirwrite.o.go Img-2.0.1/libtiff/tif_dumpmode.o.go Img-2.0.1/libtiff/tif_error.o.go Img-2.0.1/libtiff/tif_extension.o.go Img-2.0.1/libtiff/tif_fax3.o.go Img-2.0.1/libtiff/tif_fax3sm.o.go Img-2.0.1/libtiff/tif_flush.o.go Img-2.0.1/libtiff/tifftcl.o.go Img-2.0.1/libtiff/tifftclStubInit.o.go Img-2.0.1/libtiff/tifftclStubLib.o.go Img-2.0.1/libtiff/tif_getimage.o.go Img-2.0.1/libtiff/tif_hash_set.o.go Img-2.0.1/libtiff/tif_luv.o.go Img-2.0.1/libtiff/tif_lzw.o.go Img-2.0.1/libtiff/tif_next.o.go Img-2.0.1/libtiff/tif_open.o.go Img-2.0.1/libtiff/tif_packbits.o.go Img-2.0.1/libtiff/tif_predict.o.go Img-2.0.1/libtiff/tif_print.o.go Img-2.0.1/libtiff/tif_read.o.go Img-2.0.1/libtiff/tif_strip.o.go Img-2.0.1/libtiff/tif_swab.o.go Img-2.0.1/libtiff/tif_thunder.o.go Img-2.0.1/libtiff/tif_tile.o.go Img-2.0.1/libtiff/tif_unix.o.go Img-2.0.1/libtiff/tif_version.o.go Img-2.0.1/libtiff/tif_warning.o.go Img-2.0.1/libtiff/tif_write.o.go Img-2.0.1/pcx/pcx.o.go Img-2.0.1/pixmap/pixmap.o.go Img-2.0.1/pixmap/pixmapUnix.o.go Img-2.0.1/png/png.o.go Img-2.0.1/ppm/ppm.o.go Img-2.0.1/ps/ps.o.go Img-2.0.1/raw/raw.o.go Img-2.0.1/sgi/sgi.o.go Img-2.0.1/sun/sun.o.go Img-2.0.1/tga/tga.o.go Img-2.0.1/tiff/tiffJpeg.o.go Img-2.0.1/tiff/tiff.o.go Img-2.0.1/tiff/tiffPixar.o.go Img-2.0.1/tiff/tiffZip.o.go Img-2.0.1/window/window.o.go Img-2.0.1/xbm/xbm.o.go Img-2.0.1/xpm/xpm.o.go Img-2.0.1/zlib/adler32.o.go Img-2.0.1/zlib/compress.o.go Img-2.0.1/zlib/crc32.o.go Img-2.0.1/zlib/deflate.o.go Img-2.0.1/zlib/gzclose.o.go Img-2.0.1/zlib/gzlib.o.go Img-2.0.1/zlib/gzread.o.go Img-2.0.1/zlib/gzwrite.o.go Img-2.0.1/zlib/infback.o.go Img-2.0.1/zlib/inffast.o.go Img-2.0.1/zlib/inflate.o.go Img-2.0.1/zlib/inftrees.o.go Img-2.0.1/zlib/trees.o.go Img-2.0.1/zlib/uncompr.o.go Img-2.0.1/zlib/zlibtcl.o.go Img-2.0.1/zlib/zlibtclStubInit.o.go Img-2.0.1/zlib/zlibtclStubLib.o.go Img-2.0.1/zlib/zutil.o.go /home/jnml/.config/ccgo/v4/libtcl9.0/linux/arm/tcl9.0.1/unix/tclStubLib.o /home/jnml/.config/ccgo/v4/libtk9.0/linux/arm/tk9.0.1/unix/tkStubLib.o --package-name img --prefix-external=X --prefix-field=F --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -ignore-link-errors -lX11 -o internal/img/img_linux_arm.go', DO NOT EDIT. //go:build linux && arm package img import ( "reflect" "unsafe" "modernc.org/libX11" "modernc.org/libc" ) var _ reflect.Type var _ unsafe.Pointer const Above = 0 const AllTemporary = 0 const AllocAll = 1 const AllocNone = 0 const AllowExposures = 1 const AlreadyGrabbed = 1 const Always = 2 const AnyButton = 0 const AnyKey = 0 const AnyPropertyType = 0 const ArcChord = 0 const ArcPieSlice = 1 const AsyncBoth = 6 const AsyncKeyboard = 3 const AsyncPointer = 0 const AutoRepeatModeDefault = 2 const AutoRepeatModeOff = 0 const AutoRepeatModeOn = 1 const BIG_ENDIAN = "__BIG_ENDIAN" const BUFSIZ = 1024 const BYTE_ORDER = "__BYTE_ORDER" const BadAccess = 10 const BadAlloc = 11 const BadAtom = 5 const BadColor = 12 const BadCursor = 6 const BadDrawable = 9 const BadFont = 7 const BadGC = 13 const BadIDChoice = 14 const BadImplementation = 17 const BadLength = 16 const BadMatch = 8 const BadName = 15 const BadPixmap = 4 const BadRequest = 1 const BadValue = 2 const BadWindow = 3 const Below = 1 const Bool = "int" const BottomIf = 3 const Button1 = 1 const Button2 = 2 const Button3 = 3 const Button4 = 4 const Button5 = 5 const ButtonPress = 4 const ButtonRelease = 5 const CONST86 = "const" const CapButt = 1 const CapNotLast = 0 const CapProjecting = 3 const CapRound = 2 const CenterGravity = 5 const CirculateNotify = 26 const CirculateRequest = 27 const ClientMessage = 33 const ClipByChildren = 0 const ColormapInstalled = 1 const ColormapNotify = 32 const ColormapUninstalled = 0 const Complex = 0 const ConfigureNotify = 22 const ConfigureRequest = 23 const ControlMapIndex = 2 const Convex = 2 const CoordModeOrigin = 0 const CoordModePrevious = 1 const CopyFromParent = 0 const CreateNotify = 16 const CurrentTime = 0 const CursorShape = 0 const DefaultBlanking = 2 const DefaultExposures = 2 const DestroyAll = 0 const DestroyNotify = 17 const DirectColor = 5 const DisableAccess = 0 const DisableScreenInterval = 0 const DisableScreenSaver = 0 const DontAllowExposures = 0 const DontPreferBlanking = 0 const EXIT_FAILURE = 1 const EXIT_SUCCESS = 0 const EastGravity = 6 const EnableAccess = 1 const EnterNotify = 7 const EvenOddRule = 0 const Expose = 12 const FD_SETSIZE = 1024 const FILENAME_MAX = 4096 const FOPEN_MAX = 1000 const FUNCPROTO = 15 const F_LOCK = 1 const F_OK = 0 const F_TEST = 3 const F_TLOCK = 2 const F_ULOCK = 0 const False = 0 const FamilyChaos = 2 const FamilyDECnet = 1 const FamilyInternet = 0 const FamilyInternet6 = 6 const FamilyServerInterpreted = 5 const FillOpaqueStippled = 3 const FillSolid = 0 const FillStippled = 2 const FillTiled = 1 const FirstExtensionError = 128 const FocusIn = 9 const FocusOut = 10 const FontChange = 255 const FontLeftToRight = 0 const FontRightToLeft = 1 const ForgetGravity = 0 const GCLastBit = 22 const GXand = 0x1 const GXandInverted = 0x4 const GXandReverse = 0x2 const GXclear = 0x0 const GXcopy = 0x3 const GXcopyInverted = 0xc const GXequiv = 0x9 const GXinvert = 0xa const GXnand = 0xe const GXnoop = 0x5 const GXnor = 0x8 const GXor = 0x7 const GXorInverted = 0xd const GXorReverse = 0xb const GXset = 0xf const GXxor = 0x6 const GenericEvent = 35 const GrabFrozen = 4 const GrabInvalidTime = 2 const GrabModeAsync = 1 const GrabModeSync = 0 const GrabNotViewable = 3 const GrabSuccess = 0 const GraphicsExpose = 13 const GravityNotify = 24 const GrayScale = 1 const HAVE_CAST_TO_UNION = 1 const HAVE_FORMAT_VERSION3 = 1 const HAVE_HIDDEN = 1 const HAVE_INTTYPES_H = 1 const HAVE_LSEEK64 = 1 const HAVE_OPEN64 = 1 const HAVE_STDBOOL_H = 1 const HAVE_STDINT_H = 1 const HAVE_STDIO_H = 1 const HAVE_STDLIB_H = 1 const HAVE_STRINGS_H = 1 const HAVE_STRING_H = 1 const HAVE_SYS_STAT_H = 1 const HAVE_SYS_TYPES_H = 1 const HAVE_UNISTD_H = 1 const HostDelete = 1 const HostInsert = 0 const IMG_DEFAULT_DPI = 0 const IMG_GAMMA_TABLE_SIZE = 257 const IMG_MAP_AGC = 2 const IMG_MAP_AGC_STR = "agc" const IMG_MAP_MINMAX = 1 const IMG_MAP_MINMAX_STR = "minmax" const IMG_MAP_NONE = 0 const IMG_MAP_NONE_STR = "none" const IMG_MAX_CHANNELS = 4 const IncludeInferiors = 1 const InputFocus = 1 const InputOnly = 2 const InputOutput = 1 const IsUnmapped = 0 const IsUnviewable = 1 const IsViewable = 2 const JoinBevel = 2 const JoinMiter = 0 const JoinRound = 1 const KeyPress = 2 const KeyRelease = 3 const KeymapNotify = 11 const LASTEvent = 36 const LITTLE_ENDIAN = "__LITTLE_ENDIAN" const LSBFirst = 0 const L_INCR = 1 const L_SET = 0 const L_XTND = 2 const L_ctermid = 20 const L_cuserid = 20 const L_tmpnam = 20 const LastExtensionError = 255 const LeaveNotify = 8 const LedModeOff = 0 const LedModeOn = 1 const LineDoubleDash = 2 const LineOnOffDash = 1 const LineSolid = 0 const LockMapIndex = 1 const LowerHighest = 1 const MSBFirst = 1 const MapNotify = 19 const MapRequest = 20 const MappingBusy = 1 const MappingFailed = 2 const MappingKeyboard = 1 const MappingModifier = 0 const MappingNotify = 34 const MappingPointer = 2 const MappingSuccess = 0 const Mod1MapIndex = 3 const Mod2MapIndex = 4 const Mod3MapIndex = 5 const Mod4MapIndex = 6 const Mod5MapIndex = 7 const MotionNotify = 6 const NDEBUG = 1 const NUM_STATIC_TOKENS = 20 const NeedFunctionPrototypes = 1 const NeedNestedPrototypes = 1 const NeedVarargsPrototypes = 1 const NeedWidePrototypes = 0 const NoEventMask = 0 const NoExpose = 14 const NoSymbol = 0 const Nonconvex = 1 const None = 0 const NorthEastGravity = 3 const NorthGravity = 2 const NorthWestGravity = 1 const NotUseful = 0 const NotifyAncestor = 0 const NotifyDetailNone = 7 const NotifyGrab = 1 const NotifyHint = 1 const NotifyInferior = 2 const NotifyNonlinear = 3 const NotifyNonlinearVirtual = 4 const NotifyNormal = 0 const NotifyPointer = 5 const NotifyPointerRoot = 6 const NotifyUngrab = 2 const NotifyVirtual = 1 const NotifyWhileGrabbed = 3 const Opposite = 4 const PACKAGE_BUGREPORT = "" const PACKAGE_NAME = "tkimg" const PACKAGE_STRING = "tkimg 2.0.1" const PACKAGE_TARNAME = "tkimg" const PACKAGE_TCLNAME = "img::base" const PACKAGE_URL = "" const PACKAGE_VERSION = "2.0.1" const PDP_ENDIAN = "__PDP_ENDIAN" const POSIX_CLOSE_RESTART = 0 const P_tmpdir = "/tmp" const ParentRelative = 1 const PlaceOnBottom = 1 const PlaceOnTop = 0 const PointerRoot = 1 const PointerWindow = 0 const PreferBlanking = 1 const PropModeAppend = 2 const PropModePrepend = 1 const PropModeReplace = 0 const PropertyDelete = 1 const PropertyNewValue = 0 const PropertyNotify = 28 const PseudoColor = 3 const QueuedAfterFlush = 2 const QueuedAfterReading = 1 const QueuedAlready = 0 const RAND_MAX = 0x7fffffff const READBUFLEN = 512 const R_OK = 4 const RaiseLowest = 0 const ReparentNotify = 21 const ReplayKeyboard = 5 const ReplayPointer = 2 const ResizeRequest = 25 const RetainPermanent = 1 const RetainTemporary = 2 const RevertToParent = 2 const SEEK_DATA = 3 const SEEK_HOLE = 4 const STDC_HEADERS = 1 const STDERR_FILENO = 2 const STDIN_FILENO = 0 const STDOUT_FILENO = 1 const ScreenSaverActive = 1 const ScreenSaverReset = 0 const SelectionClear = 29 const SelectionNotify = 31 const SelectionRequest = 30 const SetModeDelete = 1 const SetModeInsert = 0 const ShiftMapIndex = 0 const SouthEastGravity = 9 const SouthGravity = 8 const SouthWestGravity = 7 const StaticColor = 2 const StaticGravity = 10 const StaticGray = 0 const Status = "int" const StippleShape = 2 const Success = 0 const SyncBoth = 7 const SyncKeyboard = 4 const SyncPointer = 1 const TCL_ALLOW_INLINE_COMPILATION = 0x20000 const TCL_ALPHA_RELEASE = 0 const TCL_APPEND_VALUE = 4 const TCL_ARGV_CONSTANT = 15 const TCL_ARGV_END = 23 const TCL_ARGV_FLOAT = 19 const TCL_ARGV_FUNC = 20 const TCL_ARGV_GENFUNC = 21 const TCL_ARGV_HELP = 22 const TCL_ARGV_INT = 16 const TCL_ARGV_REST = 18 const TCL_ARGV_STRING = 17 const TCL_BETA_RELEASE = 1 const TCL_BREAK = 3 const TCL_CANCEL_UNWIND = 0x100000 const TCL_CFG_OPTIMIZED = 1 const TCL_CHANNEL_THREAD_INSERT = 0 const TCL_CHANNEL_THREAD_REMOVE = 1 const TCL_CLOSE2PROC = "NULL" const TCL_CODE_USER_MAX = 0x3fffffff const TCL_CODE_USER_MIN = 5 const TCL_COMBINE = 0x1000000 const TCL_CONTINUE = 4 const TCL_CREATE_HARD_LINK = 0x02 const TCL_CREATE_SYMBOLIC_LINK = 0x01 const TCL_DONT_QUOTE_HASH = 8 const TCL_DONT_USE_BRACES = 1 const TCL_DSTRING_STATIC_SIZE = 200 const TCL_ENCODING_CHAR_LIMIT = 0x10 const TCL_ENCODING_END = 0x02 const TCL_ENCODING_INTERNAL_USE_MASK = 0xFF00 const TCL_ENCODING_NO_TERMINATE = 0x08 const TCL_ENCODING_PROFILE_REPLACE = 0x02000000 const TCL_ENCODING_PROFILE_STRICT = "TCL_ENCODING_STOPONERROR" const TCL_ENCODING_PROFILE_TCL8 = 0x01000000 const TCL_ENCODING_START = 0x01 const TCL_ENCODING_STOPONERROR = 0x0 const TCL_ENSEMBLE_PREFIX = 0x02 const TCL_ERROR = 1 const TCL_EVAL_DIRECT = 0x040000 const TCL_EVAL_GLOBAL = 0x020000 const TCL_EVAL_INVOKE = 0x080000 const TCL_EVAL_NOERR = 0x200000 const TCL_EXACT = 1 const TCL_FINAL_RELEASE = 2 const TCL_GLOBAL_ONLY = 1 const TCL_HASH_KEY_DIRECT_COMPARE = 0x4 const TCL_HASH_KEY_RANDOMIZE_HASH = 0x1 const TCL_HASH_KEY_SYSTEM_HASH = 0x2 const TCL_HASH_KEY_TYPE_VERSION = 1 const TCL_HASH_TYPE = "size_t" const TCL_INDEX_TEMP_TABLE = 64 const TCL_LEAVE_ERR_MSG = 0x200 const TCL_LIMIT_COMMANDS = 0x01 const TCL_LIMIT_TIME = 0x02 const TCL_LINK_BINARY = 16 const TCL_LINK_BOOLEAN = 3 const TCL_LINK_CHAR = 6 const TCL_LINK_CHARS = 15 const TCL_LINK_DOUBLE = 2 const TCL_LINK_FLOAT = 13 const TCL_LINK_INT = 1 const TCL_LINK_READ_ONLY = 0x80 const TCL_LINK_SHORT = 8 const TCL_LINK_STRING = 4 const TCL_LINK_UCHAR = 7 const TCL_LINK_UINT = 10 const TCL_LINK_USHORT = 9 const TCL_LINK_WIDE_INT = 5 const TCL_LINK_WIDE_UINT = 14 const TCL_LIST_ELEMENT = 8 const TCL_LL_MODIFIER = "ll" const TCL_LOAD_GLOBAL = 1 const TCL_LOAD_LAZY = 2 const TCL_MAJOR_VERSION = 9 const TCL_MAX_PREC = 17 const TCL_MINOR_VERSION = 0 const TCL_MODE_BLOCKING = 0 const TCL_MODE_NONBLOCKING = 1 const TCL_NAMESPACE_ONLY = 2 const TCL_NO_EVAL = 0x010000 const TCL_NULL_OK = 32 const TCL_NUMBER_BIG = 3 const TCL_NUMBER_DOUBLE = 4 const TCL_NUMBER_INT = 2 const TCL_NUMBER_NAN = 5 const TCL_OK = 0 const TCL_ONE_WORD_KEYS = 1 const TCL_PARSE_BAD_NUMBER = 9 const TCL_PARSE_BRACE_EXTRA = 2 const TCL_PARSE_MISSING_BRACE = 3 const TCL_PARSE_MISSING_BRACKET = 4 const TCL_PARSE_MISSING_PAREN = 5 const TCL_PARSE_MISSING_QUOTE = 6 const TCL_PARSE_MISSING_VAR_BRACE = 7 const TCL_PARSE_QUOTE_EXTRA = 1 const TCL_PARSE_SUCCESS = 0 const TCL_PARSE_SYNTAX = 8 const TCL_PATCH_LEVEL = "9.0.1" const TCL_REG_ADVANCED = 000003 const TCL_REG_ADVF = 000002 const TCL_REG_BASIC = 000000 const TCL_REG_CANMATCH = 001000 const TCL_REG_EXPANDED = 000040 const TCL_REG_EXTENDED = 000001 const TCL_REG_NEWLINE = 000300 const TCL_REG_NLANCH = 000200 const TCL_REG_NLSTOP = 000100 const TCL_REG_NOCASE = 000010 const TCL_REG_NOSUB = 000020 const TCL_REG_NOTBOL = 0001 const TCL_REG_NOTEOL = 0002 const TCL_REG_QUOTE = 000004 const TCL_RELEASE_LEVEL = "TCL_FINAL_RELEASE" const TCL_RELEASE_SERIAL = 1 const TCL_RETURN = 2 const TCL_SERVICE_ALL = 1 const TCL_SERVICE_NONE = 0 const TCL_SIZE_MODIFIER = "TCL_T_MODIFIER" const TCL_SMALL_HASH_TABLE = 4 const TCL_STRING_KEYS = 0 const TCL_SUBST_ALL = 007 const TCL_SUBST_BACKSLASHES = 004 const TCL_SUBST_COMMANDS = 001 const TCL_SUBST_VARIABLES = 002 const TCL_THREADS = 1 const TCL_THREAD_JOINABLE = 0001 const TCL_THREAD_NOFLAGS = 0000 const TCL_THREAD_STACK_DEFAULT = 0 const TCL_TOKEN_BS = 8 const TCL_TOKEN_COMMAND = 16 const TCL_TOKEN_EXPAND_WORD = 256 const TCL_TOKEN_OPERATOR = 128 const TCL_TOKEN_SIMPLE_WORD = 2 const TCL_TOKEN_SUB_EXPR = 64 const TCL_TOKEN_TEXT = 4 const TCL_TOKEN_VARIABLE = 32 const TCL_TOKEN_WORD = 1 const TCL_TRACE_ARRAY = 0x800 const TCL_TRACE_DELETE = 0x4000 const TCL_TRACE_DESTROYED = 0x80 const TCL_TRACE_READS = 0x10 const TCL_TRACE_RENAME = 0x2000 const TCL_TRACE_RESULT_DYNAMIC = 0x8000 const TCL_TRACE_RESULT_OBJECT = 0x10000 const TCL_TRACE_UNSETS = 0x40 const TCL_TRACE_WRITES = 0x20 const TCL_T_MODIFIER = "t" const TCL_UTF_MAX = 4 const TCL_VERSION = "9.0" const TCL_ZLIB_COMPRESS_BEST = 9 const TCL_ZLIB_COMPRESS_FAST = 1 const TCL_ZLIB_COMPRESS_NONE = 0 const TCL_ZLIB_FINALIZE = 4 const TCL_ZLIB_FLUSH = 2 const TCL_ZLIB_FORMAT_AUTO = 8 const TCL_ZLIB_FORMAT_GZIP = 4 const TCL_ZLIB_FORMAT_RAW = 1 const TCL_ZLIB_FORMAT_ZLIB = 2 const TCL_ZLIB_FULLFLUSH = 3 const TCL_ZLIB_NO_FLUSH = 0 const TCL_ZLIB_STREAM_DEFLATE = 16 const TCL_ZLIB_STREAM_INFLATE = 32 const TCL_Z_MODIFIER = "z" const TKIMGAPI = "MODULE_SCOPE" const TK_3D_DARK_GC = 3 const TK_3D_FLAT_GC = 1 const TK_3D_LIGHT_GC = 2 const TK_ALREADY_DEAD = 4 const TK_ALWAYS_REDRAW = 1 const TK_ANONYMOUS_WINDOW = 0x4000 const TK_ARGV_CONSTANT = 15 const TK_ARGV_CONST_OPTION = 24 const TK_ARGV_DONT_SKIP_FIRST_ARG = 0x8 const TK_ARGV_END = 27 const TK_ARGV_FLOAT = 20 const TK_ARGV_FUNC = 21 const TK_ARGV_GENFUNC = 22 const TK_ARGV_HELP = 23 const TK_ARGV_INT = 16 const TK_ARGV_NO_ABBREV = 0x4 const TK_ARGV_NO_DEFAULTS = 0x1 const TK_ARGV_NO_LEFTOVERS = 0x2 const TK_ARGV_OPTION_NAME_VALUE = 26 const TK_ARGV_OPTION_VALUE = 25 const TK_ARGV_REST = 19 const TK_ARGV_STRING = 17 const TK_ARGV_UID = 18 const TK_AT_LEAST_ONE = 2 const TK_BOTH_HALVES = 0x400 const TK_CAN_INPUT_TEXT = 0x100000 const TK_CHECKED_IC = 0x20 const TK_CONFIG_ARGV_ONLY = 1 const TK_CONFIG_NULL_OK = "TCL_NULL_OK" const TK_CONFIG_OBJS = 0x80 const TK_CONFIG_USER_BIT = 0x100 const TK_CONTAINER = 0x200 const TK_DONT_DESTROY_WINDOW = 0x40 const TK_EMBEDDED = 0x100 const TK_GRAB_FLAG = 0x10 const TK_HAS_WRAPPER = 0x8000 const TK_IGNORE_NEWLINES = 16 const TK_IGNORE_TABS = 8 const TK_INTERACTIVE_PRIO = 80 const TK_ISOLATE_END = 32 const TK_ITEM_DONT_REDRAW = 2 const TK_ITEM_STATE_DEPENDANT = 1 const TK_MAJOR_VERSION = 9 const TK_MAPPED = 1 const TK_MAX_PRIO = 100 const TK_MINOR_VERSION = 0 const TK_MOVABLE_POINTS = 2 const TK_NEED_CONFIG_NOTIFY = 8 const TK_NOTIFY_SHARE = 20 const TK_NUM_SAVED_OPTIONS = 20 const TK_OFFSET_BOTTOM = 128 const TK_OFFSET_CENTER = 8 const TK_OFFSET_INDEX = 1 const TK_OFFSET_LEFT = 4 const TK_OFFSET_MIDDLE = 64 const TK_OFFSET_RELATIVE = 2 const TK_OFFSET_RIGHT = 16 const TK_OFFSET_TOP = 32 const TK_OPTION_NULL_OK = "TCL_NULL_OK" const TK_PARTIAL_OK = 4 const TK_PATCH_LEVEL = "9.0.1" const TK_PHOTO_COMPOSITE_OVERLAY = 0 const TK_PHOTO_COMPOSITE_SET = 1 const TK_PROP_PROPCHANGE = 0x40000 const TK_RELEASE_LEVEL = "TCL_FINAL_RELEASE" const TK_RELEASE_SERIAL = 1 const TK_RELIEF_FLAT = 0 const TK_RELIEF_GROOVE = 1 const TK_RELIEF_RAISED = 2 const TK_RELIEF_RIDGE = 3 const TK_RELIEF_SOLID = 4 const TK_RELIEF_SUNKEN = 5 const TK_REPARENTED = 0x2000 const TK_SCROLL_ERROR = 4 const TK_SCROLL_MOVETO = 1 const TK_SCROLL_PAGES = 2 const TK_SCROLL_UNITS = 3 const TK_STARTUP_FILE_PRIO = 40 const TK_STYLE_VERSION = "TK_STYLE_VERSION_1" const TK_STYLE_VERSION_1 = 0x1 const TK_TAG_SPACE = 3 const TK_TOP_HIERARCHY = 0x20000 const TK_TOP_LEVEL = 2 const TK_USER_DEFAULT_PRIO = 60 const TK_VERSION = "9.0" const TK_WHOLE_WORDS = 1 const TK_WIDGET_DEFAULT_PRIO = 20 const TK_WIN_MANAGED = 0x10000 const TK_WM_COLORMAP_WINDOW = 0x80 const TK_WM_MANAGEABLE = 0x80000 const TK_WRAPPER = 0x1000 const TMP_MAX = 10000 const Tcl_CreateSlave = "Tcl_CreateChild" const Tcl_EncodingFreeProc = "Tcl_FreeProc" const Tcl_ExitProc = "Tcl_FreeProc" const Tcl_FSFreeInternalRepProc = "Tcl_FreeProc" const Tcl_FileFreeProc = "Tcl_FreeProc" const Tcl_GetMaster = "Tcl_GetParent" const Tcl_GetSlave = "Tcl_GetChild" const Tcl_LimitHandlerDeleteProc = "Tcl_FreeProc" const Tcl_PackageInitProc = "Tcl_LibraryInitProc" const Tcl_PackageUnloadProc = "Tcl_LibraryUnloadProc" const Tcl_StaticPackage = "Tcl_StaticLibrary" const Tcl_ThreadCreateType = "void" const TileShape = 1 const Tk_GeomLostSlaveProc = "Tk_GeomLostContentProc" const Tk_GetImageMasterData = "Tk_GetImageModelData" const Tk_ImageMaster = "Tk_ImageModel" const TopIf = 2 const True = 1 const TrueColor = 4 const USE_TCLOO_STUBS = 1 const USE_TCL_STUBS = 1 const USE_THREAD_ALLOC = 1 const USE_TK_STUBS = 1 const UnmapGravity = 0 const UnmapNotify = 18 const Unsorted = 0 const VisibilityFullyObscured = 2 const VisibilityNotify = 15 const VisibilityPartiallyObscured = 1 const VisibilityUnobscured = 0 const WNOHANG = 1 const WUNTRACED = 2 const W_OK = 2 const WestGravity = 4 const WhenMapped = 1 const WindingRule = 1 const XIMHotKeyStateOFF = 0x0002 const XIMHotKeyStateON = 0x0001 const XIMInitialState = 1 const XIMPreeditArea = 0x0001 const XIMPreeditCallbacks = 0x0002 const XIMPreeditEnable = 1 const XIMPreeditNone = 0x0010 const XIMPreeditNothing = 0x0008 const XIMPreeditPosition = 0x0004 const XIMPreeditUnKnown = 0 const XIMReverse = 1 const XIMStatusArea = 0x0100 const XIMStatusCallbacks = 0x0200 const XIMStatusNone = 0x0800 const XIMStatusNothing = 0x0400 const XIMStringConversionBottomEdge = 0x00000008 const XIMStringConversionBuffer = 0x0001 const XIMStringConversionChar = 0x0004 const XIMStringConversionConcealed = 0x00000010 const XIMStringConversionLeftEdge = 0x00000001 const XIMStringConversionLine = 0x0002 const XIMStringConversionRetrieval = 0x0002 const XIMStringConversionRightEdge = 0x00000002 const XIMStringConversionSubstitution = 0x0001 const XIMStringConversionTopEdge = 0x00000004 const XIMStringConversionWord = 0x0003 const XIMStringConversionWrapped = 0x00000020 const XLookupBoth = 4 const XLookupChars = 2 const XLookupKeySym = 3 const XLookupNone = 1 const XNArea = "area" const XNAreaNeeded = "areaNeeded" const XNBackground = "background" const XNBackgroundPixmap = "backgroundPixmap" const XNBaseFontName = "baseFontName" const XNClientWindow = "clientWindow" const XNColormap = "colorMap" const XNContextualDrawing = "contextualDrawing" const XNCursor = "cursor" const XNDefaultString = "defaultString" const XNDestroyCallback = "destroyCallback" const XNDirectionalDependentDrawing = "directionalDependentDrawing" const XNFilterEvents = "filterEvents" const XNFocusWindow = "focusWindow" const XNFontInfo = "fontInfo" const XNFontSet = "fontSet" const XNForeground = "foreground" const XNGeometryCallback = "geometryCallback" const XNHotKey = "hotKey" const XNHotKeyState = "hotKeyState" const XNInputStyle = "inputStyle" const XNLineSpace = "lineSpace" const XNMissingCharSet = "missingCharSet" const XNOMAutomatic = "omAutomatic" const XNOrientation = "orientation" const XNPreeditAttributes = "preeditAttributes" const XNPreeditCaretCallback = "preeditCaretCallback" const XNPreeditDoneCallback = "preeditDoneCallback" const XNPreeditDrawCallback = "preeditDrawCallback" const XNPreeditStartCallback = "preeditStartCallback" const XNPreeditState = "preeditState" const XNPreeditStateNotifyCallback = "preeditStateNotifyCallback" const XNQueryICValuesList = "queryICValuesList" const XNQueryIMValuesList = "queryIMValuesList" const XNQueryInputStyle = "queryInputStyle" const XNQueryOrientation = "queryOrientation" const XNR6PreeditCallback = "r6PreeditCallback" const XNRequiredCharSet = "requiredCharSet" const XNResetState = "resetState" const XNResourceClass = "resourceClass" const XNResourceName = "resourceName" const XNSeparatorofNestedList = "separatorofNestedList" const XNSpotLocation = "spotLocation" const XNStatusAttributes = "statusAttributes" const XNStatusDoneCallback = "statusDoneCallback" const XNStatusDrawCallback = "statusDrawCallback" const XNStatusStartCallback = "statusStartCallback" const XNStdColormap = "stdColorMap" const XNStringConversion = "stringConversion" const XNStringConversionCallback = "stringConversionCallback" const XNVaNestedList = "XNVaNestedList" const XNVisiblePosition = "visiblePosition" const XYBitmap = 0 const XYPixmap = 1 const X_HAVE_UTF8_STRING = 1 const X_OK = 1 const X_PROTOCOL = 11 const X_PROTOCOL_REVISION = 0 const XlibSpecificationRelease = 6 const YSorted = 1 const YXBanded = 3 const YXSorted = 2 const ZPixmap = 2 const _CS_GNU_LIBC_VERSION = 2 const _CS_GNU_LIBPTHREAD_VERSION = 3 const _CS_PATH = 0 const _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4 const _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116 const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117 const _CS_POSIX_V6_ILP32_OFF32_LIBS = 1118 const _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119 const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120 const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121 const _CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122 const _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123 const _CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124 const _CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125 const _CS_POSIX_V6_LP64_OFF64_LIBS = 1126 const _CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127 const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128 const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129 const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130 const _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131 const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1 const _CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132 const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133 const _CS_POSIX_V7_ILP32_OFF32_LIBS = 1134 const _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135 const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136 const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137 const _CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138 const _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139 const _CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140 const _CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141 const _CS_POSIX_V7_LP64_OFF64_LIBS = 1142 const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143 const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144 const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145 const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146 const _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147 const _CS_POSIX_V7_THREADS_CFLAGS = 1150 const _CS_POSIX_V7_THREADS_LDFLAGS = 1151 const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5 const _CS_V6_ENV = 1148 const _CS_V7_ENV = 1149 const _FILE_OFFSET_BITS = 64 const _GNU_SOURCE = 1 const _IOFBF = 0 const _IOLBF = 1 const _IONBF = 2 const _PC_2_SYMLINKS = 20 const _PC_ALLOC_SIZE_MIN = 18 const _PC_ASYNC_IO = 10 const _PC_CHOWN_RESTRICTED = 6 const _PC_FILESIZEBITS = 13 const _PC_LINK_MAX = 0 const _PC_MAX_CANON = 1 const _PC_MAX_INPUT = 2 const _PC_NAME_MAX = 3 const _PC_NO_TRUNC = 7 const _PC_PATH_MAX = 4 const _PC_PIPE_BUF = 5 const _PC_PRIO_IO = 11 const _PC_REC_INCR_XFER_SIZE = 14 const _PC_REC_MAX_XFER_SIZE = 15 const _PC_REC_MIN_XFER_SIZE = 16 const _PC_REC_XFER_ALIGN = 17 const _PC_SOCK_MAXBUF = 12 const _PC_SYMLINK_MAX = 19 const _PC_SYNC_IO = 9 const _PC_VDISABLE = 8 const _POSIX2_C_BIND = "_POSIX_VERSION" const _POSIX2_VERSION = "_POSIX_VERSION" const _POSIX_ADVISORY_INFO = "_POSIX_VERSION" const _POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION" const _POSIX_BARRIERS = "_POSIX_VERSION" const _POSIX_CHOWN_RESTRICTED = 1 const _POSIX_CLOCK_SELECTION = "_POSIX_VERSION" const _POSIX_CPUTIME = "_POSIX_VERSION" const _POSIX_FSYNC = "_POSIX_VERSION" const _POSIX_IPV6 = "_POSIX_VERSION" const _POSIX_JOB_CONTROL = 1 const _POSIX_MAPPED_FILES = "_POSIX_VERSION" const _POSIX_MEMLOCK = "_POSIX_VERSION" const _POSIX_MEMLOCK_RANGE = "_POSIX_VERSION" const _POSIX_MEMORY_PROTECTION = "_POSIX_VERSION" const _POSIX_MESSAGE_PASSING = "_POSIX_VERSION" const _POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION" const _POSIX_NO_TRUNC = 1 const _POSIX_RAW_SOCKETS = "_POSIX_VERSION" const _POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION" const _POSIX_REALTIME_SIGNALS = "_POSIX_VERSION" const _POSIX_REGEXP = 1 const _POSIX_SAVED_IDS = 1 const _POSIX_SEMAPHORES = "_POSIX_VERSION" const _POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION" const _POSIX_SHELL = 1 const _POSIX_SPAWN = "_POSIX_VERSION" const _POSIX_SPIN_LOCKS = "_POSIX_VERSION" const _POSIX_THREADS = "_POSIX_VERSION" const _POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION" const _POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION" const _POSIX_THREAD_CPUTIME = "_POSIX_VERSION" const _POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION" const _POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION" const _POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION" const _POSIX_TIMEOUTS = "_POSIX_VERSION" const _POSIX_TIMERS = "_POSIX_VERSION" const _POSIX_V6_ILP32_OFFBIG = 1 const _POSIX_V7_ILP32_OFFBIG = 1 const _POSIX_VDISABLE = 0 const _POSIX_VERSION = 200809 const _REDIR_TIME64 = 1 const _REENTRANT = 1 const _SC_2_CHAR_TERM = 95 const _SC_2_C_BIND = 47 const _SC_2_C_DEV = 48 const _SC_2_FORT_DEV = 49 const _SC_2_FORT_RUN = 50 const _SC_2_LOCALEDEF = 52 const _SC_2_PBS = 168 const _SC_2_PBS_ACCOUNTING = 169 const _SC_2_PBS_CHECKPOINT = 175 const _SC_2_PBS_LOCATE = 170 const _SC_2_PBS_MESSAGE = 171 const _SC_2_PBS_TRACK = 172 const _SC_2_SW_DEV = 51 const _SC_2_UPE = 97 const _SC_2_VERSION = 46 const _SC_ADVISORY_INFO = 132 const _SC_AIO_LISTIO_MAX = 23 const _SC_AIO_MAX = 24 const _SC_AIO_PRIO_DELTA_MAX = 25 const _SC_ARG_MAX = 0 const _SC_ASYNCHRONOUS_IO = 12 const _SC_ATEXIT_MAX = 87 const _SC_AVPHYS_PAGES = 86 const _SC_BARRIERS = 133 const _SC_BC_BASE_MAX = 36 const _SC_BC_DIM_MAX = 37 const _SC_BC_SCALE_MAX = 38 const _SC_BC_STRING_MAX = 39 const _SC_CHILD_MAX = 1 const _SC_CLK_TCK = 2 const _SC_CLOCK_SELECTION = 137 const _SC_COLL_WEIGHTS_MAX = 40 const _SC_CPUTIME = 138 const _SC_DELAYTIMER_MAX = 26 const _SC_EXPR_NEST_MAX = 42 const _SC_FSYNC = 15 const _SC_GETGR_R_SIZE_MAX = 69 const _SC_GETPW_R_SIZE_MAX = 70 const _SC_HOST_NAME_MAX = 180 const _SC_IOV_MAX = 60 const _SC_IPV6 = 235 const _SC_JOB_CONTROL = 7 const _SC_LINE_MAX = 43 const _SC_LOGIN_NAME_MAX = 71 const _SC_MAPPED_FILES = 16 const _SC_MEMLOCK = 17 const _SC_MEMLOCK_RANGE = 18 const _SC_MEMORY_PROTECTION = 19 const _SC_MESSAGE_PASSING = 20 const _SC_MINSIGSTKSZ = 249 const _SC_MONOTONIC_CLOCK = 149 const _SC_MQ_OPEN_MAX = 27 const _SC_MQ_PRIO_MAX = 28 const _SC_NGROUPS_MAX = 3 const _SC_NPROCESSORS_CONF = 83 const _SC_NPROCESSORS_ONLN = 84 const _SC_NZERO = 109 const _SC_OPEN_MAX = 4 const _SC_PAGESIZE = 30 const _SC_PAGE_SIZE = 30 const _SC_PASS_MAX = 88 const _SC_PHYS_PAGES = 85 const _SC_PRIORITIZED_IO = 13 const _SC_PRIORITY_SCHEDULING = 10 const _SC_RAW_SOCKETS = 236 const _SC_READER_WRITER_LOCKS = 153 const _SC_REALTIME_SIGNALS = 9 const _SC_REGEXP = 155 const _SC_RE_DUP_MAX = 44 const _SC_RTSIG_MAX = 31 const _SC_SAVED_IDS = 8 const _SC_SEMAPHORES = 21 const _SC_SEM_NSEMS_MAX = 32 const _SC_SEM_VALUE_MAX = 33 const _SC_SHARED_MEMORY_OBJECTS = 22 const _SC_SHELL = 157 const _SC_SIGQUEUE_MAX = 34 const _SC_SIGSTKSZ = 250 const _SC_SPAWN = 159 const _SC_SPIN_LOCKS = 154 const _SC_SPORADIC_SERVER = 160 const _SC_SS_REPL_MAX = 241 const _SC_STREAMS = 174 const _SC_STREAM_MAX = 5 const _SC_SYMLOOP_MAX = 173 const _SC_SYNCHRONIZED_IO = 14 const _SC_THREADS = 67 const _SC_THREAD_ATTR_STACKADDR = 77 const _SC_THREAD_ATTR_STACKSIZE = 78 const _SC_THREAD_CPUTIME = 139 const _SC_THREAD_DESTRUCTOR_ITERATIONS = 73 const _SC_THREAD_KEYS_MAX = 74 const _SC_THREAD_PRIORITY_SCHEDULING = 79 const _SC_THREAD_PRIO_INHERIT = 80 const _SC_THREAD_PRIO_PROTECT = 81 const _SC_THREAD_PROCESS_SHARED = 82 const _SC_THREAD_ROBUST_PRIO_INHERIT = 247 const _SC_THREAD_ROBUST_PRIO_PROTECT = 248 const _SC_THREAD_SAFE_FUNCTIONS = 68 const _SC_THREAD_SPORADIC_SERVER = 161 const _SC_THREAD_STACK_MIN = 75 const _SC_THREAD_THREADS_MAX = 76 const _SC_TIMEOUTS = 164 const _SC_TIMERS = 11 const _SC_TIMER_MAX = 35 const _SC_TRACE = 181 const _SC_TRACE_EVENT_FILTER = 182 const _SC_TRACE_EVENT_NAME_MAX = 242 const _SC_TRACE_INHERIT = 183 const _SC_TRACE_LOG = 184 const _SC_TRACE_NAME_MAX = 243 const _SC_TRACE_SYS_MAX = 244 const _SC_TRACE_USER_EVENT_MAX = 245 const _SC_TTY_NAME_MAX = 72 const _SC_TYPED_MEMORY_OBJECTS = 165 const _SC_TZNAME_MAX = 6 const _SC_UIO_MAXIOV = 60 const _SC_V6_ILP32_OFF32 = 176 const _SC_V6_ILP32_OFFBIG = 177 const _SC_V6_LP64_OFF64 = 178 const _SC_V6_LPBIG_OFFBIG = 179 const _SC_V7_ILP32_OFF32 = 237 const _SC_V7_ILP32_OFFBIG = 238 const _SC_V7_LP64_OFF64 = 239 const _SC_V7_LPBIG_OFFBIG = 240 const _SC_VERSION = 29 const _SC_XBS5_ILP32_OFF32 = 125 const _SC_XBS5_ILP32_OFFBIG = 126 const _SC_XBS5_LP64_OFF64 = 127 const _SC_XBS5_LPBIG_OFFBIG = 128 const _SC_XOPEN_CRYPT = 92 const _SC_XOPEN_ENH_I18N = 93 const _SC_XOPEN_LEGACY = 129 const _SC_XOPEN_REALTIME = 130 const _SC_XOPEN_REALTIME_THREADS = 131 const _SC_XOPEN_SHM = 94 const _SC_XOPEN_STREAMS = 246 const _SC_XOPEN_UNIX = 91 const _SC_XOPEN_VERSION = 89 const _SC_XOPEN_XCU_VERSION = 90 const _SC_XOPEN_XPG2 = 98 const _SC_XOPEN_XPG3 = 99 const _SC_XOPEN_XPG4 = 100 const _STDC_PREDEF_H = 1 const _THREAD_SAFE = 1 const _TIME_BITS = 64 const _XOPEN_ENH_I18N = 1 const _XOPEN_UNIX = 1 const _XOPEN_VERSION = 700 const _X_INLINE = "inline" const _X_RESTRICT_KYWD = "restrict" const _Xconst = "const" const __ACCUM_EPSILON__ = "0x1P-15K" const __ACCUM_FBIT__ = 15 const __ACCUM_IBIT__ = 16 const __ACCUM_MAX__ = "0X7FFFFFFFP-15K" const __APCS_32__ = 1 const __ARMEL__ = 1 const __ARM_32BIT_STATE = 1 const __ARM_ARCH = 6 const __ARM_ARCH_6__ = 1 const __ARM_ARCH_ISA_ARM = 1 const __ARM_ARCH_ISA_THUMB = 1 const __ARM_EABI__ = 1 const __ARM_FEATURE_CLZ = 1 const __ARM_FEATURE_COPROC = 15 const __ARM_FEATURE_DSP = 1 const __ARM_FEATURE_LDREX = 4 const __ARM_FEATURE_QBIT = 1 const __ARM_FEATURE_SAT = 1 const __ARM_FEATURE_SIMD32 = 1 const __ARM_FEATURE_UNALIGNED = 1 const __ARM_FP = 12 const __ARM_PCS_VFP = 1 const __ARM_SIZEOF_MINIMAL_ENUM = 4 const __ARM_SIZEOF_WCHAR_T = 4 const __ATOMIC_ACQUIRE = 2 const __ATOMIC_ACQ_REL = 4 const __ATOMIC_CONSUME = 1 const __ATOMIC_RELAXED = 0 const __ATOMIC_RELEASE = 3 const __ATOMIC_SEQ_CST = 5 const __BIGGEST_ALIGNMENT__ = 8 const __BIG_ENDIAN = 4321 const __BYTE_ORDER = 1234 const __BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__" const __CCGO__ = 1 const __CHAR_BIT__ = 8 const __CHAR_UNSIGNED__ = 1 const __DA_FBIT__ = 31 const __DA_IBIT__ = 32 const __DBL_DECIMAL_DIG__ = 17 const __DBL_DIG__ = 15 const __DBL_HAS_DENORM__ = 1 const __DBL_HAS_INFINITY__ = 1 const __DBL_HAS_QUIET_NAN__ = 1 const __DBL_IS_IEC_60559__ = 2 const __DBL_MANT_DIG__ = 53 const __DBL_MAX_10_EXP__ = 308 const __DBL_MAX_EXP__ = 1024 const __DECIMAL_DIG__ = 17 const __DEC_EVAL_METHOD__ = 2 const __DQ_FBIT__ = 63 const __DQ_IBIT__ = 0 const __ELF__ = 1 const __FINITE_MATH_ONLY__ = 0 const __FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__" const __FLT32X_DECIMAL_DIG__ = 17 const __FLT32X_DENORM_MIN__ = 4.9406564584124654e-324 const __FLT32X_DIG__ = 15 const __FLT32X_EPSILON__ = 2.2204460492503131e-16 const __FLT32X_HAS_DENORM__ = 1 const __FLT32X_HAS_INFINITY__ = 1 const __FLT32X_HAS_QUIET_NAN__ = 1 const __FLT32X_IS_IEC_60559__ = 2 const __FLT32X_MANT_DIG__ = 53 const __FLT32X_MAX_10_EXP__ = 308 const __FLT32X_MAX_EXP__ = 1024 const __FLT32X_MAX__ = 1.7976931348623157e+308 const __FLT32X_MIN__ = 2.2250738585072014e-308 const __FLT32X_NORM_MAX__ = 1.7976931348623157e+308 const __FLT32_DECIMAL_DIG__ = 9 const __FLT32_DENORM_MIN__ = 1.4012984643248171e-45 const __FLT32_DIG__ = 6 const __FLT32_EPSILON__ = 1.1920928955078125e-7 const __FLT32_HAS_DENORM__ = 1 const __FLT32_HAS_INFINITY__ = 1 const __FLT32_HAS_QUIET_NAN__ = 1 const __FLT32_IS_IEC_60559__ = 2 const __FLT32_MANT_DIG__ = 24 const __FLT32_MAX_10_EXP__ = 38 const __FLT32_MAX_EXP__ = 128 const __FLT32_MAX__ = 3.4028234663852886e+38 const __FLT32_MIN__ = 1.1754943508222875e-38 const __FLT32_NORM_MAX__ = 3.4028234663852886e+38 const __FLT64_DECIMAL_DIG__ = 17 const __FLT64_DENORM_MIN__ = 4.9406564584124654e-324 const __FLT64_DIG__ = 15 const __FLT64_EPSILON__ = 2.2204460492503131e-16 const __FLT64_HAS_DENORM__ = 1 const __FLT64_HAS_INFINITY__ = 1 const __FLT64_HAS_QUIET_NAN__ = 1 const __FLT64_IS_IEC_60559__ = 2 const __FLT64_MANT_DIG__ = 53 const __FLT64_MAX_10_EXP__ = 308 const __FLT64_MAX_EXP__ = 1024 const __FLT64_MAX__ = 1.7976931348623157e+308 const __FLT64_MIN__ = 2.2250738585072014e-308 const __FLT64_NORM_MAX__ = 1.7976931348623157e+308 const __FLT_DECIMAL_DIG__ = 9 const __FLT_DENORM_MIN__ = 1.4012984643248171e-45 const __FLT_DIG__ = 6 const __FLT_EPSILON__ = 1.1920928955078125e-7 const __FLT_EVAL_METHOD_TS_18661_3__ = 0 const __FLT_EVAL_METHOD__ = 0 const __FLT_HAS_DENORM__ = 1 const __FLT_HAS_INFINITY__ = 1 const __FLT_HAS_QUIET_NAN__ = 1 const __FLT_IS_IEC_60559__ = 2 const __FLT_MANT_DIG__ = 24 const __FLT_MAX_10_EXP__ = 38 const __FLT_MAX_EXP__ = 128 const __FLT_MAX__ = 3.4028234663852886e+38 const __FLT_MIN__ = 1.1754943508222875e-38 const __FLT_NORM_MAX__ = 3.4028234663852886e+38 const __FLT_RADIX__ = 2 const __FRACT_EPSILON__ = "0x1P-15R" const __FRACT_FBIT__ = 15 const __FRACT_IBIT__ = 0 const __FRACT_MAX__ = "0X7FFFP-15R" const __FUNCTION__ = "__func__" const __GCC_ASM_FLAG_OUTPUTS__ = 1 const __GCC_ATOMIC_BOOL_LOCK_FREE = 1 const __GCC_ATOMIC_CHAR16_T_LOCK_FREE = 1 const __GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2 const __GCC_ATOMIC_CHAR_LOCK_FREE = 1 const __GCC_ATOMIC_INT_LOCK_FREE = 2 const __GCC_ATOMIC_LLONG_LOCK_FREE = 1 const __GCC_ATOMIC_LONG_LOCK_FREE = 2 const __GCC_ATOMIC_POINTER_LOCK_FREE = 2 const __GCC_ATOMIC_SHORT_LOCK_FREE = 1 const __GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1 const __GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2 const __GCC_CONSTRUCTIVE_SIZE = 64 const __GCC_DESTRUCTIVE_SIZE = 64 const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1 const __GCC_IEC_559 = 2 const __GCC_IEC_559_COMPLEX = 2 const __GNUC_EXECUTION_CHARSET_NAME = "UTF-8" const __GNUC_MINOR__ = 2 const __GNUC_PATCHLEVEL__ = 0 const __GNUC_STDC_INLINE__ = 1 const __GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE" const __GNUC__ = 12 const __GXX_ABI_VERSION = 1017 const __GXX_TYPEINFO_EQUALITY_INLINE = 0 const __HAVE_SPECULATION_SAFE_VALUE = 1 const __HA_FBIT__ = 7 const __HA_IBIT__ = 8 const __HQ_FBIT__ = 15 const __HQ_IBIT__ = 0 const __INT16_MAX__ = 0x7fff const __INT32_MAX__ = 0x7fffffff const __INT32_TYPE__ = "int" const __INT64_MAX__ = 0x7fffffffffffffff const __INT8_MAX__ = 0x7f const __INTMAX_MAX__ = 0x7fffffffffffffff const __INTMAX_WIDTH__ = 64 const __INTPTR_MAX__ = 0x7fffffff const __INTPTR_TYPE__ = "int" const __INTPTR_WIDTH__ = 32 const __INT_FAST16_MAX__ = 0x7fffffff const __INT_FAST16_TYPE__ = "int" const __INT_FAST16_WIDTH__ = 32 const __INT_FAST32_MAX__ = 0x7fffffff const __INT_FAST32_TYPE__ = "int" const __INT_FAST32_WIDTH__ = 32 const __INT_FAST64_MAX__ = 0x7fffffffffffffff const __INT_FAST64_WIDTH__ = 64 const __INT_FAST8_MAX__ = 0x7f const __INT_FAST8_WIDTH__ = 8 const __INT_LEAST16_MAX__ = 0x7fff const __INT_LEAST16_WIDTH__ = 16 const __INT_LEAST32_MAX__ = 0x7fffffff const __INT_LEAST32_TYPE__ = "int" const __INT_LEAST32_WIDTH__ = 32 const __INT_LEAST64_MAX__ = 0x7fffffffffffffff const __INT_LEAST64_WIDTH__ = 64 const __INT_LEAST8_MAX__ = 0x7f const __INT_LEAST8_WIDTH__ = 8 const __INT_MAX__ = 0x7fffffff const __INT_WIDTH__ = 32 const __LACCUM_EPSILON__ = "0x1P-31LK" const __LACCUM_FBIT__ = 31 const __LACCUM_IBIT__ = 32 const __LACCUM_MAX__ = "0X7FFFFFFFFFFFFFFFP-31LK" const __LDBL_DECIMAL_DIG__ = 17 const __LDBL_DENORM_MIN__ = 4.9406564584124654e-324 const __LDBL_DIG__ = 15 const __LDBL_EPSILON__ = 2.2204460492503131e-16 const __LDBL_HAS_DENORM__ = 1 const __LDBL_HAS_INFINITY__ = 1 const __LDBL_HAS_QUIET_NAN__ = 1 const __LDBL_IS_IEC_60559__ = 2 const __LDBL_MANT_DIG__ = 53 const __LDBL_MAX_10_EXP__ = 308 const __LDBL_MAX_EXP__ = 1024 const __LDBL_MAX__ = 1.7976931348623157e+308 const __LDBL_MIN__ = 2.2250738585072014e-308 const __LDBL_NORM_MAX__ = 1.7976931348623157e+308 const __LFRACT_EPSILON__ = "0x1P-31LR" const __LFRACT_FBIT__ = 31 const __LFRACT_IBIT__ = 0 const __LFRACT_MAX__ = "0X7FFFFFFFP-31LR" const __LITTLE_ENDIAN = 1234 const __LLACCUM_EPSILON__ = "0x1P-31LLK" const __LLACCUM_FBIT__ = 31 const __LLACCUM_IBIT__ = 32 const __LLACCUM_MAX__ = "0X7FFFFFFFFFFFFFFFP-31LLK" const __LLFRACT_EPSILON__ = "0x1P-63LLR" const __LLFRACT_FBIT__ = 63 const __LLFRACT_IBIT__ = 0 const __LLFRACT_MAX__ = "0X7FFFFFFFFFFFFFFFP-63LLR" const __LONG_LONG_MAX__ = 0x7fffffffffffffff const __LONG_LONG_WIDTH__ = 64 const __LONG_MAX = 0x7fffffff const __LONG_MAX__ = 0x7fffffff const __LONG_WIDTH__ = 32 const __OPTIMIZE__ = 1 const __ORDER_BIG_ENDIAN__ = 4321 const __ORDER_LITTLE_ENDIAN__ = 1234 const __ORDER_PDP_ENDIAN__ = 3412 const __PDP_ENDIAN = 3412 const __PRAGMA_REDEFINE_EXTNAME = 1 const __PRETTY_FUNCTION__ = "__func__" const __PTRDIFF_MAX__ = 0x7fffffff const __PTRDIFF_TYPE__ = "int" const __PTRDIFF_WIDTH__ = 32 const __QQ_FBIT__ = 7 const __QQ_IBIT__ = 0 const __SACCUM_EPSILON__ = "0x1P-7HK" const __SACCUM_FBIT__ = 7 const __SACCUM_IBIT__ = 8 const __SACCUM_MAX__ = "0X7FFFP-7HK" const __SA_FBIT__ = 15 const __SA_IBIT__ = 16 const __SCHAR_MAX__ = 0x7f const __SCHAR_WIDTH__ = 8 const __SFRACT_EPSILON__ = "0x1P-7HR" const __SFRACT_FBIT__ = 7 const __SFRACT_IBIT__ = 0 const __SFRACT_MAX__ = "0X7FP-7HR" const __SHRT_MAX__ = 0x7fff const __SHRT_WIDTH__ = 16 const __SIG_ATOMIC_MAX__ = 0x7fffffff const __SIG_ATOMIC_TYPE__ = "int" const __SIG_ATOMIC_WIDTH__ = 32 const __SIZEOF_DOUBLE__ = 8 const __SIZEOF_FLOAT__ = 4 const __SIZEOF_INT__ = 4 const __SIZEOF_LONG_DOUBLE__ = 8 const __SIZEOF_LONG_LONG__ = 8 const __SIZEOF_LONG__ = 4 const __SIZEOF_POINTER__ = 4 const __SIZEOF_PTRDIFF_T__ = 4 const __SIZEOF_SHORT__ = 2 const __SIZEOF_SIZE_T__ = 4 const __SIZEOF_WCHAR_T__ = 4 const __SIZEOF_WINT_T__ = 4 const __SIZE_MAX__ = 0xffffffff const __SIZE_WIDTH__ = 32 const __SQ_FBIT__ = 31 const __SQ_IBIT__ = 0 const __STDC_HOSTED__ = 1 const __STDC_IEC_559_COMPLEX__ = 1 const __STDC_IEC_559__ = 1 const __STDC_IEC_60559_BFP__ = 201404 const __STDC_IEC_60559_COMPLEX__ = 201404 const __STDC_ISO_10646__ = 201706 const __STDC_UTF_16__ = 1 const __STDC_UTF_32__ = 1 const __STDC_VERSION__ = 201710 const __STDC__ = 1 const __TA_FBIT__ = 63 const __TA_IBIT__ = 64 const __THUMB_INTERWORK__ = 1 const __TQ_FBIT__ = 127 const __TQ_IBIT__ = 0 const __UACCUM_EPSILON__ = "0x1P-16UK" const __UACCUM_FBIT__ = 16 const __UACCUM_IBIT__ = 16 const __UACCUM_MAX__ = "0XFFFFFFFFP-16UK" const __UACCUM_MIN__ = "0.0UK" const __UDA_FBIT__ = 32 const __UDA_IBIT__ = 32 const __UDQ_FBIT__ = 64 const __UDQ_IBIT__ = 0 const __UFRACT_EPSILON__ = "0x1P-16UR" const __UFRACT_FBIT__ = 16 const __UFRACT_IBIT__ = 0 const __UFRACT_MAX__ = "0XFFFFP-16UR" const __UFRACT_MIN__ = "0.0UR" const __UHA_FBIT__ = 8 const __UHA_IBIT__ = 8 const __UHQ_FBIT__ = 16 const __UHQ_IBIT__ = 0 const __UINT16_MAX__ = 0xffff const __UINT32_MAX__ = 0xffffffff const __UINT64_MAX__ = "0xffffffffffffffffU" const __UINT8_MAX__ = 0xff const __UINTMAX_MAX__ = "0xffffffffffffffffU" const __UINTPTR_MAX__ = 0xffffffff const __UINT_FAST16_MAX__ = 0xffffffff const __UINT_FAST32_MAX__ = 0xffffffff const __UINT_FAST64_MAX__ = "0xffffffffffffffffU" const __UINT_FAST8_MAX__ = 0xff const __UINT_LEAST16_MAX__ = 0xffff const __UINT_LEAST32_MAX__ = 0xffffffff const __UINT_LEAST64_MAX__ = "0xffffffffffffffffU" const __UINT_LEAST8_MAX__ = 0xff const __ULACCUM_EPSILON__ = "0x1P-32ULK" const __ULACCUM_FBIT__ = 32 const __ULACCUM_IBIT__ = 32 const __ULACCUM_MAX__ = "0XFFFFFFFFFFFFFFFFP-32ULK" const __ULACCUM_MIN__ = "0.0ULK" const __ULFRACT_EPSILON__ = "0x1P-32ULR" const __ULFRACT_FBIT__ = 32 const __ULFRACT_IBIT__ = 0 const __ULFRACT_MAX__ = "0XFFFFFFFFP-32ULR" const __ULFRACT_MIN__ = "0.0ULR" const __ULLACCUM_EPSILON__ = "0x1P-32ULLK" const __ULLACCUM_FBIT__ = 32 const __ULLACCUM_IBIT__ = 32 const __ULLACCUM_MAX__ = "0XFFFFFFFFFFFFFFFFP-32ULLK" const __ULLACCUM_MIN__ = "0.0ULLK" const __ULLFRACT_EPSILON__ = "0x1P-64ULLR" const __ULLFRACT_FBIT__ = 64 const __ULLFRACT_IBIT__ = 0 const __ULLFRACT_MAX__ = "0XFFFFFFFFFFFFFFFFP-64ULLR" const __ULLFRACT_MIN__ = "0.0ULLR" const __UQQ_FBIT__ = 8 const __UQQ_IBIT__ = 0 const __USACCUM_EPSILON__ = "0x1P-8UHK" const __USACCUM_FBIT__ = 8 const __USACCUM_IBIT__ = 8 const __USACCUM_MAX__ = "0XFFFFP-8UHK" const __USACCUM_MIN__ = "0.0UHK" const __USA_FBIT__ = 16 const __USA_IBIT__ = 16 const __USE_TIME_BITS64 = 1 const __USFRACT_EPSILON__ = "0x1P-8UHR" const __USFRACT_FBIT__ = 8 const __USFRACT_IBIT__ = 0 const __USFRACT_MAX__ = "0XFFP-8UHR" const __USFRACT_MIN__ = "0.0UHR" const __USQ_FBIT__ = 32 const __USQ_IBIT__ = 0 const __UTA_FBIT__ = 64 const __UTA_IBIT__ = 64 const __UTQ_FBIT__ = 128 const __UTQ_IBIT__ = 0 const __VERSION__ = "12.2.0" const __VFP_FP__ = 1 const __WCHAR_MAX__ = 0xffffffff const __WCHAR_MIN__ = 0 const __WCHAR_WIDTH__ = 32 const __WINT_MAX__ = 0xffffffff const __WINT_MIN__ = 0 const __WINT_WIDTH__ = 32 const __arm__ = 1 const __gnu_linux__ = 1 const __inline = "inline" const __linux = 1 const __linux__ = 1 const __restrict = "restrict" const __restrict_arr = "restrict" const __unix = 1 const __unix__ = 1 const alloca = "__builtin_alloca" const attemptckalloc = "Tcl_AttemptAlloc" const attemptckrealloc = "Tcl_AttemptRealloc" const ckalloc = "Tcl_Alloc" const ckfree = "Tcl_Free" const ckrealloc = "Tcl_Realloc" const linux = 1 const tkimg_snprintf = "snprintf" const tkimg_vsnprintf = "vsnprintf" const unix = 1 type T__builtin_va_list = uintptr type T__predefined_size_t = uint32 type T__predefined_wchar_t = uint32 type T__predefined_ptrdiff_t = int32 type Tsize_t = uint32 type Tssize_t = int32 type Toff_t = int64 type Tva_list = uintptr type T__isoc_va_list = uintptr type Tfpos_t = struct { F__ccgo_align [0]uint32 F__lldata [0]int64 F__align [0]float64 F__opaque [16]uint8 } type T_G_fpos64_t = Tfpos_t type Tcookie_io_functions_t = struct { Fread uintptr Fwrite uintptr Fseek uintptr Fclose1 uintptr } type T_IO_cookie_io_functions_t = Tcookie_io_functions_t type Tlocale_t = uintptr type Twchar_t = uint32 type Tdiv_t = struct { Fquot int32 Frem int32 } type Tldiv_t = struct { Fquot int32 Frem int32 } type Tlldiv_t = struct { F__ccgo_align [0]uint32 Fquot int64 Frem int64 } type T__jmp_buf = [32]uint64 type Tjmp_buf = [1]T__jmp_buf_tag type T__jmp_buf_tag = struct { F__ccgo_align [0]uint32 F__jb T__jmp_buf F__fl uint32 F__ss [32]uint32 F__ccgo_pad3 [4]byte } type Tsigjmp_buf = [1]T__jmp_buf_tag type Tmax_align_t = struct { F__ccgo_align [0]uint32 F__ll int64 F__ld float64 } type Tptrdiff_t = int32 type TClientData = uintptr type TTcl_WideInt = int64 type TTcl_WideUInt = uint64 type TTcl_Size = int32 type TTcl_AsyncHandler = uintptr type TTcl_Channel = uintptr type TTcl_ChannelTypeVersion = uintptr type TTcl_Command = uintptr type TTcl_Condition = uintptr type TTcl_Dict = uintptr type TTcl_EncodingState = uintptr type TTcl_Encoding = uintptr type TTcl_Event = struct { Fproc uintptr FnextPtr uintptr } type TTcl_InterpState = uintptr type TTcl_LoadHandle = uintptr type TTcl_Mutex = uintptr type TTcl_Pid = uintptr type TTcl_RegExp = uintptr type TTcl_ThreadDataKey = uintptr type TTcl_ThreadId = uintptr type TTcl_TimerToken = uintptr type TTcl_Trace = uintptr type TTcl_Var = uintptr type TTcl_ZlibStream = uintptr type TTcl_RegExpIndices = struct { Fstart TTcl_Size Fend TTcl_Size } type TTcl_RegExpInfo = struct { Fnsubs TTcl_Size Fmatches uintptr FextendStart TTcl_Size } type TTcl_Stat_ = uintptr type TTcl_OldStat_ = uintptr type TTcl_Obj1 = struct { F__ccgo_align [0]uint32 FrefCount TTcl_Size Fbytes uintptr Flength TTcl_Size FtypePtr uintptr FinternalRep TTcl_ObjInternalRep } type TTcl_ObjType = struct { Fname uintptr FfreeIntRepProc uintptr FdupIntRepProc uintptr FupdateStringProc uintptr FsetFromAnyProc uintptr Fversion Tsize_t FlengthProc uintptr FindexProc uintptr FsliceProc uintptr FreverseProc uintptr FgetElementsProc uintptr FsetElementProc uintptr FreplaceProc uintptr FinOperProc uintptr } type TTcl_ObjInternalRep = struct { F__ccgo_align [0]uint32 FdoubleValue [0]float64 FotherValuePtr [0]uintptr FwideValue [0]TTcl_WideInt FtwoPtrValue [0]struct { Fptr1 uintptr Fptr2 uintptr } FptrAndLongRep [0]struct { Fptr uintptr Fvalue uint32 } FptrAndSize [0]struct { Fptr uintptr Fsize TTcl_Size } FlongValue int32 F__ccgo_pad7 [4]byte } type TTcl_Obj = struct { F__ccgo_align [0]uint32 FrefCount TTcl_Size Fbytes uintptr Flength TTcl_Size FtypePtr uintptr FinternalRep TTcl_ObjInternalRep } type TTcl_Namespace = struct { Fname uintptr FfullName uintptr FclientData uintptr FdeleteProc uintptr FparentPtr uintptr } type TTcl_CallFrame = struct { FnsPtr uintptr Fdummy1 int32 Fdummy2 TTcl_Size Fdummy3 uintptr Fdummy4 uintptr Fdummy5 uintptr Fdummy6 TTcl_Size Fdummy7 uintptr Fdummy8 uintptr Fdummy9 TTcl_Size Fdummy10 uintptr Fdummy11 uintptr Fdummy12 uintptr Fdummy13 uintptr } type TTcl_CmdInfo = struct { FisNativeObjectProc int32 FobjProc uintptr FobjClientData uintptr Fproc uintptr FclientData uintptr FdeleteProc uintptr FdeleteData uintptr FnamespacePtr uintptr FobjProc2 uintptr FobjClientData2 uintptr } type TTcl_DString = struct { Fstring1 uintptr Flength TTcl_Size FspaceAvl TTcl_Size FstaticSpace [200]uint8 } type TTcl_HashKeyType = struct { Fversion int32 Fflags int32 FhashKeyProc uintptr FcompareKeysProc uintptr FallocEntryProc uintptr FfreeEntryProc uintptr } type TTcl_HashTable = struct { Fbuckets uintptr FstaticBuckets [4]uintptr FnumBuckets TTcl_Size FnumEntries TTcl_Size FrebuildSize TTcl_Size Fmask Tsize_t FdownShift int32 FkeyType int32 FfindProc uintptr FcreateProc uintptr FtypePtr uintptr } type TTcl_HashEntry = struct { FnextPtr uintptr FtablePtr uintptr Fhash Tsize_t FclientData uintptr Fkey struct { FobjPtr [0]uintptr Fwords [0][1]int32 Fstring1 [0][1]uint8 FoneWordValue uintptr } } type TTcl_HashEntry1 = struct { FnextPtr uintptr FtablePtr uintptr Fhash Tsize_t FclientData uintptr Fkey struct { FobjPtr [0]uintptr Fwords [0][1]int32 Fstring1 [0][1]uint8 FoneWordValue uintptr } } type TTcl_HashKeyType1 = struct { Fversion int32 Fflags int32 FhashKeyProc uintptr FcompareKeysProc uintptr FallocEntryProc uintptr FfreeEntryProc uintptr } type TTcl_HashTable1 = struct { Fbuckets uintptr FstaticBuckets [4]uintptr FnumBuckets TTcl_Size FnumEntries TTcl_Size FrebuildSize TTcl_Size Fmask Tsize_t FdownShift int32 FkeyType int32 FfindProc uintptr FcreateProc uintptr FtypePtr uintptr } type TTcl_HashSearch = struct { FtablePtr uintptr FnextIndex TTcl_Size FnextEntryPtr uintptr } type TTcl_DictSearch = struct { Fnext uintptr Fepoch Tsize_t FdictionaryPtr TTcl_Dict } type TTcl_Event1 = struct { Fproc uintptr FnextPtr uintptr } type TTcl_QueuePosition = int32 const TCL_QUEUE_TAIL = 0 const TCL_QUEUE_HEAD = 1 const TCL_QUEUE_MARK = 2 const TCL_QUEUE_ALERT_IF_EMPTY = 4 type TTcl_Time = struct { F__ccgo_align [0]uint32 Fsec int64 Fusec int32 F__ccgo_pad2 [4]byte } type TTcl_DriverCloseProc = struct{} type TTcl_DriverSeekProc = struct{} type TTcl_ChannelType = struct { FtypeName uintptr Fversion TTcl_ChannelTypeVersion FcloseProc uintptr FinputProc uintptr FoutputProc uintptr FseekProc uintptr FsetOptionProc uintptr FgetOptionProc uintptr FwatchProc uintptr FgetHandleProc uintptr Fclose2Proc uintptr FblockModeProc uintptr FflushProc uintptr FhandlerProc uintptr FwideSeekProc uintptr FthreadActionProc uintptr FtruncateProc uintptr } type TTcl_PathType = int32 type Tcl_PathType = int32 const TCL_PATH_ABSOLUTE = 0 const TCL_PATH_RELATIVE = 1 const TCL_PATH_VOLUME_RELATIVE = 2 type TTcl_GlobTypeData = struct { Ftype1 int32 Fperm int32 FmacType uintptr FmacCreator uintptr } type TTcl_FSVersion = uintptr type TTcl_Filesystem = struct { FtypeName uintptr FstructureLength TTcl_Size Fversion TTcl_FSVersion FpathInFilesystemProc uintptr FdupInternalRepProc uintptr FfreeInternalRepProc uintptr FinternalToNormalizedProc uintptr FcreateInternalRepProc uintptr FnormalizePathProc uintptr FfilesystemPathTypeProc uintptr FfilesystemSeparatorProc uintptr FstatProc uintptr FaccessProc uintptr FopenFileChannelProc uintptr FmatchInDirectoryProc uintptr FutimeProc uintptr FlinkProc uintptr FlistVolumesProc uintptr FfileAttrStringsProc uintptr FfileAttrsGetProc uintptr FfileAttrsSetProc uintptr FcreateDirectoryProc uintptr FremoveDirectoryProc uintptr FdeleteFileProc uintptr FcopyFileProc uintptr FrenameFileProc uintptr FcopyDirectoryProc uintptr FlstatProc uintptr FloadFileProc uintptr FgetCwdProc uintptr FchdirProc uintptr } type TTcl_NotifierProcs = struct { FsetTimerProc uintptr FwaitForEventProc uintptr FcreateFileHandlerProc uintptr FdeleteFileHandlerProc uintptr FinitNotifierProc uintptr FfinalizeNotifierProc uintptr FalertNotifierProc uintptr FserviceModeHookProc uintptr } type TTcl_Token = struct { Ftype1 int32 Fstart uintptr Fsize TTcl_Size FnumComponents TTcl_Size } type TTcl_Parse = struct { FcommentStart uintptr FcommentSize TTcl_Size FcommandStart uintptr FcommandSize TTcl_Size FnumWords TTcl_Size FtokenPtr uintptr FnumTokens TTcl_Size FtokensAvailable TTcl_Size FerrorType int32 Fincomplete int32 Fstring1 uintptr Fend uintptr Finterp uintptr Fterm uintptr FstaticTokens [20]TTcl_Token } type TTcl_EncodingType = struct { FencodingName uintptr FtoUtfProc uintptr FfromUtfProc uintptr FfreeProc uintptr FclientData uintptr FnullSize TTcl_Size } type TTcl_UniChar = int32 type TTcl_Config = struct { Fkey uintptr Fvalue uintptr } type TTcl_ArgvInfo = struct { Ftype1 int32 FkeyStr uintptr FsrcPtr uintptr FdstPtr uintptr FhelpStr uintptr FclientData uintptr } type TTclStubHooks = struct { FtclPlatStubs uintptr FtclIntStubs uintptr FtclIntPlatStubs uintptr } type TTclStubs = struct { Fmagic int32 Fhooks uintptr Ftcl_PkgProvideEx uintptr Ftcl_PkgRequireEx uintptr Ftcl_Panic uintptr Ftcl_Alloc uintptr Ftcl_Free uintptr Ftcl_Realloc uintptr Ftcl_DbCkalloc uintptr Ftcl_DbCkfree uintptr Ftcl_DbCkrealloc uintptr Ftcl_CreateFileHandler uintptr Ftcl_DeleteFileHandler uintptr Ftcl_SetTimer uintptr Ftcl_Sleep uintptr Ftcl_WaitForEvent uintptr Ftcl_AppendAllObjTypes uintptr Ftcl_AppendStringsToObj uintptr Ftcl_AppendToObj uintptr Ftcl_ConcatObj uintptr Ftcl_ConvertToType uintptr Ftcl_DbDecrRefCount uintptr Ftcl_DbIncrRefCount uintptr Ftcl_DbIsShared uintptr Freserved22 uintptr Ftcl_DbNewByteArrayObj uintptr Ftcl_DbNewDoubleObj uintptr Ftcl_DbNewListObj uintptr Freserved26 uintptr Ftcl_DbNewObj uintptr Ftcl_DbNewStringObj uintptr Ftcl_DuplicateObj uintptr FtclFreeObj uintptr Ftcl_GetBoolean uintptr Ftcl_GetBooleanFromObj uintptr Ftcl_GetByteArrayFromObj uintptr Ftcl_GetDouble uintptr Ftcl_GetDoubleFromObj uintptr Freserved36 uintptr Ftcl_GetInt uintptr Ftcl_GetIntFromObj uintptr Ftcl_GetLongFromObj uintptr Ftcl_GetObjType uintptr FtclGetStringFromObj uintptr Ftcl_InvalidateStringRep uintptr Ftcl_ListObjAppendList uintptr Ftcl_ListObjAppendElement uintptr FtclListObjGetElements uintptr Ftcl_ListObjIndex uintptr FtclListObjLength uintptr Ftcl_ListObjReplace uintptr Freserved49 uintptr Ftcl_NewByteArrayObj uintptr Ftcl_NewDoubleObj uintptr Freserved52 uintptr Ftcl_NewListObj uintptr Freserved54 uintptr Ftcl_NewObj uintptr Ftcl_NewStringObj uintptr Freserved57 uintptr Ftcl_SetByteArrayLength uintptr Ftcl_SetByteArrayObj uintptr Ftcl_SetDoubleObj uintptr Freserved61 uintptr Ftcl_SetListObj uintptr Freserved63 uintptr Ftcl_SetObjLength uintptr Ftcl_SetStringObj uintptr Freserved66 uintptr Freserved67 uintptr Ftcl_AllowExceptions uintptr Ftcl_AppendElement uintptr Ftcl_AppendResult uintptr Ftcl_AsyncCreate uintptr Ftcl_AsyncDelete uintptr Ftcl_AsyncInvoke uintptr Ftcl_AsyncMark uintptr Ftcl_AsyncReady uintptr Freserved76 uintptr Freserved77 uintptr Ftcl_BadChannelOption uintptr Ftcl_CallWhenDeleted uintptr Ftcl_CancelIdleCall uintptr Ftcl_Close uintptr Ftcl_CommandComplete uintptr Ftcl_Concat uintptr Ftcl_ConvertElement uintptr Ftcl_ConvertCountedElement uintptr Ftcl_CreateAlias uintptr Ftcl_CreateAliasObj uintptr Ftcl_CreateChannel uintptr Ftcl_CreateChannelHandler uintptr Ftcl_CreateCloseHandler uintptr Ftcl_CreateCommand uintptr Ftcl_CreateEventSource uintptr Ftcl_CreateExitHandler uintptr Ftcl_CreateInterp uintptr Freserved95 uintptr Ftcl_CreateObjCommand uintptr Ftcl_CreateChild uintptr Ftcl_CreateTimerHandler uintptr Ftcl_CreateTrace uintptr Ftcl_DeleteAssocData uintptr Ftcl_DeleteChannelHandler uintptr Ftcl_DeleteCloseHandler uintptr Ftcl_DeleteCommand uintptr Ftcl_DeleteCommandFromToken uintptr Ftcl_DeleteEvents uintptr Ftcl_DeleteEventSource uintptr Ftcl_DeleteExitHandler uintptr Ftcl_DeleteHashEntry uintptr Ftcl_DeleteHashTable uintptr Ftcl_DeleteInterp uintptr Ftcl_DetachPids uintptr Ftcl_DeleteTimerHandler uintptr Ftcl_DeleteTrace uintptr Ftcl_DontCallWhenDeleted uintptr Ftcl_DoOneEvent uintptr Ftcl_DoWhenIdle uintptr Ftcl_DStringAppend uintptr Ftcl_DStringAppendElement uintptr Ftcl_DStringEndSublist uintptr Ftcl_DStringFree uintptr Ftcl_DStringGetResult uintptr Ftcl_DStringInit uintptr Ftcl_DStringResult uintptr Ftcl_DStringSetLength uintptr Ftcl_DStringStartSublist uintptr Ftcl_Eof uintptr Ftcl_ErrnoId uintptr Ftcl_ErrnoMsg uintptr Freserved129 uintptr Ftcl_EvalFile uintptr Freserved131 uintptr Ftcl_EventuallyFree uintptr Ftcl_Exit uintptr Ftcl_ExposeCommand uintptr Ftcl_ExprBoolean uintptr Ftcl_ExprBooleanObj uintptr Ftcl_ExprDouble uintptr Ftcl_ExprDoubleObj uintptr Ftcl_ExprLong uintptr Ftcl_ExprLongObj uintptr Ftcl_ExprObj uintptr Ftcl_ExprString uintptr Ftcl_Finalize uintptr Freserved144 uintptr Ftcl_FirstHashEntry uintptr Ftcl_Flush uintptr Freserved147 uintptr Freserved148 uintptr FtclGetAliasObj uintptr Ftcl_GetAssocData uintptr Ftcl_GetChannel uintptr Ftcl_GetChannelBufferSize uintptr Ftcl_GetChannelHandle uintptr Ftcl_GetChannelInstanceData uintptr Ftcl_GetChannelMode uintptr Ftcl_GetChannelName uintptr Ftcl_GetChannelOption uintptr Ftcl_GetChannelType uintptr Ftcl_GetCommandInfo uintptr Ftcl_GetCommandName uintptr Ftcl_GetErrno uintptr Ftcl_GetHostName uintptr Ftcl_GetInterpPath uintptr Ftcl_GetParent uintptr Ftcl_GetNameOfExecutable uintptr Ftcl_GetObjResult uintptr Ftcl_GetOpenFile uintptr Ftcl_GetPathType uintptr Ftcl_Gets uintptr Ftcl_GetsObj uintptr Ftcl_GetServiceMode uintptr Ftcl_GetChild uintptr Ftcl_GetStdChannel uintptr Freserved174 uintptr Freserved175 uintptr Ftcl_GetVar2 uintptr Freserved177 uintptr Freserved178 uintptr Ftcl_HideCommand uintptr Ftcl_Init uintptr Ftcl_InitHashTable uintptr Ftcl_InputBlocked uintptr Ftcl_InputBuffered uintptr Ftcl_InterpDeleted uintptr Ftcl_IsSafe uintptr Ftcl_JoinPath uintptr Ftcl_LinkVar uintptr Freserved188 uintptr Ftcl_MakeFileChannel uintptr Freserved190 uintptr Ftcl_MakeTcpClientChannel uintptr Ftcl_Merge uintptr Ftcl_NextHashEntry uintptr Ftcl_NotifyChannel uintptr Ftcl_ObjGetVar2 uintptr Ftcl_ObjSetVar2 uintptr Ftcl_OpenCommandChannel uintptr Ftcl_OpenFileChannel uintptr Ftcl_OpenTcpClient uintptr Ftcl_OpenTcpServer uintptr Ftcl_Preserve uintptr Ftcl_PrintDouble uintptr Ftcl_PutEnv uintptr Ftcl_PosixError uintptr Ftcl_QueueEvent uintptr Ftcl_Read uintptr Ftcl_ReapDetachedProcs uintptr Ftcl_RecordAndEval uintptr Ftcl_RecordAndEvalObj uintptr Ftcl_RegisterChannel uintptr Ftcl_RegisterObjType uintptr Ftcl_RegExpCompile uintptr Ftcl_RegExpExec uintptr Ftcl_RegExpMatch uintptr Ftcl_RegExpRange uintptr Ftcl_Release uintptr Ftcl_ResetResult uintptr Ftcl_ScanElement uintptr Ftcl_ScanCountedElement uintptr Freserved220 uintptr Ftcl_ServiceAll uintptr Ftcl_ServiceEvent uintptr Ftcl_SetAssocData uintptr Ftcl_SetChannelBufferSize uintptr Ftcl_SetChannelOption uintptr Ftcl_SetCommandInfo uintptr Ftcl_SetErrno uintptr Ftcl_SetErrorCode uintptr Ftcl_SetMaxBlockTime uintptr Freserved230 uintptr Ftcl_SetRecursionLimit uintptr Freserved232 uintptr Ftcl_SetServiceMode uintptr Ftcl_SetObjErrorCode uintptr Ftcl_SetObjResult uintptr Ftcl_SetStdChannel uintptr Freserved237 uintptr Ftcl_SetVar2 uintptr Ftcl_SignalId uintptr Ftcl_SignalMsg uintptr Ftcl_SourceRCFile uintptr FtclSplitList uintptr FtclSplitPath uintptr Freserved244 uintptr Freserved245 uintptr Freserved246 uintptr Freserved247 uintptr Ftcl_TraceVar2 uintptr Ftcl_TranslateFileName uintptr Ftcl_Ungets uintptr Ftcl_UnlinkVar uintptr Ftcl_UnregisterChannel uintptr Freserved253 uintptr Ftcl_UnsetVar2 uintptr Freserved255 uintptr Ftcl_UntraceVar2 uintptr Ftcl_UpdateLinkedVar uintptr Freserved258 uintptr Ftcl_UpVar2 uintptr Ftcl_VarEval uintptr Freserved261 uintptr Ftcl_VarTraceInfo2 uintptr Ftcl_Write uintptr Ftcl_WrongNumArgs uintptr Ftcl_DumpActiveMemory uintptr Ftcl_ValidateAllMemory uintptr Freserved267 uintptr Freserved268 uintptr Ftcl_HashStats uintptr Ftcl_ParseVar uintptr Freserved271 uintptr Ftcl_PkgPresentEx uintptr Freserved273 uintptr Freserved274 uintptr Freserved275 uintptr Freserved276 uintptr Ftcl_WaitPid uintptr Freserved278 uintptr Ftcl_GetVersion uintptr Ftcl_InitMemory uintptr Ftcl_StackChannel uintptr Ftcl_UnstackChannel uintptr Ftcl_GetStackedChannel uintptr Ftcl_SetMainLoop uintptr Ftcl_GetAliasObj uintptr Ftcl_AppendObjToObj uintptr Ftcl_CreateEncoding uintptr Ftcl_CreateThreadExitHandler uintptr Ftcl_DeleteThreadExitHandler uintptr Freserved290 uintptr Ftcl_EvalEx uintptr Ftcl_EvalObjv uintptr Ftcl_EvalObjEx uintptr Ftcl_ExitThread uintptr Ftcl_ExternalToUtf uintptr Ftcl_ExternalToUtfDString uintptr Ftcl_FinalizeThread uintptr Ftcl_FinalizeNotifier uintptr Ftcl_FreeEncoding uintptr Ftcl_GetCurrentThread uintptr Ftcl_GetEncoding uintptr Ftcl_GetEncodingName uintptr Ftcl_GetEncodingNames uintptr Ftcl_GetIndexFromObjStruct uintptr Ftcl_GetThreadData uintptr Ftcl_GetVar2Ex uintptr Ftcl_InitNotifier uintptr Ftcl_MutexLock uintptr Ftcl_MutexUnlock uintptr Ftcl_ConditionNotify uintptr Ftcl_ConditionWait uintptr FtclNumUtfChars uintptr Ftcl_ReadChars uintptr Freserved314 uintptr Freserved315 uintptr Ftcl_SetSystemEncoding uintptr Ftcl_SetVar2Ex uintptr Ftcl_ThreadAlert uintptr Ftcl_ThreadQueueEvent uintptr Ftcl_UniCharAtIndex uintptr Ftcl_UniCharToLower uintptr Ftcl_UniCharToTitle uintptr Ftcl_UniCharToUpper uintptr Ftcl_UniCharToUtf uintptr FtclUtfAtIndex uintptr FtclUtfCharComplete uintptr Ftcl_UtfBackslash uintptr Ftcl_UtfFindFirst uintptr Ftcl_UtfFindLast uintptr FtclUtfNext uintptr FtclUtfPrev uintptr Ftcl_UtfToExternal uintptr Ftcl_UtfToExternalDString uintptr Ftcl_UtfToLower uintptr Ftcl_UtfToTitle uintptr Ftcl_UtfToChar16 uintptr Ftcl_UtfToUpper uintptr Ftcl_WriteChars uintptr Ftcl_WriteObj uintptr Ftcl_GetString uintptr Freserved341 uintptr Freserved342 uintptr Ftcl_AlertNotifier uintptr Ftcl_ServiceModeHook uintptr Ftcl_UniCharIsAlnum uintptr Ftcl_UniCharIsAlpha uintptr Ftcl_UniCharIsDigit uintptr Ftcl_UniCharIsLower uintptr Ftcl_UniCharIsSpace uintptr Ftcl_UniCharIsUpper uintptr Ftcl_UniCharIsWordChar uintptr Ftcl_Char16Len uintptr Freserved353 uintptr Ftcl_Char16ToUtfDString uintptr Ftcl_UtfToChar16DString uintptr Ftcl_GetRegExpFromObj uintptr Freserved357 uintptr Ftcl_FreeParse uintptr Ftcl_LogCommandInfo uintptr Ftcl_ParseBraces uintptr Ftcl_ParseCommand uintptr Ftcl_ParseExpr uintptr Ftcl_ParseQuotedString uintptr Ftcl_ParseVarName uintptr Ftcl_GetCwd uintptr Ftcl_Chdir uintptr Ftcl_Access uintptr Ftcl_Stat uintptr FtclUtfNcmp uintptr FtclUtfNcasecmp uintptr Ftcl_StringCaseMatch uintptr Ftcl_UniCharIsControl uintptr Ftcl_UniCharIsGraph uintptr Ftcl_UniCharIsPrint uintptr Ftcl_UniCharIsPunct uintptr Ftcl_RegExpExecObj uintptr Ftcl_RegExpGetInfo uintptr Ftcl_NewUnicodeObj uintptr Ftcl_SetUnicodeObj uintptr FtclGetCharLength uintptr FtclGetUniChar uintptr Freserved382 uintptr FtclGetRange uintptr Ftcl_AppendUnicodeToObj uintptr Ftcl_RegExpMatchObj uintptr Ftcl_SetNotifier uintptr Ftcl_GetAllocMutex uintptr Ftcl_GetChannelNames uintptr Ftcl_GetChannelNamesEx uintptr Ftcl_ProcObjCmd uintptr Ftcl_ConditionFinalize uintptr Ftcl_MutexFinalize uintptr Ftcl_CreateThread uintptr Ftcl_ReadRaw uintptr Ftcl_WriteRaw uintptr Ftcl_GetTopChannel uintptr Ftcl_ChannelBuffered uintptr Ftcl_ChannelName uintptr Ftcl_ChannelVersion uintptr Ftcl_ChannelBlockModeProc uintptr Freserved401 uintptr Ftcl_ChannelClose2Proc uintptr Ftcl_ChannelInputProc uintptr Ftcl_ChannelOutputProc uintptr Freserved405 uintptr Ftcl_ChannelSetOptionProc uintptr Ftcl_ChannelGetOptionProc uintptr Ftcl_ChannelWatchProc uintptr Ftcl_ChannelGetHandleProc uintptr Ftcl_ChannelFlushProc uintptr Ftcl_ChannelHandlerProc uintptr Ftcl_JoinThread uintptr Ftcl_IsChannelShared uintptr Ftcl_IsChannelRegistered uintptr Ftcl_CutChannel uintptr Ftcl_SpliceChannel uintptr Ftcl_ClearChannelHandlers uintptr Ftcl_IsChannelExisting uintptr Freserved419 uintptr Freserved420 uintptr Freserved421 uintptr Freserved422 uintptr Ftcl_InitCustomHashTable uintptr Ftcl_InitObjHashTable uintptr Ftcl_CommandTraceInfo uintptr Ftcl_TraceCommand uintptr Ftcl_UntraceCommand uintptr Ftcl_AttemptAlloc uintptr Ftcl_AttemptDbCkalloc uintptr Ftcl_AttemptRealloc uintptr Ftcl_AttemptDbCkrealloc uintptr Ftcl_AttemptSetObjLength uintptr Ftcl_GetChannelThread uintptr FtclGetUnicodeFromObj uintptr Freserved435 uintptr Freserved436 uintptr Ftcl_SubstObj uintptr Ftcl_DetachChannel uintptr Ftcl_IsStandardChannel uintptr Ftcl_FSCopyFile uintptr Ftcl_FSCopyDirectory uintptr Ftcl_FSCreateDirectory uintptr Ftcl_FSDeleteFile uintptr Ftcl_FSLoadFile uintptr Ftcl_FSMatchInDirectory uintptr Ftcl_FSLink uintptr Ftcl_FSRemoveDirectory uintptr Ftcl_FSRenameFile uintptr Ftcl_FSLstat uintptr Ftcl_FSUtime uintptr Ftcl_FSFileAttrsGet uintptr Ftcl_FSFileAttrsSet uintptr Ftcl_FSFileAttrStrings uintptr Ftcl_FSStat uintptr Ftcl_FSAccess uintptr Ftcl_FSOpenFileChannel uintptr Ftcl_FSGetCwd uintptr Ftcl_FSChdir uintptr Ftcl_FSConvertToPathType uintptr Ftcl_FSJoinPath uintptr FtclFSSplitPath uintptr Ftcl_FSEqualPaths uintptr Ftcl_FSGetNormalizedPath uintptr Ftcl_FSJoinToPath uintptr Ftcl_FSGetInternalRep uintptr Ftcl_FSGetTranslatedPath uintptr Ftcl_FSEvalFile uintptr Ftcl_FSNewNativePath uintptr Ftcl_FSGetNativePath uintptr Ftcl_FSFileSystemInfo uintptr Ftcl_FSPathSeparator uintptr Ftcl_FSListVolumes uintptr Ftcl_FSRegister uintptr Ftcl_FSUnregister uintptr Ftcl_FSData uintptr Ftcl_FSGetTranslatedStringPath uintptr Ftcl_FSGetFileSystemForPath uintptr Ftcl_FSGetPathType uintptr Ftcl_OutputBuffered uintptr Ftcl_FSMountsChanged uintptr Ftcl_EvalTokensStandard uintptr Ftcl_GetTime uintptr Ftcl_CreateObjTrace uintptr Ftcl_GetCommandInfoFromToken uintptr Ftcl_SetCommandInfoFromToken uintptr Ftcl_DbNewWideIntObj uintptr Ftcl_GetWideIntFromObj uintptr Ftcl_NewWideIntObj uintptr Ftcl_SetWideIntObj uintptr Ftcl_AllocStatBuf uintptr Ftcl_Seek uintptr Ftcl_Tell uintptr Ftcl_ChannelWideSeekProc uintptr Ftcl_DictObjPut uintptr Ftcl_DictObjGet uintptr Ftcl_DictObjRemove uintptr FtclDictObjSize uintptr Ftcl_DictObjFirst uintptr Ftcl_DictObjNext uintptr Ftcl_DictObjDone uintptr Ftcl_DictObjPutKeyList uintptr Ftcl_DictObjRemoveKeyList uintptr Ftcl_NewDictObj uintptr Ftcl_DbNewDictObj uintptr Ftcl_RegisterConfig uintptr Ftcl_CreateNamespace uintptr Ftcl_DeleteNamespace uintptr Ftcl_AppendExportList uintptr Ftcl_Export uintptr Ftcl_Import uintptr Ftcl_ForgetImport uintptr Ftcl_GetCurrentNamespace uintptr Ftcl_GetGlobalNamespace uintptr Ftcl_FindNamespace uintptr Ftcl_FindCommand uintptr Ftcl_GetCommandFromObj uintptr Ftcl_GetCommandFullName uintptr Ftcl_FSEvalFileEx uintptr Freserved519 uintptr Ftcl_LimitAddHandler uintptr Ftcl_LimitRemoveHandler uintptr Ftcl_LimitReady uintptr Ftcl_LimitCheck uintptr Ftcl_LimitExceeded uintptr Ftcl_LimitSetCommands uintptr Ftcl_LimitSetTime uintptr Ftcl_LimitSetGranularity uintptr Ftcl_LimitTypeEnabled uintptr Ftcl_LimitTypeExceeded uintptr Ftcl_LimitTypeSet uintptr Ftcl_LimitTypeReset uintptr Ftcl_LimitGetCommands uintptr Ftcl_LimitGetTime uintptr Ftcl_LimitGetGranularity uintptr Ftcl_SaveInterpState uintptr Ftcl_RestoreInterpState uintptr Ftcl_DiscardInterpState uintptr Ftcl_SetReturnOptions uintptr Ftcl_GetReturnOptions uintptr Ftcl_IsEnsemble uintptr Ftcl_CreateEnsemble uintptr Ftcl_FindEnsemble uintptr Ftcl_SetEnsembleSubcommandList uintptr Ftcl_SetEnsembleMappingDict uintptr Ftcl_SetEnsembleUnknownHandler uintptr Ftcl_SetEnsembleFlags uintptr Ftcl_GetEnsembleSubcommandList uintptr Ftcl_GetEnsembleMappingDict uintptr Ftcl_GetEnsembleUnknownHandler uintptr Ftcl_GetEnsembleFlags uintptr Ftcl_GetEnsembleNamespace uintptr Ftcl_SetTimeProc uintptr Ftcl_QueryTimeProc uintptr Ftcl_ChannelThreadActionProc uintptr Ftcl_NewBignumObj uintptr Ftcl_DbNewBignumObj uintptr Ftcl_SetBignumObj uintptr Ftcl_GetBignumFromObj uintptr Ftcl_TakeBignumFromObj uintptr Ftcl_TruncateChannel uintptr Ftcl_ChannelTruncateProc uintptr Ftcl_SetChannelErrorInterp uintptr Ftcl_GetChannelErrorInterp uintptr Ftcl_SetChannelError uintptr Ftcl_GetChannelError uintptr Ftcl_InitBignumFromDouble uintptr Ftcl_GetNamespaceUnknownHandler uintptr Ftcl_SetNamespaceUnknownHandler uintptr Ftcl_GetEncodingFromObj uintptr Ftcl_GetEncodingSearchPath uintptr Ftcl_SetEncodingSearchPath uintptr Ftcl_GetEncodingNameFromEnvironment uintptr Ftcl_PkgRequireProc uintptr Ftcl_AppendObjToErrorInfo uintptr Ftcl_AppendLimitedToObj uintptr Ftcl_Format uintptr Ftcl_AppendFormatToObj uintptr Ftcl_ObjPrintf uintptr Ftcl_AppendPrintfToObj uintptr Ftcl_CancelEval uintptr Ftcl_Canceled uintptr Ftcl_CreatePipe uintptr Ftcl_NRCreateCommand uintptr Ftcl_NREvalObj uintptr Ftcl_NREvalObjv uintptr Ftcl_NRCmdSwap uintptr Ftcl_NRAddCallback uintptr Ftcl_NRCallObjProc uintptr Ftcl_GetFSDeviceFromStat uintptr Ftcl_GetFSInodeFromStat uintptr Ftcl_GetModeFromStat uintptr Ftcl_GetLinkCountFromStat uintptr Ftcl_GetUserIdFromStat uintptr Ftcl_GetGroupIdFromStat uintptr Ftcl_GetDeviceTypeFromStat uintptr Ftcl_GetAccessTimeFromStat uintptr Ftcl_GetModificationTimeFromStat uintptr Ftcl_GetChangeTimeFromStat uintptr Ftcl_GetSizeFromStat uintptr Ftcl_GetBlocksFromStat uintptr Ftcl_GetBlockSizeFromStat uintptr Ftcl_SetEnsembleParameterList uintptr Ftcl_GetEnsembleParameterList uintptr FtclParseArgsObjv uintptr Ftcl_GetErrorLine uintptr Ftcl_SetErrorLine uintptr Ftcl_TransferResult uintptr Ftcl_InterpActive uintptr Ftcl_BackgroundException uintptr Ftcl_ZlibDeflate uintptr Ftcl_ZlibInflate uintptr Ftcl_ZlibCRC32 uintptr Ftcl_ZlibAdler32 uintptr Ftcl_ZlibStreamInit uintptr Ftcl_ZlibStreamGetCommandName uintptr Ftcl_ZlibStreamEof uintptr Ftcl_ZlibStreamChecksum uintptr Ftcl_ZlibStreamPut uintptr Ftcl_ZlibStreamGet uintptr Ftcl_ZlibStreamClose uintptr Ftcl_ZlibStreamReset uintptr Ftcl_SetStartupScript uintptr Ftcl_GetStartupScript uintptr Ftcl_CloseEx uintptr Ftcl_NRExprObj uintptr Ftcl_NRSubstObj uintptr Ftcl_LoadFile uintptr Ftcl_FindSymbol uintptr Ftcl_FSUnloadFile uintptr Ftcl_ZlibStreamSetCompressionDictionary uintptr Ftcl_OpenTcpServerEx uintptr FtclZipfs_Mount uintptr FtclZipfs_Unmount uintptr FtclZipfs_TclLibrary uintptr FtclZipfs_MountBuffer uintptr Ftcl_FreeInternalRep uintptr Ftcl_InitStringRep uintptr Ftcl_FetchInternalRep uintptr Ftcl_StoreInternalRep uintptr Ftcl_HasStringRep uintptr Ftcl_IncrRefCount uintptr Ftcl_DecrRefCount uintptr Ftcl_IsShared uintptr Ftcl_LinkArray uintptr Ftcl_GetIntForIndex uintptr Ftcl_UtfToUniChar uintptr Ftcl_UniCharToUtfDString uintptr Ftcl_UtfToUniCharDString uintptr FtclGetBytesFromObj uintptr Ftcl_GetBytesFromObj uintptr Ftcl_GetStringFromObj uintptr Ftcl_GetUnicodeFromObj uintptr Ftcl_GetSizeIntFromObj uintptr Ftcl_UtfCharComplete uintptr Ftcl_UtfNext uintptr Ftcl_UtfPrev uintptr Ftcl_FSTildeExpand uintptr Ftcl_ExternalToUtfDStringEx uintptr Ftcl_UtfToExternalDStringEx uintptr Ftcl_AsyncMarkFromSignal uintptr Ftcl_ListObjGetElements uintptr Ftcl_ListObjLength uintptr Ftcl_DictObjSize uintptr Ftcl_SplitList uintptr Ftcl_SplitPath uintptr Ftcl_FSSplitPath uintptr Ftcl_ParseArgsObjv uintptr Ftcl_UniCharLen uintptr Ftcl_NumUtfChars uintptr Ftcl_GetCharLength uintptr Ftcl_UtfAtIndex uintptr Ftcl_GetRange uintptr Ftcl_GetUniChar uintptr Ftcl_GetBool uintptr Ftcl_GetBoolFromObj uintptr Ftcl_CreateObjCommand2 uintptr Ftcl_CreateObjTrace2 uintptr Ftcl_NRCreateCommand2 uintptr Ftcl_NRCallObjProc2 uintptr Ftcl_GetNumberFromObj uintptr Ftcl_GetNumber uintptr Ftcl_RemoveChannelMode uintptr Ftcl_GetEncodingNulLength uintptr Ftcl_GetWideUIntFromObj uintptr Ftcl_DStringToObj uintptr Ftcl_UtfNcmp uintptr Ftcl_UtfNcasecmp uintptr Ftcl_NewWideUIntObj uintptr Ftcl_SetWideUIntObj uintptr FtclUnusedStubEntry uintptr } type TTclPlatStubs = struct { Fmagic int32 Fhooks uintptr Freserved0 uintptr Ftcl_MacOSXOpenVersionedBundleResources uintptr Ftcl_MacOSXNotifierAddRunLoopMode uintptr Ftcl_WinConvertError uintptr } type Tregister_t = int32 type Ttime_t = int64 type Tsuseconds_t = int64 type Tint8_t = int8 type Tint16_t = int16 type Tint32_t = int32 type Tint64_t = int64 type Tu_int64_t = uint64 type Tmode_t = uint32 type Tnlink_t = uint32 type Tino_t = uint64 type Tdev_t = uint64 type Tblksize_t = int32 type Tblkcnt_t = int64 type Tfsblkcnt_t = uint64 type Tfsfilcnt_t = uint64 type Ttimer_t = uintptr type Tclockid_t = int32 type Tclock_t = int32 type Tpid_t = int32 type Tid_t = uint32 type Tuid_t = uint32 type Tgid_t = uint32 type Tkey_t = int32 type Tuseconds_t = uint32 type Tpthread_t = uintptr type Tpthread_once_t = int32 type Tpthread_key_t = uint32 type Tpthread_spinlock_t = int32 type Tpthread_mutexattr_t = struct { F__attr uint32 } type Tpthread_condattr_t = struct { F__attr uint32 } type Tpthread_barrierattr_t = struct { F__attr uint32 } type Tpthread_rwlockattr_t = struct { F__attr [2]uint32 } type Tpthread_attr_t = struct { F__u struct { F__vi [0][9]int32 F__s [0][9]uint32 F__i [9]int32 } } type Tpthread_mutex_t = struct { F__u struct { F__vi [0][6]int32 F__p [0][6]uintptr F__i [6]int32 } F__ccgo_room int32 } type Tpthread_cond_t = struct { F__u struct { F__vi [0][12]int32 F__p [0][12]uintptr F__i [12]int32 } } type Tpthread_rwlock_t = struct { F__u struct { F__vi [0][8]int32 F__p [0][8]uintptr F__i [8]int32 } } type Tpthread_barrier_t = struct { F__u struct { F__vi [0][5]int32 F__p [0][5]uintptr F__i [5]int32 } } type Tu_int8_t = uint8 type Tu_int16_t = uint16 type Tu_int32_t = uint32 type Tcaddr_t = uintptr type Tu_char = uint8 type Tu_short = uint16 type Tushort = uint16 type Tu_int = uint32 type Tuint = uint32 type Tu_long = uint32 type Tulong = uint32 type Tquad_t = int64 type Tu_quad_t = uint64 type Tuint16_t = uint16 type Tuint32_t = uint32 type Tuint64_t = uint64 type Ttimeval = struct { F__ccgo_align [0]uint32 Ftv_sec Ttime_t Ftv_usec Tsuseconds_t } type Ttimespec = struct { F__ccgo_align [0]uint32 Ftv_sec Ttime_t Ftv_nsec int32 F__ccgo12 uint32 } type Tsigset_t = struct { F__bits [32]uint32 } type T__sigset_t = Tsigset_t type Tfd_mask = uint32 type Tfd_set = struct { Ffds_bits [32]uint32 } type TXID = uint32 type TMask = uint32 type TAtom = uint32 type TVisualID = uint32 type TTime = uint32 type TWindow = uint32 type TDrawable = uint32 type TFont = uint32 type TPixmap = uint32 type TCursor = uint32 type TColormap = uint32 type TGContext = uint32 type TKeySym = uint32 type TKeyCode = uint8 type TXPointer = uintptr type TXExtData = struct { Fnumber int32 Fnext uintptr Ffree_private uintptr Fprivate_data TXPointer } type T_XExtData = TXExtData type TXExtCodes = struct { Fextension int32 Fmajor_opcode int32 Ffirst_event int32 Ffirst_error int32 } type TXPixmapFormatValues = struct { Fdepth int32 Fbits_per_pixel int32 Fscanline_pad int32 } type TXGCValues = struct { Ffunction int32 Fplane_mask uint32 Fforeground uint32 Fbackground uint32 Fline_width int32 Fline_style int32 Fcap_style int32 Fjoin_style int32 Ffill_style int32 Ffill_rule int32 Farc_mode int32 Ftile TPixmap Fstipple TPixmap Fts_x_origin int32 Fts_y_origin int32 Ffont TFont Fsubwindow_mode int32 Fgraphics_exposures int32 Fclip_x_origin int32 Fclip_y_origin int32 Fclip_mask TPixmap Fdash_offset int32 Fdashes uint8 } type TGC = uintptr type TVisual = struct { Fext_data uintptr Fvisualid TVisualID Fclass int32 Fred_mask uint32 Fgreen_mask uint32 Fblue_mask uint32 Fbits_per_rgb int32 Fmap_entries int32 } type TDepth = struct { Fdepth int32 Fnvisuals int32 Fvisuals uintptr } type TScreen = struct { Fext_data uintptr Fdisplay uintptr Froot TWindow Fwidth int32 Fheight int32 Fmwidth int32 Fmheight int32 Fndepths int32 Fdepths uintptr Froot_depth int32 Froot_visual uintptr Fdefault_gc TGC Fcmap TColormap Fwhite_pixel uint32 Fblack_pixel uint32 Fmax_maps int32 Fmin_maps int32 Fbacking_store int32 Fsave_unders int32 Froot_input_mask int32 } type TScreenFormat = struct { Fext_data uintptr Fdepth int32 Fbits_per_pixel int32 Fscanline_pad int32 } type TXSetWindowAttributes = struct { Fbackground_pixmap TPixmap Fbackground_pixel uint32 Fborder_pixmap TPixmap Fborder_pixel uint32 Fbit_gravity int32 Fwin_gravity int32 Fbacking_store int32 Fbacking_planes uint32 Fbacking_pixel uint32 Fsave_under int32 Fevent_mask int32 Fdo_not_propagate_mask int32 Foverride_redirect int32 Fcolormap TColormap Fcursor TCursor } type TXWindowAttributes = struct { Fx int32 Fy int32 Fwidth int32 Fheight int32 Fborder_width int32 Fdepth int32 Fvisual uintptr Froot TWindow Fclass int32 Fbit_gravity int32 Fwin_gravity int32 Fbacking_store int32 Fbacking_planes uint32 Fbacking_pixel uint32 Fsave_under int32 Fcolormap TColormap Fmap_installed int32 Fmap_state int32 Fall_event_masks int32 Fyour_event_mask int32 Fdo_not_propagate_mask int32 Foverride_redirect int32 Fscreen uintptr } type TXHostAddress = struct { Ffamily int32 Flength int32 Faddress uintptr } type TXServerInterpretedAddress = struct { Ftypelength int32 Fvaluelength int32 Ftype1 uintptr Fvalue uintptr } type TXImage = struct { Fwidth int32 Fheight int32 Fxoffset int32 Fformat int32 Fdata uintptr Fbyte_order int32 Fbitmap_unit int32 Fbitmap_bit_order int32 Fbitmap_pad int32 Fdepth int32 Fbytes_per_line int32 Fbits_per_pixel int32 Fred_mask uint32 Fgreen_mask uint32 Fblue_mask uint32 Fobdata TXPointer Ff Tfuncs } type T_XImage = TXImage type TXWindowChanges = struct { Fx int32 Fy int32 Fwidth int32 Fheight int32 Fborder_width int32 Fsibling TWindow Fstack_mode int32 } type TXColor = struct { Fpixel uint32 Fred uint16 Fgreen uint16 Fblue uint16 Fflags uint8 Fpad uint8 } type TXSegment = struct { Fx1 int16 Fy1 int16 Fx2 int16 Fy2 int16 } type TXPoint = struct { Fx int16 Fy int16 } type TXRectangle = struct { Fx int16 Fy int16 Fwidth uint16 Fheight uint16 } type TXArc = struct { Fx int16 Fy int16 Fwidth uint16 Fheight uint16 Fangle1 int16 Fangle2 int16 } type TXKeyboardControl = struct { Fkey_click_percent int32 Fbell_percent int32 Fbell_pitch int32 Fbell_duration int32 Fled int32 Fled_mode int32 Fkey int32 Fauto_repeat_mode int32 } type TXKeyboardState = struct { Fkey_click_percent int32 Fbell_percent int32 Fbell_pitch uint32 Fbell_duration uint32 Fled_mask uint32 Fglobal_auto_repeat int32 Fauto_repeats [32]uint8 } type TXTimeCoord = struct { Ftime TTime Fx int16 Fy int16 } type TXModifierKeymap = struct { Fmax_keypermod int32 Fmodifiermap uintptr } type T_XPrivDisplay = uintptr type TXKeyEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fstate uint32 Fkeycode uint32 Fsame_screen int32 } type TXKeyPressedEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fstate uint32 Fkeycode uint32 Fsame_screen int32 } type TXKeyReleasedEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fstate uint32 Fkeycode uint32 Fsame_screen int32 } type TXButtonEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fstate uint32 Fbutton uint32 Fsame_screen int32 } type TXButtonPressedEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fstate uint32 Fbutton uint32 Fsame_screen int32 } type TXButtonReleasedEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fstate uint32 Fbutton uint32 Fsame_screen int32 } type TXMotionEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fstate uint32 Fis_hint uint8 Fsame_screen int32 } type TXPointerMovedEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fstate uint32 Fis_hint uint8 Fsame_screen int32 } type TXCrossingEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fmode int32 Fdetail int32 Fsame_screen int32 Ffocus int32 Fstate uint32 } type TXEnterWindowEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fmode int32 Fdetail int32 Fsame_screen int32 Ffocus int32 Fstate uint32 } type TXLeaveWindowEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fmode int32 Fdetail int32 Fsame_screen int32 Ffocus int32 Fstate uint32 } type TXFocusChangeEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fmode int32 Fdetail int32 } type TXFocusInEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fmode int32 Fdetail int32 } type TXFocusOutEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fmode int32 Fdetail int32 } type TXKeymapEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fkey_vector [32]uint8 } type TXExposeEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fx int32 Fy int32 Fwidth int32 Fheight int32 Fcount int32 } type TXGraphicsExposeEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fdrawable TDrawable Fx int32 Fy int32 Fwidth int32 Fheight int32 Fcount int32 Fmajor_code int32 Fminor_code int32 } type TXNoExposeEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fdrawable TDrawable Fmajor_code int32 Fminor_code int32 } type TXVisibilityEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fstate int32 } type TXCreateWindowEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fparent TWindow Fwindow TWindow Fx int32 Fy int32 Fwidth int32 Fheight int32 Fborder_width int32 Foverride_redirect int32 } type TXDestroyWindowEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fevent TWindow Fwindow TWindow } type TXUnmapEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fevent TWindow Fwindow TWindow Ffrom_configure int32 } type TXMapEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fevent TWindow Fwindow TWindow Foverride_redirect int32 } type TXMapRequestEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fparent TWindow Fwindow TWindow } type TXReparentEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fevent TWindow Fwindow TWindow Fparent TWindow Fx int32 Fy int32 Foverride_redirect int32 } type TXConfigureEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fevent TWindow Fwindow TWindow Fx int32 Fy int32 Fwidth int32 Fheight int32 Fborder_width int32 Fabove TWindow Foverride_redirect int32 } type TXGravityEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fevent TWindow Fwindow TWindow Fx int32 Fy int32 } type TXResizeRequestEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fwidth int32 Fheight int32 } type TXConfigureRequestEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fparent TWindow Fwindow TWindow Fx int32 Fy int32 Fwidth int32 Fheight int32 Fborder_width int32 Fabove TWindow Fdetail int32 Fvalue_mask uint32 } type TXCirculateEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fevent TWindow Fwindow TWindow Fplace int32 } type TXCirculateRequestEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fparent TWindow Fwindow TWindow Fplace int32 } type TXPropertyEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fatom TAtom Ftime TTime Fstate int32 } type TXSelectionClearEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fselection TAtom Ftime TTime } type TXSelectionRequestEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fowner TWindow Frequestor TWindow Fselection TAtom Ftarget TAtom Fproperty TAtom Ftime TTime } type TXSelectionEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Frequestor TWindow Fselection TAtom Ftarget TAtom Fproperty TAtom Ftime TTime } type TXColormapEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fcolormap TColormap Fnew1 int32 Fstate int32 } type TXClientMessageEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Fmessage_type TAtom Fformat int32 Fdata struct { Fs [0][10]int16 Fl [0][5]int32 Fb [20]uint8 } } type TXMappingEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow Frequest int32 Ffirst_keycode int32 Fcount int32 } type TXErrorEvent = struct { Ftype1 int32 Fdisplay uintptr Fresourceid TXID Fserial uint32 Ferror_code uint8 Frequest_code uint8 Fminor_code uint8 } type TXAnyEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow } type TXGenericEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fextension int32 Fevtype int32 } type TXGenericEventCookie = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fextension int32 Fevtype int32 Fcookie uint32 Fdata uintptr } type TXEvent = struct { Fxany [0]TXAnyEvent Fxkey [0]TXKeyEvent Fxbutton [0]TXButtonEvent Fxmotion [0]TXMotionEvent Fxcrossing [0]TXCrossingEvent Fxfocus [0]TXFocusChangeEvent Fxexpose [0]TXExposeEvent Fxgraphicsexpose [0]TXGraphicsExposeEvent Fxnoexpose [0]TXNoExposeEvent Fxvisibility [0]TXVisibilityEvent Fxcreatewindow [0]TXCreateWindowEvent Fxdestroywindow [0]TXDestroyWindowEvent Fxunmap [0]TXUnmapEvent Fxmap [0]TXMapEvent Fxmaprequest [0]TXMapRequestEvent Fxreparent [0]TXReparentEvent Fxconfigure [0]TXConfigureEvent Fxgravity [0]TXGravityEvent Fxresizerequest [0]TXResizeRequestEvent Fxconfigurerequest [0]TXConfigureRequestEvent Fxcirculate [0]TXCirculateEvent Fxcirculaterequest [0]TXCirculateRequestEvent Fxproperty [0]TXPropertyEvent Fxselectionclear [0]TXSelectionClearEvent Fxselectionrequest [0]TXSelectionRequestEvent Fxselection [0]TXSelectionEvent Fxcolormap [0]TXColormapEvent Fxclient [0]TXClientMessageEvent Fxmapping [0]TXMappingEvent Fxerror [0]TXErrorEvent Fxkeymap [0]TXKeymapEvent Fxgeneric [0]TXGenericEvent Fxcookie [0]TXGenericEventCookie Fpad [0][24]int32 Ftype1 int32 F__ccgo_pad35 [92]byte } type T_XEvent = TXEvent type TXCharStruct = struct { Flbearing int16 Frbearing int16 Fwidth int16 Fascent int16 Fdescent int16 Fattributes uint16 } type TXFontProp = struct { Fname TAtom Fcard32 uint32 } type TXFontStruct = struct { Fext_data uintptr Ffid TFont Fdirection uint32 Fmin_char_or_byte2 uint32 Fmax_char_or_byte2 uint32 Fmin_byte1 uint32 Fmax_byte1 uint32 Fall_chars_exist int32 Fdefault_char uint32 Fn_properties int32 Fproperties uintptr Fmin_bounds TXCharStruct Fmax_bounds TXCharStruct Fper_char uintptr Fascent int32 Fdescent int32 } type TXTextItem = struct { Fchars uintptr Fnchars int32 Fdelta int32 Ffont TFont } type TXChar2b = struct { Fbyte1 uint8 Fbyte2 uint8 } type TXTextItem16 = struct { Fchars uintptr Fnchars int32 Fdelta int32 Ffont TFont } type TXEDataObject = struct { Fgc [0]TGC Fvisual [0]uintptr Fscreen [0]uintptr Fpixmap_format [0]uintptr Ffont [0]uintptr Fdisplay uintptr } type TXFontSetExtents = struct { Fmax_ink_extent TXRectangle Fmax_logical_extent TXRectangle } type TXOM = uintptr type TXOC = uintptr type TXFontSet = uintptr type TXmbTextItem = struct { Fchars uintptr Fnchars int32 Fdelta int32 Ffont_set TXFontSet } type TXwcTextItem = struct { Fchars uintptr Fnchars int32 Fdelta int32 Ffont_set TXFontSet } type TXOMCharSetList = struct { Fcharset_count int32 Fcharset_list uintptr } type TXOrientation = int32 const XOMOrientation_LTR_TTB = 0 const XOMOrientation_RTL_TTB = 1 const XOMOrientation_TTB_LTR = 2 const XOMOrientation_TTB_RTL = 3 const XOMOrientation_Context = 4 type TXOMOrientation = struct { Fnum_orientation int32 Forientation uintptr } type TXOMFontInfo = struct { Fnum_font int32 Ffont_struct_list uintptr Ffont_name_list uintptr } type TXIM = uintptr type TXIC = uintptr type TXIMProc = uintptr type TXICProc = uintptr type TXIDProc = uintptr type TXIMStyle = uint32 type TXIMStyles = struct { Fcount_styles uint16 Fsupported_styles uintptr } type TXVaNestedList = uintptr type TXIMCallback = struct { Fclient_data TXPointer Fcallback TXIMProc } type TXICCallback = struct { Fclient_data TXPointer Fcallback TXICProc } type TXIMFeedback = uint32 type TXIMText = struct { Flength uint16 Ffeedback uintptr Fencoding_is_wchar int32 Fstring1 struct { Fwide_char [0]uintptr Fmulti_byte uintptr } } type T_XIMText = TXIMText type TXIMPreeditState = uint32 type TXIMPreeditStateNotifyCallbackStruct = struct { Fstate TXIMPreeditState } type T_XIMPreeditStateNotifyCallbackStruct = TXIMPreeditStateNotifyCallbackStruct type TXIMResetState = uint32 type TXIMStringConversionFeedback = uint32 type TXIMStringConversionText = struct { Flength uint16 Ffeedback uintptr Fencoding_is_wchar int32 Fstring1 struct { Fwcs [0]uintptr Fmbs uintptr } } type T_XIMStringConversionText = TXIMStringConversionText type TXIMStringConversionPosition = uint16 type TXIMStringConversionType = uint16 type TXIMStringConversionOperation = uint16 type TXIMCaretDirection = int32 const XIMForwardChar = 0 const XIMBackwardChar = 1 const XIMForwardWord = 2 const XIMBackwardWord = 3 const XIMCaretUp = 4 const XIMCaretDown = 5 const XIMNextLine = 6 const XIMPreviousLine = 7 const XIMLineStart = 8 const XIMLineEnd = 9 const XIMAbsolutePosition = 10 const XIMDontChange = 11 type TXIMStringConversionCallbackStruct = struct { Fposition TXIMStringConversionPosition Fdirection TXIMCaretDirection Foperation TXIMStringConversionOperation Ffactor uint16 Ftext uintptr } type T_XIMStringConversionCallbackStruct = TXIMStringConversionCallbackStruct type TXIMPreeditDrawCallbackStruct = struct { Fcaret int32 Fchg_first int32 Fchg_length int32 Ftext uintptr } type T_XIMPreeditDrawCallbackStruct = TXIMPreeditDrawCallbackStruct type TXIMCaretStyle = int32 const XIMIsInvisible = 0 const XIMIsPrimary = 1 const XIMIsSecondary = 2 type TXIMPreeditCaretCallbackStruct = struct { Fposition int32 Fdirection TXIMCaretDirection Fstyle TXIMCaretStyle } type T_XIMPreeditCaretCallbackStruct = TXIMPreeditCaretCallbackStruct type TXIMStatusDataType = int32 const XIMTextType = 0 const XIMBitmapType = 1 type TXIMStatusDrawCallbackStruct = struct { Ftype1 TXIMStatusDataType Fdata struct { Fbitmap [0]TPixmap Ftext uintptr } } type T_XIMStatusDrawCallbackStruct = TXIMStatusDrawCallbackStruct type TXIMHotKeyTrigger = struct { Fkeysym TKeySym Fmodifier int32 Fmodifier_mask int32 } type T_XIMHotKeyTrigger = TXIMHotKeyTrigger type TXIMHotKeyTriggers = struct { Fnum_hot_key int32 Fkey uintptr } type T_XIMHotKeyTriggers = TXIMHotKeyTriggers type TXIMHotKeyState = uint32 type TXIMValuesList = struct { Fcount_values uint16 Fsupported_values uintptr } type TXErrorHandler = uintptr type TXIOErrorHandler = uintptr type TXIOErrorExitHandler = uintptr type TXConnectionWatchProc = uintptr type TTk_BindingTable = uintptr type TTk_Canvas = uintptr type TTk_Cursor = uintptr type TTk_ErrorHandler = uintptr type TTk_Font = uintptr type TTk_Image = uintptr type TTk_ImageModel = uintptr type TTk_OptionTable = uintptr type TTk_PostscriptInfo = uintptr type TTk_TextLayout = uintptr type TTk_Window = uintptr type TTk_3DBorder = uintptr type TTk_Style = uintptr type TTk_StyleEngine = uintptr type TTk_StyledElement = uintptr type TTk_Uid = uintptr type TTk_OptionType = int32 const TK_OPTION_BOOLEAN = 0 const TK_OPTION_INT = 1 const TK_OPTION_DOUBLE = 2 const TK_OPTION_STRING = 3 const TK_OPTION_STRING_TABLE = 4 const TK_OPTION_COLOR = 5 const TK_OPTION_FONT = 6 const TK_OPTION_BITMAP = 7 const TK_OPTION_BORDER = 8 const TK_OPTION_RELIEF = 9 const TK_OPTION_CURSOR = 10 const TK_OPTION_JUSTIFY = 11 const TK_OPTION_ANCHOR = 12 const TK_OPTION_SYNONYM = 13 const TK_OPTION_PIXELS = 14 const TK_OPTION_WINDOW = 15 const TK_OPTION_END = 16 const TK_OPTION_CUSTOM = 17 const TK_OPTION_STYLE = 18 const TK_OPTION_INDEX = 19 type TTk_OptionSpec = struct { Ftype1 TTk_OptionType FoptionName uintptr FdbName uintptr FdbClass uintptr FdefValue uintptr FobjOffset TTcl_Size FinternalOffset TTcl_Size Fflags int32 FclientData uintptr FtypeMask int32 } type TTk_ObjCustomOption = struct { Fname uintptr FsetProc uintptr FgetProc uintptr FrestoreProc uintptr FfreeProc uintptr FclientData uintptr } type TTk_SavedOption = struct { F__ccgo_align [0]uint32 FoptionPtr uintptr FvaluePtr uintptr FinternalForm float64 } type TTk_SavedOptions = struct { F__ccgo_align [0]uint32 FrecordPtr uintptr Ftkwin TTk_Window FnumItems TTcl_Size F__ccgo_align3 [4]byte Fitems [20]TTk_SavedOption FnextPtr uintptr F__ccgo_pad5 [4]byte } type TTk_CustomOption = struct { FparseProc uintptr FprintProc uintptr FclientData uintptr } type TTk_ConfigSpec = struct { Ftype1 int32 FargvName uintptr FdbName TTk_Uid FdbClass TTk_Uid FdefValue TTk_Uid Foffset TTcl_Size FspecFlags int32 FcustomPtr uintptr } type TTk_ConfigTypes = int32 const TK_CONFIG_BOOLEAN = 0 const TK_CONFIG_INT = 1 const TK_CONFIG_DOUBLE = 2 const TK_CONFIG_STRING = 3 const TK_CONFIG_UID = 4 const TK_CONFIG_COLOR = 5 const TK_CONFIG_FONT = 6 const TK_CONFIG_BITMAP = 7 const TK_CONFIG_BORDER = 8 const TK_CONFIG_RELIEF = 9 const TK_CONFIG_CURSOR = 10 const TK_CONFIG_ACTIVE_CURSOR = 11 const TK_CONFIG_JUSTIFY = 12 const TK_CONFIG_ANCHOR = 13 const TK_CONFIG_SYNONYM = 14 const TK_CONFIG_CAP_STYLE = 15 const TK_CONFIG_JOIN_STYLE = 16 const TK_CONFIG_PIXELS = 17 const TK_CONFIG_MM = 18 const TK_CONFIG_WINDOW = 19 const TK_CONFIG_CUSTOM = 20 const TK_CONFIG_END = 21 type TTk_ArgvInfo = struct { Fkey uintptr Ftype1 int32 Fsrc uintptr Fdst uintptr Fhelp uintptr } type TTk_RestrictAction = int32 const TK_DEFER_EVENT = 0 const TK_PROCESS_EVENT = 1 const TK_DISCARD_EVENT = 2 type TTk_Anchor = int32 const TK_ANCHOR_NULL = -1 const TK_ANCHOR_N = 0 const TK_ANCHOR_NE = 1 const TK_ANCHOR_E = 2 const TK_ANCHOR_SE = 3 const TK_ANCHOR_S = 4 const TK_ANCHOR_SW = 5 const TK_ANCHOR_W = 6 const TK_ANCHOR_NW = 7 const TK_ANCHOR_CENTER = 8 type TTk_Justify = int32 const TK_JUSTIFY_NULL = -1 const TK_JUSTIFY_LEFT = 0 const TK_JUSTIFY_RIGHT = 1 const TK_JUSTIFY_CENTER = 2 type TTk_FontMetrics = struct { Fascent int32 Fdescent int32 Flinespace int32 } type TTk_ClassProcs = struct { Fsize TTcl_Size FworldChangedProc uintptr FcreateProc uintptr FmodalProc uintptr } type TTk_GeomMgr = struct { Fname uintptr FrequestProc uintptr FlostContentProc uintptr } type TXVirtualEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fevent TWindow Froot TWindow Fsubwindow TWindow Ftime TTime Fx int32 Fy int32 Fx_root int32 Fy_root int32 Fstate uint32 Fname TTk_Uid Fsame_screen int32 Fuser_data uintptr } type TXActivateDeactivateEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow } type TXActivateEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow } type TXDeactivateEvent = struct { Ftype1 int32 Fserial uint32 Fsend_event int32 Fdisplay uintptr Fwindow TWindow } type TTk_FakeWin = struct { Fdisplay uintptr Fdummy1 uintptr FscreenNum int32 Fvisual uintptr Fdepth int32 Fwindow TWindow Fdummy2 uintptr Fdummy3 uintptr FparentPtr TTk_Window Fdummy4 uintptr Fdummy5 uintptr FpathName uintptr FnameUid TTk_Uid FclassUid TTk_Uid Fchanges TXWindowChanges Fdummy6 uint32 Fatts TXSetWindowAttributes Fdummy7 uint32 Fflags uint32 Fdummy8 uintptr Fdummy9 TXIC Fdummy10 uintptr Fdummy11 TTcl_Size Fdummy12 TTcl_Size Fdummy13 uintptr Fdummy14 uintptr Fdummy15 uintptr FreqWidth int32 FreqHeight int32 FinternalBorderLeft int32 Fdummy16 uintptr Fdummy17 uintptr Fdummy18 uintptr Fdummy19 uintptr FinternalBorderRight int32 FinternalBorderTop int32 FinternalBorderBottom int32 FminReqWidth int32 FminReqHeight int32 Fdummy20 int32 Fdummy21 uintptr Fdummy22 TTk_Window } type TTk_State = int32 const TK_STATE_NULL = -1 const TK_STATE_ACTIVE = 0 const TK_STATE_DISABLED = 1 const TK_STATE_NORMAL = 2 const TK_STATE_HIDDEN = 3 type TTk_SmoothMethod = struct { Fname uintptr FcoordProc uintptr FpostscriptProc uintptr } type TTk_Item = struct { Fid TTcl_Size FnextPtr uintptr FstaticTagSpace [3]TTk_Uid FtagPtr uintptr FtagSpace TTcl_Size FnumTags TTcl_Size FtypePtr uintptr Fx1 int32 Fy1 int32 Fx2 int32 Fy2 int32 FprevPtr uintptr Fstate TTk_State Freserved1 uintptr Fredraw_flags int32 } type TTk_ItemType = struct { Fname uintptr FitemSize TTcl_Size FcreateProc uintptr FconfigSpecs uintptr FconfigProc uintptr FcoordProc uintptr FdeleteProc uintptr FdisplayProc uintptr Fflags int32 FpointProc uintptr FareaProc uintptr FpostscriptProc uintptr FscaleProc uintptr FtranslateProc uintptr FindexProc uintptr FicursorProc uintptr FselectionProc uintptr FinsertProc uintptr FdCharsProc uintptr FnextPtr uintptr FrotateProc uintptr Freserved2 int32 Freserved3 uintptr Freserved4 uintptr } type TTk_CanvasTextInfo = struct { FselBorder TTk_3DBorder FselBorderWidth int32 FselFgColorPtr uintptr FselItemPtr uintptr FselectFirst TTcl_Size FselectLast TTcl_Size FanchorItemPtr uintptr FselectAnchor TTcl_Size FinsertBorder TTk_3DBorder FinsertWidth int32 FinsertBorderWidth int32 FfocusItemPtr uintptr FgotFocus int32 FcursorOn int32 Freserved1 uintptr Freserved2 uintptr Freserved3 uintptr } type TTk_Dash = struct { Fnumber int32 Fpattern struct { Farray [0][4]uint8 Fpt uintptr } } type TTk_TSOffset = struct { Fflags int32 Fxoffset int32 Fyoffset int32 } type TTk_Outline = struct { F__ccgo_align [0]uint32 Fgc TGC F__ccgo_align1 [4]byte Fwidth float64 FactiveWidth float64 FdisabledWidth float64 Foffset int32 Fdash TTk_Dash FactiveDash TTk_Dash FdisabledDash TTk_Dash FoffsetObj uintptr Freserved2 uintptr Freserved3 uintptr Ftsoffset TTk_TSOffset Fcolor uintptr FactiveColor uintptr FdisabledColor uintptr Fstipple TPixmap FactiveStipple TPixmap FdisabledStipple TPixmap F__ccgo_pad18 [4]byte } type TTk_ImageType = struct { Fname uintptr FcreateProc uintptr FgetProc uintptr FdisplayProc uintptr FfreeProc uintptr FdeleteProc uintptr FpostscriptProc uintptr FnextPtr uintptr Freserved uintptr } type TTk_ImageType1 = struct { Fname uintptr FcreateProc uintptr FgetProc uintptr FdisplayProc uintptr FfreeProc uintptr FdeleteProc uintptr FpostscriptProc uintptr FnextPtr uintptr Freserved uintptr } type TTk_PhotoHandle = uintptr type TTk_PhotoImageBlock = struct { FpixelPtr uintptr Fwidth int32 Fheight int32 Fpitch int32 FpixelSize int32 Foffset [4]int32 } type TTk_PhotoImageFormat = struct { Fname uintptr FfileMatchProc uintptr FstringMatchProc uintptr FfileReadProc uintptr FstringReadProc uintptr FfileWriteProc uintptr FstringWriteProc uintptr FnextPtr uintptr } type TTk_PhotoImageFormatVersion3 = struct { Fname uintptr FfileMatchProc uintptr FstringMatchProc uintptr FfileReadProc uintptr FstringReadProc uintptr FfileWriteProc uintptr FstringWriteProc uintptr FnextPtr uintptr } type TTk_PhotoImageFormat1 = struct { Fname uintptr FfileMatchProc uintptr FstringMatchProc uintptr FfileReadProc uintptr FstringReadProc uintptr FfileWriteProc uintptr FstringWriteProc uintptr FnextPtr uintptr } type TTk_PhotoImageFormatVersion31 = struct { Fname uintptr FfileMatchProc uintptr FstringMatchProc uintptr FfileReadProc uintptr FstringReadProc uintptr FfileWriteProc uintptr FstringWriteProc uintptr FnextPtr uintptr } type TTk_ElementOptionSpec = struct { Fname uintptr Ftype1 TTk_OptionType } type TTk_ElementSpec = struct { Fversion int32 Fname uintptr Foptions uintptr FgetSize uintptr FgetBox uintptr FgetBorderWidth uintptr Fdraw uintptr } type TTkStubHooks = struct { FtkPlatStubs uintptr FtkIntStubs uintptr FtkIntPlatStubs uintptr FtkIntXlibStubs uintptr } type TTkStubs = struct { Fmagic int32 Fhooks uintptr Ftk_MainLoop uintptr Ftk_3DBorderColor uintptr Ftk_3DBorderGC uintptr Ftk_3DHorizontalBevel uintptr Ftk_3DVerticalBevel uintptr Ftk_AddOption uintptr Ftk_BindEvent uintptr Ftk_CanvasDrawableCoords uintptr Ftk_CanvasEventuallyRedraw uintptr Ftk_CanvasGetCoord uintptr Ftk_CanvasGetTextInfo uintptr Ftk_CanvasPsBitmap uintptr Ftk_CanvasPsColor uintptr Ftk_CanvasPsFont uintptr Ftk_CanvasPsPath uintptr Ftk_CanvasPsStipple uintptr Ftk_CanvasPsY uintptr Ftk_CanvasSetStippleOrigin uintptr Ftk_CanvasTagsParseProc uintptr Ftk_CanvasTagsPrintProc uintptr Ftk_CanvasTkwin uintptr Ftk_CanvasWindowCoords uintptr Ftk_ChangeWindowAttributes uintptr Ftk_CharBbox uintptr Ftk_ClearSelection uintptr Ftk_ClipboardAppend uintptr Ftk_ClipboardClear uintptr Ftk_ConfigureInfo uintptr Ftk_ConfigureValue uintptr Ftk_ConfigureWidget uintptr Ftk_ConfigureWindow uintptr Ftk_ComputeTextLayout uintptr Ftk_CoordsToWindow uintptr Ftk_CreateBinding uintptr Ftk_CreateBindingTable uintptr Ftk_CreateErrorHandler uintptr Ftk_CreateEventHandler uintptr Ftk_CreateGenericHandler uintptr Ftk_CreateImageType uintptr Ftk_CreateItemType uintptr Ftk_CreatePhotoImageFormat uintptr Ftk_CreateSelHandler uintptr Ftk_CreateWindow uintptr Ftk_CreateWindowFromPath uintptr Ftk_DefineBitmap uintptr Ftk_DefineCursor uintptr Ftk_DeleteAllBindings uintptr Ftk_DeleteBinding uintptr Ftk_DeleteBindingTable uintptr Ftk_DeleteErrorHandler uintptr Ftk_DeleteEventHandler uintptr Ftk_DeleteGenericHandler uintptr Ftk_DeleteImage uintptr Ftk_DeleteSelHandler uintptr Ftk_DestroyWindow uintptr Ftk_DisplayName uintptr Ftk_DistanceToTextLayout uintptr Ftk_Draw3DPolygon uintptr Ftk_Draw3DRectangle uintptr Ftk_DrawChars uintptr Ftk_DrawFocusHighlight uintptr Ftk_DrawTextLayout uintptr Ftk_Fill3DPolygon uintptr Ftk_Fill3DRectangle uintptr Ftk_FindPhoto uintptr Ftk_FontId uintptr Ftk_Free3DBorder uintptr Ftk_FreeBitmap uintptr Ftk_FreeColor uintptr Ftk_FreeColormap uintptr Ftk_FreeCursor uintptr Ftk_FreeFont uintptr Ftk_FreeGC uintptr Ftk_FreeImage uintptr Ftk_FreeOptions uintptr Ftk_FreePixmap uintptr Ftk_FreeTextLayout uintptr Freserved77 uintptr Ftk_GCForColor uintptr Ftk_GeometryRequest uintptr Ftk_Get3DBorder uintptr Ftk_GetAllBindings uintptr Ftk_GetAnchor uintptr Ftk_GetAtomName uintptr Ftk_GetBinding uintptr Ftk_GetBitmap uintptr Ftk_GetBitmapFromData uintptr Ftk_GetCapStyle uintptr Ftk_GetColor uintptr Ftk_GetColorByValue uintptr Ftk_GetColormap uintptr Ftk_GetCursor uintptr Ftk_GetCursorFromData uintptr Ftk_GetFont uintptr Ftk_GetFontFromObj uintptr Ftk_GetFontMetrics uintptr Ftk_GetGC uintptr Ftk_GetImage uintptr Ftk_GetImageModelData uintptr Ftk_GetItemTypes uintptr Ftk_GetJoinStyle uintptr Ftk_GetJustify uintptr Ftk_GetNumMainWindows uintptr Ftk_GetOption uintptr Ftk_GetPixels uintptr Ftk_GetPixmap uintptr Ftk_GetRelief uintptr Ftk_GetRootCoords uintptr Ftk_GetScrollInfo uintptr Ftk_GetScreenMM uintptr Ftk_GetSelection uintptr Ftk_GetUid uintptr Ftk_GetVisual uintptr Ftk_GetVRootGeometry uintptr Ftk_Grab uintptr Ftk_HandleEvent uintptr Ftk_IdToWindow uintptr Ftk_ImageChanged uintptr Freserved118 uintptr Ftk_InternAtom uintptr Ftk_IntersectTextLayout uintptr Ftk_MaintainGeometry uintptr Ftk_MainWindow uintptr Ftk_MakeWindowExist uintptr Ftk_ManageGeometry uintptr Ftk_MapWindow uintptr Ftk_MeasureChars uintptr Ftk_MoveResizeWindow uintptr Ftk_MoveWindow uintptr Ftk_MoveToplevelWindow uintptr Ftk_NameOf3DBorder uintptr Ftk_NameOfAnchor uintptr Ftk_NameOfBitmap uintptr Ftk_NameOfCapStyle uintptr Ftk_NameOfColor uintptr Ftk_NameOfCursor uintptr Ftk_NameOfFont uintptr Ftk_NameOfImage uintptr Ftk_NameOfJoinStyle uintptr Ftk_NameOfJustify uintptr Ftk_NameOfRelief uintptr Ftk_NameToWindow uintptr Ftk_OwnSelection uintptr Ftk_ParseArgv uintptr Freserved144 uintptr Freserved145 uintptr Ftk_PhotoGetImage uintptr Ftk_PhotoBlank uintptr Freserved148 uintptr Ftk_PhotoGetSize uintptr Freserved150 uintptr Ftk_PointToChar uintptr Ftk_PostscriptFontName uintptr Ftk_PreserveColormap uintptr Ftk_QueueWindowEvent uintptr Ftk_RedrawImage uintptr Ftk_ResizeWindow uintptr Ftk_RestackWindow uintptr Ftk_RestrictEvents uintptr Freserved159 uintptr Ftk_SetAppName uintptr Ftk_SetBackgroundFromBorder uintptr Ftk_SetClass uintptr Ftk_SetGrid uintptr Ftk_SetInternalBorder uintptr Ftk_SetWindowBackground uintptr Ftk_SetWindowBackgroundPixmap uintptr Ftk_SetWindowBorder uintptr Ftk_SetWindowBorderWidth uintptr Ftk_SetWindowBorderPixmap uintptr Ftk_SetWindowColormap uintptr Ftk_SetWindowVisual uintptr Ftk_SizeOfBitmap uintptr Ftk_SizeOfImage uintptr Ftk_StrictMotif uintptr Ftk_TextLayoutToPostscript uintptr Ftk_TextWidth uintptr Ftk_UndefineCursor uintptr Ftk_UnderlineChars uintptr Ftk_UnderlineTextLayout uintptr Ftk_Ungrab uintptr Ftk_UnmaintainGeometry uintptr Ftk_UnmapWindow uintptr Ftk_UnsetGrid uintptr Ftk_UpdatePointer uintptr Ftk_AllocBitmapFromObj uintptr Ftk_Alloc3DBorderFromObj uintptr Ftk_AllocColorFromObj uintptr Ftk_AllocCursorFromObj uintptr Ftk_AllocFontFromObj uintptr Ftk_CreateOptionTable uintptr Ftk_DeleteOptionTable uintptr Ftk_Free3DBorderFromObj uintptr Ftk_FreeBitmapFromObj uintptr Ftk_FreeColorFromObj uintptr Ftk_FreeConfigOptions uintptr Ftk_FreeSavedOptions uintptr Ftk_FreeCursorFromObj uintptr Ftk_FreeFontFromObj uintptr Ftk_Get3DBorderFromObj uintptr Ftk_GetAnchorFromObj uintptr Ftk_GetBitmapFromObj uintptr Ftk_GetColorFromObj uintptr Ftk_GetCursorFromObj uintptr Ftk_GetOptionInfo uintptr Ftk_GetOptionValue uintptr Ftk_GetJustifyFromObj uintptr Ftk_GetMMFromObj uintptr Ftk_GetPixelsFromObj uintptr Ftk_GetReliefFromObj uintptr Ftk_GetScrollInfoObj uintptr Ftk_InitOptions uintptr Freserved212 uintptr Ftk_RestoreSavedOptions uintptr Ftk_SetOptions uintptr Ftk_InitConsoleChannels uintptr Freserved216 uintptr Ftk_CreateSmoothMethod uintptr Freserved218 uintptr Freserved219 uintptr Ftk_GetDash uintptr Ftk_CreateOutline uintptr Ftk_DeleteOutline uintptr Ftk_ConfigOutlineGC uintptr Ftk_ChangeOutlineGC uintptr Ftk_ResetOutlineGC uintptr Ftk_CanvasPsOutline uintptr Ftk_SetTSOrigin uintptr Ftk_CanvasGetCoordFromObj uintptr Ftk_CanvasSetOffset uintptr Ftk_DitherPhoto uintptr Ftk_PostscriptBitmap uintptr Ftk_PostscriptColor uintptr Ftk_PostscriptFont uintptr Ftk_PostscriptImage uintptr Ftk_PostscriptPath uintptr Ftk_PostscriptStipple uintptr Ftk_PostscriptY uintptr Ftk_PostscriptPhoto uintptr Ftk_CreateClientMessageHandler uintptr Ftk_DeleteClientMessageHandler uintptr Ftk_CreateAnonymousWindow uintptr Ftk_SetClassProcs uintptr Ftk_SetInternalBorderEx uintptr Ftk_SetMinimumRequestSize uintptr Ftk_SetCaretPos uintptr Freserved246 uintptr Freserved247 uintptr Ftk_CollapseMotionEvents uintptr Ftk_RegisterStyleEngine uintptr Ftk_GetStyleEngine uintptr Ftk_RegisterStyledElement uintptr Ftk_GetElementId uintptr Ftk_CreateStyle uintptr Ftk_GetStyle uintptr Ftk_FreeStyle uintptr Ftk_NameOfStyle uintptr Ftk_AllocStyleFromObj uintptr Freserved258 uintptr Freserved259 uintptr Ftk_GetStyledElement uintptr Ftk_GetElementSize uintptr Ftk_GetElementBox uintptr Ftk_GetElementBorderWidth uintptr Ftk_DrawElement uintptr Ftk_PhotoExpand uintptr Ftk_PhotoPutBlock uintptr Ftk_PhotoPutZoomedBlock uintptr Ftk_PhotoSetSize uintptr Ftk_GetUserInactiveTime uintptr Ftk_ResetUserInactiveTime uintptr Ftk_Interp uintptr Freserved272 uintptr Freserved273 uintptr Ftk_AlwaysShowSelection uintptr Ftk_GetButtonMask uintptr Ftk_GetDoublePixelsFromObj uintptr Ftk_NewWindowObj uintptr Ftk_SendVirtualEvent uintptr Ftk_FontGetDescription uintptr Ftk_CreatePhotoImageFormatVersion3 uintptr Ftk_DrawHighlightBorder uintptr Ftk_SetMainMenubar uintptr Ftk_SetWindowMenubar uintptr Ftk_ClipDrawableToRect uintptr Ftk_GetSystemDefault uintptr Ftk_UseWindow uintptr Ftk_MakeContainer uintptr Ftk_GetOtherWindow uintptr Ftk_Get3DBorderColors uintptr Ftk_MakeWindow uintptr Ftk_UnderlineCharsInContext uintptr Ftk_DrawCharsInContext uintptr Ftk_MeasureCharsInContext uintptr FtkUnusedStubEntry uintptr } type Tboolean = int32 type Ttkimg_FileReadBuffer = struct { FuseReadBuf int32 FbufStart int32 FbufEnd int32 FreadBuf uintptr } type Ttkimg_Stream = struct { Fchannel TTcl_Channel FbyteObj uintptr Fdata uintptr Fstate int32 Fposition TTcl_Size Flength TTcl_Size FreadBuffer Ttkimg_FileReadBuffer } type TTkimgStubs = struct { Fmagic int32 Fhooks uintptr Ftkimg_OpenFileChannelPtr uintptr Ftkimg_ReadInitFilePtr uintptr Ftkimg_ReadInitStringPtr uintptr Ftkimg_WriteInitFilePtr uintptr Ftkimg_WriteInitStringPtr uintptr Ftkimg_EnableReadBufferPtr uintptr Ftkimg_ReadPtr uintptr Ftkimg_WritePtr uintptr Ftkimg_PutcPtr uintptr Ftkimg_GetTemporaryFileNamePtr uintptr Ftkimg_DeleteFilePtr uintptr Freserved11 uintptr Freserved12 uintptr Freserved13 uintptr Freserved14 uintptr Freserved15 uintptr Freserved16 uintptr Freserved17 uintptr Freserved18 uintptr Freserved19 uintptr Freserved20 uintptr Freserved21 uintptr Freserved22 uintptr Freserved23 uintptr Freserved24 uintptr Freserved25 uintptr Freserved26 uintptr Freserved27 uintptr Freserved28 uintptr Freserved29 uintptr Ftkimg_GetDistanceValuePtr uintptr Ftkimg_SetResolutionPtr uintptr Ftkimg_GetResolutionPtr uintptr Ftkimg_SetNumPagesPtr uintptr Ftkimg_GetNumPagesPtr uintptr Ftkimg_ListObjGetElementsPtr uintptr Freserved36 uintptr Freserved37 uintptr Freserved38 uintptr Freserved39 uintptr Freserved40 uintptr Freserved41 uintptr Freserved42 uintptr Freserved43 uintptr Freserved44 uintptr Freserved45 uintptr Freserved46 uintptr Freserved47 uintptr Freserved48 uintptr Freserved49 uintptr Ftkimg_IsIntelPtr uintptr Ftkimg_CreateGammaTablePtr uintptr Ftkimg_LookupGammaTablePtr uintptr Ftkimg_UShortToUBytePtr uintptr Ftkimg_ShortToUBytePtr uintptr Ftkimg_FloatToUBytePtr uintptr Ftkimg_ReadUByteRowPtr uintptr Ftkimg_ReadUShortRowPtr uintptr Ftkimg_ReadShortRowPtr uintptr Ftkimg_ReadFloatRowPtr uintptr Ftkimg_ReadUByteFilePtr uintptr Ftkimg_ReadUShortFilePtr uintptr Ftkimg_ReadFloatFilePtr uintptr Ftkimg_RemapUShortValuesPtr uintptr Ftkimg_RemapFloatValuesPtr uintptr Ftkimg_UIntToUBytePtr uintptr Ftkimg_IntToUBytePtr uintptr Ftkimg_ReadUIntRowPtr uintptr Ftkimg_ReadIntRowPtr uintptr Ftkimg_ReadUIntFilePtr uintptr Ftkimg_RemapUIntValuesPtr uintptr Ftkimg_DoubleToUBytePtr uintptr Ftkimg_ReadDoubleRowPtr uintptr Ftkimg_ReadDoubleFilePtr uintptr Ftkimg_RemapDoubleValuesPtr uintptr } type Tintptr_t = int32 /* *-------------------------------------------------------------- * * tkimg_EnableReadBuffer -- Initialize read buffer. * * The optional read buffer may be used for compressed image file * formats (ex. RLE), where the file has to be read byte by byte. * This option is only available when reading from an image file, * i.e. "image create -file ..." * * CAUTION: * - Use this option only, when you do NOT use file seeks. * - Use tkimg_EnableReadBuffer(handle, 1) * to allocate and initialize the read buffer before usage. * - Use tkimg_EnableReadBuffer(handle, 0) * to free and switch off the read buffer after usage. * * Results: * None * * Side effects: * None. * *-------------------------------------------------------------- */ func Xtkimg_EnableReadBuffer(tls *libc.TLS, handle uintptr, onOff int32) { (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FuseReadBuf = onOff if onOff != 0 { (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FreadBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, uint32(READBUFLEN)) libc.Xmemset(tls, (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FreadBuf, 0, uint32(READBUFLEN)) (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart = -int32(1) (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufEnd = -int32(1) } else { if (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FreadBuf != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FreadBuf) (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FreadBuf = libc.UintptrFromInt32(0) } } } /* *-------------------------------------------------------------------------- * tkimg_Read -- Read from stream. * * This procedure fills a buffer from the stream input. * The stream can be a file channel or a binary string. * * Results: * The number of bytes successfully read from the stream. * * Side effects: * Status of read buffer may change, if it is enabled. * *-------------------------------------------------------------------------- */ func Xtkimg_Read(tls *libc.TLS, handle uintptr, dst uintptr, count TTcl_Size) (r TTcl_Size) { bp := tls.Alloc(16) defer tls.Free(16) var bytesRead, bytesToRead TTcl_Size var copyRest int32 var dstPtr uintptr _, _, _, _ = bytesRead, bytesToRead, copyRest, dstPtr switch (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fstate { case libc.Int32FromInt32(1)< (*Ttkimg_Stream)(unsafe.Pointer(handle)).Flength { count = (*Ttkimg_Stream)(unsafe.Pointer(handle)).Flength } if count != 0 { libc.Xmemcpy(tls, dst, (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fdata, libc.Uint32FromInt32(count)) *(*TTcl_Size)(unsafe.Pointer(handle + 20)) -= count *(*uintptr)(unsafe.Pointer(handle + 8)) += uintptr(count) } return count case libc.Int32FromInt32(1)< 0 { if (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart < 0 { (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufEnd = (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fchannel, (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FreadBuf, int32(READBUFLEN)) - int32(1) (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart = 0 if (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufEnd < 0 { return (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufEnd } } if (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart+bytesToRead <= (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufEnd+int32(1) { /* All bytes already in the buffer. Just copy them to dst. */ libc.Xmemcpy(tls, dstPtr, (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FreadBuf+uintptr((*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart), libc.Uint32FromInt32(bytesToRead)) (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart += bytesToRead if (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart >= int32(READBUFLEN) { (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart = -int32(1) } return bytesRead + bytesToRead } else { copyRest = (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufEnd - (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart + int32(1) libc.Xmemcpy(tls, dstPtr, (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FreadBuf+uintptr((*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart), libc.Uint32FromInt32(copyRest)) dstPtr += uintptr(copyRest) bytesRead += copyRest bytesToRead -= copyRest (*Ttkimg_Stream)(unsafe.Pointer(handle)).FreadBuffer.FbufStart = -int32(1) } } return count default: (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Panic})))(tls, __ccgo_ts, libc.VaList(bp+8, (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fstate)) return -int32(1) } return r } /* *----------------------------------------------------------------------- * tkimg_Write -- Write to stream. * * This procedure writes image data to an output stream. * * Results: * The return value is the number of bytes written. * * Side effects: * None. * *----------------------------------------------------------------------- */ func Xtkimg_Write(tls *libc.TLS, handle uintptr, src uintptr, count TTcl_Size) (r TTcl_Size) { bp := tls.Alloc(32) defer tls.Free(32) var destPtr uintptr var _ /* objSz at bp+0 */ TTcl_Size _ = destPtr switch (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fstate { case libc.Int32FromInt32(1)< libc.Int32FromUint32(libc.Uint32FromInt32(-libc.Int32FromInt32(1))>>libc.Int32FromInt32(1)) { return -int32(1) } destPtr = (*(*func(*libc.TLS, uintptr, TTcl_Size) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetByteArrayLength})))(tls, (*Ttkimg_Stream)(unsafe.Pointer(handle)).FbyteObj, *(*TTcl_Size)(unsafe.Pointer(bp))+count) if !(destPtr != 0) { return -int32(1) } libc.Xmemcpy(tls, destPtr+uintptr(*(*TTcl_Size)(unsafe.Pointer(bp))), src, libc.Uint32FromInt32(count)) return count case libc.Int32FromInt32(1)< v2 { v1 = float64(0) } else { if ftmp < float64(1) { v3 = ftmp } else { v3 = float64(1) } v1 = v3 } ftmp = v1 ftmp = Xtkimg_LookupGammaTable(tls, ftmp, gammaTable) itmp = int32(ftmp*libc.Float64FromFloat64(255) + libc.Float64FromFloat64(0.5)) if itmp < int32(255) { v5 = itmp } else { v5 = int32(255) } if 0 > v5 { v4 = 0 } else { if itmp < int32(255) { v6 = itmp } else { v6 = int32(255) } v4 = v6 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v4) ubdest++ src += 2 } } else { for src < stop { itmp = libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(src))) / libc.Int32FromInt32(256) if itmp < int32(255) { v8 = itmp } else { v8 = int32(255) } if 0 > v8 { v7 = 0 } else { if itmp < int32(255) { v9 = itmp } else { v9 = int32(255) } v7 = v9 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v7) ubdest++ src += 2 } } return } func Xtkimg_ShortToUByte(tls *libc.TLS, n int32, shortIn uintptr, gammaTable uintptr, ubOut uintptr) { var ftmp float64 var itmp, v1, v2, v3, v4, v5, v6 int32 var src, stop, ubdest uintptr _, _, _, _, _, _, _, _, _, _, _ = ftmp, itmp, src, stop, ubdest, v1, v2, v3, v4, v5, v6 src = shortIn stop = shortIn + uintptr(n)*2 ubdest = ubOut /* Handle a gamma value of 1.0 (gammaTable == NULL) as a special case. Quite nice speed improvement for the maybe most used case. */ if gammaTable != 0 { for src < stop { /* Map short values from the range [MIN_SHORT .. MAX_SHORT] to the range [0.0 .. 1.0], do gamma correction and then map into the displayable range [0 .. 255]. */ ftmp = float64(*(*int16)(unsafe.Pointer(src)))/float64(65535) + float64(0.5) ftmp = Xtkimg_LookupGammaTable(tls, ftmp, gammaTable) itmp = int32(ftmp*libc.Float64FromFloat64(255) + libc.Float64FromFloat64(0.5)) if itmp < int32(255) { v2 = itmp } else { v2 = int32(255) } if 0 > v2 { v1 = 0 } else { if itmp < int32(255) { v3 = itmp } else { v3 = int32(255) } v1 = v3 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v1) ubdest++ src += 2 } } else { for src < stop { /* Map short values from the range [MIN_SHORT .. MAX_SHORT] to the displayable range [0 .. 255]. */ itmp = int32(float64(*(*int16)(unsafe.Pointer(src)))*libc.Float64FromFloat64(255)/libc.Float64FromFloat64(65535) + libc.Float64FromFloat64(128)) if itmp < int32(255) { v5 = itmp } else { v5 = int32(255) } if 0 > v5 { v4 = 0 } else { if itmp < int32(255) { v6 = itmp } else { v6 = int32(255) } v4 = v6 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v4) ubdest++ src += 2 } } return } func Xtkimg_UIntToUByte(tls *libc.TLS, n int32, intIn uintptr, gammaTable uintptr, ubOut uintptr) { var ftmp, v1, v2, v3 float64 var itmp, v4, v5, v6, v7, v8, v9 int32 var src, stop, ubdest uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ftmp, itmp, src, stop, ubdest, v1, v2, v3, v4, v5, v6, v7, v8, v9 src = intIn stop = intIn + uintptr(n)*4 ubdest = ubOut /* Handle a gamma value of 1.0 (gammaTable == NULL) as a special case. Quite nice speed improvement for the maybe most used case. */ if gammaTable != 0 { for src < stop { ftmp = float64(*(*uint32)(unsafe.Pointer(src))) / float64(4.294967295e+09) if ftmp < float64(1) { v2 = ftmp } else { v2 = float64(1) } if float64(0) > v2 { v1 = float64(0) } else { if ftmp < float64(1) { v3 = ftmp } else { v3 = float64(1) } v1 = v3 } ftmp = v1 ftmp = Xtkimg_LookupGammaTable(tls, ftmp, gammaTable) itmp = int32(ftmp*libc.Float64FromFloat64(255) + libc.Float64FromFloat64(0.5)) if itmp < int32(255) { v5 = itmp } else { v5 = int32(255) } if 0 > v5 { v4 = 0 } else { if itmp < int32(255) { v6 = itmp } else { v6 = int32(255) } v4 = v6 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v4) ubdest++ src += 4 } } else { for src < stop { itmp = libc.Int32FromUint32(*(*uint32)(unsafe.Pointer(src)) / libc.Uint32FromInt32(16777216)) if itmp < int32(255) { v8 = itmp } else { v8 = int32(255) } if 0 > v8 { v7 = 0 } else { if itmp < int32(255) { v9 = itmp } else { v9 = int32(255) } v7 = v9 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v7) ubdest++ src += 4 } } return } func Xtkimg_IntToUByte(tls *libc.TLS, n int32, intIn uintptr, gammaTable uintptr, ubOut uintptr) { var ftmp float64 var itmp, v1, v2, v3, v4, v5, v6 int32 var src, stop, ubdest uintptr _, _, _, _, _, _, _, _, _, _, _ = ftmp, itmp, src, stop, ubdest, v1, v2, v3, v4, v5, v6 src = intIn stop = intIn + uintptr(n)*4 ubdest = ubOut /* Handle a gamma value of 1.0 (gammaTable == NULL) as a special case. Quite nice speed improvement for the maybe most used case. */ if gammaTable != 0 { for src < stop { /* Map int values from the range [MIN_INT .. MAX_INT] to the range [0.0 .. 1.0], do gamma correction and then map into the displayable range [0 .. 255]. */ ftmp = float64(*(*int32)(unsafe.Pointer(src)))/float64(4.294967295e+09) + float64(0.5) ftmp = Xtkimg_LookupGammaTable(tls, ftmp, gammaTable) itmp = int32(ftmp*libc.Float64FromFloat64(255) + libc.Float64FromFloat64(0.5)) if itmp < int32(255) { v2 = itmp } else { v2 = int32(255) } if 0 > v2 { v1 = 0 } else { if itmp < int32(255) { v3 = itmp } else { v3 = int32(255) } v1 = v3 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v1) ubdest++ src += 4 } } else { for src < stop { /* Map int values from the range [MIN_INT .. MAX_INT] to the displayable range [0 .. 255]. */ itmp = int32(float64(*(*int32)(unsafe.Pointer(src)))*libc.Float64FromFloat64(1.6777215e+07)/libc.Float64FromFloat64(4.294967295e+09) + libc.Float64FromFloat64(128)) if itmp < int32(255) { v5 = itmp } else { v5 = int32(255) } if 0 > v5 { v4 = 0 } else { if itmp < int32(255) { v6 = itmp } else { v6 = int32(255) } v4 = v6 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v4) ubdest++ src += 4 } } return } // C documentation // // /* If no gamma correction is needed (i.e. gamma == 1.0), specify NULL for // * parameter gammaTable. // */ func Xtkimg_FloatToUByte(tls *libc.TLS, n int32, floatIn uintptr, gammaTable uintptr, ubOut uintptr) { var ftmp, v1, v2, v3 float64 var itmp, v4, v5, v6, v7, v8, v9 int32 var src, stop, ubdest uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ftmp, itmp, src, stop, ubdest, v1, v2, v3, v4, v5, v6, v7, v8, v9 src = floatIn stop = floatIn + uintptr(n)*4 ubdest = ubOut /* Handle a gamma value of 1.0 (gammaTable == NULL) as a special case. Quite nice speed improvement for the maybe most used case. */ if gammaTable != 0 { for src < stop { if float64(*(*float32)(unsafe.Pointer(src))) < float64(1) { v2 = float64(*(*float32)(unsafe.Pointer(src))) } else { v2 = float64(1) } if float64(0) > v2 { v1 = float64(0) } else { if float64(*(*float32)(unsafe.Pointer(src))) < float64(1) { v3 = float64(*(*float32)(unsafe.Pointer(src))) } else { v3 = float64(1) } v1 = v3 } ftmp = v1 ftmp = Xtkimg_LookupGammaTable(tls, ftmp, gammaTable) itmp = int32(ftmp*libc.Float64FromFloat64(255) + libc.Float64FromFloat64(0.5)) if itmp < int32(255) { v5 = itmp } else { v5 = int32(255) } if 0 > v5 { v4 = 0 } else { if itmp < int32(255) { v6 = itmp } else { v6 = int32(255) } v4 = v6 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v4) ubdest++ src += 4 } } else { for src < stop { itmp = int32(float64(*(*float32)(unsafe.Pointer(src)))*libc.Float64FromFloat64(255) + libc.Float64FromFloat64(0.5)) if itmp < int32(255) { v8 = itmp } else { v8 = int32(255) } if 0 > v8 { v7 = 0 } else { if itmp < int32(255) { v9 = itmp } else { v9 = int32(255) } v7 = v9 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v7) ubdest++ src += 4 } } return } // C documentation // // /* If no gamma correction is needed (i.e. gamma == 1.0), specify NULL for // * parameter gammaTable. // */ func Xtkimg_DoubleToUByte(tls *libc.TLS, n int32, doubleIn uintptr, gammaTable uintptr, ubOut uintptr) { var ftmp, v1, v2, v3 float64 var itmp, v4, v5, v6, v7, v8, v9 int32 var src, stop, ubdest uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ftmp, itmp, src, stop, ubdest, v1, v2, v3, v4, v5, v6, v7, v8, v9 src = doubleIn stop = doubleIn + uintptr(n)*8 ubdest = ubOut /* Handle a gamma value of 1.0 (gammaTable == NULL) as a special case. Quite nice speed improvement for the maybe most used case. */ if gammaTable != 0 { for src < stop { if *(*float64)(unsafe.Pointer(src)) < libc.Float64FromFloat64(1) { v2 = *(*float64)(unsafe.Pointer(src)) } else { v2 = libc.Float64FromFloat64(1) } if float64(0) > v2 { v1 = float64(0) } else { if *(*float64)(unsafe.Pointer(src)) < libc.Float64FromFloat64(1) { v3 = *(*float64)(unsafe.Pointer(src)) } else { v3 = libc.Float64FromFloat64(1) } v1 = v3 } ftmp = v1 ftmp = Xtkimg_LookupGammaTable(tls, ftmp, gammaTable) itmp = int32(ftmp*libc.Float64FromFloat64(255) + libc.Float64FromFloat64(0.5)) if itmp < int32(255) { v5 = itmp } else { v5 = int32(255) } if 0 > v5 { v4 = 0 } else { if itmp < int32(255) { v6 = itmp } else { v6 = int32(255) } v4 = v6 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v4) ubdest++ src += 8 } } else { for src < stop { itmp = int32(*(*float64)(unsafe.Pointer(src))*libc.Float64FromFloat64(255) + libc.Float64FromFloat64(0.5)) if itmp < int32(255) { v8 = itmp } else { v8 = int32(255) } if 0 > v8 { v7 = 0 } else { if itmp < int32(255) { v9 = itmp } else { v9 = int32(255) } v7 = v9 } *(*uint8)(unsafe.Pointer(ubdest)) = libc.Uint8FromInt32(v7) ubdest++ src += 8 } } return } func Xtkimg_ReadUByteRow(tls *libc.TLS, handle uintptr, pixels uintptr, nBytes int32) (r int32) { if nBytes != Xtkimg_Read(tls, handle, pixels, nBytes) { return 0 } return int32(1) } func Xtkimg_ReadUShortRow(tls *libc.TLS, handle uintptr, pixels uintptr, nShorts int32, buf uintptr, swapBytes int32) (r int32) { var bufPtr, mPtr uintptr var i int32 _, _, _ = bufPtr, i, mPtr bufPtr = buf mPtr = pixels if int32(2)*nShorts != Xtkimg_Read(tls, handle, buf, int32(2)*nShorts) { return 0 } if swapBytes != 0 { i = 0 for { if !(i < nShorts) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr)) mPtr += 2 bufPtr += uintptr(2) goto _1 _1: ; i++ } } else { i = 0 for { if !(i < nShorts) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) mPtr += 2 bufPtr += uintptr(2) goto _2 _2: ; i++ } } return int32(1) } func Xtkimg_ReadShortRow(tls *libc.TLS, handle uintptr, pixels uintptr, nShorts int32, buf uintptr, swapBytes int32) (r int32) { var bufPtr, mPtr uintptr var i int32 _, _, _ = bufPtr, i, mPtr bufPtr = buf mPtr = pixels if int32(2)*nShorts != Xtkimg_Read(tls, handle, buf, int32(2)*nShorts) { return 0 } if swapBytes != 0 { i = 0 for { if !(i < nShorts) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr)) mPtr += 2 bufPtr += uintptr(2) goto _1 _1: ; i++ } } else { i = 0 for { if !(i < nShorts) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) mPtr += 2 bufPtr += uintptr(2) goto _2 _2: ; i++ } } return int32(1) } func Xtkimg_ReadUIntRow(tls *libc.TLS, handle uintptr, pixels uintptr, nInts int32, buf uintptr, swapBytes int32) (r int32) { var bufPtr, mPtr uintptr var i int32 _, _, _ = bufPtr, i, mPtr bufPtr = buf mPtr = pixels if int32(4)*nInts != Xtkimg_Read(tls, handle, buf, int32(4)*nInts) { return 0 } if swapBytes != 0 { i = 0 for { if !(i < nInts) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr + 3)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr + 2)) *(*uint8)(unsafe.Pointer(mPtr + 2)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 3)) = *(*uint8)(unsafe.Pointer(bufPtr)) mPtr += 4 bufPtr += uintptr(4) goto _1 _1: ; i++ } } else { i = 0 for { if !(i < nInts) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 2)) = *(*uint8)(unsafe.Pointer(bufPtr + 2)) *(*uint8)(unsafe.Pointer(mPtr + 3)) = *(*uint8)(unsafe.Pointer(bufPtr + 3)) mPtr += 4 bufPtr += uintptr(4) goto _2 _2: ; i++ } } return int32(1) } func Xtkimg_ReadIntRow(tls *libc.TLS, handle uintptr, pixels uintptr, nInts int32, buf uintptr, swapBytes int32) (r int32) { var bufPtr, mPtr uintptr var i int32 _, _, _ = bufPtr, i, mPtr bufPtr = buf mPtr = pixels if int32(4)*nInts != Xtkimg_Read(tls, handle, buf, int32(4)*nInts) { return 0 } if swapBytes != 0 { i = 0 for { if !(i < nInts) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr + 3)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr + 2)) *(*uint8)(unsafe.Pointer(mPtr + 2)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 3)) = *(*uint8)(unsafe.Pointer(bufPtr)) mPtr += 4 bufPtr += uintptr(4) goto _1 _1: ; i++ } } else { i = 0 for { if !(i < nInts) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 2)) = *(*uint8)(unsafe.Pointer(bufPtr + 2)) *(*uint8)(unsafe.Pointer(mPtr + 3)) = *(*uint8)(unsafe.Pointer(bufPtr + 3)) mPtr += 4 bufPtr += uintptr(4) goto _2 _2: ; i++ } } return int32(1) } func Xtkimg_ReadFloatRow(tls *libc.TLS, handle uintptr, pixels uintptr, nFloats int32, buf uintptr, swapBytes int32) (r int32) { var bufPtr, mPtr uintptr var i int32 _, _, _ = bufPtr, i, mPtr bufPtr = buf mPtr = pixels if int32(4)*nFloats != Xtkimg_Read(tls, handle, buf, int32(4)*nFloats) { return 0 } if swapBytes != 0 { i = 0 for { if !(i < nFloats) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr + 3)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr + 2)) *(*uint8)(unsafe.Pointer(mPtr + 2)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 3)) = *(*uint8)(unsafe.Pointer(bufPtr)) mPtr += 4 bufPtr += uintptr(4) goto _1 _1: ; i++ } } else { i = 0 for { if !(i < nFloats) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 2)) = *(*uint8)(unsafe.Pointer(bufPtr + 2)) *(*uint8)(unsafe.Pointer(mPtr + 3)) = *(*uint8)(unsafe.Pointer(bufPtr + 3)) mPtr += 4 bufPtr += uintptr(4) goto _2 _2: ; i++ } } return int32(1) } func Xtkimg_ReadDoubleRow(tls *libc.TLS, handle uintptr, pixels uintptr, nDoubles int32, buf uintptr, swapBytes int32) (r int32) { var bufPtr, mPtr uintptr var i int32 _, _, _ = bufPtr, i, mPtr bufPtr = buf mPtr = pixels if int32(8)*nDoubles != Xtkimg_Read(tls, handle, buf, int32(8)*nDoubles) { return 0 } if swapBytes != 0 { i = 0 for { if !(i < nDoubles) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr + 7)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr + 6)) *(*uint8)(unsafe.Pointer(mPtr + 2)) = *(*uint8)(unsafe.Pointer(bufPtr + 5)) *(*uint8)(unsafe.Pointer(mPtr + 3)) = *(*uint8)(unsafe.Pointer(bufPtr + 4)) *(*uint8)(unsafe.Pointer(mPtr + 4)) = *(*uint8)(unsafe.Pointer(bufPtr + 3)) *(*uint8)(unsafe.Pointer(mPtr + 5)) = *(*uint8)(unsafe.Pointer(bufPtr + 2)) *(*uint8)(unsafe.Pointer(mPtr + 6)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 7)) = *(*uint8)(unsafe.Pointer(bufPtr)) mPtr += 8 bufPtr += uintptr(8) goto _1 _1: ; i++ } } else { i = 0 for { if !(i < nDoubles) { break } *(*uint8)(unsafe.Pointer(mPtr)) = *(*uint8)(unsafe.Pointer(bufPtr)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 2)) = *(*uint8)(unsafe.Pointer(bufPtr + 2)) *(*uint8)(unsafe.Pointer(mPtr + 3)) = *(*uint8)(unsafe.Pointer(bufPtr + 3)) *(*uint8)(unsafe.Pointer(mPtr + 4)) = *(*uint8)(unsafe.Pointer(bufPtr + 4)) *(*uint8)(unsafe.Pointer(mPtr + 5)) = *(*uint8)(unsafe.Pointer(bufPtr + 5)) *(*uint8)(unsafe.Pointer(mPtr + 6)) = *(*uint8)(unsafe.Pointer(bufPtr + 6)) *(*uint8)(unsafe.Pointer(mPtr + 7)) = *(*uint8)(unsafe.Pointer(bufPtr + 7)) mPtr += 8 bufPtr += uintptr(8) goto _2 _2: ; i++ } } return int32(1) } func Xtkimg_ReadUByteFile(tls *libc.TLS, handle uintptr, buf uintptr, width int32, height int32, nchan int32, verbose int32, findMinMax int32, minVals uintptr, maxVals uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var bufPtr uintptr var c, x, y int32 _, _, _, _ = bufPtr, c, x, y bufPtr = buf c = 0 for { if !(c < nchan) { break } *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(1.7976931348623157e+308) *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) = -libc.Float64FromFloat64(1.7976931348623157e+308) goto _1 _1: ; c++ } y = 0 for { if !(y < height) { break } if !(Xtkimg_ReadUByteRow(tls, handle, bufPtr, nchan*width) != 0) { return 0 } if findMinMax != 0 { x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } if float64(*(*uint8)(unsafe.Pointer(bufPtr))) > *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) { *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) = float64(*(*uint8)(unsafe.Pointer(bufPtr))) } if float64(*(*uint8)(unsafe.Pointer(bufPtr))) < *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) { *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(*(*uint8)(unsafe.Pointer(bufPtr))) } bufPtr++ goto _4 _4: ; c++ } goto _3 _3: ; x++ } } else { bufPtr += uintptr(nchan * width) } goto _2 _2: ; y++ } if verbose != 0 && findMinMax != 0 { libc.Xprintf(tls, __ccgo_ts+137, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+161, libc.VaList(bp+8, libc.Int32FromUint8(uint8(*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))))) goto _5 _5: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xprintf(tls, __ccgo_ts+167, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+161, libc.VaList(bp+8, libc.Int32FromUint8(uint8(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)))))) goto _6 _6: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xfflush(tls, libc.Xstdout) } return int32(1) } func Xtkimg_ReadUShortFile(tls *libc.TLS, handle uintptr, buf uintptr, width int32, height int32, nchan int32, swapBytes int32, verbose int32, findMinMax int32, minVals uintptr, maxVals uintptr, saturation float64) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var bufPtr, line uintptr var c, x, y int32 var value uint16 var v5 float64 _, _, _, _, _, _, _ = bufPtr, c, line, value, x, y, v5 bufPtr = buf if saturation <= float64(0) { saturation = float64(65535) } c = 0 for { if !(c < nchan) { break } *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(1.7976931348623157e+308) *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) = -libc.Float64FromFloat64(1.7976931348623157e+308) goto _1 _1: ; c++ } line = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Alloc})))(tls, uint32(2)*libc.Uint32FromInt32(nchan)*libc.Uint32FromInt32(width)) y = 0 for { if !(y < height) { break } if !(Xtkimg_ReadUShortRow(tls, handle, bufPtr, nchan*width, line, swapBytes) != 0) { return 0 } if findMinMax != 0 { x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } if float64(*(*uint16)(unsafe.Pointer(bufPtr))) < saturation { v5 = float64(*(*uint16)(unsafe.Pointer(bufPtr))) } else { v5 = saturation } value = uint16(v5) if float64(value) > *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) { *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) = float64(value) } if float64(value) < *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) { *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(value) } bufPtr += 2 goto _4 _4: ; c++ } goto _3 _3: ; x++ } } else { bufPtr += uintptr(nchan*width) * 2 } goto _2 _2: ; y++ } if verbose != 0 && findMinMax != 0 { libc.Xprintf(tls, __ccgo_ts+137, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+161, libc.VaList(bp+8, libc.Int32FromUint16(uint16(*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))))) goto _6 _6: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xprintf(tls, __ccgo_ts+167, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+161, libc.VaList(bp+8, libc.Int32FromUint16(uint16(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)))))) goto _7 _7: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xfflush(tls, libc.Xstdout) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) return int32(1) } func Xtkimg_ReadUIntFile(tls *libc.TLS, handle uintptr, buf uintptr, width int32, height int32, nchan int32, swapBytes int32, verbose int32, findMinMax int32, minVals uintptr, maxVals uintptr, saturation float64) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var bufPtr, line uintptr var c, x, y int32 var value uint32 var v5 float64 _, _, _, _, _, _, _ = bufPtr, c, line, value, x, y, v5 bufPtr = buf if saturation <= float64(0) { saturation = float64(4.294967295e+09) } c = 0 for { if !(c < nchan) { break } *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(1.7976931348623157e+308) *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) = -libc.Float64FromFloat64(1.7976931348623157e+308) goto _1 _1: ; c++ } line = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Alloc})))(tls, uint32(4)*libc.Uint32FromInt32(nchan)*libc.Uint32FromInt32(width)) y = 0 for { if !(y < height) { break } if !(Xtkimg_ReadUIntRow(tls, handle, bufPtr, nchan*width, line, swapBytes) != 0) { return 0 } if findMinMax != 0 { x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } if float64(*(*uint32)(unsafe.Pointer(bufPtr))) < saturation { v5 = float64(*(*uint32)(unsafe.Pointer(bufPtr))) } else { v5 = saturation } value = uint32(v5) if float64(value) > *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) { *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) = float64(value) } if float64(value) < *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) { *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(value) } bufPtr += 4 goto _4 _4: ; c++ } goto _3 _3: ; x++ } } else { bufPtr += uintptr(nchan*width) * 4 } goto _2 _2: ; y++ } if verbose != 0 && findMinMax != 0 { libc.Xprintf(tls, __ccgo_ts+137, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+161, libc.VaList(bp+8, uint32(*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8))))) goto _6 _6: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xprintf(tls, __ccgo_ts+167, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+161, libc.VaList(bp+8, uint32(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))))) goto _7 _7: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xfflush(tls, libc.Xstdout) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) return int32(1) } func Xtkimg_ReadFloatFile(tls *libc.TLS, handle uintptr, buf uintptr, width int32, height int32, nchan int32, swapBytes int32, verbose int32, findMinMax int32, minVals uintptr, maxVals uintptr, saturation float64) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var bufPtr, line uintptr var c, x, y int32 var value float32 var v5 float64 _, _, _, _, _, _, _ = bufPtr, c, line, value, x, y, v5 bufPtr = buf if saturation <= float64(0) { saturation = float64(1.7976931348623157e+308) } c = 0 for { if !(c < nchan) { break } *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(1.7976931348623157e+308) *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) = -libc.Float64FromFloat64(1.7976931348623157e+308) goto _1 _1: ; c++ } line = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Alloc})))(tls, uint32(4)*libc.Uint32FromInt32(nchan)*libc.Uint32FromInt32(width)) y = 0 for { if !(y < height) { break } if !(Xtkimg_ReadFloatRow(tls, handle, bufPtr, nchan*width, line, swapBytes) != 0) { return 0 } if findMinMax != 0 { x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } if float64(*(*float32)(unsafe.Pointer(bufPtr))) < saturation { v5 = float64(*(*float32)(unsafe.Pointer(bufPtr))) } else { v5 = saturation } value = float32(v5) if float64(value) > *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) { *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) = float64(value) } if float64(value) < *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) { *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(value) } bufPtr += 4 goto _4 _4: ; c++ } goto _3 _3: ; x++ } } else { bufPtr += uintptr(nchan*width) * 4 } goto _2 _2: ; y++ } if verbose != 0 && findMinMax != 0 { libc.Xprintf(tls, __ccgo_ts+137, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+191, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))) goto _6 _6: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xprintf(tls, __ccgo_ts+167, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+191, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)))) goto _7 _7: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xfflush(tls, libc.Xstdout) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) return int32(1) } func Xtkimg_ReadDoubleFile(tls *libc.TLS, handle uintptr, buf uintptr, width int32, height int32, nchan int32, swapBytes int32, verbose int32, findMinMax int32, minVals uintptr, maxVals uintptr, saturation float64) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var bufPtr, line uintptr var c, x, y int32 var value, v5 float64 _, _, _, _, _, _, _ = bufPtr, c, line, value, x, y, v5 bufPtr = buf if saturation <= float64(0) { saturation = float64(1.7976931348623157e+308) } c = 0 for { if !(c < nchan) { break } *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(1.7976931348623157e+308) *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) = -libc.Float64FromFloat64(1.7976931348623157e+308) goto _1 _1: ; c++ } line = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Alloc})))(tls, uint32(8)*libc.Uint32FromInt32(nchan)*libc.Uint32FromInt32(width)) y = 0 for { if !(y < height) { break } if !(Xtkimg_ReadDoubleRow(tls, handle, bufPtr, nchan*width, line, swapBytes) != 0) { return 0 } if findMinMax != 0 { x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } if *(*float64)(unsafe.Pointer(bufPtr)) < saturation { v5 = *(*float64)(unsafe.Pointer(bufPtr)) } else { v5 = saturation } value = v5 if value > *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) { *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) = value } if value < *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) { *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) = value } bufPtr += 8 goto _4 _4: ; c++ } goto _3 _3: ; x++ } } else { bufPtr += uintptr(nchan*width) * 8 } goto _2 _2: ; y++ } if verbose != 0 && findMinMax != 0 { libc.Xprintf(tls, __ccgo_ts+137, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+195, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))) goto _6 _6: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xprintf(tls, __ccgo_ts+167, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+195, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)))) goto _7 _7: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xfflush(tls, libc.Xstdout) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) return int32(1) } func _getHistogramIndex(tls *libc.TLS, val float64, minVal float64, maxVal float64) (r int32) { var histoInd int32 var scaledVal, v1, v2, v3, v4 float64 _, _, _, _, _, _ = histoInd, scaledVal, v1, v2, v3, v4 if val-minVal > float64(0) { v1 = val - minVal } else { v1 = float64(0) } scaledVal = float64(255) * (v1 / (maxVal - minVal)) if scaledVal < float64(255) { v3 = scaledVal } else { v3 = float64(255) } if float64(0) > v3 { v2 = float64(0) } else { if scaledVal < float64(255) { v4 = scaledVal } else { v4 = float64(255) } v2 = v4 } histoInd = int32(v2) return histoInd } func _histogramUShort(tls *libc.TLS, buf uintptr, width int32, height int32, dummy787 int32, minVals uintptr, maxVals uintptr, histogram uintptr, printAgc int32) { bp := tls.Alloc(32) defer tls.Free(32) var bufPtr uintptr var c, count, histoInd, i, x, y int32 _, _, _, _, _, _, _ = bufPtr, c, count, histoInd, i, x, y bufPtr = buf libc.Xmemset(tls, histogram, 0, libc.Uint32FromInt32(IMG_HISTOGRAM_SIZE)*libc.Uint32FromInt64(4)) /* Currently supported only for 1 channel images. */ c = 0 y = 0 for { if !(y < height) { break } x = 0 for { if !(x < width) { break } histoInd = _getHistogramIndex(tls, float64(*(*uint16)(unsafe.Pointer(bufPtr))), *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)), *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))) *(*int32)(unsafe.Pointer(histogram + uintptr(histoInd)*4))++ bufPtr += 2 goto _2 _2: ; x++ } goto _1 _1: ; y++ } if printAgc != 0 { count = 0 libc.Xprintf(tls, __ccgo_ts+200, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(minVals)))) libc.Xprintf(tls, __ccgo_ts+219, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(maxVals)))) i = 0 for { if !(i < int32(IMG_HISTOGRAM_SIZE)) { break } libc.Xprintf(tls, __ccgo_ts+238, libc.VaList(bp+8, i, *(*int32)(unsafe.Pointer(histogram + uintptr(i)*4)))) if *(*int32)(unsafe.Pointer(histogram + uintptr(i)*4)) != 0 { count++ } goto _3 _3: ; i++ } libc.Xprintf(tls, __ccgo_ts+261, libc.VaList(bp+8, count, int32(IMG_HISTOGRAM_SIZE)-count)) } return } func Xtkimg_RemapUShortValues(tls *libc.TLS, buf uintptr, width int32, height int32, nchan int32, minVals uintptr, maxVals uintptr, agcCutOffPercent float64, printAgc int32) { bp := tls.Alloc(1056) defer tls.Free(1056) var agcCutOff, scaledVal, sum, v11, v12, v13, v2, v3, v4 float64 var bufPtr uintptr var c, i, maxLutInd, minLutInd, x, y int32 var lut [256]float64 var m, maxNewVals, minNewVals, t [4]float64 var _ /* histogram at bp+0 */ [256]int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = agcCutOff, bufPtr, c, i, lut, m, maxLutInd, maxNewVals, minLutInd, minNewVals, scaledVal, sum, t, x, y, v11, v12, v13, v2, v3, v4 bufPtr = buf c = 0 for { if !(c < nchan) { break } minNewVals[c] = *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) maxNewVals[c] = *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) goto _1 _1: ; c++ } if agcCutOffPercent > float64(0) { minLutInd = -int32(1) maxLutInd = -int32(1) if agcCutOffPercent*float64(0.01) < float64(1) { v3 = agcCutOffPercent * float64(0.01) } else { v3 = float64(1) } if float64(0) > v3 { v2 = float64(0) } else { if agcCutOffPercent*float64(0.01) < float64(1) { v4 = agcCutOffPercent * float64(0.01) } else { v4 = float64(1) } v2 = v4 } agcCutOff = v2 sum = float64(0) /* Calculate histogram. */ _histogramUShort(tls, buf, width, height, nchan, minVals, maxVals, bp, printAgc) /* Accumulate the histogram and divide by the image size. */ i = 0 for { if !(i < int32(IMG_HISTOGRAM_SIZE)) { break } sum = sum + float64((*(*[256]int32)(unsafe.Pointer(bp)))[i]) lut[i] = sum / float64(width*height) if lut[i] >= agcCutOff && minLutInd < 0 { minLutInd = i } if lut[i] >= float64(1)-agcCutOff && maxLutInd < 0 { maxLutInd = i } if printAgc != 0 { libc.Xprintf(tls, __ccgo_ts+282, libc.VaList(bp+1032, i, lut[i])) } goto _5 _5: ; i++ } c = 0 for { if !(c < nchan) { break } minNewVals[c] = float64(minLutInd)*(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))-*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))/float64(255) + *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) maxNewVals[c] = float64(maxLutInd)*(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))-*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))/float64(255) + *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) if printAgc != 0 { libc.Xprintf(tls, __ccgo_ts+300, libc.VaList(bp+1032, agcCutOff)) libc.Xprintf(tls, __ccgo_ts+316, libc.VaList(bp+1032, minLutInd)) libc.Xprintf(tls, __ccgo_ts+334, libc.VaList(bp+1032, maxLutInd)) libc.Xprintf(tls, __ccgo_ts+352, libc.VaList(bp+1032, minNewVals[c])) libc.Xprintf(tls, __ccgo_ts+368, libc.VaList(bp+1032, maxNewVals[c])) } goto _6 _6: ; c++ } } c = 0 for { if !(c < nchan) { break } m[c] = (libc.Float64FromFloat64(65535) - libc.Float64FromFloat64(0)) / (maxNewVals[c] - minNewVals[c]) t[c] = float64(0) - m[c]*minNewVals[c] goto _7 _7: ; c++ } y = 0 for { if !(y < height) { break } x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } scaledVal = float64(*(*uint16)(unsafe.Pointer(bufPtr)))*m[c] + t[c] if scaledVal < float64(libc.Int32FromInt32(65535)) { v12 = scaledVal } else { v12 = float64(libc.Int32FromInt32(65535)) } if float64(libc.Int32FromInt32(0)) > v12 { v11 = float64(libc.Int32FromInt32(0)) } else { if scaledVal < float64(libc.Int32FromInt32(65535)) { v13 = scaledVal } else { v13 = float64(libc.Int32FromInt32(65535)) } v11 = v13 } *(*uint16)(unsafe.Pointer(bufPtr)) = uint16(v11) bufPtr += 2 goto _10 _10: ; c++ } goto _9 _9: ; x++ } goto _8 _8: ; y++ } return } func _histogramUInt(tls *libc.TLS, buf uintptr, width int32, height int32, dummy893 int32, minVals uintptr, maxVals uintptr, histogram uintptr, printAgc int32) { bp := tls.Alloc(32) defer tls.Free(32) var bufPtr uintptr var c, count, histoInd, i, x, y int32 _, _, _, _, _, _, _ = bufPtr, c, count, histoInd, i, x, y bufPtr = buf libc.Xmemset(tls, histogram, 0, libc.Uint32FromInt32(IMG_HISTOGRAM_SIZE)*libc.Uint32FromInt64(4)) /* Currently supported only for 1 channel images. */ c = 0 y = 0 for { if !(y < height) { break } x = 0 for { if !(x < width) { break } histoInd = _getHistogramIndex(tls, float64(*(*uint32)(unsafe.Pointer(bufPtr))), *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)), *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))) *(*int32)(unsafe.Pointer(histogram + uintptr(histoInd)*4))++ bufPtr += 4 goto _2 _2: ; x++ } goto _1 _1: ; y++ } if printAgc != 0 { count = 0 libc.Xprintf(tls, __ccgo_ts+200, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(minVals)))) libc.Xprintf(tls, __ccgo_ts+219, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(maxVals)))) i = 0 for { if !(i < int32(IMG_HISTOGRAM_SIZE)) { break } libc.Xprintf(tls, __ccgo_ts+238, libc.VaList(bp+8, i, *(*int32)(unsafe.Pointer(histogram + uintptr(i)*4)))) if *(*int32)(unsafe.Pointer(histogram + uintptr(i)*4)) != 0 { count++ } goto _3 _3: ; i++ } libc.Xprintf(tls, __ccgo_ts+261, libc.VaList(bp+8, count, int32(IMG_HISTOGRAM_SIZE)-count)) } return } func Xtkimg_RemapUIntValues(tls *libc.TLS, buf uintptr, width int32, height int32, nchan int32, minVals uintptr, maxVals uintptr, agcCutOffPercent float64, printAgc int32) { bp := tls.Alloc(1056) defer tls.Free(1056) var agcCutOff, scaledVal, sum, v11, v12, v13, v2, v3, v4 float64 var bufPtr uintptr var c, i, maxLutInd, minLutInd, x, y int32 var lut [256]float64 var m, maxNewVals, minNewVals, t [4]float64 var _ /* histogram at bp+0 */ [256]int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = agcCutOff, bufPtr, c, i, lut, m, maxLutInd, maxNewVals, minLutInd, minNewVals, scaledVal, sum, t, x, y, v11, v12, v13, v2, v3, v4 bufPtr = buf c = 0 for { if !(c < nchan) { break } minNewVals[c] = *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) maxNewVals[c] = *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) goto _1 _1: ; c++ } if agcCutOffPercent > float64(0) { minLutInd = -int32(1) maxLutInd = -int32(1) if agcCutOffPercent*float64(0.01) < float64(1) { v3 = agcCutOffPercent * float64(0.01) } else { v3 = float64(1) } if float64(0) > v3 { v2 = float64(0) } else { if agcCutOffPercent*float64(0.01) < float64(1) { v4 = agcCutOffPercent * float64(0.01) } else { v4 = float64(1) } v2 = v4 } agcCutOff = v2 sum = float64(0) /* Calculate histogram. */ _histogramUInt(tls, buf, width, height, nchan, minVals, maxVals, bp, printAgc) /* Accumulate the histogram and divide by the image size. */ i = 0 for { if !(i < int32(IMG_HISTOGRAM_SIZE)) { break } sum = sum + float64((*(*[256]int32)(unsafe.Pointer(bp)))[i]) lut[i] = sum / float64(width*height) if lut[i] >= agcCutOff && minLutInd < 0 { minLutInd = i } if lut[i] >= float64(1)-agcCutOff && maxLutInd < 0 { maxLutInd = i } if printAgc != 0 { libc.Xprintf(tls, __ccgo_ts+282, libc.VaList(bp+1032, i, lut[i])) } goto _5 _5: ; i++ } c = 0 for { if !(c < nchan) { break } minNewVals[c] = float64(minLutInd)*(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))-*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))/float64(255) + *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) maxNewVals[c] = float64(maxLutInd)*(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))-*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))/float64(255) + *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) if printAgc != 0 { libc.Xprintf(tls, __ccgo_ts+300, libc.VaList(bp+1032, agcCutOff)) libc.Xprintf(tls, __ccgo_ts+316, libc.VaList(bp+1032, minLutInd)) libc.Xprintf(tls, __ccgo_ts+334, libc.VaList(bp+1032, maxLutInd)) libc.Xprintf(tls, __ccgo_ts+352, libc.VaList(bp+1032, minNewVals[c])) libc.Xprintf(tls, __ccgo_ts+368, libc.VaList(bp+1032, maxNewVals[c])) } goto _6 _6: ; c++ } } c = 0 for { if !(c < nchan) { break } m[c] = (libc.Float64FromFloat64(4.294967295e+09) - libc.Float64FromFloat64(0)) / (maxNewVals[c] - minNewVals[c]) t[c] = float64(0) - m[c]*minNewVals[c] goto _7 _7: ; c++ } y = 0 for { if !(y < height) { break } x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } scaledVal = float64(*(*uint32)(unsafe.Pointer(bufPtr)))*m[c] + t[c] if scaledVal < float64(libc.Int64FromInt64(4294967295)) { v12 = scaledVal } else { v12 = float64(libc.Int64FromInt64(4294967295)) } if float64(libc.Int32FromInt32(0)) > v12 { v11 = float64(libc.Int32FromInt32(0)) } else { if scaledVal < float64(libc.Int64FromInt64(4294967295)) { v13 = scaledVal } else { v13 = float64(libc.Int64FromInt64(4294967295)) } v11 = v13 } *(*uint32)(unsafe.Pointer(bufPtr)) = uint32(v11) bufPtr += 4 goto _10 _10: ; c++ } goto _9 _9: ; x++ } goto _8 _8: ; y++ } return } func _histogramFloat(tls *libc.TLS, buf uintptr, width int32, height int32, dummy997 int32, minVals uintptr, maxVals uintptr, histogram uintptr, printAgc int32) { bp := tls.Alloc(32) defer tls.Free(32) var bufPtr uintptr var c, count, histoInd, i, x, y int32 _, _, _, _, _, _, _ = bufPtr, c, count, histoInd, i, x, y bufPtr = buf libc.Xmemset(tls, histogram, 0, libc.Uint32FromInt32(IMG_HISTOGRAM_SIZE)*libc.Uint32FromInt64(4)) /* Currently supported only for 1 channel images. */ c = 0 y = 0 for { if !(y < height) { break } x = 0 for { if !(x < width) { break } histoInd = _getHistogramIndex(tls, float64(*(*float32)(unsafe.Pointer(bufPtr))), *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)), *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))) *(*int32)(unsafe.Pointer(histogram + uintptr(histoInd)*4))++ bufPtr += 4 goto _2 _2: ; x++ } goto _1 _1: ; y++ } if printAgc != 0 { count = 0 libc.Xprintf(tls, __ccgo_ts+200, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(minVals)))) libc.Xprintf(tls, __ccgo_ts+219, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(maxVals)))) i = 0 for { if !(i < int32(IMG_HISTOGRAM_SIZE)) { break } libc.Xprintf(tls, __ccgo_ts+238, libc.VaList(bp+8, i, *(*int32)(unsafe.Pointer(histogram + uintptr(i)*4)))) if *(*int32)(unsafe.Pointer(histogram + uintptr(i)*4)) != 0 { count++ } goto _3 _3: ; i++ } libc.Xprintf(tls, __ccgo_ts+261, libc.VaList(bp+8, count, int32(IMG_HISTOGRAM_SIZE)-count)) } return } func Xtkimg_RemapFloatValues(tls *libc.TLS, buf uintptr, width int32, height int32, nchan int32, minVals uintptr, maxVals uintptr, agcCutOffPercent float64, printAgc int32) { bp := tls.Alloc(1056) defer tls.Free(1056) var agcCutOff, scaledVal, sum, v11, v12, v13, v2, v3, v4 float64 var bufPtr uintptr var c, i, maxLutInd, minLutInd, x, y int32 var lut [256]float64 var m, maxNewVals, minNewVals, t [4]float64 var _ /* histogram at bp+0 */ [256]int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = agcCutOff, bufPtr, c, i, lut, m, maxLutInd, maxNewVals, minLutInd, minNewVals, scaledVal, sum, t, x, y, v11, v12, v13, v2, v3, v4 bufPtr = buf c = 0 for { if !(c < nchan) { break } minNewVals[c] = *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) maxNewVals[c] = *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) goto _1 _1: ; c++ } if agcCutOffPercent > float64(0) { minLutInd = -int32(1) maxLutInd = -int32(1) if agcCutOffPercent*float64(0.01) < float64(1) { v3 = agcCutOffPercent * float64(0.01) } else { v3 = float64(1) } if float64(0) > v3 { v2 = float64(0) } else { if agcCutOffPercent*float64(0.01) < float64(1) { v4 = agcCutOffPercent * float64(0.01) } else { v4 = float64(1) } v2 = v4 } agcCutOff = v2 sum = float64(0) /* Calculate histogram. */ _histogramFloat(tls, buf, width, height, nchan, minVals, maxVals, bp, printAgc) /* Accumulate the histogram and divide by the image size. */ i = 0 for { if !(i < int32(IMG_HISTOGRAM_SIZE)) { break } sum = sum + float64((*(*[256]int32)(unsafe.Pointer(bp)))[i]) lut[i] = sum / float64(width*height) if lut[i] >= agcCutOff && minLutInd < 0 { minLutInd = i } if lut[i] >= float64(1)-agcCutOff && maxLutInd < 0 { maxLutInd = i } if printAgc != 0 { libc.Xprintf(tls, __ccgo_ts+282, libc.VaList(bp+1032, i, lut[i])) } goto _5 _5: ; i++ } c = 0 for { if !(c < nchan) { break } minNewVals[c] = float64(minLutInd)*(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))-*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))/float64(255) + *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) maxNewVals[c] = float64(maxLutInd)*(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))-*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))/float64(255) + *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) if printAgc != 0 { libc.Xprintf(tls, __ccgo_ts+300, libc.VaList(bp+1032, agcCutOff)) libc.Xprintf(tls, __ccgo_ts+316, libc.VaList(bp+1032, minLutInd)) libc.Xprintf(tls, __ccgo_ts+334, libc.VaList(bp+1032, maxLutInd)) libc.Xprintf(tls, __ccgo_ts+352, libc.VaList(bp+1032, minNewVals[c])) libc.Xprintf(tls, __ccgo_ts+368, libc.VaList(bp+1032, maxNewVals[c])) } goto _6 _6: ; c++ } } c = 0 for { if !(c < nchan) { break } m[c] = (libc.Float64FromFloat64(1) - libc.Float64FromFloat64(0)) / (maxNewVals[c] - minNewVals[c]) t[c] = float64(0) - m[c]*minNewVals[c] goto _7 _7: ; c++ } y = 0 for { if !(y < height) { break } x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } scaledVal = float64(*(*float32)(unsafe.Pointer(bufPtr)))*m[c] + t[c] if scaledVal < float64(1) { v12 = scaledVal } else { v12 = float64(1) } if float64(0) > v12 { v11 = float64(0) } else { if scaledVal < float64(1) { v13 = scaledVal } else { v13 = float64(1) } v11 = v13 } *(*float32)(unsafe.Pointer(bufPtr)) = float32(v11) bufPtr += 4 goto _10 _10: ; c++ } goto _9 _9: ; x++ } goto _8 _8: ; y++ } return } func _histogramDouble(tls *libc.TLS, buf uintptr, width int32, height int32, dummy1103 int32, minVals uintptr, maxVals uintptr, histogram uintptr, printAgc int32) { bp := tls.Alloc(32) defer tls.Free(32) var bufPtr uintptr var c, count, histoInd, i, x, y int32 _, _, _, _, _, _, _ = bufPtr, c, count, histoInd, i, x, y bufPtr = buf libc.Xmemset(tls, histogram, 0, libc.Uint32FromInt32(IMG_HISTOGRAM_SIZE)*libc.Uint32FromInt64(4)) /* Currently supported only for 1 channel images. */ c = 0 y = 0 for { if !(y < height) { break } x = 0 for { if !(x < width) { break } histoInd = _getHistogramIndex(tls, *(*float64)(unsafe.Pointer(bufPtr)), *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)), *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))) *(*int32)(unsafe.Pointer(histogram + uintptr(histoInd)*4))++ bufPtr += 8 goto _2 _2: ; x++ } goto _1 _1: ; y++ } if printAgc != 0 { count = 0 libc.Xprintf(tls, __ccgo_ts+200, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(minVals)))) libc.Xprintf(tls, __ccgo_ts+219, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(maxVals)))) i = 0 for { if !(i < int32(IMG_HISTOGRAM_SIZE)) { break } libc.Xprintf(tls, __ccgo_ts+238, libc.VaList(bp+8, i, *(*int32)(unsafe.Pointer(histogram + uintptr(i)*4)))) if *(*int32)(unsafe.Pointer(histogram + uintptr(i)*4)) != 0 { count++ } goto _3 _3: ; i++ } libc.Xprintf(tls, __ccgo_ts+261, libc.VaList(bp+8, count, int32(IMG_HISTOGRAM_SIZE)-count)) } return } func Xtkimg_RemapDoubleValues(tls *libc.TLS, buf uintptr, width int32, height int32, nchan int32, minVals uintptr, maxVals uintptr, agcCutOffPercent float64, printAgc int32) { bp := tls.Alloc(1056) defer tls.Free(1056) var agcCutOff, scaledVal, sum, v11, v12, v13, v2, v3, v4 float64 var bufPtr uintptr var c, i, maxLutInd, minLutInd, x, y int32 var lut [256]float64 var m, maxNewVals, minNewVals, t [4]float64 var _ /* histogram at bp+0 */ [256]int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = agcCutOff, bufPtr, c, i, lut, m, maxLutInd, maxNewVals, minLutInd, minNewVals, scaledVal, sum, t, x, y, v11, v12, v13, v2, v3, v4 bufPtr = buf c = 0 for { if !(c < nchan) { break } minNewVals[c] = *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) maxNewVals[c] = *(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8)) goto _1 _1: ; c++ } if agcCutOffPercent > float64(0) { minLutInd = -int32(1) maxLutInd = -int32(1) if agcCutOffPercent*float64(0.01) < float64(1) { v3 = agcCutOffPercent * float64(0.01) } else { v3 = float64(1) } if float64(0) > v3 { v2 = float64(0) } else { if agcCutOffPercent*float64(0.01) < float64(1) { v4 = agcCutOffPercent * float64(0.01) } else { v4 = float64(1) } v2 = v4 } agcCutOff = v2 sum = float64(0) /* Calculate histogram. */ _histogramDouble(tls, buf, width, height, nchan, minVals, maxVals, bp, printAgc) /* Accumulate the histogram and divide by the image size. */ i = 0 for { if !(i < int32(IMG_HISTOGRAM_SIZE)) { break } sum = sum + float64((*(*[256]int32)(unsafe.Pointer(bp)))[i]) lut[i] = sum / float64(width*height) if lut[i] >= agcCutOff && minLutInd < 0 { minLutInd = i } if lut[i] >= float64(1)-agcCutOff && maxLutInd < 0 { maxLutInd = i } if printAgc != 0 { libc.Xprintf(tls, __ccgo_ts+282, libc.VaList(bp+1032, i, lut[i])) } goto _5 _5: ; i++ } c = 0 for { if !(c < nchan) { break } minNewVals[c] = float64(minLutInd)*(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))-*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))/float64(255) + *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) maxNewVals[c] = float64(maxLutInd)*(*(*float64)(unsafe.Pointer(maxVals + uintptr(c)*8))-*(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)))/float64(255) + *(*float64)(unsafe.Pointer(minVals + uintptr(c)*8)) if printAgc != 0 { libc.Xprintf(tls, __ccgo_ts+300, libc.VaList(bp+1032, agcCutOff)) libc.Xprintf(tls, __ccgo_ts+316, libc.VaList(bp+1032, minLutInd)) libc.Xprintf(tls, __ccgo_ts+334, libc.VaList(bp+1032, maxLutInd)) libc.Xprintf(tls, __ccgo_ts+352, libc.VaList(bp+1032, minNewVals[c])) libc.Xprintf(tls, __ccgo_ts+368, libc.VaList(bp+1032, maxNewVals[c])) } goto _6 _6: ; c++ } } c = 0 for { if !(c < nchan) { break } m[c] = (libc.Float64FromFloat64(1) - libc.Float64FromFloat64(0)) / (maxNewVals[c] - minNewVals[c]) t[c] = float64(0) - m[c]*minNewVals[c] goto _7 _7: ; c++ } y = 0 for { if !(y < height) { break } x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } scaledVal = *(*float64)(unsafe.Pointer(bufPtr))*m[c] + t[c] if scaledVal < float64(1) { v12 = scaledVal } else { v12 = float64(1) } if float64(0) > v12 { v11 = float64(0) } else { if scaledVal < float64(1) { v13 = scaledVal } else { v13 = float64(1) } v11 = v13 } *(*float64)(unsafe.Pointer(bufPtr)) = v11 bufPtr += 8 goto _10 _10: ; c++ } goto _9 _9: ; x++ } goto _8 _8: ; y++ } return } const CLOCKS_PER_SEC = 1000000 const CLOCK_BOOTTIME = 7 const CLOCK_BOOTTIME_ALARM = 9 const CLOCK_MONOTONIC = 1 const CLOCK_MONOTONIC_COARSE = 6 const CLOCK_MONOTONIC_RAW = 4 const CLOCK_PROCESS_CPUTIME_ID = 2 const CLOCK_REALTIME = 0 const CLOCK_REALTIME_ALARM = 8 const CLOCK_REALTIME_COARSE = 5 const CLOCK_SGI_CYCLE = 10 const CLOCK_TAI = 11 const CLOCK_THREAD_CPUTIME_ID = 3 const TIMER_ABSTIME = 1 const TIME_UTC = 1 const TKIMG_VERSION_UUID = 941 const __tm_gmtoff = "tm_gmtoff" const __tm_zone = "tm_zone" type Ttm = struct { Ftm_sec int32 Ftm_min int32 Ftm_hour int32 Ftm_mday int32 Ftm_mon int32 Ftm_year int32 Ftm_wday int32 Ftm_yday int32 Ftm_isdst int32 Ftm_gmtoff int32 Ftm_zone uintptr } type Titimerspec = struct { F__ccgo_align [0]uint32 Fit_interval Ttimespec Fit_value Ttimespec } /* * Declarations for externally visible functions. */ /* *---------------------------------------------------------------------------- * * Tkimg_Init -- * * Initialisation routine for loadable module * * Results: * A Tcl result: TCL_OK or TCL_ERROR. * * Side effects: * Creates commands in the interpreter. * *---------------------------------------------------------------------------- */ func XTkimg_Init(tls *libc.TLS, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* info at bp+0 */ TTcl_CmdInfo if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+32, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { /* No more parameters available. */ break } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i+int32(1))*4)), libc.UintptrFromInt32(0)) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(optionStr))) == int32('-') { /* Next parameter is an option. */ break } if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+32, __ccgo_ts+836, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 16)) i++ case 2: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+32, __ccgo_ts+807, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT)(unsafe.Pointer(opts)).Fxres = *(*float64)(unsafe.Pointer(bp + 16)) case 3: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+32, __ccgo_ts+836, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 16)) break } } goto _1 _1: ; i++ } return TCL_OK } var _readOptions = [2]uintptr{ 0: __ccgo_ts + 641, 1: libc.UintptrFromInt32(0), } var _writeOptions = [5]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 650, 2: __ccgo_ts + 662, 3: __ccgo_ts + 675, 4: libc.UintptrFromInt32(0), } // C documentation // // /* // * Caution: Match functions return 1 on success and 0 on failure, // * while the Read and Write functions return a standard Tcl return // * value: TCL_OK is 0, Tcl_ERROR is 1 ! // */ func _FileMatchVersion3(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var retVal int32 var _ /* handle at bp+16 */ Ttkimg_Stream var _ /* xdpi at bp+0 */ float64 var _ /* ydpi at bp+8 */ float64 _ = retVal libc.Xmemset(tls, bp+16, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp+16, chan1) retVal = _CommonMatch(tls, bp+16, widthPtr, heightPtr, bp, bp+8, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0)) if retVal != 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp + 8)) >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, *(*float64)(unsafe.Pointer(bp)), *(*float64)(unsafe.Pointer(bp + 8))) { return 0 } } return retVal } func _StringMatchVersion3(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var retVal int32 var _ /* handle at bp+16 */ Ttkimg_Stream var _ /* xdpi at bp+0 */ float64 var _ /* ydpi at bp+8 */ float64 _ = retVal libc.Xmemset(tls, bp+16, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp+16, dataObj) != 0) { return 0 } retVal = _CommonMatch(tls, bp+16, widthPtr, heightPtr, bp, bp+8, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0)) if retVal != 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp + 8)) >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, *(*float64)(unsafe.Pointer(bp)), *(*float64)(unsafe.Pointer(bp + 8))) { return 0 } } return retVal } func _FileReadVersion3(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonRead(tls, interp, bp, fileName, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) } func _StringReadVersion3(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonRead(tls, interp, bp, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) } func _FileWriteVersion3(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, fileName, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite(tls, interp, fileName, format, bp, blockPtr, metadataIn) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } func _StringWriteVersion3(tls *libc.TLS, interp uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = result libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp) result = _CommonWrite(tls, interp, __ccgo_ts+865, format, bp, blockPtr, metadataIn) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp))).FbyteObj) } return result } func _getUInt32(tls *libc.TLS, buf uintptr) (r uint32) { return libc.Uint32FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf)))|libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(buf + 1)))<> int32(1) goto _2 _2: ; bit++ } (*(*TBitmapChannel)(unsafe.Pointer(masks + uintptr(i)*12))).Fshiftin = libc.Uint32FromInt32(offset) (*(*TBitmapChannel)(unsafe.Pointer(masks + uintptr(i)*12))).Fshiftout = libc.Uint32FromInt32(int32(8) - nbits) goto _1 _1: ; i++ } } /* * Helper functions for the entry points. Work horses. */ func _CommonMatch(tls *libc.TLS, handle uintptr, widthPtr uintptr, heightPtr uintptr, xdpiPtr uintptr, ydpiPtr uintptr, colorMap uintptr, numBits uintptr, numCols uintptr, comp uintptr, mask uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var c, clrUsed, compression, height, i, nBits, offBits, width, xres, yres int32 var ptr, v1, v3, v4, v5 uintptr var _ /* buf at bp+0 */ [50]uint8 var _ /* colbuf at bp+52 */ [4]uint8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, clrUsed, compression, height, i, nBits, offBits, ptr, width, xres, yres, v1, v3, v4, v5 xres = 0 yres = 0 width = 0 height = 0 if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(2)) != int32(2) || libc.Xstrncmp(tls, __ccgo_ts+878, bp, uint32(2)) != 0 || (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(24)) != int32(24) || (*(*[50]uint8)(unsafe.Pointer(bp)))[int32(13)] != 0 || (*(*[50]uint8)(unsafe.Pointer(bp)))[int32(14)] != 0 || (*(*[50]uint8)(unsafe.Pointer(bp)))[int32(15)] != 0 { return 0 } offBits = libc.Int32FromUint32(uint32((*(*[50]uint8)(unsafe.Pointer(bp)))[int32(11)])< int32(36) { if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, c-int32(36)) != c-int32(36) { return 0 } } if compression == int32(BI_BITFIELDS) { /* Read the channel masks. */ if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, libc.Int32FromInt32(3)*libc.Int32FromInt32(4)) != libc.Int32FromInt32(3)*libc.Int32FromInt32(4) { return 0 } if mask != 0 { *(*uint32)(unsafe.Pointer(mask)) = _getUInt32(tls, bp) *(*uint32)(unsafe.Pointer(mask + 1*4)) = _getUInt32(tls, bp+4) *(*uint32)(unsafe.Pointer(mask + 2*4)) = _getUInt32(tls, bp+8) } offBits -= libc.Int32FromInt32(3) * libc.Int32FromInt32(4) } if !(clrUsed != 0) && nBits < int32(24) { clrUsed = int32(1) << nBits } if nBits < int32(16) { offBits -= (int32(3) + libc.BoolInt32(c != int32(12))) * clrUsed v1 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(int32(3)*clrUsed)) ptr = v1 *(*uintptr)(unsafe.Pointer(colorMap)) = v1 if ptr == libc.UintptrFromInt32(0) { return 0 } i = 0 for { if !(i < clrUsed) { break } if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+52, int32(3)+libc.BoolInt32(c != int32(12))) != int32(3)+libc.BoolInt32(c != int32(12)) { return 0 } v3 = ptr ptr++ *(*uint8)(unsafe.Pointer(v3)) = (*(*[4]uint8)(unsafe.Pointer(bp + 52)))[0] v4 = ptr ptr++ *(*uint8)(unsafe.Pointer(v4)) = (*(*[4]uint8)(unsafe.Pointer(bp + 52)))[int32(1)] v5 = ptr ptr++ *(*uint8)(unsafe.Pointer(v5)) = (*(*[4]uint8)(unsafe.Pointer(bp + 52)))[int32(2)] goto _2 _2: ; i++ } } for offBits > int32(28) { offBits -= int32(28) if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(28)) != int32(28) { return 0 } } if offBits > 0 { if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, offBits) != offBits { return 0 } } if numCols != 0 { *(*int32)(unsafe.Pointer(numCols)) = clrUsed } } *(*float64)(unsafe.Pointer(xdpiPtr)) = float64(int32(float64(xres)*libc.Float64FromFloat64(0.0254) + libc.Float64FromFloat64(0.5))) *(*float64)(unsafe.Pointer(ydpiPtr)) = float64(int32(float64(yres)*libc.Float64FromFloat64(0.0254) + libc.Float64FromFloat64(0.5))) if *(*float64)(unsafe.Pointer(xdpiPtr)) == float64(0) { *(*float64)(unsafe.Pointer(xdpiPtr)) = -libc.Float64FromFloat64(1) } if *(*float64)(unsafe.Pointer(ydpiPtr)) == float64(0) { *(*float64)(unsafe.Pointer(ydpiPtr)) = -libc.Float64FromFloat64(1) } if numBits != 0 { *(*int32)(unsafe.Pointer(numBits)) = nBits } if comp != 0 { *(*int32)(unsafe.Pointer(comp)) = compression } *(*int32)(unsafe.Pointer(widthPtr)) = width *(*int32)(unsafe.Pointer(heightPtr)) = height return int32(1) } func _CommonRead(tls *libc.TLS, interp uintptr, handle uintptr, fileName uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(224) defer tls.Free(224) var bytesPerLine, c, c1, c2, i, j, x, y int32 var expline, line, v12, v13, v14, v15, v18, v2, v21, v24, v5, v6, v7, v9 uintptr var howMuch uint8 var rgb uint16 var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* buf at bp+124 */ [20]uint8 var _ /* colorMap at bp+72 */ uintptr var _ /* comp at bp+44 */ int32 var _ /* fileHeight at bp+68 */ int32 var _ /* fileWidth at bp+64 */ int32 var _ /* intMask at bp+76 */ [3]uint32 var _ /* masks at bp+88 */ [3]TBitmapChannel var _ /* numBits at bp+36 */ int32 var _ /* numCols at bp+40 */ int32 var _ /* opts at bp+144 */ TFMTOPT var _ /* rleBuf at bp+168 */ [2]uint8 var _ /* rleDelta at bp+170 */ [2]uint8 var _ /* val at bp+172 */ uint8 var _ /* xdpi at bp+48 */ float64 var _ /* ydpi at bp+56 */ float64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bytesPerLine, c, c1, c2, expline, howMuch, i, j, line, rgb, x, y, v12, v13, v14, v15, v18, v2, v21, v24, v5, v6, v7, v9 *(*int32)(unsafe.Pointer(bp + 40)) = 0 *(*uintptr)(unsafe.Pointer(bp + 72)) = libc.UintptrFromInt32(0) line = libc.UintptrFromInt32(0) expline = libc.UintptrFromInt32(0) if _ParseFormatOpts(tls, interp, format, bp+144, libc.Int32FromInt32(1)<= float64(0) && *(*float64)(unsafe.Pointer(bp + 56)) >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, *(*float64)(unsafe.Pointer(bp + 48)), *(*float64)(unsafe.Pointer(bp + 56))) { goto error } } if (*(*TFMTOPT)(unsafe.Pointer(bp + 144))).Fverbose != 0 { _printImgInfo(tls, *(*int32)(unsafe.Pointer(bp + 64)), *(*int32)(unsafe.Pointer(bp + 68)), *(*float64)(unsafe.Pointer(bp + 48)), *(*float64)(unsafe.Pointer(bp + 56)), *(*int32)(unsafe.Pointer(bp + 36)), fileName, __ccgo_ts+881) } if *(*int32)(unsafe.Pointer(bp + 36)) == int32(16) { if *(*int32)(unsafe.Pointer(bp + 44)) == int32(BI_BITFIELDS) { _GetChannelMasks(tls, bp+76, bp+88) } else { (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[0].Fmask = uint32(0x7c00) (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[0].Fshiftin = uint32(10) (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[0].Fshiftout = uint32(3) (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(1)].Fmask = uint32(0x03e0) (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(1)].Fshiftin = uint32(5) (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(1)].Fshiftout = uint32(3) (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(2)].Fmask = uint32(0x001f) (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(2)].Fshiftin = uint32(0) (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(2)].Fshiftout = uint32(3) } } if *(*int32)(unsafe.Pointer(bp + 44)) == int32(BI_RLE8) || *(*int32)(unsafe.Pointer(bp + 44)) == int32(BI_RLE4) { (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, int32(1)) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+width, destY+height) == int32(TCL_ERROR) { goto error } bytesPerLine = (*(*int32)(unsafe.Pointer(bp + 36))**(*int32)(unsafe.Pointer(bp + 64)) + int32(31)) / int32(32) * int32(4) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = int32(3) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = width * int32(3) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = width (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) *(*int32)(unsafe.Pointer(bp + 20)) = int32(2) *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = *(*int32)(unsafe.Pointer(bp + 20)) if *(*int32)(unsafe.Pointer(bp + 44)) == BI_RGB || *(*int32)(unsafe.Pointer(bp + 44)) == int32(BI_BITFIELDS) { /* No compression */ line = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(bytesPerLine)) if line == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+896, libc.UintptrFromInt32(0))) goto error } y = srcY + height for { if !(y < *(*int32)(unsafe.Pointer(bp + 68))) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } goto _1 _1: ; y++ } switch *(*int32)(unsafe.Pointer(bp + 36)) { case int32(32): v2 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(int32(3)*width)) expline = v2 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = v2 if expline == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+896, libc.UintptrFromInt32(0))) goto error } y = height - int32(1) for { if !(y >= 0) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = srcX for { if !(x < srcX+width) { break } v5 = expline expline++ *(*uint8)(unsafe.Pointer(v5)) = *(*uint8)(unsafe.Pointer(line + uintptr(x*int32(4)+0))) v6 = expline expline++ *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(line + uintptr(x*int32(4)+int32(1)))) v7 = expline expline++ *(*uint8)(unsafe.Pointer(v7)) = *(*uint8)(unsafe.Pointer(line + uintptr(x*int32(4)+int32(2)))) goto _4 _4: ; x++ } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, destY+y, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { goto error } expline = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr goto _3 _3: ; y-- } case int32(24): (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = line + uintptr(srcX*int32(3)) y = height - int32(1) for { if !(y >= 0) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, destY+y, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { goto error } goto _8 _8: ; y-- } case int32(16): v9 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(int32(3)*width)) expline = v9 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = v9 if expline == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+896, libc.UintptrFromInt32(0))) goto error } y = height - int32(1) for { if !(y >= 0) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = srcX for { if !(x < srcX+width) { break } rgb = uint16(_getUInt16(tls, line+uintptr(x*int32(2)))) v12 = expline expline++ *(*uint8)(unsafe.Pointer(v12)) = uint8(uint32(rgb) & (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(2)].Fmask >> (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(2)].Fshiftin << (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(2)].Fshiftout) v13 = expline expline++ *(*uint8)(unsafe.Pointer(v13)) = uint8(uint32(rgb) & (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(1)].Fmask >> (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(1)].Fshiftin << (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[int32(1)].Fshiftout) v14 = expline expline++ *(*uint8)(unsafe.Pointer(v14)) = uint8(uint32(rgb) & (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[0].Fmask >> (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[0].Fshiftin << (*(*[3]TBitmapChannel)(unsafe.Pointer(bp + 88)))[0].Fshiftout) goto _11 _11: ; x++ } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, destY+y, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { goto error } expline = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr goto _10 _10: ; y-- } case int32(8): v15 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(int32(3)*width)) expline = v15 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = v15 if expline == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+896, libc.UintptrFromInt32(0))) goto error } y = height - int32(1) for { if !(y >= 0) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = srcX for { if !(x < srcX+width) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(line + uintptr(x)))) > *(*int32)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+964, libc.UintptrFromInt32(0))) goto error } libc.Xmemcpy(tls, expline, *(*uintptr)(unsafe.Pointer(bp + 72))+uintptr(int32(3)*libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(line + uintptr(x))))), uint32(3)) expline += uintptr(3) goto _17 _17: ; x++ } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, destY+y, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { goto error } expline = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr goto _16 _16: ; y-- } case int32(4): v18 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(int32(3)*width)) expline = v18 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = v18 if expline == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+896, libc.UintptrFromInt32(0))) goto error } y = height - int32(1) for { if !(y >= 0) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = srcX for { if !(x < srcX+width) { break } if x&int32(1) != 0 { c = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(line + uintptr(x/int32(2))))) & int32(0x0f) } else { c = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(line + uintptr(x/int32(2))))) >> int32(4) } if c > *(*int32)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+964, libc.UintptrFromInt32(0))) goto error } libc.Xmemcpy(tls, expline, *(*uintptr)(unsafe.Pointer(bp + 72))+uintptr(int32(3)*c), uint32(3)) expline += uintptr(3) goto _20 _20: ; x++ } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, destY+y, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { goto error } expline = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr goto _19 _19: ; y-- } case int32(1): v21 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(int32(3)*width)) expline = v21 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = v21 if expline == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+896, libc.UintptrFromInt32(0))) goto error } y = height - int32(1) for { if !(y >= 0) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = srcX for { if !(x < srcX+width) { break } c1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(line + uintptr(x/int32(8))))) >> (int32(7) - x%int32(8)) & int32(1) if c1 > *(*int32)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+964, libc.UintptrFromInt32(0))) goto error } libc.Xmemcpy(tls, expline, *(*uintptr)(unsafe.Pointer(bp + 72))+uintptr(int32(3)*c1), uint32(3)) expline += uintptr(3) goto _23 _23: ; x++ } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, destY+y, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { goto error } expline = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr goto _22 _22: ; y-- } default: libc.X__builtin_snprintf(tls, bp+124, uint32(20), __ccgo_ts+999, libc.VaList(bp+184, *(*int32)(unsafe.Pointer(bp + 36)))) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, bp+124, __ccgo_ts+1002, libc.UintptrFromInt32(0))) goto error } } else { x = srcX y = *(*int32)(unsafe.Pointer(bp + 68)) - int32(1) v24 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(int32(3)**(*int32)(unsafe.Pointer(bp + 64)))) expline = v24 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = v24 if expline == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+896, libc.UintptrFromInt32(0))) goto error } if *(*int32)(unsafe.Pointer(bp + 36)) != int32(4) && *(*int32)(unsafe.Pointer(bp + 36)) != int32(8) { libc.X__builtin_snprintf(tls, bp+124, uint32(20), __ccgo_ts+999, libc.VaList(bp+184, *(*int32)(unsafe.Pointer(bp + 36)))) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+1037, bp+124, __ccgo_ts+1072, libc.UintptrFromInt32(0))) goto error } for int32(1) != 0 { if int32(2) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+168, int32(2)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+1090, libc.UintptrFromInt32(0))) goto error } if libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 168)))[0]) != 0 { howMuch = (*(*[2]uint8)(unsafe.Pointer(bp + 168)))[0] switch *(*int32)(unsafe.Pointer(bp + 36)) { case int32(8): i = 0 for { if !(i < libc.Int32FromUint8(howMuch)) { break } if libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 168)))[int32(1)]) > *(*int32)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+964, libc.UintptrFromInt32(0))) goto error } libc.Xmemcpy(tls, expline, *(*uintptr)(unsafe.Pointer(bp + 72))+uintptr(int32(3)*libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 168)))[int32(1)])), uint32(3)) if x >= srcX+width-int32(1) { break } expline += uintptr(3) goto _25 _25: ; i++ x++ } case int32(4): i = 0 for { if !(i < libc.Int32FromUint8(howMuch)) { break } if x&int32(1) != 0 { c2 = libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 168)))[int32(1)]) & int32(0x0f) } else { c2 = libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 168)))[int32(1)]) >> int32(4) } if c2 > *(*int32)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+964, libc.UintptrFromInt32(0))) goto error } libc.Xmemcpy(tls, expline, *(*uintptr)(unsafe.Pointer(bp + 72))+uintptr(int32(3)*c2), uint32(3)) if x >= srcX+width-int32(1) { break } expline += uintptr(3) goto _26 _26: ; i++ x++ } break } } else { if libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 168)))[int32(1)]) > int32(2) { /* uncompressed record */ howMuch = (*(*[2]uint8)(unsafe.Pointer(bp + 168)))[int32(1)] switch *(*int32)(unsafe.Pointer(bp + 36)) { case int32(8): i = 0 for { if !(i < libc.Int32FromUint8(howMuch)) { break } if int32(1) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+172, int32(1)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+1090, libc.UintptrFromInt32(0))) goto error } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 172))) > *(*int32)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+964, libc.UintptrFromInt32(0))) goto error } libc.Xmemcpy(tls, expline, *(*uintptr)(unsafe.Pointer(bp + 72))+uintptr(int32(3)*libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 172)))), uint32(3)) if x >= srcX+width-int32(1) { break } expline += uintptr(3) goto _27 _27: ; i++ x++ } case int32(4): i = 0 for { if !(i < libc.Int32FromUint8(howMuch)) { break } if int32(1) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+172, int32(1)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+1090, libc.UintptrFromInt32(0))) goto error } j = 0 for { if !(j < int32(2)) { break } if x&int32(1) != 0 { c2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 172))) & int32(0x0f) } else { c2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 172))) >> int32(4) } if c2 > *(*int32)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+964, libc.UintptrFromInt32(0))) goto error } libc.Xmemcpy(tls, expline, *(*uintptr)(unsafe.Pointer(bp + 72))+uintptr(int32(3)*c2), uint32(3)) if x >= srcX+width-int32(1) { break } expline += uintptr(3) goto _29 _29: ; j++ x++ } goto _28 _28: ; i += int32(2) } break } if libc.Int32FromUint8(howMuch)%int32(2) != 0 && *(*int32)(unsafe.Pointer(bp + 36)) == int32(4) { howMuch++ } if libc.Int32FromUint8(howMuch)/(int32(8) / *(*int32)(unsafe.Pointer(bp + 36)))%int32(2) != 0 { if int32(1) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+172, int32(1)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+1090, libc.UintptrFromInt32(0))) goto error } } } else { if libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 168)))[int32(1)]) == 0 { /* End of line */ if destY+y > *(*int32)(unsafe.Pointer(bp + 68)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+1105, libc.UintptrFromInt32(0))) goto error } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, destY+y, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { goto error } y-- x = srcX expline = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr if y < 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+1105, libc.UintptrFromInt32(0))) goto error } } else { if libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 168)))[int32(1)]) == int32(1) { /* End of bitmap */ break } else { if libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 168)))[int32(1)]) == int32(2) { /* Deltarecord */ if int32(2) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+170, int32(2)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+184, __ccgo_ts+1090, libc.UintptrFromInt32(0))) goto error } x += libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 170)))[0]) y += libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp + 170)))[int32(1)]) } } } } } } } (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, 0) if *(*uintptr)(unsafe.Pointer(bp + 72)) != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, *(*uintptr)(unsafe.Pointer(bp + 72))) } if line != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) } if expline != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr) } return TCL_OK goto error error: ; (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, 0) if *(*uintptr)(unsafe.Pointer(bp + 72)) != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, *(*uintptr)(unsafe.Pointer(bp + 72))) } if line != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) } if expline != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr) } return int32(TCL_ERROR) } func _CommonWrite(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, handle uintptr, blockPtr uintptr, metadataIn uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var alphaOffset, blueOffset, bperline, greenOffset, i, nbytes, ncolors, pixel, pixel1, x, xres, y, yres, v1, v5 int32 var colors [256]int32 var imagePtr, pixelPtr uintptr var v10, v11 uint8 var _ /* buf at bp+0 */ [4]uint8 var _ /* opts at bp+24 */ TFMTOPT var _ /* xdpi at bp+8 */ float64 var _ /* ydpi at bp+16 */ float64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, bperline, colors, greenOffset, i, imagePtr, nbytes, ncolors, pixel, pixel1, pixelPtr, x, xres, y, yres, v1, v10, v11, v5 if _ParseFormatOpts(tls, interp, format, bp+24, libc.Int32FromInt32(1)<= int32(512) { for ncolors < int32(256) { v5 = ncolors ncolors++ colors[v5] = 0 } nbytes = int32(1) } else { nbytes = int32(3) ncolors = 0 } bperline = ((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth*nbytes + int32(3)) / int32(4) * int32(4) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, __ccgo_ts+878, int32(2)) _putint(tls, handle, int32(54)+ncolors*int32(4)+bperline*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) _putint(tls, handle, 0) _putint(tls, handle, int32(54)+ncolors*int32(4)) _putint(tls, handle, int32(40)) _putint(tls, handle, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) _putint(tls, handle, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) _putint(tls, handle, int32(1)+nbytes<> int32(8)) (*(*[4]uint8)(unsafe.Pointer(bp)))[int32(2)] = libc.Uint8FromInt32(i >> int32(16)) (*(*[4]uint8)(unsafe.Pointer(bp)))[int32(3)] = libc.Uint8FromInt32(i >> int32(24)) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, int32(4)) } const DEBUG_READ = 0 const FALSE = 0 const MAX_SHORT = 32767 const PACKAGE_NAME2 = "tkimgdted" const PACKAGE_STRING2 = "tkimgdted 2.0.1" const PACKAGE_TARNAME2 = "tkimgdted" const PACKAGE_TCLNAME2 = "img::dted" const TRUE = 1 const strIntel = "Intel" const strMotorola = "Motorola" var _sImageFormat = TTk_PhotoImageFormat{ Fname: __ccgo_ts + 1146, } func init() { p := unsafe.Pointer(&_sImageFormat) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatch) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatch) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileRead) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringRead) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWrite) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWrite) } /* *---------------------------------------------------------------------------- * * Tkimgdted_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgdted_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<> int32(24)) *(*TInt)(unsafe.Pointer(bp + 4)) &= int32(0x00ffffff) if libc.Int32FromUint8(recognition_sentinel) != int32(170) { libc.X__builtin_snprintf(tls, bp+12, uint32(100), __ccgo_ts+1625, libc.VaList(bp+224, libc.Int32FromUint8(recognition_sentinel))) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+224, bp+12, libc.UintptrFromInt32(0))) return uint8(FALSE) } /* Read the elevation data into the supplied column buffer "buf". */ nBytes = libc.Int32FromUint32(uint32(2) * libc.Uint32FromInt32(nRows)) if nBytes != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, buf, nBytes) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+224, __ccgo_ts+1665, libc.UintptrFromInt32(0))) return uint8(FALSE) } /* Copy (and swap bytes, if needed) from the column buffer into the pixel array (shorts). Simultaneously calculate checksum, part 2. */ if hostIsIntel != 0 { i = 0 for { if !(i < nRows) { break } mPtr = pixels + uintptr(i*nCols)*2 + uintptr(curCol)*2 v2 = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr)) = v2 checksum1 += libc.Int32FromUint8(v2) v3 = *(*uint8)(unsafe.Pointer(bufPtr)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = v3 checksum1 += libc.Int32FromUint8(v3) bufPtr += uintptr(2) goto _1 _1: ; i++ } } else { i = 0 for { if !(i < nRows) { break } mPtr = pixels + uintptr(i*nCols)*2 + uintptr(curCol)*2 v5 = *(*uint8)(unsafe.Pointer(bufPtr)) *(*uint8)(unsafe.Pointer(mPtr)) = v5 checksum1 += libc.Int32FromUint8(v5) v6 = *(*uint8)(unsafe.Pointer(bufPtr + 1)) *(*uint8)(unsafe.Pointer(mPtr + 1)) = v6 checksum1 += libc.Int32FromUint8(v6) bufPtr += uintptr(2) goto _4 _4: ; i++ } } /* Read the checksum */ if !(_readInt(tls, handle, bp+8) != 0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+224, __ccgo_ts+1695, libc.UintptrFromInt32(0))) return uint8(FALSE) } if *(*TInt)(unsafe.Pointer(bp + 8)) != checksum1 { libc.X__builtin_snprintf(tls, bp+112, uint32(100), __ccgo_ts+1719, libc.VaList(bp+224, *(*TInt)(unsafe.Pointer(bp + 8)), checksum1)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+224, bp+112, libc.UintptrFromInt32(0))) return uint8(FALSE) } return uint8(TRUE) } func _readDtedFile(tls *libc.TLS, interp uintptr, handle uintptr, buf uintptr, width TInt, height TInt, nchan TInt, hostIsIntel TBoln, verbose TBoln, minVals uintptr, maxVals uintptr) (r TBoln) { bp := tls.Alloc(32) defer tls.Free(32) var bufPtr, colBuf uintptr var c, x, y TInt _, _, _, _, _ = bufPtr, c, colBuf, x, y bufPtr = buf c = 0 for { if !(c < nchan) { break } *(*TShort)(unsafe.Pointer(minVals + uintptr(c)*2)) = int16(MAX_SHORT) *(*TShort)(unsafe.Pointer(maxVals + uintptr(c)*2)) = int16(-int32(32768)) goto _1 _1: ; c++ } colBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, uint32(2)*libc.Uint32FromInt32(nchan)*libc.Uint32FromInt32(height)) if colBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+896, libc.UintptrFromInt32(0))) return uint8(FALSE) } /* Read the elevation data column by column. */ x = 0 for { if !(x < width) { break } if !(_readDtedColumn(tls, interp, handle, buf, height, width, x, colBuf, hostIsIntel) != 0) { return uint8(FALSE) } goto _2 _2: ; x++ } /* Loop through the elevation data and find minimum and maximum values. Ignore elevation values equal to -32767, because these indicate, no elevation data available. See also function remapShortValues. Note: We extend the range of undefined elevations to all values smaller than ELEV_UNDEFINED, because of DTED files not fully compliant to the specification. */ bufPtr = buf x = 0 for { if !(x < width) { break } y = 0 for { if !(y < height) { break } c = 0 for { if !(c < nchan) { break } if int32(*(*TShort)(unsafe.Pointer(bufPtr))) >= -int32(32000) { if int32(*(*TShort)(unsafe.Pointer(bufPtr))) > int32(*(*TShort)(unsafe.Pointer(maxVals + uintptr(c)*2))) { *(*TShort)(unsafe.Pointer(maxVals + uintptr(c)*2)) = *(*TShort)(unsafe.Pointer(bufPtr)) } if int32(*(*TShort)(unsafe.Pointer(bufPtr))) < int32(*(*TShort)(unsafe.Pointer(minVals + uintptr(c)*2))) { *(*TShort)(unsafe.Pointer(minVals + uintptr(c)*2)) = *(*TShort)(unsafe.Pointer(bufPtr)) } } bufPtr += 2 goto _5 _5: ; c++ } goto _4 _4: ; y++ } goto _3 _3: ; x++ } if verbose != 0 { libc.Xprintf(tls, __ccgo_ts+137, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+1760, libc.VaList(bp+8, int32(*(*TShort)(unsafe.Pointer(minVals + uintptr(c)*2))))) goto _6 _6: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xprintf(tls, __ccgo_ts+167, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+1760, libc.VaList(bp+8, int32(*(*TShort)(unsafe.Pointer(maxVals + uintptr(c)*2))))) goto _7 _7: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xfflush(tls, libc.Xstdout) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, colBuf) return uint8(TRUE) } /* Map the original short values into the range [MIN_SHORT .. MAX_SHORT]. We must take care of values equal to -32767, which indicate that no elevation data is available. So we map this value to the minimum value. See also function readDtedFile. */ func _remapShortValues(tls *libc.TLS, buf uintptr, width TInt, height TInt, nchan TInt, minVals uintptr, maxVals uintptr) (r TBoln) { var bufPtr uintptr var c, tmpInt, x, y TInt var m, t [4]TFloat var tmpShort TShort var v5 int32 _, _, _, _, _, _, _, _, _ = bufPtr, c, m, t, tmpInt, tmpShort, x, y, v5 bufPtr = buf c = 0 for { if !(c < nchan) { break } m[c] = float32(libc.Int32FromInt32(MAX_SHORT) - -libc.Int32FromInt32(32768)) / float32(int32(*(*TShort)(unsafe.Pointer(maxVals + uintptr(c)*2)))-int32(*(*TShort)(unsafe.Pointer(minVals + uintptr(c)*2)))) t[c] = float32(-libc.Int32FromInt32(32768)) - m[c]*float32(*(*TShort)(unsafe.Pointer(minVals + uintptr(c)*2))) goto _1 _1: ; c++ } y = 0 for { if !(y < height) { break } x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } if int32(*(*TShort)(unsafe.Pointer(bufPtr))) >= -int32(32000) { v5 = int32(*(*TShort)(unsafe.Pointer(bufPtr))) } else { v5 = int32(*(*TShort)(unsafe.Pointer(minVals + uintptr(c)*2))) } tmpShort = int16(v5) tmpInt = int32(float64(float32(tmpShort)*m[c]+t[c]) + libc.Float64FromFloat64(0.5)) if tmpInt < -int32(32768) { *(*TShort)(unsafe.Pointer(bufPtr)) = int16(-int32(32768)) } else { if tmpInt > int32(MAX_SHORT) { *(*TShort)(unsafe.Pointer(bufPtr)) = int16(MAX_SHORT) } else { *(*TShort)(unsafe.Pointer(bufPtr)) = int16(tmpInt) } } bufPtr += 2 goto _4 _4: ; c++ } goto _3 _3: ; x++ } goto _2 _2: ; y++ } return uint8(TRUE) } func _ParseFormatOpts1(tls *libc.TLS, interp uintptr, format uintptr, opts uintptr, mode int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var i, v2, v3 TTcl_Size var optionStr uintptr var _ /* boolVal at bp+12 */ int32 var _ /* doubleVal at bp+24 */ float64 var _ /* index at bp+4 */ int32 var _ /* intVal at bp+16 */ int32 var _ /* objc at bp+0 */ TTcl_Size var _ /* objv at bp+8 */ uintptr _, _, _, _ = i, optionStr, v2, v3 /* Initialize format options with default values. */ (*TFMTOPT1)(unsafe.Pointer(opts)).Fverbose = uint8(FALSE) (*TFMTOPT1)(unsafe.Pointer(opts)).FminVal = int16(-int32(1)) (*TFMTOPT1)(unsafe.Pointer(opts)).FmaxVal = int16(-int32(1)) (*TFMTOPT1)(unsafe.Pointer(opts)).Fgamma = float64(1) if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ListObjGetElementsPtr})))(tls, interp, format, bp, bp+8) == int32(TCL_ERROR) { return int32(TCL_ERROR) } i = int32(1) for { if !(i < *(*TTcl_Size)(unsafe.Pointer(bp))) { break } if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+40, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)<= 0 { (*TFMTOPT1)(unsafe.Pointer(opts)).FminVal = int16(*(*int32)(unsafe.Pointer(bp + 16))) } case 2: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetInt})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+1870, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } if *(*int32)(unsafe.Pointer(bp + 16)) >= 0 { (*TFMTOPT1)(unsafe.Pointer(opts)).FmaxVal = int16(*(*int32)(unsafe.Pointer(bp + 16))) } case 3: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+24) == int32(TCL_ERROR) || *(*float64)(unsafe.Pointer(bp + 24)) < libc.Float64FromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+1925, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 24)) >= float64(0) { (*TFMTOPT1)(unsafe.Pointer(opts)).Fgamma = *(*float64)(unsafe.Pointer(bp + 24)) } break } } else { /* No write functionality. */ } goto _1 _1: ; i++ } return TCL_OK } var _readOptions1 = [5]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 1764, 2: __ccgo_ts + 1769, 3: __ccgo_ts + 1774, 4: libc.UintptrFromInt32(0), } func _FileMatch(tls *libc.TLS, chan1 TTcl_Channel, dummy535 uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonMatch1(tls, interp, bp, format, widthPtr, heightPtr, libc.UintptrFromInt32(0)) } func _StringMatch(tls *libc.TLS, dataObj uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonMatch1(tls, interp, bp, format, widthPtr, heightPtr, libc.UintptrFromInt32(0)) } func _CommonMatch1(tls *libc.TLS, interp uintptr, handle uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, dtedHeaderPtr uintptr) (r int32) { bp := tls.Alloc(3472) defer tls.Free(3472) var _ /* buf at bp+3440 */ [5]TByte var _ /* nCols at bp+3432 */ TInt var _ /* nRows at bp+3428 */ TInt var _ /* th at bp+0 */ TDTEDHEADER (*(*[5]TByte)(unsafe.Pointer(bp + 3440)))[int32(4)] = uint8('\000') if !(_readHeader(tls, handle, bp) != 0) { return FALSE } libc.Xmemcpy(tls, bp+3440, bp+80+281, uint32(4)) libc.Xsscanf(tls, bp+3440, __ccgo_ts+2000, libc.VaList(bp+3456, bp+3428)) libc.Xmemcpy(tls, bp+3440, bp+80+285, uint32(4)) libc.Xsscanf(tls, bp+3440, __ccgo_ts+2000, libc.VaList(bp+3456, bp+3432)) *(*int32)(unsafe.Pointer(widthPtr)) = *(*TInt)(unsafe.Pointer(bp + 3432)) *(*int32)(unsafe.Pointer(heightPtr)) = *(*TInt)(unsafe.Pointer(bp + 3428)) if dtedHeaderPtr != 0 { *(*TDTEDHEADER)(unsafe.Pointer(dtedHeaderPtr)) = *(*TDTEDHEADER)(unsafe.Pointer(bp)) } return int32(TRUE) } func _FileRead(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, filename uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonRead1(tls, interp, bp, filename, format, imageHandle, destX, destY, width, height, srcX, srcY) } func _StringRead(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonRead1(tls, interp, bp, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY) } func _CommonRead1(tls *libc.TLS, interp uintptr, handle uintptr, filename uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(5616) defer tls.Free(5616) var c, nchan, y TInt var hostIsIntel TBoln var outHeight, outWidth, outY, stopY, v3, v4, v5 int32 var pixbufPtr, rawbufPtr, v7 uintptr var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* fileHeight at bp+40 */ TInt var _ /* fileWidth at bp+36 */ TInt var _ /* gtable at bp+3528 */ [257]TDouble var _ /* maxVals at bp+56 */ [4]TShort var _ /* minVals at bp+48 */ [4]TShort var _ /* opts at bp+3504 */ TFMTOPT1 var _ /* tf at bp+64 */ TDTEDFILE _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, hostIsIntel, nchan, outHeight, outWidth, outY, pixbufPtr, rawbufPtr, stopY, y, v3, v4, v5, v7 nchan = int32(1) libc.Xmemset(tls, bp+64, 0, uint32(3436)) _CommonMatch1(tls, interp, handle, format, bp+36, bp+40, bp+64) if _ParseFormatOpts1(tls, interp, format, bp+3504, libc.Int32FromInt32(1)< *(*TInt)(unsafe.Pointer(bp + 36)) { outWidth = *(*TInt)(unsafe.Pointer(bp + 36)) - srcX } else { outWidth = width } if srcY+height > *(*TInt)(unsafe.Pointer(bp + 40)) { outHeight = *(*TInt)(unsafe.Pointer(bp + 40)) - srcY } else { outHeight = height } if outWidth <= 0 || outHeight <= 0 || srcX >= *(*TInt)(unsafe.Pointer(bp + 36)) || srcY >= *(*TInt)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+5592, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } hostIsIntel = libc.Uint8FromInt32((*(*func(*libc.TLS) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_IsIntelPtr})))(tls)) (*(*TDTEDFILE)(unsafe.Pointer(bp + 64))).Frawbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))**(*TInt)(unsafe.Pointer(bp + 40))*nchan)*uint32(2)) if (*(*TDTEDFILE)(unsafe.Pointer(bp + 64))).Frawbuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+5592, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if !(_readDtedFile(tls, interp, handle, (*(*TDTEDFILE)(unsafe.Pointer(bp + 64))).Frawbuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), nchan, hostIsIntel, (*(*TFMTOPT1)(unsafe.Pointer(bp + 3504))).Fverbose, bp+48, bp+56) != 0) { return int32(TCL_ERROR) } if int32((*(*TFMTOPT1)(unsafe.Pointer(bp + 3504))).FminVal) >= 0 { c = 0 for { if !(c < nchan) { break } (*(*[4]TShort)(unsafe.Pointer(bp + 48)))[c] = (*(*TFMTOPT1)(unsafe.Pointer(bp + 3504))).FminVal goto _1 _1: ; c++ } } if int32((*(*TFMTOPT1)(unsafe.Pointer(bp + 3504))).FmaxVal) >= 0 { c = 0 for { if !(c < nchan) { break } (*(*[4]TShort)(unsafe.Pointer(bp + 56)))[c] = (*(*TFMTOPT1)(unsafe.Pointer(bp + 3504))).FmaxVal goto _2 _2: ; c++ } } _remapShortValues(tls, (*(*TDTEDFILE)(unsafe.Pointer(bp + 64))).Frawbuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), nchan, bp+48, bp+56) if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+outWidth, destY+outHeight) == int32(TCL_ERROR) { _dtedClose(tls, bp+64) return int32(TCL_ERROR) } (*(*TDTEDFILE)(unsafe.Pointer(bp + 64))).Fpixbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))*nchan)) if (*(*TDTEDFILE)(unsafe.Pointer(bp + 64))).Fpixbuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+5592, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = nchan (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = *(*TInt)(unsafe.Pointer(bp + 36)) * nchan (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = outWidth (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) *(*int32)(unsafe.Pointer(bp + 20)) = 0 if nchan > int32(1) { v3 = int32(1) } else { v3 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = v3 if nchan > int32(2) { v4 = int32(2) } else { v4 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = v4 if nchan > int32(3) { v5 = int32(3) } else { v5 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = v5 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = (*(*TDTEDFILE)(unsafe.Pointer(bp + 64))).Fpixbuf + uintptr(srcX*nchan) stopY = srcY + outHeight outY = destY y = 0 for { if !(y < stopY) { break } pixbufPtr = (*(*TDTEDFILE)(unsafe.Pointer(bp + 64))).Fpixbuf rawbufPtr = (*(*TDTEDFILE)(unsafe.Pointer(bp + 64))).Frawbuf + uintptr((*(*TInt)(unsafe.Pointer(bp + 40))-int32(1)-y)**(*TInt)(unsafe.Pointer(bp + 36))*nchan)*2 if (*(*TFMTOPT1)(unsafe.Pointer(bp + 3504))).Fgamma != float64(1) { v7 = bp + 3528 } else { v7 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, int32, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ShortToUBytePtr})))(tls, *(*TInt)(unsafe.Pointer(bp + 36))*nchan, rawbufPtr, v7, pixbufPtr) rawbufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp + 36))*nchan) * 2 if y >= srcY { if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { _dtedClose(tls, bp+64) return int32(TCL_ERROR) } outY++ } goto _6 _6: ; y++ } _dtedClose(tls, bp+64) return TCL_OK } func _FileWrite(tls *libc.TLS, interp uintptr, dummy758 uintptr, dummy759 uintptr, dummy760 uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2034, libc.VaList(bp+8, _sImageFormat.Fname))) return int32(TCL_ERROR) } func _StringWrite(tls *libc.TLS, interp uintptr, dummy768 uintptr, dummy769 uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2034, libc.VaList(bp+8, _sImageFormat.Fname))) return int32(TCL_ERROR) } const FPF_ID = "FPF Public Image Format" const FPF_STRING_LEN = 32 const PACKAGE_NAME3 = "tkimgflir" const PACKAGE_STRING3 = "tkimgflir 2.0.1" const PACKAGE_TARNAME3 = "tkimgflir" const PACKAGE_TCLNAME3 = "img::flir" const TYPE_DOUBLE = 3 const TYPE_FLOAT = 2 const TYPE_INT = 1 const TYPE_SHORT = 0 const strDouble = "double" const strFloat = "float" const strInt = "int" const strShort = "short" const strUnknown = "Unknown" var _sImageFormat1 = TTk_PhotoImageFormat{ Fname: __ccgo_ts + 2070, } func init() { p := unsafe.Pointer(&_sImageFormat1) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatch1) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatch1) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileRead1) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringRead1) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWrite1) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWrite1) } /* *---------------------------------------------------------------------------- * * Tkimgflir_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgflir_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+32, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)<= float64(0) { (*TFMTOPT2)(unsafe.Pointer(opts)).FminVal = float32(*(*float64)(unsafe.Pointer(bp + 16))) } case 2: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2687, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 16)) >= float64(0) { (*TFMTOPT2)(unsafe.Pointer(opts)).FmaxVal = float32(*(*float64)(unsafe.Pointer(bp + 16))) } case 3: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) || *(*float64)(unsafe.Pointer(bp + 16)) < float64(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+1925, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 16)) >= float64(0) { (*TFMTOPT2)(unsafe.Pointer(opts)).Fgamma = float32(*(*float64)(unsafe.Pointer(bp + 16))) } case 4: if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+2169, libc.Xstrlen(tls, __ccgo_ts+2169)) != 0) { (*TFMTOPT2)(unsafe.Pointer(opts)).FmapMode = IMG_MAP_NONE } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+2174, libc.Xstrlen(tls, __ccgo_ts+2174)) != 0) { (*TFMTOPT2)(unsafe.Pointer(opts)).FmapMode = int32(IMG_MAP_MINMAX) } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+2181, libc.Xstrlen(tls, __ccgo_ts+2181)) != 0) { (*TFMTOPT2)(unsafe.Pointer(opts)).FmapMode = int32(IMG_MAP_AGC) } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2743, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } } } case 5: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2799, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 16)) >= float64(0) { (*TFMTOPT2)(unsafe.Pointer(opts)).Fsaturation = float32(*(*float64)(unsafe.Pointer(bp + 16))) } case 6: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) || *(*float64)(unsafe.Pointer(bp + 16)) < float64(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2854, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 16)) >= float64(0) { (*TFMTOPT2)(unsafe.Pointer(opts)).FcutOff = float32(*(*float64)(unsafe.Pointer(bp + 16))) } case 7: if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+12) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2930, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT2)(unsafe.Pointer(opts)).FprintAgc = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 12))) break } } else { /* No write functionality. */ } goto _1 _1: ; i++ } /* Convert minimum and maximum range values. */ if float64((*TFMTOPT2)(unsafe.Pointer(opts)).FminVal) >= float64(0) && float64((*TFMTOPT2)(unsafe.Pointer(opts)).FmaxVal) >= float64(0) && (*TFMTOPT2)(unsafe.Pointer(opts)).FminVal >= (*TFMTOPT2)(unsafe.Pointer(opts)).FmaxVal { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+3000, 0)) return int32(TCL_ERROR) } return TCL_OK } var _readOptions2 = [9]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 1764, 2: __ccgo_ts + 1769, 3: __ccgo_ts + 1774, 4: __ccgo_ts + 2596, 5: __ccgo_ts + 2601, 6: __ccgo_ts + 2613, 7: __ccgo_ts + 2621, 8: libc.UintptrFromInt32(0), } func _FileMatch1(tls *libc.TLS, chan1 TTcl_Channel, filename uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonMatch2(tls, interp, bp, format, widthPtr, heightPtr, libc.UintptrFromInt32(0)) } func _StringMatch1(tls *libc.TLS, dataObj uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonMatch2(tls, interp, bp, format, widthPtr, heightPtr, libc.UintptrFromInt32(0)) } func _CommonMatch2(tls *libc.TLS, interp uintptr, handle uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, fpfHeaderPtr uintptr) (r int32) { bp := tls.Alloc(896) defer tls.Free(896) var _ /* th at bp+0 */ TFPF_HEADER if !(_readHeader1(tls, interp, handle, bp) != 0) { return FALSE } *(*int32)(unsafe.Pointer(widthPtr)) = libc.Int32FromUint16((*(*TFPF_HEADER)(unsafe.Pointer(bp))).FimgData.Fwidth) *(*int32)(unsafe.Pointer(heightPtr)) = libc.Int32FromUint16((*(*TFPF_HEADER)(unsafe.Pointer(bp))).FimgData.Fheight) if fpfHeaderPtr != 0 { *(*TFPF_HEADER)(unsafe.Pointer(fpfHeaderPtr)) = *(*TFPF_HEADER)(unsafe.Pointer(bp)) } return int32(TRUE) } func _FileRead1(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, filename uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonRead2(tls, interp, bp, filename, format, imageHandle, destX, destY, width, height, srcX, srcY) } func _StringRead1(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonRead2(tls, interp, bp, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY) } func _CommonRead2(tls *libc.TLS, interp uintptr, handle uintptr, filename uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(3152) defer tls.Free(3152) var c, y TInt var doubleBufPtr, floatBufPtr, pixbufPtr, uintBufPtr, ushortBufPtr, v12, v13, v14, v15 uintptr var nChans, outHeight, outWidth, outY, result, stopY, v10, v8, v9 int32 var swapBytes TBoln var v4, v5, v6, v7 float64 var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* fileHeight at bp+40 */ TInt var _ /* fileWidth at bp+36 */ TInt var _ /* gtable at bp+1056 */ [257]TDouble var _ /* maxVals at bp+80 */ [4]TDouble var _ /* minVals at bp+48 */ [4]TDouble var _ /* opts at bp+1024 */ TFMTOPT2 var _ /* tf at bp+112 */ TFPF_FILE _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, doubleBufPtr, floatBufPtr, nChans, outHeight, outWidth, outY, pixbufPtr, result, stopY, swapBytes, uintBufPtr, ushortBufPtr, y, v10, v12, v13, v14, v15, v4, v5, v6, v7, v8, v9 *(*TInt)(unsafe.Pointer(bp + 36)) = 0 *(*TInt)(unsafe.Pointer(bp + 40)) = 0 result = TCL_OK nChans = int32(1) swapBytes = uint8(FALSE) libc.Xmemset(tls, bp+112, 0, uint32(912)) if !(_CommonMatch2(tls, interp, handle, format, bp+36, bp+40, bp+112) != 0) { return int32(TCL_ERROR) } if _ParseFormatOpts2(tls, interp, format, bp+1024, libc.Int32FromInt32(1)< *(*TInt)(unsafe.Pointer(bp + 36)) { outWidth = *(*TInt)(unsafe.Pointer(bp + 36)) - srcX } else { outWidth = width } if srcY+height > *(*TInt)(unsafe.Pointer(bp + 40)) { outHeight = *(*TInt)(unsafe.Pointer(bp + 40)) - srcY } else { outHeight = height } if outWidth <= 0 || outHeight <= 0 || srcX >= *(*TInt)(unsafe.Pointer(bp + 36)) || srcY >= *(*TInt)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+3120, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*func(*libc.TLS, float64, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_CreateGammaTablePtr})))(tls, float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fgamma), bp+1056) switch libc.Int32FromUint16((*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).Fth.FimgData.FpixelType) { case int32(TYPE_DOUBLE): (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FdoubleBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))**(*TInt)(unsafe.Pointer(bp + 40))*nChans)*uint32(8)) if (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FdoubleBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+3120, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, uintptr, int32, int32, int32, int32, int32, int32, uintptr, uintptr, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadDoubleFilePtr})))(tls, handle, (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FdoubleBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), nChans, libc.Int32FromUint8(swapBytes), libc.Int32FromUint8((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fverbose), libc.BoolInt32((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmapMode != IMG_MAP_NONE), bp+48, bp+80, float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fsaturation)) case int32(TYPE_FLOAT): (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FfloatBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))**(*TInt)(unsafe.Pointer(bp + 40))*nChans)*uint32(4)) if (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FfloatBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+3120, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, uintptr, int32, int32, int32, int32, int32, int32, uintptr, uintptr, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadFloatFilePtr})))(tls, handle, (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FfloatBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), nChans, libc.Int32FromUint8(swapBytes), libc.Int32FromUint8((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fverbose), libc.BoolInt32((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmapMode != IMG_MAP_NONE), bp+48, bp+80, float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fsaturation)) case int32(TYPE_INT): (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FuintBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))**(*TInt)(unsafe.Pointer(bp + 40))*nChans)*uint32(4)) if (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FuintBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+3120, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, uintptr, int32, int32, int32, int32, int32, int32, uintptr, uintptr, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadUIntFilePtr})))(tls, handle, (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FuintBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), nChans, libc.Int32FromUint8(swapBytes), libc.Int32FromUint8((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fverbose), libc.BoolInt32((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmapMode != IMG_MAP_NONE), bp+48, bp+80, float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fsaturation)) case TYPE_SHORT: (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FushortBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))**(*TInt)(unsafe.Pointer(bp + 40))*nChans)*uint32(2)) if (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FushortBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+3120, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, uintptr, int32, int32, int32, int32, int32, int32, uintptr, uintptr, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadUShortFilePtr})))(tls, handle, (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FushortBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), nChans, libc.Int32FromUint8(swapBytes), libc.Int32FromUint8((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fverbose), libc.BoolInt32((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmapMode != IMG_MAP_NONE), bp+48, bp+80, float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fsaturation)) default: (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+3120, __ccgo_ts+3065, __ccgo_ts+3095, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } switch (*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmapMode { case IMG_MAP_NONE: c = 0 for { if !(c < nChans) { break } (*(*[4]TDouble)(unsafe.Pointer(bp + 48)))[c] = float64(0) (*(*[4]TDouble)(unsafe.Pointer(bp + 80)))[c] = float64(255) goto _1 _1: ; c++ } case int32(IMG_MAP_MINMAX): if float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FminVal) >= float64(0) { c = 0 for { if !(c < nChans) { break } (*(*[4]TDouble)(unsafe.Pointer(bp + 48)))[c] = float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FminVal) goto _2 _2: ; c++ } } if float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmaxVal) >= float64(0) { c = 0 for { if !(c < nChans) { break } (*(*[4]TDouble)(unsafe.Pointer(bp + 80)))[c] = float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmaxVal) goto _3 _3: ; c++ } } case int32(IMG_MAP_AGC): /* Nothing to do. Saturation is considered on tkimg_ReadFloatFile. */ break } switch libc.Int32FromUint16((*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).Fth.FimgData.FpixelType) { case int32(TYPE_DOUBLE): if (*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmapMode == int32(IMG_MAP_AGC) { v4 = float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FcutOff) } else { v4 = -libc.Float64FromFloat64(1) } (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr, uintptr, float64, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_RemapDoubleValuesPtr})))(tls, (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FdoubleBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), nChans, bp+48, bp+80, v4, libc.Int32FromUint8((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FprintAgc)) case int32(TYPE_FLOAT): if (*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmapMode == int32(IMG_MAP_AGC) { v5 = float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FcutOff) } else { v5 = -libc.Float64FromFloat64(1) } (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr, uintptr, float64, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_RemapFloatValuesPtr})))(tls, (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FfloatBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), nChans, bp+48, bp+80, v5, libc.Int32FromUint8((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FprintAgc)) case int32(TYPE_INT): if (*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmapMode == int32(IMG_MAP_AGC) { v6 = float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FcutOff) } else { v6 = -libc.Float64FromFloat64(1) } (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr, uintptr, float64, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_RemapUIntValuesPtr})))(tls, (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FuintBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), nChans, bp+48, bp+80, v6, libc.Int32FromUint8((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FprintAgc)) case TYPE_SHORT: if (*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FmapMode == int32(IMG_MAP_AGC) { v7 = float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FcutOff) } else { v7 = -libc.Float64FromFloat64(1) } (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr, uintptr, float64, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_RemapUShortValuesPtr})))(tls, (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FushortBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), nChans, bp+48, bp+80, v7, libc.Int32FromUint8((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).FprintAgc)) break } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+outWidth, destY+outHeight) == int32(TCL_ERROR) { _fpfClose(tls, bp+112) return int32(TCL_ERROR) } (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).Fpixbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))*nChans)) if (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).Fpixbuf == libc.UintptrFromInt32(0) { _fpfClose(tls, bp+112) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+3120, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = nChans (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = *(*TInt)(unsafe.Pointer(bp + 36)) * nChans (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = outWidth (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) *(*int32)(unsafe.Pointer(bp + 20)) = 0 if nChans > int32(1) { v8 = int32(1) } else { v8 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = v8 if nChans > int32(2) { v9 = int32(2) } else { v9 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = v9 if nChans > int32(3) { v10 = int32(3) } else { v10 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = v10 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).Fpixbuf + uintptr(srcX*nChans) stopY = srcY + outHeight outY = destY y = 0 for { if !(y < stopY) { break } pixbufPtr = (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).Fpixbuf switch libc.Int32FromUint16((*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).Fth.FimgData.FpixelType) { case int32(TYPE_DOUBLE): doubleBufPtr = (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FdoubleBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp + 36))*nChans)*8 if float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fgamma) != float64(1) { v12 = bp + 1056 } else { v12 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, int32, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_DoubleToUBytePtr})))(tls, *(*TInt)(unsafe.Pointer(bp + 36))*nChans, doubleBufPtr, v12, pixbufPtr) doubleBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp + 36))*nChans) * 8 case int32(TYPE_FLOAT): floatBufPtr = (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FfloatBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp + 36))*nChans)*4 if float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fgamma) != float64(1) { v13 = bp + 1056 } else { v13 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, int32, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_FloatToUBytePtr})))(tls, *(*TInt)(unsafe.Pointer(bp + 36))*nChans, floatBufPtr, v13, pixbufPtr) floatBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp + 36))*nChans) * 4 case int32(TYPE_INT): uintBufPtr = (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FuintBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp + 36))*nChans)*4 if float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fgamma) != float64(1) { v14 = bp + 1056 } else { v14 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, int32, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_UIntToUBytePtr})))(tls, *(*TInt)(unsafe.Pointer(bp + 36))*nChans, uintBufPtr, v14, pixbufPtr) uintBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp + 36))*nChans) * 4 case TYPE_SHORT: ushortBufPtr = (*(*TFPF_FILE)(unsafe.Pointer(bp + 112))).FushortBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp + 36))*nChans)*2 if float64((*(*TFMTOPT2)(unsafe.Pointer(bp + 1024))).Fgamma) != float64(1) { v15 = bp + 1056 } else { v15 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, int32, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_UShortToUBytePtr})))(tls, *(*TInt)(unsafe.Pointer(bp + 36))*nChans, ushortBufPtr, v15, pixbufPtr) ushortBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp + 36))*nChans) * 2 break } if y >= srcY { if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = int32(TCL_ERROR) break } outY++ } goto _11 _11: ; y++ } _fpfClose(tls, bp+112) return result } func _FileWrite1(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2034, libc.VaList(bp+8, _sImageFormat1.Fname))) return int32(TCL_ERROR) } func _StringWrite1(tls *libc.TLS, interp uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2034, libc.VaList(bp+8, _sImageFormat1.Fname))) return int32(TCL_ERROR) } const CM_ALPHA = 3 const CM_BLUE = 2 const CM_GREEN = 1 const CM_RED = 0 const DEFAULT_BACKGROUND_VALUE = 217 const GIF87a = "GIF87a" const GIF89a = "GIF89a" const GIFBITS = 12 const GIF_EXTENSION = 33 const GIF_SPECIAL = 256 const GIF_START = 44 const GIF_TERMINATOR = 59 const HSIZE = 5003 const INTERLACE = 64 const LOCALCOLORMAP = 128 const MAXCOLORMAPSIZE = 256 const MAX_LWZ_BITS = 12 const PACKAGE_NAME4 = "tkimggif" const PACKAGE_STRING4 = "tkimggif 2.0.1" const PACKAGE_TARNAME4 = "tkimggif" const PACKAGE_TCLNAME4 = "img::gif" var _sImageFormat2 = TTk_PhotoImageFormat{ Fname: __ccgo_ts + 3148, } func init() { p := unsafe.Pointer(&_sImageFormat2) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatch2) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatch2) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileRead2) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringRead2) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWrite2) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWrite2) } /* *---------------------------------------------------------------------------- * * Tkimggif_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimggif_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)< 3 8 bit bytes. A-Z, a-z, 0-9, + * and / represent the 64 values (in order). '=' is a trailing padding char * when the un-encoded data is not a multiple of 3 bytes. We'll ignore white * space when encountered. Any other invalid character is treated as an EOF */ /* * Non-ASCII encoding support: * Most data in a GIF image is binary and is treated as such. However, * a few key bits are stashed in ASCII. If we try to compare those pieces * to the char they represent, it will fail on any non-ASCII (eg, EBCDIC) * system. To accomodate these systems, we test against the numeric value * of the ASCII characters instead of the characters themselves. This is * encoding independant. */ type TGIFImageConfig = struct { Fbuf [280]uint8 Fbytes int32 Fdone int32 Fwindow uint32 FbitsInWindow int32 Fc uintptr Fhandle Ttkimg_Stream } // C documentation // // /* Format options structure for use with ParseFormatOpts */ type TFMTOPT3 = struct { Fverbose int32 FpageIndex int32 } func _printImgInfo3(tls *libc.TLS, width int32, height int32, pageIndex int32, fileName uintptr, msg uintptr) { bp := tls.Alloc(288) defer tls.Free(288) var outChan TTcl_Channel var _ /* str at bp+0 */ [256]uint8 _ = outChan outChan = (*(*func(*libc.TLS, int32) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStdChannel})))(tls, libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+32, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)< *(*int32)(unsafe.Pointer(bp)) { width = *(*int32)(unsafe.Pointer(bp)) - srcX } if srcY+height > *(*int32)(unsafe.Pointer(bp + 4)) { height = *(*int32)(unsafe.Pointer(bp + 4)) - srcY } if width <= 0 || height <= 0 || srcX >= *(*int32)(unsafe.Pointer(bp)) || srcY >= *(*int32)(unsafe.Pointer(bp + 4)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1192, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+width, destY+height) == int32(TCL_ERROR) { return int32(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).FpixelSize = int32(4) *(*int32)(unsafe.Pointer(bp + 8 + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 8 + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 8 + 20 + 2*4)) = int32(2) *(*int32)(unsafe.Pointer(bp + 8 + 20 + 3*4)) = int32(3) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).FpixelPtr = libc.UintptrFromInt32(0) for int32(1) != 0 { if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, gifConfPtr+300, bp+44, int32(1)) != int32(1) { /* * Premature end of image. */ (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1192, __ccgo_ts+3417, libc.UintptrFromInt32(0))) goto error } if libc.Int32FromUint8((*(*[100]uint8)(unsafe.Pointer(bp + 44)))[0]) == int32(GIF_TERMINATOR) { /* * GIF terminator. */ (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1192, __ccgo_ts+3445, libc.UintptrFromInt32(0))) goto error } if libc.Int32FromUint8((*(*[100]uint8)(unsafe.Pointer(bp + 44)))[0]) == int32(GIF_EXTENSION) { /* * This is a GIF extension. */ if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, gifConfPtr+300, bp+44, int32(1)) != int32(1) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1192, __ccgo_ts+3474, libc.UintptrFromInt32(0))) goto error } if _DoExtension(tls, gifConfPtr, libc.Int32FromUint8((*(*[100]uint8)(unsafe.Pointer(bp + 44)))[0]), bp+1168) < 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1192, __ccgo_ts+3525, libc.UintptrFromInt32(0))) goto error } continue } if libc.Int32FromUint8((*(*[100]uint8)(unsafe.Pointer(bp + 44)))[0]) != int32(GIF_START) { /* * Not a valid start character; ignore it. */ continue } if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, gifConfPtr+300, bp+44, int32(9)) != int32(9) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1192, __ccgo_ts+3562, libc.UintptrFromInt32(0))) goto error } imageWidth = libc.Int32FromUint8((*(*[100]uint8)(unsafe.Pointer(bp + 44)))[int32(5)])< imageWidth { width = imageWidth } pageIndex = libc.Int32FromUint8((*(*[100]uint8)(unsafe.Pointer(bp + 44)))[int32(3)])< srcY { destY -= srcY height += srcY srcY = 0 } if height > imageHeight { height = imageHeight } if width <= 0 || height <= 0 { (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).FpixelPtr = uintptr(0) goto noerror } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).Fwidth = width (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).Fheight = height if *(*int32)(unsafe.Pointer(bp + 1168)) >= 0 { v2 = int32(4) } else { v2 = int32(3) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).FpixelSize = v2 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).Fpitch = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).FpixelSize * imageWidth nBytes = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).Fpitch * imageHeight pixBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(nBytes)) if pixBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1192, __ccgo_ts+896, libc.UintptrFromInt32(0))) goto error } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).FpixelPtr = pixBuf if _ReadImage(tls, interp, (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).FpixelPtr, gifConfPtr, imageWidth, imageHeight, bp+144, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), srcX, srcY, libc.BoolInt32(libc.Int32FromUint8((*(*[100]uint8)(unsafe.Pointer(bp + 44)))[int32(8)])&int32(INTERLACE) == int32(INTERLACE)), *(*int32)(unsafe.Pointer(bp + 1168))) != TCL_OK { goto error } if (*(*TFMTOPT3)(unsafe.Pointer(bp + 1176))).Fverbose != 0 { _printImgInfo3(tls, imageWidth, imageHeight, (*(*TFMTOPT3)(unsafe.Pointer(bp + 1176))).FpageIndex, fileName, __ccgo_ts+881) } break } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).FpixelPtr = pixBuf + uintptr(srcY*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).Fpitch) + uintptr(srcX*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 8))).FpixelSize) if *(*int32)(unsafe.Pointer(bp + 1168)) == -int32(1) { v3 = int32(TK_PHOTO_COMPOSITE_SET) } else { v3 = TK_PHOTO_COMPOSITE_OVERLAY } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp+8, destX, destY, width, height, v3) == int32(TCL_ERROR) { goto error } goto noerror noerror: ; if pixBuf != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, pixBuf) } return TCL_OK goto error error: ; if pixBuf != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, pixBuf) } if trashBuffer != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, trashBuffer) } return int32(TCL_ERROR) } /* *---------------------------------------------------------------------- * * StringMatch -- * * This procedure is invoked by the photo image type to see if * an object contains image data in GIF format. * * Results: * The return value is 1 if the first characters in the object are * like GIF data, and 0 otherwise. * * Side effects: * the size of the image is placed in widthPtr and heightPtr. * *---------------------------------------------------------------------- */ func _StringMatch2(tls *libc.TLS, dataObj uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(352) defer tls.Free(352) var _ /* gifConf at bp+0 */ TGIFImageConfig libc.Xmemset(tls, bp, 0, uint32(340)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp+300, dataObj) != 0) { return 0 } return _ReadGIFHeader(tls, bp, widthPtr, heightPtr) } /* *---------------------------------------------------------------------- * * StringRead -- * * This procedure is called by the photo image type to read * GIF format data from a binary string, and give it to * the photo image. * * Results: * A standard TCL completion code. If TCL_ERROR is returned * then an error message is left in the interp's result. * * Side effects: * new data is added to the image given by imageHandle. This * procedure calls FileReadGif by redefining the operation of * fprintf temporarily. * *---------------------------------------------------------------------- */ func _StringRead2(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(352) defer tls.Free(352) var _ /* gifConf at bp+0 */ TGIFImageConfig libc.Xmemset(tls, bp, 0, uint32(340)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp+300, dataObj) != 0) { return 0 } return _CommonRead3(tls, interp, bp, __ccgo_ts+3612, format, imageHandle, destX, destY, width, height, srcX, srcY) } /* *---------------------------------------------------------------------- * * ReadGIFHeader -- * * This procedure reads the GIF header from the beginning of a * GIF file and returns the dimensions of the image. * * Results: * The return value is 1 if file "f" appears to start with * a valid GIF header, 0 otherwise. If the header is valid, * then *widthPtr and *heightPtr are modified to hold the * dimensions of the image. * * Side effects: * The access position in f advances. * *---------------------------------------------------------------------- */ func _ReadGIFHeader(tls *libc.TLS, gifConfPtr uintptr, widthPtr uintptr, heightPtr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [7]uint8 if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, gifConfPtr+300, bp, int32(6)) != int32(6) || libc.Xstrncmp(tls, __ccgo_ts+3624, bp, uint32(6)) != 0 && libc.Xstrncmp(tls, __ccgo_ts+3631, bp, uint32(6)) != 0 { return 0 } if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, gifConfPtr+300, bp, int32(4)) != int32(4) { return 0 } *(*int32)(unsafe.Pointer(widthPtr)) = libc.Int32FromUint8((*(*[7]uint8)(unsafe.Pointer(bp)))[int32(1)])< int32(MAXCOLORMAPSIZE) { return 0 } i = 0 for { if !(i < number) { break } if !(libc.Uint32FromInt32((*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, gifConfPtr+300, bp, int32(3))) == libc.Uint32FromInt64(3)) { return 0 } if buffer != 0 { *(*uint8)(unsafe.Pointer(buffer + uintptr(i)*4)) = (*(*[3]uint8)(unsafe.Pointer(bp)))[0] *(*uint8)(unsafe.Pointer(buffer + uintptr(i)*4 + 1)) = (*(*[3]uint8)(unsafe.Pointer(bp)))[int32(1)] *(*uint8)(unsafe.Pointer(buffer + uintptr(i)*4 + 2)) = (*(*[3]uint8)(unsafe.Pointer(bp)))[int32(2)] *(*uint8)(unsafe.Pointer(buffer + uintptr(i)*4 + 3)) = uint8(255) } goto _1 _1: ; i++ } return int32(1) } func _DoExtension(tls *libc.TLS, gifConfPtr uintptr, label int32, transparent uintptr) (r int32) { var count int32 _ = count switch label { case int32(0x01): goto _1 case int32(0xff): goto _2 case int32(0xfe): goto _3 case int32(0xf9): goto _4 } goto _5 _1: ; /* Plain Text Extension */ goto _5 _2: ; /* Application Extension */ goto _5 _3: ; /* Comment Extension */ _8: ; count = _GetDataBlock(tls, gifConfPtr, gifConfPtr) goto _7 _7: ; if count > 0 { goto _8 } goto _6 _6: ; return count _4: ; /* Graphic Control Extension */ count = _GetDataBlock(tls, gifConfPtr, gifConfPtr) if count < 0 { return int32(1) } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(gifConfPtr)))&int32(0x1) != 0 { *(*int32)(unsafe.Pointer(transparent)) = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(gifConfPtr + 3))) } for cond := true; cond; cond = count > 0 { count = _GetDataBlock(tls, gifConfPtr, gifConfPtr) } return count _5: ; for cond := true; cond; cond = count > 0 { count = _GetDataBlock(tls, gifConfPtr, gifConfPtr) } return count } func _GetDataBlock(tls *libc.TLS, gifConfPtr uintptr, buf uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* count at bp+0 */ uint8 if !((*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, gifConfPtr+300, bp, int32(1)) == libc.Int32FromInt32(1)) { return -int32(1) } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != 0 && !((*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, gifConfPtr+300, buf, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))) { return -int32(1) } return libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) } /* *---------------------------------------------------------------------- * * ReadImage -- * * Process a GIF image from a given source, with a given height, * width, transparency, etc. * * This code is based on the code found in the ImageMagick GIF decoder, * which is (c) 2000 ImageMagick Studio. * * Some thoughts on our implementation: * It sure would be nice if ReadImage didn't take 11 parameters! I think * that if we were smarter, we could avoid doing that. * * Possible further optimizations: we could pull the GetCode function * directly into ReadImage, which would improve our speed. * * Results: * Processes a GIF image and loads the pixel data into a memory array. * * Side effects: * None. * *---------------------------------------------------------------------- */ func _ReadImage(tls *libc.TLS, interp uintptr, imagePtr uintptr, gifConfPtr uintptr, len1 int32, rows int32, cmap uintptr, width int32, height int32, srcX int32, srcY int32, interlace int32, transparent int32) (r int32) { bp := tls.Alloc(20528) defer tls.Free(20528) var clearCode, code, codeSize, endCode, firstCode, i, inCode, maxCode, oldCode, pass, v, xpos, ypos, v13 int32 var pixelPtr, top, v10, v11, v12, v4, v5, v6, v7, v8, v9 uintptr var _ /* append at bp+8194 */ [4096]uint8 var _ /* initialCodeSize at bp+0 */ uint8 var _ /* prefix at bp+2 */ [4096]uint16 var _ /* stack at bp+12290 */ [8192]uint8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = clearCode, code, codeSize, endCode, firstCode, i, inCode, maxCode, oldCode, pass, pixelPtr, top, v, xpos, ypos, v10, v11, v12, v13, v4, v5, v6, v7, v8, v9 xpos = 0 ypos = 0 pass = 0 /* * Initialize the decoder */ if !((*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, gifConfPtr+300, bp, int32(1)) == libc.Int32FromInt32(1)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+20496, __ccgo_ts+3638, (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_PosixError})))(tls, interp), libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) > int32(MAX_LWZ_BITS) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+20496, __ccgo_ts+3664, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if transparent != -int32(1) { *(*uint8)(unsafe.Pointer(cmap + uintptr(transparent)*4)) = uint8(0) *(*uint8)(unsafe.Pointer(cmap + uintptr(transparent)*4 + 1)) = uint8(0) *(*uint8)(unsafe.Pointer(cmap + uintptr(transparent)*4 + 2)) = uint8(0) *(*uint8)(unsafe.Pointer(cmap + uintptr(transparent)*4 + 3)) = uint8(0) } pixelPtr = imagePtr /* Initialize the decoder */ /* Set values for "special" numbers: * clear code reset the decoder * end code stop decoding * code size size of the next code to retrieve * max code next available table position */ clearCode = int32(1) << libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) endCode = clearCode + int32(1) codeSize = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) + int32(1) maxCode = clearCode + int32(2) oldCode = -int32(1) firstCode = -int32(1) libc.Xmemset(tls, bp+2, 0, libc.Uint32FromInt32(libc.Int32FromInt32(1)< maxCode || code == endCode { /* * If we're doing things right, we should never * receive a code that is greater than our current * maximum code. If we do, bail, because our decoder * does not yet have that code set up. * * If the code is the magic endCode value, quit. */ return TCL_OK } if code == clearCode { /* Reset the decoder */ codeSize = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) + int32(1) maxCode = clearCode + int32(2) oldCode = -int32(1) goto _3 } if oldCode == -int32(1) { /* * Last pass reset the decoder, so the first code we * see must be a singleton. Seed the stack with it, * and set up the old/first code pointers for * insertion into the codes table. We can't just * roll this into the clearCode test above, because * at that point we have not yet read the next code. */ v4 = top top++ *(*uint8)(unsafe.Pointer(v4)) = (*(*[4096]uint8)(unsafe.Pointer(bp + 8194)))[code] oldCode = code firstCode = code goto _3 } inCode = code if code == maxCode && maxCode < libc.Int32FromInt32(1)< clearCode { /* * Populate the stack by tracing the code in the * codes table from its tail to its head */ v6 = top top++ *(*uint8)(unsafe.Pointer(v6)) = (*(*[4096]uint8)(unsafe.Pointer(bp + 8194)))[code] code = libc.Int32FromUint16((*(*[4096]uint16)(unsafe.Pointer(bp + 2)))[code]) } firstCode = libc.Int32FromUint8((*(*[4096]uint8)(unsafe.Pointer(bp + 8194)))[code]) /* Push the head of the code onto the stack */ v7 = top top++ *(*uint8)(unsafe.Pointer(v7)) = libc.Uint8FromInt32(firstCode) if maxCode < libc.Int32FromInt32(1)<= int32(1)<= 0 { v12 = pixelPtr pixelPtr++ *(*uint8)(unsafe.Pointer(v12)) = *(*uint8)(unsafe.Pointer(cmap + uintptr(v)*4 + 3)) } xpos++ goto _3 _3: } /* If interlacing, the next ypos is not just +1 */ if interlace != 0 { ypos += _interlaceStep[pass] for ypos >= rows { pass++ if pass > int32(3) { return TCL_OK } ypos = _interlaceStart[pass] } } else { ypos++ } if transparent >= 0 { v13 = int32(4) } else { v13 = int32(3) } pixelPtr = imagePtr + uintptr(ypos*len1*v13) goto _2 _2: ; i++ } return TCL_OK } var _interlaceStep = [4]int32{ 0: int32(8), 1: int32(8), 2: int32(4), 3: int32(2), } var _interlaceStart = [4]int32{ 1: int32(4), 2: int32(2), 3: int32(1), } /* *---------------------------------------------------------------------- * * GetCode -- * * Extract the next compression code from the file. In GIF's, the * compression codes are between 3 and 12 bits long and are then * packed into 8 bit bytes, left to right, for example: * bbbaaaaa * dcccccbb * eeeedddd * ... * We use a byte buffer read from the file and a sliding window * to unpack the bytes. Thanks to ImageMagick for the sliding window * idea. * args: handle the handle to read from * code_size size of the code to extract * flag boolean indicating whether the extractor * should be reset or not * * Results: * code the next compression code * * Side effects: * May consume more input from chan. * *---------------------------------------------------------------------- */ func _GetCode(tls *libc.TLS, gifConfPtr uintptr, code_size int32, flag int32) (r int32) { var ret int32 _ = ret if flag != 0 { /* Initialize the decoder */ (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).FbitsInWindow = 0 (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fbytes = 0 (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fwindow = uint32(0) (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fdone = 0 (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fc = libc.UintptrFromInt32(0) return 0 } for (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).FbitsInWindow < code_size { /* Not enough bits in our window to cover the request */ if (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fdone != 0 { return -int32(1) } if (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fbytes == 0 { /* Not enough bytes in our buffer to add to the window */ (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fbytes = _GetDataBlock(tls, gifConfPtr, gifConfPtr) (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fc = gifConfPtr if (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fbytes <= 0 { (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fdone = int32(1) break } } /* Tack another byte onto the window, see if that's enough */ *(*uint32)(unsafe.Pointer(gifConfPtr + 288)) += libc.Uint32FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fc))) << (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).FbitsInWindow) (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fc++ *(*int32)(unsafe.Pointer(gifConfPtr + 292)) += int32(8) (*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fbytes-- } /* The next code will always be the last code_size bits of the window */ ret = libc.Int32FromUint32((*TGIFImageConfig)(unsafe.Pointer(gifConfPtr)).Fwindow & libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(code_size) *(*int32)(unsafe.Pointer(gifConfPtr + 292)) -= code_size return ret } /* * This software is copyrighted as noted below. It may be freely copied, * modified, and redistributed, provided that the copyright notice is * preserved on all copies. * * There is no warranty or other guarantee of fitness for this software, * it is provided solely "as is". Bug reports or fixes may be sent * to the author, who may or may not act on them as he desires. * * You may not include this software in a program or other software product * without supplying the source, or without informing the end-user that the * source is available for no extra charge. * * If you modify this software, you should include a notice giving the * name of the person performing the modification, the date of modification, * and the reason for such modification. */ /* * FileWrite - writes a image in GIF format. *------------------------------------------------------------------------- * Author: Lolo * Engeneering Projects Area * Department of Mining * University of Oviedo * e-mail zz11425958@zeus.etsimo.uniovi.es * lolo@pcsig22.etsimo.uniovi.es * Date: Fri September 20 1996 * * Modified for transparency handling (gif89a) and miGIF compression * by Jan Nijtmans * *---------------------------------------------------------------------- * FileWriteGIF- * * This procedure is called by the photo image type to write * GIF format data from a photo image into a given file * * Results: * A standard TCL completion code. If TCL_ERROR is returned * then an error message is left in the interp's result. * *---------------------------------------------------------------------- */ /* * Types, defines and variables needed to write and compress a GIF. */ type TGifWriterState = struct { Fssize int32 Fcsize int32 Frsize int32 FpixelOffset uintptr FpixelSize int32 FpixelPitch int32 FgreenOffset int32 FblueOffset int32 FalphaOffset int32 Fnum int32 Fmapa [256][3]uint8 } type Tifunptr = uintptr func _FileWrite2(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result chan1 = libc.UintptrFromInt32(0) libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, fileName, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite1(tls, interp, fileName, bp, format, blockPtr) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } func _StringWrite2(tls *libc.TLS, interp uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = result libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp) result = _CommonWrite1(tls, interp, __ccgo_ts+865, bp, format, blockPtr) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp))).FbyteObj) } return result } func _CommonWrite1(tls *libc.TLS, interp uintptr, fileName uintptr, handle uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(848) defer tls.Free(848) var c uint8 var height, resolution, width, x, v1, v6 int32 var left, top uint32 var v2, v4 uintptr var _ /* opts at bp+808 */ TFMTOPT3 var _ /* state at bp+0 */ TGifWriterState _, _, _, _, _, _, _, _, _, _, _ = c, height, left, resolution, top, width, x, v1, v2, v4, v6 if _ParseFormatOpts3(tls, interp, format, bp+808, libc.Int32FromInt32(1)<= int32(MAXCOLORMAPSIZE) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+824, __ccgo_ts+3705, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*TGifWriterState)(unsafe.Pointer(bp))).Fnum < int32(2) { (*(*TGifWriterState)(unsafe.Pointer(bp))).Fnum = int32(2) } if (*(*TGifWriterState)(unsafe.Pointer(bp))).FalphaOffset != 0 { v4 = __ccgo_ts + 3631 } else { v4 = __ccgo_ts + 3624 } (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, v4, int32(6)) if (*(*TFMTOPT3)(unsafe.Pointer(bp + 808))).Fverbose != 0 { _printImgInfo3(tls, width, height, 0, fileName, __ccgo_ts+1132) } c = libc.Uint8FromInt32(int32(int16(width)) & libc.Int32FromInt32(0x00FF)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(int16(width)) >> libc.Int32FromInt32(8)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(int16(height)) & libc.Int32FromInt32(0x00FF)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(int16(height)) >> libc.Int32FromInt32(8)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) resolution = 0 for (*(*TGifWriterState)(unsafe.Pointer(bp))).Fnum>>resolution != 0 { resolution++ } c = libc.Uint8FromInt32(int32(111) + resolution*int32(17)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) (*(*TGifWriterState)(unsafe.Pointer(bp))).Fnum = int32(1) << resolution /* background color */ (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, 0) /* zero for future expansion */ (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, 0) x = 0 for { if !(x < (*(*TGifWriterState)(unsafe.Pointer(bp))).Fnum) { break } (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 40 + uintptr(x)*3)))) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 40 + uintptr(x)*3 + 1)))) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 40 + uintptr(x)*3 + 2)))) goto _5 _5: ; x++ } /* * Write out extension for transparent color index, if necessary. */ if (*(*TGifWriterState)(unsafe.Pointer(bp))).FalphaOffset != 0 { c = uint8(GIF_EXTENSION) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, __ccgo_ts+3742, int32(7)) } c = uint8(GIF_START) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(libc.Int16FromUint32(top)) & libc.Int32FromInt32(0x00FF)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(libc.Int16FromUint32(top)) >> libc.Int32FromInt32(8)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(libc.Int16FromUint32(left)) & libc.Int32FromInt32(0x00FF)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(libc.Int16FromUint32(left)) >> libc.Int32FromInt32(8)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(int16(width)) & libc.Int32FromInt32(0x00FF)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(int16(width)) >> libc.Int32FromInt32(8)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(int16(height)) & libc.Int32FromInt32(0x00FF)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(int32(int16(height)) >> libc.Int32FromInt32(8)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = uint8(0) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) c = libc.Uint8FromInt32(resolution) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) v6 = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth (*(*TGifWriterState)(unsafe.Pointer(bp))).Frsize = v6 (*(*TGifWriterState)(unsafe.Pointer(bp))).Fssize = v6 (*(*TGifWriterState)(unsafe.Pointer(bp))).Fcsize = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight _Compress(tls, bp, resolution+int32(1), handle, __ccgo_fp(_ReadValue)) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, 0) c = uint8(GIF_TERMINATOR) (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_PutcPtr})))(tls, handle, libc.Int32FromUint8(c)) return TCL_OK } func _ColorNumber(tls *libc.TLS, statePtr uintptr, red int32, green int32, blue int32) (r int32) { var x int32 _ = x x = libc.BoolInt32((*TGifWriterState)(unsafe.Pointer(statePtr)).FalphaOffset != 0) for { if !(x <= int32(MAXCOLORMAPSIZE)) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(statePtr + 40 + uintptr(x)*3))) == red && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(statePtr + 40 + uintptr(x)*3 + 1))) == green && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(statePtr + 40 + uintptr(x)*3 + 2))) == blue { return x } goto _1 _1: ; x++ } return -int32(1) } func _IsNewColor(tls *libc.TLS, statePtr uintptr, red int32, green int32, blue int32) (r int32) { var x int32 _ = x x = libc.BoolInt32((*TGifWriterState)(unsafe.Pointer(statePtr)).FalphaOffset != 0) for { if !(x <= (*TGifWriterState)(unsafe.Pointer(statePtr)).Fnum) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(statePtr + 40 + uintptr(x)*3))) == red && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(statePtr + 40 + uintptr(x)*3 + 1))) == green && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(statePtr + 40 + uintptr(x)*3 + 2))) == blue { return 0 } goto _1 _1: ; x++ } return int32(1) } func _SaveMap(tls *libc.TLS, statePtr uintptr, blockPtr uintptr) { var blue, green, red uint8 var colors uintptr var x, y int32 _, _, _, _, _, _ = blue, colors, green, red, x, y if (*TGifWriterState)(unsafe.Pointer(statePtr)).FalphaOffset != 0 { (*TGifWriterState)(unsafe.Pointer(statePtr)).Fnum = 0 *(*uint8)(unsafe.Pointer(statePtr + 40)) = uint8(DEFAULT_BACKGROUND_VALUE) *(*uint8)(unsafe.Pointer(statePtr + 40 + 1)) = uint8(DEFAULT_BACKGROUND_VALUE) *(*uint8)(unsafe.Pointer(statePtr + 40 + 2)) = uint8(DEFAULT_BACKGROUND_VALUE) } else { (*TGifWriterState)(unsafe.Pointer(statePtr)).Fnum = -int32(1) } y = 0 for { if !(y < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) { break } colors = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr + uintptr(*(*int32)(unsafe.Pointer(blockPtr + 20))) + uintptr(y*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) x = 0 for { if !(x < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) { break } if !((*TGifWriterState)(unsafe.Pointer(statePtr)).FalphaOffset != 0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(colors + uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).FalphaOffset)))) != 0 { red = *(*uint8)(unsafe.Pointer(colors)) green = *(*uint8)(unsafe.Pointer(colors + uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).FgreenOffset))) blue = *(*uint8)(unsafe.Pointer(colors + uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).FblueOffset))) if _IsNewColor(tls, statePtr, libc.Int32FromUint8(red), libc.Int32FromUint8(green), libc.Int32FromUint8(blue)) != 0 { (*TGifWriterState)(unsafe.Pointer(statePtr)).Fnum++ if (*TGifWriterState)(unsafe.Pointer(statePtr)).Fnum >= int32(MAXCOLORMAPSIZE) { return } *(*uint8)(unsafe.Pointer(statePtr + 40 + uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).Fnum)*3)) = red *(*uint8)(unsafe.Pointer(statePtr + 40 + uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).Fnum)*3 + 1)) = green *(*uint8)(unsafe.Pointer(statePtr + 40 + uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).Fnum)*3 + 2)) = blue } } colors += uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).FpixelSize) goto _2 _2: ; x++ } goto _1 _1: ; y++ } } func _ReadValue(tls *libc.TLS, statePtr uintptr) (r int32) { var col uint32 var v1 int32 var v2 uintptr _, _, _ = col, v1, v2 if (*TGifWriterState)(unsafe.Pointer(statePtr)).Fcsize == 0 { return -int32(1) } if (*TGifWriterState)(unsafe.Pointer(statePtr)).FalphaOffset != 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TGifWriterState)(unsafe.Pointer(statePtr)).FpixelOffset + uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).FalphaOffset)))) == 0 { col = uint32(0) } else { col = libc.Uint32FromInt32(_ColorNumber(tls, statePtr, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TGifWriterState)(unsafe.Pointer(statePtr)).FpixelOffset))), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TGifWriterState)(unsafe.Pointer(statePtr)).FpixelOffset + uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).FgreenOffset)))), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TGifWriterState)(unsafe.Pointer(statePtr)).FpixelOffset + uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).FblueOffset)))))) } *(*uintptr)(unsafe.Pointer(statePtr + 12)) += uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).FpixelSize) v2 = statePtr *(*int32)(unsafe.Pointer(v2))-- v1 = *(*int32)(unsafe.Pointer(v2)) if v1 <= 0 { (*TGifWriterState)(unsafe.Pointer(statePtr)).Fssize = (*TGifWriterState)(unsafe.Pointer(statePtr)).Frsize (*TGifWriterState)(unsafe.Pointer(statePtr)).Fcsize-- *(*uintptr)(unsafe.Pointer(statePtr + 12)) += uintptr((*TGifWriterState)(unsafe.Pointer(statePtr)).FpixelPitch - (*TGifWriterState)(unsafe.Pointer(statePtr)).Frsize*(*TGifWriterState)(unsafe.Pointer(statePtr)).FpixelSize) } return libc.Int32FromUint32(col) } /* * * GIF Image compression - modified 'compress' * * Based on: compress.c - File compression ala IEEE Computer, June 1984. * * By Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) * Jim McKie (decvax!mcvax!jim) * Steve Davies (decvax!vax135!petsd!peora!srd) * Ken Turkowski (decvax!decwrl!turtlevax!ken) * James A. Woods (decvax!ihnp4!ames!jaw) * Joe Orost (decvax!vax135!petsd!joe) * */ type TGIFState_t = struct { Fn_bits int32 Fmaxcode int32 Fhtab [5003]int32 Fcodetab [5003]uint32 Fhsize int32 Ffree_ent int32 Fclear_flg int32 Foffset int32 Fin_count uint32 Fout_count uint32 Fg_init_bits int32 Fg_outfile uintptr FClearCode int32 FEOFCode int32 Fcur_accum uint32 Fcur_bits int32 Fa_count int32 Faccum [256]uint8 } func _Compress(tls *libc.TLS, statePtr uintptr, init_bits int32, handle uintptr, readValue Tifunptr) { bp := tls.Alloc(40352) defer tls.Free(40352) var c, disp, ent, fcode, hshift, hsize_reg, i, v1, v3, v4 int32 var v5 uintptr var _ /* state at bp+0 */ TGIFState_t _, _, _, _, _, _, _, _, _, _, _ = c, disp, ent, fcode, hshift, hsize_reg, i, v1, v3, v4, v5 i = 0 libc.Xmemset(tls, bp, 0, uint32(40340)) /* * Set up the globals: g_init_bits - initial number of bits * g_outfile - pointer to output file */ (*(*TGIFState_t)(unsafe.Pointer(bp))).Fg_init_bits = init_bits (*(*TGIFState_t)(unsafe.Pointer(bp))).Fg_outfile = handle /* * Set up the necessary values */ (*(*TGIFState_t)(unsafe.Pointer(bp))).Foffset = 0 (*(*TGIFState_t)(unsafe.Pointer(bp))).Fhsize = int32(HSIZE) (*(*TGIFState_t)(unsafe.Pointer(bp))).Fout_count = uint32(0) (*(*TGIFState_t)(unsafe.Pointer(bp))).Fclear_flg = 0 (*(*TGIFState_t)(unsafe.Pointer(bp))).Fin_count = uint32(1) v1 = (*(*TGIFState_t)(unsafe.Pointer(bp))).Fg_init_bits (*(*TGIFState_t)(unsafe.Pointer(bp))).Fn_bits = v1 (*(*TGIFState_t)(unsafe.Pointer(bp))).Fmaxcode = libc.Int32FromInt32(1)< 0 { goto probe } goto nomatch nomatch: ; _output(tls, bp, ent) (*(*TGIFState_t)(unsafe.Pointer(bp))).Fout_count++ ent = c if (*(*TGIFState_t)(unsafe.Pointer(bp))).Ffree_ent < libc.Int32FromInt32(1)< hashtable */ *(*int32)(unsafe.Pointer(bp + 8 + uintptr(i)*4)) = fcode } else { _cl_block(tls, bp) } } /* * Put out the final code. */ _output(tls, bp, ent) (*(*TGIFState_t)(unsafe.Pointer(bp))).Fout_count++ _output(tls, bp, (*(*TGIFState_t)(unsafe.Pointer(bp))).FEOFCode) return } /***************************************************************** * TAG( output ) * * Output the given code. * Inputs: * code: A n_bits-bit integer. If == -1, then EOF. This assumes * that n_bits =< (long) wordsize - 1. * Outputs: * Outputs code to the file. * Assumptions: * Chars are 8 bits long. * Algorithm: * Maintain a GIFBITS character long buffer (so that 8 codes will * fit in it exactly). Use the VAX insv instruction to insert each * code in turn. When the buffer fills up empty it and start over. */ var _masks = [17]uint32{ 1: uint32(0x0001), 2: uint32(0x0003), 3: uint32(0x0007), 4: uint32(0x000F), 5: uint32(0x001F), 6: uint32(0x003F), 7: uint32(0x007F), 8: uint32(0x00FF), 9: uint32(0x01FF), 10: uint32(0x03FF), 11: uint32(0x07FF), 12: uint32(0x0FFF), 13: uint32(0x1FFF), 14: uint32(0x3FFF), 15: uint32(0x7FFF), 16: uint32(0xFFFF), } func _output(tls *libc.TLS, statePtr uintptr, code int32) { var v1 int32 _ = v1 *(*uint32)(unsafe.Pointer(statePtr + 40072)) &= _masks[(*TGIFState_t)(unsafe.Pointer(statePtr)).Fcur_bits] if (*TGIFState_t)(unsafe.Pointer(statePtr)).Fcur_bits > 0 { *(*uint32)(unsafe.Pointer(statePtr + 40072)) |= libc.Uint32FromInt32(code << (*TGIFState_t)(unsafe.Pointer(statePtr)).Fcur_bits) } else { (*TGIFState_t)(unsafe.Pointer(statePtr)).Fcur_accum = libc.Uint32FromInt32(code) } *(*int32)(unsafe.Pointer(statePtr + 40076)) += (*TGIFState_t)(unsafe.Pointer(statePtr)).Fn_bits for (*TGIFState_t)(unsafe.Pointer(statePtr)).Fcur_bits >= int32(8) { _char_out(tls, statePtr, libc.Int32FromUint32((*TGIFState_t)(unsafe.Pointer(statePtr)).Fcur_accum&libc.Uint32FromInt32(0xff))) *(*uint32)(unsafe.Pointer(statePtr + 40072)) >>= uint32(8) *(*int32)(unsafe.Pointer(statePtr + 40076)) -= int32(8) } /* * If the next entry is going to be too big for the code size, * then increase it, if possible. */ if (*TGIFState_t)(unsafe.Pointer(statePtr)).Ffree_ent > (*TGIFState_t)(unsafe.Pointer(statePtr)).Fmaxcode || (*TGIFState_t)(unsafe.Pointer(statePtr)).Fclear_flg != 0 { if (*TGIFState_t)(unsafe.Pointer(statePtr)).Fclear_flg != 0 { v1 = (*TGIFState_t)(unsafe.Pointer(statePtr)).Fg_init_bits (*TGIFState_t)(unsafe.Pointer(statePtr)).Fn_bits = v1 (*TGIFState_t)(unsafe.Pointer(statePtr)).Fmaxcode = libc.Int32FromInt32(1)< 0 { _char_out(tls, statePtr, libc.Int32FromUint32((*TGIFState_t)(unsafe.Pointer(statePtr)).Fcur_accum&libc.Uint32FromInt32(0xff))) *(*uint32)(unsafe.Pointer(statePtr + 40072)) >>= uint32(8) *(*int32)(unsafe.Pointer(statePtr + 40076)) -= int32(8) } _flush_char(tls, statePtr) } } // C documentation // // /* // * Clear out the hash table // */ func _cl_block(tls *libc.TLS, statePtr uintptr) { /* table clear for block compress */ _cl_hash(tls, statePtr, (*TGIFState_t)(unsafe.Pointer(statePtr)).Fhsize) (*TGIFState_t)(unsafe.Pointer(statePtr)).Ffree_ent = (*TGIFState_t)(unsafe.Pointer(statePtr)).FClearCode + int32(2) (*TGIFState_t)(unsafe.Pointer(statePtr)).Fclear_flg = int32(1) _output(tls, statePtr, (*TGIFState_t)(unsafe.Pointer(statePtr)).FClearCode) } func _cl_hash(tls *libc.TLS, statePtr uintptr, hsize int32) { /* reset code table */ var htab_p, v3 uintptr var i, m1 int32 _, _, _, _ = htab_p, i, m1, v3 htab_p = statePtr + 8 + uintptr(hsize)*4 m1 = -int32(1) i = hsize - int32(16) for { /* might use Sys V memset(3) here */ *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(16)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(15)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(14)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(13)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(12)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(11)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(10)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(9)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(8)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(7)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(6)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(5)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(4)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(3)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(2)*4)) = m1 *(*int32)(unsafe.Pointer(htab_p - libc.UintptrFromInt32(1)*4)) = m1 htab_p -= uintptr(16) * 4 goto _1 _1: ; i -= int32(16) if !(i >= 0) { break } } i += int32(16) for { if !(i > 0) { break } htab_p -= 4 v3 = htab_p *(*int32)(unsafe.Pointer(v3)) = m1 goto _2 _2: ; i-- } } /****************************************************************************** * * GIF Specific routines * ******************************************************************************/ // C documentation // // /* // * Set up the 'byte output' routine // */ func _char_init(tls *libc.TLS, statePtr uintptr) { (*TGIFState_t)(unsafe.Pointer(statePtr)).Fa_count = 0 (*TGIFState_t)(unsafe.Pointer(statePtr)).Fcur_accum = uint32(0) (*TGIFState_t)(unsafe.Pointer(statePtr)).Fcur_bits = 0 } // C documentation // // /* // * Add a character to the end of the current packet, and if it is 254 // * characters, flush the packet to disk. // */ func _char_out(tls *libc.TLS, statePtr uintptr, c int32) { var v1 int32 var v2 uintptr _, _ = v1, v2 v2 = statePtr + 40080 v1 = *(*int32)(unsafe.Pointer(v2)) *(*int32)(unsafe.Pointer(v2))++ *(*uint8)(unsafe.Pointer(statePtr + 40084 + uintptr(v1))) = libc.Uint8FromInt32(c) if (*TGIFState_t)(unsafe.Pointer(statePtr)).Fa_count >= int32(254) { _flush_char(tls, statePtr) } } // C documentation // // /* // * Flush the packet to disk, and reset the accumulator // */ func _flush_char(tls *libc.TLS, statePtr uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* c at bp+0 */ uint8 if (*TGIFState_t)(unsafe.Pointer(statePtr)).Fa_count > 0 { *(*uint8)(unsafe.Pointer(bp)) = libc.Uint8FromInt32((*TGIFState_t)(unsafe.Pointer(statePtr)).Fa_count) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, (*TGIFState_t)(unsafe.Pointer(statePtr)).Fg_outfile, bp, int32(1)) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, (*TGIFState_t)(unsafe.Pointer(statePtr)).Fg_outfile, statePtr+40084, (*TGIFState_t)(unsafe.Pointer(statePtr)).Fa_count) (*TGIFState_t)(unsafe.Pointer(statePtr)).Fa_count = 0 } } const PACKAGE_NAME5 = "tkimgico" const PACKAGE_STRING5 = "tkimgico 2.0.1" const PACKAGE_TARNAME5 = "tkimgico" const PACKAGE_TCLNAME5 = "img::ico" var _sImageFormatVersion31 = TTk_PhotoImageFormatVersion3{ Fname: __ccgo_ts + 3749, } func init() { p := unsafe.Pointer(&_sImageFormatVersion31) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatchVersion31) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatchVersion31) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileReadVersion31) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringReadVersion31) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWriteVersion31) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWriteVersion31) } /* *---------------------------------------------------------------------------- * * Tkimgico_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgico_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<, from a file and convert them into the current machine's format. */ func _readUShort(tls *libc.TLS, handle uintptr, s uintptr) (r TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [2]uint8 if int32(2) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(2)) { return uint8(FALSE) } *(*TUShort)(unsafe.Pointer(s)) = libc.Uint16FromInt32(libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp)))[0]) | libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp)))[int32(1)])<, from a file and convert them into the current machine's format. */ func _readUInt(tls *libc.TLS, handle uintptr, i uintptr) (r TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [4]uint8 if int32(4) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(4)) { return uint8(FALSE) } *(*TUInt1)(unsafe.Pointer(i)) = libc.Uint32FromInt32(libc.Int32FromUint8((*(*[4]uint8)(unsafe.Pointer(bp)))[0])|libc.Int32FromUint8((*(*[4]uint8)(unsafe.Pointer(bp)))[int32(1)])< (an array of 2 bytes) and write the array to a file. */ func _writeUShort(tls *libc.TLS, handle uintptr, s TUShort) (r TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [2]TByte (*(*[2]TByte)(unsafe.Pointer(bp)))[0] = uint8(s) (*(*[2]TByte)(unsafe.Pointer(bp)))[int32(1)] = libc.Uint8FromInt32(libc.Int32FromUint16(s) >> int32(8)) if int32(2) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, int32(2)) { return uint8(FALSE) } return uint8(TRUE) } /* Convert a unsigned 32 bit integer number into the format (an array of 4 bytes) and write the array to a file. */ func _writeUInt(tls *libc.TLS, handle uintptr, i TUInt1) (r TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [4]TByte (*(*[4]TByte)(unsafe.Pointer(bp)))[0] = uint8(i) (*(*[4]TByte)(unsafe.Pointer(bp)))[int32(1)] = uint8(i >> int32(8)) (*(*[4]TByte)(unsafe.Pointer(bp)))[int32(2)] = uint8(i >> int32(16)) (*(*[4]TByte)(unsafe.Pointer(bp)))[int32(3)] = uint8(i >> int32(24)) if int32(4) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, int32(4)) { return uint8(FALSE) } return uint8(TRUE) } func _printImgInfo4(tls *libc.TLS, th uintptr, ih uintptr, pageIndex int32, fileName uintptr, msg uintptr) { bp := tls.Alloc(288) defer tls.Free(288) var i int32 var outChan TTcl_Channel var _ /* str at bp+0 */ [256]uint8 _, _ = i, outChan i = pageIndex outChan = (*(*func(*libc.TLS, int32) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStdChannel})))(tls, libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+32, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)<= int32(1) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetNumPagesPtr})))(tls, metadataOut, *(*int32)(unsafe.Pointer(bp + 8))) { retVal = 0 } } return retVal } func _StringMatchVersion31(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var pageIndex, retVal int32 var _ /* handle at bp+12 */ Ttkimg_Stream var _ /* numPages at bp+8 */ int32 var _ /* opts at bp+0 */ TFMTOPT4 _, _ = pageIndex, retVal retVal = int32(1) pageIndex = 0 libc.Xmemset(tls, bp+12, 0, uint32(40)) if _ParseFormatOpts4(tls, interp, format, bp, libc.Int32FromInt32(1)<= int32(1) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetNumPagesPtr})))(tls, metadataOut, *(*int32)(unsafe.Pointer(bp + 8))) { retVal = 0 } } return retVal } func _CommonMatch3(tls *libc.TLS, handle uintptr, widthPtr uintptr, heightPtr uintptr, numPagesPtr uintptr, pageIndex int32, icoHeaderPtr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var headerPtr uintptr var _ /* icoHeader at bp+0 */ TICOHEADER _ = headerPtr if !(icoHeaderPtr != 0) { headerPtr = bp } else { headerPtr = icoHeaderPtr } if !(_readIcoHeader(tls, handle, headerPtr) != 0) { return 0 } *(*int32)(unsafe.Pointer(widthPtr)) = libc.Int32FromUint8((*(*TICOENTRY)(unsafe.Pointer((*TICOHEADER)(unsafe.Pointer(headerPtr)).Fentries + uintptr(pageIndex)*20))).Fwidth) *(*int32)(unsafe.Pointer(heightPtr)) = libc.Int32FromUint8((*(*TICOENTRY)(unsafe.Pointer((*TICOHEADER)(unsafe.Pointer(headerPtr)).Fentries + uintptr(pageIndex)*20))).Fheight) *(*int32)(unsafe.Pointer(numPagesPtr)) = libc.Int32FromUint16((*TICOHEADER)(unsafe.Pointer(headerPtr)).FnIcons) if !(icoHeaderPtr != 0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TICOHEADER)(unsafe.Pointer(headerPtr)).Fentries) } return int32(1) } func _FileReadVersion31(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonRead4(tls, interp, bp, fileName, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) } func _StringReadVersion31(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonRead4(tls, interp, bp, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) } func _CommonRead4(tls *libc.TLS, interp uintptr, handle uintptr, fileName uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(2208) defer tls.Free(2208) var bytesPerLine, c, c1, c2, errorFlag, icoHeaderHeight, icoHeaderWidth, nBytesToSkip, outHeight, outWidth, outY, x, y, v22 int32 var dummy, expline, line uintptr var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* colorMap at bp+1120 */ [256]TICOCOLOR var _ /* fileHeight at bp+40 */ int32 var _ /* fileWidth at bp+36 */ int32 var _ /* icoHeader at bp+1072 */ TICOHEADER var _ /* infoHeader at bp+1080 */ TINFOHEADER var _ /* msgStr at bp+44 */ [1024]uint8 var _ /* numPages at bp+2152 */ int32 var _ /* opts at bp+2144 */ TFMTOPT4 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bytesPerLine, c, c1, c2, dummy, errorFlag, expline, icoHeaderHeight, icoHeaderWidth, line, nBytesToSkip, outHeight, outWidth, outY, x, y, v22 errorFlag = TCL_OK line = libc.UintptrFromInt32(0) expline = libc.UintptrFromInt32(0) if _ParseFormatOpts4(tls, interp, format, bp+2144, libc.Int32FromInt32(1)<= libc.Int32FromUint16((*(*TICOHEADER)(unsafe.Pointer(bp + 1072))).FnIcons) { libc.X__builtin_snprintf(tls, bp+44, uint32(1024), __ccgo_ts+3977, libc.VaList(bp+2168, (*(*TFMTOPT4)(unsafe.Pointer(bp + 2144))).FpageIndex)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, bp+44, libc.UintptrFromInt32(0))) errorFlag = int32(TCL_ERROR) goto error } /* Instead of seeking, which does not work on strings, we calculate the number of bytes from the current position till the start of the INFOHEADER and read these bytes with tkimg_Read. */ nBytesToSkip = libc.Int32FromUint32((*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 1072))).Fentries + uintptr((*(*TFMTOPT4)(unsafe.Pointer(bp + 2144))).FpageIndex)*20))).FfileOffset - uint32(6) - libc.Uint32FromInt32(int32(16)*libc.Int32FromUint16((*(*TICOHEADER)(unsafe.Pointer(bp + 1072))).FnIcons))) if nBytesToSkip > 0 { dummy = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(nBytesToSkip)) if dummy == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+896, libc.UintptrFromInt32(0))) errorFlag = int32(TCL_ERROR) goto error } if nBytesToSkip != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, dummy, nBytesToSkip) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+4000, libc.UintptrFromInt32(0))) errorFlag = int32(TCL_ERROR) goto error } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, dummy) } /* Read Info header and color map */ if !(_readInfoHeader(tls, handle, bp+1080) != 0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+4027, libc.UintptrFromInt32(0))) errorFlag = int32(TCL_ERROR) goto error } if (*(*TINFOHEADER)(unsafe.Pointer(bp + 1080))).Fcompression != uint32(BI_RGB) { libc.X__builtin_snprintf(tls, bp+44, uint32(1024), __ccgo_ts+4053, libc.VaList(bp+2168, (*(*TINFOHEADER)(unsafe.Pointer(bp + 1080))).Fcompression)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, bp+44, libc.UintptrFromInt32(0))) errorFlag = int32(TCL_ERROR) goto error } if libc.Int32FromUint16((*(*TINFOHEADER)(unsafe.Pointer(bp + 1080))).FnBitsPerPixel) != int32(24) && libc.Int32FromUint16((*(*TINFOHEADER)(unsafe.Pointer(bp + 1080))).FnBitsPerPixel) != int32(32) { if !(_readColorMap(tls, handle, libc.Int32FromUint16((*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 1072))).Fentries + uintptr((*(*TFMTOPT4)(unsafe.Pointer(bp + 2144))).FpageIndex)*20))).FnColors), bp+1120) != 0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+3393, libc.UintptrFromInt32(0))) errorFlag = int32(TCL_ERROR) goto error } } *(*int32)(unsafe.Pointer(bp + 36)) = libc.Int32FromUint32((*(*TINFOHEADER)(unsafe.Pointer(bp + 1080))).Fwidth) *(*int32)(unsafe.Pointer(bp + 40)) = libc.Int32FromUint32((*(*TINFOHEADER)(unsafe.Pointer(bp + 1080))).Fheight / uint32(2)) icoHeaderWidth = libc.Int32FromUint8((*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 1072))).Fentries + uintptr((*(*TFMTOPT4)(unsafe.Pointer(bp + 2144))).FpageIndex)*20))).Fwidth) icoHeaderHeight = libc.Int32FromUint8((*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 1072))).Fentries + uintptr((*(*TFMTOPT4)(unsafe.Pointer(bp + 2144))).FpageIndex)*20))).Fheight) if icoHeaderWidth == 0 { icoHeaderWidth = int32(256) } if icoHeaderHeight == 0 { icoHeaderHeight = int32(256) } if *(*int32)(unsafe.Pointer(bp + 36)) != icoHeaderWidth || *(*int32)(unsafe.Pointer(bp + 40)) != icoHeaderHeight { libc.X__builtin_snprintf(tls, bp+44, uint32(1024), __ccgo_ts+4087, libc.VaList(bp+2168, *(*int32)(unsafe.Pointer(bp + 36)), *(*int32)(unsafe.Pointer(bp + 40)), icoHeaderWidth, icoHeaderHeight)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, bp+44, libc.UintptrFromInt32(0))) errorFlag = int32(TCL_ERROR) goto error } outWidth = *(*int32)(unsafe.Pointer(bp + 36)) outHeight = *(*int32)(unsafe.Pointer(bp + 40)) if *(*int32)(unsafe.Pointer(bp + 36)) != width || *(*int32)(unsafe.Pointer(bp + 40)) != height { if srcX != 0 || srcY != 0 || destX != 0 || destY != 0 { if srcX+width > *(*int32)(unsafe.Pointer(bp + 36)) { outWidth = *(*int32)(unsafe.Pointer(bp + 36)) - srcX } else { outWidth = width } if srcY+height > *(*int32)(unsafe.Pointer(bp + 40)) { outHeight = *(*int32)(unsafe.Pointer(bp + 40)) - srcY } else { outHeight = height } } } if outWidth <= 0 || outHeight <= 0 || srcX >= *(*int32)(unsafe.Pointer(bp + 36)) || srcY >= *(*int32)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*TFMTOPT4)(unsafe.Pointer(bp + 2144))).Fverbose != 0 { _printImgInfo4(tls, bp+1072, bp+1080, (*(*TFMTOPT4)(unsafe.Pointer(bp + 2144))).FpageIndex, fileName, __ccgo_ts+881) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+outWidth, destY+outHeight) == int32(TCL_ERROR) { errorFlag = int32(TCL_ERROR) goto error } bytesPerLine = (libc.Int32FromUint16((*(*TINFOHEADER)(unsafe.Pointer(bp + 1080))).FnBitsPerPixel)**(*int32)(unsafe.Pointer(bp + 36)) + int32(31)) / int32(32) * int32(4) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = int32(4) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = *(*int32)(unsafe.Pointer(bp + 36)) * int32(4) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = outWidth (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) *(*int32)(unsafe.Pointer(bp + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = int32(2) *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = int32(3) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(int32(4)**(*int32)(unsafe.Pointer(bp + 36))**(*int32)(unsafe.Pointer(bp + 40)))) if (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+896, libc.UintptrFromInt32(0))) goto error } expline = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr line = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(bytesPerLine)) if line == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+896, libc.UintptrFromInt32(0))) goto error } switch libc.Int32FromUint16((*(*TINFOHEADER)(unsafe.Pointer(bp + 1080))).FnBitsPerPixel) { case int32(32): goto _1 case int32(24): goto _2 case int32(8): goto _3 case int32(4): goto _4 case int32(1): goto _5 default: goto _6 } goto _7 _1: ; y = 0 _10: ; if !(y < *(*int32)(unsafe.Pointer(bp + 40))) { goto _8 } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = 0 for { if !(x < *(*int32)(unsafe.Pointer(bp + 36))) { break } *(*uint8)(unsafe.Pointer(expline)) = *(*uint8)(unsafe.Pointer(line + uintptr(x*int32(4)+int32(2)))) *(*uint8)(unsafe.Pointer(expline + 1)) = *(*uint8)(unsafe.Pointer(line + uintptr(x*int32(4)+int32(1)))) *(*uint8)(unsafe.Pointer(expline + 2)) = *(*uint8)(unsafe.Pointer(line + uintptr(x*int32(4)+0))) *(*uint8)(unsafe.Pointer(expline + 3)) = *(*uint8)(unsafe.Pointer(line + uintptr(x*int32(4)+int32(3)))) expline += uintptr(4) goto _11 _11: ; x++ } goto _9 _9: ; y++ goto _10 goto _8 _8: ; goto _7 _2: ; y = 0 for { if !(y < *(*int32)(unsafe.Pointer(bp + 40))) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = 0 for { if !(x < *(*int32)(unsafe.Pointer(bp + 36))) { break } *(*uint8)(unsafe.Pointer(expline)) = *(*uint8)(unsafe.Pointer(line + uintptr(x*int32(3)+int32(2)))) *(*uint8)(unsafe.Pointer(expline + 1)) = *(*uint8)(unsafe.Pointer(line + uintptr(x*int32(3)+int32(1)))) *(*uint8)(unsafe.Pointer(expline + 2)) = *(*uint8)(unsafe.Pointer(line + uintptr(x*int32(3)+0))) expline += uintptr(4) goto _13 _13: ; x++ } goto _12 _12: ; y++ } goto _7 _3: ; y = 0 for { if !(y < *(*int32)(unsafe.Pointer(bp + 40))) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = 0 for { if !(x < *(*int32)(unsafe.Pointer(bp + 36))) { break } *(*uint8)(unsafe.Pointer(expline)) = (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 1120)))[*(*uint8)(unsafe.Pointer(line + uintptr(x)))].Fred *(*uint8)(unsafe.Pointer(expline + 1)) = (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 1120)))[*(*uint8)(unsafe.Pointer(line + uintptr(x)))].Fgreen *(*uint8)(unsafe.Pointer(expline + 2)) = (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 1120)))[*(*uint8)(unsafe.Pointer(line + uintptr(x)))].Fblue expline += uintptr(4) goto _15 _15: ; x++ } goto _14 _14: ; y++ } goto _7 _4: ; y = 0 for { if !(y < *(*int32)(unsafe.Pointer(bp + 40))) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = 0 for { if !(x < *(*int32)(unsafe.Pointer(bp + 36))) { break } if x&int32(1) != 0 { c = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(line + uintptr(x/int32(2))))) & int32(0x0f) } else { c = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(line + uintptr(x/int32(2))))) >> int32(4) } *(*uint8)(unsafe.Pointer(expline)) = (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 1120)))[c].Fred *(*uint8)(unsafe.Pointer(expline + 1)) = (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 1120)))[c].Fgreen *(*uint8)(unsafe.Pointer(expline + 2)) = (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 1120)))[c].Fblue expline += uintptr(4) goto _17 _17: ; x++ } goto _16 _16: ; y++ } goto _7 _5: ; y = 0 for { if !(y < *(*int32)(unsafe.Pointer(bp + 40))) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = 0 for { if !(x < *(*int32)(unsafe.Pointer(bp + 36))) { break } c1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(line + uintptr(x/int32(8))))) >> (int32(7) - x%int32(8)) & int32(1) *(*uint8)(unsafe.Pointer(expline)) = (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 1120)))[c1].Fred *(*uint8)(unsafe.Pointer(expline + 1)) = (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 1120)))[c1].Fgreen *(*uint8)(unsafe.Pointer(expline + 2)) = (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 1120)))[c1].Fblue expline += uintptr(4) goto _19 _19: ; x++ } goto _18 _18: ; y++ } goto _7 _6: ; libc.X__builtin_snprintf(tls, bp+44, uint32(1024), __ccgo_ts+4129, libc.VaList(bp+2168, libc.Int32FromUint16((*(*TINFOHEADER)(unsafe.Pointer(bp + 1080))).FnBitsPerPixel))) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, bp+44, libc.UintptrFromInt32(0))) errorFlag = int32(TCL_ERROR) goto error _7: ; if libc.Int32FromUint16((*(*TINFOHEADER)(unsafe.Pointer(bp + 1080))).FnBitsPerPixel) != int32(32) { /* Read XAND bitmap. We don't need to read the alpha bitmap, if alpha is supplied already in the 32-bit case. */ bytesPerLine = (int32(1)**(*int32)(unsafe.Pointer(bp + 36)) + int32(31)) / int32(32) * int32(4) expline = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr y = 0 for { if !(y < *(*int32)(unsafe.Pointer(bp + 40))) { break } if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, line, bytesPerLine) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2168, __ccgo_ts+938, libc.UintptrFromInt32(0))) goto error } x = 0 for { if !(x < *(*int32)(unsafe.Pointer(bp + 36))) { break } c2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(line + uintptr(x/int32(8))))) >> (int32(7) - x%int32(8)) & int32(1) if c2 != 0 { v22 = 0 } else { v22 = int32(255) } *(*uint8)(unsafe.Pointer(expline + 3)) = libc.Uint8FromInt32(v22) expline += uintptr(4) goto _21 _21: ; x++ } goto _20 _20: ; y++ } } /* Store the pointer to allocated buffer for later freeing. */ expline = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr += uintptr(srcX * int32(4)) outY = destY + outHeight - int32(1) y = *(*int32)(unsafe.Pointer(bp + 40)) - int32(1) for { if !(y >= 0) { break } if y >= srcY && y < srcY+outHeight { errorFlag = (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, outWidth, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) if errorFlag == int32(TCL_ERROR) { break } outY-- } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr += uintptr(int32(4) * *(*int32)(unsafe.Pointer(bp + 36))) goto _23 _23: ; y-- } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = expline goto error error: ; if (*(*TICOHEADER)(unsafe.Pointer(bp + 1072))).Fentries != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*(*TICOHEADER)(unsafe.Pointer(bp + 1072))).Fentries) } if line != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) } if expline != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr) } return errorFlag } func _FileWriteVersion31(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, fileName, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite2(tls, interp, fileName, bp, format, blockPtr, metadataIn) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } func _StringWriteVersion31(tls *libc.TLS, interp uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = result libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp) result = _CommonWrite2(tls, interp, __ccgo_ts+865, bp, format, blockPtr, metadataIn) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp))).FbyteObj) } return result } func _CommonWrite2(tls *libc.TLS, interp uintptr, fileName uintptr, handle uintptr, format uintptr, blockPtr uintptr, metadataIn uintptr) (r int32) { bp := tls.Alloc(1120) defer tls.Free(1120) var alphaOffset, blueOffset, bytesPerLineAND, bytesPerLineXOR, c, foundColor, greenOffset, i, nbytes, ncolors, redOffset, x, y, v1, v10, v11, v8, v9 int32 var imagePtr, pixelPtr, p17 uintptr var pixel TICOCOLOR var v5, v6, v7 TUByte var _ /* buf at bp+0 */ [4]TUByte var _ /* colorMap at bp+56 */ [256]TICOCOLOR var _ /* icoHeader at bp+8 */ TICOHEADER var _ /* infoHeader at bp+16 */ TINFOHEADER var _ /* opts at bp+1080 */ TFMTOPT4 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, bytesPerLineAND, bytesPerLineXOR, c, foundColor, greenOffset, i, imagePtr, nbytes, ncolors, pixel, pixelPtr, redOffset, x, y, v1, v10, v11, v5, v6, v7, v8, v9, p17 if _ParseFormatOpts4(tls, interp, format, bp+1080, libc.Int32FromInt32(1)< int32(255) || (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight > int32(255) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1096, __ccgo_ts+4160, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } redOffset = 0 greenOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 1*4)) - *(*int32)(unsafe.Pointer(blockPtr + 20)) blueOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) - *(*int32)(unsafe.Pointer(blockPtr + 20)) alphaOffset = *(*int32)(unsafe.Pointer(blockPtr + 20)) if alphaOffset < *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) { alphaOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) } alphaOffset++ v1 = alphaOffset if v1 < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize { alphaOffset -= *(*int32)(unsafe.Pointer(blockPtr + 20)) } else { alphaOffset = 0 } ncolors = 0 if greenOffset != 0 || blueOffset != 0 { y = 0 for { if !(ncolors <= int32(256) && y < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) { break } pixelPtr = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr + uintptr(y*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) + uintptr(*(*int32)(unsafe.Pointer(blockPtr + 20))) x = 0 for { if !(ncolors <= int32(256) && x < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) { break } pixel.Fred = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(redOffset))) pixel.Fgreen = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(greenOffset))) pixel.Fblue = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(blueOffset))) if alphaOffset != 0 && libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(alphaOffset)))) == 0 { pixel.Falpha = uint8(0) } else { pixel.Falpha = uint8(1) } foundColor = 0 i = 0 for { if !(i < ncolors) { break } if libc.Int32FromUint8(pixel.Fred) == libc.Int32FromUint8((*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 56)))[i].Fred) && libc.Int32FromUint8(pixel.Fgreen) == libc.Int32FromUint8((*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 56)))[i].Fgreen) && libc.Int32FromUint8(pixel.Fblue) == libc.Int32FromUint8((*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 56)))[i].Fblue) { foundColor = int32(1) break } goto _4 _4: ; i++ } if !(foundColor != 0) { if ncolors < int32(256) { (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 56)))[ncolors] = pixel } ncolors++ } pixelPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) goto _3 _3: ; x++ } goto _2 _2: ; y++ } if ncolors <= int32(256) { v7 = libc.Uint8FromInt32(0) pixel.Falpha = v7 v6 = v7 pixel.Fblue = v6 v5 = v6 pixel.Fgreen = v5 pixel.Fred = v5 for ncolors < int32(256) { v8 = ncolors ncolors++ (*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 56)))[v8] = pixel } nbytes = int32(1) } else { nbytes = int32(3) ncolors = 0 } } else { nbytes = int32(1) } bytesPerLineXOR = ((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth*nbytes + int32(3)) / int32(4) * int32(4) bytesPerLineAND = ((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth*int32(1) + int32(31)) / int32(32) * int32(4) (*(*TICOHEADER)(unsafe.Pointer(bp + 8))).FnIcons = uint16(1) (*(*TICOHEADER)(unsafe.Pointer(bp + 8))).Fentries = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, uint32(20)) if (*(*TICOHEADER)(unsafe.Pointer(bp + 8))).Fentries == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1096, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 8))).Fentries))).Fwidth = libc.Uint8FromInt32((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) (*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 8))).Fentries))).Fheight = libc.Uint8FromInt32((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) if ncolors > 0 { v9 = ncolors } else { v9 = 0 } (*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 8))).Fentries))).FnColors = libc.Uint16FromInt32(v9) (*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 8))).Fentries))).Freserved = uint8(0) (*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 8))).Fentries))).FnPlanes = uint16(1) if ncolors > 0 { v10 = int32(8) } else { v10 = int32(24) } (*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 8))).Fentries))).FbitCount = libc.Uint16FromInt32(v10) (*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 8))).Fentries))).FsizeInBytes = uint32(40) + libc.Uint32FromInt32(ncolors)*uint32(4) + libc.Uint32FromInt32(bytesPerLineXOR*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) + libc.Uint32FromInt32(bytesPerLineAND*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) (*(*TICOENTRY)(unsafe.Pointer((*(*TICOHEADER)(unsafe.Pointer(bp + 8))).Fentries))).FfileOffset = libc.Uint32FromInt32(int32(6) + libc.Int32FromUint16((*(*TICOHEADER)(unsafe.Pointer(bp + 8))).FnIcons)*int32(16)) if !(_writeIcoHeader(tls, handle, bp+8) != 0) { return int32(TCL_ERROR) } (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).Fsize = uint32(40) (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).Fwidth = libc.Uint32FromInt32((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).Fheight = libc.Uint32FromInt32((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight * int32(2)) (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).FnPlanes = uint16(1) if ncolors > 0 { v11 = int32(8) } else { v11 = int32(24) } (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).FnBitsPerPixel = libc.Uint16FromInt32(v11) (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).Fcompression = uint32(0) (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).FimageSize = uint32(0) (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).FxPixelsPerM = uint32(0) (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).FyPixelsPerM = uint32(0) (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).FnColorsUsed = uint32(0) (*(*TINFOHEADER)(unsafe.Pointer(bp + 16))).FnColorsImportant = uint32(0) if !(_writeInfoHeader(tls, handle, bp+16) != 0) { return int32(TCL_ERROR) } if ncolors > 0 { if !(_writeColorMap(tls, handle, ncolors, bp+56) != 0) { return int32(TCL_ERROR) } } if (*(*TFMTOPT4)(unsafe.Pointer(bp + 1080))).Fverbose != 0 { _printImgInfo4(tls, bp+8, bp+16, 0, fileName, __ccgo_ts+1132) } bytesPerLineXOR -= (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth * nbytes imagePtr = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr + uintptr(*(*int32)(unsafe.Pointer(blockPtr + 20))) + uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) y = 0 for { if !(y < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) { break } imagePtr -= uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) pixelPtr = imagePtr x = 0 for { if !(x < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) { break } if ncolors != 0 { i = 0 for { if !(i < ncolors) { break } if libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(redOffset)))) == libc.Int32FromUint8((*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 56)))[i].Fred) && libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(greenOffset)))) == libc.Int32FromUint8((*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 56)))[i].Fgreen) && libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(blueOffset)))) == libc.Int32FromUint8((*(*[256]TICOCOLOR)(unsafe.Pointer(bp + 56)))[i].Fblue) { (*(*[4]TUByte)(unsafe.Pointer(bp)))[0] = libc.Uint8FromInt32(i) } goto _14 _14: ; i++ } } else { (*(*[4]TUByte)(unsafe.Pointer(bp)))[0] = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(blueOffset))) (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(1)] = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(greenOffset))) (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(2)] = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(redOffset))) } (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, nbytes) pixelPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) goto _13 _13: ; x++ } if bytesPerLineXOR != 0 { (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, __ccgo_ts+1128, bytesPerLineXOR) } goto _12 _12: ; y++ } bytesPerLineAND -= (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth / int32(8) imagePtr = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr + uintptr(*(*int32)(unsafe.Pointer(blockPtr + 20))) + uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) y = 0 for { if !(y < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) { break } imagePtr -= uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) pixelPtr = imagePtr x = 0 for { if !(x < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) { break } if x%int32(8) == 0 { (*(*[4]TUByte)(unsafe.Pointer(bp)))[0] = uint8(0) } if alphaOffset != 0 { c = libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(alphaOffset)))) if c == 0 { p17 = bp *(*TUByte)(unsafe.Pointer(p17)) = TUByte(int32(*(*TUByte)(unsafe.Pointer(p17))) | libc.Int32FromInt32(1)<<(libc.Int32FromInt32(7)-x%libc.Int32FromInt32(8))) } } if x%int32(8) == int32(7) { (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, int32(1)) } pixelPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) goto _16 _16: ; x++ } if bytesPerLineAND != 0 { (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, __ccgo_ts+1128, bytesPerLineAND) } goto _15 _15: ; y++ } return TCL_OK } const BITS_IN_JSAMPLE = 8 const CENTERJSAMPLE = 128 const CHAR_IS_UNSIGNED = 1 const C_MAX_BLOCKS_IN_MCU = 10 const DCTSIZE = 8 const DCTSIZE2 = 64 const D_MAX_BLOCKS_IN_MCU = 10 const HAVE_LOCALE_H = 1 const HAVE_PROTOTYPES = 1 const HAVE_STDDEF_H = 1 const HAVE_UNSIGNED_CHAR = 1 const HAVE_UNSIGNED_SHORT = 1 const JDCT_DEFAULT = 0 const JDCT_FASTEST = 1 const JMSG_LENGTH_MAX = 200 const JMSG_STR_PARM_MAX = 80 const JPEGTCLAPI = "extern" const JPEGTCL_MAJOR_VERSION = 9 const JPEGTCL_MINOR_VERSION = 6 const JPEGTCL_PATCH_LEVEL = "9.6.0" const JPEGTCL_RELEASE_LEVEL = "TCL_RELEASE" const JPEGTCL_RELEASE_SERIAL = 0 const JPEGTCL_VERSION = "9.6.0" const JPEG_APP0 = 0xE0 const JPEG_COM = 0xFE const JPEG_EOI = 217 const JPEG_HEADER_OK = 1 const JPEG_HEADER_TABLES_ONLY = 2 const JPEG_LIB_VERSION = 90 const JPEG_LIB_VERSION_MAJOR = 9 const JPEG_LIB_VERSION_MINOR = 6 const JPEG_MAX_DIMENSION = 65500 const JPEG_REACHED_EOI = 2 const JPEG_REACHED_SOS = 1 const JPEG_ROW_COMPLETED = 3 const JPEG_RST0 = 0xD0 const JPEG_SCAN_COMPLETED = 4 const JPEG_SUSPENDED = 0 const JPOOL_IMAGE = 1 const JPOOL_NUMPOOLS = 2 const JPOOL_PERMANENT = 0 const MAXJSAMPLE = 255 const MAX_COMPONENTS = 10 const MAX_COMPS_IN_SCAN = 4 const MAX_SAMP_FACTOR = 4 const NUM_ARITH_TBLS = 16 const NUM_HUFF_TBLS = 4 const NUM_QUANT_TBLS = 4 const PACKAGE_NAME6 = "tkimgjpeg" const PACKAGE_STRING6 = "tkimgjpeg 2.0.1" const PACKAGE_TARNAME6 = "tkimgjpeg" const PACKAGE_TCLNAME6 = "img::jpeg" const STRING_BUF_SIZE = 4096 type TJSAMPLE = uint8 type TJCOEF = int16 type TJOCTET = uint8 type TUINT8 = uint8 type TUINT16 = uint16 type TINT16 = int16 type TINT32 = int32 type TJDIMENSION = uint32 type Tnoreturn_t = struct{} type TJSAMPROW = uintptr type TJSAMPARRAY = uintptr type TJSAMPIMAGE = uintptr type TJBLOCK = [64]TJCOEF type TJBLOCKROW = uintptr type TJBLOCKARRAY = uintptr type TJBLOCKIMAGE = uintptr type TJCOEFPTR = uintptr type TJQUANT_TBL = struct { Fquantval [64]TUINT16 Fsent_table Tboolean } type TJHUFF_TBL = struct { Fbits [17]TUINT8 Fhuffval [256]TUINT8 Fsent_table Tboolean } type Tjpeg_component_info = struct { Fcomponent_id int32 Fcomponent_index int32 Fh_samp_factor int32 Fv_samp_factor int32 Fquant_tbl_no int32 Fdc_tbl_no int32 Fac_tbl_no int32 Fwidth_in_blocks TJDIMENSION Fheight_in_blocks TJDIMENSION FDCT_h_scaled_size int32 FDCT_v_scaled_size int32 Fdownsampled_width TJDIMENSION Fdownsampled_height TJDIMENSION Fcomponent_needed Tboolean FMCU_width int32 FMCU_height int32 FMCU_blocks int32 FMCU_sample_width int32 Flast_col_width int32 Flast_row_height int32 Fquant_table uintptr Fdct_table uintptr } type Tjpeg_scan_info = struct { Fcomps_in_scan int32 Fcomponent_index [4]int32 FSs int32 FSe int32 FAh int32 FAl int32 } type Tjpeg_saved_marker_ptr = uintptr type Tjpeg_marker_struct = struct { Fnext Tjpeg_saved_marker_ptr Fmarker TUINT8 Foriginal_length uint32 Fdata_length uint32 Fdata uintptr } type TJ_COLOR_SPACE = int32 const JCS_UNKNOWN = 0 const JCS_GRAYSCALE = 1 const JCS_RGB = 2 const JCS_YCbCr = 3 const JCS_CMYK = 4 const JCS_YCCK = 5 const JCS_BG_RGB = 6 const JCS_BG_YCC = 7 type TJ_COLOR_TRANSFORM = int32 const JCT_NONE = 0 const JCT_SUBTRACT_GREEN = 1 type TJ_DCT_METHOD = int32 const JDCT_ISLOW = 0 const JDCT_IFAST = 1 const JDCT_FLOAT = 2 type TJ_DITHER_MODE = int32 const JDITHER_NONE = 0 const JDITHER_ORDERED = 1 const JDITHER_FS = 2 type Tjpeg_common_struct = struct { Ferr uintptr Fmem uintptr Fprogress uintptr Fclient_data uintptr Fis_decompressor Tboolean Fglobal_state int32 } type Tj_common_ptr = uintptr type Tj_compress_ptr = uintptr type Tjpeg_compress_struct = struct { F__ccgo_align [0]uint32 Ferr uintptr Fmem uintptr Fprogress uintptr Fclient_data uintptr Fis_decompressor Tboolean Fglobal_state int32 Fdest uintptr Fimage_width TJDIMENSION Fimage_height TJDIMENSION Finput_components int32 Fin_color_space TJ_COLOR_SPACE F__ccgo_align11 [4]byte Finput_gamma float64 Fscale_num uint32 Fscale_denom uint32 Fjpeg_width TJDIMENSION Fjpeg_height TJDIMENSION Fdata_precision int32 Fnum_components int32 Fjpeg_color_space TJ_COLOR_SPACE Fcomp_info uintptr Fquant_tbl_ptrs [4]uintptr Fq_scale_factor [4]int32 Fdc_huff_tbl_ptrs [4]uintptr Fac_huff_tbl_ptrs [4]uintptr Farith_dc_L [16]TUINT8 Farith_dc_U [16]TUINT8 Farith_ac_K [16]TUINT8 Fnum_scans int32 Fscan_info uintptr Fraw_data_in Tboolean Farith_code Tboolean Foptimize_coding Tboolean FCCIR601_sampling Tboolean Fdo_fancy_downsampling Tboolean Fsmoothing_factor int32 Fdct_method TJ_DCT_METHOD Frestart_interval uint32 Frestart_in_rows int32 Fwrite_JFIF_header Tboolean FJFIF_major_version TUINT8 FJFIF_minor_version TUINT8 Fdensity_unit TUINT8 FX_density TUINT16 FY_density TUINT16 Fwrite_Adobe_marker Tboolean Fcolor_transform TJ_COLOR_TRANSFORM Fnext_scanline TJDIMENSION Fprogressive_mode Tboolean Fmax_h_samp_factor int32 Fmax_v_samp_factor int32 Fmin_DCT_h_scaled_size int32 Fmin_DCT_v_scaled_size int32 Ftotal_iMCU_rows TJDIMENSION Fcomps_in_scan int32 Fcur_comp_info [4]uintptr FMCUs_per_row TJDIMENSION FMCU_rows_in_scan TJDIMENSION Fblocks_in_MCU int32 FMCU_membership [10]int32 FSs int32 FSe int32 FAh int32 FAl int32 Fblock_size int32 Fnatural_order uintptr Flim_Se int32 Fmaster uintptr Fmain1 uintptr Fprep uintptr Fcoef uintptr Fmarker uintptr Fcconvert uintptr Fdownsample uintptr Ffdct uintptr Fentropy uintptr Fscript_space uintptr Fscript_space_size int32 F__ccgo_pad77 [4]byte } type Tj_decompress_ptr = uintptr type Tjpeg_decompress_struct = struct { F__ccgo_align [0]uint32 Ferr uintptr Fmem uintptr Fprogress uintptr Fclient_data uintptr Fis_decompressor Tboolean Fglobal_state int32 Fsrc uintptr Fimage_width TJDIMENSION Fimage_height TJDIMENSION Fnum_components int32 Fjpeg_color_space TJ_COLOR_SPACE Fout_color_space TJ_COLOR_SPACE Fscale_num uint32 Fscale_denom uint32 Foutput_gamma float64 Fbuffered_image Tboolean Fraw_data_out Tboolean Fdct_method TJ_DCT_METHOD Fdo_fancy_upsampling Tboolean Fdo_block_smoothing Tboolean Fquantize_colors Tboolean Fdither_mode TJ_DITHER_MODE Ftwo_pass_quantize Tboolean Fdesired_number_of_colors int32 Fenable_1pass_quant Tboolean Fenable_external_quant Tboolean Fenable_2pass_quant Tboolean Foutput_width TJDIMENSION Foutput_height TJDIMENSION Fout_color_components int32 Foutput_components int32 Frec_outbuf_height int32 Factual_number_of_colors int32 Fcolormap TJSAMPARRAY Foutput_scanline TJDIMENSION Finput_scan_number int32 Finput_iMCU_row TJDIMENSION Foutput_scan_number int32 Foutput_iMCU_row TJDIMENSION Fcoef_bits uintptr Fquant_tbl_ptrs [4]uintptr Fdc_huff_tbl_ptrs [4]uintptr Fac_huff_tbl_ptrs [4]uintptr Fdata_precision int32 Fcomp_info uintptr Fis_baseline Tboolean Fprogressive_mode Tboolean Farith_code Tboolean Farith_dc_L [16]TUINT8 Farith_dc_U [16]TUINT8 Farith_ac_K [16]TUINT8 Frestart_interval uint32 Fsaw_JFIF_marker Tboolean FJFIF_major_version TUINT8 FJFIF_minor_version TUINT8 Fdensity_unit TUINT8 FX_density TUINT16 FY_density TUINT16 Fsaw_Adobe_marker Tboolean FAdobe_transform TUINT8 Fcolor_transform TJ_COLOR_TRANSFORM FCCIR601_sampling Tboolean Fmarker_list Tjpeg_saved_marker_ptr Fmax_h_samp_factor int32 Fmax_v_samp_factor int32 Fmin_DCT_h_scaled_size int32 Fmin_DCT_v_scaled_size int32 Ftotal_iMCU_rows TJDIMENSION Fsample_range_limit uintptr Fcomps_in_scan int32 Fcur_comp_info [4]uintptr FMCUs_per_row TJDIMENSION FMCU_rows_in_scan TJDIMENSION Fblocks_in_MCU int32 FMCU_membership [10]int32 FSs int32 FSe int32 FAh int32 FAl int32 Fblock_size int32 Fnatural_order uintptr Flim_Se int32 Funread_marker int32 Fmaster uintptr Fmain1 uintptr Fcoef uintptr Fpost uintptr Finputctl uintptr Fmarker uintptr Fentropy uintptr Fidct uintptr Fupsample uintptr Fcconvert uintptr Fcquantize uintptr } type Tjpeg_error_mgr = struct { Ferror_exit uintptr Femit_message uintptr Foutput_message uintptr Fformat_message uintptr Freset_error_mgr uintptr Fmsg_code int32 Fmsg_parm struct { Fs [0][80]uint8 Fi [8]int32 F__ccgo_pad2 [48]byte } Ftrace_level int32 Fnum_warnings int32 Fjpeg_message_table uintptr Flast_jpeg_message int32 Faddon_message_table uintptr Ffirst_addon_message int32 Flast_addon_message int32 } type Tjpeg_progress_mgr = struct { Fprogress_monitor uintptr Fpass_counter int32 Fpass_limit int32 Fcompleted_passes int32 Ftotal_passes int32 } type Tjpeg_destination_mgr = struct { Fnext_output_byte uintptr Ffree_in_buffer Tsize_t Finit_destination uintptr Fempty_output_buffer uintptr Fterm_destination uintptr } type Tjpeg_source_mgr = struct { Fnext_input_byte uintptr Fbytes_in_buffer Tsize_t Finit_source uintptr Ffill_input_buffer uintptr Fskip_input_data uintptr Fresync_to_restart uintptr Fterm_source uintptr } type Tjvirt_sarray_ptr = uintptr type Tjvirt_barray_ptr = uintptr type Tjpeg_memory_mgr = struct { Falloc_small uintptr Falloc_large uintptr Falloc_sarray uintptr Falloc_barray uintptr Frequest_virt_sarray uintptr Frequest_virt_barray uintptr Frealize_virt_arrays uintptr Faccess_virt_sarray uintptr Faccess_virt_barray uintptr Ffree_pool uintptr Fself_destruct uintptr Fmax_memory_to_use int32 Fmax_alloc_chunk int32 } type Tjpeg_marker_parser_method = uintptr type TJ_MESSAGE_CODE = int32 const JMSG_NOMESSAGE = 0 const JERR_BAD_ALIGN_TYPE = 1 const JERR_BAD_ALLOC_CHUNK = 2 const JERR_BAD_BUFFER_MODE = 3 const JERR_BAD_COMPONENT_ID = 4 const JERR_BAD_CROP_SPEC = 5 const JERR_BAD_DCT_COEF = 6 const JERR_BAD_DCTSIZE = 7 const JERR_BAD_DROP_SAMPLING = 8 const JERR_BAD_HUFF_TABLE = 9 const JERR_BAD_IN_COLORSPACE = 10 const JERR_BAD_J_COLORSPACE = 11 const JERR_BAD_LENGTH = 12 const JERR_BAD_LIB_VERSION = 13 const JERR_BAD_MCU_SIZE = 14 const JERR_BAD_POOL_ID = 15 const JERR_BAD_PRECISION = 16 const JERR_BAD_PROGRESSION = 17 const JERR_BAD_PROG_SCRIPT = 18 const JERR_BAD_SAMPLING = 19 const JERR_BAD_SCAN_SCRIPT = 20 const JERR_BAD_STATE = 21 const JERR_BAD_STRUCT_SIZE = 22 const JERR_BAD_VIRTUAL_ACCESS = 23 const JERR_BUFFER_SIZE = 24 const JERR_CANT_SUSPEND = 25 const JERR_CCIR601_NOTIMPL = 26 const JERR_COMPONENT_COUNT = 27 const JERR_CONVERSION_NOTIMPL = 28 const JERR_DAC_INDEX = 29 const JERR_DAC_VALUE = 30 const JERR_DHT_INDEX = 31 const JERR_DQT_INDEX = 32 const JERR_EMPTY_IMAGE = 33 const JERR_EMS_READ = 34 const JERR_EMS_WRITE = 35 const JERR_EOI_EXPECTED = 36 const JERR_FILE_READ = 37 const JERR_FILE_WRITE = 38 const JERR_FRACT_SAMPLE_NOTIMPL = 39 const JERR_HUFF_CLEN_OUTOFBOUNDS = 40 const JERR_HUFF_MISSING_CODE = 41 const JERR_IMAGE_TOO_BIG = 42 const JERR_INPUT_EMPTY = 43 const JERR_INPUT_EOF = 44 const JERR_MISMATCHED_QUANT_TABLE = 45 const JERR_MISSING_DATA = 46 const JERR_MODE_CHANGE = 47 const JERR_NOTIMPL = 48 const JERR_NOT_COMPILED = 49 const JERR_NO_ARITH_TABLE = 50 const JERR_NO_BACKING_STORE = 51 const JERR_NO_HUFF_TABLE = 52 const JERR_NO_IMAGE = 53 const JERR_NO_QUANT_TABLE = 54 const JERR_NO_SOI = 55 const JERR_OUT_OF_MEMORY = 56 const JERR_QUANT_COMPONENTS = 57 const JERR_QUANT_FEW_COLORS = 58 const JERR_QUANT_MANY_COLORS = 59 const JERR_SOF_BEFORE = 60 const JERR_SOF_DUPLICATE = 61 const JERR_SOF_NO_SOS = 62 const JERR_SOF_UNSUPPORTED = 63 const JERR_SOI_DUPLICATE = 64 const JERR_TFILE_CREATE = 65 const JERR_TFILE_READ = 66 const JERR_TFILE_SEEK = 67 const JERR_TFILE_WRITE = 68 const JERR_TOO_LITTLE_DATA = 69 const JERR_UNKNOWN_MARKER = 70 const JERR_VIRTUAL_BUG = 71 const JERR_WIDTH_OVERFLOW = 72 const JERR_XMS_READ = 73 const JERR_XMS_WRITE = 74 const JMSG_COPYRIGHT = 75 const JMSG_VERSION = 76 const JTRC_16BIT_TABLES = 77 const JTRC_ADOBE = 78 const JTRC_APP0 = 79 const JTRC_APP14 = 80 const JTRC_DAC = 81 const JTRC_DHT = 82 const JTRC_DQT = 83 const JTRC_DRI = 84 const JTRC_EMS_CLOSE = 85 const JTRC_EMS_OPEN = 86 const JTRC_EOI = 87 const JTRC_HUFFBITS = 88 const JTRC_JFIF = 89 const JTRC_JFIF_BADTHUMBNAILSIZE = 90 const JTRC_JFIF_EXTENSION = 91 const JTRC_JFIF_THUMBNAIL = 92 const JTRC_MISC_MARKER = 93 const JTRC_PARMLESS_MARKER = 94 const JTRC_QUANTVALS = 95 const JTRC_QUANT_3_NCOLORS = 96 const JTRC_QUANT_NCOLORS = 97 const JTRC_QUANT_SELECTED = 98 const JTRC_RECOVERY_ACTION = 99 const JTRC_RST = 100 const JTRC_SMOOTH_NOTIMPL = 101 const JTRC_SOF = 102 const JTRC_SOF_COMPONENT = 103 const JTRC_SOI = 104 const JTRC_SOS = 105 const JTRC_SOS_COMPONENT = 106 const JTRC_SOS_PARAMS = 107 const JTRC_TFILE_CLOSE = 108 const JTRC_TFILE_OPEN = 109 const JTRC_THUMB_JPEG = 110 const JTRC_THUMB_PALETTE = 111 const JTRC_THUMB_RGB = 112 const JTRC_UNKNOWN_IDS = 113 const JTRC_XMS_CLOSE = 114 const JTRC_XMS_OPEN = 115 const JWRN_ADOBE_XFORM = 116 const JWRN_ARITH_BAD_CODE = 117 const JWRN_BOGUS_PROGRESSION = 118 const JWRN_EXTRANEOUS_DATA = 119 const JWRN_HIT_MARKER = 120 const JWRN_HUFF_BAD_CODE = 121 const JWRN_JFIF_MAJOR = 122 const JWRN_JPEG_EOF = 123 const JWRN_MUST_RESYNC = 124 const JWRN_NOT_SEQUENTIAL = 125 const JWRN_TOO_MUCH_DATA = 126 const JMSG_LASTMSGCODE = 127 type TJpegtclStubs = struct { Fmagic int32 Fhooks uintptr Fjpeg_std_errorPtr uintptr Fjpeg_CreateCompressPtr uintptr Fjpeg_CreateDecompressPtr uintptr Fjpeg_destroy_compressPtr uintptr Fjpeg_destroy_decompressPtr uintptr Fjpeg_stdio_destPtr uintptr Fjpeg_stdio_srcPtr uintptr Fjpeg_set_defaultsPtr uintptr Fjpeg_set_colorspacePtr uintptr Fjpeg_default_colorspacePtr uintptr Fjpeg_set_qualityPtr uintptr Fjpeg_set_linear_qualityPtr uintptr Fjpeg_add_quant_tablePtr uintptr Fjpeg_quality_scalingPtr uintptr Fjpeg_simple_progressionPtr uintptr Fjpeg_suppress_tablesPtr uintptr Fjpeg_alloc_quant_tablePtr uintptr Fjpeg_alloc_huff_tablePtr uintptr Fjpeg_start_compressPtr uintptr Fjpeg_write_scanlinesPtr uintptr Fjpeg_finish_compressPtr uintptr Fjpeg_write_raw_dataPtr uintptr Fjpeg_write_markerPtr uintptr Fjpeg_write_m_headerPtr uintptr Fjpeg_write_m_bytePtr uintptr Fjpeg_write_tablesPtr uintptr Fjpeg_read_headerPtr uintptr Fjpeg_start_decompressPtr uintptr Fjpeg_read_scanlinesPtr uintptr Fjpeg_finish_decompressPtr uintptr Fjpeg_read_raw_dataPtr uintptr Fjpeg_has_multiple_scansPtr uintptr Fjpeg_start_outputPtr uintptr Fjpeg_finish_outputPtr uintptr Fjpeg_input_completePtr uintptr Fjpeg_new_colormapPtr uintptr Fjpeg_consume_inputPtr uintptr Fjpeg_calc_output_dimensionsPtr uintptr Fjpeg_save_markersPtr uintptr Fjpeg_set_marker_processorPtr uintptr Fjpeg_read_coefficientsPtr uintptr Fjpeg_write_coefficientsPtr uintptr Fjpeg_copy_critical_parametersPtr uintptr Fjpeg_abort_compressPtr uintptr Fjpeg_abort_decompressPtr uintptr Fjpeg_abortPtr uintptr Fjpeg_destroyPtr uintptr Fjpeg_resync_to_restartPtr uintptr Fjpeg_std_huff_tablePtr uintptr } var _sImageFormatVersion32 = TTk_PhotoImageFormatVersion3{ Fname: __ccgo_ts + 4201, } func init() { p := unsafe.Pointer(&_sImageFormatVersion32) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatchVersion32) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatchVersion32) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileReadVersion32) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringReadVersion32) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWriteVersion32) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWriteVersion32) } /* *---------------------------------------------------------------------------- * * Tkimgjpeg_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgjpeg_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+40, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } } } else { if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, TTcl_Size, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetIndexFromObjStruct})))(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), uintptr(unsafe.Pointer(&_writeOptions3)), libc.Int32FromUint32(libc.Uint32FromInt64(4)), __ccgo_ts+688, libc.Int32FromInt32(0)|libc.Int32FromUint32(libc.Uint32FromInt64(4)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v5 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+40, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v5)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } } } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { /* No more parameters available. */ break } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i+int32(1))*4)), libc.UintptrFromInt32(0)) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(optionStr))) == int32('-') { /* Next parameter is an option. */ break } if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+24) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+836, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT5)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 24)) i++ case 7: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+24) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+807, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT5)(unsafe.Pointer(opts)).Fxres = *(*float64)(unsafe.Pointer(bp + 24)) case 8: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+24) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+836, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT5)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 24)) break } } goto _1 _1: ; i++ } return TCL_OK } var _readOptions5 = [4]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 4241, 2: __ccgo_ts + 4247, 3: libc.UintptrFromInt32(0), } var _writeOptions3 = [10]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 4247, 2: __ccgo_ts + 4258, 3: __ccgo_ts + 4268, 4: __ccgo_ts + 4281, 5: __ccgo_ts + 4290, 6: __ccgo_ts + 650, 7: __ccgo_ts + 662, 8: __ccgo_ts + 675, 9: libc.UintptrFromInt32(0), } func _SetupJPegLibrary(tls *libc.TLS, interp uintptr) (r int32) { bp := tls.Alloc(576) defer tls.Free(576) var cinfo, v1 uintptr var i int32 var _ /* jerror at bp+0 */ Tmy_error_mgr _, _, _ = cinfo, i, v1 if !(XJpegtcl_InitStubs(tls, interp, __ccgo_ts+4455, 0) != 0) { return int32(TCL_ERROR) } /* The followin code tries to determine if the JPEG library is valid at all. The library might be configured differently, which will produce core dumps. Also it might be that fields appear in different places in jpeg_compress_struct or jpeg_decompress_struct. This will make the library totally unusable. In stead of a core-dump, we better have a proper error message */ /* overallocat size, so we don't get a core-dump if the library thinks that the structure is much larger */ cinfo = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(8)*libc.Uint32FromInt64(440)) if cinfo == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+536, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_errorPtr})))(tls, bp) (*(*Tmy_error_mgr)(unsafe.Pointer(bp))).Fpub.Ferror_exit = __ccgo_fp(_my_error_exit) (*(*Tmy_error_mgr)(unsafe.Pointer(bp))).Fpub.Foutput_message = __ccgo_fp(_my_output_message) /* Establish the setjmp return context for my_error_exit to use. */ v1 = bp + 136 tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: /* If we get here, the JPEG library is invalid. */ (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_compressPtr})))(tls, cinfo) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, cinfo) if interp != 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+536, __ccgo_ts+4461, __ccgo_ts+4477, __ccgo_ts+4485, libc.UintptrFromInt32(0))) } r = int32(TCL_ERROR) return default: tls.PopJumpBuffer(v1) } }() /* Now we can initialize libjpeg. */ *(*uint8)(unsafe.Pointer(cinfo + uintptr(440))) = uint8(53) (*(*func(*libc.TLS, Tj_compress_ptr, int32, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_CreateCompressPtr})))(tls, cinfo, int32(JPEG_LIB_VERSION), libc.Uint32FromInt64(440)) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cinfo + uintptr(440)))) != int32(53) { /* Oops. The library changed this value, which is outside the * structure. Definitely, the library is invalid!!!! */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JMSG_NOMESSAGE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Set up JPEG compression parameters. */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width = uint32(16) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height = uint32(16) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components = int32(3) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space = int32(JCS_RGB) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision = -int32(1) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding = int32(TRUE) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdct_method = -int32(1) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FX_density = uint16(0) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FY_density = uint16(0) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_set_defaultsPtr})))(tls, cinfo) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision != int32(BITS_IN_JSAMPLE) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding != FALSE || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdct_method != int32(JDCT_ISLOW) || libc.Int32FromUint16((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FX_density) != int32(1) || libc.Int32FromUint16((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FY_density) != int32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JMSG_NOMESSAGE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } i = 0 for { if !(i < int32(NUM_ARITH_TBLS)) { break } if libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 152 + uintptr(i)))) != 0 || libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 168 + uintptr(i)))) != int32(1) || libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 184 + uintptr(i)))) != int32(5) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JMSG_NOMESSAGE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } goto _2 _2: ; i++ } (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_compressPtr})))(tls, cinfo) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, cinfo) return TCL_OK } func _FileMatchVersion32(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(1072) defer tls.Free(1072) var retVal int32 var v1 uintptr var _ /* cinfo at bp+16 */ Tjpeg_decompress_struct var _ /* handle at bp+1032 */ Ttkimg_Stream var _ /* jerror at bp+504 */ Tmy_error_mgr var _ /* xdpi at bp+0 */ float64 var _ /* ydpi at bp+8 */ float64 _, _ = retVal, v1 libc.Xmemset(tls, bp+1032, 0, uint32(40)) /* Initialize JPEG error handler */ /* We set up the normal JPEG error routines, then override error_exit. */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(bp + 16))).Ferr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_errorPtr})))(tls, bp+504) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 504))).Fpub.Ferror_exit = __ccgo_fp(_my_error_exit) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 504))).Fpub.Foutput_message = __ccgo_fp(_my_output_message) /* Establish the setjmp return context for my_error_exit to use. */ v1 = bp + 504 + 136 tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: /* If we get here, the JPEG code has signaled an error. */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_decompressPtr})))(tls, bp+16) r = 0 return default: tls.PopJumpBuffer(v1) } }() /* Now we can initialize libjpeg. */ (*(*func(*libc.TLS, Tj_decompress_ptr, int32, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_CreateDecompressPtr})))(tls, bp+16, int32(JPEG_LIB_VERSION), libc.Uint32FromInt64(488)) _my_jpeg_channel_src(tls, bp+16, chan1) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp+1032, chan1) retVal = _CommonMatch4(tls, bp+16, bp+1032, widthPtr, heightPtr, bp, bp+8) if retVal != 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp + 8)) >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, *(*float64)(unsafe.Pointer(bp)), *(*float64)(unsafe.Pointer(bp + 8))) { return 0 } } /* Reclaim libjpeg's internal resources. */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_decompressPtr})))(tls, bp+16) return retVal } func _StringMatchVersion32(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(1072) defer tls.Free(1072) var retVal int32 var v1 uintptr var _ /* cinfo at bp+16 */ Tjpeg_decompress_struct var _ /* handle at bp+1032 */ Ttkimg_Stream var _ /* jerror at bp+504 */ Tmy_error_mgr var _ /* xdpi at bp+0 */ float64 var _ /* ydpi at bp+8 */ float64 _, _ = retVal, v1 libc.Xmemset(tls, bp+1032, 0, uint32(40)) /* Initialize JPEG error handler */ /* We set up the normal JPEG error routines, then override error_exit. */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(bp + 16))).Ferr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_errorPtr})))(tls, bp+504) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 504))).Fpub.Ferror_exit = __ccgo_fp(_my_error_exit) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 504))).Fpub.Foutput_message = __ccgo_fp(_my_output_message) /* Establish the setjmp return context for my_error_exit to use. */ v1 = bp + 504 + 136 tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: /* If we get here, the JPEG code has signaled an error. */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_decompressPtr})))(tls, bp+16) r = 0 return default: tls.PopJumpBuffer(v1) } }() /* Now we can initialize libjpeg. */ (*(*func(*libc.TLS, Tj_decompress_ptr, int32, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_CreateDecompressPtr})))(tls, bp+16, int32(JPEG_LIB_VERSION), libc.Uint32FromInt64(488)) _my_jpeg_obj_src(tls, bp+16, dataObj) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp+1032, dataObj) != 0) { return 0 } retVal = _CommonMatch4(tls, bp+16, bp+1032, widthPtr, heightPtr, bp, bp+8) if retVal != 0 && *(*float64)(unsafe.Pointer(bp)) >= float64(0) && *(*float64)(unsafe.Pointer(bp + 8)) >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, *(*float64)(unsafe.Pointer(bp)), *(*float64)(unsafe.Pointer(bp + 8))) { return 0 } } /* Reclaim libjpeg's internal resources. */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_decompressPtr})))(tls, bp+16) return retVal } /* *---------------------------------------------------------------------- * * CommonMatch -- * * This procedure is invoked by the photo image type to see if * a string contains image data in JPEG format. * * Results: * The return value is >0 if the first characters in the string look * like JPEG data, and 0 otherwise. For a valid image, the image * dimensions are determined. * * Side effects: * the size of the image is placed in widthPtr and heightPtr. * *---------------------------------------------------------------------- */ func _CommonMatch4(tls *libc.TLS, cinfo Tj_decompress_ptr, handle uintptr, widthPtr uintptr, heightPtr uintptr, xdpiPtr uintptr, ydpiPtr uintptr) (r int32) { /* Ready to read header data. */ if (*(*func(*libc.TLS, Tj_decompress_ptr, Tboolean) int32)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_read_headerPtr})))(tls, cinfo, int32(TRUE)) != int32(JPEG_HEADER_OK) { return 0 } (*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_start_decompressPtr})))(tls, cinfo) *(*int32)(unsafe.Pointer(widthPtr)) = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width) *(*int32)(unsafe.Pointer(heightPtr)) = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height) *(*float64)(unsafe.Pointer(xdpiPtr)) = -libc.Float64FromFloat64(1) *(*float64)(unsafe.Pointer(ydpiPtr)) = -libc.Float64FromFloat64(1) if libc.Int32FromUint16((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FX_density) != 0 && libc.Int32FromUint16((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FY_density) != 0 { if libc.Int32FromUint8((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdensity_unit) == int32(1) { /* dots per inch */ *(*float64)(unsafe.Pointer(xdpiPtr)) = float64((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FX_density) *(*float64)(unsafe.Pointer(ydpiPtr)) = float64((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FY_density) } else { if libc.Int32FromUint8((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdensity_unit) == int32(2) { /* dots per cm */ *(*float64)(unsafe.Pointer(xdpiPtr)) = float64((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FX_density) * float64(2.54) *(*float64)(unsafe.Pointer(ydpiPtr)) = float64((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FY_density) * float64(2.54) } } } return int32(1) } func _FileReadVersion32(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(1040) defer tls.Free(1040) var result int32 var v1 uintptr var _ /* cinfo at bp+0 */ Tjpeg_decompress_struct var _ /* jerror at bp+488 */ Tmy_error_mgr _, _ = result, v1 /* Initialize JPEG error handler */ /* We set up the normal JPEG error routines, then override error_exit. */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(bp))).Ferr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_errorPtr})))(tls, bp+488) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 488))).Fpub.Ferror_exit = __ccgo_fp(_my_error_exit) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 488))).Fpub.Foutput_message = __ccgo_fp(_my_output_message) /* Establish the setjmp return context for my_error_exit to use. */ v1 = bp + 488 + 136 tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: /* If we get here, the JPEG code has signaled an error. */ (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1024, __ccgo_ts+4526, libc.UintptrFromInt32(0))) _append_jpeg_message(tls, interp, bp) (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_decompressPtr})))(tls, bp) r = int32(TCL_ERROR) return default: tls.PopJumpBuffer(v1) } }() /* Now we can initialize libjpeg. */ (*(*func(*libc.TLS, Tj_decompress_ptr, int32, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_CreateDecompressPtr})))(tls, bp, int32(JPEG_LIB_VERSION), libc.Uint32FromInt64(488)) _my_jpeg_channel_src(tls, bp, chan1) /* Share code with StringRead. */ result = _CommonRead5(tls, interp, fileName, bp, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) /* Reclaim libjpeg's internal resources. */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_decompressPtr})))(tls, bp) return result } func _StringReadVersion32(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(1040) defer tls.Free(1040) var result int32 var v1 uintptr var _ /* cinfo at bp+0 */ Tjpeg_decompress_struct var _ /* jerror at bp+488 */ Tmy_error_mgr _, _ = result, v1 /* Initialize JPEG error handler */ /* We set up the normal JPEG error routines, then override error_exit. */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(bp))).Ferr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_errorPtr})))(tls, bp+488) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 488))).Fpub.Ferror_exit = __ccgo_fp(_my_error_exit) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 488))).Fpub.Foutput_message = __ccgo_fp(_my_output_message) /* Establish the setjmp return context for my_error_exit to use. */ v1 = bp + 488 + 136 tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: /* If we get here, the JPEG code has signaled an error. */ (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1024, __ccgo_ts+4553, libc.UintptrFromInt32(0))) _append_jpeg_message(tls, interp, bp) (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_decompressPtr})))(tls, bp) r = int32(TCL_ERROR) return default: tls.PopJumpBuffer(v1) } }() /* Now we can initialize libjpeg. */ (*(*func(*libc.TLS, Tj_decompress_ptr, int32, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_CreateDecompressPtr})))(tls, bp, int32(JPEG_LIB_VERSION), libc.Uint32FromInt64(488)) _my_jpeg_obj_src(tls, bp, dataObj) /* Share code with FileRead. */ result = _CommonRead5(tls, interp, __ccgo_ts+865, bp, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) /* Reclaim libjpeg's internal resources. */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_decompressPtr})))(tls, bp) return result } // C documentation // // /* // *---------------------------------------------------------------------- // * // * CommonRead -- // * // * The common guts of FileRead and StringRead. // * The decompress struct has already been set up and the // * appropriate data source manager initialized. // * The caller should do jpeg_destroy_decompress upon return. // * // *---------------------------------------------------------------------- // */ func _CommonRead5(tls *libc.TLS, interp uintptr, fileName uintptr, cinfo Tj_decompress_ptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(112) defer tls.Free(112) var buffer TJSAMPARRAY var curY, fileHeight, fileWidth, outHeight, outWidth, outY, stopY int32 var xdpi, ydpi float64 var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* opts at bp+40 */ TFMTOPT5 _, _, _, _, _, _, _, _, _, _ = buffer, curY, fileHeight, fileWidth, outHeight, outWidth, outY, stopY, xdpi, ydpi /* Ready to read header data. */ (*(*func(*libc.TLS, Tj_decompress_ptr, Tboolean) int32)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_read_headerPtr})))(tls, cinfo, int32(TRUE)) /* This code only supports 8-bit-precision JPEG files. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdata_precision != int32(8) || libc.Bool(uint32(1) != uint32(1)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+96, __ccgo_ts+4582, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if _ParseFormatOpts5(tls, interp, format, bp+40, libc.Int32FromInt32(1)< fileWidth { outWidth = fileWidth - srcX } else { outWidth = width } if srcY+height > fileHeight { outHeight = fileHeight - srcY } else { outHeight = height } if outWidth <= 0 || outHeight <= 0 || srcX >= fileWidth || srcY >= fileHeight { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+96, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } /* Check colorspace. */ switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_space { case int32(JCS_GRAYSCALE): /* a single-sample grayscale pixel is expanded into equal R,G,B values */ (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = int32(1) *(*int32)(unsafe.Pointer(bp + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = 0 case int32(JCS_RGB): /* note: this pixel layout assumes default configuration of libjpeg. */ (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = int32(3) *(*int32)(unsafe.Pointer(bp + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = int32(2) default: (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+96, __ccgo_ts+4609, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = outWidth (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize * fileWidth *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = *(*int32)(unsafe.Pointer(bp + 20)) xdpi = -libc.Float64FromFloat64(1) ydpi = -libc.Float64FromFloat64(1) if libc.Int32FromUint16((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FX_density) != 0 && libc.Int32FromUint16((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FY_density) != 0 { if libc.Int32FromUint8((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdensity_unit) == int32(1) { /* dots per inch */ xdpi = float64((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FX_density) ydpi = float64((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FY_density) } else { if libc.Int32FromUint8((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdensity_unit) == int32(2) { /* dots per cm */ xdpi = float64((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FX_density) * float64(2.54) ydpi = float64((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FY_density) * float64(2.54) } } } if xdpi >= float64(0) && ydpi >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, xdpi, ydpi) { return int32(TCL_ERROR) } } if (*(*TFMTOPT5)(unsafe.Pointer(bp + 40))).Fverbose != 0 { _printImgInfo5(tls, fileWidth, fileHeight, int32(xdpi+libc.Float64FromFloat64(0.5)), int32(ydpi+libc.Float64FromFloat64(0.5)), fileName, __ccgo_ts+881) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+outWidth, destY+outHeight) == int32(TCL_ERROR) { (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_abort_decompressPtr})))(tls, cinfo) return int32(TCL_ERROR) } /* Make a temporary one-row-high sample array */ buffer = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_components), uint32(1)) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = *(*TJSAMPROW)(unsafe.Pointer(buffer)) + uintptr(srcX*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize) /* Read as much of the data as we need to */ stopY = srcY + outHeight outY = destY curY = 0 for { if !(curY < stopY) { break } (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPARRAY, TJDIMENSION) TJDIMENSION)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_read_scanlinesPtr})))(tls, cinfo, buffer, uint32(1)) if curY >= srcY { if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, outWidth, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_abort_decompressPtr})))(tls, cinfo) return int32(TCL_ERROR) } outY++ } goto _1 _1: ; curY++ } /* Do normal cleanup if we read the whole image; else early abort */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline == (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height { (*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_finish_decompressPtr})))(tls, cinfo) } else { (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_abort_decompressPtr})))(tls, cinfo) } return TCL_OK } func _FileWriteVersion32(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(1008) defer tls.Free(1008) var chan1 TTcl_Channel var result int32 var v1 uintptr var _ /* cinfo at bp+0 */ Tjpeg_compress_struct var _ /* jerror at bp+440 */ Tmy_error_mgr _, _, _ = chan1, result, v1 chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, fileName, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } /* Initialize JPEG error handler */ /* We set up the normal JPEG error routines, then override error_exit. */ (*(*Tjpeg_compress_struct)(unsafe.Pointer(bp))).Ferr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_errorPtr})))(tls, bp+440) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 440))).Fpub.Ferror_exit = __ccgo_fp(_my_error_exit) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 440))).Fpub.Foutput_message = __ccgo_fp(_my_output_message) /* Establish the setjmp return context for my_error_exit to use. */ v1 = bp + 440 + 136 tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: /* If we get here, the JPEG code has signaled an error. */ (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+976, __ccgo_ts+4638, fileName, __ccgo_ts+4666, libc.UintptrFromInt32(0))) _append_jpeg_message(tls, interp, bp) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_compressPtr})))(tls, bp) (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) r = int32(TCL_ERROR) return default: tls.PopJumpBuffer(v1) } }() /* Now we can initialize libjpeg. */ (*(*func(*libc.TLS, Tj_compress_ptr, int32, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_CreateCompressPtr})))(tls, bp, int32(JPEG_LIB_VERSION), libc.Uint32FromInt64(440)) _my_jpeg_channel_dest(tls, bp, chan1) result = _CommonWrite3(tls, interp, fileName, bp, format, blockPtr, metadataIn) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_compressPtr})))(tls, bp) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } func _StringWriteVersion32(tls *libc.TLS, interp uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(992) defer tls.Free(992) var dest Tdest_ptr var result int32 var v1 uintptr var _ /* cinfo at bp+0 */ Tjpeg_compress_struct var _ /* jerror at bp+440 */ Tmy_error_mgr _, _, _ = dest, result, v1 /* Initialize JPEG error handler */ /* We set up the normal JPEG error routines, then override error_exit. */ (*(*Tjpeg_compress_struct)(unsafe.Pointer(bp))).Ferr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_errorPtr})))(tls, bp+440) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 440))).Fpub.Ferror_exit = __ccgo_fp(_my_error_exit) (*(*Tmy_error_mgr)(unsafe.Pointer(bp + 440))).Fpub.Foutput_message = __ccgo_fp(_my_output_message) /* Establish the setjmp return context for my_error_exit to use. */ v1 = bp + 440 + 136 tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: /* If we get here, the JPEG code has signaled an error. */ (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+976, __ccgo_ts+4670, libc.UintptrFromInt32(0))) _append_jpeg_message(tls, interp, bp) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_compressPtr})))(tls, bp) r = int32(TCL_ERROR) return default: tls.PopJumpBuffer(v1) } }() /* Now we can initialize libjpeg. */ (*(*func(*libc.TLS, Tj_compress_ptr, int32, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_CreateCompressPtr})))(tls, bp, int32(JPEG_LIB_VERSION), libc.Uint32FromInt64(440)) /* tkimg_WriteInitString is called in function below. */ _my_jpeg_string_dest(tls, bp) result = _CommonWrite3(tls, interp, __ccgo_ts+865, bp, format, blockPtr, metadataIn) if result == TCL_OK { dest = (*(*Tjpeg_compress_struct)(unsafe.Pointer(bp))).Fdest (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*Tdestination_mgr)(unsafe.Pointer(dest)).Fhandle.FbyteObj) } (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroy_compressPtr})))(tls, bp) return result } /* *---------------------------------------------------------------------- * * CommonWrite -- * * The common guts of FileWrite and StringWrite. * The compress struct has already been set up and the * appropriate data destination manager initialized. * The caller should do jpeg_destroy_compress upon return, * and also close the destination as necessary. * *---------------------------------------------------------------------- */ func _CommonWrite3(tls *libc.TLS, interp uintptr, fileName uintptr, cinfo Tj_compress_ptr, format uintptr, blockPtr uintptr, metadataIn uintptr) (r int32) { bp := tls.Alloc(80) defer tls.Free(80) var alphaOffset, blueOffset, greenOffset, h, w, v1 int32 var buffer TJSAMPARRAY var bufferPtr, v10, v5, v6, v7, v8, v9 TJSAMPROW var pixLinePtr, pixelPtr uintptr var _ /* opts at bp+24 */ TFMTOPT5 var _ /* row_pointer at bp+0 */ [1]TJSAMPROW var _ /* xdpi at bp+8 */ float64 var _ /* ydpi at bp+16 */ float64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, buffer, bufferPtr, greenOffset, h, pixLinePtr, pixelPtr, w, v1, v10, v5, v6, v7, v8, v9 greenOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 1*4)) - *(*int32)(unsafe.Pointer(blockPtr + 20)) blueOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) - *(*int32)(unsafe.Pointer(blockPtr + 20)) alphaOffset = *(*int32)(unsafe.Pointer(blockPtr + 20)) if alphaOffset < *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) { alphaOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) } alphaOffset++ v1 = alphaOffset if v1 < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize { alphaOffset -= *(*int32)(unsafe.Pointer(blockPtr + 20)) } else { alphaOffset = 0 } /* Set up JPEG compression parameters. */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width = libc.Uint32FromInt32((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height = libc.Uint32FromInt32((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components = int32(3) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space = int32(JCS_RGB) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_set_defaultsPtr})))(tls, cinfo) if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetResolutionPtr})))(tls, interp, metadataIn, bp+8, bp+16) { return int32(TCL_ERROR) } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FX_density = uint16(*(*float64)(unsafe.Pointer(bp + 8))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FY_density = uint16(*(*float64)(unsafe.Pointer(bp + 16))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdensity_unit = uint8(1) /* dots per inch */ if _ParseFormatOpts5(tls, interp, format, bp+24, libc.Int32FromInt32(1)< 0 { (*(*func(*libc.TLS, Tj_compress_ptr, int32, Tboolean))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_set_qualityPtr})))(tls, cinfo, (*(*TFMTOPT5)(unsafe.Pointer(bp + 24))).Fquality, FALSE) } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding = (*(*TFMTOPT5)(unsafe.Pointer(bp + 24))).Foptimize if (*(*TFMTOPT5)(unsafe.Pointer(bp + 24))).Fsmooth > 0 { (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fsmoothing_factor = (*(*TFMTOPT5)(unsafe.Pointer(bp + 24))).Fsmooth } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FX_density = uint16((*(*TFMTOPT5)(unsafe.Pointer(bp + 24))).Fxres) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FY_density = uint16((*(*TFMTOPT5)(unsafe.Pointer(bp + 24))).Fyres) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdensity_unit = uint8(1) /* Dots per inch */ pixLinePtr = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr + uintptr(*(*int32)(unsafe.Pointer(blockPtr + 20))) greenOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 1*4)) - *(*int32)(unsafe.Pointer(blockPtr + 20)) blueOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) - *(*int32)(unsafe.Pointer(blockPtr + 20)) if (*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_set_colorspacePtr != libc.UintptrFromInt32(0) && ((*(*TFMTOPT5)(unsafe.Pointer(bp + 24))).Fgrayscale != 0 || !(greenOffset != 0) && !(blueOffset != 0)) { /* Generate monochrome JPEG file if source block is grayscale. */ (*(*func(*libc.TLS, Tj_compress_ptr, TJ_COLOR_SPACE))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_set_colorspacePtr})))(tls, cinfo, int32(JCS_GRAYSCALE)) } (*(*func(*libc.TLS, Tj_compress_ptr, Tboolean))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_start_compressPtr})))(tls, cinfo, int32(TRUE)) /* note: we assume libjpeg is configured for standard RGB pixel order. */ if greenOffset == int32(1) && blueOffset == int32(2) && (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize == int32(3) { /* No need to reformat pixels before passing data to libjpeg */ h = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight for { if !(h > 0) { break } (*(*[1]TJSAMPROW)(unsafe.Pointer(bp)))[0] = pixLinePtr (*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPARRAY, TJDIMENSION) TJDIMENSION)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_write_scanlinesPtr})))(tls, cinfo, bp, uint32(1)) pixLinePtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) goto _2 _2: ; h-- } } else { /* Must convert data format. Create a one-scanline work buffer. */ buffer = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components), uint32(1)) h = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight for { if !(h > 0) { break } pixelPtr = pixLinePtr bufferPtr = *(*TJSAMPROW)(unsafe.Pointer(buffer)) w = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth for { if !(w > 0) { break } if alphaOffset != 0 && !(*(*uint8)(unsafe.Pointer(pixelPtr + uintptr(alphaOffset))) != 0) { /* if pixel is transparant, better use gray * than the default black. */ v5 = bufferPtr bufferPtr++ *(*TJSAMPLE)(unsafe.Pointer(v5)) = uint8(0xd9) v6 = bufferPtr bufferPtr++ *(*TJSAMPLE)(unsafe.Pointer(v6)) = uint8(0xd9) v7 = bufferPtr bufferPtr++ *(*TJSAMPLE)(unsafe.Pointer(v7)) = uint8(0xd9) } else { v8 = bufferPtr bufferPtr++ *(*TJSAMPLE)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(pixelPtr)) v9 = bufferPtr bufferPtr++ *(*TJSAMPLE)(unsafe.Pointer(v9)) = *(*uint8)(unsafe.Pointer(pixelPtr + uintptr(greenOffset))) v10 = bufferPtr bufferPtr++ *(*TJSAMPLE)(unsafe.Pointer(v10)) = *(*uint8)(unsafe.Pointer(pixelPtr + uintptr(blueOffset))) } pixelPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) goto _4 _4: ; w-- } (*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPARRAY, TJDIMENSION) TJDIMENSION)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_write_scanlinesPtr})))(tls, cinfo, buffer, uint32(1)) pixLinePtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) goto _3 _3: ; h-- } } (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_finish_compressPtr})))(tls, cinfo) if (*(*TFMTOPT5)(unsafe.Pointer(bp + 24))).Fverbose != 0 { _printImgInfo5(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width), libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height), libc.Int32FromUint16((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FX_density), libc.Int32FromUint16((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FY_density), fileName, __ccgo_ts+1132) } return TCL_OK } /* * libjpeg source manager for reading from base64-encoded strings * and from Tcl_Channels. */ func _my_jpeg_obj_src(tls *libc.TLS, cinfo Tj_decompress_ptr, dataObj uintptr) { var src Tsrc_ptr _ = src src = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, uint32(4164)) libc.Xmemset(tls, src, 0, uint32(4164)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc = src (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Finit_source = __ccgo_fp(_dummy_source) (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Ffill_input_buffer = __ccgo_fp(_fill_input_buffer) (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fskip_input_data = __ccgo_fp(_skip_input_data) (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fresync_to_restart = (*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_resync_to_restartPtr /* use default method */ (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fterm_source = __ccgo_fp(_dummy_source) (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, src+28, dataObj) (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fbytes_in_buffer = uint32(0) /* forces fill_input_buffer on first read */ (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fnext_input_byte = libc.UintptrFromInt32(0) /* until buffer loaded */ } func _fill_input_buffer(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { var nbytes int32 var src Tsrc_ptr _, _ = nbytes, src src = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc nbytes = (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, src+28, src+68, int32(STRING_BUF_SIZE)) if nbytes <= 0 { /* Insert a fake EOI marker */ *(*TJOCTET)(unsafe.Pointer(src + 68)) = libc.Uint8FromInt32(0xFF) *(*TJOCTET)(unsafe.Pointer(src + 68 + 1)) = libc.Uint8FromInt32(JPEG_EOI) nbytes = int32(2) } (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fnext_input_byte = src + 68 (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fbytes_in_buffer = libc.Uint32FromInt32(nbytes) return int32(TRUE) } func _skip_input_data(tls *libc.TLS, cinfo Tj_decompress_ptr, num_bytes int32) { var src Tsrc_ptr _ = src src = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc if num_bytes > 0 { for num_bytes > libc.Int32FromUint32((*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fbytes_in_buffer) { num_bytes -= libc.Int32FromUint32((*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fbytes_in_buffer) _fill_input_buffer(tls, cinfo) } (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fnext_input_byte += uintptr(libc.Uint32FromInt32(num_bytes)) (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fbytes_in_buffer -= libc.Uint32FromInt32(num_bytes) } } func _dummy_source(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* no work necessary here */ } // C documentation // // /* // * libjpeg source manager for reading from channels. // */ func _my_jpeg_channel_src(tls *libc.TLS, cinfo Tj_decompress_ptr, chan1 TTcl_Channel) { var src Tsrc_ptr _ = src src = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, uint32(4164)) libc.Xmemset(tls, src, 0, uint32(4164)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc = src (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Finit_source = __ccgo_fp(_dummy_source) (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Ffill_input_buffer = __ccgo_fp(_fill_input_buffer) (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fskip_input_data = __ccgo_fp(_skip_input_data) (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fresync_to_restart = (*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_resync_to_restartPtr /* use default method */ (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fterm_source = __ccgo_fp(_dummy_source) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, src+28, chan1) (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fbytes_in_buffer = uint32(0) /* forces fill_input_buffer on first read */ (*Tsource_mgr)(unsafe.Pointer(src)).Fpub.Fnext_input_byte = libc.UintptrFromInt32(0) /* until buffer loaded */ } /* * libjpeg destination manager for writing to base64-encoded strings * and Tcl_Channel's. */ func _my_jpeg_string_dest(tls *libc.TLS, cinfo Tj_compress_ptr) { var dest Tdest_ptr _ = dest if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest == libc.UintptrFromInt32(0) { /* first time for this JPEG object? */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, uint32(4156)) } libc.Xmemset(tls, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest, 0, uint32(4156)) dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest (*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Finit_destination = __ccgo_fp(_my_init_destination) (*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Fempty_output_buffer = __ccgo_fp(_my_empty_output_buffer) (*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Fterm_destination = __ccgo_fp(_my_term_destination) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, dest+20) } func _my_jpeg_channel_dest(tls *libc.TLS, cinfo Tj_compress_ptr, chan1 TTcl_Channel) { var dest Tdest_ptr _ = dest if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest == libc.UintptrFromInt32(0) { /* first time for this JPEG object? */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, uint32(4156)) } libc.Xmemset(tls, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest, 0, uint32(4156)) dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest (*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Finit_destination = __ccgo_fp(_my_init_destination) (*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Fempty_output_buffer = __ccgo_fp(_my_empty_output_buffer) (*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Fterm_destination = __ccgo_fp(_my_term_destination) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, dest+20, chan1) } func _my_init_destination(tls *libc.TLS, cinfo Tj_compress_ptr) { var dest Tdest_ptr _ = dest dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest (*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Fnext_output_byte = dest + 60 (*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Ffree_in_buffer = uint32(STRING_BUF_SIZE) } func _my_empty_output_buffer(tls *libc.TLS, cinfo Tj_compress_ptr) (r Tboolean) { var dest Tdest_ptr _ = dest dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, dest+20, dest+60, int32(STRING_BUF_SIZE)) != int32(STRING_BUF_SIZE) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_FILE_WRITE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Fnext_output_byte = dest + 60 (*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Ffree_in_buffer = uint32(STRING_BUF_SIZE) return int32(TRUE) } func _my_term_destination(tls *libc.TLS, cinfo Tj_compress_ptr) { var datacount int32 var dest Tdest_ptr _, _ = datacount, dest dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest datacount = int32(STRING_BUF_SIZE) - libc.Int32FromUint32((*Tdestination_mgr)(unsafe.Pointer(dest)).Fpub.Ffree_in_buffer) /* Write any data remaining in the buffer */ if datacount > 0 { if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, dest+20, dest+60, datacount) != datacount { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_FILE_WRITE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* Empty any partial-byte from the base64 encoder */ } /* * Error handler to replace (or extend, really) libjpeg's default handler */ func _my_error_exit(tls *libc.TLS, cinfo Tj_common_ptr) { var myerr uintptr _ = myerr myerr = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr /* Exit back to outer level */ tls.Longjmp(myerr+136, libc.Int32FromInt32(1)) } func _append_jpeg_message(tls *libc.TLS, interp uintptr, cinfo Tj_common_ptr) { bp := tls.Alloc(224) defer tls.Free(224) var _ /* buffer at bp+0 */ [200]uint8 (*(*func(*libc.TLS, Tj_common_ptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fformat_message})))(tls, cinfo, bp) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+208, bp, libc.UintptrFromInt32(0))) } func _my_output_message(tls *libc.TLS, cinfo Tj_common_ptr) { /* Override libjpeg's output_message to do nothing. * This ensures that warning messages will not appear on stderr, * even for a corrupted JPEG file. Too bad there's no way * to report a "warning" message to the calling Tcl script. */ } const CSTATE_RAW_OK = 102 const CSTATE_SCANNING = 101 const CSTATE_START = 100 const CSTATE_WRCOEFS = 103 const DEFAULT_MAX_MEM = 524288000 const DSTATE_BUFIMAGE = 207 const DSTATE_BUFPOST = 208 const DSTATE_INHEADER = 201 const DSTATE_PRELOAD = 203 const DSTATE_PRESCAN = 204 const DSTATE_RAW_OK = 206 const DSTATE_RDCOEFS = 209 const DSTATE_READY = 202 const DSTATE_SCANNING = 205 const DSTATE_START = 200 const DSTATE_STOPPING = 210 const FAST_FLOAT = "float" const INLINE = "__inline__" const JDCT_DEFAULT1 = "JDCT_ISLOW" const JDCT_FASTEST1 = "JDCT_IFAST" const JPEGTCLAPI1 = "MODULE_SCOPE" const JPEG_EOI1 = 0xD9 const MULTIPLIER = "int" const PACKAGE_NAME7 = "jpegtcl" const PACKAGE_STRING7 = "jpegtcl 9.6.0" const PACKAGE_TARNAME7 = "jpegtcl" const PACKAGE_VERSION1 = "9.6.0" const RANGE_BITS = 2 const RGB_BLUE = 2 const RGB_GREEN = 1 const RGB_PIXELSIZE = 3 const RGB_RED = 0 const FALSE1 = 0 const TRUE1 = 1 type TJ_BUF_MODE = int32 const JBUF_PASS_THRU = 0 const JBUF_SAVE_SOURCE = 1 const JBUF_CRANK_DEST = 2 const JBUF_SAVE_AND_PASS = 3 type Tjpeg_comp_master = struct { Fprepare_for_pass uintptr Fpass_startup uintptr Ffinish_pass uintptr Fcall_pass_startup Tboolean Fis_last_pass Tboolean } type Tjpeg_c_main_controller = struct { Fstart_pass uintptr Fprocess_data uintptr } type Tjpeg_c_prep_controller = struct { Fstart_pass uintptr Fpre_process_data uintptr } type Tjpeg_c_coef_controller = struct { Fstart_pass uintptr Fcompress_data uintptr } type Tjpeg_color_converter = struct { Fstart_pass uintptr Fcolor_convert uintptr } type Tjpeg_downsampler = struct { Fstart_pass uintptr Fdownsample uintptr Fneed_context_rows Tboolean } type Tforward_DCT_ptr = uintptr type Tjpeg_forward_dct = struct { Fstart_pass uintptr Fforward_DCT [10]Tforward_DCT_ptr } type Tjpeg_entropy_encoder = struct { Fstart_pass uintptr Fencode_mcu uintptr Ffinish_pass uintptr } type Tjpeg_marker_writer = struct { Fwrite_file_header uintptr Fwrite_frame_header uintptr Fwrite_scan_header uintptr Fwrite_file_trailer uintptr Fwrite_tables_only uintptr Fwrite_marker_header uintptr Fwrite_marker_byte uintptr } type Tjpeg_decomp_master = struct { Fprepare_for_output_pass uintptr Ffinish_output_pass uintptr Fis_dummy_pass Tboolean } type Tjpeg_input_controller = struct { Fconsume_input uintptr Freset_input_controller uintptr Fstart_input_pass uintptr Ffinish_input_pass uintptr Fhas_multiple_scans Tboolean Feoi_reached Tboolean } type Tjpeg_d_main_controller = struct { Fstart_pass uintptr Fprocess_data uintptr } type Tjpeg_d_coef_controller = struct { Fstart_input_pass uintptr Fconsume_data uintptr Fstart_output_pass uintptr Fdecompress_data uintptr Fcoef_arrays uintptr } type Tjpeg_d_post_controller = struct { Fstart_pass uintptr Fpost_process_data uintptr } type Tjpeg_marker_reader = struct { Freset_marker_reader uintptr Fread_markers uintptr Fread_restart_marker Tjpeg_marker_parser_method Fsaw_SOI Tboolean Fsaw_SOF Tboolean Fnext_restart_num int32 Fdiscarded_bytes uint32 } type Tjpeg_entropy_decoder = struct { Fstart_pass uintptr Fdecode_mcu uintptr Ffinish_pass uintptr } type Tinverse_DCT_method_ptr = uintptr type Tjpeg_inverse_dct = struct { Fstart_pass uintptr Finverse_DCT [10]Tinverse_DCT_method_ptr } type Tjpeg_upsampler = struct { Fstart_pass uintptr Fupsample uintptr Fneed_context_rows Tboolean } type Tjpeg_color_deconverter = struct { Fstart_pass uintptr Fcolor_convert uintptr } type Tjpeg_color_quantizer = struct { Fstart_pass uintptr Fcolor_quantize uintptr Ffinish_pass uintptr Fnew_color_map uintptr } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* * Initialization of a JPEG compression object. * The error manager must already be set up (in case memory manager fails). */ func Xjpeg_CreateCompress(tls *libc.TLS, cinfo Tj_compress_ptr, version int32, structsize Tsize_t) { var client_data, err uintptr var i int32 _, _, _ = client_data, err, i /* Guard against version mismatches between library and caller. */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem = libc.UintptrFromInt32(0) /* so jpeg_destroy knows mem mgr not called */ if version != int32(JPEG_LIB_VERSION) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_LIB_VERSION) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = int32(JPEG_LIB_VERSION) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = version (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if structsize != libc.Uint32FromInt64(440) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STRUCT_SIZE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint32(libc.Uint32FromInt64(440)) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = libc.Int32FromUint32(structsize) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* For debugging purposes, we zero the whole master structure. * But the application has already set the err pointer, and may have set * client_data, so we have to save and restore those fields. * Note: if application hasn't set client_data, tools like Purify may * complain here. */ err = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr client_data = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fclient_data /* ignore Purify complaint here */ libc.Xmemset(tls, cinfo, 0, libc.Uint32FromInt64(440)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr = err (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fclient_data = client_data (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fis_decompressor = int32(FALSE1) /* Initialize a memory manager instance for this object */ Xjinit_memory_mgr(tls, cinfo) /* Zero out pointers to permanent structures. */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress = libc.UintptrFromInt32(0) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest = libc.UintptrFromInt32(0) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info = libc.UintptrFromInt32(0) i = 0 for { if !(i < int32(NUM_QUANT_TBLS)) { break } *(*uintptr)(unsafe.Pointer(cinfo + 88 + uintptr(i)*4)) = libc.UintptrFromInt32(0) *(*int32)(unsafe.Pointer(cinfo + 104 + uintptr(i)*4)) = int32(100) goto _1 _1: ; i++ } i = 0 for { if !(i < int32(NUM_HUFF_TBLS)) { break } *(*uintptr)(unsafe.Pointer(cinfo + 120 + uintptr(i)*4)) = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(cinfo + 136 + uintptr(i)*4)) = libc.UintptrFromInt32(0) goto _2 _2: ; i++ } /* Must do it here for emit_dqt in case jpeg_write_tables is used */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(DCTSIZE) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscript_space = libc.UintptrFromInt32(0) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_gamma = float64(1) /* in case application forgets */ /* OK, I'm ready */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(CSTATE_START) } /* * Destruction of a JPEG compression object */ func Xjpeg_destroy_compress(tls *libc.TLS, cinfo Tj_compress_ptr) { Xjpeg_destroy(tls, cinfo) /* use common routine */ } /* * Abort processing of a JPEG compression operation, * but don't destroy the object itself. */ func Xjpeg_abort_compress(tls *libc.TLS, cinfo Tj_compress_ptr) { Xjpeg_abort(tls, cinfo) /* use common routine */ } /* * Forcibly suppress or un-suppress all quantization and Huffman tables. * Marks all currently defined tables as already written (if suppress) * or not written (if !suppress). This will control whether they get emitted * by a subsequent jpeg_start_compress call. * * This routine is exported for use by applications that want to produce * abbreviated JPEG datastreams. It logically belongs in jcparam.c, but * since it is called by jpeg_start_compress, we put it here --- otherwise * jcparam.o would be linked whether the application used it or not. */ func Xjpeg_suppress_tables(tls *libc.TLS, cinfo Tj_compress_ptr, suppress Tboolean) { var htbl, qtbl, v2, v4, v5 uintptr var i int32 _, _, _, _, _, _ = htbl, i, qtbl, v2, v4, v5 i = 0 for { if !(i < int32(NUM_QUANT_TBLS)) { break } v2 = *(*uintptr)(unsafe.Pointer(cinfo + 88 + uintptr(i)*4)) qtbl = v2 if v2 != libc.UintptrFromInt32(0) { (*TJQUANT_TBL)(unsafe.Pointer(qtbl)).Fsent_table = suppress } goto _1 _1: ; i++ } i = 0 for { if !(i < int32(NUM_HUFF_TBLS)) { break } v4 = *(*uintptr)(unsafe.Pointer(cinfo + 120 + uintptr(i)*4)) htbl = v4 if v4 != libc.UintptrFromInt32(0) { (*TJHUFF_TBL)(unsafe.Pointer(htbl)).Fsent_table = suppress } v5 = *(*uintptr)(unsafe.Pointer(cinfo + 136 + uintptr(i)*4)) htbl = v5 if v5 != libc.UintptrFromInt32(0) { (*TJHUFF_TBL)(unsafe.Pointer(htbl)).Fsent_table = suppress } goto _3 _3: ; i++ } } /* * Finish JPEG compression. * * If a multipass operating mode was selected, this may do a great deal of * work including most of the actual output. */ func Xjpeg_finish_compress(tls *libc.TLS, cinfo Tj_compress_ptr) { var iMCU_row TJDIMENSION _ = iMCU_row if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(CSTATE_SCANNING) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(CSTATE_RAW_OK) { /* Terminate first pass */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnext_scanline < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_TOO_LITTLE_DATA) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_comp_master)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Ffinish_pass})))(tls, cinfo) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_WRCOEFS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* Perform any remaining passes */ for !((*Tjpeg_comp_master)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fis_last_pass != 0) { (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_comp_master)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fprepare_for_pass})))(tls, cinfo) iMCU_row = uint32(0) for { if !(iMCU_row < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows) { break } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) { (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_counter = libc.Int32FromUint32(iMCU_row) (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_limit = libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fprogress_monitor})))(tls, cinfo) } /* We bypass the main controller and invoke coef controller directly; * all work is being done from the coefficient buffer. */ if !((*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPIMAGE) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_c_coef_controller)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fcompress_data})))(tls, cinfo, libc.UintptrFromInt32(0)) != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CANT_SUSPEND) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } goto _1 _1: ; iMCU_row++ } (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_comp_master)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Ffinish_pass})))(tls, cinfo) } /* Write EOI, do final cleanup */ (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_file_trailer})))(tls, cinfo) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fterm_destination})))(tls, cinfo) /* We can use jpeg_abort to release memory and reset global_state */ Xjpeg_abort(tls, cinfo) } /* * Write a special marker. * This is only recommended for writing COM or APPn markers. * Must be called after jpeg_start_compress() and before * first call to jpeg_write_scanlines() or jpeg_write_raw_data(). */ func Xjpeg_write_marker(tls *libc.TLS, cinfo Tj_compress_ptr, marker int32, dataptr uintptr, datalen uint32) { var write_marker_byte uintptr var v1 uint32 _, _ = write_marker_byte, v1 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnext_scanline != uint32(0) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_SCANNING) && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_RAW_OK) && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_WRCOEFS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*(*func(*libc.TLS, Tj_compress_ptr, int32, uint32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_marker_header})))(tls, cinfo, marker, datalen) write_marker_byte = (*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_marker_byte /* copy for speed */ for { v1 = datalen datalen-- if !(v1 != 0) { break } (*(*func(*libc.TLS, Tj_compress_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{write_marker_byte})))(tls, cinfo, libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(dataptr)))) dataptr++ } } /* Same, but piecemeal. */ func Xjpeg_write_m_header(tls *libc.TLS, cinfo Tj_compress_ptr, marker int32, datalen uint32) { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnext_scanline != uint32(0) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_SCANNING) && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_RAW_OK) && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_WRCOEFS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*(*func(*libc.TLS, Tj_compress_ptr, int32, uint32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_marker_header})))(tls, cinfo, marker, datalen) } func Xjpeg_write_m_byte(tls *libc.TLS, cinfo Tj_compress_ptr, val int32) { (*(*func(*libc.TLS, Tj_compress_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_marker_byte})))(tls, cinfo, val) } /* * Alternate compression function: just write an abbreviated table file. * Before calling this, all parameters and a data destination must be set up. * * To produce a pair of files containing abbreviated tables and abbreviated * image data, one would proceed as follows: * * initialize JPEG object * set JPEG parameters * set destination to table file * jpeg_write_tables(cinfo); * set destination to image file * jpeg_start_compress(cinfo, FALSE); * write data... * jpeg_finish_compress(cinfo); * * jpeg_write_tables has the side effect of marking all tables written * (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress * will not re-emit the tables unless it is passed write_all_tables=TRUE. */ func Xjpeg_write_tables(tls *libc.TLS, cinfo Tj_compress_ptr) { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_START) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* (Re)initialize error mgr and destination modules */ (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Freset_error_mgr})))(tls, cinfo) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Finit_destination})))(tls, cinfo) /* Initialize the marker writer ... bit of a crock to do it here. */ Xjinit_marker_writer(tls, cinfo) /* Write them tables! */ (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_tables_only})))(tls, cinfo) /* And clean up. */ (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fterm_destination})))(tls, cinfo) /* * In library releases up through v6a, we called jpeg_abort() here to free * any working memory allocated by the destination manager and marker * writer. Some applications had a problem with that: they allocated space * of their own from the library memory manager, and didn't want it to go * away during write_tables. So now we do nothing. This will cause a * memory leak if an app calls write_tables repeatedly without doing a full * compression cycle or otherwise resetting the JPEG object. However, that * seems less bad than unexpectedly freeing memory in the normal case. * An app that prefers the old behavior can call jpeg_abort for itself after * each call to jpeg_write_tables(). */ } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* * Compression initialization. * Before calling this, all parameters and a data destination must be set up. * * We require a write_all_tables parameter as a failsafe check when writing * multiple datastreams from the same compression object. Since prior runs * will have left all the tables marked sent_table=TRUE, a subsequent run * would emit an abbreviated stream (no tables) by default. This may be what * is wanted, but for safety's sake it should not be the default behavior: * programmers should have to make a deliberate choice to emit abbreviated * images. Therefore the documentation and examples should encourage people * to pass write_all_tables=TRUE; then it will take active thought to do the * wrong thing. */ func Xjpeg_start_compress(tls *libc.TLS, cinfo Tj_compress_ptr, write_all_tables Tboolean) { var v1 int32 _ = v1 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_START) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if write_all_tables != 0 { Xjpeg_suppress_tables(tls, cinfo, int32(FALSE1)) } /* mark all tables to be written */ /* (Re)initialize error mgr and destination modules */ (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Freset_error_mgr})))(tls, cinfo) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Finit_destination})))(tls, cinfo) /* Perform master selection of active modules */ Xjinit_compress_master(tls, cinfo) /* Set up for the first pass */ (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_comp_master)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fprepare_for_pass})))(tls, cinfo) /* Ready for application to drive first pass through jpeg_write_scanlines * or jpeg_write_raw_data. */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnext_scanline = uint32(0) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fraw_data_in != 0 { v1 = int32(CSTATE_RAW_OK) } else { v1 = int32(CSTATE_SCANNING) } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = v1 } /* * Write some scanlines of data to the JPEG compressor. * * The return value will be the number of lines actually written. * This should be less than the supplied num_lines only in case that * the data destination module has requested suspension of the compressor, * or if more than image_height scanlines are passed in. * * Note: we warn about excess calls to jpeg_write_scanlines() since * this likely signals an application programmer error. However, * excess scanlines passed in the last valid call are *silently* ignored, * so that the application need not adjust num_lines for end-of-image * when using a multiple-scanline buffer. */ func Xjpeg_write_scanlines(tls *libc.TLS, cinfo Tj_compress_ptr, scanlines TJSAMPARRAY, num_lines TJDIMENSION) (r TJDIMENSION) { bp := tls.Alloc(16) defer tls.Free(16) var rows_left TJDIMENSION var _ /* row_ctr at bp+0 */ TJDIMENSION _ = rows_left if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_SCANNING) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnext_scanline >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_TOO_MUCH_DATA) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) } /* Call progress monitor hook if present */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) { (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_counter = libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnext_scanline) (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_limit = libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fprogress_monitor})))(tls, cinfo) } /* Give master control module another chance if this is first call to * jpeg_write_scanlines. This lets output of the frame/scan headers be * delayed so that application can write COM, etc, markers between * jpeg_start_compress and jpeg_write_scanlines. */ if (*Tjpeg_comp_master)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fcall_pass_startup != 0 { (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_comp_master)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fpass_startup})))(tls, cinfo) } /* Ignore any extra scanlines at bottom of image. */ rows_left = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height - (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnext_scanline if num_lines > rows_left { num_lines = rows_left } *(*TJDIMENSION)(unsafe.Pointer(bp)) = uint32(0) (*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPARRAY, uintptr, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_c_main_controller)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmain1)).Fprocess_data})))(tls, cinfo, scanlines, bp, num_lines) *(*TJDIMENSION)(unsafe.Pointer(cinfo + 264)) += *(*TJDIMENSION)(unsafe.Pointer(bp)) return *(*TJDIMENSION)(unsafe.Pointer(bp)) } /* * Alternate entry point to write raw data. * Processes exactly one iMCU row per call, unless suspended. */ func Xjpeg_write_raw_data(tls *libc.TLS, cinfo Tj_compress_ptr, data TJSAMPIMAGE, num_lines TJDIMENSION) (r TJDIMENSION) { var lines_per_iMCU_row TJDIMENSION _ = lines_per_iMCU_row if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_RAW_OK) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnext_scanline >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_TOO_MUCH_DATA) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) return uint32(0) } /* Call progress monitor hook if present */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) { (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_counter = libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnext_scanline) (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_limit = libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fprogress_monitor})))(tls, cinfo) } /* Give master control module another chance if this is first call to * jpeg_write_raw_data. This lets output of the frame/scan headers be * delayed so that application can write COM, etc, markers between * jpeg_start_compress and jpeg_write_raw_data. */ if (*Tjpeg_comp_master)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fcall_pass_startup != 0 { (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_comp_master)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fpass_startup})))(tls, cinfo) } /* Verify that at least one iMCU row has been passed. */ lines_per_iMCU_row = libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor * (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size) if num_lines < lines_per_iMCU_row { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BUFFER_SIZE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Directly compress the row. */ if !((*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPIMAGE) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_c_coef_controller)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fcompress_data})))(tls, cinfo, data) != 0) { /* If compressor did not consume the whole row, suspend processing. */ return uint32(0) } /* OK, we processed one iMCU row. */ *(*TJDIMENSION)(unsafe.Pointer(cinfo + 264)) += lines_per_iMCU_row return lines_per_iMCU_row } const AC_STAT_BINS = 256 const DC_STAT_BINS = 64 const JPEG_RST01 = 208 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Expanded entropy encoder object for arithmetic encoding. */ type Tarith_entropy_encoder = struct { Fpub Tjpeg_entropy_encoder Fc TINT32 Fa TINT32 Fsc TINT32 Fzc TINT32 Fct int32 Fbuffer int32 Flast_dc_val [4]int32 Fdc_context [4]int32 Frestarts_to_go uint32 Fnext_restart_num int32 Fdc_stats [16]uintptr Fac_stats [16]uintptr Ffixed_bin [4]uint8 } type Tarith_entropy_ptr = uintptr /* The following two definitions specify the allocation chunk size * for the statistics area. * According to sections F.1.4.4.1.3 and F.1.4.4.2, we need at least * 49 statistics bins for DC, and 245 statistics bins for AC coding. * * We use a compact representation with 1 byte per statistics bin, * thus the numbers directly represent byte sizes. * This 1 byte per statistics bin contains the meaning of the MPS * (more probable symbol) in the highest bit (mask 0x80), and the * index into the probability estimation state machine table * in the lower bits (mask 0x7F). */ /* NOTE: Uncomment the following #define if you want to use the * given formula for calculating the AC conditioning parameter Kx * for spectral selection progressive coding in section G.1.3.2 * of the spec (Kx = Kmin + SRL (8 + Se - Kmin) 4). * Although the spec and P&M authors claim that this "has proven * to give good results for 8 bit precision samples", I'm not * convinced yet that this is really beneficial. * Early tests gave only very marginal compression enhancements * (a few - around 5 or so - bytes even for very large files), * which would turn out rather negative if we'd suppress the * DAC (Define Arithmetic Conditioning) marker segments for * the default parameters in the future. * Note that currently the marker writing module emits 12-byte * DAC segments for a full-component scan in a color image. * This is not worth worrying about IMHO. However, since the * spec defines the default values to be used if the tables * are omitted (unlike Huffman tables, which are required * anyway), one might optimize this behaviour in the future, * and then it would be disadvantageous to use custom tables if * they don't provide sufficient gain to exceed the DAC size. * * On the other hand, I'd consider it as a reasonable result * that the conditioning has no significant influence on the * compression performance. This means that the basic * statistical model is already rather stable. * * Thus, at the moment, we use the default conditioning values * anyway, and do not use the custom formula. * #define CALCULATE_SPECTRAL_CONDITIONING */ /* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32. * We assume that int right shift is unsigned if INT32 right shift is, * which should be safe. */ func _emit_byte(tls *libc.TLS, val int32, cinfo Tj_compress_ptr) { /* Write next output byte; we do not support suspension in this module. */ var dest, v1, v2, v4 uintptr var v3 Tsize_t _, _, _, _, _ = dest, v1, v2, v3, v4 dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest v2 = dest v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ *(*TJOCTET)(unsafe.Pointer(v1)) = libc.Uint8FromInt32(val) v4 = dest + 4 *(*Tsize_t)(unsafe.Pointer(v4))-- v3 = *(*Tsize_t)(unsafe.Pointer(v4)) if v3 == uint32(0) { if !((*(*func(*libc.TLS, Tj_compress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_destination_mgr)(unsafe.Pointer(dest)).Fempty_output_buffer})))(tls, cinfo) != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CANT_SUSPEND) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } } /* * Finish up at the end of an arithmetic-compressed scan. */ func _finish_pass(tls *libc.TLS, cinfo Tj_compress_ptr) { var e Tarith_entropy_ptr var temp, v1, v11, v14, v2, v5, v8 TINT32 var v12, v15, v3, v6, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _ = e, temp, v1, v11, v12, v14, v15, v2, v3, v5, v6, v8, v9 e = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Section D.1.8: Termination of encoding */ /* Find the e->c in the coding interval with the largest * number of trailing zero bits */ v1 = libc.Int32FromUint32(libc.Uint32FromInt32((*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fa-libc.Int32FromInt32(1)+(*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc) & libc.Uint32FromUint32(0xFFFF0000)) temp = v1 if v1 < (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc { (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc = temp + int32(0x8000) } else { (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc = temp } /* Send remaining bytes to output */ *(*TINT32)(unsafe.Pointer(e + 12)) <<= (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fct if libc.Uint32FromInt32((*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc)&uint32(0xF8000000) != 0 { /* One final overflow has to be handled */ if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer >= 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fzc != 0 { for { _emit_byte(tls, 0x00, cinfo) goto _4 _4: ; v3 = e + 24 *(*TINT32)(unsafe.Pointer(v3))-- v2 = *(*TINT32)(unsafe.Pointer(v3)) if !(v2 != 0) { break } } } _emit_byte(tls, (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer+int32(1), cinfo) if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer+int32(1) == int32(0xFF) { _emit_byte(tls, 0x00, cinfo) } } *(*TINT32)(unsafe.Pointer(e + 24)) += (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fsc /* carry-over converts stacked 0xFF bytes to 0x00 */ (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fsc = 0 } else { if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer == 0 { (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fzc++ } else { if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer >= 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fzc != 0 { for { _emit_byte(tls, 0x00, cinfo) goto _7 _7: ; v6 = e + 24 *(*TINT32)(unsafe.Pointer(v6))-- v5 = *(*TINT32)(unsafe.Pointer(v6)) if !(v5 != 0) { break } } } _emit_byte(tls, (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer, cinfo) } } if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fsc != 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fzc != 0 { for { _emit_byte(tls, 0x00, cinfo) goto _10 _10: ; v9 = e + 24 *(*TINT32)(unsafe.Pointer(v9))-- v8 = *(*TINT32)(unsafe.Pointer(v9)) if !(v8 != 0) { break } } } for { _emit_byte(tls, int32(0xFF), cinfo) _emit_byte(tls, 0x00, cinfo) goto _13 _13: ; v12 = e + 20 *(*TINT32)(unsafe.Pointer(v12))-- v11 = *(*TINT32)(unsafe.Pointer(v12)) if !(v11 != 0) { break } } } } /* Output final bytes only if they are not 0x00 */ if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc&int32(0x7FFF800) != 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fzc != 0 { /* output final pending zero bytes */ for { _emit_byte(tls, 0x00, cinfo) goto _16 _16: ; v15 = e + 24 *(*TINT32)(unsafe.Pointer(v15))-- v14 = *(*TINT32)(unsafe.Pointer(v15)) if !(v14 != 0) { break } } } _emit_byte(tls, (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc>>libc.Int32FromInt32(19)&libc.Int32FromInt32(0xFF), cinfo) if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc>>libc.Int32FromInt32(19)&int32(0xFF) == int32(0xFF) { _emit_byte(tls, 0x00, cinfo) } if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc&int32(0x7F800) != 0 { _emit_byte(tls, (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc>>libc.Int32FromInt32(11)&libc.Int32FromInt32(0xFF), cinfo) if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc>>libc.Int32FromInt32(11)&int32(0xFF) == int32(0xFF) { _emit_byte(tls, 0x00, cinfo) } } } } /* * The core arithmetic encoding routine (common in JPEG and JBIG). * This needs to go as fast as possible. * Machine-dependent optimization facilities * are not utilized in this portable implementation. * However, this code should be fairly efficient and * may be a good base for further optimizations anyway. * * Parameter 'val' to be encoded may be 0 or 1 (binary decision). * * Note: I've added full "Pacman" termination support to the * byte output routines, which is equivalent to the optional * Discard_final_zeros procedure (Figure D.15) in the spec. * Thus, we always produce the shortest possible output * stream compliant to the spec (no trailing zero bytes, * except for FF stuffing). * * I've also introduced a new scheme for accessing * the probability estimation state machine table, * derived from Markus Kuhn's JBIG implementation. */ func _arith_encode(tls *libc.TLS, cinfo Tj_compress_ptr, st uintptr, val int32) { var e Tarith_entropy_ptr var nl, nm uint8 var qe, temp, v12, v3, v6, v9 TINT32 var sv, v1 int32 var v10, v13, v2, v4, v7 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = e, nl, nm, qe, sv, temp, v1, v10, v12, v13, v2, v3, v4, v6, v7, v9 e = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Fetch values from our compact representation of Table D.3(D.2): * Qe values and probability estimation state machine */ sv = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(st))) qe = Xjpeg_aritab[sv&int32(0x7F)] /* => Qe_Value */ nl = libc.Uint8FromInt32(qe & int32(0xFF)) qe >>= int32(8) /* Next_Index_LPS + Switch_MPS */ nm = libc.Uint8FromInt32(qe & int32(0xFF)) qe >>= int32(8) /* Next_Index_MPS */ /* Encode & estimation procedures per sections D.1.4 & D.1.5 */ *(*TINT32)(unsafe.Pointer(e + 16)) -= qe if val != sv>>int32(7) { /* Encode the less probable symbol */ if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fa >= qe { /* If the interval size (qe) for the less probable symbol (LPS) * is larger than the interval size for the MPS, then exchange * the two symbols for coding efficiency, otherwise code the LPS * as usual: */ *(*TINT32)(unsafe.Pointer(e + 12)) += (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fa (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fa = qe } *(*uint8)(unsafe.Pointer(st)) = libc.Uint8FromInt32(sv&int32(0x80) ^ libc.Int32FromUint8(nl)) /* Estimate_after_LPS */ } else { /* Encode the more probable symbol */ if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fa >= int32(0x8000) { return } /* A >= 0x8000 -> ready, no renormalization required */ if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fa < qe { /* If the interval size (qe) for the less probable symbol (LPS) * is larger than the interval size for the MPS, then exchange * the two symbols for coding efficiency: */ *(*TINT32)(unsafe.Pointer(e + 12)) += (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fa (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fa = qe } *(*uint8)(unsafe.Pointer(st)) = libc.Uint8FromInt32(sv&int32(0x80) ^ libc.Int32FromUint8(nm)) /* Estimate_after_MPS */ } /* Renormalization & data output per section D.1.6 */ for cond := true; cond; cond = (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fa < int32(0x8000) { *(*TINT32)(unsafe.Pointer(e + 16)) <<= int32(1) *(*TINT32)(unsafe.Pointer(e + 12)) <<= int32(1) v2 = e + 28 *(*int32)(unsafe.Pointer(v2))-- v1 = *(*int32)(unsafe.Pointer(v2)) if v1 == 0 { /* Another byte is ready for output */ temp = (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fc >> int32(19) if temp > int32(0xFF) { /* Handle overflow over all stacked 0xFF bytes */ if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer >= 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fzc != 0 { for { _emit_byte(tls, 0x00, cinfo) goto _5 _5: ; v4 = e + 24 *(*TINT32)(unsafe.Pointer(v4))-- v3 = *(*TINT32)(unsafe.Pointer(v4)) if !(v3 != 0) { break } } } _emit_byte(tls, (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer+int32(1), cinfo) if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer+int32(1) == int32(0xFF) { _emit_byte(tls, 0x00, cinfo) } } *(*TINT32)(unsafe.Pointer(e + 24)) += (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fsc /* carry-over converts stacked 0xFF bytes to 0x00 */ (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fsc = 0 /* Note: The 3 spacer bits in the C register guarantee * that the new buffer byte can't be 0xFF here * (see page 160 in the P&M JPEG book). */ /* New output byte, might overflow later */ (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer = temp & libc.Int32FromInt32(0xFF) } else { if temp == int32(0xFF) { (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fsc++ /* stack 0xFF byte (which might overflow later) */ } else { /* Output all stacked 0xFF bytes, they will not overflow any more */ if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer == 0 { (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fzc++ } else { if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer >= 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fzc != 0 { for { _emit_byte(tls, 0x00, cinfo) goto _8 _8: ; v7 = e + 24 *(*TINT32)(unsafe.Pointer(v7))-- v6 = *(*TINT32)(unsafe.Pointer(v7)) if !(v6 != 0) { break } } } _emit_byte(tls, (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer, cinfo) } } if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fsc != 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fzc != 0 { for { _emit_byte(tls, 0x00, cinfo) goto _11 _11: ; v10 = e + 24 *(*TINT32)(unsafe.Pointer(v10))-- v9 = *(*TINT32)(unsafe.Pointer(v10)) if !(v9 != 0) { break } } } for { _emit_byte(tls, int32(0xFF), cinfo) _emit_byte(tls, 0x00, cinfo) goto _14 _14: ; v13 = e + 20 *(*TINT32)(unsafe.Pointer(v13))-- v12 = *(*TINT32)(unsafe.Pointer(v13)) if !(v12 != 0) { break } } } /* New output byte (can still overflow) */ (*Tarith_entropy_encoder)(unsafe.Pointer(e)).Fbuffer = temp & libc.Int32FromInt32(0xFF) } } *(*TINT32)(unsafe.Pointer(e + 12)) &= int32(0x7FFFF) *(*int32)(unsafe.Pointer(e + 28)) += int32(8) } } } /* * Emit a restart marker & resynchronize predictions. */ func _emit_restart(tls *libc.TLS, cinfo Tj_compress_ptr, restart_num int32) { var ci int32 var compptr uintptr var entropy Tarith_entropy_ptr _, _, _ = ci, compptr, entropy entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy _finish_pass(tls, cinfo) _emit_byte(tls, int32(0xFF), cinfo) _emit_byte(tls, int32(JPEG_RST01)+restart_num, cinfo) /* Re-initialize statistics areas */ ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) /* DC needs no table for refinement scan */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs == 0 && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no)*4)), 0, libc.Uint32FromInt32(libc.Int32FromInt32(DC_STAT_BINS))) /* Reset DC predictions to 0 */ *(*int32)(unsafe.Pointer(entropy + 36 + uintptr(ci)*4)) = 0 *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) = 0 } /* AC needs no table when not present */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe != 0 { libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no)*4)), 0, libc.Uint32FromInt32(libc.Int32FromInt32(AC_STAT_BINS))) } goto _1 _1: ; ci++ } /* Reset arithmetic encoding variables */ (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fc = 0 (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fa = int32(0x10000) (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fsc = 0 (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fzc = 0 (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fct = int32(11) (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fbuffer = -int32(1) /* empty */ } /* * MCU encoding for DC initial scan (either spectral selection, * or first pass of successive approximation). */ func _encode_mcu_DC_first(tls *libc.TLS, cinfo Tj_compress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var blkn, ci, m, tbl, v, v2, v21, v3 int32 var entropy Tarith_entropy_ptr var st uintptr _, _, _, _, _, _, _, _, _, _ = blkn, ci, entropy, m, st, tbl, v, v2, v21, v3 entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Emit restart marker if needed */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _emit_restart(tls, cinfo, (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num) (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num++ *(*int32)(unsafe.Pointer(entropy + 72)) &= int32(7) } (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } /* Encode the MCU data blocks */ blkn = 0 for { if !(blkn < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } ci = *(*int32)(unsafe.Pointer(cinfo + 324 + uintptr(blkn)*4)) tbl = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)))).Fdc_tbl_no /* Compute the DC value after the required point transform by Al. * This is simply an arithmetic right shift. */ m = int32(*(*TJCOEF)(unsafe.Pointer(*(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4))))) >> (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl /* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */ /* Table F.4: Point to statistics bin S0 for DC coefficient coding */ st = *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4)) + uintptr(*(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4))) /* Figure F.4: Encode_DC_DIFF */ v21 = m - *(*int32)(unsafe.Pointer(entropy + 36 + uintptr(ci)*4)) v = v21 if v21 == 0 { _arith_encode(tls, cinfo, st, 0) *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) = 0 /* zero diff category */ } else { *(*int32)(unsafe.Pointer(entropy + 36 + uintptr(ci)*4)) = m _arith_encode(tls, cinfo, st, int32(1)) /* Figure F.6: Encoding nonzero value v */ /* Figure F.7: Encoding the sign of v */ if v > 0 { _arith_encode(tls, cinfo, st+uintptr(1), 0) /* Table F.4: SS = S0 + 1 */ st += uintptr(2) /* Table F.4: SP = S0 + 2 */ *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) = int32(4) /* small positive diff category */ } else { v = -v _arith_encode(tls, cinfo, st+uintptr(1), int32(1)) /* Table F.4: SS = S0 + 1 */ st += uintptr(3) /* Table F.4: SN = S0 + 3 */ *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) = int32(8) /* small negative diff category */ } /* Figure F.8: Encoding the magnitude category of v */ m = 0 v -= int32(1) if v != 0 { _arith_encode(tls, cinfo, st, int32(1)) m = int32(1) v2 = v st = *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4)) + uintptr(20) /* Table F.4: X1 = 20 */ for { v2 >>= int32(1) if !(v2 != 0) { break } _arith_encode(tls, cinfo, st, int32(1)) m <<= int32(1) st += uintptr(1) } } _arith_encode(tls, cinfo, st, 0) /* Section F.1.4.4.1.2: Establish dc_context conditioning category */ if m < libc.Int32FromInt32(1)<<*(*TUINT8)(unsafe.Pointer(cinfo + 152 + uintptr(tbl)))>>libc.Int32FromInt32(1) { *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) = 0 } else { if m > libc.Int32FromInt32(1)<<*(*TUINT8)(unsafe.Pointer(cinfo + 168 + uintptr(tbl)))>>libc.Int32FromInt32(1) { *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) += int32(8) } } /* large diff category */ /* Figure F.9: Encoding the magnitude bit pattern of v */ st += uintptr(14) for { m >>= int32(1) if !(m != 0) { break } if m&v != 0 { v3 = int32(1) } else { v3 = 0 } _arith_encode(tls, cinfo, st, v3) } } goto _1 _1: ; blkn++ } return int32(TRUE1) } /* * MCU encoding for AC initial scan (either spectral selection, * or first pass of successive approximation). */ func _encode_mcu_AC_first(tls *libc.TLS, cinfo Tj_compress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var block TJBLOCKROW var entropy Tarith_entropy_ptr var k, ke, m, tbl, v, v2, v1, v3, v6, v7, v8, v9 int32 var natural_order, st uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = block, entropy, k, ke, m, natural_order, st, tbl, v, v2, v1, v3, v6, v7, v8, v9 entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Emit restart marker if needed */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _emit_restart(tls, cinfo, (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num) (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num++ *(*int32)(unsafe.Pointer(entropy + 72)) &= int32(7) } (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } natural_order = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order /* Encode the MCU data block */ block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data)) tbl = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 296)))).Fac_tbl_no /* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */ /* Establish EOB (end-of-block) index */ ke = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe for { /* We must apply the point transform by Al. For AC coefficients this * is an integer division with rounding towards 0. To do this portably * in C, we shift after obtaining the absolute value. */ v3 = int32(*(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(ke)*4)))*2))) v = v3 if v3 >= 0 { v >>= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl if v != 0 { break } } else { v = -v v >>= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl if v != 0 { break } } goto _2 _2: ; ke-- v1 = ke if !(v1 != 0) { break } } /* Figure F.5: Encode_AC_Coefficients */ k = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs - int32(1) for { if !(k < ke) { break } st = *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)) + uintptr(int32(3)*k) _arith_encode(tls, cinfo, st, 0) /* EOB decision */ for { k++ v7 = k v6 = int32(*(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(v7)*4)))*2))) v = v6 if v6 >= 0 { v >>= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl if v != 0 { _arith_encode(tls, cinfo, st+uintptr(1), int32(1)) _arith_encode(tls, cinfo, entropy+204, 0) break } } else { v = -v v >>= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl if v != 0 { _arith_encode(tls, cinfo, st+uintptr(1), int32(1)) _arith_encode(tls, cinfo, entropy+204, int32(1)) break } } _arith_encode(tls, cinfo, st+uintptr(1), 0) st += uintptr(3) goto _5 _5: } st += uintptr(2) /* Figure F.8: Encoding the magnitude category of v */ m = 0 v -= int32(1) if v != 0 { _arith_encode(tls, cinfo, st, int32(1)) m = int32(1) v2 = v v2 >>= int32(1) if v2 != 0 { _arith_encode(tls, cinfo, st, int32(1)) m <<= int32(1) if k <= libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 184 + uintptr(tbl)))) { v8 = int32(189) } else { v8 = int32(217) } st = *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)) + uintptr(v8) for { v2 >>= int32(1) if !(v2 != 0) { break } _arith_encode(tls, cinfo, st, int32(1)) m <<= int32(1) st += uintptr(1) } } } _arith_encode(tls, cinfo, st, 0) /* Figure F.9: Encoding the magnitude bit pattern of v */ st += uintptr(14) for { m >>= int32(1) if !(m != 0) { break } if m&v != 0 { v9 = int32(1) } else { v9 = 0 } _arith_encode(tls, cinfo, st, v9) } goto _4 _4: } /* Encode EOB decision only if k < cinfo->Se */ if k < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe { st = *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)) + uintptr(int32(3)*k) _arith_encode(tls, cinfo, st, int32(1)) } return int32(TRUE1) } /* * MCU encoding for DC successive approximation refinement scan. * Note: we assume such scans can be multi-component, * although the spec is not very clear on the point. */ func _encode_mcu_DC_refine(tls *libc.TLS, cinfo Tj_compress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var Al, blkn int32 var entropy Tarith_entropy_ptr var st uintptr _, _, _, _ = Al, blkn, entropy, st entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Emit restart marker if needed */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _emit_restart(tls, cinfo, (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num) (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num++ *(*int32)(unsafe.Pointer(entropy + 72)) &= int32(7) } (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } st = entropy + 204 /* use fixed probability estimation */ Al = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl /* Encode the MCU data blocks */ blkn = 0 for { if !(blkn < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } /* We simply emit the Al'th bit of the DC coefficient value. */ _arith_encode(tls, cinfo, st, int32(*(*TJCOEF)(unsafe.Pointer(*(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)))))>>Al&int32(1)) goto _1 _1: ; blkn++ } return int32(TRUE1) } /* * MCU encoding for AC successive approximation refinement scan. */ func _encode_mcu_AC_refine(tls *libc.TLS, cinfo Tj_compress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var block TJBLOCKROW var entropy Tarith_entropy_ptr var k, ke, kex, tbl, v, v1, v3, v5, v8, v9 int32 var natural_order, st uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = block, entropy, k, ke, kex, natural_order, st, tbl, v, v1, v3, v5, v8, v9 entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Emit restart marker if needed */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _emit_restart(tls, cinfo, (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num) (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num++ *(*int32)(unsafe.Pointer(entropy + 72)) &= int32(7) } (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } natural_order = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order /* Encode the MCU data block */ block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data)) tbl = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 296)))).Fac_tbl_no /* Section G.1.3.3: Encoding of AC coefficients */ /* Establish EOB (end-of-block) index */ ke = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe for { /* We must apply the point transform by Al. For AC coefficients this * is an integer division with rounding towards 0. To do this portably * in C, we shift after obtaining the absolute value. */ v3 = int32(*(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(ke)*4)))*2))) v = v3 if v3 >= 0 { v >>= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl if v != 0 { break } } else { v = -v v >>= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl if v != 0 { break } } goto _2 _2: ; ke-- v1 = ke if !(v1 != 0) { break } } /* Establish EOBx (previous stage end-of-block) index */ kex = ke for { if !(kex > 0) { break } v5 = int32(*(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(kex)*4)))*2))) v = v5 if v5 >= 0 { v >>= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh if v != 0 { break } } else { v = -v v >>= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh if v != 0 { break } } goto _4 _4: ; kex-- } /* Figure G.10: Encode_AC_Coefficients_SA */ k = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs - int32(1) for { if !(k < ke) { break } st = *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)) + uintptr(int32(3)*k) if k >= kex { _arith_encode(tls, cinfo, st, 0) } /* EOB decision */ for { k++ v9 = k v8 = int32(*(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(v9)*4)))*2))) v = v8 if v8 >= 0 { v >>= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl if v != 0 { if v>>int32(1) != 0 { /* previously nonzero coef */ _arith_encode(tls, cinfo, st+uintptr(2), v&int32(1)) } else { /* newly nonzero coef */ _arith_encode(tls, cinfo, st+uintptr(1), int32(1)) _arith_encode(tls, cinfo, entropy+204, 0) } break } } else { v = -v v >>= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl if v != 0 { if v>>int32(1) != 0 { /* previously nonzero coef */ _arith_encode(tls, cinfo, st+uintptr(2), v&int32(1)) } else { /* newly nonzero coef */ _arith_encode(tls, cinfo, st+uintptr(1), int32(1)) _arith_encode(tls, cinfo, entropy+204, int32(1)) } break } } _arith_encode(tls, cinfo, st+uintptr(1), 0) st += uintptr(3) goto _7 _7: } goto _6 _6: } /* Encode EOB decision only if k < cinfo->Se */ if k < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe { st = *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)) + uintptr(int32(3)*k) _arith_encode(tls, cinfo, st, int32(1)) } return int32(TRUE1) } /* * Encode and output one MCU's worth of arithmetic-compressed coefficients. */ func _encode_mcu(tls *libc.TLS, cinfo Tj_compress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var blkn, ci, k, ke, m, tbl, v, v2, v10, v11, v21, v3, v4, v5, v8, v9 int32 var block TJBLOCKROW var compptr, natural_order, st uintptr var entropy Tarith_entropy_ptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = blkn, block, ci, compptr, entropy, k, ke, m, natural_order, st, tbl, v, v2, v10, v11, v21, v3, v4, v5, v8, v9 entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Emit restart marker if needed */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _emit_restart(tls, cinfo, (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num) (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num++ *(*int32)(unsafe.Pointer(entropy + 72)) &= int32(7) } (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } natural_order = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order /* Encode the MCU data blocks */ blkn = 0 for { if !(blkn < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)) ci = *(*int32)(unsafe.Pointer(cinfo + 324 + uintptr(blkn)*4)) compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) /* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */ tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no /* Table F.4: Point to statistics bin S0 for DC coefficient coding */ st = *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4)) + uintptr(*(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4))) /* Figure F.4: Encode_DC_DIFF */ v21 = int32(*(*TJCOEF)(unsafe.Pointer(block))) - *(*int32)(unsafe.Pointer(entropy + 36 + uintptr(ci)*4)) v = v21 if v21 == 0 { _arith_encode(tls, cinfo, st, 0) *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) = 0 /* zero diff category */ } else { *(*int32)(unsafe.Pointer(entropy + 36 + uintptr(ci)*4)) = int32(*(*TJCOEF)(unsafe.Pointer(block))) _arith_encode(tls, cinfo, st, int32(1)) /* Figure F.6: Encoding nonzero value v */ /* Figure F.7: Encoding the sign of v */ if v > 0 { _arith_encode(tls, cinfo, st+uintptr(1), 0) /* Table F.4: SS = S0 + 1 */ st += uintptr(2) /* Table F.4: SP = S0 + 2 */ *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) = int32(4) /* small positive diff category */ } else { v = -v _arith_encode(tls, cinfo, st+uintptr(1), int32(1)) /* Table F.4: SS = S0 + 1 */ st += uintptr(3) /* Table F.4: SN = S0 + 3 */ *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) = int32(8) /* small negative diff category */ } /* Figure F.8: Encoding the magnitude category of v */ m = 0 v -= int32(1) if v != 0 { _arith_encode(tls, cinfo, st, int32(1)) m = int32(1) v2 = v st = *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4)) + uintptr(20) /* Table F.4: X1 = 20 */ for { v2 >>= int32(1) if !(v2 != 0) { break } _arith_encode(tls, cinfo, st, int32(1)) m <<= int32(1) st += uintptr(1) } } _arith_encode(tls, cinfo, st, 0) /* Section F.1.4.4.1.2: Establish dc_context conditioning category */ if m < libc.Int32FromInt32(1)<<*(*TUINT8)(unsafe.Pointer(cinfo + 152 + uintptr(tbl)))>>libc.Int32FromInt32(1) { *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) = 0 } else { if m > libc.Int32FromInt32(1)<<*(*TUINT8)(unsafe.Pointer(cinfo + 168 + uintptr(tbl)))>>libc.Int32FromInt32(1) { *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) += int32(8) } } /* large diff category */ /* Figure F.9: Encoding the magnitude bit pattern of v */ st += uintptr(14) for { m >>= int32(1) if !(m != 0) { break } if m&v != 0 { v3 = int32(1) } else { v3 = 0 } _arith_encode(tls, cinfo, st, v3) } } /* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */ v4 = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se ke = v4 if v4 == 0 { goto _1 } tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no /* Establish EOB (end-of-block) index */ for { if *(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(ke)*4)))*2)) != 0 { break } goto _6 _6: ; ke-- v5 = ke if !(v5 != 0) { break } } /* Figure F.5: Encode_AC_Coefficients */ k = 0 for { if !(k < ke) { break } st = *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)) + uintptr(int32(3)*k) _arith_encode(tls, cinfo, st, 0) /* EOB decision */ for { k++ v9 = k v8 = int32(*(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(v9)*4)))*2))) v = v8 if !(v8 == 0) { break } _arith_encode(tls, cinfo, st+uintptr(1), 0) st += uintptr(3) } _arith_encode(tls, cinfo, st+uintptr(1), int32(1)) /* Figure F.6: Encoding nonzero value v */ /* Figure F.7: Encoding the sign of v */ if v > 0 { _arith_encode(tls, cinfo, entropy+204, 0) } else { v = -v _arith_encode(tls, cinfo, entropy+204, int32(1)) } st += uintptr(2) /* Figure F.8: Encoding the magnitude category of v */ m = 0 v -= int32(1) if v != 0 { _arith_encode(tls, cinfo, st, int32(1)) m = int32(1) v2 = v v2 >>= int32(1) if v2 != 0 { _arith_encode(tls, cinfo, st, int32(1)) m <<= int32(1) if k <= libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 184 + uintptr(tbl)))) { v10 = int32(189) } else { v10 = int32(217) } st = *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)) + uintptr(v10) for { v2 >>= int32(1) if !(v2 != 0) { break } _arith_encode(tls, cinfo, st, int32(1)) m <<= int32(1) st += uintptr(1) } } } _arith_encode(tls, cinfo, st, 0) /* Figure F.9: Encoding the magnitude bit pattern of v */ st += uintptr(14) for { m >>= int32(1) if !(m != 0) { break } if m&v != 0 { v11 = int32(1) } else { v11 = 0 } _arith_encode(tls, cinfo, st, v11) } goto _7 _7: } /* Encode EOB decision only if k < cinfo->lim_Se */ if k < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se { st = *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)) + uintptr(int32(3)*k) _arith_encode(tls, cinfo, st, int32(1)) } goto _1 _1: ; blkn++ } return int32(TRUE1) } /* * Initialize for an arithmetic-compressed scan. */ func _start_pass(tls *libc.TLS, cinfo Tj_compress_ptr, gather_statistics Tboolean) { var ci, tbl int32 var compptr uintptr var entropy Tarith_entropy_ptr _, _, _, _ = ci, compptr, entropy, tbl entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy if gather_statistics != 0 { /* Make sure to avoid that in the master control logic! * We are fully adaptive here and need no extra * statistics gathering pass! */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NOT_COMPILED) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* We assume jcmaster.c already validated the progressive scan parameters. */ /* Select execution routines */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu_DC_first) } else { (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu_AC_first) } } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu_DC_refine) } else { (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu_AC_refine) } } } else { (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu) } /* Allocate & initialize requested statistics areas */ ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) /* DC needs no table for refinement scan */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs == 0 && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no if tbl < 0 || tbl >= int32(NUM_ARITH_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_ARITH_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = tbl (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), uint32(DC_STAT_BINS)) } libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4)), 0, libc.Uint32FromInt32(libc.Int32FromInt32(DC_STAT_BINS))) /* Initialize DC predictions to 0 */ *(*int32)(unsafe.Pointer(entropy + 36 + uintptr(ci)*4)) = 0 *(*int32)(unsafe.Pointer(entropy + 52 + uintptr(ci)*4)) = 0 } /* AC needs no table when not present */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe != 0 { tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no if tbl < 0 || tbl >= int32(NUM_ARITH_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_ARITH_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = tbl (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), uint32(AC_STAT_BINS)) } libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(tbl)*4)), 0, libc.Uint32FromInt32(libc.Int32FromInt32(AC_STAT_BINS))) } goto _1 _1: ; ci++ } /* Initialize arithmetic encoding variables */ (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fc = 0 (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fa = int32(0x10000) (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fsc = 0 (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fzc = 0 (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fct = int32(11) (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fbuffer = -int32(1) /* empty */ /* Initialize restart stuff */ (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num = 0 } /* * Module initialization routine for arithmetic entropy encoding. */ func Xjinit_arith_encoder(tls *libc.TLS, cinfo Tj_compress_ptr) { var entropy Tarith_entropy_ptr var i int32 _, _ = entropy, i entropy = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(208)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy = entropy (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fstart_pass = __ccgo_fp(_start_pass) (*Tarith_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Ffinish_pass = __ccgo_fp(_finish_pass) /* Mark tables unallocated */ i = 0 for { if !(i < int32(NUM_ARITH_TBLS)) { break } *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(i)*4)) = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(i)*4)) = libc.UintptrFromInt32(0) goto _1 _1: ; i++ } /* Initialize index for fixed probability estimation */ *(*uint8)(unsafe.Pointer(entropy + 204)) = uint8(113) } const JPEG_RST02 = 0xD0 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* We use a full-image coefficient buffer when doing Huffman optimization, * and also for writing multiple-scan JPEG files. In all cases, the DCT * step is run during the first pass, and subsequent passes need only read * the buffered coefficients. */ /* Private buffer controller object */ type Tmy_coef_controller = struct { Fpub Tjpeg_c_coef_controller FiMCU_row_num TJDIMENSION FMCU_ctr TJDIMENSION FMCU_vert_offset int32 FMCU_rows_per_iMCU_row int32 FMCU_buffer [10]TJBLOCKROW Fwhole_image [10]Tjvirt_barray_ptr Fblk_buffer [10]TJBLOCK } type Tmy_coef_ptr = uintptr func _start_iMCU_row(tls *libc.TLS, cinfo Tj_compress_ptr) { /* Reset within-iMCU-row counters for a new row */ var coef Tmy_coef_ptr _ = coef coef = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef /* In an interleaved scan, an MCU row is the same as an iMCU row. * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. * But at the bottom of the image, process only what's left. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan > int32(1) { (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row = int32(1) } else { if (*Tmy_coef_controller)(unsafe.Pointer(coef)).FiMCU_row_num < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows-uint32(1) { (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 296)))).Fv_samp_factor } else { (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 296)))).Flast_row_height } } (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_ctr = uint32(0) (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_vert_offset = 0 } /* * Initialize for a processing pass. */ func _start_pass_coef(tls *libc.TLS, cinfo Tj_compress_ptr, pass_mode TJ_BUF_MODE) { var coef Tmy_coef_ptr _ = coef coef = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef (*Tmy_coef_controller)(unsafe.Pointer(coef)).FiMCU_row_num = uint32(0) _start_iMCU_row(tls, cinfo) switch pass_mode { case int32(JBUF_PASS_THRU): if *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 64)) != libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_coef_controller)(unsafe.Pointer(coef)).Fpub.Fcompress_data = __ccgo_fp(_compress_data) case int32(JBUF_SAVE_AND_PASS): if *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 64)) == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_coef_controller)(unsafe.Pointer(coef)).Fpub.Fcompress_data = __ccgo_fp(_compress_first_pass) case int32(JBUF_CRANK_DEST): if *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 64)) == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_coef_controller)(unsafe.Pointer(coef)).Fpub.Fcompress_data = __ccgo_fp(_compress_output) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* * Process some data in the single-pass case. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor block rows for each component in the image. * Returns TRUE if the iMCU row is completed, FALSE if suspended. * * NB: input_buf contains a plane for each component in image, * which we index according to the component's SOF position. */ func _compress_data(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPIMAGE) (r Tboolean) { var MCU_col_num, last_MCU_col, last_iMCU_row, xpos TJDIMENSION var blkp TJBLOCKROW var blockcnt, ci, xindex, yindex, yoffset, v4, v6, v7 int32 var coef Tmy_coef_ptr var compptr uintptr var forward_DCT Tforward_DCT_ptr var input_ptr TJSAMPARRAY _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = MCU_col_num, blkp, blockcnt, ci, coef, compptr, forward_DCT, input_ptr, last_MCU_col, last_iMCU_row, xindex, xpos, yindex, yoffset, v4, v6, v7 coef = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef /* index of current MCU within row */ last_MCU_col = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FMCUs_per_row - uint32(1) last_iMCU_row = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows - uint32(1) /* Loop to write as much as one whole iMCU row */ yoffset = (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_vert_offset for { if !(yoffset < (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row) { break } MCU_col_num = (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_ctr for { if !(MCU_col_num <= last_MCU_col) { break } /* Determine where data comes from in input_buf and do the DCT thing. * Each call on forward_DCT processes a horizontal row of DCT blocks as * wide as an MCU. Dummy blocks at the right or bottom edge are filled in * specially. The data in them does not matter for image reconstruction, * so we fill them with values that will encode to the smallest amount of * data, viz: all zeroes in the AC entries, DC entries equal to previous * block's DC value. (Thanks to Thomas Kinsman for this idea.) */ blkp = coef + 104 /* pointer to current DCT block within MCU */ ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) forward_DCT = *(*Tforward_DCT_ptr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ffdct + 4 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)*4)) input_ptr = *(*TJSAMPARRAY)(unsafe.Pointer(input_buf + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)*4)) + uintptr(yoffset*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size)*4 /* ypos == (yoffset + yindex) * compptr->DCT_v_scaled_size */ if MCU_col_num < last_MCU_col { v4 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width } else { v4 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_col_width } blockcnt = v4 xpos = MCU_col_num * libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_sample_width) yindex = 0 for { if !(yindex < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height) { break } if (*Tmy_coef_controller)(unsafe.Pointer(coef)).FiMCU_row_num < last_iMCU_row || yoffset+yindex < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_row_height { (*(*func(*libc.TLS, Tj_compress_ptr, uintptr, TJSAMPARRAY, TJBLOCKROW, TJDIMENSION, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{forward_DCT})))(tls, cinfo, compptr, input_ptr, blkp, xpos, libc.Uint32FromInt32(blockcnt)) input_ptr += uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size) * 4 blkp += uintptr(blockcnt) * 128 /* Dummy blocks at right edge */ v6 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width - blockcnt xindex = v6 if v6 == 0 { goto _5 } } else { /* At bottom of image, need a whole row of dummy blocks */ xindex = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width } /* Fill in any dummy blocks needed in this row */ libc.Xmemset(tls, blkp, 0, libc.Uint32FromInt32(xindex)*libc.Uint32FromInt64(128)) for { *(*TJCOEF)(unsafe.Pointer(blkp)) = *(*TJCOEF)(unsafe.Pointer(blkp + uintptr(-libc.Int32FromInt32(1))*128)) blkp += 128 goto _8 _8: ; xindex-- v7 = xindex if !(v7 != 0) { break } } goto _5 _5: ; yindex++ } goto _3 _3: ; ci++ } /* Try to write the MCU. In event of a suspension failure, we will * re-DCT the MCU on restart (a bit inefficient, could be fixed...) */ if !((*(*func(*libc.TLS, Tj_compress_ptr, TJBLOCKARRAY) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_encoder)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Fencode_mcu})))(tls, cinfo, coef+24) != 0) { /* Suspension forced; update state counters and exit */ (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_vert_offset = yoffset (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_ctr = MCU_col_num return int32(FALSE1) } goto _2 _2: ; MCU_col_num++ } /* Completed an MCU row, but perhaps not an iMCU row */ (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_ctr = uint32(0) goto _1 _1: ; yoffset++ } /* Completed the iMCU row, advance counters for next one */ (*Tmy_coef_controller)(unsafe.Pointer(coef)).FiMCU_row_num++ _start_iMCU_row(tls, cinfo) return int32(TRUE1) } /* * Process some data in the first pass of a multi-pass case. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor block rows for each component in the image. * This amount of data is read from the source buffer, DCT'd and quantized, * and saved into the virtual arrays. We also generate suitable dummy blocks * as needed at the right and lower edges. (The dummy blocks are constructed * in the virtual arrays, which have been padded appropriately.) This makes * it possible for subsequent passes not to worry about real vs. dummy blocks. * * We must also emit the data to the entropy encoder. This is conveniently * done by calling compress_output() after we've loaded the current strip * of the virtual arrays. * * NB: input_buf contains a plane for each component in image. All * components are DCT'd and loaded into the virtual arrays in this pass. * However, it may be that only a subset of the components are emitted to * the entropy encoder during this first pass; be careful about looking * at the scan-dependent variables (MCU dimensions, etc). */ func _compress_first_pass(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPIMAGE) (r Tboolean) { var MCUindex, MCUs_across, blocks_across, last_iMCU_row TJDIMENSION var bi, block_row, block_rows, ci, h_samp_factor, ndummy, v4 int32 var buffer TJBLOCKARRAY var coef Tmy_coef_ptr var compptr uintptr var forward_DCT Tforward_DCT_ptr var input_ptr TJSAMPARRAY var lastDC TJCOEF var lastblockrow, thisblockrow TJBLOCKROW _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = MCUindex, MCUs_across, bi, block_row, block_rows, blocks_across, buffer, ci, coef, compptr, forward_DCT, h_samp_factor, input_ptr, lastDC, last_iMCU_row, lastblockrow, ndummy, thisblockrow, v4 coef = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef last_iMCU_row = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows - uint32(1) ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Align the virtual buffer for this component. */ buffer = (*(*func(*libc.TLS, Tj_common_ptr, Tjvirt_barray_ptr, TJDIMENSION, TJDIMENSION, Tboolean) TJBLOCKARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Faccess_virt_barray})))(tls, cinfo, *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 64 + uintptr(ci)*4)), (*Tmy_coef_controller)(unsafe.Pointer(coef)).FiMCU_row_num*libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), int32(TRUE1)) /* Count non-dummy DCT block rows in this iMCU row. */ if (*Tmy_coef_controller)(unsafe.Pointer(coef)).FiMCU_row_num < last_iMCU_row { block_rows = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor } else { /* NB: can't use last_row_height here, since may not be set! */ block_rows = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks % libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor)) if block_rows == 0 { block_rows = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor } } blocks_across = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks h_samp_factor = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor /* Count number of dummy blocks to be added at the right margin. */ ndummy = libc.Int32FromUint32(blocks_across % libc.Uint32FromInt32(h_samp_factor)) if ndummy > 0 { ndummy = h_samp_factor - ndummy } forward_DCT = *(*Tforward_DCT_ptr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ffdct + 4 + uintptr(ci)*4)) input_ptr = *(*TJSAMPARRAY)(unsafe.Pointer(input_buf + uintptr(ci)*4)) /* Perform DCT for all non-dummy blocks in this iMCU row. Each call * on forward_DCT processes a complete horizontal row of DCT blocks. */ block_row = 0 for { if !(block_row < block_rows) { break } thisblockrow = *(*TJBLOCKROW)(unsafe.Pointer(buffer + uintptr(block_row)*4)) (*(*func(*libc.TLS, Tj_compress_ptr, uintptr, TJSAMPARRAY, TJBLOCKROW, TJDIMENSION, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{forward_DCT})))(tls, cinfo, compptr, input_ptr, thisblockrow, libc.Uint32FromInt32(0), blocks_across) input_ptr += uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size) * 4 if ndummy > 0 { /* Create dummy blocks at the right edge of the image. */ thisblockrow += uintptr(blocks_across) * 128 /* => first dummy block */ libc.Xmemset(tls, thisblockrow, 0, libc.Uint32FromInt32(ndummy)*libc.Uint32FromInt64(128)) lastDC = *(*TJCOEF)(unsafe.Pointer(thisblockrow + uintptr(-libc.Int32FromInt32(1))*128)) bi = 0 for { if !(bi < ndummy) { break } *(*TJCOEF)(unsafe.Pointer(thisblockrow + uintptr(bi)*128)) = lastDC goto _3 _3: ; bi++ } } goto _2 _2: ; block_row++ } /* If at end of image, create dummy block rows as needed. * The tricky part here is that within each MCU, we want the DC values * of the dummy blocks to match the last real block's DC value. * This squeezes a few more bytes out of the resulting file... */ if block_row < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor { blocks_across += libc.Uint32FromInt32(ndummy) /* include lower right corner */ MCUs_across = blocks_across / libc.Uint32FromInt32(h_samp_factor) for { thisblockrow = *(*TJBLOCKROW)(unsafe.Pointer(buffer + uintptr(block_row)*4)) lastblockrow = *(*TJBLOCKROW)(unsafe.Pointer(buffer + uintptr(block_row-int32(1))*4)) libc.Xmemset(tls, thisblockrow, 0, blocks_across*libc.Uint32FromInt64(128)) MCUindex = uint32(0) for { if !(MCUindex < MCUs_across) { break } lastDC = *(*TJCOEF)(unsafe.Pointer(lastblockrow + uintptr(h_samp_factor-int32(1))*128)) bi = 0 for { if !(bi < h_samp_factor) { break } *(*TJCOEF)(unsafe.Pointer(thisblockrow + uintptr(bi)*128)) = lastDC goto _7 _7: ; bi++ } thisblockrow += uintptr(h_samp_factor) * 128 /* advance to next MCU in row */ lastblockrow += uintptr(h_samp_factor) * 128 goto _6 _6: ; MCUindex++ } goto _5 _5: ; block_row++ v4 = block_row if !(v4 < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor) { break } } } goto _1 _1: ; ci++ compptr += 88 } /* NB: compress_output will increment iMCU_row_num if successful. * A suspension return will result in redoing all the work above next time. */ /* Emit data to the entropy encoder, sharing code with subsequent passes */ return _compress_output(tls, cinfo, input_buf) } /* * Process some data in subsequent passes of a multi-pass case. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor block rows for each component in the scan. * The data is obtained from the virtual arrays and fed to the entropy coder. * Returns TRUE if the iMCU row is completed, FALSE if suspended. * * NB: input_buf is ignored; it is likely to be a NULL pointer. */ func _compress_output(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPIMAGE) (r Tboolean) { var MCU_col_num, start_col TJDIMENSION var blkp, v8 TJBLOCKARRAY var buffer [4]TJBLOCKARRAY var buffer_ptr, v9 TJBLOCKROW var ci, xindex, yindex, yoffset, v6 int32 var coef Tmy_coef_ptr var compptr uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = MCU_col_num, blkp, buffer, buffer_ptr, ci, coef, compptr, start_col, xindex, yindex, yoffset, v6, v8, v9 coef = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef /* Align the virtual buffers for the components used in this scan. * NB: during first pass, this is safe only because the buffers will * already be aligned properly, so jmemmgr.c won't need to do any I/O. */ ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) buffer[ci] = (*(*func(*libc.TLS, Tj_common_ptr, Tjvirt_barray_ptr, TJDIMENSION, TJDIMENSION, Tboolean) TJBLOCKARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Faccess_virt_barray})))(tls, cinfo, *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 64 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)*4)), (*Tmy_coef_controller)(unsafe.Pointer(coef)).FiMCU_row_num*libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), int32(FALSE1)) goto _1 _1: ; ci++ } /* Loop to process one whole iMCU row */ yoffset = (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_vert_offset for { if !(yoffset < (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row) { break } MCU_col_num = (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_ctr for { if !(MCU_col_num < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FMCUs_per_row) { break } /* Construct list of pointers to DCT blocks belonging to this MCU */ blkp = coef + 24 /* pointer to current DCT block within MCU */ ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) start_col = MCU_col_num * libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width) yindex = 0 for { if !(yindex < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height) { break } buffer_ptr = *(*TJBLOCKROW)(unsafe.Pointer(buffer[ci] + uintptr(yoffset+yindex)*4)) + uintptr(start_col)*128 xindex = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width for { v8 = blkp blkp += 4 v9 = buffer_ptr buffer_ptr += 128 *(*TJBLOCKROW)(unsafe.Pointer(v8)) = v9 goto _7 _7: ; xindex-- v6 = xindex if !(v6 != 0) { break } } goto _5 _5: ; yindex++ } goto _4 _4: ; ci++ } /* Try to write the MCU. */ if !((*(*func(*libc.TLS, Tj_compress_ptr, TJBLOCKARRAY) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_encoder)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Fencode_mcu})))(tls, cinfo, coef+24) != 0) { /* Suspension forced; update state counters and exit */ (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_vert_offset = yoffset (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_ctr = MCU_col_num return int32(FALSE1) } goto _3 _3: ; MCU_col_num++ } /* Completed an MCU row, but perhaps not an iMCU row */ (*Tmy_coef_controller)(unsafe.Pointer(coef)).FMCU_ctr = uint32(0) goto _2 _2: ; yoffset++ } /* Completed the iMCU row, advance counters for next one */ (*Tmy_coef_controller)(unsafe.Pointer(coef)).FiMCU_row_num++ _start_iMCU_row(tls, cinfo) return int32(TRUE1) } /* * Initialize coefficient buffer controller. */ func Xjinit_c_coef_controller(tls *libc.TLS, cinfo Tj_compress_ptr, need_full_buffer Tboolean) { var bi, ci, v2 int32 var blkp, v4 TJBLOCKARRAY var buffer_ptr, v5 TJBLOCKROW var coef Tmy_coef_ptr var compptr uintptr _, _, _, _, _, _, _, _, _ = bi, blkp, buffer_ptr, ci, coef, compptr, v2, v4, v5 if need_full_buffer != 0 { coef = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(1384)-libc.Uint32FromInt64(1280)) ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 64 + uintptr(ci)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tboolean, TJDIMENSION, TJDIMENSION, TJDIMENSION) Tjvirt_barray_ptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Frequest_virt_barray})))(tls, cinfo, int32(JPOOL_IMAGE), int32(FALSE1), libc.Uint32FromInt32(Xjround_up(tls, libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks), (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor)), libc.Uint32FromInt32(Xjround_up(tls, libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks), (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor)), libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor)) goto _1 _1: ; ci++ compptr += 88 } } else { coef = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(1384)) blkp = coef + 24 buffer_ptr = coef + 104 bi = int32(C_MAX_BLOCKS_IN_MCU) for { v4 = blkp blkp += 4 v5 = buffer_ptr buffer_ptr += 128 *(*TJBLOCKROW)(unsafe.Pointer(v4)) = v5 goto _3 _3: ; bi-- v2 = bi if !(v2 != 0) { break } } *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 64)) = libc.UintptrFromInt32(0) /* flag for no virtual arrays */ } (*Tmy_coef_controller)(unsafe.Pointer(coef)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_coef) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef = coef } const R_CR_OFF = "B_CB_OFF" const R_Y_OFF = 0 const SCALEBITS = 16 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Private subobject */ type Tmy_color_converter = struct { Fpub Tjpeg_color_converter Frgb_ycc_tab uintptr } type Tmy_cconvert_ptr = uintptr /**************** RGB -> YCbCr conversion: most common case **************/ /* * YCbCr is defined per Recommendation ITU-R BT.601-7 (03/2011), * previously known as Recommendation CCIR 601-1, except that Cb and Cr * are normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. * sRGB (standard RGB color space) is defined per IEC 61966-2-1:1999. * sYCC (standard luma-chroma-chroma color space with extended gamut) * is defined per IEC 61966-2-1:1999 Amendment A1:2003 Annex F. * bg-sRGB and bg-sYCC (big gamut standard color spaces) * are defined per IEC 61966-2-1:1999 Amendment A1:2003 Annex G. * Note that the derived conversion coefficients given in some of these * documents are imprecise. The general conversion equations are * Y = Kr * R + (1 - Kr - Kb) * G + Kb * B * Cb = (B - Y) / (1 - Kb) / K * Cr = (R - Y) / (1 - Kr) / K * With Kr = 0.299 and Kb = 0.114 (derived according to SMPTE RP 177-1993 * from the 1953 FCC NTSC primaries and CIE Illuminant C), K = 2 for sYCC, * the conversion equations to be implemented are therefore * Y = 0.299 * R + 0.587 * G + 0.114 * B * Cb = -0.168735892 * R - 0.331264108 * G + 0.5 * B + CENTERJSAMPLE * Cr = 0.5 * R - 0.418687589 * G - 0.081312411 * B + CENTERJSAMPLE * Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2, * rather than CENTERJSAMPLE, for Cb and Cr. This gave equal positive and * negative swings for Cb/Cr, but meant that grayscale values (Cb=Cr=0) * were not represented exactly. Now we sacrifice exact representation of * maximum red and maximum blue in order to get exact grayscales. * * To avoid floating-point arithmetic, we represent the fractional constants * as integers scaled up by 2^16 (about 4 digits precision); we have to divide * the products by 2^16, with appropriate rounding, to get the correct answer. * * For even more speed, we avoid doing any multiplications in the inner loop * by precalculating the constants times R,G,B for all possible values. * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); * for 9-bit to 12-bit samples it is still acceptable. It's not very * reasonable for 16-bit samples, but if you want lossless storage * you shouldn't be changing colorspace anyway. * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included * in the tables to save adding them separately in the inner loop. */ /* We allocate one big table and divide it up into eight parts, instead of * doing eight alloc_small requests. This lets us use a single table base * address, which can be held in a register in the inner loops on many * machines (more than can hold all eight addresses, anyway). */ /* * Initialize for RGB->YCC colorspace conversion. */ func _rgb_ycc_start(tls *libc.TLS, cinfo Tj_compress_ptr) { var cconvert Tmy_cconvert_ptr var i TINT32 var rgb_ycc_tab, v1 uintptr _, _, _, _ = cconvert, i, rgb_ycc_tab, v1 cconvert = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcconvert /* Allocate and fill in the conversion tables. */ v1 = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(8)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*libc.Uint32FromInt64(4)) rgb_ycc_tab = v1 (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Frgb_ycc_tab = v1 i = 0 for { if !(i <= int32(MAXJSAMPLE)) { break } *(*TINT32)(unsafe.Pointer(rgb_ycc_tab + uintptr(i+R_Y_OFF)*4)) = int32(libc.Float64FromFloat64(0.299)*float64(libc.Int32FromInt32(1)<Cb and R=>Cr tables are the same rgb_ycc_tab[i+R_CR_OFF] = (i << (SCALEBITS-1)) + CBCR_OFFSET + ONE_HALF-1; */ *(*TINT32)(unsafe.Pointer(rgb_ycc_tab + uintptr(i+libc.Int32FromInt32(6)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) = -int32(libc.Float64FromFloat64(0.418687589)*float64(libc.Int32FromInt32(1)<= 0) { break } v2 = input_buf input_buf += 4 inptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) outptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf)) + uintptr(output_row)*4)) outptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf + 1*4)) + uintptr(output_row)*4)) outptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf + 2*4)) + uintptr(output_row)*4)) output_row++ col = uint32(0) for { if !(col < num_cols) { break } r = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr))) g = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 1))) b = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 2))) inptr += uintptr(RGB_PIXELSIZE) /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations * must be too; we do not need an explicit range-limiting operation. * Hence the value being shifted is never negative, and we don't * need the general RIGHT_SHIFT macro. */ /* Y */ *(*TJSAMPLE)(unsafe.Pointer(outptr0 + uintptr(col))) = libc.Uint8FromInt32((*(*TINT32)(unsafe.Pointer(ctab + uintptr(r+R_Y_OFF)*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(g+libc.Int32FromInt32(1)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(b+libc.Int32FromInt32(2)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4))) >> libc.Int32FromInt32(SCALEBITS)) /* Cb */ *(*TJSAMPLE)(unsafe.Pointer(outptr1 + uintptr(col))) = libc.Uint8FromInt32((*(*TINT32)(unsafe.Pointer(ctab + uintptr(r+libc.Int32FromInt32(3)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(g+libc.Int32FromInt32(4)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(b+libc.Int32FromInt32(5)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4))) >> libc.Int32FromInt32(SCALEBITS)) /* Cr */ *(*TJSAMPLE)(unsafe.Pointer(outptr2 + uintptr(col))) = libc.Uint8FromInt32((*(*TINT32)(unsafe.Pointer(ctab + uintptr(r+libc.Int32FromInt32(5)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(g+libc.Int32FromInt32(6)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(b+libc.Int32FromInt32(7)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4))) >> libc.Int32FromInt32(SCALEBITS)) goto _3 _3: ; col++ } } } /**************** Cases other than RGB -> YCbCr **************/ /* * Convert some rows of samples to the JPEG colorspace. * This version handles RGB->grayscale conversion, * which is the same as the RGB->Y portion of RGB->YCbCr. * We assume rgb_ycc_start has been called (we only use the Y tables). */ func _rgb_gray_convert(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPIMAGE, output_row TJDIMENSION, num_rows int32) { var cconvert Tmy_cconvert_ptr var col, num_cols, v3 TJDIMENSION var ctab uintptr var inptr, outptr TJSAMPROW var y TINT32 var v1 int32 var v2 TJSAMPARRAY _, _, _, _, _, _, _, _, _, _ = cconvert, col, ctab, inptr, num_cols, outptr, y, v1, v2, v3 cconvert = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcconvert ctab = (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Frgb_ycc_tab num_cols = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } v2 = input_buf input_buf += 4 inptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) v3 = output_row output_row++ outptr = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf)) + uintptr(v3)*4)) col = uint32(0) for { if !(col < num_cols) { break } y = *(*TINT32)(unsafe.Pointer(ctab + uintptr(R_Y_OFF+libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr))))*4)) y += *(*TINT32)(unsafe.Pointer(ctab + uintptr(libc.Int32FromInt32(1)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))+libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 1))))*4)) y += *(*TINT32)(unsafe.Pointer(ctab + uintptr(libc.Int32FromInt32(2)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))+libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 2))))*4)) inptr += uintptr(RGB_PIXELSIZE) *(*TJSAMPLE)(unsafe.Pointer(outptr + uintptr(col))) = libc.Uint8FromInt32(y >> libc.Int32FromInt32(SCALEBITS)) goto _4 _4: ; col++ } } } /* * Convert some rows of samples to the JPEG colorspace. * This version handles Adobe-style CMYK->YCCK conversion, * where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the * same conversion as above, while passing K (black) unchanged. * We assume rgb_ycc_start has been called. */ func _cmyk_ycck_convert(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPIMAGE, output_row TJDIMENSION, num_rows int32) { var b, g, r, v1 int32 var cconvert Tmy_cconvert_ptr var col, num_cols TJDIMENSION var ctab uintptr var inptr, outptr0, outptr1, outptr2, outptr3 TJSAMPROW var v2 TJSAMPARRAY _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, cconvert, col, ctab, g, inptr, num_cols, outptr0, outptr1, outptr2, outptr3, r, v1, v2 cconvert = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcconvert ctab = (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Frgb_ycc_tab num_cols = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } v2 = input_buf input_buf += 4 inptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) outptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf)) + uintptr(output_row)*4)) outptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf + 1*4)) + uintptr(output_row)*4)) outptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf + 2*4)) + uintptr(output_row)*4)) outptr3 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf + 3*4)) + uintptr(output_row)*4)) output_row++ col = uint32(0) for { if !(col < num_cols) { break } r = int32(MAXJSAMPLE) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr))) g = int32(MAXJSAMPLE) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 1))) b = int32(MAXJSAMPLE) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 2))) /* K passes through as-is */ *(*TJSAMPLE)(unsafe.Pointer(outptr3 + uintptr(col))) = *(*TJSAMPLE)(unsafe.Pointer(inptr + 3)) /* don't need GETJSAMPLE here */ inptr += uintptr(4) /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations * must be too; we do not need an explicit range-limiting operation. * Hence the value being shifted is never negative, and we don't * need the general RIGHT_SHIFT macro. */ /* Y */ *(*TJSAMPLE)(unsafe.Pointer(outptr0 + uintptr(col))) = libc.Uint8FromInt32((*(*TINT32)(unsafe.Pointer(ctab + uintptr(r+R_Y_OFF)*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(g+libc.Int32FromInt32(1)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(b+libc.Int32FromInt32(2)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4))) >> libc.Int32FromInt32(SCALEBITS)) /* Cb */ *(*TJSAMPLE)(unsafe.Pointer(outptr1 + uintptr(col))) = libc.Uint8FromInt32((*(*TINT32)(unsafe.Pointer(ctab + uintptr(r+libc.Int32FromInt32(3)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(g+libc.Int32FromInt32(4)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(b+libc.Int32FromInt32(5)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4))) >> libc.Int32FromInt32(SCALEBITS)) /* Cr */ *(*TJSAMPLE)(unsafe.Pointer(outptr2 + uintptr(col))) = libc.Uint8FromInt32((*(*TINT32)(unsafe.Pointer(ctab + uintptr(r+libc.Int32FromInt32(5)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(g+libc.Int32FromInt32(6)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4)) + *(*TINT32)(unsafe.Pointer(ctab + uintptr(b+libc.Int32FromInt32(7)*(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)))*4))) >> libc.Int32FromInt32(SCALEBITS)) goto _3 _3: ; col++ } } } /* * Convert some rows of samples to the JPEG colorspace. * [R,G,B] to [R-G,G,B-G] conversion with modulo calculation * (forward reversible color transform). * This can be seen as an adaption of the general RGB->YCbCr * conversion equation with Kr = Kb = 0, while replacing the * normalization by modulo calculation. */ func _rgb_rgb1_convert(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPIMAGE, output_row TJDIMENSION, num_rows int32) { var b, g, r, v1 int32 var col, num_cols TJDIMENSION var inptr, outptr0, outptr1, outptr2 TJSAMPROW var v2 TJSAMPARRAY _, _, _, _, _, _, _, _, _, _, _ = b, col, g, inptr, num_cols, outptr0, outptr1, outptr2, r, v1, v2 num_cols = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } v2 = input_buf input_buf += 4 inptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) outptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf)) + uintptr(output_row)*4)) outptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf + 1*4)) + uintptr(output_row)*4)) outptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf + 2*4)) + uintptr(output_row)*4)) output_row++ col = uint32(0) for { if !(col < num_cols) { break } r = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr))) g = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 1))) b = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 2))) inptr += uintptr(RGB_PIXELSIZE) /* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD * (modulo) operator is equivalent to the bitmask operator AND. */ *(*TJSAMPLE)(unsafe.Pointer(outptr0 + uintptr(col))) = libc.Uint8FromInt32((r - g + libc.Int32FromInt32(CENTERJSAMPLE)) & libc.Int32FromInt32(MAXJSAMPLE)) *(*TJSAMPLE)(unsafe.Pointer(outptr1 + uintptr(col))) = libc.Uint8FromInt32(g) *(*TJSAMPLE)(unsafe.Pointer(outptr2 + uintptr(col))) = libc.Uint8FromInt32((b - g + libc.Int32FromInt32(CENTERJSAMPLE)) & libc.Int32FromInt32(MAXJSAMPLE)) goto _3 _3: ; col++ } } } /* * Convert some rows of samples to the JPEG colorspace. * This version handles grayscale output with no conversion. * The source can be either plain grayscale or YCC (since Y == gray). */ func _grayscale_convert(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPIMAGE, output_row TJDIMENSION, num_rows int32) { var count, num_cols, v3 TJDIMENSION var inptr, outptr, v5 TJSAMPROW var instride, v1 int32 var v2 TJSAMPARRAY _, _, _, _, _, _, _, _, _ = count, inptr, instride, num_cols, outptr, v1, v2, v3, v5 instride = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components num_cols = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } v2 = input_buf input_buf += 4 inptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) v3 = output_row output_row++ outptr = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf)) + uintptr(v3)*4)) count = num_cols for { if !(count > uint32(0)) { break } v5 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v5)) = *(*TJSAMPLE)(unsafe.Pointer(inptr)) /* don't need GETJSAMPLE() here */ inptr += uintptr(instride) goto _4 _4: ; count-- } } } /* * Convert some rows of samples to the JPEG colorspace. * No colorspace conversion, but change from interleaved * to separate-planes representation. */ func _rgb_convert(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPIMAGE, output_row TJDIMENSION, num_rows int32) { var col, num_cols TJDIMENSION var inptr, outptr0, outptr1, outptr2 TJSAMPROW var v1 int32 var v2 TJSAMPARRAY _, _, _, _, _, _, _, _ = col, inptr, num_cols, outptr0, outptr1, outptr2, v1, v2 num_cols = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } v2 = input_buf input_buf += 4 inptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) outptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf)) + uintptr(output_row)*4)) outptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf + 1*4)) + uintptr(output_row)*4)) outptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf + 2*4)) + uintptr(output_row)*4)) output_row++ col = uint32(0) for { if !(col < num_cols) { break } /* We can dispense with GETJSAMPLE() here */ *(*TJSAMPLE)(unsafe.Pointer(outptr0 + uintptr(col))) = *(*TJSAMPLE)(unsafe.Pointer(inptr)) *(*TJSAMPLE)(unsafe.Pointer(outptr1 + uintptr(col))) = *(*TJSAMPLE)(unsafe.Pointer(inptr + 1)) *(*TJSAMPLE)(unsafe.Pointer(outptr2 + uintptr(col))) = *(*TJSAMPLE)(unsafe.Pointer(inptr + 2)) inptr += uintptr(RGB_PIXELSIZE) goto _3 _3: ; col++ } } } /* * Convert some rows of samples to the JPEG colorspace. * This version handles multi-component colorspaces without conversion. * We assume input_components == num_components. */ func _null_convert(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPIMAGE, output_row TJDIMENSION, num_rows int32) { var ci, num_comps, v1 int32 var count, num_cols TJDIMENSION var inptr, outptr, v4 TJSAMPROW _, _, _, _, _, _, _, _ = ci, count, inptr, num_cols, num_comps, outptr, v1, v4 num_comps = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components num_cols = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } /* It seems fastest to make a separate pass for each component. */ ci = 0 for { if !(ci < num_comps) { break } inptr = *(*TJSAMPROW)(unsafe.Pointer(input_buf)) + uintptr(ci) outptr = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(output_buf + uintptr(ci)*4)) + uintptr(output_row)*4)) count = num_cols for { if !(count > uint32(0)) { break } v4 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v4)) = *(*TJSAMPLE)(unsafe.Pointer(inptr)) /* don't need GETJSAMPLE() here */ inptr += uintptr(num_comps) goto _3 _3: ; count-- } goto _2 _2: ; ci++ } input_buf += 4 output_row++ } } /* * Empty method for start_pass. */ func _null_method(tls *libc.TLS, cinfo Tj_compress_ptr) { /* no work needed */ } /* * Module initialization routine for input colorspace conversion. */ func Xjinit_color_converter(tls *libc.TLS, cinfo Tj_compress_ptr) { var cconvert Tmy_cconvert_ptr _ = cconvert cconvert = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(12)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcconvert = cconvert /* set start_pass to null method until we find out differently */ (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fstart_pass = __ccgo_fp(_null_method) /* Make sure input_components agrees with in_color_space */ switch (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space { case int32(JCS_GRAYSCALE): if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components != int32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_IN_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } case int32(JCS_RGB): fallthrough case int32(JCS_BG_RGB): fallthrough case int32(JCS_YCbCr): fallthrough case int32(JCS_BG_YCC): if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components != int32(3) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_IN_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } case int32(JCS_CMYK): fallthrough case int32(JCS_YCCK): if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components != int32(4) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_IN_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } default: /* JCS_UNKNOWN can be anything */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components < int32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_IN_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* Support color transform only for RGB colorspaces */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform != 0 && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space != int32(JCS_RGB) && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space != int32(JCS_BG_RGB) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Check num_components, set conversion method based on requested space */ switch (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space { case int32(JCS_GRAYSCALE): if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components != int32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } switch (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space { case int32(JCS_GRAYSCALE): fallthrough case int32(JCS_YCbCr): fallthrough case int32(JCS_BG_YCC): (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_grayscale_convert) case int32(JCS_RGB): (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fstart_pass = __ccgo_fp(_rgb_ycc_start) (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb_gray_convert) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } case int32(JCS_RGB): fallthrough case int32(JCS_BG_RGB): if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components != int32(3) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space != (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } switch (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform { case int32(JCT_NONE): (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb_convert) case int32(JCT_SUBTRACT_GREEN): (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb_rgb1_convert) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } case int32(JCS_YCbCr): if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components != int32(3) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } switch (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space { case int32(JCS_RGB): (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fstart_pass = __ccgo_fp(_rgb_ycc_start) (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb_ycc_convert) case int32(JCS_YCbCr): (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_null_convert) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } case int32(JCS_BG_YCC): if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components != int32(3) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } switch (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space { case int32(JCS_RGB): /* For conversion from normal RGB input to BG_YCC representation, * the Cb/Cr values are first computed as usual, and then * quantized further after DCT processing by a factor of * 2 in reference to the nominal quantization factor. */ /* need quantization scale by factor of 2 after DCT */ (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).Fcomponent_needed = int32(TRUE1) (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).Fcomponent_needed = int32(TRUE1) /* compute normal YCC first */ (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fstart_pass = __ccgo_fp(_rgb_ycc_start) (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb_ycc_convert) case int32(JCS_YCbCr): /* need quantization scale by factor of 2 after DCT */ (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).Fcomponent_needed = int32(TRUE1) (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).Fcomponent_needed = int32(TRUE1) /*FALLTHROUGH*/ fallthrough case int32(JCS_BG_YCC): /* Pass through for BG_YCC input */ (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_null_convert) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } case int32(JCS_CMYK): if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components != int32(4) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space != int32(JCS_CMYK) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_null_convert) case int32(JCS_YCCK): if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components != int32(4) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } switch (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space { case int32(JCS_CMYK): (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fstart_pass = __ccgo_fp(_rgb_ycc_start) (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_cmyk_ycck_convert) case int32(JCS_YCCK): (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_null_convert) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } default: /* allow null conversion of JCS_UNKNOWN */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space != (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components != (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_color_converter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_null_convert) } } const CONST_BITS = 14 const IFAST_SCALE_BITS = 2 type TDCTELEM = int32 type Tforward_DCT_method_ptr = uintptr type Tfloat_DCT_method_ptr = uintptr type TISLOW_MULT_TYPE = int32 type TIFAST_MULT_TYPE = int32 type TFLOAT_MULT_TYPE = float32 /* * Macros for handling fixed-point arithmetic; these are used by many * but not all of the DCT/IDCT modules. * * All values are expected to be of type INT32. * Fractional constants are scaled left by CONST_BITS bits. * CONST_BITS is defined within each module using these macros, * and may differ from one module to the next. */ /* Convert a positive real constant to an integer scaled by CONST_SCALE. * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, * thus causing a lot of useless floating-point operations at run time. */ /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * This macro is used only when the two inputs will actually be no more than * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a * full 32x32 multiply. This provides a useful speedup on many machines. * Unfortunately there is no way to specify a 16x16->32 multiply portably * in C, but some C compilers will do the right thing if you provide the * correct combination of casts. */ /* Same except both inputs are variables. */ /* Like RIGHT_SHIFT, but applies to a DCTELEM. * We assume that int right shift is unsigned if INT32 right shift is. */ /* Private subobject for this module */ type Tmy_fdct_controller = struct { Fpub Tjpeg_forward_dct Fdo_dct [10]Tforward_DCT_method_ptr Fdo_float_dct [10]Tfloat_DCT_method_ptr } type Tmy_fdct_ptr = uintptr /* The allocated post-DCT divisor tables -- big enough for any * supported variant and not identical to the quant table entries, * because of scaling (especially for an unnormalized DCT) -- * are pointed to by dct_table in the per-component comp_info * structures. Each table is given in normal array order. */ type Tdivisor_table = struct { Ffloat_array [0][64]float32 Fint_array [64]TDCTELEM } /* The current scaled-DCT routines require ISLOW-style divisor tables, * so be sure to compile that code if either ISLOW or SCALING is requested. */ /* * Perform forward DCT on one or more blocks of a component. * * The input samples are taken from the sample_data[] array starting at * position start_col, and moving to the right for any additional blocks. * The quantized coefficients are returned in coef_blocks[]. */ func _forward_DCT(tls *libc.TLS, cinfo Tj_compress_ptr, compptr uintptr, sample_data TJSAMPARRAY, coef_blocks TJBLOCKROW, start_col TJDIMENSION, num_blocks TJDIMENSION) { bp := tls.Alloc(256) defer tls.Free(256) /* This version is used for integer DCT implementations. */ var bi TJDIMENSION var divisors uintptr var do_dct Tforward_DCT_method_ptr var fdct Tmy_fdct_ptr var i int32 var output_ptr TJCOEFPTR var qval, temp TDCTELEM var _ /* workspace at bp+0 */ [64]TDCTELEM _, _, _, _, _, _, _, _ = bi, divisors, do_dct, fdct, i, output_ptr, qval, temp /* This routine is heavily used, so it's worth coding it tightly. */ fdct = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ffdct do_dct = *(*Tforward_DCT_method_ptr)(unsafe.Pointer(fdct + 44 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)*4)) divisors = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdct_table bi = uint32(0) for { if !(bi < num_blocks) { break } /* Perform the DCT */ (*(*func(*libc.TLS, uintptr, TJSAMPARRAY, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{do_dct})))(tls, bp, sample_data, start_col) /* Quantize/descale the coefficients, and store into coef_blocks[] */ output_ptr = coef_blocks + uintptr(bi)*128 i = 0 for { if !(i < int32(DCTSIZE2)) { break } qval = *(*TDCTELEM)(unsafe.Pointer(divisors + uintptr(i)*4)) temp = (*(*[64]TDCTELEM)(unsafe.Pointer(bp)))[i] /* Divide the coefficient value by qval, ensuring proper rounding. * Since C does not specify the direction of rounding for negative * quotients, we have to force the dividend positive for portability. * * In most files, at least half of the output values will be zero * (at default quantization settings, more like three-quarters...) * so we should ensure that this case is fast. On many machines, * a comparison is enough cheaper than a divide to make a special test * a win. Since both inputs will be nonnegative, we need only test * for a < b to discover whether a/b is 0. * If your machine's division is fast enough, define FAST_DIVIDE. */ if temp < 0 { temp = -temp temp += qval >> int32(1) /* for rounding */ if temp >= qval { temp /= qval } else { temp = 0 } temp = -temp } else { temp += qval >> int32(1) /* for rounding */ if temp >= qval { temp /= qval } else { temp = 0 } } *(*TJCOEF)(unsafe.Pointer(output_ptr + uintptr(i)*2)) = int16(temp) goto _2 _2: ; i++ } goto _1 _1: ; bi++ start_col += libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size) } } func _forward_DCT_float(tls *libc.TLS, cinfo Tj_compress_ptr, compptr uintptr, sample_data TJSAMPARRAY, coef_blocks TJBLOCKROW, start_col TJDIMENSION, num_blocks TJDIMENSION) { bp := tls.Alloc(256) defer tls.Free(256) /* This version is used for floating-point DCT implementations. */ var bi TJDIMENSION var divisors uintptr var do_dct Tfloat_DCT_method_ptr var fdct Tmy_fdct_ptr var i int32 var output_ptr TJCOEFPTR var temp float32 var _ /* workspace at bp+0 */ [64]float32 _, _, _, _, _, _, _ = bi, divisors, do_dct, fdct, i, output_ptr, temp /* This routine is heavily used, so it's worth coding it tightly. */ fdct = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ffdct do_dct = *(*Tfloat_DCT_method_ptr)(unsafe.Pointer(fdct + 84 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)*4)) divisors = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdct_table bi = uint32(0) for { if !(bi < num_blocks) { break } /* Perform the DCT */ (*(*func(*libc.TLS, uintptr, TJSAMPARRAY, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{do_dct})))(tls, bp, sample_data, start_col) /* Quantize/descale the coefficients, and store into coef_blocks[] */ output_ptr = coef_blocks + uintptr(bi)*128 i = 0 for { if !(i < int32(DCTSIZE2)) { break } /* Apply the quantization and scaling factor */ temp = (*(*[64]float32)(unsafe.Pointer(bp)))[i] * *(*float32)(unsafe.Pointer(divisors + uintptr(i)*4)) /* Round to nearest integer. * Since C does not specify the direction of rounding for negative * quotients, we have to force the dividend positive for portability. * The maximum coefficient size is +-16K (for 12-bit data), so this * code should work for either 16-bit or 32-bit ints. */ *(*TJCOEF)(unsafe.Pointer(output_ptr + uintptr(i)*2)) = int16(int32(temp+libc.Float32FromFloat64(16384.5)) - libc.Int32FromInt32(16384)) goto _2 _2: ; i++ } goto _1 _1: ; bi++ start_col += libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size) } } /* * Initialize for a processing pass. * Verify that all referenced Q-tables are present, and set up * the divisor table for each one. * In the current implementation, DCT of all components is done during * the first pass, even if only some components will be output in the * first scan. Hence all components should be examined here. */ func _start_pass_fdctmgr(tls *libc.TLS, cinfo Tj_compress_ptr) { var ci, col, i, method, qtblno, row, v3, v5, v6 int32 var compptr, dtbl, fdtbl, qtbl uintptr var fdct Tmy_fdct_ptr var v9 float64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ci, col, compptr, dtbl, fdct, fdtbl, i, method, qtbl, qtblno, row, v3, v5, v6, v9 fdct = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ffdct method = 0 ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Select the proper DCT routine for this component's scaling */ switch (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size<= int32(NUM_QUANT_TBLS) || *(*uintptr)(unsafe.Pointer(cinfo + 88 + uintptr(qtblno)*4)) == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_QUANT_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = qtblno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } qtbl = *(*uintptr)(unsafe.Pointer(cinfo + 88 + uintptr(qtblno)*4)) /* Create divisor table from quant table */ switch method { case int32(JDCT_ISLOW): /* For LL&M IDCT method, divisors are equal to raw quantization * coefficients multiplied by 8 (to counteract scaling). */ dtbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdct_table i = 0 for { if !(i < int32(DCTSIZE2)) { break } if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0 { v3 = int32(4) } else { v3 = int32(3) } *(*TDCTELEM)(unsafe.Pointer(dtbl + uintptr(i)*4)) = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(qtbl + uintptr(i)*2))) << v3 goto _2 _2: ; i++ } *(*Tforward_DCT_ptr)(unsafe.Pointer(fdct + 4 + uintptr(ci)*4)) = __ccgo_fp(_forward_DCT) case int32(JDCT_IFAST): dtbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdct_table i = 0 for { if !(i < int32(DCTSIZE2)) { break } if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0 { v5 = libc.Int32FromInt32(CONST_BITS) - libc.Int32FromInt32(4) } else { v5 = libc.Int32FromInt32(CONST_BITS) - libc.Int32FromInt32(3) } if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0 { v6 = libc.Int32FromInt32(CONST_BITS) - libc.Int32FromInt32(4) } else { v6 = libc.Int32FromInt32(CONST_BITS) - libc.Int32FromInt32(3) } *(*TDCTELEM)(unsafe.Pointer(dtbl + uintptr(i)*4)) = (libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(qtbl + uintptr(i)*2)))*int32(_aanscales[i]) + libc.Int32FromInt32(1)<<(v5-libc.Int32FromInt32(1))) >> v6 goto _4 _4: ; i++ } *(*Tforward_DCT_ptr)(unsafe.Pointer(fdct + 4 + uintptr(ci)*4)) = __ccgo_fp(_forward_DCT) case int32(JDCT_FLOAT): /* For float AA&N IDCT method, divisors are equal to quantization * coefficients scaled by scalefactor[row]*scalefactor[col], where * scalefactor[0] = 1 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 * We apply a further scale factor of 8. * What's actually stored is 1/divisor so that the inner loop can * use a multiplication rather than a division. */ fdtbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdct_table i = 0 row = 0 for { if !(row < int32(DCTSIZE)) { break } col = 0 for { if !(col < int32(DCTSIZE)) { break } if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0 { v9 = float64(16) } else { v9 = float64(8) } *(*float32)(unsafe.Pointer(fdtbl + uintptr(i)*4)) = float32(libc.Float64FromFloat64(1) / (float64(*(*TUINT16)(unsafe.Pointer(qtbl + uintptr(i)*2))) * _aanscalefactor[row] * _aanscalefactor[col] * v9)) i++ goto _8 _8: ; col++ } goto _7 _7: ; row++ } *(*Tforward_DCT_ptr)(unsafe.Pointer(fdct + 4 + uintptr(ci)*4)) = __ccgo_fp(_forward_DCT_float) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NOT_COMPILED) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } goto _1 _1: ; ci++ compptr += 88 } } /* For AA&N IDCT method, divisors are equal to quantization * coefficients scaled by scalefactor[row]*scalefactor[col], where * scalefactor[0] = 1 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 * We apply a further scale factor of 8. */ var _aanscales = [64]TINT16{ 0: int16(16384), 1: int16(22725), 2: int16(21407), 3: int16(19266), 4: int16(16384), 5: int16(12873), 6: int16(8867), 7: int16(4520), 8: int16(22725), 9: int16(31521), 10: int16(29692), 11: int16(26722), 12: int16(22725), 13: int16(17855), 14: int16(12299), 15: int16(6270), 16: int16(21407), 17: int16(29692), 18: int16(27969), 19: int16(25172), 20: int16(21407), 21: int16(16819), 22: int16(11585), 23: int16(5906), 24: int16(19266), 25: int16(26722), 26: int16(25172), 27: int16(22654), 28: int16(19266), 29: int16(15137), 30: int16(10426), 31: int16(5315), 32: int16(16384), 33: int16(22725), 34: int16(21407), 35: int16(19266), 36: int16(16384), 37: int16(12873), 38: int16(8867), 39: int16(4520), 40: int16(12873), 41: int16(17855), 42: int16(16819), 43: int16(15137), 44: int16(12873), 45: int16(10114), 46: int16(6967), 47: int16(3552), 48: int16(8867), 49: int16(12299), 50: int16(11585), 51: int16(10426), 52: int16(8867), 53: int16(6967), 54: int16(4799), 55: int16(2446), 56: int16(4520), 57: int16(6270), 58: int16(5906), 59: int16(5315), 60: int16(4520), 61: int16(3552), 62: int16(2446), 63: int16(1247), } var _aanscalefactor = [8]float64{ 0: float64(1), 1: float64(1.387039845), 2: float64(1.306562965), 3: float64(1.175875602), 4: float64(1), 5: float64(0.785694958), 6: float64(0.5411961), 7: float64(0.275899379), } /* * Initialize FDCT manager. */ func Xjinit_forward_dct(tls *libc.TLS, cinfo Tj_compress_ptr) { var ci int32 var compptr uintptr var fdct Tmy_fdct_ptr _, _, _ = ci, compptr, fdct fdct = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(124)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ffdct = fdct (*Tmy_fdct_controller)(unsafe.Pointer(fdct)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_fdctmgr) ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Allocate a divisor table for each component */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdct_table = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(256)) goto _1 _1: ; ci++ compptr += 88 } } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* * Compute JPEG image dimensions and related values. * NOTE: this is exported for possible use by application. * Hence it mustn't do anything that can't be done twice. */ func Xjpeg_calc_jpeg_dimensions(tls *libc.TLS, cinfo Tj_compress_ptr) { /* Do computations that are needed before master selection phase */ /* Sanity check on input image dimensions to prevent overflow in * following calculations. * We do check jpeg_width and jpeg_height in initial_setup in jcmaster.c, * but image_width and image_height can come from arbitrary data, * and we need some space for multiplication by block_size. */ if libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)>>int32(24) != 0 || libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)>>int32(24) != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_IMAGE_TOO_BIG) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint32(libc.Uint32FromInt32(65500)) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Compute actual JPEG image dimensions and DCT scaling choices. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/1 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width * libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height * libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(1) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(1) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(2) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/2 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(2))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(2))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(2) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(2) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(3) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/3 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(3))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(3))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(3) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(3) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(4) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/4 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(4))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(4))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(4) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(4) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(5) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/5 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(5))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(5))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(5) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(5) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(6) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/6 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(6))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(6))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(6) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(6) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(7) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/7 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(7))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(7))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(7) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(7) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(8) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/8 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(8))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(8))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(8) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(8) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(9) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/9 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(9))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(9))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(9) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(9) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(10) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/10 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(10))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(10))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(10) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(10) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(11) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/11 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(11))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(11))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(11) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(11) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(12) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/12 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(12))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(12))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(12) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(12) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(13) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/13 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(13))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(13))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(13) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(13) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(14) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/14 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(14))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(14))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(14) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(14) } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num*uint32(15) >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size) { /* Provide block_size/15 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(15))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(15))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(15) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(15) } else { /* Provide block_size/16 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(16))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size, int32(16))) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(16) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(16) } } } } } } } } } } } } } } } } /* * Master selection of compression modules. * This is done once at the start of processing an image. We determine * which modules will be used and give them appropriate initialization calls. */ func Xjinit_compress_master(tls *libc.TLS, cinfo Tj_compress_ptr) { var jd_samplesperrow TJDIMENSION var samplesperrow int32 _, _ = jd_samplesperrow, samplesperrow /* For now, precision must match compiled-in value... */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision != int32(BITS_IN_JSAMPLE) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PRECISION) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Sanity check on input image dimensions */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height <= uint32(0) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width <= uint32(0) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components <= 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_EMPTY_IMAGE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Width of an input scanline must be representable as JDIMENSION. */ samplesperrow = libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width) * (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components jd_samplesperrow = libc.Uint32FromInt32(samplesperrow) if libc.Int32FromUint32(jd_samplesperrow) != samplesperrow { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_WIDTH_OVERFLOW) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Compute JPEG image dimensions and related values. */ Xjpeg_calc_jpeg_dimensions(tls, cinfo) /* Initialize master control (includes parameter checking/processing) */ Xjinit_c_master_control(tls, cinfo, int32(FALSE1)) /* Preprocessing */ if !((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fraw_data_in != 0) { Xjinit_color_converter(tls, cinfo) Xjinit_downsampler(tls, cinfo) Xjinit_c_prep_controller(tls, cinfo, int32(FALSE1)) } /* Forward DCT */ Xjinit_forward_dct(tls, cinfo) /* Entropy encoding: either Huffman or arithmetic coding. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Farith_code != 0 { Xjinit_arith_encoder(tls, cinfo) } else { Xjinit_huff_encoder(tls, cinfo) } /* Need a full-image coefficient buffer in any multi-pass mode. */ Xjinit_c_coef_controller(tls, cinfo, libc.BoolInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_scans > int32(1) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding != 0)) Xjinit_c_main_controller(tls, cinfo, int32(FALSE1)) Xjinit_marker_writer(tls, cinfo) /* We can now tell the memory manager to allocate virtual arrays. */ (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Frealize_virt_arrays})))(tls, cinfo) /* Write the datastream header (SOI) immediately. * Frame and scan headers are postponed till later. * This lets application insert special markers after the SOI. */ (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_file_header})))(tls, cinfo) } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Note: currently, there is no operating mode in which a full-image buffer * is needed at this step. If there were, that mode could not be used with * "raw data" input, since this module is bypassed in that case. However, * we've left the code here for possible use in special applications. */ /* Private buffer controller object */ type Tmy_main_controller = struct { Fpub Tjpeg_c_main_controller Fcur_iMCU_row TJDIMENSION Frowgroup_ctr TJDIMENSION Fsuspended Tboolean Fpass_mode TJ_BUF_MODE Fbuffer [10]TJSAMPARRAY } type Tmy_main_ptr = uintptr /* * Initialize for a processing pass. */ func _start_pass_main(tls *libc.TLS, cinfo Tj_compress_ptr, pass_mode TJ_BUF_MODE) { var mainp Tmy_main_ptr _ = mainp mainp = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmain1 /* Do nothing in raw-data mode. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fraw_data_in != 0 { return } (*Tmy_main_controller)(unsafe.Pointer(mainp)).Fcur_iMCU_row = uint32(0) /* initialize counters */ (*Tmy_main_controller)(unsafe.Pointer(mainp)).Frowgroup_ctr = uint32(0) (*Tmy_main_controller)(unsafe.Pointer(mainp)).Fsuspended = int32(FALSE1) (*Tmy_main_controller)(unsafe.Pointer(mainp)).Fpass_mode = pass_mode /* save mode for use by process_data */ switch pass_mode { case int32(JBUF_PASS_THRU): (*Tmy_main_controller)(unsafe.Pointer(mainp)).Fpub.Fprocess_data = __ccgo_fp(_process_data_simple_main) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) break } } /* * Process some data. * This routine handles the simple pass-through mode, * where we have only a strip buffer. */ func _process_data_simple_main(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPARRAY, in_row_ctr uintptr, in_rows_avail TJDIMENSION) { var mainp Tmy_main_ptr _ = mainp mainp = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmain1 for (*Tmy_main_controller)(unsafe.Pointer(mainp)).Fcur_iMCU_row < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows { /* Read input data if we haven't filled the main buffer yet */ if (*Tmy_main_controller)(unsafe.Pointer(mainp)).Frowgroup_ctr < libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size) { (*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPARRAY, uintptr, TJDIMENSION, TJSAMPIMAGE, uintptr, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_c_prep_controller)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprep)).Fpre_process_data})))(tls, cinfo, input_buf, in_row_ctr, in_rows_avail, mainp+24, mainp+12, libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size)) } /* If we don't have a full iMCU row buffered, return to application for * more data. Note that preprocessor will always pad to fill the iMCU row * at the bottom of the image. */ if (*Tmy_main_controller)(unsafe.Pointer(mainp)).Frowgroup_ctr != libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size) { return } /* Send the completed row to the compressor */ if !((*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPIMAGE) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_c_coef_controller)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fcompress_data})))(tls, cinfo, mainp+24) != 0) { /* If compressor did not consume the whole row, then we must need to * suspend processing and return to the application. In this situation * we pretend we didn't yet consume the last input row; otherwise, if * it happened to be the last row of the image, the application would * think we were done. */ if !((*Tmy_main_controller)(unsafe.Pointer(mainp)).Fsuspended != 0) { *(*TJDIMENSION)(unsafe.Pointer(in_row_ctr))-- (*Tmy_main_controller)(unsafe.Pointer(mainp)).Fsuspended = int32(TRUE1) } return } /* We did finish the row. Undo our little suspension hack if a previous * call suspended; then mark the main buffer empty. */ if (*Tmy_main_controller)(unsafe.Pointer(mainp)).Fsuspended != 0 { *(*TJDIMENSION)(unsafe.Pointer(in_row_ctr))++ (*Tmy_main_controller)(unsafe.Pointer(mainp)).Fsuspended = int32(FALSE1) } (*Tmy_main_controller)(unsafe.Pointer(mainp)).Frowgroup_ctr = uint32(0) (*Tmy_main_controller)(unsafe.Pointer(mainp)).Fcur_iMCU_row++ } } /* * Initialize main buffer controller. */ func Xjinit_c_main_controller(tls *libc.TLS, cinfo Tj_compress_ptr, need_full_buffer Tboolean) { var ci int32 var compptr uintptr var mainp Tmy_main_ptr _, _, _ = ci, compptr, mainp mainp = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(64)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmain1 = mainp (*Tmy_main_controller)(unsafe.Pointer(mainp)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_main) /* We don't need to create a buffer in raw-data mode. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fraw_data_in != 0 { return } /* Create the buffer. It holds downsampled data, so each component * may be of a different size. */ if need_full_buffer != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } else { /* Allocate a strip buffer for each component */ ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } *(*TJSAMPARRAY)(unsafe.Pointer(mainp + 24 + uintptr(ci)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks*libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size), libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size)) goto _1 _1: ; ci++ compptr += 88 } } } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ type TJPEG_MARKER = int32 const /* JPEG marker codes */ M_SOF0 = 192 const M_SOF1 = 193 const M_SOF2 = 194 const M_SOF3 = 195 const M_SOF5 = 197 const M_SOF6 = 198 const M_SOF7 = 199 const M_JPG = 200 const M_SOF9 = 201 const M_SOF10 = 202 const M_SOF11 = 203 const M_SOF13 = 205 const M_SOF14 = 206 const M_SOF15 = 207 const M_DHT = 196 const M_DAC = 204 const M_RST0 = 208 const M_RST1 = 209 const M_RST2 = 210 const M_RST3 = 211 const M_RST4 = 212 const M_RST5 = 213 const M_RST6 = 214 const M_RST7 = 215 const M_SOI = 216 const M_EOI = 217 const M_SOS = 218 const M_DQT = 219 const M_DNL = 220 const M_DRI = 221 const M_DHP = 222 const M_EXP = 223 const M_APP0 = 224 const M_APP1 = 225 const M_APP2 = 226 const M_APP3 = 227 const M_APP4 = 228 const M_APP5 = 229 const M_APP6 = 230 const M_APP7 = 231 const M_APP8 = 232 const M_APP9 = 233 const M_APP10 = 234 const M_APP11 = 235 const M_APP12 = 236 const M_APP13 = 237 const M_APP14 = 238 const M_APP15 = 239 const M_JPG0 = 240 const M_JPG8 = 248 const M_JPG13 = 253 const M_COM = 254 const M_TEM = 1 const M_ERROR = 256 /* Private state */ type Tmy_marker_writer = struct { Fpub Tjpeg_marker_writer Flast_restart_interval uint32 } type Tmy_marker_ptr = uintptr /* * Basic output routines. * * Note that we do not support suspension while writing a marker. * Therefore, an application using suspension must ensure that there is * enough buffer space for the initial markers (typ. 600-700 bytes) before * calling jpeg_start_compress, and enough space to write the trailing EOI * (a few bytes) before calling jpeg_finish_compress. Multipass compression * modes are not supported at all with suspension, so those two are the only * points where markers will be written. */ func _emit_byte1(tls *libc.TLS, cinfo Tj_compress_ptr, val int32) { /* Emit a byte */ var dest, v1, v2, v4 uintptr var v3 Tsize_t _, _, _, _, _ = dest, v1, v2, v3, v4 dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest v2 = dest v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ *(*TJOCTET)(unsafe.Pointer(v1)) = libc.Uint8FromInt32(val) v4 = dest + 4 *(*Tsize_t)(unsafe.Pointer(v4))-- v3 = *(*Tsize_t)(unsafe.Pointer(v4)) if v3 == uint32(0) { if !((*(*func(*libc.TLS, Tj_compress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_destination_mgr)(unsafe.Pointer(dest)).Fempty_output_buffer})))(tls, cinfo) != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CANT_SUSPEND) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } } func _emit_marker(tls *libc.TLS, cinfo Tj_compress_ptr, mark TJPEG_MARKER) { /* Emit a marker code */ _emit_byte1(tls, cinfo, int32(0xFF)) _emit_byte1(tls, cinfo, mark) } func _emit_2bytes(tls *libc.TLS, cinfo Tj_compress_ptr, value int32) { /* Emit a 2-byte integer; these are always MSB first in JPEG files */ _emit_byte1(tls, cinfo, value>>int32(8)&int32(0xFF)) _emit_byte1(tls, cinfo, value&int32(0xFF)) } /* * Routines to write specific marker types. */ func _emit_dqt(tls *libc.TLS, cinfo Tj_compress_ptr, index int32) (r int32) { /* Emit a DQT marker */ /* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */ var i, prec, v2 int32 var qtbl uintptr var qval uint32 _, _, _, _, _ = i, prec, qtbl, qval, v2 qtbl = *(*uintptr)(unsafe.Pointer(cinfo + 88 + uintptr(index)*4)) if qtbl == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_QUANT_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = index (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } prec = 0 i = 0 for { if !(i <= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se) { break } if libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(qtbl + uintptr(*(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order + uintptr(i)*4)))*2))) > int32(255) { prec = int32(1) } goto _1 _1: ; i++ } if !((*TJQUANT_TBL)(unsafe.Pointer(qtbl)).Fsent_table != 0) { _emit_marker(tls, cinfo, int32(M_DQT)) if prec != 0 { v2 = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se*int32(2) + int32(2) + int32(1) + int32(2) } else { v2 = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se + int32(1) + int32(1) + int32(2) } _emit_2bytes(tls, cinfo, v2) _emit_byte1(tls, cinfo, index+prec<>libc.Int32FromInt32(8))) } _emit_byte1(tls, cinfo, libc.Int32FromUint32(qval&libc.Uint32FromInt32(0xFF))) goto _3 _3: ; i++ } (*TJQUANT_TBL)(unsafe.Pointer(qtbl)).Fsent_table = int32(TRUE1) } return prec } func _emit_dht(tls *libc.TLS, cinfo Tj_compress_ptr, index int32, is_ac Tboolean) { /* Emit a DHT marker */ var htbl uintptr var i, length int32 _, _, _ = htbl, i, length if is_ac != 0 { htbl = *(*uintptr)(unsafe.Pointer(cinfo + 136 + uintptr(index)*4)) index += int32(0x10) /* output index has AC bit set */ } else { htbl = *(*uintptr)(unsafe.Pointer(cinfo + 120 + uintptr(index)*4)) } if htbl == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_HUFF_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = index (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if !((*TJHUFF_TBL)(unsafe.Pointer(htbl)).Fsent_table != 0) { _emit_marker(tls, cinfo, int32(M_DHT)) length = 0 i = int32(1) for { if !(i <= int32(16)) { break } length += libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + uintptr(i)))) goto _1 _1: ; i++ } _emit_2bytes(tls, cinfo, length+int32(2)+int32(1)+int32(16)) _emit_byte1(tls, cinfo, index) i = int32(1) for { if !(i <= int32(16)) { break } _emit_byte1(tls, cinfo, libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + uintptr(i))))) goto _2 _2: ; i++ } i = 0 for { if !(i < length) { break } _emit_byte1(tls, cinfo, libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + 17 + uintptr(i))))) goto _3 _3: ; i++ } (*TJHUFF_TBL)(unsafe.Pointer(htbl)).Fsent_table = int32(TRUE1) } } func _emit_dac(tls *libc.TLS, cinfo Tj_compress_ptr) { /* Emit a DAC marker */ /* Since the useful info is so small, we want to emit all the tables in */ /* one DAC marker. Therefore this routine does its own scan of the table. */ var ac_in_use, dc_in_use [16]uint8 var compptr uintptr var i, length int32 var v2 uint8 _, _, _, _, _, _ = ac_in_use, compptr, dc_in_use, i, length, v2 i = 0 for { if !(i < int32(NUM_ARITH_TBLS)) { break } v2 = libc.Uint8FromInt32(0) ac_in_use[i] = v2 dc_in_use[i] = v2 goto _1 _1: ; i++ } i = 0 for { if !(i < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(i)*4)) /* DC needs no table for refinement scan */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs == 0 && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { dc_in_use[(*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no] = uint8(1) } /* AC needs no table when not present */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe != 0 { ac_in_use[(*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no] = uint8(1) } goto _3 _3: ; i++ } length = 0 i = 0 for { if !(i < int32(NUM_ARITH_TBLS)) { break } length += libc.Int32FromUint8(dc_in_use[i]) + libc.Int32FromUint8(ac_in_use[i]) goto _4 _4: ; i++ } if length != 0 { _emit_marker(tls, cinfo, int32(M_DAC)) _emit_2bytes(tls, cinfo, length*int32(2)+int32(2)) i = 0 for { if !(i < int32(NUM_ARITH_TBLS)) { break } if dc_in_use[i] != 0 { _emit_byte1(tls, cinfo, i) _emit_byte1(tls, cinfo, libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 152 + uintptr(i))))+libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 168 + uintptr(i))))< int32(65535) || libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width) > int32(65535) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_IMAGE_TOO_BIG) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint32(libc.Uint32FromInt32(65535)) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } _emit_byte1(tls, cinfo, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision) _emit_2bytes(tls, cinfo, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height)) _emit_2bytes(tls, cinfo, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width)) _emit_byte1(tls, cinfo, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } _emit_byte1(tls, cinfo, (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id) _emit_byte1(tls, cinfo, (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor< libc.Uint32FromInt32(65533) { /* safety check */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_LENGTH) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } _emit_marker(tls, cinfo, marker) _emit_2bytes(tls, cinfo, libc.Int32FromUint32(datalen+libc.Uint32FromInt32(2))) /* total length */ } func _write_marker_byte(tls *libc.TLS, cinfo Tj_compress_ptr, val int32) { /* Emit one byte of marker parameters following write_marker_header */ _emit_byte1(tls, cinfo, val) } /* * Write datastream header. * This consists of an SOI and optional APPn markers. * We recommend use of the JFIF marker, but not the Adobe marker, * when using YCbCr or grayscale data. The JFIF marker is also used * for other standard JPEG colorspaces. The Adobe marker is helpful * to distinguish RGB, CMYK, and YCCK colorspaces. * Note that an application can write additional header markers after * jpeg_start_compress returns. */ func _write_file_header(tls *libc.TLS, cinfo Tj_compress_ptr) { var marker Tmy_marker_ptr _ = marker marker = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker _emit_marker(tls, cinfo, int32(M_SOI)) /* first the SOI */ /* SOI is defined to reset restart interval to 0 */ (*Tmy_marker_writer)(unsafe.Pointer(marker)).Flast_restart_interval = uint32(0) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_JFIF_header != 0 { /* next an optional JFIF APP0 */ _emit_jfif_app0(tls, cinfo) } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_Adobe_marker != 0 { /* next an optional Adobe APP14 */ _emit_adobe_app14(tls, cinfo) } } /* * Write frame header. * This consists of DQT and SOFn markers, * a conditional LSE marker and a conditional pseudo SOS marker. * Note that we do not emit the SOF until we have emitted the DQT(s). * This avoids compatibility problems with incorrect implementations that * try to error-check the quant table numbers as soon as they see the SOF. */ func _write_frame_header(tls *libc.TLS, cinfo Tj_compress_ptr) { var ci, prec int32 var compptr uintptr var is_baseline Tboolean _, _, _, _ = ci, compptr, is_baseline, prec /* Emit DQT for each quantization table. * Note that emit_dqt() suppresses any duplicate tables. */ prec = 0 ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } prec += _emit_dqt(tls, cinfo, (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no) goto _1 _1: ; ci++ compptr += 88 } /* now prec is nonzero iff there are any 16-bit quant tables. */ /* Check for a non-baseline specification. * Note we assume that Huffman table numbers won't be changed later. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Farith_code != 0 || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision != int32(8) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size != int32(DCTSIZE) { is_baseline = int32(FALSE1) } else { is_baseline = int32(TRUE1) ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no > int32(1) || (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no > int32(1) { is_baseline = int32(FALSE1) } goto _2 _2: ; ci++ compptr += 88 } if prec != 0 && is_baseline != 0 { is_baseline = int32(FALSE1) /* If it's baseline except for quantizer size, warn the user */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_16BIT_TABLES) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, 0) } } /* Emit the proper SOF marker */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Farith_code != 0 { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { _emit_sof(tls, cinfo, int32(M_SOF10)) } else { _emit_sof(tls, cinfo, int32(M_SOF9)) } /* SOF code for sequential arithmetic */ } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { _emit_sof(tls, cinfo, int32(M_SOF2)) } else { if is_baseline != 0 { _emit_sof(tls, cinfo, int32(M_SOF0)) } else { _emit_sof(tls, cinfo, int32(M_SOF1)) } } /* SOF code for non-baseline Huffman file */ } /* Check to emit LSE inverse color transform specification marker */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform != 0 { _emit_lse_ict(tls, cinfo) } /* Check to emit pseudo SOS marker */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size != int32(DCTSIZE) { _emit_pseudo_sos(tls, cinfo) } } /* * Write scan header. * This consists of DHT or DAC markers, optional DRI, and SOS. * Compressed data will be written following the SOS. */ func _write_scan_header(tls *libc.TLS, cinfo Tj_compress_ptr) { var compptr uintptr var i int32 var marker Tmy_marker_ptr _, _, _ = compptr, i, marker marker = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Farith_code != 0 { /* Emit arith conditioning info. We may have some duplication * if the file has multiple scans, but it's so small it's hardly * worth worrying about. */ _emit_dac(tls, cinfo) } else { /* Emit Huffman tables. * Note that emit_dht() suppresses any duplicate tables. */ i = 0 for { if !(i < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(i)*4)) /* DC needs no table for refinement scan */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs == 0 && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { _emit_dht(tls, cinfo, (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no, int32(FALSE1)) } /* AC needs no table when not present */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe != 0 { _emit_dht(tls, cinfo, (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no, int32(TRUE1)) } goto _1 _1: ; i++ } } /* Emit DRI if required --- note that DRI value could change for each scan. * We avoid wasting space with unnecessary DRIs, however. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != (*Tmy_marker_writer)(unsafe.Pointer(marker)).Flast_restart_interval { _emit_dri(tls, cinfo) (*Tmy_marker_writer)(unsafe.Pointer(marker)).Flast_restart_interval = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval } _emit_sos(tls, cinfo) } /* * Write datastream trailer. */ func _write_file_trailer(tls *libc.TLS, cinfo Tj_compress_ptr) { _emit_marker(tls, cinfo, int32(M_EOI)) } /* * Write an abbreviated table-specification datastream. * This consists of SOI, DQT and DHT tables, and EOI. * Any table that is defined and not marked sent_table = TRUE will be * emitted. Note that all tables will be marked sent_table = TRUE at exit. */ func _write_tables_only(tls *libc.TLS, cinfo Tj_compress_ptr) { var i int32 _ = i _emit_marker(tls, cinfo, int32(M_SOI)) i = 0 for { if !(i < int32(NUM_QUANT_TBLS)) { break } if *(*uintptr)(unsafe.Pointer(cinfo + 88 + uintptr(i)*4)) != libc.UintptrFromInt32(0) { _emit_dqt(tls, cinfo, i) } goto _1 _1: ; i++ } if !((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Farith_code != 0) { i = 0 for { if !(i < int32(NUM_HUFF_TBLS)) { break } if *(*uintptr)(unsafe.Pointer(cinfo + 120 + uintptr(i)*4)) != libc.UintptrFromInt32(0) { _emit_dht(tls, cinfo, i, int32(FALSE1)) } if *(*uintptr)(unsafe.Pointer(cinfo + 136 + uintptr(i)*4)) != libc.UintptrFromInt32(0) { _emit_dht(tls, cinfo, i, int32(TRUE1)) } goto _2 _2: ; i++ } } _emit_marker(tls, cinfo, int32(M_EOI)) } /* * Initialize the marker writer module. */ func Xjinit_marker_writer(tls *libc.TLS, cinfo Tj_compress_ptr) { var marker Tmy_marker_ptr _ = marker /* Create the subobject */ marker = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(32)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker = marker /* Initialize method pointers */ (*Tmy_marker_writer)(unsafe.Pointer(marker)).Fpub.Fwrite_file_header = __ccgo_fp(_write_file_header) (*Tmy_marker_writer)(unsafe.Pointer(marker)).Fpub.Fwrite_frame_header = __ccgo_fp(_write_frame_header) (*Tmy_marker_writer)(unsafe.Pointer(marker)).Fpub.Fwrite_scan_header = __ccgo_fp(_write_scan_header) (*Tmy_marker_writer)(unsafe.Pointer(marker)).Fpub.Fwrite_file_trailer = __ccgo_fp(_write_file_trailer) (*Tmy_marker_writer)(unsafe.Pointer(marker)).Fpub.Fwrite_tables_only = __ccgo_fp(_write_tables_only) (*Tmy_marker_writer)(unsafe.Pointer(marker)).Fpub.Fwrite_marker_header = __ccgo_fp(_write_marker_header) (*Tmy_marker_writer)(unsafe.Pointer(marker)).Fpub.Fwrite_marker_byte = __ccgo_fp(_write_marker_byte) /* Initialize private state */ (*Tmy_marker_writer)(unsafe.Pointer(marker)).Flast_restart_interval = uint32(0) } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Private state */ type Tc_pass_type = int32 const main_pass = 0 const /* input data, also do first output step */ huff_opt_pass = 1 const /* Huffman code optimization pass */ output_pass = 2 type Tmy_comp_master = struct { Fpub Tjpeg_comp_master Fpass_type Tc_pass_type Fpass_number int32 Ftotal_passes int32 Fscan_number int32 } type Tmy_master_ptr = uintptr /* * Support routines that do various essential calculations. */ func _initial_setup(tls *libc.TLS, cinfo Tj_compress_ptr) { /* Do computations that are needed before master selection phase */ var ci, ssize, v1, v3, v4, v6, v7 int32 var compptr uintptr _, _, _, _, _, _, _, _ = ci, compptr, ssize, v1, v3, v4, v6, v7 /* Sanity check on block_size */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size < int32(1) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size > int32(16) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_DCTSIZE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Derive natural_order from block_size */ switch (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size { case int32(2): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order2)) case int32(3): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order3)) case int32(4): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order4)) case int32(5): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order5)) case int32(6): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order6)) case int32(7): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order7)) default: (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) } /* Derive lim_Se from block_size */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size < int32(DCTSIZE) { v1 = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size - int32(1) } else { v1 = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se = v1 /* Sanity check on image dimensions */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height <= uint32(0) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width <= uint32(0) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components <= 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_EMPTY_IMAGE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Make sure image isn't bigger than I can handle */ if libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height) > libc.Int32FromInt32(65500) || libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width) > libc.Int32FromInt32(65500) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_IMAGE_TOO_BIG) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint32(libc.Uint32FromInt32(65500)) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Only 8 to 12 bits data precision are supported for DCT based JPEG */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision < int32(8) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision > int32(12) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PRECISION) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Check that number of components won't exceed internal array sizes */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components > int32(MAX_COMPONENTS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_COMPONENT_COUNT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = int32(MAX_COMPONENTS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Compute maximum sampling factors; check factor validity */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor = int32(1) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor = int32(1) ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor <= 0 || (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor > int32(MAX_SAMP_FACTOR) || (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor <= 0 || (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor > int32(MAX_SAMP_FACTOR) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_SAMPLING) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor > (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor { v3 = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor } else { v3 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor = v3 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor > (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor { v4 = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor } else { v4 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor = v4 goto _2 _2: ; ci++ compptr += 88 } /* Compute dimensions of components */ ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Fill in the correct component_index value; don't rely on application */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index = ci /* In selecting the actual DCT scaling for each component, we try to * scale down the chroma components via DCT scaling rather than downsampling. * This saves time if the downsampler gets to use 1:1 scaling. * Note this code adapts subsampling ratios which are powers of 2. */ ssize = int32(1) if !((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fraw_data_in != 0) { for { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdo_fancy_downsampling != 0 { v6 = int32(DCTSIZE) } else { v6 = libc.Int32FromInt32(DCTSIZE) / libc.Int32FromInt32(2) } if !((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size*ssize <= v6 && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor%((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor*ssize*int32(2)) == 0) { break } ssize = ssize * int32(2) } } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size * ssize ssize = int32(1) if !((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fraw_data_in != 0) { for { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdo_fancy_downsampling != 0 { v7 = int32(DCTSIZE) } else { v7 = libc.Int32FromInt32(DCTSIZE) / libc.Int32FromInt32(2) } if !((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size*ssize <= v7 && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor%((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor*ssize*int32(2)) == 0) { break } ssize = ssize * int32(2) } } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size * ssize /* We don't support DCT ratios larger than 2. */ if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size > (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size*int32(2) { (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size * int32(2) } else { if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size > (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size*int32(2) { (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size * int32(2) } } /* Size in DCT blocks */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width)*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height)*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) /* Size in samples */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdownsampled_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width)*((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size), (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdownsampled_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height)*((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size), (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) /* Don't need quantization scale after DCT, * until color conversion says otherwise. */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed = int32(FALSE1) goto _5 _5: ; ci++ compptr += 88 } /* Compute number of fully interleaved MCU rows (number of times that * main controller will call coefficient controller). */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_height), (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) } func _validate_script(tls *libc.TLS, cinfo Tj_compress_ptr) { bp := tls.Alloc(2560) defer tls.Free(2560) /* Verify that the scan script in cinfo->scan_info[] is valid; also * determine whether it uses progressive JPEG, and set cinfo->progressive_mode. */ var Ah, Al, Se, Ss, ci, coefi, ncomps, scanno, thisi, v7, v9 int32 var component_sent [10]Tboolean var last_bitpos_ptr, scanptr, v3 uintptr var v10, v8 bool var _ /* last_bitpos at bp+0 */ [10][64]int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Ah, Al, Se, Ss, ci, coefi, component_sent, last_bitpos_ptr, ncomps, scanno, scanptr, thisi, v10, v3, v7, v8, v9 /* -1 until that coefficient has been seen; then last Al for it */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_scans <= 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_SCAN_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = 0 (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1; * for progressive JPEG, no scan can have this. */ scanptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscan_info if (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSs != 0 || (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSe != libc.Int32FromInt32(DCTSIZE2)-libc.Int32FromInt32(1) { (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode = int32(TRUE1) last_bitpos_ptr = bp ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } coefi = 0 for { if !(coefi < int32(DCTSIZE2)) { break } v3 = last_bitpos_ptr last_bitpos_ptr += 4 *(*int32)(unsafe.Pointer(v3)) = -int32(1) goto _2 _2: ; coefi++ } goto _1 _1: ; ci++ } } else { (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode = int32(FALSE1) ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } component_sent[ci] = int32(FALSE1) goto _4 _4: ; ci++ } } scanno = int32(1) for { if !(scanno <= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_scans) { break } /* Validate component indexes */ ncomps = (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).Fcomps_in_scan if ncomps <= 0 || ncomps > int32(MAX_COMPS_IN_SCAN) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_COMPONENT_COUNT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = ncomps *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = int32(MAX_COMPS_IN_SCAN) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } ci = 0 for { if !(ci < ncomps) { break } thisi = *(*int32)(unsafe.Pointer(scanptr + 4 + uintptr(ci)*4)) if thisi < 0 || thisi >= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_SCAN_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = scanno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Components must appear in SOF order within each scan */ if ci > 0 && thisi <= *(*int32)(unsafe.Pointer(scanptr + 4 + uintptr(ci-int32(1))*4)) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_SCAN_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = scanno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } goto _6 _6: ; ci++ } /* Validate progression parameters */ Ss = (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSs Se = (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSe Ah = (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FAh Al = (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FAl if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { /* The JPEG spec simply gives the ranges 0..13 for Ah and Al, but that * seems wrong: the upper bound ought to depend on data precision. * Perhaps they really meant 0..N+1 for N-bit precision. * Here we allow 0..10 for 8-bit data; Al larger than 10 results in * out-of-range reconstructed DC values during the first DC scan, * which might cause problems for some decoders. */ if v8 = Ss < 0 || Ss >= int32(DCTSIZE2) || Se < Ss || Se >= int32(DCTSIZE2) || Ah < 0; !v8 { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision > int32(8) { v7 = int32(13) } else { v7 = int32(10) } } if v10 = v8 || Ah > v7 || Al < 0; !v10 { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision > int32(8) { v9 = int32(13) } else { v9 = int32(10) } } if v10 || Al > v9 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PROG_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = scanno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if Ss == 0 { if Se != 0 { /* DC and AC together not OK */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PROG_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = scanno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } else { if ncomps != int32(1) { /* AC scans must be for only one component */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PROG_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = scanno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } ci = 0 for { if !(ci < ncomps) { break } last_bitpos_ptr = bp + uintptr(*(*int32)(unsafe.Pointer(scanptr + 4 + uintptr(ci)*4)))*256 if Ss != 0 && *(*int32)(unsafe.Pointer(last_bitpos_ptr)) < 0 { /* AC without prior DC scan */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PROG_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = scanno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } coefi = Ss for { if !(coefi <= Se) { break } if *(*int32)(unsafe.Pointer(last_bitpos_ptr + uintptr(coefi)*4)) < 0 { /* first scan of this coefficient */ if Ah != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PROG_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = scanno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } else { /* not first scan */ if Ah != *(*int32)(unsafe.Pointer(last_bitpos_ptr + uintptr(coefi)*4)) || Al != Ah-int32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PROG_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = scanno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } *(*int32)(unsafe.Pointer(last_bitpos_ptr + uintptr(coefi)*4)) = Al goto _12 _12: ; coefi++ } goto _11 _11: ; ci++ } } else { /* For sequential JPEG, all progression parameters must be these: */ if Ss != 0 || Se != libc.Int32FromInt32(DCTSIZE2)-libc.Int32FromInt32(1) || Ah != 0 || Al != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PROG_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = scanno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Make sure components are not sent twice */ ci = 0 for { if !(ci < ncomps) { break } thisi = *(*int32)(unsafe.Pointer(scanptr + 4 + uintptr(ci)*4)) if component_sent[thisi] != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_SCAN_SCRIPT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = scanno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } component_sent[thisi] = int32(TRUE1) goto _13 _13: ; ci++ } } goto _5 _5: ; scanptr += 36 scanno++ } /* Now verify that everything got sent. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { /* For progressive mode, we only check that at least some DC data * got sent for each component; the spec does not require that all bits * of all coefficients be transmitted. Would it be wiser to enforce * transmission of all coefficient bits?? */ ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if *(*int32)(unsafe.Pointer(bp + uintptr(ci)*256)) < 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_MISSING_DATA) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } goto _14 _14: ; ci++ } } else { ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if !(component_sent[ci] != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_MISSING_DATA) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } goto _15 _15: ; ci++ } } } func _reduce_script(tls *libc.TLS, cinfo Tj_compress_ptr) { /* Adapt scan script for use with reduced block size; * assume that script has been validated before. */ var idxin, idxout int32 var scanptr uintptr _, _, _ = idxin, idxout, scanptr /* Circumvent const declaration for this function */ scanptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscan_info idxout = 0 idxin = 0 for { if !(idxin < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_scans) { break } /* After skipping, idxout becomes smaller than idxin */ if idxin != idxout { /* Copy rest of data; * note we stay in given chunk of allocated memory. */ *(*Tjpeg_scan_info)(unsafe.Pointer(scanptr + uintptr(idxout)*36)) = *(*Tjpeg_scan_info)(unsafe.Pointer(scanptr + uintptr(idxin)*36)) } if (*(*Tjpeg_scan_info)(unsafe.Pointer(scanptr + uintptr(idxout)*36))).FSs > (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se { /* Entire scan out of range - skip this entry */ goto _1 } if (*(*Tjpeg_scan_info)(unsafe.Pointer(scanptr + uintptr(idxout)*36))).FSe > (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se { /* Limit scan to end of block */ (*(*Tjpeg_scan_info)(unsafe.Pointer(scanptr + uintptr(idxout)*36))).FSe = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se } idxout++ goto _1 _1: ; idxin++ } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_scans = idxout } func _select_scan_parameters(tls *libc.TLS, cinfo Tj_compress_ptr) { /* Set up the scan parameters for the current scan */ var ci int32 var master Tmy_master_ptr var scanptr uintptr _, _, _ = ci, master, scanptr if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscan_info != libc.UintptrFromInt32(0) { /* Prepare for current scan --- the script is already validated */ master = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster scanptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscan_info + uintptr((*Tmy_comp_master)(unsafe.Pointer(master)).Fscan_number)*36 (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan = (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).Fcomps_in_scan ci = 0 for { if !(ci < (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).Fcomps_in_scan) { break } *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + uintptr(*(*int32)(unsafe.Pointer(scanptr + 4 + uintptr(ci)*4)))*88 goto _1 _1: ; ci++ } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs = (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSs (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe = (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSe (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh = (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FAh (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl = (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FAl return } } else { /* Prepare for single sequential-JPEG scan containing all components */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components > int32(MAX_COMPS_IN_SCAN) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_COMPONENT_COUNT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = int32(MAX_COMPS_IN_SCAN) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + uintptr(ci)*88 goto _2 _2: ; ci++ } } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs = 0 (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size - int32(1) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh = 0 (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl = 0 } func _per_scan_setup(tls *libc.TLS, cinfo Tj_compress_ptr) { /* Do computations that are needed before processing a JPEG scan */ /* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */ var ci, mcublks, nominal, tmp, v2, v3, v5 int32 var compptr, v4 uintptr _, _, _, _, _, _, _, _, _ = ci, compptr, mcublks, nominal, tmp, v2, v3, v4, v5 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan == int32(1) { /* Noninterleaved (single-component) scan */ compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296)) /* Overall image size in MCUs */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FMCUs_per_row = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FMCU_rows_in_scan = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks /* For noninterleaved scan, always one block per MCU */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_blocks = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_sample_width = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_col_width = int32(1) /* For noninterleaved scans, it is convenient to define last_row_height * as the number of block rows present in the last iMCU row. */ tmp = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks % libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor)) if tmp == 0 { tmp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_row_height = tmp /* Prepare array describing MCU composition */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU = int32(1) *(*int32)(unsafe.Pointer(cinfo + 324)) = 0 } else { /* Interleaved (multi-component) scan */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan <= 0 || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan > int32(MAX_COMPS_IN_SCAN) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_COMPONENT_COUNT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = int32(MAX_COMPS_IN_SCAN) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Overall image size in MCUs */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FMCUs_per_row = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_width), (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FMCU_rows_in_scan = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU = 0 ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) /* Sampling factors give # of blocks of component in each MCU */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_blocks = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_sample_width = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size /* Figure number of non-dummy blocks in last MCU column & row */ tmp = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks % libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width)) if tmp == 0 { tmp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_col_width = tmp tmp = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks % libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height)) if tmp == 0 { tmp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_row_height = tmp /* Prepare array describing MCU composition */ mcublks = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_blocks if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU+mcublks > int32(C_MAX_BLOCKS_IN_MCU) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_MCU_SIZE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } for { v2 = mcublks mcublks-- if !(v2 > 0) { break } v4 = cinfo + 320 v3 = *(*int32)(unsafe.Pointer(v4)) *(*int32)(unsafe.Pointer(v4))++ *(*int32)(unsafe.Pointer(cinfo + 324 + uintptr(v3)*4)) = ci } goto _1 _1: ; ci++ } } /* Convert restart specified in rows to actual MCU count. */ /* Note that count must fit in 16 bits, so we provide limiting. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_in_rows > 0 { nominal = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_in_rows * libc.Int32FromUint32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FMCUs_per_row) if nominal < int32(65535) { v5 = nominal } else { v5 = int32(65535) } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval = libc.Uint32FromInt32(v5) } } /* * Per-pass setup. * This is called at the beginning of each pass. We determine which modules * will be active during this pass and give them appropriate start_pass calls. * We also set is_last_pass to indicate whether any more passes will be * required. */ func _prepare_for_pass(tls *libc.TLS, cinfo Tj_compress_ptr) { var master Tmy_master_ptr var v1 int32 _, _ = master, v1 master = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster switch (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_type { case int32(main_pass): /* Initial pass: will collect input data, and do either Huffman * optimization or data output for the first scan. */ _select_scan_parameters(tls, cinfo) _per_scan_setup(tls, cinfo) if !((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fraw_data_in != 0) { (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_color_converter)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcconvert)).Fstart_pass})))(tls, cinfo) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_downsampler)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdownsample)).Fstart_pass})))(tls, cinfo) (*(*func(*libc.TLS, Tj_compress_ptr, TJ_BUF_MODE))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_c_prep_controller)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprep)).Fstart_pass})))(tls, cinfo, int32(JBUF_PASS_THRU)) } (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_forward_dct)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ffdct)).Fstart_pass})))(tls, cinfo) (*(*func(*libc.TLS, Tj_compress_ptr, Tboolean))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_encoder)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Fstart_pass})))(tls, cinfo, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding) if (*Tmy_comp_master)(unsafe.Pointer(master)).Ftotal_passes > int32(1) { v1 = int32(JBUF_SAVE_AND_PASS) } else { v1 = int32(JBUF_PASS_THRU) } (*(*func(*libc.TLS, Tj_compress_ptr, TJ_BUF_MODE))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_c_coef_controller)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fstart_pass})))(tls, cinfo, v1) (*(*func(*libc.TLS, Tj_compress_ptr, TJ_BUF_MODE))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_c_main_controller)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmain1)).Fstart_pass})))(tls, cinfo, int32(JBUF_PASS_THRU)) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding != 0 { /* No immediate data output; postpone writing frame/scan headers */ (*Tmy_comp_master)(unsafe.Pointer(master)).Fpub.Fcall_pass_startup = int32(FALSE1) } else { /* Will write frame/scan headers at first jpeg_write_scanlines call */ (*Tmy_comp_master)(unsafe.Pointer(master)).Fpub.Fcall_pass_startup = int32(TRUE1) } case int32(huff_opt_pass): /* Do Huffman optimization for a scan after the first one. */ _select_scan_parameters(tls, cinfo) _per_scan_setup(tls, cinfo) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs != 0 || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { (*(*func(*libc.TLS, Tj_compress_ptr, Tboolean))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_encoder)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Fstart_pass})))(tls, cinfo, int32(TRUE1)) (*(*func(*libc.TLS, Tj_compress_ptr, TJ_BUF_MODE))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_c_coef_controller)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fstart_pass})))(tls, cinfo, int32(JBUF_CRANK_DEST)) (*Tmy_comp_master)(unsafe.Pointer(master)).Fpub.Fcall_pass_startup = int32(FALSE1) break } /* Special case: Huffman DC refinement scans need no Huffman table * and therefore we can skip the optimization pass for them. */ (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_type = int32(output_pass) (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_number++ /*FALLTHROUGH*/ fallthrough case int32(output_pass): /* Do a data-output pass. */ /* We need not repeat per-scan setup if prior optimization pass did it. */ if !((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding != 0) { _select_scan_parameters(tls, cinfo) _per_scan_setup(tls, cinfo) } (*(*func(*libc.TLS, Tj_compress_ptr, Tboolean))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_encoder)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Fstart_pass})))(tls, cinfo, int32(FALSE1)) (*(*func(*libc.TLS, Tj_compress_ptr, TJ_BUF_MODE))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_c_coef_controller)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fstart_pass})))(tls, cinfo, int32(JBUF_CRANK_DEST)) /* We emit frame/scan headers now */ if (*Tmy_comp_master)(unsafe.Pointer(master)).Fscan_number == 0 { (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_frame_header})))(tls, cinfo) } (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_scan_header})))(tls, cinfo) (*Tmy_comp_master)(unsafe.Pointer(master)).Fpub.Fcall_pass_startup = int32(FALSE1) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NOT_COMPILED) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_comp_master)(unsafe.Pointer(master)).Fpub.Fis_last_pass = libc.BoolInt32((*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_number == (*Tmy_comp_master)(unsafe.Pointer(master)).Ftotal_passes-libc.Int32FromInt32(1)) /* Set up progress monitor's pass info if present */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) { (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fcompleted_passes = (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_number (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Ftotal_passes = (*Tmy_comp_master)(unsafe.Pointer(master)).Ftotal_passes } } /* * Special start-of-pass hook. * This is called by jpeg_write_scanlines if call_pass_startup is TRUE. * In single-pass processing, we need this hook because we don't want to * write frame/scan headers during jpeg_start_compress; we want to let the * application write COM markers etc. between jpeg_start_compress and the * jpeg_write_scanlines loop. * In multi-pass processing, this routine is not used. */ func _pass_startup(tls *libc.TLS, cinfo Tj_compress_ptr) { (*Tjpeg_comp_master)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fcall_pass_startup = int32(FALSE1) /* reset flag so call only once */ (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_frame_header})))(tls, cinfo) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_scan_header})))(tls, cinfo) } /* * Finish up at end of pass. */ func _finish_pass_master(tls *libc.TLS, cinfo Tj_compress_ptr) { var master Tmy_master_ptr _ = master master = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster /* The entropy coder always needs an end-of-pass call, * either to analyze statistics or to flush its output buffer. */ (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_encoder)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Ffinish_pass})))(tls, cinfo) /* Update state for next pass */ switch (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_type { case int32(main_pass): /* next pass is either output of scan 0 (after optimization) * or output of scan 1 (if no optimization). */ (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_type = int32(output_pass) if !((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding != 0) { (*Tmy_comp_master)(unsafe.Pointer(master)).Fscan_number++ } case int32(huff_opt_pass): /* next pass is always output of current scan */ (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_type = int32(output_pass) case int32(output_pass): /* next pass is either optimization or output of next scan */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding != 0 { (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_type = int32(huff_opt_pass) } (*Tmy_comp_master)(unsafe.Pointer(master)).Fscan_number++ break } (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_number++ } /* * Initialize master compression control. */ func Xjinit_c_master_control(tls *libc.TLS, cinfo Tj_compress_ptr, transcode_only Tboolean) { var master Tmy_master_ptr _ = master master = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(36)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmaster = master (*Tmy_comp_master)(unsafe.Pointer(master)).Fpub.Fprepare_for_pass = __ccgo_fp(_prepare_for_pass) (*Tmy_comp_master)(unsafe.Pointer(master)).Fpub.Fpass_startup = __ccgo_fp(_pass_startup) (*Tmy_comp_master)(unsafe.Pointer(master)).Fpub.Ffinish_pass = __ccgo_fp(_finish_pass_master) (*Tmy_comp_master)(unsafe.Pointer(master)).Fpub.Fis_last_pass = int32(FALSE1) /* Validate parameters, determine derived values */ _initial_setup(tls, cinfo) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscan_info != libc.UintptrFromInt32(0) { _validate_script(tls, cinfo) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size < int32(DCTSIZE) { _reduce_script(tls, cinfo) } } else { (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode = int32(FALSE1) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_scans = int32(1) } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding != 0 { (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Farith_code = int32(FALSE1) } else { if !((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Farith_code != 0) && ((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size > int32(1) && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size < int32(DCTSIZE)) { /* TEMPORARY HACK ??? */ /* assume default tables no good for progressive or reduced AC mode */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding = int32(TRUE1) } } /* force Huffman optimization */ /* Initialize my private state */ if transcode_only != 0 { /* no main pass in transcoding */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding != 0 { (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_type = int32(huff_opt_pass) } else { (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_type = int32(output_pass) } } else { /* for normal compression, first pass is always this type: */ (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_type = int32(main_pass) } (*Tmy_comp_master)(unsafe.Pointer(master)).Fscan_number = 0 (*Tmy_comp_master)(unsafe.Pointer(master)).Fpass_number = 0 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding != 0 { (*Tmy_comp_master)(unsafe.Pointer(master)).Ftotal_passes = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_scans * int32(2) } else { (*Tmy_comp_master)(unsafe.Pointer(master)).Ftotal_passes = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_scans } } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* * Abort processing of a JPEG compression or decompression operation, * but don't destroy the object itself. * * For this, we merely clean up all the nonpermanent memory pools. * Note that temp files (virtual arrays) are not allowed to belong to * the permanent pool, so we will be able to close all temp files here. * Closing a data source or destination, if necessary, is the application's * responsibility. */ func Xjpeg_abort(tls *libc.TLS, cinfo Tj_common_ptr) { var pool int32 _ = pool /* Do nothing if called on a not-initialized or destroyed JPEG object. */ if (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem == libc.UintptrFromInt32(0) { return } /* Releasing pools in reverse order might help avoid fragmentation * with some (brain-damaged) malloc libraries. */ pool = libc.Int32FromInt32(JPOOL_NUMPOOLS) - libc.Int32FromInt32(1) for { if !(pool > JPOOL_PERMANENT) { break } (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem)).Ffree_pool})))(tls, cinfo, pool) goto _1 _1: ; pool-- } /* Reset overall state for possible reuse of object */ if (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fis_decompressor != 0 { (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_START) /* Try to keep application from accessing now-deleted marker list. * A bit kludgy to do it here, but this is the most central place. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker_list = libc.UintptrFromInt32(0) } else { (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(CSTATE_START) } } /* * Destruction of a JPEG object. * * Everything gets deallocated except the master jpeg_compress_struct itself * and the error manager struct. Both of these are supplied by the application * and must be freed, if necessary, by the application. (Often they are on * the stack and so don't need to be freed anyway.) * Closing a data source or destination, if necessary, is the application's * responsibility. */ func Xjpeg_destroy(tls *libc.TLS, cinfo Tj_common_ptr) { /* We need only tell the memory manager to release everything. */ /* NB: mem pointer is NULL if memory mgr failed to initialize. */ if (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem)).Fself_destruct})))(tls, cinfo) } (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem = libc.UintptrFromInt32(0) /* be safe if jpeg_destroy is called twice */ (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fglobal_state = 0 /* mark it destroyed */ } /* * Convenience routines for allocating quantization and Huffman tables. * (Would jutils.c be a more reasonable place to put these?) */ func Xjpeg_alloc_quant_table(tls *libc.TLS, cinfo Tj_common_ptr) (r uintptr) { var tbl uintptr _ = tbl tbl = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, libc.Uint32FromInt64(132)) (*TJQUANT_TBL)(unsafe.Pointer(tbl)).Fsent_table = int32(FALSE1) /* make sure this is false in any new table */ return tbl } func Xjpeg_alloc_huff_table(tls *libc.TLS, cinfo Tj_common_ptr) (r uintptr) { var tbl uintptr _ = tbl tbl = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, libc.Uint32FromInt64(280)) (*TJHUFF_TBL)(unsafe.Pointer(tbl)).Fsent_table = int32(FALSE1) /* make sure this is false in any new table */ return tbl } /* * Set up the standard Huffman tables (cf. JPEG standard section K.3). * IMPORTANT: these are only valid for 8-bit data precision! * (Would jutils.c be a more reasonable place to put this?) */ func Xjpeg_std_huff_table(tls *libc.TLS, cinfo Tj_common_ptr, isDC Tboolean, tblno int32) (r uintptr) { var bits, htbl, htblptr, val uintptr var len1, nsymbols int32 _, _, _, _, _, _ = bits, htbl, htblptr, len1, nsymbols, val if (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fis_decompressor != 0 { if isDC != 0 { htblptr = cinfo + 180 } else { htblptr = cinfo + 196 } } else { if isDC != 0 { htblptr = cinfo + 120 } else { htblptr = cinfo + 136 } } switch tblno { case 0: if isDC != 0 { bits = uintptr(unsafe.Pointer(&_bits_dc_luminance)) val = uintptr(unsafe.Pointer(&_val_dc_luminance)) } else { bits = uintptr(unsafe.Pointer(&_bits_ac_luminance)) val = uintptr(unsafe.Pointer(&_val_ac_luminance)) } case int32(1): if isDC != 0 { bits = uintptr(unsafe.Pointer(&_bits_dc_chrominance)) val = uintptr(unsafe.Pointer(&_val_dc_chrominance)) } else { bits = uintptr(unsafe.Pointer(&_bits_ac_chrominance)) val = uintptr(unsafe.Pointer(&_val_ac_chrominance)) } default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_HUFF_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = tblno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) return libc.UintptrFromInt32(0) /* avoid compiler warnings for uninitialized variables */ } if *(*uintptr)(unsafe.Pointer(htblptr + uintptr(tblno)*4)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(htblptr + uintptr(tblno)*4)) = Xjpeg_alloc_huff_table(tls, cinfo) } htbl = *(*uintptr)(unsafe.Pointer(htblptr + uintptr(tblno)*4)) /* Copy the number-of-symbols-of-each-code-length counts */ libc.Xmemcpy(tls, htbl, bits, libc.Uint32FromInt64(17)) /* Validate the counts. We do this here mainly so we can copy the right * number of symbols from the val[] array, without risking marching off * the end of memory. jxhuff.c will do a more thorough test later. */ nsymbols = 0 len1 = int32(1) for { if !(len1 <= int32(16)) { break } nsymbols += libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(bits + uintptr(len1)))) goto _1 _1: ; len1++ } if nsymbols > int32(256) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_HUFF_TABLE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if nsymbols > 0 { libc.Xmemcpy(tls, htbl+17, val, libc.Uint32FromInt32(nsymbols)*libc.Uint32FromInt64(1)) } /* Initialize sent_table FALSE so table will be written to JPEG file. */ (*TJHUFF_TBL)(unsafe.Pointer(htbl)).Fsent_table = int32(FALSE1) return htbl } var _bits_dc_luminance = [17]TUINT8{ 2: uint8(1), 3: uint8(5), 4: uint8(1), 5: uint8(1), 6: uint8(1), 7: uint8(1), 8: uint8(1), 9: uint8(1), } var _val_dc_luminance = [12]TUINT8{ 1: uint8(1), 2: uint8(2), 3: uint8(3), 4: uint8(4), 5: uint8(5), 6: uint8(6), 7: uint8(7), 8: uint8(8), 9: uint8(9), 10: uint8(10), 11: uint8(11), } var _bits_dc_chrominance = [17]TUINT8{ 2: uint8(3), 3: uint8(1), 4: uint8(1), 5: uint8(1), 6: uint8(1), 7: uint8(1), 8: uint8(1), 9: uint8(1), 10: uint8(1), 11: uint8(1), } var _val_dc_chrominance = [12]TUINT8{ 1: uint8(1), 2: uint8(2), 3: uint8(3), 4: uint8(4), 5: uint8(5), 6: uint8(6), 7: uint8(7), 8: uint8(8), 9: uint8(9), 10: uint8(10), 11: uint8(11), } var _bits_ac_luminance = [17]TUINT8{ 2: uint8(2), 3: uint8(1), 4: uint8(3), 5: uint8(3), 6: uint8(2), 7: uint8(4), 8: uint8(3), 9: uint8(5), 10: uint8(5), 11: uint8(4), 12: uint8(4), 15: uint8(1), 16: uint8(0x7d), } var _val_ac_luminance = [162]TUINT8{ 0: uint8(0x01), 1: uint8(0x02), 2: uint8(0x03), 4: uint8(0x04), 5: uint8(0x11), 6: uint8(0x05), 7: uint8(0x12), 8: uint8(0x21), 9: uint8(0x31), 10: uint8(0x41), 11: uint8(0x06), 12: uint8(0x13), 13: uint8(0x51), 14: uint8(0x61), 15: uint8(0x07), 16: uint8(0x22), 17: uint8(0x71), 18: uint8(0x14), 19: uint8(0x32), 20: uint8(0x81), 21: uint8(0x91), 22: uint8(0xa1), 23: uint8(0x08), 24: uint8(0x23), 25: uint8(0x42), 26: uint8(0xb1), 27: uint8(0xc1), 28: uint8(0x15), 29: uint8(0x52), 30: uint8(0xd1), 31: uint8(0xf0), 32: uint8(0x24), 33: uint8(0x33), 34: uint8(0x62), 35: uint8(0x72), 36: uint8(0x82), 37: uint8(0x09), 38: uint8(0x0a), 39: uint8(0x16), 40: uint8(0x17), 41: uint8(0x18), 42: uint8(0x19), 43: uint8(0x1a), 44: uint8(0x25), 45: uint8(0x26), 46: uint8(0x27), 47: uint8(0x28), 48: uint8(0x29), 49: uint8(0x2a), 50: uint8(0x34), 51: uint8(0x35), 52: uint8(0x36), 53: uint8(0x37), 54: uint8(0x38), 55: uint8(0x39), 56: uint8(0x3a), 57: uint8(0x43), 58: uint8(0x44), 59: uint8(0x45), 60: uint8(0x46), 61: uint8(0x47), 62: uint8(0x48), 63: uint8(0x49), 64: uint8(0x4a), 65: uint8(0x53), 66: uint8(0x54), 67: uint8(0x55), 68: uint8(0x56), 69: uint8(0x57), 70: uint8(0x58), 71: uint8(0x59), 72: uint8(0x5a), 73: uint8(0x63), 74: uint8(0x64), 75: uint8(0x65), 76: uint8(0x66), 77: uint8(0x67), 78: uint8(0x68), 79: uint8(0x69), 80: uint8(0x6a), 81: uint8(0x73), 82: uint8(0x74), 83: uint8(0x75), 84: uint8(0x76), 85: uint8(0x77), 86: uint8(0x78), 87: uint8(0x79), 88: uint8(0x7a), 89: uint8(0x83), 90: uint8(0x84), 91: uint8(0x85), 92: uint8(0x86), 93: uint8(0x87), 94: uint8(0x88), 95: uint8(0x89), 96: uint8(0x8a), 97: uint8(0x92), 98: uint8(0x93), 99: uint8(0x94), 100: uint8(0x95), 101: uint8(0x96), 102: uint8(0x97), 103: uint8(0x98), 104: uint8(0x99), 105: uint8(0x9a), 106: uint8(0xa2), 107: uint8(0xa3), 108: uint8(0xa4), 109: uint8(0xa5), 110: uint8(0xa6), 111: uint8(0xa7), 112: uint8(0xa8), 113: uint8(0xa9), 114: uint8(0xaa), 115: uint8(0xb2), 116: uint8(0xb3), 117: uint8(0xb4), 118: uint8(0xb5), 119: uint8(0xb6), 120: uint8(0xb7), 121: uint8(0xb8), 122: uint8(0xb9), 123: uint8(0xba), 124: uint8(0xc2), 125: uint8(0xc3), 126: uint8(0xc4), 127: uint8(0xc5), 128: uint8(0xc6), 129: uint8(0xc7), 130: uint8(0xc8), 131: uint8(0xc9), 132: uint8(0xca), 133: uint8(0xd2), 134: uint8(0xd3), 135: uint8(0xd4), 136: uint8(0xd5), 137: uint8(0xd6), 138: uint8(0xd7), 139: uint8(0xd8), 140: uint8(0xd9), 141: uint8(0xda), 142: uint8(0xe1), 143: uint8(0xe2), 144: uint8(0xe3), 145: uint8(0xe4), 146: uint8(0xe5), 147: uint8(0xe6), 148: uint8(0xe7), 149: uint8(0xe8), 150: uint8(0xe9), 151: uint8(0xea), 152: uint8(0xf1), 153: uint8(0xf2), 154: uint8(0xf3), 155: uint8(0xf4), 156: uint8(0xf5), 157: uint8(0xf6), 158: uint8(0xf7), 159: uint8(0xf8), 160: uint8(0xf9), 161: uint8(0xfa), } var _bits_ac_chrominance = [17]TUINT8{ 2: uint8(2), 3: uint8(1), 4: uint8(2), 5: uint8(4), 6: uint8(4), 7: uint8(3), 8: uint8(4), 9: uint8(7), 10: uint8(5), 11: uint8(4), 12: uint8(4), 14: uint8(1), 15: uint8(2), 16: uint8(0x77), } var _val_ac_chrominance = [162]TUINT8{ 1: uint8(0x01), 2: uint8(0x02), 3: uint8(0x03), 4: uint8(0x11), 5: uint8(0x04), 6: uint8(0x05), 7: uint8(0x21), 8: uint8(0x31), 9: uint8(0x06), 10: uint8(0x12), 11: uint8(0x41), 12: uint8(0x51), 13: uint8(0x07), 14: uint8(0x61), 15: uint8(0x71), 16: uint8(0x13), 17: uint8(0x22), 18: uint8(0x32), 19: uint8(0x81), 20: uint8(0x08), 21: uint8(0x14), 22: uint8(0x42), 23: uint8(0x91), 24: uint8(0xa1), 25: uint8(0xb1), 26: uint8(0xc1), 27: uint8(0x09), 28: uint8(0x23), 29: uint8(0x33), 30: uint8(0x52), 31: uint8(0xf0), 32: uint8(0x15), 33: uint8(0x62), 34: uint8(0x72), 35: uint8(0xd1), 36: uint8(0x0a), 37: uint8(0x16), 38: uint8(0x24), 39: uint8(0x34), 40: uint8(0xe1), 41: uint8(0x25), 42: uint8(0xf1), 43: uint8(0x17), 44: uint8(0x18), 45: uint8(0x19), 46: uint8(0x1a), 47: uint8(0x26), 48: uint8(0x27), 49: uint8(0x28), 50: uint8(0x29), 51: uint8(0x2a), 52: uint8(0x35), 53: uint8(0x36), 54: uint8(0x37), 55: uint8(0x38), 56: uint8(0x39), 57: uint8(0x3a), 58: uint8(0x43), 59: uint8(0x44), 60: uint8(0x45), 61: uint8(0x46), 62: uint8(0x47), 63: uint8(0x48), 64: uint8(0x49), 65: uint8(0x4a), 66: uint8(0x53), 67: uint8(0x54), 68: uint8(0x55), 69: uint8(0x56), 70: uint8(0x57), 71: uint8(0x58), 72: uint8(0x59), 73: uint8(0x5a), 74: uint8(0x63), 75: uint8(0x64), 76: uint8(0x65), 77: uint8(0x66), 78: uint8(0x67), 79: uint8(0x68), 80: uint8(0x69), 81: uint8(0x6a), 82: uint8(0x73), 83: uint8(0x74), 84: uint8(0x75), 85: uint8(0x76), 86: uint8(0x77), 87: uint8(0x78), 88: uint8(0x79), 89: uint8(0x7a), 90: uint8(0x82), 91: uint8(0x83), 92: uint8(0x84), 93: uint8(0x85), 94: uint8(0x86), 95: uint8(0x87), 96: uint8(0x88), 97: uint8(0x89), 98: uint8(0x8a), 99: uint8(0x92), 100: uint8(0x93), 101: uint8(0x94), 102: uint8(0x95), 103: uint8(0x96), 104: uint8(0x97), 105: uint8(0x98), 106: uint8(0x99), 107: uint8(0x9a), 108: uint8(0xa2), 109: uint8(0xa3), 110: uint8(0xa4), 111: uint8(0xa5), 112: uint8(0xa6), 113: uint8(0xa7), 114: uint8(0xa8), 115: uint8(0xa9), 116: uint8(0xaa), 117: uint8(0xb2), 118: uint8(0xb3), 119: uint8(0xb4), 120: uint8(0xb5), 121: uint8(0xb6), 122: uint8(0xb7), 123: uint8(0xb8), 124: uint8(0xb9), 125: uint8(0xba), 126: uint8(0xc2), 127: uint8(0xc3), 128: uint8(0xc4), 129: uint8(0xc5), 130: uint8(0xc6), 131: uint8(0xc7), 132: uint8(0xc8), 133: uint8(0xc9), 134: uint8(0xca), 135: uint8(0xd2), 136: uint8(0xd3), 137: uint8(0xd4), 138: uint8(0xd5), 139: uint8(0xd6), 140: uint8(0xd7), 141: uint8(0xd8), 142: uint8(0xd9), 143: uint8(0xda), 144: uint8(0xe2), 145: uint8(0xe3), 146: uint8(0xe4), 147: uint8(0xe5), 148: uint8(0xe6), 149: uint8(0xe7), 150: uint8(0xe8), 151: uint8(0xe9), 152: uint8(0xea), 153: uint8(0xf2), 154: uint8(0xf3), 155: uint8(0xf4), 156: uint8(0xf5), 157: uint8(0xf6), 158: uint8(0xf7), 159: uint8(0xf8), 160: uint8(0xf9), 161: uint8(0xfa), } const JDCT_DEFAULT2 = 0 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* * Quantization table setup routines */ func Xjpeg_add_quant_table(tls *libc.TLS, cinfo Tj_compress_ptr, which_tbl int32, basic_table uintptr, scale_factor int32, force_baseline Tboolean) { /* Define a quantization table equal to the basic_table times * a scale factor (given as a percentage). * If force_baseline is TRUE, the computed quantization table entries * are limited to 1..255 for JPEG baseline compatibility. */ var i, temp int32 var qtblptr uintptr _, _, _ = i, qtblptr, temp /* Safety check to ensure start_compress not called yet. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_START) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if which_tbl < 0 || which_tbl >= int32(NUM_QUANT_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_DQT_INDEX) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = which_tbl (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } qtblptr = cinfo + 88 + uintptr(which_tbl)*4 if *(*uintptr)(unsafe.Pointer(qtblptr)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(qtblptr)) = Xjpeg_alloc_quant_table(tls, cinfo) } i = 0 for { if !(i < int32(DCTSIZE2)) { break } temp = (libc.Int32FromUint32(*(*uint32)(unsafe.Pointer(basic_table + uintptr(i)*4)))*scale_factor + int32(50)) / int32(100) /* limit the values to the valid range */ if temp <= 0 { temp = int32(1) } if temp > int32(32767) { temp = int32(32767) } /* max quantizer needed for 12 bits */ if force_baseline != 0 && temp > int32(255) { temp = int32(255) } /* limit to baseline range if requested */ *(*TUINT16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(qtblptr)) + uintptr(i)*2)) = libc.Uint16FromInt32(temp) goto _1 _1: ; i++ } /* Initialize sent_table FALSE so table will be written to JPEG file. */ (*TJQUANT_TBL)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(qtblptr)))).Fsent_table = int32(FALSE1) } // C documentation // // /* These are the sample quantization tables given in JPEG spec section K.1. // * NOTE: chrominance DC value is changed from 17 to 16 for lossless support. // * The spec says that the values given produce "good" quality, // * and when divided by 2, "very good" quality. // */ var _std_luminance_quant_tbl = [64]uint32{ 0: uint32(16), 1: uint32(11), 2: uint32(10), 3: uint32(16), 4: uint32(24), 5: uint32(40), 6: uint32(51), 7: uint32(61), 8: uint32(12), 9: uint32(12), 10: uint32(14), 11: uint32(19), 12: uint32(26), 13: uint32(58), 14: uint32(60), 15: uint32(55), 16: uint32(14), 17: uint32(13), 18: uint32(16), 19: uint32(24), 20: uint32(40), 21: uint32(57), 22: uint32(69), 23: uint32(56), 24: uint32(14), 25: uint32(17), 26: uint32(22), 27: uint32(29), 28: uint32(51), 29: uint32(87), 30: uint32(80), 31: uint32(62), 32: uint32(18), 33: uint32(22), 34: uint32(37), 35: uint32(56), 36: uint32(68), 37: uint32(109), 38: uint32(103), 39: uint32(77), 40: uint32(24), 41: uint32(35), 42: uint32(55), 43: uint32(64), 44: uint32(81), 45: uint32(104), 46: uint32(113), 47: uint32(92), 48: uint32(49), 49: uint32(64), 50: uint32(78), 51: uint32(87), 52: uint32(103), 53: uint32(121), 54: uint32(120), 55: uint32(101), 56: uint32(72), 57: uint32(92), 58: uint32(95), 59: uint32(98), 60: uint32(112), 61: uint32(100), 62: uint32(103), 63: uint32(99), } var _std_chrominance_quant_tbl = [64]uint32{ 0: uint32(16), 1: uint32(18), 2: uint32(24), 3: uint32(47), 4: uint32(99), 5: uint32(99), 6: uint32(99), 7: uint32(99), 8: uint32(18), 9: uint32(21), 10: uint32(26), 11: uint32(66), 12: uint32(99), 13: uint32(99), 14: uint32(99), 15: uint32(99), 16: uint32(24), 17: uint32(26), 18: uint32(56), 19: uint32(99), 20: uint32(99), 21: uint32(99), 22: uint32(99), 23: uint32(99), 24: uint32(47), 25: uint32(66), 26: uint32(99), 27: uint32(99), 28: uint32(99), 29: uint32(99), 30: uint32(99), 31: uint32(99), 32: uint32(99), 33: uint32(99), 34: uint32(99), 35: uint32(99), 36: uint32(99), 37: uint32(99), 38: uint32(99), 39: uint32(99), 40: uint32(99), 41: uint32(99), 42: uint32(99), 43: uint32(99), 44: uint32(99), 45: uint32(99), 46: uint32(99), 47: uint32(99), 48: uint32(99), 49: uint32(99), 50: uint32(99), 51: uint32(99), 52: uint32(99), 53: uint32(99), 54: uint32(99), 55: uint32(99), 56: uint32(99), 57: uint32(99), 58: uint32(99), 59: uint32(99), 60: uint32(99), 61: uint32(99), 62: uint32(99), 63: uint32(99), } func Xjpeg_default_qtables(tls *libc.TLS, cinfo Tj_compress_ptr, force_baseline Tboolean) { /* Set or change the 'quality' (quantization) setting, using default tables * and straight percentage-scaling quality scales. * This entry point allows different scalings for luminance and chrominance. */ /* Set up two quantization tables using the specified scaling */ Xjpeg_add_quant_table(tls, cinfo, 0, uintptr(unsafe.Pointer(&_std_luminance_quant_tbl)), *(*int32)(unsafe.Pointer(cinfo + 104)), force_baseline) Xjpeg_add_quant_table(tls, cinfo, int32(1), uintptr(unsafe.Pointer(&_std_chrominance_quant_tbl)), *(*int32)(unsafe.Pointer(cinfo + 104 + 1*4)), force_baseline) } func Xjpeg_set_linear_quality(tls *libc.TLS, cinfo Tj_compress_ptr, scale_factor int32, force_baseline Tboolean) { /* Set or change the 'quality' (quantization) setting, using default tables * and a straight percentage-scaling quality scale. In most cases it's better * to use jpeg_set_quality (below); this entry point is provided for * applications that insist on a linear percentage scaling. */ /* Set up two quantization tables using the specified scaling */ Xjpeg_add_quant_table(tls, cinfo, 0, uintptr(unsafe.Pointer(&_std_luminance_quant_tbl)), scale_factor, force_baseline) Xjpeg_add_quant_table(tls, cinfo, int32(1), uintptr(unsafe.Pointer(&_std_chrominance_quant_tbl)), scale_factor, force_baseline) } func Xjpeg_quality_scaling(tls *libc.TLS, quality int32) (r int32) { /* Convert a user-specified quality rating to a percentage scaling factor * for an underlying quantization table, using our recommended scaling curve. * The input 'quality' factor should be 0 (terrible) to 100 (very good). */ /* Safety limit on quality factor. Convert 0 to 1 to avoid zero divide. */ if quality <= 0 { quality = int32(1) } if quality > int32(100) { quality = int32(100) } /* The basic table is used as-is (scaling 100) for a quality of 50. * Qualities 50..100 are converted to scaling percentage 200 - 2*Q; * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table * to make all the table entries 1 (hence, minimum quantization loss). * Qualities 1..50 are converted to scaling percentage 5000/Q. */ if quality < int32(50) { quality = int32(5000) / quality } else { quality = int32(200) - quality*int32(2) } return quality } func Xjpeg_set_quality(tls *libc.TLS, cinfo Tj_compress_ptr, quality int32, force_baseline Tboolean) { /* Set or change the 'quality' (quantization) setting, using default tables. * This is the standard quality-adjusting entry point for typical user * interfaces; only those who want detailed control over quantization tables * would use the preceding routines directly. */ /* Convert user 0-100 rating to percentage scaling */ quality = Xjpeg_quality_scaling(tls, quality) /* Set up standard quality tables */ Xjpeg_set_linear_quality(tls, cinfo, quality, force_baseline) } /* * Reset standard Huffman tables */ func _std_huff_tables(tls *libc.TLS, cinfo Tj_compress_ptr) { if *(*uintptr)(unsafe.Pointer(cinfo + 120)) != libc.UintptrFromInt32(0) { Xjpeg_std_huff_table(tls, cinfo, int32(TRUE1), 0) } if *(*uintptr)(unsafe.Pointer(cinfo + 136)) != libc.UintptrFromInt32(0) { Xjpeg_std_huff_table(tls, cinfo, int32(FALSE1), 0) } if *(*uintptr)(unsafe.Pointer(cinfo + 120 + 1*4)) != libc.UintptrFromInt32(0) { Xjpeg_std_huff_table(tls, cinfo, int32(TRUE1), int32(1)) } if *(*uintptr)(unsafe.Pointer(cinfo + 136 + 1*4)) != libc.UintptrFromInt32(0) { Xjpeg_std_huff_table(tls, cinfo, int32(FALSE1), int32(1)) } } /* * Default parameter setup for compression. * * Applications that don't choose to use this routine must do their * own setup of all these parameters. Alternately, you can call this * to establish defaults and then alter parameters selectively. This * is the recommended approach since, if we add any new parameters, * your code will still work (they'll be set to reasonable defaults). */ func Xjpeg_set_defaults(tls *libc.TLS, cinfo Tj_compress_ptr) { var i, v2 int32 _, _ = i, v2 /* Safety check to ensure start_compress not called yet. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_START) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Allocate comp_info array large enough for maximum component count. * Array is made permanent in case application wants to compress * multiple images at same param settings. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info == libc.UintptrFromInt32(0) { (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, libc.Uint32FromInt32(MAX_COMPONENTS)*libc.Uint32FromInt64(88)) } /* Initialize everything not dependent on the color space */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_num = uint32(1) /* 1:1 scaling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscale_denom = uint32(1) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision = int32(BITS_IN_JSAMPLE) /* Set up two quantization tables using default quality of 75 */ Xjpeg_set_quality(tls, cinfo, int32(75), int32(TRUE1)) /* Reset standard Huffman tables */ _std_huff_tables(tls, cinfo) /* Initialize default arithmetic coding conditioning */ i = 0 for { if !(i < int32(NUM_ARITH_TBLS)) { break } *(*TUINT8)(unsafe.Pointer(cinfo + 152 + uintptr(i))) = uint8(0) *(*TUINT8)(unsafe.Pointer(cinfo + 168 + uintptr(i))) = uint8(1) *(*TUINT8)(unsafe.Pointer(cinfo + 184 + uintptr(i))) = uint8(5) goto _1 _1: ; i++ } /* Default is no multiple-scan output */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscan_info = libc.UintptrFromInt32(0) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_scans = 0 /* Expect normal source image, not raw downsampled data */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fraw_data_in = int32(FALSE1) /* The standard Huffman tables are only valid for 8-bit data precision. * If the precision is higher, use arithmetic coding. * (Alternatively, using Huffman coding would be possible with forcing * optimization on so that usable tables will be computed, or by * supplying default tables that are valid for the desired precision.) * Otherwise, use Huffman coding by default. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision > int32(8) { v2 = int32(TRUE1) } else { v2 = int32(FALSE1) } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Farith_code = v2 /* By default, don't do extra passes to optimize entropy coding */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Foptimize_coding = int32(FALSE1) /* By default, use the simpler non-cosited sampling alignment */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FCCIR601_sampling = int32(FALSE1) /* By default, apply fancy downsampling */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdo_fancy_downsampling = int32(TRUE1) /* No input smoothing */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fsmoothing_factor = 0 /* DCT algorithm preference */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdct_method = int32(JDCT_ISLOW) /* No restart markers */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval = uint32(0) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_in_rows = 0 /* Fill in default JFIF marker parameters. Note that whether the marker * will actually be written is determined by jpeg_set_colorspace. * * By default, the library emits JFIF version code 1.01. * An application that wants to emit JFIF 1.02 extension markers should set * JFIF_minor_version to 2. We could probably get away with just defaulting * to 1.02, but there may still be some decoders in use that will complain * about that; saying 1.01 should minimize compatibility problems. * * For wide gamut colorspaces (BG_RGB and BG_YCC), the major version will be * overridden by jpeg_set_colorspace and set to 2. */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FJFIF_major_version = uint8(1) /* Default JFIF version = 1.01 */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FJFIF_minor_version = uint8(1) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdensity_unit = uint8(0) /* Pixel size is unknown by default */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FX_density = uint16(1) /* Pixel aspect ratio is square by default */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FY_density = uint16(1) /* No color transform */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform = int32(JCT_NONE) /* Choose JPEG colorspace based on input space, set defaults accordingly */ Xjpeg_default_colorspace(tls, cinfo) } /* * Select an appropriate JPEG colorspace for in_color_space. */ func Xjpeg_default_colorspace(tls *libc.TLS, cinfo Tj_compress_ptr) { switch (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fin_color_space { case int32(JCS_UNKNOWN): Xjpeg_set_colorspace(tls, cinfo, int32(JCS_UNKNOWN)) case int32(JCS_GRAYSCALE): Xjpeg_set_colorspace(tls, cinfo, int32(JCS_GRAYSCALE)) case int32(JCS_RGB): Xjpeg_set_colorspace(tls, cinfo, int32(JCS_YCbCr)) case int32(JCS_YCbCr): Xjpeg_set_colorspace(tls, cinfo, int32(JCS_YCbCr)) case int32(JCS_CMYK): Xjpeg_set_colorspace(tls, cinfo, int32(JCS_CMYK)) /* By default, no translation */ case int32(JCS_YCCK): Xjpeg_set_colorspace(tls, cinfo, int32(JCS_YCCK)) case int32(JCS_BG_RGB): /* No translation for now -- conversion to BG_YCC not yet supportet */ Xjpeg_set_colorspace(tls, cinfo, int32(JCS_BG_RGB)) case int32(JCS_BG_YCC): Xjpeg_set_colorspace(tls, cinfo, int32(JCS_BG_YCC)) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_IN_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* * Set the JPEG colorspace, and choose colorspace-dependent default values. */ func Xjpeg_set_colorspace(tls *libc.TLS, cinfo Tj_compress_ptr, colorspace TJ_COLOR_SPACE) { var ci, v10, v11, v12, v13, v2, v3, v4, v5, v6, v7, v8, v9 int32 var compptr uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ci, compptr, v10, v11, v12, v13, v2, v3, v4, v5, v6, v7, v8, v9 /* Safety check to ensure start_compress not called yet. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_START) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* For all colorspaces, we use Q and Huff tables 0 for luminance components, * tables 1 for chrominance components. */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = colorspace (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_JFIF_header = int32(FALSE1) /* No marker for non-JFIF colorspaces */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_Adobe_marker = int32(FALSE1) /* write no Adobe marker by default */ switch colorspace { case int32(JCS_UNKNOWN): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Finput_components if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components < int32(1) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components > int32(MAX_COMPONENTS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_COMPONENT_COUNT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = int32(MAX_COMPONENTS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + uintptr(ci)*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = ci (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) goto _1 _1: ; ci++ } case int32(JCS_GRAYSCALE): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_JFIF_header = int32(TRUE1) /* Write a JFIF marker */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components = int32(1) /* JFIF specifies component ID 1 */ compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x01) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) case int32(JCS_RGB): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_Adobe_marker = int32(TRUE1) /* write Adobe marker to flag RGB */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components = int32(3) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x52) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v2 = int32(1) } else { v2 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = v2 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v3 = int32(1) } else { v3 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = v3 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v4 = int32(1) } else { v4 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = v4 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x47) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x42) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v5 = int32(1) } else { v5 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = v5 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v6 = int32(1) } else { v6 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = v6 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v7 = int32(1) } else { v7 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = v7 case int32(JCS_YCbCr): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_JFIF_header = int32(TRUE1) /* Write a JFIF marker */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components = int32(3) /* JFIF specifies component IDs 1,2,3 */ /* We default to 2x2 subsamples of chrominance */ compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x01) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(2) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(2) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x02) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(1) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x03) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(1) case int32(JCS_CMYK): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_Adobe_marker = int32(TRUE1) /* write Adobe marker to flag CMYK */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components = int32(4) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x43) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x4D) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x59) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 3*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x4B) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) case int32(JCS_YCCK): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_Adobe_marker = int32(TRUE1) /* write Adobe marker to flag YCCK */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components = int32(4) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x01) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(2) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(2) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x02) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(1) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x03) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(1) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 3*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x04) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(2) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(2) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) case int32(JCS_BG_RGB): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_JFIF_header = int32(TRUE1) /* Write a JFIF marker */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FJFIF_major_version = uint8(2) /* Set JFIF major version = 2 */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components = int32(3) /* Add offset 0x20 to the normal R/G/B component IDs */ compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x72) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v8 = int32(1) } else { v8 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = v8 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v9 = int32(1) } else { v9 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = v9 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v10 = int32(1) } else { v10 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = v10 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x67) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x62) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v11 = int32(1) } else { v11 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = v11 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v12 = int32(1) } else { v12 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = v12 if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform == int32(JCT_SUBTRACT_GREEN) { v13 = int32(1) } else { v13 = 0 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = v13 case int32(JCS_BG_YCC): (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fwrite_JFIF_header = int32(TRUE1) /* Write a JFIF marker */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FJFIF_major_version = uint8(2) /* Set JFIF major version = 2 */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components = int32(3) /* Add offset 0x20 to the normal Cb/Cr component IDs */ /* We default to 2x2 subsamples of chrominance */ compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x01) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(2) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(2) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = 0 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(0) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x22) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(1) compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88 (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = int32(0x23) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = libc.Int32FromInt32(1) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } func _fill_a_scan(tls *libc.TLS, scanptr uintptr, ci int32, Ss int32, Se int32, Ah int32, Al int32) (r uintptr) { /* Support routine: generate one scan for specified component */ (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).Fcomps_in_scan = int32(1) *(*int32)(unsafe.Pointer(scanptr + 4)) = ci (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSs = Ss (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSe = Se (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FAh = Ah (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FAl = Al scanptr += 36 return scanptr } func _fill_scans(tls *libc.TLS, scanptr uintptr, ncomps int32, Ss int32, Se int32, Ah int32, Al int32) (r uintptr) { /* Support routine: generate one scan for each component */ var ci int32 _ = ci ci = 0 for { if !(ci < ncomps) { break } (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).Fcomps_in_scan = int32(1) *(*int32)(unsafe.Pointer(scanptr + 4)) = ci (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSs = Ss (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSe = Se (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FAh = Ah (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FAl = Al scanptr += 36 goto _1 _1: ; ci++ } return scanptr } func _fill_dc_scans(tls *libc.TLS, scanptr uintptr, ncomps int32, Ah int32, Al int32) (r uintptr) { /* Support routine: generate interleaved DC scan if possible, else N scans */ var ci, v2 int32 _, _ = ci, v2 if ncomps <= int32(MAX_COMPS_IN_SCAN) { /* Single interleaved DC scan */ (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).Fcomps_in_scan = ncomps ci = 0 for { if !(ci < ncomps) { break } *(*int32)(unsafe.Pointer(scanptr + 4 + uintptr(ci)*4)) = ci goto _1 _1: ; ci++ } v2 = libc.Int32FromInt32(0) (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSe = v2 (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FSs = v2 (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FAh = Ah (*Tjpeg_scan_info)(unsafe.Pointer(scanptr)).FAl = Al scanptr += 36 } else { /* Noninterleaved DC scan for each component */ scanptr = _fill_scans(tls, scanptr, ncomps, 0, 0, Ah, Al) } return scanptr } /* * Create a recommended progressive-JPEG script. * cinfo->num_components and cinfo->jpeg_color_space must be correct. */ func Xjpeg_simple_progression(tls *libc.TLS, cinfo Tj_compress_ptr) { var ncomps, nscans, v1 int32 var scanptr uintptr _, _, _, _ = ncomps, nscans, scanptr, v1 ncomps = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components /* Safety check to ensure start_compress not called yet. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_START) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Figure space needed for script. Calculation must match code below! */ if ncomps == int32(3) && ((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space == int32(JCS_YCbCr) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space == int32(JCS_BG_YCC)) { /* Custom script for YCC color images. */ nscans = int32(10) } else { /* All-purpose script for other color spaces. */ if ncomps > int32(MAX_COMPS_IN_SCAN) { nscans = int32(6) * ncomps } else { nscans = int32(2) + int32(4)*ncomps } /* 2 DC scans; 4 AC scans per component */ } /* Allocate space for script. * We need to put it in the permanent pool in case the application performs * multiple compressions without changing the settings. To avoid a memory * leak if jpeg_simple_progression is called repeatedly for the same JPEG * object, we try to re-use previously allocated space, and we allocate * enough space to handle YCC even if initially asked for grayscale. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscript_space == libc.UintptrFromInt32(0) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscript_space_size < nscans { if nscans > int32(10) { v1 = nscans } else { v1 = int32(10) } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscript_space_size = v1 (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscript_space = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscript_space_size)*libc.Uint32FromInt64(36)) } scanptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscript_space (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fscan_info = scanptr (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_scans = nscans if ncomps == int32(3) && ((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space == int32(JCS_YCbCr) || (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space == int32(JCS_BG_YCC)) { /* Custom script for YCC color images. */ /* Initial DC scan */ scanptr = _fill_dc_scans(tls, scanptr, ncomps, 0, int32(1)) /* Initial AC scan: get some luma data out in a hurry */ scanptr = _fill_a_scan(tls, scanptr, 0, int32(1), int32(5), 0, int32(2)) /* Chroma data is too small to be worth expending many scans on */ scanptr = _fill_a_scan(tls, scanptr, int32(2), int32(1), int32(63), 0, int32(1)) scanptr = _fill_a_scan(tls, scanptr, int32(1), int32(1), int32(63), 0, int32(1)) /* Complete spectral selection for luma AC */ scanptr = _fill_a_scan(tls, scanptr, 0, int32(6), int32(63), 0, int32(2)) /* Refine next bit of luma AC */ scanptr = _fill_a_scan(tls, scanptr, 0, int32(1), int32(63), int32(2), int32(1)) /* Finish DC successive approximation */ scanptr = _fill_dc_scans(tls, scanptr, ncomps, int32(1), 0) /* Finish AC successive approximation */ scanptr = _fill_a_scan(tls, scanptr, int32(2), int32(1), int32(63), int32(1), 0) scanptr = _fill_a_scan(tls, scanptr, int32(1), int32(1), int32(63), int32(1), 0) /* Luma bottom bit comes last since it's usually largest scan */ scanptr = _fill_a_scan(tls, scanptr, 0, int32(1), int32(63), int32(1), 0) } else { /* All-purpose script for other color spaces. */ /* Successive approximation first pass */ scanptr = _fill_dc_scans(tls, scanptr, ncomps, 0, int32(1)) scanptr = _fill_scans(tls, scanptr, ncomps, int32(1), int32(5), 0, int32(2)) scanptr = _fill_scans(tls, scanptr, ncomps, int32(6), int32(63), 0, int32(2)) /* Successive approximation second pass */ scanptr = _fill_scans(tls, scanptr, ncomps, int32(1), int32(63), int32(2), int32(1)) /* Successive approximation final pass */ scanptr = _fill_dc_scans(tls, scanptr, ncomps, int32(1), 0) scanptr = _fill_scans(tls, scanptr, ncomps, int32(1), int32(63), int32(1), 0) } } const JDCT_DEFAULT3 = "JDCT_ISLOW" /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* At present, jcsample.c can request context rows only for smoothing. * In the future, we might also need context rows for CCIR601 sampling * or other more-complex downsampling procedures. The code to support * context rows should be compiled only if needed. */ /* * For the simple (no-context-row) case, we just need to buffer one * row group's worth of pixels for the downsampling step. At the bottom of * the image, we pad to a full row group by replicating the last pixel row. * The downsampler's last output row is then replicated if needed to pad * out to a full iMCU row. * * When providing context rows, we must buffer three row groups' worth of * pixels. Three row groups are physically allocated, but the row pointer * arrays are made five row groups high, with the extra pointers above and * below "wrapping around" to point to the last and first real row groups. * This allows the downsampler to access the proper context rows. * At the top and bottom of the image, we create dummy context rows by * copying the first or last real pixel row. This copying could be avoided * by pointer hacking as is done in jdmainct.c, but it doesn't seem worth the * trouble on the compression side. */ /* Private buffer controller object */ type Tmy_prep_controller = struct { Fpub Tjpeg_c_prep_controller Fcolor_buf [10]TJSAMPARRAY Frows_to_go TJDIMENSION Fnext_buf_row int32 Fthis_row_group int32 Fnext_buf_stop int32 } type Tmy_prep_ptr = uintptr /* * Initialize for a processing pass. */ func _start_pass_prep(tls *libc.TLS, cinfo Tj_compress_ptr, pass_mode TJ_BUF_MODE) { var prep Tmy_prep_ptr _ = prep prep = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprep if pass_mode != int32(JBUF_PASS_THRU) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Initialize total-height counter for detecting bottom of image */ (*Tmy_prep_controller)(unsafe.Pointer(prep)).Frows_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height /* Mark the conversion buffer empty */ (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row = 0 /* Preset additional state variables for context mode. * These aren't used in non-context mode, so we needn't test which mode. */ (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fthis_row_group = 0 /* Set next_buf_stop to stop after two row groups have been read in. */ (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_stop = int32(2) * (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor } /* * Expand an image vertically from height input_rows to height output_rows, * by duplicating the bottom row. */ func _expand_bottom_edge(tls *libc.TLS, image_data TJSAMPARRAY, num_cols TJDIMENSION, input_rows int32, output_rows int32) { var row int32 _ = row row = input_rows for { if !(row < output_rows) { break } Xjcopy_sample_rows(tls, image_data+uintptr(input_rows)*4-uintptr(1)*4, image_data+uintptr(row)*4, int32(1), num_cols) goto _1 _1: ; row++ } } /* * Process some data in the simple no-context case. * * Preprocessor output data is counted in "row groups". A row group * is defined to be v_samp_factor sample rows of each component. * Downsampling will produce this much data from each max_v_samp_factor * input rows. */ func _pre_process_data(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPARRAY, in_row_ctr uintptr, in_rows_avail TJDIMENSION, output_buf TJSAMPIMAGE, out_row_group_ctr uintptr, out_row_groups_avail TJDIMENSION) { var ci, numrows int32 var compptr uintptr var inrows TJDIMENSION var prep Tmy_prep_ptr var v1 uint32 _, _, _, _, _, _ = ci, compptr, inrows, numrows, prep, v1 prep = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprep for *(*TJDIMENSION)(unsafe.Pointer(in_row_ctr)) < in_rows_avail && *(*TJDIMENSION)(unsafe.Pointer(out_row_group_ctr)) < out_row_groups_avail { /* Do color conversion to fill the conversion buffer. */ inrows = in_rows_avail - *(*TJDIMENSION)(unsafe.Pointer(in_row_ctr)) numrows = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor - (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row if libc.Uint32FromInt32(numrows) < inrows { v1 = libc.Uint32FromInt32(numrows) } else { v1 = inrows } numrows = libc.Int32FromUint32(v1) (*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPARRAY, TJSAMPIMAGE, TJDIMENSION, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_color_converter)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcconvert)).Fcolor_convert})))(tls, cinfo, input_buf+uintptr(*(*TJDIMENSION)(unsafe.Pointer(in_row_ctr)))*4, prep+8, libc.Uint32FromInt32((*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row), numrows) *(*TJDIMENSION)(unsafe.Pointer(in_row_ctr)) += libc.Uint32FromInt32(numrows) *(*int32)(unsafe.Pointer(prep + 52)) += numrows *(*TJDIMENSION)(unsafe.Pointer(prep + 48)) -= libc.Uint32FromInt32(numrows) /* If at bottom of image, pad to fill the conversion buffer. */ if (*Tmy_prep_controller)(unsafe.Pointer(prep)).Frows_to_go == uint32(0) && (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor { ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } _expand_bottom_edge(tls, *(*TJSAMPARRAY)(unsafe.Pointer(prep + 8 + uintptr(ci)*4)), (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width, (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor) goto _2 _2: ; ci++ } (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor } /* If we've filled the conversion buffer, empty it. */ if (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row == (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor { (*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPIMAGE, TJDIMENSION, TJSAMPIMAGE, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_downsampler)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdownsample)).Fdownsample})))(tls, cinfo, prep+8, libc.Uint32FromInt32(0), output_buf, *(*TJDIMENSION)(unsafe.Pointer(out_row_group_ctr))) (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row = 0 *(*TJDIMENSION)(unsafe.Pointer(out_row_group_ctr))++ } /* If at bottom of image, pad the output to a full iMCU height. * Note we assume the caller is providing a one-iMCU-height output buffer! */ if (*Tmy_prep_controller)(unsafe.Pointer(prep)).Frows_to_go == uint32(0) && *(*TJDIMENSION)(unsafe.Pointer(out_row_group_ctr)) < out_row_groups_avail { ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } numrows = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size / (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size _expand_bottom_edge(tls, *(*TJSAMPARRAY)(unsafe.Pointer(output_buf + uintptr(ci)*4)), (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks*libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size), libc.Int32FromUint32(*(*TJDIMENSION)(unsafe.Pointer(out_row_group_ctr))*libc.Uint32FromInt32(numrows)), libc.Int32FromUint32(out_row_groups_avail*libc.Uint32FromInt32(numrows))) goto _3 _3: ; ci++ compptr += 88 } *(*TJDIMENSION)(unsafe.Pointer(out_row_group_ctr)) = out_row_groups_avail break /* can exit outer loop without test */ } } } /* * Process some data in the context case. */ func _pre_process_context(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPARRAY, in_row_ctr uintptr, in_rows_avail TJDIMENSION, output_buf TJSAMPIMAGE, out_row_group_ctr uintptr, out_row_groups_avail TJDIMENSION) { var buf_height, ci, numrows, row int32 var inrows TJDIMENSION var prep Tmy_prep_ptr var v1 uint32 _, _, _, _, _, _, _ = buf_height, ci, inrows, numrows, prep, row, v1 prep = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprep buf_height = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor * int32(3) for *(*TJDIMENSION)(unsafe.Pointer(out_row_group_ctr)) < out_row_groups_avail { if *(*TJDIMENSION)(unsafe.Pointer(in_row_ctr)) < in_rows_avail { /* Do color conversion to fill the conversion buffer. */ inrows = in_rows_avail - *(*TJDIMENSION)(unsafe.Pointer(in_row_ctr)) numrows = (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_stop - (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row if libc.Uint32FromInt32(numrows) < inrows { v1 = libc.Uint32FromInt32(numrows) } else { v1 = inrows } numrows = libc.Int32FromUint32(v1) (*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPARRAY, TJSAMPIMAGE, TJDIMENSION, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_color_converter)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcconvert)).Fcolor_convert})))(tls, cinfo, input_buf+uintptr(*(*TJDIMENSION)(unsafe.Pointer(in_row_ctr)))*4, prep+8, libc.Uint32FromInt32((*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row), numrows) /* Pad at top of image, if first time through */ if (*Tmy_prep_controller)(unsafe.Pointer(prep)).Frows_to_go == (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_height { ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } row = int32(1) for { if !(row <= (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor) { break } Xjcopy_sample_rows(tls, *(*TJSAMPARRAY)(unsafe.Pointer(prep + 8 + uintptr(ci)*4)), *(*TJSAMPARRAY)(unsafe.Pointer(prep + 8 + uintptr(ci)*4))-uintptr(row)*4, int32(1), (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width) goto _3 _3: ; row++ } goto _2 _2: ; ci++ } } *(*TJDIMENSION)(unsafe.Pointer(in_row_ctr)) += libc.Uint32FromInt32(numrows) *(*int32)(unsafe.Pointer(prep + 52)) += numrows *(*TJDIMENSION)(unsafe.Pointer(prep + 48)) -= libc.Uint32FromInt32(numrows) } else { /* Return for more data, unless we are at the bottom of the image. */ if (*Tmy_prep_controller)(unsafe.Pointer(prep)).Frows_to_go != uint32(0) { break } /* When at bottom of image, pad to fill the conversion buffer. */ if (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row < (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_stop { ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } _expand_bottom_edge(tls, *(*TJSAMPARRAY)(unsafe.Pointer(prep + 8 + uintptr(ci)*4)), (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width, (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row, (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_stop) goto _4 _4: ; ci++ } (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row = (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_stop } } /* If we've gotten enough data, downsample a row group. */ if (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row == (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_stop { (*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPIMAGE, TJDIMENSION, TJSAMPIMAGE, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_downsampler)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdownsample)).Fdownsample})))(tls, cinfo, prep+8, libc.Uint32FromInt32((*Tmy_prep_controller)(unsafe.Pointer(prep)).Fthis_row_group), output_buf, *(*TJDIMENSION)(unsafe.Pointer(out_row_group_ctr))) *(*TJDIMENSION)(unsafe.Pointer(out_row_group_ctr))++ /* Advance pointers with wraparound as necessary. */ *(*int32)(unsafe.Pointer(prep + 56)) += (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor if (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fthis_row_group >= buf_height { (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fthis_row_group = 0 } if (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row >= buf_height { (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row = 0 } (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_stop = (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fnext_buf_row + (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor } } } /* * Create the wrapped-around downsampling input buffer needed for context mode. */ func _create_context_buffer(tls *libc.TLS, cinfo Tj_compress_ptr) { var ci, i, rgroup_height int32 var compptr uintptr var fake_buffer, true_buffer TJSAMPARRAY var prep Tmy_prep_ptr _, _, _, _, _, _, _ = ci, compptr, fake_buffer, i, prep, rgroup_height, true_buffer prep = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprep rgroup_height = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor /* Grab enough space for fake row pointers for all the components; * we need five row groups' worth of pointers for each component. */ fake_buffer = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components*libc.Int32FromInt32(5)*rgroup_height)*libc.Uint32FromInt64(4)) ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Allocate the actual buffer space (3 row groups) for this component. * We make the buffer wide enough to allow the downsampler to edge-expand * horizontally within the buffer, if it so chooses. */ true_buffer = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor/(*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor), libc.Uint32FromInt32(libc.Int32FromInt32(3)*rgroup_height)) /* Copy true buffer row pointers into the middle of the fake row array */ libc.Xmemcpy(tls, fake_buffer+uintptr(rgroup_height)*4, true_buffer, libc.Uint32FromInt32(libc.Int32FromInt32(3)*rgroup_height)*libc.Uint32FromInt64(4)) /* Fill in the above and below wraparound pointers */ i = 0 for { if !(i < rgroup_height) { break } *(*TJSAMPROW)(unsafe.Pointer(fake_buffer + uintptr(i)*4)) = *(*TJSAMPROW)(unsafe.Pointer(true_buffer + uintptr(int32(2)*rgroup_height+i)*4)) *(*TJSAMPROW)(unsafe.Pointer(fake_buffer + uintptr(int32(4)*rgroup_height+i)*4)) = *(*TJSAMPROW)(unsafe.Pointer(true_buffer + uintptr(i)*4)) goto _2 _2: ; i++ } *(*TJSAMPARRAY)(unsafe.Pointer(prep + 8 + uintptr(ci)*4)) = fake_buffer + uintptr(rgroup_height)*4 fake_buffer += uintptr(int32(5)*rgroup_height) * 4 /* point to space for next component */ goto _1 _1: ; ci++ compptr += 88 } } /* * Initialize preprocessing controller. */ func Xjinit_c_prep_controller(tls *libc.TLS, cinfo Tj_compress_ptr, need_full_buffer Tboolean) { var ci int32 var compptr uintptr var prep Tmy_prep_ptr _, _, _ = ci, compptr, prep if need_full_buffer != 0 { /* safety check */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } prep = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(64)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprep = prep (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_prep) /* Allocate the color conversion buffer. * We make the buffer wide enough to allow the downsampler to edge-expand * horizontally within the buffer, if it so chooses. */ if (*Tjpeg_downsampler)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdownsample)).Fneed_context_rows != 0 { /* Set up to provide context rows */ (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fpub.Fpre_process_data = __ccgo_fp(_pre_process_context) _create_context_buffer(tls, cinfo) } else { /* No context, just make it tall enough for one row group */ (*Tmy_prep_controller)(unsafe.Pointer(prep)).Fpub.Fpre_process_data = __ccgo_fp(_pre_process_data) ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } *(*TJSAMPARRAY)(unsafe.Pointer(prep + 8 + uintptr(ci)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks)*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size*(*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor/(*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor), libc.Uint32FromInt32((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor)) goto _1 _1: ; ci++ compptr += 88 } } } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ // C documentation // // /* Pointer to routine to downsample a single component */ type Tdownsample1_ptr = uintptr /* Private subobject */ type Tmy_downsampler = struct { Fpub Tjpeg_downsampler Fmethods [10]Tdownsample1_ptr Frowgroup_height [10]int32 Fh_expand [10]TUINT8 Fv_expand [10]TUINT8 } type Tmy_downsample_ptr = uintptr /* * Initialize for a downsampling pass. */ func _start_pass_downsample(tls *libc.TLS, cinfo Tj_compress_ptr) { /* no work for now */ } /* * Expand a component horizontally from width input_cols to width output_cols, * by duplicating the rightmost samples. */ func _expand_right_edge(tls *libc.TLS, image_data TJSAMPARRAY, num_rows int32, input_cols TJDIMENSION, output_cols TJDIMENSION) { var count, numcols, row int32 var pixval TJSAMPLE var ptr, v3 TJSAMPROW _, _, _, _, _, _ = count, numcols, pixval, ptr, row, v3 numcols = libc.Int32FromUint32(output_cols - input_cols) if numcols > 0 { row = 0 for { if !(row < num_rows) { break } ptr = *(*TJSAMPROW)(unsafe.Pointer(image_data + uintptr(row)*4)) + uintptr(input_cols) pixval = *(*TJSAMPLE)(unsafe.Pointer(ptr + uintptr(-libc.Int32FromInt32(1)))) /* don't need GETJSAMPLE() here */ count = numcols for { if !(count > 0) { break } v3 = ptr ptr++ *(*TJSAMPLE)(unsafe.Pointer(v3)) = pixval goto _2 _2: ; count-- } goto _1 _1: ; row++ } } } /* * Do downsampling for a whole row group (all components). * * In this version we simply downsample each component independently. */ func _sep_downsample(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPIMAGE, in_row_index TJDIMENSION, output_buf TJSAMPIMAGE, out_row_group_index TJDIMENSION) { var ci int32 var compptr uintptr var downsample Tmy_downsample_ptr var in_ptr, out_ptr TJSAMPARRAY _, _, _, _, _ = ci, compptr, downsample, in_ptr, out_ptr downsample = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdownsample ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } in_ptr = *(*TJSAMPARRAY)(unsafe.Pointer(input_buf + uintptr(ci)*4)) + uintptr(in_row_index)*4 out_ptr = *(*TJSAMPARRAY)(unsafe.Pointer(output_buf + uintptr(ci)*4)) + uintptr(out_row_group_index*libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(downsample + 52 + uintptr(ci)*4))))*4 (*(*func(*libc.TLS, Tj_compress_ptr, uintptr, TJSAMPARRAY, TJSAMPARRAY))(unsafe.Pointer(&struct{ uintptr }{*(*Tdownsample1_ptr)(unsafe.Pointer(downsample + 12 + uintptr(ci)*4))})))(tls, cinfo, compptr, in_ptr, out_ptr) goto _1 _1: ; ci++ compptr += 88 } } /* * Downsample pixel values of a single component. * One row group is processed per call. * This version handles arbitrary integral sampling ratios, without smoothing. * Note that this version is not actually used for customary sampling ratios. */ func _int_downsample(tls *libc.TLS, cinfo Tj_compress_ptr, compptr uintptr, input_data TJSAMPARRAY, output_data TJSAMPARRAY) { var downsample Tmy_downsample_ptr var h, h_expand, inrow, numpix, numpix2, outrow, v, v_expand, v1 int32 var inptr, outptr, v5, v6 TJSAMPROW var outcol, outcol_h, output_cols TJDIMENSION var outvalue TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = downsample, h, h_expand, inptr, inrow, numpix, numpix2, outcol, outcol_h, outptr, output_cols, outrow, outvalue, v, v_expand, v1, v5, v6 downsample = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdownsample /* outcol_h == outcol*h_expand */ output_cols = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks * libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size) h_expand = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(downsample + 92 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)))) v_expand = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(downsample + 102 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)))) numpix = h_expand * v_expand numpix2 = numpix / int32(2) /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more * efficient. */ _expand_right_edge(tls, input_data, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width, output_cols*libc.Uint32FromInt32(h_expand)) v1 = libc.Int32FromInt32(0) outrow = v1 inrow = v1 for inrow < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor { outptr = *(*TJSAMPROW)(unsafe.Pointer(output_data + uintptr(outrow)*4)) outcol = uint32(0) outcol_h = libc.Uint32FromInt32(0) for { if !(outcol < output_cols) { break } outvalue = 0 v = 0 for { if !(v < v_expand) { break } inptr = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow+v)*4)) + uintptr(outcol_h) h = 0 for { if !(h < h_expand) { break } v5 = inptr inptr++ outvalue += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v5))) goto _4 _4: ; h++ } goto _3 _3: ; v++ } v6 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v6)) = libc.Uint8FromInt32((outvalue + numpix2) / numpix) goto _2 _2: ; outcol++ outcol_h += libc.Uint32FromInt32(h_expand) } inrow += v_expand outrow++ } } /* * Downsample pixel values of a single component. * This version handles the special case of a full-size component, * without smoothing. */ func _fullsize_downsample(tls *libc.TLS, cinfo Tj_compress_ptr, compptr uintptr, input_data TJSAMPARRAY, output_data TJSAMPARRAY) { /* Copy the data */ Xjcopy_sample_rows(tls, input_data, output_data, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width) /* Edge-expand */ _expand_right_edge(tls, output_data, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width, (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks*libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size)) } /* * Downsample pixel values of a single component. * This version handles the common case of 2:1 horizontal and 1:1 vertical, * without smoothing. * * A note about the "bias" calculations: when rounding fractional values to * integer, we do not want to always round 0.5 up to the next integer. * If we did that, we'd introduce a noticeable bias towards larger values. * Instead, this code is arranged so that 0.5 will be rounded up or down at * alternate pixel locations (a simple ordered dither pattern). */ func _h2v1_downsample(tls *libc.TLS, cinfo Tj_compress_ptr, compptr uintptr, input_data TJSAMPARRAY, output_data TJSAMPARRAY) { var bias, inrow int32 var inptr, outptr, v3 TJSAMPROW var outcol, output_cols TJDIMENSION _, _, _, _, _, _, _ = bias, inptr, inrow, outcol, outptr, output_cols, v3 output_cols = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks * libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size) /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more * efficient. */ _expand_right_edge(tls, input_data, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width, output_cols*uint32(2)) inrow = 0 for { if !(inrow < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_data + uintptr(inrow)*4)) inptr = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow)*4)) bias = 0 /* bias = 0,1,0,1,... for successive samples */ outcol = uint32(0) for { if !(outcol < output_cols) { break } v3 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v3)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 1))) + bias) >> libc.Int32FromInt32(1)) bias ^= int32(1) /* 0=>1, 1=>0 */ inptr += uintptr(2) goto _2 _2: ; outcol++ } goto _1 _1: ; inrow++ } } /* * Downsample pixel values of a single component. * This version handles the standard case of 2:1 horizontal and 2:1 vertical, * without smoothing. */ func _h2v2_downsample(tls *libc.TLS, cinfo Tj_compress_ptr, compptr uintptr, input_data TJSAMPARRAY, output_data TJSAMPARRAY) { var bias, inrow, outrow, v1 int32 var inptr0, inptr1, outptr, v3 TJSAMPROW var outcol, output_cols TJDIMENSION _, _, _, _, _, _, _, _, _, _ = bias, inptr0, inptr1, inrow, outcol, outptr, output_cols, outrow, v1, v3 output_cols = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks * libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size) /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more * efficient. */ _expand_right_edge(tls, input_data, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width, output_cols*uint32(2)) v1 = libc.Int32FromInt32(0) outrow = v1 inrow = v1 for inrow < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor { outptr = *(*TJSAMPROW)(unsafe.Pointer(output_data + uintptr(outrow)*4)) inptr0 = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow)*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow+int32(1))*4)) bias = int32(1) /* bias = 1,2,1,2,... for successive samples */ outcol = uint32(0) for { if !(outcol < output_cols) { break } v3 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v3)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + 1))) + bias) >> libc.Int32FromInt32(2)) bias ^= int32(3) /* 1=>2, 2=>1 */ inptr0 += uintptr(2) inptr1 += uintptr(2) goto _2 _2: ; outcol++ } inrow += int32(2) outrow++ } } /* * Downsample pixel values of a single component. * This version handles the standard case of 2:1 horizontal and 2:1 vertical, * with smoothing. One row of context is required. */ func _h2v2_smooth_downsample(tls *libc.TLS, cinfo Tj_compress_ptr, compptr uintptr, input_data TJSAMPARRAY, output_data TJSAMPARRAY) { var above_ptr, below_ptr, inptr0, inptr1, outptr, v2, v4 TJSAMPROW var colctr, output_cols TJDIMENSION var inrow, outrow, v1 int32 var memberscale, membersum, neighscale, neighsum TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = above_ptr, below_ptr, colctr, inptr0, inptr1, inrow, memberscale, membersum, neighscale, neighsum, outptr, output_cols, outrow, v1, v2, v4 output_cols = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks * libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size) /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more * efficient. */ _expand_right_edge(tls, input_data-uintptr(1)*4, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor+int32(2), (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width, output_cols*uint32(2)) /* We don't bother to form the individual "smoothed" input pixel values; * we can directly compute the output which is the average of the four * smoothed values. Each of the four member pixels contributes a fraction * (1-8*SF) to its own smoothed image and a fraction SF to each of the three * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final * output. The four corner-adjacent neighbor pixels contribute a fraction * SF to just one smoothed pixel, or SF/4 to the final output; while the * eight edge-adjacent neighbors contribute SF to each of two smoothed * pixels, or SF/2 overall. In order to use integer arithmetic, these * factors are scaled by 2^16 = 65536. * Also recall that SF = smoothing_factor / 1024. */ memberscale = int32(16384) - (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fsmoothing_factor*int32(80) /* scaled (1-5*SF)/4 */ neighscale = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fsmoothing_factor * int32(16) /* scaled SF/4 */ v1 = libc.Int32FromInt32(0) outrow = v1 inrow = v1 for inrow < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor { outptr = *(*TJSAMPROW)(unsafe.Pointer(output_data + uintptr(outrow)*4)) inptr0 = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow)*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow+int32(1))*4)) above_ptr = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow-int32(1))*4)) below_ptr = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow+int32(2))*4)) /* Special case for first column: pretend column -1 is same as column 0 */ membersum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + 1))) neighsum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + 2))) neighsum += neighsum neighsum += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr + 2))) membersum = membersum*memberscale + neighsum*neighscale v2 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v2)) = libc.Uint8FromInt32((membersum + libc.Int32FromInt32(32768)) >> libc.Int32FromInt32(16)) inptr0 += uintptr(2) inptr1 += uintptr(2) above_ptr += uintptr(2) below_ptr += uintptr(2) colctr = output_cols - uint32(2) for { if !(colctr > uint32(0)) { break } /* sum of pixels directly mapped to this output element */ membersum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + 1))) /* sum of edge-neighbor pixels */ neighsum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + uintptr(-libc.Int32FromInt32(1))))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + uintptr(-libc.Int32FromInt32(1))))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + 2))) /* The edge-neighbors count twice as much as corner-neighbors */ neighsum += neighsum /* Add in the corner-neighbors */ neighsum += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr + uintptr(-libc.Int32FromInt32(1))))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr + uintptr(-libc.Int32FromInt32(1))))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr + 2))) /* form final output scaled up by 2^16 */ membersum = membersum*memberscale + neighsum*neighscale /* round, descale and output it */ v4 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v4)) = libc.Uint8FromInt32((membersum + libc.Int32FromInt32(32768)) >> libc.Int32FromInt32(16)) inptr0 += uintptr(2) inptr1 += uintptr(2) above_ptr += uintptr(2) below_ptr += uintptr(2) goto _3 _3: ; colctr-- } /* Special case for last column */ membersum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + 1))) neighsum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + uintptr(-libc.Int32FromInt32(1))))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + uintptr(-libc.Int32FromInt32(1))))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + 1))) neighsum += neighsum neighsum += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr + uintptr(-libc.Int32FromInt32(1))))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr + uintptr(-libc.Int32FromInt32(1))))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr + 1))) membersum = membersum*memberscale + neighsum*neighscale *(*TJSAMPLE)(unsafe.Pointer(outptr)) = libc.Uint8FromInt32((membersum + libc.Int32FromInt32(32768)) >> libc.Int32FromInt32(16)) inrow += int32(2) outrow++ } } /* * Downsample pixel values of a single component. * This version handles the special case of a full-size component, * with smoothing. One row of context is required. */ func _fullsize_smooth_downsample(tls *libc.TLS, cinfo Tj_compress_ptr, compptr uintptr, input_data TJSAMPARRAY, output_data TJSAMPARRAY) { var above_ptr, below_ptr, inptr, outptr, v2, v3, v4, v5, v7, v8 TJSAMPROW var colctr, output_cols TJDIMENSION var colsum, inrow, lastcolsum, nextcolsum int32 var memberscale, membersum, neighscale, neighsum TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = above_ptr, below_ptr, colctr, colsum, inptr, inrow, lastcolsum, memberscale, membersum, neighscale, neighsum, nextcolsum, outptr, output_cols, v2, v3, v4, v5, v7, v8 output_cols = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks * libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size) /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more * efficient. */ _expand_right_edge(tls, input_data-uintptr(1)*4, (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor+int32(2), (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fimage_width, output_cols) /* Each of the eight neighbor pixels contributes a fraction SF to the * smoothed pixel, while the main pixel contributes (1-8*SF). In order * to use integer arithmetic, these factors are multiplied by 2^16 = 65536. * Also recall that SF = smoothing_factor / 1024. */ memberscale = int32(65536) - (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fsmoothing_factor*int32(512) /* scaled 1-8*SF */ neighscale = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fsmoothing_factor * int32(64) /* scaled SF */ inrow = 0 for { if !(inrow < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_data + uintptr(inrow)*4)) inptr = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow)*4)) above_ptr = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow-int32(1))*4)) below_ptr = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(inrow+int32(1))*4)) /* Special case for first column */ v2 = above_ptr above_ptr++ v3 = below_ptr below_ptr++ colsum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr))) v4 = inptr inptr++ membersum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v4))) nextcolsum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr))) neighsum = colsum + (colsum - membersum) + nextcolsum membersum = membersum*memberscale + neighsum*neighscale v5 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v5)) = libc.Uint8FromInt32((membersum + libc.Int32FromInt32(32768)) >> libc.Int32FromInt32(16)) lastcolsum = colsum colsum = nextcolsum colctr = output_cols - uint32(2) for { if !(colctr > uint32(0)) { break } v7 = inptr inptr++ membersum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v7))) above_ptr++ below_ptr++ nextcolsum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(above_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(below_ptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr))) neighsum = lastcolsum + (colsum - membersum) + nextcolsum membersum = membersum*memberscale + neighsum*neighscale v8 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v8)) = libc.Uint8FromInt32((membersum + libc.Int32FromInt32(32768)) >> libc.Int32FromInt32(16)) lastcolsum = colsum colsum = nextcolsum goto _6 _6: ; colctr-- } /* Special case for last column */ membersum = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr))) neighsum = lastcolsum + (colsum - membersum) + colsum membersum = membersum*memberscale + neighsum*neighscale *(*TJSAMPLE)(unsafe.Pointer(outptr)) = libc.Uint8FromInt32((membersum + libc.Int32FromInt32(32768)) >> libc.Int32FromInt32(16)) goto _1 _1: ; inrow++ } } /* * Module initialization routine for downsampling. * Note that we must select a routine for each component. */ func Xjinit_downsampler(tls *libc.TLS, cinfo Tj_compress_ptr) { var ci, h_in_group, h_out_group, v_in_group, v_out_group int32 var compptr uintptr var downsample Tmy_downsample_ptr var smoothok Tboolean _, _, _, _, _, _, _, _ = ci, compptr, downsample, h_in_group, h_out_group, smoothok, v_in_group, v_out_group smoothok = int32(TRUE1) downsample = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(112)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdownsample = downsample (*Tmy_downsampler)(unsafe.Pointer(downsample)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_downsample) (*Tmy_downsampler)(unsafe.Pointer(downsample)).Fpub.Fdownsample = __ccgo_fp(_sep_downsample) (*Tmy_downsampler)(unsafe.Pointer(downsample)).Fpub.Fneed_context_rows = int32(FALSE1) if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FCCIR601_sampling != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CCIR601_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Verify we can handle the sampling factors, and set up method pointers */ ci = 0 compptr = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Compute size of an "output group" for DCT scaling. This many samples * are to be converted from max_h_samp_factor * max_v_samp_factor pixels. */ h_out_group = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size / (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size v_out_group = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size / (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size h_in_group = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor v_in_group = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor *(*int32)(unsafe.Pointer(downsample + 52 + uintptr(ci)*4)) = v_out_group /* save for use later */ if h_in_group == h_out_group && v_in_group == v_out_group { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fsmoothing_factor != 0 { *(*Tdownsample1_ptr)(unsafe.Pointer(downsample + 12 + uintptr(ci)*4)) = __ccgo_fp(_fullsize_smooth_downsample) (*Tmy_downsampler)(unsafe.Pointer(downsample)).Fpub.Fneed_context_rows = int32(TRUE1) } else { *(*Tdownsample1_ptr)(unsafe.Pointer(downsample + 12 + uintptr(ci)*4)) = __ccgo_fp(_fullsize_downsample) } } else { if h_in_group == h_out_group*int32(2) && v_in_group == v_out_group { smoothok = int32(FALSE1) *(*Tdownsample1_ptr)(unsafe.Pointer(downsample + 12 + uintptr(ci)*4)) = __ccgo_fp(_h2v1_downsample) } else { if h_in_group == h_out_group*int32(2) && v_in_group == v_out_group*int32(2) { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fsmoothing_factor != 0 { *(*Tdownsample1_ptr)(unsafe.Pointer(downsample + 12 + uintptr(ci)*4)) = __ccgo_fp(_h2v2_smooth_downsample) (*Tmy_downsampler)(unsafe.Pointer(downsample)).Fpub.Fneed_context_rows = int32(TRUE1) } else { *(*Tdownsample1_ptr)(unsafe.Pointer(downsample + 12 + uintptr(ci)*4)) = __ccgo_fp(_h2v2_downsample) } } else { if h_in_group%h_out_group == 0 && v_in_group%v_out_group == 0 { smoothok = int32(FALSE1) *(*Tdownsample1_ptr)(unsafe.Pointer(downsample + 12 + uintptr(ci)*4)) = __ccgo_fp(_int_downsample) *(*TUINT8)(unsafe.Pointer(downsample + 92 + uintptr(ci))) = libc.Uint8FromInt32(h_in_group / h_out_group) *(*TUINT8)(unsafe.Pointer(downsample + 102 + uintptr(ci))) = libc.Uint8FromInt32(v_in_group / v_out_group) } else { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_FRACT_SAMPLE_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } } } goto _1 _1: ; ci++ compptr += 88 } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fsmoothing_factor != 0 && !(smoothok != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_SMOOTH_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, 0) } } /* * Compression initialization for writing raw-coefficient data. * Before calling this, all parameters and a data destination must be set up. * Call jpeg_finish_compress() to actually write the data. * * The number of passed virtual arrays must match cinfo->num_components. * Note that the virtual arrays need not be filled or even realized at * the time write_coefficients is called; indeed, if the virtual arrays * were requested from this compression object's memory manager, they * typically will be realized during this routine and filled afterwards. */ func Xjpeg_write_coefficients(tls *libc.TLS, cinfo Tj_compress_ptr, coef_arrays uintptr) { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(CSTATE_START) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Mark all tables to be written */ Xjpeg_suppress_tables(tls, cinfo, int32(FALSE1)) /* (Re)initialize error mgr and destination modules */ (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Freset_error_mgr})))(tls, cinfo) (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Finit_destination})))(tls, cinfo) /* Perform master selection of active modules */ _transencode_master_selection(tls, cinfo, coef_arrays) /* Wait for jpeg_finish_compress() call */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnext_scanline = uint32(0) /* so jpeg_write_marker works */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(CSTATE_WRCOEFS) } /* * Initialize the compression object with default parameters, * then copy from the source object all parameters needed for lossless * transcoding. Parameters that can be varied without loss (such as * scan script and Huffman optimization) are left in their default states. */ func Xjpeg_copy_critical_parameters(tls *libc.TLS, srcinfo Tj_decompress_ptr, dstinfo Tj_compress_ptr) { var c_quant, incomp, outcomp, qtblptr, slot_quant uintptr var ci, coefi, tblno, v1 int32 _, _, _, _, _, _, _, _, _ = c_quant, ci, coefi, incomp, outcomp, qtblptr, slot_quant, tblno, v1 /* Safety check to ensure start_compress not called yet. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fglobal_state != int32(CSTATE_START) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr)).Ferror_exit})))(tls, dstinfo) } /* Copy fundamental image dimensions */ (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fimage_width = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fimage_width (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fimage_height = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fimage_height (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Finput_components = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fnum_components (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fin_color_space = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fjpeg_color_space (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fjpeg_width = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Foutput_width (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fjpeg_height = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Foutput_height (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fmin_DCT_h_scaled_size = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fmin_DCT_h_scaled_size (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fmin_DCT_v_scaled_size = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fmin_DCT_v_scaled_size /* Initialize all parameters to default values */ Xjpeg_set_defaults(tls, dstinfo) /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB. * Fix it to get the right header markers for the image colorspace. * Note: Entropy table assignment in jpeg_set_colorspace * depends on color_transform. * Adaption is also required for setting the appropriate * entropy coding mode dependent on image data precision. */ (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fcolor_transform = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fcolor_transform Xjpeg_set_colorspace(tls, dstinfo, (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fjpeg_color_space) (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fdata_precision = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fdata_precision if (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fdata_precision > int32(8) { v1 = int32(TRUE1) } else { v1 = int32(FALSE1) } (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Farith_code = v1 (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).FCCIR601_sampling = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).FCCIR601_sampling /* Copy the source's quantization tables. */ tblno = 0 for { if !(tblno < int32(NUM_QUANT_TBLS)) { break } if *(*uintptr)(unsafe.Pointer(srcinfo + 164 + uintptr(tblno)*4)) != libc.UintptrFromInt32(0) { qtblptr = dstinfo + 88 + uintptr(tblno)*4 if *(*uintptr)(unsafe.Pointer(qtblptr)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(qtblptr)) = Xjpeg_alloc_quant_table(tls, dstinfo) } libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(qtblptr)), *(*uintptr)(unsafe.Pointer(srcinfo + 164 + uintptr(tblno)*4)), libc.Uint32FromInt64(128)) (*TJQUANT_TBL)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(qtblptr)))).Fsent_table = int32(FALSE1) } goto _2 _2: ; tblno++ } /* Copy the source's per-component info. * Note we assume jpeg_set_defaults has allocated the dest comp_info array. */ (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fnum_components = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fnum_components if (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fnum_components < int32(1) || (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fnum_components > int32(MAX_COMPONENTS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr)).Fmsg_code = int32(JERR_COMPONENT_COUNT) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fnum_components *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr + 24 + 1*4)) = int32(MAX_COMPONENTS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr)).Ferror_exit})))(tls, dstinfo) } ci = 0 incomp = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fcomp_info outcomp = (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fcomp_info for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fnum_components) { break } (*Tjpeg_component_info)(unsafe.Pointer(outcomp)).Fcomponent_id = (*Tjpeg_component_info)(unsafe.Pointer(incomp)).Fcomponent_id (*Tjpeg_component_info)(unsafe.Pointer(outcomp)).Fh_samp_factor = (*Tjpeg_component_info)(unsafe.Pointer(incomp)).Fh_samp_factor (*Tjpeg_component_info)(unsafe.Pointer(outcomp)).Fv_samp_factor = (*Tjpeg_component_info)(unsafe.Pointer(incomp)).Fv_samp_factor (*Tjpeg_component_info)(unsafe.Pointer(outcomp)).Fquant_tbl_no = (*Tjpeg_component_info)(unsafe.Pointer(incomp)).Fquant_tbl_no /* Make sure saved quantization table for component matches the qtable * slot. If not, the input file re-used this qtable slot. * IJG encoder currently cannot duplicate this. */ tblno = (*Tjpeg_component_info)(unsafe.Pointer(outcomp)).Fquant_tbl_no if tblno < 0 || tblno >= int32(NUM_QUANT_TBLS) || *(*uintptr)(unsafe.Pointer(srcinfo + 164 + uintptr(tblno)*4)) == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr)).Fmsg_code = int32(JERR_NO_QUANT_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr + 24)) = tblno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr)).Ferror_exit})))(tls, dstinfo) } slot_quant = *(*uintptr)(unsafe.Pointer(srcinfo + 164 + uintptr(tblno)*4)) c_quant = (*Tjpeg_component_info)(unsafe.Pointer(incomp)).Fquant_table if c_quant != libc.UintptrFromInt32(0) { coefi = 0 for { if !(coefi < int32(DCTSIZE2)) { break } if libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(c_quant + uintptr(coefi)*2))) != libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(slot_quant + uintptr(coefi)*2))) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr)).Fmsg_code = int32(JERR_MISMATCHED_QUANT_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr + 24)) = tblno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Ferr)).Ferror_exit})))(tls, dstinfo) } goto _4 _4: ; coefi++ } } /* Note: we do not copy the source's entropy table assignments; * instead we rely on jpeg_set_colorspace to have made a suitable choice. */ goto _3 _3: ; ci++ incomp += 88 outcomp += 88 } /* Also copy JFIF version and resolution information, if available. * Strictly speaking this isn't "critical" info, but it's nearly * always appropriate to copy it if available. In particular, * if the application chooses to copy JFIF 1.02 extension markers from * the source file, we need to copy the version to make sure we don't * emit a file that has 1.02 extensions but a claimed version of 1.01. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fsaw_JFIF_marker != 0 { if libc.Int32FromUint8((*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).FJFIF_major_version) == int32(1) || libc.Int32FromUint8((*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).FJFIF_major_version) == int32(2) { (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).FJFIF_major_version = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).FJFIF_major_version (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).FJFIF_minor_version = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).FJFIF_minor_version } (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).Fdensity_unit = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).Fdensity_unit (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).FX_density = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).FX_density (*Tjpeg_compress_struct)(unsafe.Pointer(dstinfo)).FY_density = (*Tjpeg_decompress_struct)(unsafe.Pointer(srcinfo)).FY_density } } func _jpeg_calc_trans_dimensions(tls *libc.TLS, cinfo Tj_compress_ptr) { /* Do computations that are needed before master selection phase */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size != (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_DCTSIZE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblock_size = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size } /* * Master selection of compression modules for transcoding. * This substitutes for jcinit.c's initialization of the full compressor. */ func _transencode_master_selection(tls *libc.TLS, cinfo Tj_compress_ptr, coef_arrays uintptr) { /* Do computations that are needed before master selection phase */ _jpeg_calc_trans_dimensions(tls, cinfo) /* Initialize master control (includes parameter checking/processing) */ Xjinit_c_master_control(tls, cinfo, int32(TRUE1)) /* Entropy encoding: either Huffman or arithmetic coding. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Farith_code != 0 { Xjinit_arith_encoder(tls, cinfo) } else { Xjinit_huff_encoder(tls, cinfo) } /* We need a special coefficient buffer controller. */ _transencode_coef_controller(tls, cinfo, coef_arrays) Xjinit_marker_writer(tls, cinfo) /* We can now tell the memory manager to allocate virtual arrays. */ (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Frealize_virt_arrays})))(tls, cinfo) /* Write the datastream header (SOI, JFIF) immediately. * Frame and scan headers are postponed till later. * This lets application insert special markers after the SOI. */ (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_writer)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fwrite_file_header})))(tls, cinfo) } /* * The rest of this file is a special implementation of the coefficient * buffer controller. This is similar to jccoefct.c, but it handles only * output from presupplied virtual arrays. Furthermore, we generate any * dummy padding blocks on-the-fly rather than expecting them to be present * in the arrays. */ /* Private buffer controller object */ type Tmy_coef_controller1 = struct { Fpub Tjpeg_c_coef_controller FiMCU_row_num TJDIMENSION FMCU_ctr TJDIMENSION FMCU_vert_offset int32 FMCU_rows_per_iMCU_row int32 Fwhole_image uintptr Fdummy_buffer [10]TJBLOCK } func _start_iMCU_row1(tls *libc.TLS, cinfo Tj_compress_ptr) { /* Reset within-iMCU-row counters for a new row */ var coef Tmy_coef_ptr _ = coef coef = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef /* In an interleaved scan, an MCU row is the same as an iMCU row. * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. * But at the bottom of the image, process only what's left. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan > int32(1) { (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row = int32(1) } else { if (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FiMCU_row_num < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows-uint32(1) { (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 296)))).Fv_samp_factor } else { (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 296)))).Flast_row_height } } (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_ctr = uint32(0) (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_vert_offset = 0 } /* * Initialize for a processing pass. */ func _start_pass_coef1(tls *libc.TLS, cinfo Tj_compress_ptr, pass_mode TJ_BUF_MODE) { var coef Tmy_coef_ptr _ = coef coef = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef if pass_mode != int32(JBUF_CRANK_DEST) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FiMCU_row_num = uint32(0) _start_iMCU_row1(tls, cinfo) } /* * Process some data. * We process the equivalent of one fully interleaved MCU row ("iMCU" row) * per call, ie, v_samp_factor block rows for each component in the scan. * The data is obtained from the virtual arrays and fed to the entropy coder. * Returns TRUE if the iMCU row is completed, FALSE if suspended. * * NB: input_buf is ignored; it is likely to be a NULL pointer. */ func _compress_output1(tls *libc.TLS, cinfo Tj_compress_ptr, input_buf TJSAMPIMAGE) (r Tboolean) { bp := tls.Alloc(48) defer tls.Free(48) var MCU_col_num, last_MCU_col, last_iMCU_row, start_col TJDIMENSION var blkn, blockcnt, ci, xindex, yindex, yoffset, v11, v12, v14, v5, v7, v9 int32 var buffer [4]TJBLOCKARRAY var buffer_ptr, v10, v15 TJBLOCKROW var coef Tmy_coef_ptr var compptr uintptr var _ /* MCU_buffer at bp+0 */ [10]TJBLOCKROW _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = MCU_col_num, blkn, blockcnt, buffer, buffer_ptr, ci, coef, compptr, last_MCU_col, last_iMCU_row, start_col, xindex, yindex, yoffset, v10, v11, v12, v14, v15, v5, v7, v9 coef = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef /* index of current MCU within row */ last_MCU_col = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FMCUs_per_row - uint32(1) last_iMCU_row = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows - uint32(1) /* Align the virtual buffers for the components used in this scan. */ ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) buffer[ci] = (*(*func(*libc.TLS, Tj_common_ptr, Tjvirt_barray_ptr, TJDIMENSION, TJDIMENSION, Tboolean) TJBLOCKARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Faccess_virt_barray})))(tls, cinfo, *(*Tjvirt_barray_ptr)(unsafe.Pointer((*Tmy_coef_controller1)(unsafe.Pointer(coef)).Fwhole_image + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)*4)), (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FiMCU_row_num*libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), int32(FALSE1)) goto _1 _1: ; ci++ } /* Loop to process one whole iMCU row */ yoffset = (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_vert_offset for { if !(yoffset < (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row) { break } MCU_col_num = (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_ctr for { if !(MCU_col_num <= last_MCU_col) { break } /* Construct list of pointers to DCT blocks belonging to this MCU */ blkn = 0 /* index of current DCT block within MCU */ ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) if MCU_col_num < last_MCU_col { v5 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width } else { v5 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_col_width } blockcnt = v5 start_col = MCU_col_num * libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width) yindex = 0 for { if !(yindex < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height) { break } if (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FiMCU_row_num < last_iMCU_row || yoffset+yindex < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_row_height { /* Fill in pointers to real blocks in this row */ buffer_ptr = *(*TJBLOCKROW)(unsafe.Pointer(buffer[ci] + uintptr(yoffset+yindex)*4)) + uintptr(start_col)*128 xindex = blockcnt for { v9 = blkn blkn++ v10 = buffer_ptr buffer_ptr += 128 (*(*[10]TJBLOCKROW)(unsafe.Pointer(bp)))[v9] = v10 goto _8 _8: ; xindex-- v7 = xindex if !(v7 != 0) { break } } /* Dummy blocks at right edge */ v11 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width - blockcnt xindex = v11 if v11 == 0 { goto _6 } } else { /* At bottom of image, need a whole row of dummy blocks */ xindex = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width } /* Fill in any dummy blocks needed in this row. * Dummy blocks are filled in the same way as in jccoefct.c: * all zeroes in the AC entries, DC entries equal to previous * block's DC value. The init routine has already zeroed the * AC entries, so we need only set the DC entries correctly. */ buffer_ptr = coef + 28 + uintptr(blkn)*128 for { *(*TJCOEF)(unsafe.Pointer(buffer_ptr)) = *(*TJCOEF)(unsafe.Pointer((*(*[10]TJBLOCKROW)(unsafe.Pointer(bp)))[blkn-int32(1)])) v14 = blkn blkn++ v15 = buffer_ptr buffer_ptr += 128 (*(*[10]TJBLOCKROW)(unsafe.Pointer(bp)))[v14] = v15 goto _13 _13: ; xindex-- v12 = xindex if !(v12 != 0) { break } } goto _6 _6: ; yindex++ } goto _4 _4: ; ci++ } /* Try to write the MCU. */ if !((*(*func(*libc.TLS, Tj_compress_ptr, TJBLOCKARRAY) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_encoder)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Fencode_mcu})))(tls, cinfo, bp) != 0) { /* Suspension forced; update state counters and exit */ (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_vert_offset = yoffset (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_ctr = MCU_col_num return int32(FALSE1) } goto _3 _3: ; MCU_col_num++ } /* Completed an MCU row, but perhaps not an iMCU row */ (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FMCU_ctr = uint32(0) goto _2 _2: ; yoffset++ } /* Completed the iMCU row, advance counters for next one */ (*Tmy_coef_controller1)(unsafe.Pointer(coef)).FiMCU_row_num++ _start_iMCU_row1(tls, cinfo) return int32(TRUE1) } /* * Initialize coefficient buffer controller. * * Each passed coefficient array must be the right size for that * coefficient: width_in_blocks wide and height_in_blocks high, * with unitheight at least v_samp_factor. */ func _transencode_coef_controller(tls *libc.TLS, cinfo Tj_compress_ptr, coef_arrays uintptr) { var coef Tmy_coef_ptr _ = coef coef = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(1308)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcoef = coef (*Tmy_coef_controller1)(unsafe.Pointer(coef)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_coef1) (*Tmy_coef_controller1)(unsafe.Pointer(coef)).Fpub.Fcompress_data = __ccgo_fp(_compress_output1) /* Save pointer to virtual arrays */ (*Tmy_coef_controller1)(unsafe.Pointer(coef)).Fwhole_image = coef_arrays /* Pre-zero space for dummy DCT blocks */ libc.Xmemset(tls, coef+28, 0, libc.Uint32FromInt64(1280)) } const JDCT_DEFAULT4 = 0 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* * Initialization of a JPEG decompression object. * The error manager must already be set up (in case memory manager fails). */ func Xjpeg_CreateDecompress(tls *libc.TLS, cinfo Tj_decompress_ptr, version int32, structsize Tsize_t) { var client_data, err uintptr var i int32 _, _, _ = client_data, err, i /* Guard against version mismatches between library and caller. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem = libc.UintptrFromInt32(0) /* so jpeg_destroy knows mem mgr not called */ if version != int32(JPEG_LIB_VERSION) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_LIB_VERSION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = int32(JPEG_LIB_VERSION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = version (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if structsize != libc.Uint32FromInt64(488) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STRUCT_SIZE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint32(libc.Uint32FromInt64(488)) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = libc.Int32FromUint32(structsize) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* For debugging purposes, we zero the whole master structure. * But the application has already set the err pointer, and may have set * client_data, so we have to save and restore those fields. * Note: if application hasn't set client_data, tools like Purify may * complain here. */ err = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr client_data = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fclient_data /* ignore Purify complaint here */ libc.Xmemset(tls, cinfo, 0, libc.Uint32FromInt64(488)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr = err (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fclient_data = client_data (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fis_decompressor = int32(TRUE1) /* Initialize a memory manager instance for this object */ Xjinit_memory_mgr(tls, cinfo) /* Zero out pointers to permanent structures. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress = libc.UintptrFromInt32(0) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc = libc.UintptrFromInt32(0) i = 0 for { if !(i < int32(NUM_QUANT_TBLS)) { break } *(*uintptr)(unsafe.Pointer(cinfo + 164 + uintptr(i)*4)) = libc.UintptrFromInt32(0) goto _1 _1: ; i++ } i = 0 for { if !(i < int32(NUM_HUFF_TBLS)) { break } *(*uintptr)(unsafe.Pointer(cinfo + 180 + uintptr(i)*4)) = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(cinfo + 196 + uintptr(i)*4)) = libc.UintptrFromInt32(0) goto _2 _2: ; i++ } /* Initialize marker processor so application can override methods * for COM, APPn markers before calling jpeg_read_header. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker_list = libc.UintptrFromInt32(0) Xjinit_marker_reader(tls, cinfo) /* And initialize the overall input controller. */ Xjinit_input_controller(tls, cinfo) /* OK, I'm ready */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_START) } /* * Destruction of a JPEG decompression object */ func Xjpeg_destroy_decompress(tls *libc.TLS, cinfo Tj_decompress_ptr) { Xjpeg_destroy(tls, cinfo) /* use common routine */ } /* * Abort processing of a JPEG decompression operation, * but don't destroy the object itself. */ func Xjpeg_abort_decompress(tls *libc.TLS, cinfo Tj_decompress_ptr) { Xjpeg_abort(tls, cinfo) /* use common routine */ } /* * Set default decompression parameters. */ func _default_decompress_parms(tls *libc.TLS, cinfo Tj_decompress_ptr) { var _mp uintptr var cid0, cid1, cid2, cid3 int32 _, _, _, _, _ = _mp, cid0, cid1, cid2, cid3 /* Guess the input colorspace, and set output colorspace accordingly. */ /* Note application may override our guesses. */ switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components { case int32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_GRAYSCALE) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_space = int32(JCS_GRAYSCALE) case int32(3): cid0 = (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info))).Fcomponent_id cid1 = (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).Fcomponent_id cid2 = (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).Fcomponent_id /* For robust detection of standard colorspaces * regardless of the presence of special markers, * check component IDs from SOF marker first. */ if cid0 == int32(0x01) && cid1 == int32(0x02) && cid2 == int32(0x03) { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_YCbCr) } else { if cid0 == int32(0x01) && cid1 == int32(0x22) && cid2 == int32(0x23) { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_BG_YCC) } else { if cid0 == int32(0x52) && cid1 == int32(0x47) && cid2 == int32(0x42) { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_RGB) } else { if cid0 == int32(0x72) && cid1 == int32(0x67) && cid2 == int32(0x62) { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_BG_RGB) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsaw_JFIF_marker != 0 { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_YCbCr) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsaw_Adobe_marker != 0 { switch libc.Int32FromUint8((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAdobe_transform) { case 0: (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_RGB) case int32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_YCbCr) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_ADOBE_XFORM) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint8((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAdobe_transform) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_YCbCr) /* assume it's YCbCr */ } } else { _mp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 *(*int32)(unsafe.Pointer(_mp)) = cid0 *(*int32)(unsafe.Pointer(_mp + 1*4)) = cid1 *(*int32)(unsafe.Pointer(_mp + 2*4)) = cid2 (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_UNKNOWN_IDS) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_YCbCr) /* assume it's YCbCr */ } } } } } } /* Always guess RGB is proper output colorspace. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_space = int32(JCS_RGB) case int32(4): cid0 = (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info))).Fcomponent_id cid1 = (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).Fcomponent_id cid2 = (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).Fcomponent_id cid3 = (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 3*88))).Fcomponent_id /* For robust detection of standard colorspaces * regardless of the presence of special markers, * check component IDs from SOF marker first. */ if cid0 == int32(0x01) && cid1 == int32(0x02) && cid2 == int32(0x03) && cid3 == int32(0x04) { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_YCCK) } else { if cid0 == int32(0x43) && cid1 == int32(0x4D) && cid2 == int32(0x59) && cid3 == int32(0x4B) { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_CMYK) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsaw_Adobe_marker != 0 { switch libc.Int32FromUint8((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAdobe_transform) { case 0: (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_CMYK) case int32(2): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_YCCK) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_ADOBE_XFORM) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint8((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAdobe_transform) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_YCCK) /* assume it's YCCK */ } } else { /* Unknown IDs and no special markers, assume straight CMYK. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_CMYK) } } } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_space = int32(JCS_CMYK) default: (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_UNKNOWN) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_space = int32(JCS_UNKNOWN) } /* Set defaults for other decompression parameters. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num = libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) /* 1:1 scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom = libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_gamma = float64(1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fbuffered_image = int32(FALSE1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fraw_data_out = int32(FALSE1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdct_method = int32(JDCT_ISLOW) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdo_fancy_upsampling = int32(TRUE1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdo_block_smoothing = int32(TRUE1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fquantize_colors = int32(FALSE1) /* We set these in case application only sets quantize_colors. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode = int32(JDITHER_FS) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftwo_pass_quantize = int32(TRUE1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdesired_number_of_colors = int32(256) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap = libc.UintptrFromInt32(0) /* Initialize for no mode change in buffered-image mode. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fenable_1pass_quant = int32(FALSE1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fenable_external_quant = int32(FALSE1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fenable_2pass_quant = int32(FALSE1) } /* * Decompression startup: read start of JPEG datastream to see what's there. * Need only initialize JPEG object and supply a data source before calling. * * This routine will read as far as the first SOS marker (ie, actual start of * compressed data), and will save all tables and parameters in the JPEG * object. It will also initialize the decompression parameters to default * values, and finally return JPEG_HEADER_OK. On return, the application may * adjust the decompression parameters and then call jpeg_start_decompress. * (Or, if the application only wanted to determine the image parameters, * the data need not be decompressed. In that case, call jpeg_abort or * jpeg_destroy to release any temporary space.) * If an abbreviated (tables only) datastream is presented, the routine will * return JPEG_HEADER_TABLES_ONLY upon reaching EOI. The application may then * re-use the JPEG object to read the abbreviated image datastream(s). * It is unnecessary (but OK) to call jpeg_abort in this case. * The JPEG_SUSPENDED return code only occurs if the data source module * requests suspension of the decompressor. In this case the application * should load more source data and then re-call jpeg_read_header to resume * processing. * If a non-suspending data source is used and require_image is TRUE, then the * return code need not be inspected since only JPEG_HEADER_OK is possible. * * This routine is now just a front end to jpeg_consume_input, with some * extra error checking. */ func Xjpeg_read_header(tls *libc.TLS, cinfo Tj_decompress_ptr, require_image Tboolean) (r int32) { var retcode int32 _ = retcode if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_START) && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_INHEADER) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } retcode = Xjpeg_consume_input(tls, cinfo) switch retcode { case int32(JPEG_REACHED_SOS): retcode = int32(JPEG_HEADER_OK) case int32(JPEG_REACHED_EOI): if require_image != 0 { /* Complain if application wanted an image */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_IMAGE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Reset to start state; it would be safer to require the application to * call jpeg_abort, but we can't change it now for compatibility reasons. * A side effect is to free any temporary memory (there shouldn't be any). */ Xjpeg_abort(tls, cinfo) /* sets state = DSTATE_START */ retcode = int32(JPEG_HEADER_TABLES_ONLY) case JPEG_SUSPENDED: /* no work */ break } return retcode } /* * Consume data in advance of what the decompressor requires. * This can be called at any time once the decompressor object has * been created and a data source has been set up. * * This routine is essentially a state machine that handles a couple * of critical state-transition actions, namely initial setup and * transition from header scanning to ready-for-start_decompress. * All the actual input is done via the input controller's consume_input * method. */ func Xjpeg_consume_input(tls *libc.TLS, cinfo Tj_decompress_ptr) (r int32) { var retcode int32 _ = retcode retcode = JPEG_SUSPENDED /* NB: every possible DSTATE value should be listed in this switch */ switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state { case int32(DSTATE_START): /* Start-of-datastream actions: reset appropriate modules */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Freset_input_controller})))(tls, cinfo) /* Initialize application's data source module */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Finit_source})))(tls, cinfo) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_INHEADER) /*FALLTHROUGH*/ fallthrough case int32(DSTATE_INHEADER): retcode = (*(*func(*libc.TLS, Tj_decompress_ptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fconsume_input})))(tls, cinfo) if retcode == int32(JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */ /* Set up default parameters based on header data */ _default_decompress_parms(tls, cinfo) /* Set global state: ready for start_decompress */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_READY) } case int32(DSTATE_READY): /* Can't advance past first SOS until start_decompress is called */ retcode = int32(JPEG_REACHED_SOS) case int32(DSTATE_PRELOAD): fallthrough case int32(DSTATE_PRESCAN): fallthrough case int32(DSTATE_SCANNING): fallthrough case int32(DSTATE_RAW_OK): fallthrough case int32(DSTATE_BUFIMAGE): fallthrough case int32(DSTATE_BUFPOST): fallthrough case int32(DSTATE_STOPPING): retcode = (*(*func(*libc.TLS, Tj_decompress_ptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fconsume_input})))(tls, cinfo) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } return retcode } /* * Have we finished reading the input file? */ func Xjpeg_input_complete(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Check for valid jpeg object */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state < int32(DSTATE_START) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state > int32(DSTATE_STOPPING) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } return (*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Feoi_reached } /* * Is there more than one scan? */ func Xjpeg_has_multiple_scans(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Only valid after jpeg_read_header completes */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state < int32(DSTATE_READY) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state > int32(DSTATE_STOPPING) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } return (*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fhas_multiple_scans } /* * Finish JPEG decompression. * * This will normally just verify the file trailer and release temp storage. * * Returns FALSE if suspended. The return value need be inspected only if * a suspending data source is used. */ func Xjpeg_finish_decompress(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { if ((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_SCANNING) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_RAW_OK)) && !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fbuffered_image != 0) { /* Terminate final pass of non-buffered mode */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_TOO_LITTLE_DATA) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_decomp_master)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Ffinish_output_pass})))(tls, cinfo) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_STOPPING) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_BUFIMAGE) { /* Finishing after a buffered-image operation */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_STOPPING) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_STOPPING) { /* STOPPING = repeat call after a suspension, anything else is error */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } } /* Read until EOI */ for !((*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Feoi_reached != 0) { if (*(*func(*libc.TLS, Tj_decompress_ptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fconsume_input})))(tls, cinfo) == JPEG_SUSPENDED { return int32(FALSE1) } /* Suspend, come back later */ } /* Do final cleanup */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fterm_source})))(tls, cinfo) /* We can use jpeg_abort to release memory and reset global_state */ Xjpeg_abort(tls, cinfo) return int32(TRUE1) } const JDCT_DEFAULT5 = "JDCT_ISLOW" /* * Decompression initialization. * jpeg_read_header must be completed before calling this. * * If a multipass operating mode was selected, this will do all but the * last pass, and thus may take a great deal of time. * * Returns FALSE if suspended. The return value need be inspected only if * a suspending data source is used. */ func Xjpeg_start_decompress(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { var retcode, v2 int32 var v3 uintptr _, _, _ = retcode, v2, v3 if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_READY) { /* First call: initialize master control, select active modules */ Xjinit_master_decompress(tls, cinfo) if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fbuffered_image != 0 { /* No more work here; expecting jpeg_start_output next */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_BUFIMAGE) return int32(TRUE1) } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_PRELOAD) } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_PRELOAD) { /* If file has multiple scans, absorb them all into the coef buffer */ if (*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fhas_multiple_scans != 0 { for { /* Call progress monitor hook if present */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fprogress_monitor})))(tls, cinfo) } /* Absorb some more input */ retcode = (*(*func(*libc.TLS, Tj_decompress_ptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fconsume_input})))(tls, cinfo) if retcode == JPEG_SUSPENDED { return int32(FALSE1) } if retcode == int32(JPEG_REACHED_EOI) { break } /* Advance progress counter if appropriate */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) && (retcode == int32(JPEG_ROW_COMPLETED) || retcode == int32(JPEG_REACHED_SOS)) { v3 = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress + 4 *(*int32)(unsafe.Pointer(v3))++ v2 = *(*int32)(unsafe.Pointer(v3)) if v2 >= (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_limit { /* jdmaster underestimated number of scans; ratchet up one scan */ *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress + 8)) += libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows) } } goto _1 _1: } } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scan_number = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_PRESCAN) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* Perform any dummy output passes, and set up for the final pass */ return _output_pass_setup(tls, cinfo) } /* * Set up for an output pass, and perform any dummy pass(es) needed. * Common subroutine for jpeg_start_decompress and jpeg_start_output. * Entry: global_state = DSTATE_PRESCAN only if previously suspended. * Exit: If done, returns TRUE and sets global_state for proper output mode. * If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN. */ func _output_pass_setup(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { var last_scanline TJDIMENSION var v1 int32 _, _ = last_scanline, v1 if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_PRESCAN) { /* First call: do pass setup */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_decomp_master)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fprepare_for_output_pass})))(tls, cinfo) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline = uint32(0) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_PRESCAN) } /* Loop over any required dummy passes */ for (*Tjpeg_decomp_master)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fis_dummy_pass != 0 { /* Crank through the dummy pass */ for (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height { /* Call progress monitor hook if present */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) { (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_counter = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline) (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_limit = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fprogress_monitor})))(tls, cinfo) } /* Process some data */ last_scanline = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPARRAY, uintptr, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_d_main_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmain1)).Fprocess_data})))(tls, cinfo, libc.UintptrFromInt32(0), cinfo+140, libc.Uint32FromInt32(0)) if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline == last_scanline { return int32(FALSE1) } /* No progress made, must suspend */ } /* Finish up dummy pass, and set up for another one */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_decomp_master)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Ffinish_output_pass})))(tls, cinfo) (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_decomp_master)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Fprepare_for_output_pass})))(tls, cinfo) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline = uint32(0) } /* Ready for application to drive output pass through * jpeg_read_scanlines or jpeg_read_raw_data. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fraw_data_out != 0 { v1 = int32(DSTATE_RAW_OK) } else { v1 = int32(DSTATE_SCANNING) } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = v1 return int32(TRUE1) } /* * Read some scanlines of data from the JPEG decompressor. * * The return value will be the number of lines actually read. * This may be less than the number requested in several cases, * including bottom of image, data source suspension, and operating * modes that emit multiple scanlines at a time. * * Note: we warn about excess calls to jpeg_read_scanlines() since * this likely signals an application programmer error. However, * an oversize buffer (max_lines > scanlines remaining) is not an error. */ func Xjpeg_read_scanlines(tls *libc.TLS, cinfo Tj_decompress_ptr, scanlines TJSAMPARRAY, max_lines TJDIMENSION) (r TJDIMENSION) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* row_ctr at bp+0 */ TJDIMENSION if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_SCANNING) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline >= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_TOO_MUCH_DATA) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) return uint32(0) } /* Call progress monitor hook if present */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) { (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_counter = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline) (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_limit = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fprogress_monitor})))(tls, cinfo) } /* Process some data */ *(*TJDIMENSION)(unsafe.Pointer(bp)) = uint32(0) (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPARRAY, uintptr, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_d_main_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmain1)).Fprocess_data})))(tls, cinfo, scanlines, bp, max_lines) *(*TJDIMENSION)(unsafe.Pointer(cinfo + 140)) += *(*TJDIMENSION)(unsafe.Pointer(bp)) return *(*TJDIMENSION)(unsafe.Pointer(bp)) } /* * Alternate entry point to read raw data. * Processes exactly one iMCU row per call, unless suspended. */ func Xjpeg_read_raw_data(tls *libc.TLS, cinfo Tj_decompress_ptr, data TJSAMPIMAGE, max_lines TJDIMENSION) (r TJDIMENSION) { var lines_per_iMCU_row TJDIMENSION _ = lines_per_iMCU_row if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_RAW_OK) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline >= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_TOO_MUCH_DATA) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) return uint32(0) } /* Call progress monitor hook if present */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) { (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_counter = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scanline) (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_limit = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fprogress_monitor})))(tls, cinfo) } /* Verify that at least one iMCU row can be returned. */ lines_per_iMCU_row = libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor * (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size) if max_lines < lines_per_iMCU_row { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BUFFER_SIZE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Decompress directly into user's buffer. */ if !((*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_d_coef_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fdecompress_data})))(tls, cinfo, data) != 0) { return uint32(0) } /* suspension forced, can do nothing more */ /* OK, we processed one iMCU row. */ *(*TJDIMENSION)(unsafe.Pointer(cinfo + 140)) += lines_per_iMCU_row return lines_per_iMCU_row } /* Additional entry points for buffered-image mode. */ /* * Initialize for an output pass in buffered-image mode. */ func Xjpeg_start_output(tls *libc.TLS, cinfo Tj_decompress_ptr, scan_number int32) (r Tboolean) { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_BUFIMAGE) && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_PRESCAN) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Limit scan number to valid range */ if scan_number <= 0 { scan_number = int32(1) } if (*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Feoi_reached != 0 && scan_number > (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number { scan_number = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scan_number = scan_number /* Perform any dummy output passes, and set up for the real pass */ return _output_pass_setup(tls, cinfo) } /* * Finish up after an output pass in buffered-image mode. * * Returns FALSE if suspended. The return value need be inspected only if * a suspending data source is used. */ func Xjpeg_finish_output(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { if ((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_SCANNING) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_RAW_OK)) && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fbuffered_image != 0 { /* Terminate this pass. */ /* We do not require the whole pass to have been completed. */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_decomp_master)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmaster)).Ffinish_output_pass})))(tls, cinfo) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_BUFPOST) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_BUFPOST) { /* BUFPOST = repeat call after a suspension, anything else is error */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* Read markers looking for SOS or EOI */ for (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scan_number && !((*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Feoi_reached != 0) { if (*(*func(*libc.TLS, Tj_decompress_ptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fconsume_input})))(tls, cinfo) == JPEG_SUSPENDED { return int32(FALSE1) } /* Suspend, come back later */ } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_BUFIMAGE) return int32(TRUE1) } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Expanded entropy decoder object for arithmetic decoding. */ type Tarith_entropy_decoder = struct { Fpub Tjpeg_entropy_decoder Fc TINT32 Fa TINT32 Fct int32 Flast_dc_val [4]int32 Fdc_context [4]int32 Frestarts_to_go uint32 Fdc_stats [16]uintptr Fac_stats [16]uintptr Ffixed_bin [4]uint8 } /* The following two definitions specify the allocation chunk size * for the statistics area. * According to sections F.1.4.4.1.3 and F.1.4.4.2, we need at least * 49 statistics bins for DC, and 245 statistics bins for AC coding. * * We use a compact representation with 1 byte per statistics bin, * thus the numbers directly represent byte sizes. * This 1 byte per statistics bin contains the meaning of the MPS * (more probable symbol) in the highest bit (mask 0x80), and the * index into the probability estimation state machine table * in the lower bits (mask 0x7F). */ func _get_byte(tls *libc.TLS, cinfo Tj_decompress_ptr) (r int32) { /* Read next input byte; we do not support suspension in this module. */ var src, v1, v2 uintptr _, _, _ = src, v1, v2 src = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc if (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Fbytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(src)).Ffill_input_buffer})))(tls, cinfo) != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CANT_SUSPEND) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Fbytes_in_buffer-- v2 = src v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ return libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v1))) } /* * The core arithmetic decoding routine (common in JPEG and JBIG). * This needs to go as fast as possible. * Machine-dependent optimization facilities * are not utilized in this portable implementation. * However, this code should be fairly efficient and * may be a good base for further optimizations anyway. * * Return value is 0 or 1 (binary decision). * * Note: I've changed the handling of the code base & bit * buffer register C compared to other implementations * based on the standards layout & procedures. * While it also contains both the actual base of the * coding interval (16 bits) and the next-bits buffer, * the cut-point between these two parts is floating * (instead of fixed) with the bit shift counter CT. * Thus, we also need only one (variable instead of * fixed size) shift for the LPS/MPS decision, and * we can do away with any renormalization update * of C (except for new data insertion, of course). * * I've also introduced a new scheme for accessing * the probability estimation state machine table, * derived from Markus Kuhn's JBIG implementation. */ func _arith_decode(tls *libc.TLS, cinfo Tj_decompress_ptr, st uintptr) (r int32) { var data, sv, v1, v4 int32 var e Tarith_entropy_ptr var nl, nm uint8 var qe, temp TINT32 var v2, v5, p3 uintptr _, _, _, _, _, _, _, _, _, _, _, _ = data, e, nl, nm, qe, sv, temp, v1, v2, v4, v5, p3 e = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Renormalization & data input per section D.2.6 */ for (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fa < int32(0x8000) { v2 = e + 20 *(*int32)(unsafe.Pointer(v2))-- v1 = *(*int32)(unsafe.Pointer(v2)) if v1 < 0 { /* Need to fetch next data byte */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker != 0 { data = 0 } else { data = _get_byte(tls, cinfo) /* read next input byte */ if data == int32(0xFF) { /* zero stuff or marker code */ for cond := true; cond; cond = data == int32(0xFF) { data = _get_byte(tls, cinfo) } /* swallow extra 0xFF bytes */ if data == 0 { data = int32(0xFF) } else { /* Note: Different from the Huffman decoder, hitting * a marker while processing the compressed data * segment is legal in arithmetic coding. * The convention is to supply zero data * then until decoding is complete. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker = data data = 0 } } } (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fc = (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fc< re-init A and exit loop */ (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fa = int32(0x8000) } } /* => e->a = 0x10000L after loop exit */ } *(*TINT32)(unsafe.Pointer(e + 16)) <<= int32(1) } /* Fetch values from our compact representation of Table D.3(D.2): * Qe values and probability estimation state machine */ sv = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(st))) qe = Xjpeg_aritab[sv&int32(0x7F)] /* => Qe_Value */ nl = libc.Uint8FromInt32(qe & int32(0xFF)) qe >>= int32(8) /* Next_Index_LPS + Switch_MPS */ nm = libc.Uint8FromInt32(qe & int32(0xFF)) qe >>= int32(8) /* Next_Index_MPS */ /* Decode & estimation procedures per sections D.2.4 & D.2.5 */ temp = (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fa - qe (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fa = temp temp <<= (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fct if (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fc >= temp { *(*TINT32)(unsafe.Pointer(e + 12)) -= temp /* Conditional LPS (less probable symbol) exchange */ if (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fa < qe { (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fa = qe *(*uint8)(unsafe.Pointer(st)) = libc.Uint8FromInt32(sv&int32(0x80) ^ libc.Int32FromUint8(nm)) /* Estimate_after_MPS */ } else { (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fa = qe *(*uint8)(unsafe.Pointer(st)) = libc.Uint8FromInt32(sv&int32(0x80) ^ libc.Int32FromUint8(nl)) /* Estimate_after_LPS */ sv ^= int32(0x80) /* Exchange LPS/MPS */ } } else { if (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fa < int32(0x8000) { /* Conditional MPS (more probable symbol) exchange */ if (*Tarith_entropy_decoder)(unsafe.Pointer(e)).Fa < qe { *(*uint8)(unsafe.Pointer(st)) = libc.Uint8FromInt32(sv&int32(0x80) ^ libc.Int32FromUint8(nl)) /* Estimate_after_LPS */ sv ^= int32(0x80) /* Exchange LPS/MPS */ } else { *(*uint8)(unsafe.Pointer(st)) = libc.Uint8FromInt32(sv&int32(0x80) ^ libc.Int32FromUint8(nm)) /* Estimate_after_MPS */ } } } return sv >> int32(7) } /* * Check for a restart marker & resynchronize decoder. */ func _process_restart(tls *libc.TLS, cinfo Tj_decompress_ptr) { var ci int32 var compptr uintptr var entropy Tarith_entropy_ptr _, _, _ = ci, compptr, entropy entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Advance past the RSTn marker */ if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fread_restart_marker})))(tls, cinfo) != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CANT_SUSPEND) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Re-initialize statistics areas */ ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs == 0 && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no)*4)), 0, libc.Uint32FromInt32(libc.Int32FromInt32(DC_STAT_BINS))) /* Reset DC predictions to 0 */ *(*int32)(unsafe.Pointer(entropy + 24 + uintptr(ci)*4)) = 0 *(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4)) = 0 } if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0) && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se != 0 || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs != 0 { libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer(entropy + 124 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no)*4)), 0, libc.Uint32FromInt32(libc.Int32FromInt32(AC_STAT_BINS))) } goto _1 _1: ; ci++ } /* Reset arithmetic decoding variables */ (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fc = 0 (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fa = 0 (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct = -int32(16) /* force reading 2 initial bytes to fill C */ /* Reset restart counter */ (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval } /* * Arithmetic MCU decoding. * Each of these routines decodes and returns one MCU's worth of * arithmetic-compressed coefficients. * The coefficients are reordered from zigzag order into natural array order, * but are not dequantized. * * The i'th block of the MCU is stored into the block pointed to by * MCU_data[i]. WE ASSUME THIS AREA IS INITIALLY ZEROED BY THE CALLER. */ /* * MCU decoding for DC initial scan (either spectral selection, * or first pass of successive approximation). */ func _decode_mcu_DC_first(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var blkn, ci, m, sign, tbl, v, v2 int32 var block TJBLOCKROW var entropy Tarith_entropy_ptr var st uintptr _, _, _, _, _, _, _, _, _, _ = blkn, block, ci, entropy, m, sign, st, tbl, v, v2 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Process restart marker if needed */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _process_restart(tls, cinfo) } (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } if (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct == -int32(1) { return int32(TRUE1) } /* if error do nothing */ /* Outer loop handles each block in the MCU */ blkn = 0 for { if !(blkn < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)) ci = *(*int32)(unsafe.Pointer(cinfo + 372 + uintptr(blkn)*4)) tbl = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)))).Fdc_tbl_no /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */ /* Table F.4: Point to statistics bin S0 for DC coefficient coding */ st = *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr(tbl)*4)) + uintptr(*(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4))) /* Figure F.19: Decode_DC_DIFF */ if _arith_decode(tls, cinfo, st) == 0 { *(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4)) = 0 } else { /* Figure F.21: Decoding nonzero value v */ /* Figure F.22: Decoding the sign of v */ sign = _arith_decode(tls, cinfo, st+uintptr(1)) st += uintptr(2) st += uintptr(sign) /* Figure F.23: Decoding the magnitude category of v */ v2 = _arith_decode(tls, cinfo, st) m = v2 if v2 != 0 { st = *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr(tbl)*4)) + uintptr(20) /* Table F.4: X1 = 20 */ for _arith_decode(tls, cinfo, st) != 0 { m <<= int32(1) if m == libc.Int32FromUint32(0x8000) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_ARITH_BAD_CODE) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct = -int32(1) /* magnitude overflow */ return int32(TRUE1) } st += uintptr(1) } } /* Section F.1.4.4.1.2: Establish dc_context conditioning category */ if m < libc.Int32FromInt32(1)<<*(*TUINT8)(unsafe.Pointer(cinfo + 232 + uintptr(tbl)))>>libc.Int32FromInt32(1) { *(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4)) = 0 } else { if m > libc.Int32FromInt32(1)<<*(*TUINT8)(unsafe.Pointer(cinfo + 248 + uintptr(tbl)))>>libc.Int32FromInt32(1) { *(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4)) = int32(12) + sign*int32(4) } else { *(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4)) = int32(4) + sign*int32(4) } } /* small diff category */ v = m /* Figure F.24: Decoding the magnitude bit pattern of v */ st += uintptr(14) for { m >>= int32(1) if !(m != 0) { break } if _arith_decode(tls, cinfo, st) != 0 { v |= m } } v += int32(1) if sign != 0 { v = -v } *(*int32)(unsafe.Pointer(entropy + 24 + uintptr(ci)*4)) += v } /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */ *(*TJCOEF)(unsafe.Pointer(block)) = int16(*(*int32)(unsafe.Pointer(entropy + 24 + uintptr(ci)*4)) << (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl) goto _1 _1: ; blkn++ } return int32(TRUE1) } /* * MCU decoding for AC initial scan (either spectral selection, * or first pass of successive approximation). */ func _decode_mcu_AC_first(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var block TJBLOCKROW var entropy Tarith_entropy_ptr var k, m, sign, tbl, v, v2, v3 int32 var natural_order, st uintptr _, _, _, _, _, _, _, _, _, _, _ = block, entropy, k, m, natural_order, sign, st, tbl, v, v2, v3 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Process restart marker if needed */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _process_restart(tls, cinfo) } (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } if (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct == -int32(1) { return int32(TRUE1) } /* if error do nothing */ natural_order = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order /* There is always only one block per MCU */ block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data)) tbl = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 344)))).Fac_tbl_no /* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */ /* Figure F.20: Decode_AC_coefficients */ k = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs - int32(1) for cond := true; cond; cond = k < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe { st = *(*uintptr)(unsafe.Pointer(entropy + 124 + uintptr(tbl)*4)) + uintptr(int32(3)*k) if _arith_decode(tls, cinfo, st) != 0 { break } /* EOB flag */ for { k++ if _arith_decode(tls, cinfo, st+uintptr(1)) != 0 { break } st += uintptr(3) if k >= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_ARITH_BAD_CODE) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct = -int32(1) /* spectral overflow */ return int32(TRUE1) } goto _1 _1: } /* Figure F.21: Decoding nonzero value v */ /* Figure F.22: Decoding the sign of v */ sign = _arith_decode(tls, cinfo, entropy+188) st += uintptr(2) /* Figure F.23: Decoding the magnitude category of v */ v2 = _arith_decode(tls, cinfo, st) m = v2 if v2 != 0 { if _arith_decode(tls, cinfo, st) != 0 { m <<= int32(1) if k <= libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 264 + uintptr(tbl)))) { v3 = int32(189) } else { v3 = int32(217) } st = *(*uintptr)(unsafe.Pointer(entropy + 124 + uintptr(tbl)*4)) + uintptr(v3) for _arith_decode(tls, cinfo, st) != 0 { m <<= int32(1) if m == libc.Int32FromUint32(0x8000) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_ARITH_BAD_CODE) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct = -int32(1) /* magnitude overflow */ return int32(TRUE1) } st += uintptr(1) } } } v = m /* Figure F.24: Decoding the magnitude bit pattern of v */ st += uintptr(14) for { m >>= int32(1) if !(m != 0) { break } if _arith_decode(tls, cinfo, st) != 0 { v |= m } } v += int32(1) if sign != 0 { v = -v } /* Scale and output coefficient in natural (dezigzagged) order */ *(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)))*2)) = int16(v << (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl) } return int32(TRUE1) } /* * MCU decoding for DC successive approximation refinement scan. * Note: we assume such scans can be multi-component, * although the spec is not very clear on the point. */ func _decode_mcu_DC_refine(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var blkn int32 var entropy Tarith_entropy_ptr var p1 TJCOEF var st, p2 uintptr _, _, _, _, _ = blkn, entropy, p1, st, p2 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Process restart marker if needed */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _process_restart(tls, cinfo) } (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } st = entropy + 188 /* use fixed probability estimation */ p1 = int16(int32(1) << (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl) /* 1 in the bit position being coded */ /* Outer loop handles each block in the MCU */ blkn = 0 for { if !(blkn < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } /* Encoded data is simply the next bit of the two's-complement DC value */ if _arith_decode(tls, cinfo, st) != 0 { p2 = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)) *(*TJCOEF)(unsafe.Pointer(p2)) = TJCOEF(int32(*(*TJCOEF)(unsafe.Pointer(p2))) | int32(p1)) } goto _1 _1: ; blkn++ } return int32(TRUE1) } /* * MCU decoding for AC successive approximation refinement scan. */ func _decode_mcu_AC_refine(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var block TJBLOCKROW var entropy Tarith_entropy_ptr var k, kex, tbl, v1, v4 int32 var m1, p1 TJCOEF var natural_order, st, p5, p6 uintptr var thiscoef TJCOEFPTR _, _, _, _, _, _, _, _, _, _, _, _, _, _ = block, entropy, k, kex, m1, natural_order, p1, st, tbl, thiscoef, v1, v4, p5, p6 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Process restart marker if needed */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _process_restart(tls, cinfo) } (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } if (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct == -int32(1) { return int32(TRUE1) } /* if error do nothing */ natural_order = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order /* There is always only one block per MCU */ block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data)) tbl = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 344)))).Fac_tbl_no p1 = int16(int32(1) << (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl) /* 1 in the bit position being coded */ m1 = int16(-int32(p1)) /* -1 in the bit position being coded */ /* Establish EOBx (previous stage end-of-block) index */ kex = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe for { if *(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(kex)*4)))*2)) != 0 { break } goto _2 _2: ; kex-- v1 = kex if !(v1 != 0) { break } } k = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs - int32(1) for cond := true; cond; cond = k < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe { st = *(*uintptr)(unsafe.Pointer(entropy + 124 + uintptr(tbl)*4)) + uintptr(int32(3)*k) if k >= kex { if _arith_decode(tls, cinfo, st) != 0 { break } } /* EOB flag */ for { k++ v4 = k thiscoef = block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(v4)*4)))*2 if *(*TJCOEF)(unsafe.Pointer(thiscoef)) != 0 { /* previously nonzero coef */ if _arith_decode(tls, cinfo, st+uintptr(2)) != 0 { if int32(*(*TJCOEF)(unsafe.Pointer(thiscoef))) < 0 { p5 = thiscoef *(*TJCOEF)(unsafe.Pointer(p5)) = TJCOEF(int32(*(*TJCOEF)(unsafe.Pointer(p5))) + int32(m1)) } else { p6 = thiscoef *(*TJCOEF)(unsafe.Pointer(p6)) = TJCOEF(int32(*(*TJCOEF)(unsafe.Pointer(p6))) + int32(p1)) } } break } if _arith_decode(tls, cinfo, st+uintptr(1)) != 0 { /* newly nonzero coef */ if _arith_decode(tls, cinfo, entropy+188) != 0 { *(*TJCOEF)(unsafe.Pointer(thiscoef)) = m1 } else { *(*TJCOEF)(unsafe.Pointer(thiscoef)) = p1 } break } st += uintptr(3) if k >= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_ARITH_BAD_CODE) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct = -int32(1) /* spectral overflow */ return int32(TRUE1) } goto _3 _3: } } return int32(TRUE1) } /* * Decode one MCU's worth of arithmetic-compressed coefficients. */ func _decode_mcu(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var blkn, ci, k, m, sign, tbl, v, v2, v4, v5 int32 var block TJBLOCKROW var compptr, natural_order, st uintptr var entropy Tarith_entropy_ptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = blkn, block, ci, compptr, entropy, k, m, natural_order, sign, st, tbl, v, v2, v4, v5 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Process restart marker if needed */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _process_restart(tls, cinfo) } (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } if (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct == -int32(1) { return int32(TRUE1) } /* if error do nothing */ natural_order = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order /* Outer loop handles each block in the MCU */ blkn = 0 for { if !(blkn < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)) ci = *(*int32)(unsafe.Pointer(cinfo + 372 + uintptr(blkn)*4)) compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */ tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no /* Table F.4: Point to statistics bin S0 for DC coefficient coding */ st = *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr(tbl)*4)) + uintptr(*(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4))) /* Figure F.19: Decode_DC_DIFF */ if _arith_decode(tls, cinfo, st) == 0 { *(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4)) = 0 } else { /* Figure F.21: Decoding nonzero value v */ /* Figure F.22: Decoding the sign of v */ sign = _arith_decode(tls, cinfo, st+uintptr(1)) st += uintptr(2) st += uintptr(sign) /* Figure F.23: Decoding the magnitude category of v */ v2 = _arith_decode(tls, cinfo, st) m = v2 if v2 != 0 { st = *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr(tbl)*4)) + uintptr(20) /* Table F.4: X1 = 20 */ for _arith_decode(tls, cinfo, st) != 0 { m <<= int32(1) if m == libc.Int32FromUint32(0x8000) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_ARITH_BAD_CODE) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct = -int32(1) /* magnitude overflow */ return int32(TRUE1) } st += uintptr(1) } } /* Section F.1.4.4.1.2: Establish dc_context conditioning category */ if m < libc.Int32FromInt32(1)<<*(*TUINT8)(unsafe.Pointer(cinfo + 232 + uintptr(tbl)))>>libc.Int32FromInt32(1) { *(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4)) = 0 } else { if m > libc.Int32FromInt32(1)<<*(*TUINT8)(unsafe.Pointer(cinfo + 248 + uintptr(tbl)))>>libc.Int32FromInt32(1) { *(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4)) = int32(12) + sign*int32(4) } else { *(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4)) = int32(4) + sign*int32(4) } } /* small diff category */ v = m /* Figure F.24: Decoding the magnitude bit pattern of v */ st += uintptr(14) for { m >>= int32(1) if !(m != 0) { break } if _arith_decode(tls, cinfo, st) != 0 { v |= m } } v += int32(1) if sign != 0 { v = -v } *(*int32)(unsafe.Pointer(entropy + 24 + uintptr(ci)*4)) += v } *(*TJCOEF)(unsafe.Pointer(block)) = int16(*(*int32)(unsafe.Pointer(entropy + 24 + uintptr(ci)*4))) /* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se == 0 { goto _1 } tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no k = 0 /* Figure F.20: Decode_AC_coefficients */ for cond := true; cond; cond = k < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se { st = *(*uintptr)(unsafe.Pointer(entropy + 124 + uintptr(tbl)*4)) + uintptr(int32(3)*k) if _arith_decode(tls, cinfo, st) != 0 { break } /* EOB flag */ for { k++ if _arith_decode(tls, cinfo, st+uintptr(1)) != 0 { break } st += uintptr(3) if k >= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_ARITH_BAD_CODE) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct = -int32(1) /* spectral overflow */ return int32(TRUE1) } goto _3 _3: } /* Figure F.21: Decoding nonzero value v */ /* Figure F.22: Decoding the sign of v */ sign = _arith_decode(tls, cinfo, entropy+188) st += uintptr(2) /* Figure F.23: Decoding the magnitude category of v */ v4 = _arith_decode(tls, cinfo, st) m = v4 if v4 != 0 { if _arith_decode(tls, cinfo, st) != 0 { m <<= int32(1) if k <= libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 264 + uintptr(tbl)))) { v5 = int32(189) } else { v5 = int32(217) } st = *(*uintptr)(unsafe.Pointer(entropy + 124 + uintptr(tbl)*4)) + uintptr(v5) for _arith_decode(tls, cinfo, st) != 0 { m <<= int32(1) if m == libc.Int32FromUint32(0x8000) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_ARITH_BAD_CODE) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct = -int32(1) /* magnitude overflow */ return int32(TRUE1) } st += uintptr(1) } } } v = m /* Figure F.24: Decoding the magnitude bit pattern of v */ st += uintptr(14) for { m >>= int32(1) if !(m != 0) { break } if _arith_decode(tls, cinfo, st) != 0 { v |= m } } v += int32(1) if sign != 0 { v = -v } *(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)))*2)) = int16(v) } goto _1 _1: ; blkn++ } return int32(TRUE1) } /* * Initialize for an arithmetic-compressed scan. */ func _start_pass1(tls *libc.TLS, cinfo Tj_decompress_ptr) { var ci, cindex, coefi, expected, tbl, v6 int32 var coef_bit_ptr, compptr uintptr var entropy Tarith_entropy_ptr _, _, _, _, _, _, _, _, _ = ci, cindex, coef_bit_ptr, coefi, compptr, entropy, expected, tbl, v6 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0) { goto _1 } /* Validate progressive scan parameters */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe != 0 { goto bad } } else { /* need not check Ss/Se < 0 since they came from unsigned bytes */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe > (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se { goto bad } /* AC scans may have only one component */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan != int32(1) { goto bad } } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh != 0 { /* Successive approximation refinement scan: must have Al = Ah-1. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh-int32(1) != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl { goto bad } } if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl > int32(13)) { goto _3 } /* need not check for < 0 */ goto bad bad: ; (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PROGRESSION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 2*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 3*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) _3: ; /* Update progression status, and verify that scan order is legal. * Note that inter-scan inconsistencies are treated as warnings * not fatal errors ... not clear if this is right way to behave. */ ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } cindex = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)))).Fcomponent_index coef_bit_ptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef_bits + uintptr(cindex)*256 if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs != 0 && *(*int32)(unsafe.Pointer(coef_bit_ptr)) < 0 { /* AC without prior DC scan */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_BOGUS_PROGRESSION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = cindex *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = 0 (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) } coefi = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs for { if !(coefi <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe) { break } if *(*int32)(unsafe.Pointer(coef_bit_ptr + uintptr(coefi)*4)) < 0 { v6 = 0 } else { v6 = *(*int32)(unsafe.Pointer(coef_bit_ptr + uintptr(coefi)*4)) } expected = v6 if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh != expected { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_BOGUS_PROGRESSION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = cindex *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = coefi (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) } *(*int32)(unsafe.Pointer(coef_bit_ptr + uintptr(coefi)*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl goto _5 _5: ; coefi++ } goto _4 _4: ; ci++ } /* Select MCU decoding routine */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu_DC_first) } else { (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu_AC_first) } } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu_DC_refine) } else { (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu_AC_refine) } } goto _2 _1: ; /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG. * This ought to be an error condition, but we make it a warning. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs != 0 || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh != 0 || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl != 0 || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe < int32(DCTSIZE2) && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_NOT_SEQUENTIAL) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) } /* Select MCU decoding routine */ (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu) _2: ; /* Allocate & initialize requested statistics areas */ ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs == 0 && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no if tbl < 0 || tbl >= int32(NUM_ARITH_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_ARITH_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = tbl (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr(tbl)*4)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr(tbl)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), uint32(DC_STAT_BINS)) } libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr(tbl)*4)), 0, libc.Uint32FromInt32(libc.Int32FromInt32(DC_STAT_BINS))) /* Initialize DC predictions to 0 */ *(*int32)(unsafe.Pointer(entropy + 24 + uintptr(ci)*4)) = 0 *(*int32)(unsafe.Pointer(entropy + 40 + uintptr(ci)*4)) = 0 } if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0) && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se != 0 || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs != 0 { tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no if tbl < 0 || tbl >= int32(NUM_ARITH_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_ARITH_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = tbl (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if *(*uintptr)(unsafe.Pointer(entropy + 124 + uintptr(tbl)*4)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(entropy + 124 + uintptr(tbl)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), uint32(AC_STAT_BINS)) } libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer(entropy + 124 + uintptr(tbl)*4)), 0, libc.Uint32FromInt32(libc.Int32FromInt32(AC_STAT_BINS))) } goto _7 _7: ; ci++ } /* Initialize arithmetic decoding variables */ (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fc = 0 (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fa = 0 (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fct = -int32(16) /* force reading 2 initial bytes to fill C */ /* Initialize restart counter */ (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval } /* * Finish up at the end of an arithmetic-compressed scan. */ func _finish_pass1(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* no work necessary here */ } /* * Module initialization routine for arithmetic entropy decoding. */ func Xjinit_arith_decoder(tls *libc.TLS, cinfo Tj_decompress_ptr) { var ci, i int32 var coef_bit_ptr, v4 uintptr var entropy Tarith_entropy_ptr _, _, _, _, _ = ci, coef_bit_ptr, entropy, i, v4 entropy = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(192)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy = entropy (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fstart_pass = __ccgo_fp(_start_pass1) (*Tarith_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Ffinish_pass = __ccgo_fp(_finish_pass1) /* Mark tables unallocated */ i = 0 for { if !(i < int32(NUM_ARITH_TBLS)) { break } *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr(i)*4)) = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(entropy + 124 + uintptr(i)*4)) = libc.UintptrFromInt32(0) goto _1 _1: ; i++ } /* Initialize index for fixed probability estimation */ *(*uint8)(unsafe.Pointer(entropy + 188)) = uint8(113) if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef_bits = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components*int32(DCTSIZE2))*libc.Uint32FromInt64(4)) coef_bit_ptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef_bits ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } i = 0 for { if !(i < int32(DCTSIZE2)) { break } v4 = coef_bit_ptr coef_bit_ptr += 4 *(*int32)(unsafe.Pointer(v4)) = -int32(1) goto _3 _3: ; i++ } goto _2 _2: ; ci++ } } } const OUTPUT_BUF_SIZE = 4096 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Expanded data destination object for stdio output */ type Tmy_destination_mgr = struct { Fpub Tjpeg_destination_mgr Foutfile uintptr Fbuffer [4096]TJOCTET } type Tmy_dest_ptr = uintptr /* Expanded data destination object for memory output */ type Tmy_mem_destination_mgr = struct { Fpub Tjpeg_destination_mgr Foutbuffer uintptr Foutsize uintptr Fnewbuffer uintptr Fbuffer uintptr Fbufsize Tsize_t } type Tmy_mem_dest_ptr = uintptr /* * Initialize destination --- called by jpeg_start_compress * before any data is actually written. */ func _init_destination(tls *libc.TLS, cinfo Tj_compress_ptr) { var dest Tmy_dest_ptr _ = dest dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Fpub.Fnext_output_byte = dest + 24 (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Fpub.Ffree_in_buffer = uint32(OUTPUT_BUF_SIZE) } func _init_mem_destination(tls *libc.TLS, cinfo Tj_compress_ptr) { /* no work necessary here */ } /* * Empty the output buffer --- called whenever buffer fills up. * * In typical applications, this should write the entire output buffer * (ignoring the current state of next_output_byte & free_in_buffer), * reset the pointer & count to the start of the buffer, and return TRUE * indicating that the buffer has been dumped. * * In applications that need to be able to suspend compression due to output * overrun, a FALSE return indicates that the buffer cannot be emptied now. * In this situation, the compressor will return to its caller (possibly with * an indication that it has not accepted all the supplied scanlines). The * application should resume compression after it has made more room in the * output buffer. Note that there are substantial restrictions on the use of * suspension --- see the documentation. * * When suspending, the compressor will back up to a convenient restart point * (typically the start of the current MCU). next_output_byte & free_in_buffer * indicate where the restart point will be if the current call returns FALSE. * Data beyond this point will be regenerated after resumption, so do not * write it out when emptying the buffer externally. */ func _empty_output_buffer(tls *libc.TLS, cinfo Tj_compress_ptr) (r Tboolean) { var dest Tmy_dest_ptr _ = dest dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest if libc.Xfwrite(tls, dest+24, libc.Uint32FromInt32(1), libc.Uint32FromInt32(libc.Int32FromInt32(OUTPUT_BUF_SIZE)), (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Foutfile) != libc.Uint32FromInt32(OUTPUT_BUF_SIZE) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_FILE_WRITE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Fpub.Fnext_output_byte = dest + 24 (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Fpub.Ffree_in_buffer = uint32(OUTPUT_BUF_SIZE) return int32(TRUE1) } func _empty_mem_output_buffer(tls *libc.TLS, cinfo Tj_compress_ptr) (r Tboolean) { var dest Tmy_mem_dest_ptr var nextbuffer uintptr var nextsize Tsize_t _, _, _ = dest, nextbuffer, nextsize dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest /* Try to allocate new buffer with double size */ nextsize = (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbufsize * uint32(2) nextbuffer = libc.Xmalloc(tls, nextsize) if nextbuffer == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_OUT_OF_MEMORY) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = int32(11) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } libc.Xmemcpy(tls, nextbuffer, (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbuffer, (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbufsize) if (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fnewbuffer != libc.UintptrFromInt32(0) { libc.Xfree(tls, (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fnewbuffer) } (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fnewbuffer = nextbuffer (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fpub.Fnext_output_byte = nextbuffer + uintptr((*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbufsize) (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fpub.Ffree_in_buffer = (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbufsize (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbuffer = nextbuffer (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbufsize = nextsize return int32(TRUE1) } /* * Terminate destination --- called by jpeg_finish_compress * after all data has been written. Usually needs to flush buffer. * * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding * application must deal with any cleanup that should happen even * for error exit. */ func _term_destination(tls *libc.TLS, cinfo Tj_compress_ptr) { var datacount Tsize_t var dest Tmy_dest_ptr _, _ = datacount, dest dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest datacount = uint32(OUTPUT_BUF_SIZE) - (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Fpub.Ffree_in_buffer /* Write any data remaining in the buffer */ if datacount > uint32(0) { if libc.Xfwrite(tls, dest+24, libc.Uint32FromInt32(1), datacount, (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Foutfile) != datacount { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_FILE_WRITE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } libc.Xfflush(tls, (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Foutfile) /* Make sure we wrote the output file OK */ if libc.Xferror(tls, (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Foutfile) != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_FILE_WRITE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } func _term_mem_destination(tls *libc.TLS, cinfo Tj_compress_ptr) { var dest Tmy_mem_dest_ptr _ = dest dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest *(*uintptr)(unsafe.Pointer((*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Foutbuffer)) = (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbuffer *(*Tsize_t)(unsafe.Pointer((*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Foutsize)) = (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbufsize - (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fpub.Ffree_in_buffer } /* * Prepare for output to a stdio stream. * The caller must have already opened the stream, * and is responsible for closing it after finishing compression. */ func Xjpeg_stdio_dest(tls *libc.TLS, cinfo Tj_compress_ptr, outfile uintptr) { var dest Tmy_dest_ptr _ = dest /* The destination object is made permanent so that multiple JPEG images * can be written to the same file without re-executing jpeg_stdio_dest. * This makes it dangerous to use this manager and a different destination * manager serially with the same JPEG object, because their private object * sizes may be different. Caveat programmer. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest == libc.UintptrFromInt32(0) { /* first time for this JPEG object? */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, libc.Uint32FromInt64(4120)) } dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Fpub.Finit_destination = __ccgo_fp(_init_destination) (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Fpub.Fempty_output_buffer = __ccgo_fp(_empty_output_buffer) (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Fpub.Fterm_destination = __ccgo_fp(_term_destination) (*Tmy_destination_mgr)(unsafe.Pointer(dest)).Foutfile = outfile } /* * Prepare for output to a memory buffer. * The caller may supply an own initial buffer with appropriate size. * Otherwise, or when the actual data output exceeds the given size, * the library adapts the buffer size as necessary. * The standard library functions malloc/free are used for allocating * larger memory, so the buffer is available to the application after * finishing compression, and then the application is responsible for * freeing the requested memory. * Note: An initial buffer supplied by the caller is expected to be * managed by the application. The library does not free such buffer * when allocating a larger buffer. */ func Xjpeg_mem_dest(tls *libc.TLS, cinfo Tj_compress_ptr, outbuffer uintptr, outsize uintptr) { var dest Tmy_mem_dest_ptr var v1, v2 uintptr var v3 Tsize_t _, _, _, _ = dest, v1, v2, v3 if outbuffer == libc.UintptrFromInt32(0) || outsize == libc.UintptrFromInt32(0) { /* sanity check */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BUFFER_SIZE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* The destination object is made permanent so that multiple JPEG images * can be written to the same buffer without re-executing jpeg_mem_dest. */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest == libc.UintptrFromInt32(0) { /* first time for this JPEG object? */ (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, libc.Uint32FromInt64(40)) } dest = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fpub.Finit_destination = __ccgo_fp(_init_mem_destination) (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fpub.Fempty_output_buffer = __ccgo_fp(_empty_mem_output_buffer) (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fpub.Fterm_destination = __ccgo_fp(_term_mem_destination) (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Foutbuffer = outbuffer (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Foutsize = outsize (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fnewbuffer = libc.UintptrFromInt32(0) if *(*uintptr)(unsafe.Pointer(outbuffer)) == libc.UintptrFromInt32(0) || *(*Tsize_t)(unsafe.Pointer(outsize)) == uint32(0) { /* Allocate initial buffer */ v1 = libc.Xmalloc(tls, uint32(OUTPUT_BUF_SIZE)) *(*uintptr)(unsafe.Pointer(outbuffer)) = v1 (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fnewbuffer = v1 if (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fnewbuffer == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_OUT_OF_MEMORY) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = int32(10) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } *(*Tsize_t)(unsafe.Pointer(outsize)) = uint32(OUTPUT_BUF_SIZE) } v2 = *(*uintptr)(unsafe.Pointer(outbuffer)) (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbuffer = v2 (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fpub.Fnext_output_byte = v2 v3 = *(*Tsize_t)(unsafe.Pointer(outsize)) (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fbufsize = v3 (*Tmy_mem_destination_mgr)(unsafe.Pointer(dest)).Fpub.Ffree_in_buffer = v3 } const INPUT_BUF_SIZE = 4096 const JPEG_EOI2 = 217 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Expanded data source object for stdio input */ type Tmy_source_mgr = struct { Fpub Tjpeg_source_mgr Finfile uintptr Fbuffer [4096]TJOCTET Fstart_of_file Tboolean } type Tmy_src_ptr = uintptr /* * Initialize source --- called by jpeg_read_header * before any data is actually read. */ func _init_source(tls *libc.TLS, cinfo Tj_decompress_ptr) { var src Tmy_src_ptr _ = src src = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc /* We reset the empty-input-file flag for each image, * but we don't clear the input buffer. * This is correct behavior for reading a series of images from one source. */ (*Tmy_source_mgr)(unsafe.Pointer(src)).Fstart_of_file = int32(TRUE1) } func _init_mem_source(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* no work necessary here */ } /* * Fill the input buffer --- called whenever buffer is emptied. * * In typical applications, this should read fresh data into the buffer * (ignoring the current state of next_input_byte & bytes_in_buffer), * reset the pointer & count to the start of the buffer, and return TRUE * indicating that the buffer has been reloaded. It is not necessary to * fill the buffer entirely, only to obtain at least one more byte. * * There is no such thing as an EOF return. If the end of the file has been * reached, the routine has a choice of ERREXIT() or inserting fake data into * the buffer. In most cases, generating a warning message and inserting a * fake EOI marker is the best course of action --- this will allow the * decompressor to output however much of the image is there. However, * the resulting error message is misleading if the real problem is an empty * input file, so we handle that case specially. * * In applications that need to be able to suspend compression due to input * not being available yet, a FALSE return indicates that no more data can be * obtained right now, but more may be forthcoming later. In this situation, * the decompressor will return to its caller (with an indication of the * number of scanlines it has read, if any). The application should resume * decompression after it has loaded more data into the input buffer. Note * that there are substantial restrictions on the use of suspension --- see * the documentation. * * When suspending, the decompressor will back up to a convenient restart point * (typically the start of the current MCU). next_input_byte & bytes_in_buffer * indicate where the restart point will be if the current call returns FALSE. * Data beyond this point must be rescanned after resumption, so move it to * the front of the buffer rather than discarding it. */ func _fill_input_buffer1(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { var nbytes Tsize_t var src Tmy_src_ptr _, _ = nbytes, src src = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc nbytes = libc.Xfread(tls, src+32, libc.Uint32FromInt32(1), libc.Uint32FromInt32(libc.Int32FromInt32(INPUT_BUF_SIZE)), (*Tmy_source_mgr)(unsafe.Pointer(src)).Finfile) if nbytes <= uint32(0) { if (*Tmy_source_mgr)(unsafe.Pointer(src)).Fstart_of_file != 0 { /* Treat empty input file as fatal error */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_INPUT_EMPTY) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_JPEG_EOF) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) /* Insert a fake EOI marker */ *(*TJOCTET)(unsafe.Pointer(src + 32)) = libc.Uint8FromInt32(0xFF) *(*TJOCTET)(unsafe.Pointer(src + 32 + 1)) = libc.Uint8FromInt32(JPEG_EOI2) nbytes = uint32(2) } (*Tmy_source_mgr)(unsafe.Pointer(src)).Fpub.Fnext_input_byte = src + 32 (*Tmy_source_mgr)(unsafe.Pointer(src)).Fpub.Fbytes_in_buffer = nbytes (*Tmy_source_mgr)(unsafe.Pointer(src)).Fstart_of_file = int32(FALSE1) return int32(TRUE1) } func _fill_mem_input_buffer(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* The whole JPEG data is expected to reside in the supplied memory * buffer, so any request for more data beyond the given buffer size * is treated as an error. */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_JPEG_EOF) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) /* Insert a fake EOI marker */ (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte = uintptr(unsafe.Pointer(&_mybuffer)) (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer = uint32(2) return int32(TRUE1) } var _mybuffer = [4]TJOCTET{ 0: libc.Uint8FromInt32(0xFF), 1: libc.Uint8FromInt32(JPEG_EOI2), } /* * Skip data --- used to skip over a potentially large amount of * uninteresting data (such as an APPn marker). * * Writers of suspendable-input applications must note that skip_input_data * is not granted the right to give a suspension return. If the skip extends * beyond the data currently in the buffer, the buffer can be marked empty so * that the next read will cause a fill_input_buffer call that can suspend. * Arranging for additional bytes to be discarded before reloading the input * buffer is the application writer's problem. */ func _skip_input_data1(tls *libc.TLS, cinfo Tj_decompress_ptr, num_bytes int32) { var nbytes Tsize_t var src uintptr _, _ = nbytes, src src = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc /* Just a dumb implementation for now. Could use fseek() except * it doesn't work on pipes. Not clear that being smart is worth * any trouble anyway --- large skips are infrequent. */ if num_bytes > 0 { nbytes = libc.Uint32FromInt32(num_bytes) for nbytes > (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Fbytes_in_buffer { nbytes -= (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Fbytes_in_buffer (*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(src)).Ffill_input_buffer})))(tls, cinfo) /* note we assume that fill_input_buffer will never return FALSE, * so suspension need not be handled. */ } *(*uintptr)(unsafe.Pointer(src)) += uintptr(nbytes) *(*Tsize_t)(unsafe.Pointer(src + 4)) -= nbytes } } /* * An additional method that can be provided by data source modules is the * resync_to_restart method for error recovery in the presence of RST markers. * For the moment, this source module just uses the default resync method * provided by the JPEG library. That method assumes that no backtracking * is possible. */ /* * Terminate source --- called by jpeg_finish_decompress * after all data has been read. Often a no-op. * * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding * application must deal with any cleanup that should happen even * for error exit. */ func _term_source(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* no work necessary here */ } /* * Prepare for input from a stdio stream. * The caller must have already opened the stream, * and is responsible for closing it after finishing decompression. */ func Xjpeg_stdio_src(tls *libc.TLS, cinfo Tj_decompress_ptr, infile uintptr) { var src Tmy_src_ptr _ = src /* The source object including the input buffer is made permanent so that * a series of JPEG images can be read from the same file by calling * jpeg_stdio_src only before the first one. (If we discarded the buffer * at the end of one image, we'd likely lose the start of the next one.) * This makes it unsafe to use this manager and a different source * manager serially with the same JPEG object. Caveat programmer. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc == libc.UintptrFromInt32(0) { /* first time for this JPEG object? */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, libc.Uint32FromInt64(4132)) } src = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc (*Tmy_source_mgr)(unsafe.Pointer(src)).Fpub.Finit_source = __ccgo_fp(_init_source) (*Tmy_source_mgr)(unsafe.Pointer(src)).Fpub.Ffill_input_buffer = __ccgo_fp(_fill_input_buffer1) (*Tmy_source_mgr)(unsafe.Pointer(src)).Fpub.Fskip_input_data = __ccgo_fp(_skip_input_data1) (*Tmy_source_mgr)(unsafe.Pointer(src)).Fpub.Fresync_to_restart = __ccgo_fp(Xjpeg_resync_to_restart) /* use default method */ (*Tmy_source_mgr)(unsafe.Pointer(src)).Fpub.Fterm_source = __ccgo_fp(_term_source) (*Tmy_source_mgr)(unsafe.Pointer(src)).Finfile = infile (*Tmy_source_mgr)(unsafe.Pointer(src)).Fpub.Fbytes_in_buffer = uint32(0) /* forces fill_input_buffer on first read */ (*Tmy_source_mgr)(unsafe.Pointer(src)).Fpub.Fnext_input_byte = libc.UintptrFromInt32(0) /* until buffer loaded */ } /* * Prepare for input from a supplied memory buffer. * The buffer must contain the whole JPEG data. */ func Xjpeg_mem_src(tls *libc.TLS, cinfo Tj_decompress_ptr, inbuffer uintptr, insize Tsize_t) { var src uintptr _ = src if inbuffer == libc.UintptrFromInt32(0) || insize == uint32(0) { /* Treat empty input as fatal error */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_INPUT_EMPTY) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* The source object is made permanent so that a series of JPEG images * can be read from the same buffer by calling jpeg_mem_src only before * the first one. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc == libc.UintptrFromInt32(0) { /* first time for this JPEG object? */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, libc.Uint32FromInt64(28)) } src = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Finit_source = __ccgo_fp(_init_mem_source) (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Ffill_input_buffer = __ccgo_fp(_fill_mem_input_buffer) (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Fskip_input_data = __ccgo_fp(_skip_input_data1) (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Fresync_to_restart = __ccgo_fp(Xjpeg_resync_to_restart) /* use default method */ (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Fterm_source = __ccgo_fp(_term_source) (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Fbytes_in_buffer = insize (*Tjpeg_source_mgr)(unsafe.Pointer(src)).Fnext_input_byte = inbuffer } const JPEG_EOI3 = 0xD9 const Q01_POS = 1 const Q02_POS = 2 const Q10_POS = 8 const Q11_POS = 9 const Q20_POS = 16 const SAVED_COEFS = 6 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Block smoothing is only applicable for progressive JPEG, so: */ /* Private buffer controller object */ type Tmy_coef_controller2 = struct { Fpub Tjpeg_d_coef_controller FMCU_ctr TJDIMENSION FMCU_vert_offset int32 FMCU_rows_per_iMCU_row int32 FMCU_buffer [10]TJBLOCKROW Fwhole_image [10]Tjvirt_barray_ptr Fcoef_bits_latch uintptr Fblk_buffer [10]TJBLOCK } func _start_iMCU_row2(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Reset within-iMCU-row counters for a new row (input side) */ var coef Tmy_coef_ptr _ = coef coef = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef /* In an interleaved scan, an MCU row is the same as an iMCU row. * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. * But at the bottom of the image, process only what's left. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan > int32(1) { (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row = int32(1) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_iMCU_row < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows-uint32(1) { (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 344)))).Fv_samp_factor } else { (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 344)))).Flast_row_height } } (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_ctr = uint32(0) (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_vert_offset = 0 } /* * Initialize for an input processing pass. */ func _start_input_pass(tls *libc.TLS, cinfo Tj_decompress_ptr) { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_iMCU_row = uint32(0) _start_iMCU_row2(tls, cinfo) } /* * Initialize for an output processing pass. */ func _start_output_pass(tls *libc.TLS, cinfo Tj_decompress_ptr) { var coef Tmy_coef_ptr _ = coef coef = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef /* If multipass, check to see whether to use block smoothing on this pass */ if (*Tmy_coef_controller2)(unsafe.Pointer(coef)).Fpub.Fcoef_arrays != libc.UintptrFromInt32(0) { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdo_block_smoothing != 0 && _smoothing_ok(tls, cinfo) != 0 { (*Tmy_coef_controller2)(unsafe.Pointer(coef)).Fpub.Fdecompress_data = __ccgo_fp(_decompress_smooth_data) } else { (*Tmy_coef_controller2)(unsafe.Pointer(coef)).Fpub.Fdecompress_data = __ccgo_fp(_decompress_data) } } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_iMCU_row = uint32(0) } /* * Decompress and return some data in the single-pass case. * Always attempts to emit one fully interleaved MCU row ("iMCU" row). * Input and output must run in lockstep since we have only a one-MCU buffer. * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. * * NB: output_buf contains a plane for each component in image, * which we index according to the component's SOF position. */ func _decompress_onepass(tls *libc.TLS, cinfo Tj_decompress_ptr, output_buf TJSAMPIMAGE) (r int32) { var MCU_col_num, last_MCU_col, last_iMCU_row, output_col, start_col, v7 TJDIMENSION var blkp TJBLOCKROW var ci, useful_width, xindex, yindex, yoffset, v4 int32 var coef Tmy_coef_ptr var compptr, v8 uintptr var inverse_DCT Tinverse_DCT_method_ptr var output_ptr TJSAMPARRAY _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = MCU_col_num, blkp, ci, coef, compptr, inverse_DCT, last_MCU_col, last_iMCU_row, output_col, output_ptr, start_col, useful_width, xindex, yindex, yoffset, v4, v7, v8 coef = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef /* index of current MCU within row */ last_MCU_col = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FMCUs_per_row - uint32(1) last_iMCU_row = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows - uint32(1) /* Loop to process as much as one whole iMCU row */ yoffset = (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_vert_offset for { if !(yoffset < (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row) { break } MCU_col_num = (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_ctr for { if !(MCU_col_num <= last_MCU_col) { break } blkp = coef + 116 /* pointer to current DCT block within MCU */ /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se != 0 { /* can bypass in DC only case */ libc.Xmemset(tls, blkp, 0, libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU)*libc.Uint32FromInt64(128)) } if !((*(*func(*libc.TLS, Tj_decompress_ptr, TJBLOCKARRAY) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_decoder)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Fdecode_mcu})))(tls, cinfo, coef+32) != 0) { /* Suspension forced; update state counters and exit */ (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_vert_offset = yoffset (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_ctr = MCU_col_num return JPEG_SUSPENDED } /* Determine where data should go in output_buf and do the IDCT thing. * We skip dummy blocks at the right and bottom edges (but blkp gets * incremented past them!). */ ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) /* Don't bother to IDCT an uninteresting component. */ if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { blkp += uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_blocks) * 128 goto _3 } inverse_DCT = *(*Tinverse_DCT_method_ptr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fidct + 4 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)*4)) output_ptr = *(*TJSAMPARRAY)(unsafe.Pointer(output_buf + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)*4)) + uintptr(yoffset*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size)*4 if MCU_col_num < last_MCU_col { v4 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width } else { v4 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_col_width } useful_width = v4 start_col = MCU_col_num * libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_sample_width) yindex = 0 for { if !(yindex < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height) { break } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_iMCU_row < last_iMCU_row || yoffset+yindex < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_row_height { output_col = start_col xindex = 0 for { if !(xindex < useful_width) { break } (*(*func(*libc.TLS, Tj_decompress_ptr, uintptr, TJCOEFPTR, TJSAMPARRAY, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{inverse_DCT})))(tls, cinfo, compptr, blkp+uintptr(xindex)*128, output_ptr, output_col) output_col += libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size) goto _6 _6: ; xindex++ } output_ptr += uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size) * 4 } blkp += uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width) * 128 goto _5 _5: ; yindex++ } goto _3 _3: ; ci++ } goto _2 _2: ; MCU_col_num++ } /* Completed an MCU row, but perhaps not an iMCU row */ (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_ctr = uint32(0) goto _1 _1: ; yoffset++ } /* Completed the iMCU row, advance counters for next one */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_iMCU_row++ v8 = cinfo + 148 *(*TJDIMENSION)(unsafe.Pointer(v8))++ v7 = *(*TJDIMENSION)(unsafe.Pointer(v8)) if v7 <= last_iMCU_row { _start_iMCU_row2(tls, cinfo) return int32(JPEG_ROW_COMPLETED) } /* Completed the scan */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Ffinish_input_pass})))(tls, cinfo) return int32(JPEG_SCAN_COMPLETED) } /* * Dummy consume-input routine for single-pass operation. */ func _dummy_consume_data(tls *libc.TLS, cinfo Tj_decompress_ptr) (r int32) { return JPEG_SUSPENDED /* Always indicate nothing was done */ } /* * Consume input data and store it in the full-image coefficient buffer. * We read as much as one fully interleaved MCU row ("iMCU" row) per call, * ie, v_samp_factor block rows for each component in the scan. * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. */ func _consume_data(tls *libc.TLS, cinfo Tj_decompress_ptr) (r int32) { var MCU_col_num, start_col, v10 TJDIMENSION var blkp, v8 TJBLOCKARRAY var buffer [4]TJBLOCKARRAY var buffer_ptr, v9 TJBLOCKROW var ci, xindex, yindex, yoffset, v6 int32 var coef Tmy_coef_ptr var compptr, v11 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = MCU_col_num, blkp, buffer, buffer_ptr, ci, coef, compptr, start_col, xindex, yindex, yoffset, v10, v11, v6, v8, v9 coef = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef /* Align the virtual buffers for the components used in this scan. */ ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) buffer[ci] = (*(*func(*libc.TLS, Tj_common_ptr, Tjvirt_barray_ptr, TJDIMENSION, TJDIMENSION, Tboolean) TJBLOCKARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Faccess_virt_barray})))(tls, cinfo, *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 72 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)*4)), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_iMCU_row*libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), int32(TRUE1)) /* Note: entropy decoder expects buffer to be zeroed, * but this is handled automatically by the memory manager * because we requested a pre-zeroed array. */ goto _1 _1: ; ci++ } /* Loop to process one whole iMCU row */ yoffset = (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_vert_offset for { if !(yoffset < (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_rows_per_iMCU_row) { break } MCU_col_num = (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_ctr for { if !(MCU_col_num < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FMCUs_per_row) { break } /* Construct list of pointers to DCT blocks belonging to this MCU */ blkp = coef + 32 /* pointer to current DCT block within MCU */ ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) start_col = MCU_col_num * libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width) yindex = 0 for { if !(yindex < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height) { break } buffer_ptr = *(*TJBLOCKROW)(unsafe.Pointer(buffer[ci] + uintptr(yoffset+yindex)*4)) + uintptr(start_col)*128 xindex = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width for { v8 = blkp blkp += 4 v9 = buffer_ptr buffer_ptr += 128 *(*TJBLOCKROW)(unsafe.Pointer(v8)) = v9 goto _7 _7: ; xindex-- v6 = xindex if !(v6 != 0) { break } } goto _5 _5: ; yindex++ } goto _4 _4: ; ci++ } /* Try to fetch the MCU. */ if !((*(*func(*libc.TLS, Tj_decompress_ptr, TJBLOCKARRAY) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_decoder)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Fdecode_mcu})))(tls, cinfo, coef+32) != 0) { /* Suspension forced; update state counters and exit */ (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_vert_offset = yoffset (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_ctr = MCU_col_num return JPEG_SUSPENDED } goto _3 _3: ; MCU_col_num++ } /* Completed an MCU row, but perhaps not an iMCU row */ (*Tmy_coef_controller2)(unsafe.Pointer(coef)).FMCU_ctr = uint32(0) goto _2 _2: ; yoffset++ } /* Completed the iMCU row, advance counters for next one */ v11 = cinfo + 148 *(*TJDIMENSION)(unsafe.Pointer(v11))++ v10 = *(*TJDIMENSION)(unsafe.Pointer(v11)) if v10 < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows { _start_iMCU_row2(tls, cinfo) return int32(JPEG_ROW_COMPLETED) } /* Completed the scan */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Ffinish_input_pass})))(tls, cinfo) return int32(JPEG_SCAN_COMPLETED) } /* * Decompress and return some data in the multi-pass case. * Always attempts to emit one fully interleaved MCU row ("iMCU" row). * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. * * NB: output_buf contains a plane for each component in image. */ func _decompress_data(tls *libc.TLS, cinfo Tj_decompress_ptr, output_buf TJSAMPIMAGE) (r int32) { var block_num, last_iMCU_row, output_col, v4 TJDIMENSION var block_row, block_rows, ci int32 var buffer TJBLOCKARRAY var buffer_ptr TJBLOCKROW var coef Tmy_coef_ptr var compptr, v5 uintptr var inverse_DCT Tinverse_DCT_method_ptr var output_ptr TJSAMPARRAY _, _, _, _, _, _, _, _, _, _, _, _, _, _ = block_num, block_row, block_rows, buffer, buffer_ptr, ci, coef, compptr, inverse_DCT, last_iMCU_row, output_col, output_ptr, v4, v5 coef = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef last_iMCU_row = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows - uint32(1) /* Force some input to be done if we are getting ahead of the input. */ for (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scan_number || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number == (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scan_number && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_iMCU_row <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_iMCU_row { if (*(*func(*libc.TLS, Tj_decompress_ptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fconsume_input})))(tls, cinfo) == JPEG_SUSPENDED { return JPEG_SUSPENDED } } /* OK, output from the virtual arrays. */ ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Don't bother to IDCT an uninteresting component. */ if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { goto _1 } /* Align the virtual buffer for this component. */ buffer = (*(*func(*libc.TLS, Tj_common_ptr, Tjvirt_barray_ptr, TJDIMENSION, TJDIMENSION, Tboolean) TJBLOCKARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Faccess_virt_barray})))(tls, cinfo, *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 72 + uintptr(ci)*4)), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_iMCU_row*libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), int32(FALSE1)) /* Count non-dummy DCT block rows in this iMCU row. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_iMCU_row < last_iMCU_row { block_rows = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor } else { /* NB: can't use last_row_height here; it is input-side-dependent! */ block_rows = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks % libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor)) if block_rows == 0 { block_rows = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor } } inverse_DCT = *(*Tinverse_DCT_method_ptr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fidct + 4 + uintptr(ci)*4)) output_ptr = *(*TJSAMPARRAY)(unsafe.Pointer(output_buf + uintptr(ci)*4)) /* Loop over all DCT blocks to be processed. */ block_row = 0 for { if !(block_row < block_rows) { break } buffer_ptr = *(*TJBLOCKROW)(unsafe.Pointer(buffer + uintptr(block_row)*4)) output_col = uint32(0) block_num = uint32(0) for { if !(block_num < (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks) { break } (*(*func(*libc.TLS, Tj_decompress_ptr, uintptr, TJCOEFPTR, TJSAMPARRAY, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{inverse_DCT})))(tls, cinfo, compptr, buffer_ptr, output_ptr, output_col) buffer_ptr += 128 output_col += libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size) goto _3 _3: ; block_num++ } output_ptr += uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size) * 4 goto _2 _2: ; block_row++ } goto _1 _1: ; ci++ compptr += 88 } v5 = cinfo + 156 *(*TJDIMENSION)(unsafe.Pointer(v5))++ v4 = *(*TJDIMENSION)(unsafe.Pointer(v5)) if v4 <= last_iMCU_row { return int32(JPEG_ROW_COMPLETED) } return int32(JPEG_SCAN_COMPLETED) } /* * This code applies interblock smoothing as described by section K.8 * of the JPEG standard: the first 5 AC coefficients are estimated from * the DC values of a DCT block and its 8 neighboring blocks. * We apply smoothing only for progressive JPEG decoding, and only if * the coefficients it can estimate are not yet known to full precision. */ /* Natural-order array positions of the first 5 zigzag-order coefficients */ /* * Determine whether block smoothing is applicable and safe. * We also latch the current states of the coef_bits[] entries for the * AC coefficients; otherwise, if the input side of the decompressor * advances into a new scan, we might think the coefficients are known * more accurately than they really are. */ func _smoothing_ok(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { var ci, coefi int32 var coef Tmy_coef_ptr var coef_bits, coef_bits_latch, compptr, qtable, v2 uintptr var smoothing_useful Tboolean _, _, _, _, _, _, _, _, _ = ci, coef, coef_bits, coef_bits_latch, coefi, compptr, qtable, smoothing_useful, v2 coef = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef smoothing_useful = int32(FALSE1) if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef_bits == libc.UintptrFromInt32(0) { return int32(FALSE1) } /* Allocate latch area if not already done */ if (*Tmy_coef_controller2)(unsafe.Pointer(coef)).Fcoef_bits_latch == libc.UintptrFromInt32(0) { (*Tmy_coef_controller2)(unsafe.Pointer(coef)).Fcoef_bits_latch = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components)*(libc.Uint32FromInt32(SAVED_COEFS)*libc.Uint32FromInt64(4))) } coef_bits_latch = (*Tmy_coef_controller2)(unsafe.Pointer(coef)).Fcoef_bits_latch ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* All components' quantization values must already be latched. */ v2 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_table qtable = v2 if v2 == libc.UintptrFromInt32(0) { return int32(FALSE1) } /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */ if libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(qtable))) == 0 || libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(qtable + 1*2))) == 0 || libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(qtable + 8*2))) == 0 || libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(qtable + 16*2))) == 0 || libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(qtable + 9*2))) == 0 || libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(qtable + 2*2))) == 0 { return int32(FALSE1) } /* DC values must be at least partly known for all components. */ coef_bits = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef_bits + uintptr(ci)*256 if *(*int32)(unsafe.Pointer(coef_bits)) < 0 { return int32(FALSE1) } /* Block smoothing is helpful if some AC coefficients remain inaccurate. */ coefi = int32(1) for { if !(coefi <= int32(5)) { break } *(*int32)(unsafe.Pointer(coef_bits_latch + uintptr(coefi)*4)) = *(*int32)(unsafe.Pointer(coef_bits + uintptr(coefi)*4)) if *(*int32)(unsafe.Pointer(coef_bits + uintptr(coefi)*4)) != 0 { smoothing_useful = int32(TRUE1) } goto _3 _3: ; coefi++ } coef_bits_latch += uintptr(SAVED_COEFS) * 4 goto _1 _1: ; ci++ compptr += 88 } return smoothing_useful } /* * Variant of decompress_data for use when doing block smoothing. */ func _decompress_smooth_data(tls *libc.TLS, cinfo Tj_decompress_ptr, output_buf TJSAMPIMAGE) (r int32) { bp := tls.Alloc(128) defer tls.Free(128) var Al, DC1, DC2, DC3, DC4, DC5, DC6, DC7, DC8, DC9, access_rows, block_row, block_rows, ci, pred, v1, v11, v12, v13, v14, v15, v4, v5, v6, v7, v8, v9 int32 var Q00, Q01, Q02, Q10, Q11, Q20, num TINT32 var block_num, delta, last_block_column, last_iMCU_row, output_col, v16 TJDIMENSION var buffer TJBLOCKARRAY var buffer_ptr, next_block_row, prev_block_row TJBLOCKROW var coef Tmy_coef_ptr var coef_bits, compptr, quanttbl, v17 uintptr var first_row, last_row Tboolean var inverse_DCT Tinverse_DCT_method_ptr var output_ptr TJSAMPARRAY var _ /* workspace at bp+0 */ TJBLOCK _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Al, DC1, DC2, DC3, DC4, DC5, DC6, DC7, DC8, DC9, Q00, Q01, Q02, Q10, Q11, Q20, access_rows, block_num, block_row, block_rows, buffer, buffer_ptr, ci, coef, coef_bits, compptr, delta, first_row, inverse_DCT, last_block_column, last_iMCU_row, last_row, next_block_row, num, output_col, output_ptr, pred, prev_block_row, quanttbl, v1, v11, v12, v13, v14, v15, v16, v17, v4, v5, v6, v7, v8, v9 coef = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef last_iMCU_row = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows - uint32(1) /* Force some input to be done if we are getting ahead of the input. */ for (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scan_number && !((*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Feoi_reached != 0) { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number == (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scan_number { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { v1 = int32(1) } else { v1 = 0 } /* If input is working on current scan, we ordinarily want it to * have completed the current row. But if input scan is DC, * we want it to keep one row ahead so that next block row's DC * values are up to date. */ delta = libc.Uint32FromInt32(v1) if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_iMCU_row > (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_iMCU_row+delta { break } } if (*(*func(*libc.TLS, Tj_decompress_ptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fconsume_input})))(tls, cinfo) == JPEG_SUSPENDED { return JPEG_SUSPENDED } } /* OK, output from the virtual arrays. */ ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Don't bother to IDCT an uninteresting component. */ if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { goto _2 } /* Count non-dummy DCT block rows in this iMCU row. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_iMCU_row < last_iMCU_row { block_rows = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor access_rows = block_rows * int32(2) /* this and next iMCU row */ last_row = int32(FALSE1) } else { /* NB: can't use last_row_height here; it is input-side-dependent! */ block_rows = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks % libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor)) if block_rows == 0 { block_rows = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor } access_rows = block_rows /* this iMCU row only */ last_row = int32(TRUE1) } /* Align the virtual buffer for this component. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_iMCU_row > uint32(0) { access_rows += (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor /* prior iMCU row too */ buffer = (*(*func(*libc.TLS, Tj_common_ptr, Tjvirt_barray_ptr, TJDIMENSION, TJDIMENSION, Tboolean) TJBLOCKARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Faccess_virt_barray})))(tls, cinfo, *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 72 + uintptr(ci)*4)), ((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_iMCU_row-uint32(1))*libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor), libc.Uint32FromInt32(access_rows), int32(FALSE1)) buffer += uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor) * 4 /* point to current iMCU row */ first_row = int32(FALSE1) } else { buffer = (*(*func(*libc.TLS, Tj_common_ptr, Tjvirt_barray_ptr, TJDIMENSION, TJDIMENSION, Tboolean) TJBLOCKARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Faccess_virt_barray})))(tls, cinfo, *(*Tjvirt_barray_ptr)(unsafe.Pointer(coef + 72 + uintptr(ci)*4)), libc.Uint32FromInt32(0), libc.Uint32FromInt32(access_rows), int32(FALSE1)) first_row = int32(TRUE1) } /* Fetch component-dependent info */ coef_bits = (*Tmy_coef_controller2)(unsafe.Pointer(coef)).Fcoef_bits_latch + uintptr(ci*libc.Int32FromInt32(SAVED_COEFS))*4 quanttbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_table Q00 = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quanttbl))) Q01 = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quanttbl + 1*2))) Q10 = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quanttbl + 8*2))) Q20 = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quanttbl + 16*2))) Q11 = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quanttbl + 9*2))) Q02 = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quanttbl + 2*2))) inverse_DCT = *(*Tinverse_DCT_method_ptr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fidct + 4 + uintptr(ci)*4)) output_ptr = *(*TJSAMPARRAY)(unsafe.Pointer(output_buf + uintptr(ci)*4)) /* Loop over all DCT blocks to be processed. */ block_row = 0 for { if !(block_row < block_rows) { break } buffer_ptr = *(*TJBLOCKROW)(unsafe.Pointer(buffer + uintptr(block_row)*4)) if first_row != 0 && block_row == 0 { prev_block_row = buffer_ptr } else { prev_block_row = *(*TJBLOCKROW)(unsafe.Pointer(buffer + uintptr(block_row-int32(1))*4)) } if last_row != 0 && block_row == block_rows-int32(1) { next_block_row = buffer_ptr } else { next_block_row = *(*TJBLOCKROW)(unsafe.Pointer(buffer + uintptr(block_row+int32(1))*4)) } /* We fetch the surrounding DC values using a sliding-register approach. * Initialize all nine here so as to do the right thing on narrow pics. */ v5 = int32(*(*TJCOEF)(unsafe.Pointer(prev_block_row))) DC3 = v5 v4 = v5 DC2 = v4 DC1 = v4 v7 = int32(*(*TJCOEF)(unsafe.Pointer(buffer_ptr))) DC6 = v7 v6 = v7 DC5 = v6 DC4 = v6 v9 = int32(*(*TJCOEF)(unsafe.Pointer(next_block_row))) DC9 = v9 v8 = v9 DC8 = v8 DC7 = v8 output_col = uint32(0) last_block_column = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks - uint32(1) block_num = uint32(0) for { if !(block_num <= last_block_column) { break } /* Fetch current DCT block into workspace so we can modify it. */ Xjcopy_block_row(tls, buffer_ptr, bp, libc.Uint32FromInt32(1)) /* Update DC values */ if block_num < last_block_column { DC3 = int32(*(*TJCOEF)(unsafe.Pointer(prev_block_row + 1*128))) DC6 = int32(*(*TJCOEF)(unsafe.Pointer(buffer_ptr + 1*128))) DC9 = int32(*(*TJCOEF)(unsafe.Pointer(next_block_row + 1*128))) } /* Compute coefficient estimates per K.8. * An estimate is applied only if coefficient is still zero, * and is not known to be fully accurate. */ /* AC01 */ v11 = *(*int32)(unsafe.Pointer(coef_bits + 1*4)) Al = v11 if v11 != 0 && int32((*(*TJBLOCK)(unsafe.Pointer(bp)))[int32(1)]) == 0 { num = int32(36) * Q00 * (DC4 - DC6) if num >= 0 { pred = (Q01< 0 && pred >= int32(1)< 0 && pred >= int32(1)<= 0 { pred = (Q10< 0 && pred >= int32(1)< 0 && pred >= int32(1)<= 0 { pred = (Q20< 0 && pred >= int32(1)< 0 && pred >= int32(1)<= 0 { pred = (Q11< 0 && pred >= int32(1)< 0 && pred >= int32(1)<= 0 { pred = (Q02< 0 && pred >= int32(1)< 0 && pred >= int32(1)< RGB conversion: most common case **************/ /*************** BG_YCC -> RGB conversion: less common case **************/ /*************** RGB -> Y conversion: less common case **************/ /* * YCbCr is defined per Recommendation ITU-R BT.601-7 (03/2011), * previously known as Recommendation CCIR 601-1, except that Cb and Cr * are normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. * sRGB (standard RGB color space) is defined per IEC 61966-2-1:1999. * sYCC (standard luma-chroma-chroma color space with extended gamut) * is defined per IEC 61966-2-1:1999 Amendment A1:2003 Annex F. * bg-sRGB and bg-sYCC (big gamut standard color spaces) * are defined per IEC 61966-2-1:1999 Amendment A1:2003 Annex G. * Note that the derived conversion coefficients given in some of these * documents are imprecise. The general conversion equations are * * R = Y + K * (1 - Kr) * Cr * G = Y - K * (Kb * (1 - Kb) * Cb + Kr * (1 - Kr) * Cr) / (1 - Kr - Kb) * B = Y + K * (1 - Kb) * Cb * * Y = Kr * R + (1 - Kr - Kb) * G + Kb * B * * With Kr = 0.299 and Kb = 0.114 (derived according to SMPTE RP 177-1993 * from the 1953 FCC NTSC primaries and CIE Illuminant C), K = 2 for sYCC, * the conversion equations to be implemented are therefore * * R = Y + 1.402 * Cr * G = Y - 0.344136286 * Cb - 0.714136286 * Cr * B = Y + 1.772 * Cb * * Y = 0.299 * R + 0.587 * G + 0.114 * B * * where Cb and Cr represent the incoming values less CENTERJSAMPLE. * For bg-sYCC, with K = 4, the equations are * * R = Y + 2.804 * Cr * G = Y - 0.688272572 * Cb - 1.428272572 * Cr * B = Y + 3.544 * Cb * * To avoid floating-point arithmetic, we represent the fractional constants * as integers scaled up by 2^16 (about 4 digits precision); we have to divide * the products by 2^16, with appropriate rounding, to get the correct answer. * Notice that Y, being an integral input, does not contribute any fraction * so it need not participate in the rounding. * * For even more speed, we avoid doing any multiplications in the inner loop * by precalculating the constants times Cb and Cr for all possible values. * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); * for 9-bit to 12-bit samples it is still acceptable. It's not very * reasonable for 16-bit samples, but if you want lossless storage * you shouldn't be changing colorspace anyway. * The Cr=>R and Cb=>B values can be rounded to integers in advance; * the values for the G calculation are left scaled up, * since we must add them together before rounding. */ /* * Initialize tables for YCbCr->RGB and BG_YCC->RGB colorspace conversion. */ func _build_ycc_rgb_table(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Normal case, sYCC */ var cconvert Tmy_cconvert_ptr var i int32 var x TINT32 _, _, _ = cconvert, i, x cconvert = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcconvert (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCr_r_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCb_b_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCr_g_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCb_g_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) i = 0 x = -libc.Int32FromInt32(CENTERJSAMPLE) for { if !(i <= int32(MAXJSAMPLE)) { break } /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ /* Cr=>R value is nearest int to 1.402 * x */ *(*int32)(unsafe.Pointer((*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCr_r_tab + uintptr(i)*4)) = (int32(libc.Float64FromFloat64(1.402)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(SCALEBITS) /* Cb=>B value is nearest int to 1.772 * x */ *(*int32)(unsafe.Pointer((*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCb_b_tab + uintptr(i)*4)) = (int32(libc.Float64FromFloat64(1.772)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(SCALEBITS) /* Cr=>G value is scaled-up -0.714136286 * x */ *(*TINT32)(unsafe.Pointer((*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCr_g_tab + uintptr(i)*4)) = -int32(libc.Float64FromFloat64(0.714136286)*float64(libc.Int32FromInt32(1)<G value is scaled-up -0.344136286 * x */ /* We also add in ONE_HALF so that need not do it in inner loop */ *(*TINT32)(unsafe.Pointer((*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCb_g_tab + uintptr(i)*4)) = -int32(libc.Float64FromFloat64(0.344136286)*float64(libc.Int32FromInt32(1)<R value is nearest int to 2.804 * x */ *(*int32)(unsafe.Pointer((*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCr_r_tab + uintptr(i)*4)) = (int32(libc.Float64FromFloat64(2.804)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(SCALEBITS) /* Cb=>B value is nearest int to 3.544 * x */ *(*int32)(unsafe.Pointer((*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCb_b_tab + uintptr(i)*4)) = (int32(libc.Float64FromFloat64(3.544)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(SCALEBITS) /* Cr=>G value is scaled-up -1.428272572 * x */ *(*TINT32)(unsafe.Pointer((*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCr_g_tab + uintptr(i)*4)) = -int32(libc.Float64FromFloat64(1.428272572)*float64(libc.Int32FromInt32(1)<G value is scaled-up -0.688272572 * x */ /* We also add in ONE_HALF so that need not do it in inner loop */ *(*TINT32)(unsafe.Pointer((*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCb_g_tab + uintptr(i)*4)) = -int32(libc.Float64FromFloat64(0.688272572)*float64(libc.Int32FromInt32(1)<= 0) { break } inptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(input_row)*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 1*4)) + uintptr(input_row)*4)) inptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 2*4)) + uintptr(input_row)*4)) input_row++ v2 = output_buf output_buf += 4 outptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) col = uint32(0) for { if !(col < num_cols) { break } y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + uintptr(col)))) cb = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + uintptr(col)))) cr = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr2 + uintptr(col)))) /* Range-limiting is essential due to noise introduced by DCT losses, * for extended gamut (sYCC) and wide gamut (bg-sYCC) encodings. */ *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+*(*int32)(unsafe.Pointer(Crrtab + uintptr(cr)*4))))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+(*(*TINT32)(unsafe.Pointer(Cbgtab + uintptr(cb)*4))+*(*TINT32)(unsafe.Pointer(Crgtab + uintptr(cr)*4)))>>libc.Int32FromInt32(SCALEBITS)))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+*(*int32)(unsafe.Pointer(Cbbtab + uintptr(cb)*4))))) outptr += uintptr(RGB_PIXELSIZE) goto _3 _3: ; col++ } } } /**************** Cases other than YCC -> RGB ****************/ /* * Initialize for RGB->grayscale colorspace conversion. */ func _build_rgb_y_table(tls *libc.TLS, cinfo Tj_decompress_ptr) { var cconvert Tmy_cconvert_ptr var i TINT32 _, _ = cconvert, i cconvert = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcconvert (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FR_y_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FG_y_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FB_y_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) i = 0 for { if !(i <= int32(MAXJSAMPLE)) { break } *(*TINT32)(unsafe.Pointer((*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FR_y_tab + uintptr(i)*4)) = int32(libc.Float64FromFloat64(0.299)*float64(libc.Int32FromInt32(1)<= 0) { break } inptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(input_row)*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 1*4)) + uintptr(input_row)*4)) inptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 2*4)) + uintptr(input_row)*4)) input_row++ v2 = output_buf output_buf += 4 outptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) col = uint32(0) for { if !(col < num_cols) { break } y = *(*TINT32)(unsafe.Pointer(Rytab + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + uintptr(col)))))*4)) y += *(*TINT32)(unsafe.Pointer(Gytab + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + uintptr(col)))))*4)) y += *(*TINT32)(unsafe.Pointer(Bytab + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr2 + uintptr(col)))))*4)) *(*TJSAMPLE)(unsafe.Pointer(outptr + uintptr(col))) = libc.Uint8FromInt32(y >> libc.Int32FromInt32(SCALEBITS)) goto _3 _3: ; col++ } } } /* * Convert some rows of samples to the output colorspace. * [R-G,G,B-G] to [R,G,B] conversion with modulo calculation * (inverse color transform). * This can be seen as an adaption of the general YCbCr->RGB * conversion equation with Kr = Kb = 0, while replacing the * normalization by modulo calculation. */ func _rgb1_rgb_convert(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, input_row TJDIMENSION, output_buf TJSAMPARRAY, num_rows int32) { var b, g, r, v1 int32 var col, num_cols TJDIMENSION var inptr0, inptr1, inptr2, outptr TJSAMPROW var v2 TJSAMPARRAY _, _, _, _, _, _, _, _, _, _, _ = b, col, g, inptr0, inptr1, inptr2, num_cols, outptr, r, v1, v2 num_cols = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } inptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(input_row)*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 1*4)) + uintptr(input_row)*4)) inptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 2*4)) + uintptr(input_row)*4)) input_row++ v2 = output_buf output_buf += 4 outptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) col = uint32(0) for { if !(col < num_cols) { break } r = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + uintptr(col)))) g = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + uintptr(col)))) b = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr2 + uintptr(col)))) /* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD * (modulo) operator is equivalent to the bitmask operator AND. */ *(*TJSAMPLE)(unsafe.Pointer(outptr)) = libc.Uint8FromInt32((r + g - libc.Int32FromInt32(CENTERJSAMPLE)) & libc.Int32FromInt32(MAXJSAMPLE)) *(*TJSAMPLE)(unsafe.Pointer(outptr + 1)) = libc.Uint8FromInt32(g) *(*TJSAMPLE)(unsafe.Pointer(outptr + 2)) = libc.Uint8FromInt32((b + g - libc.Int32FromInt32(CENTERJSAMPLE)) & libc.Int32FromInt32(MAXJSAMPLE)) outptr += uintptr(RGB_PIXELSIZE) goto _3 _3: ; col++ } } } /* * [R-G,G,B-G] to grayscale conversion with modulo calculation * (inverse color transform). */ func _rgb1_gray_convert(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, input_row TJDIMENSION, output_buf TJSAMPARRAY, num_rows int32) { var Bytab, Gytab, Rytab uintptr var b, g, r, v1 int32 var cconvert Tmy_cconvert_ptr var col, num_cols TJDIMENSION var inptr0, inptr1, inptr2, outptr TJSAMPROW var y TINT32 var v2 TJSAMPARRAY _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Bytab, Gytab, Rytab, b, cconvert, col, g, inptr0, inptr1, inptr2, num_cols, outptr, r, y, v1, v2 cconvert = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcconvert Rytab = (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FR_y_tab Gytab = (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FG_y_tab Bytab = (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FB_y_tab num_cols = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } inptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(input_row)*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 1*4)) + uintptr(input_row)*4)) inptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 2*4)) + uintptr(input_row)*4)) input_row++ v2 = output_buf output_buf += 4 outptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) col = uint32(0) for { if !(col < num_cols) { break } r = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + uintptr(col)))) g = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + uintptr(col)))) b = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr2 + uintptr(col)))) /* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD * (modulo) operator is equivalent to the bitmask operator AND. */ y = *(*TINT32)(unsafe.Pointer(Rytab + uintptr((r+g-int32(CENTERJSAMPLE))&int32(MAXJSAMPLE))*4)) y += *(*TINT32)(unsafe.Pointer(Gytab + uintptr(g)*4)) y += *(*TINT32)(unsafe.Pointer(Bytab + uintptr((b+g-int32(CENTERJSAMPLE))&int32(MAXJSAMPLE))*4)) *(*TJSAMPLE)(unsafe.Pointer(outptr + uintptr(col))) = libc.Uint8FromInt32(y >> libc.Int32FromInt32(SCALEBITS)) goto _3 _3: ; col++ } } } /* * Convert some rows of samples to the output colorspace. * No colorspace change, but conversion from separate-planes * to interleaved representation. */ func _rgb_convert1(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, input_row TJDIMENSION, output_buf TJSAMPARRAY, num_rows int32) { var col, num_cols TJDIMENSION var inptr0, inptr1, inptr2, outptr TJSAMPROW var v1 int32 var v2 TJSAMPARRAY _, _, _, _, _, _, _, _ = col, inptr0, inptr1, inptr2, num_cols, outptr, v1, v2 num_cols = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } inptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(input_row)*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 1*4)) + uintptr(input_row)*4)) inptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 2*4)) + uintptr(input_row)*4)) input_row++ v2 = output_buf output_buf += 4 outptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) col = uint32(0) for { if !(col < num_cols) { break } /* We can dispense with GETJSAMPLE() here */ *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(inptr0 + uintptr(col))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 1)) = *(*TJSAMPLE)(unsafe.Pointer(inptr1 + uintptr(col))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 2)) = *(*TJSAMPLE)(unsafe.Pointer(inptr2 + uintptr(col))) outptr += uintptr(RGB_PIXELSIZE) goto _3 _3: ; col++ } } } /* * Color conversion for no colorspace change: just copy the data, * converting from separate-planes to interleaved representation. * Note: Omit uninteresting components in output buffer. */ func _null_convert1(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, input_row TJDIMENSION, output_buf TJSAMPARRAY, num_rows int32) { var ci, out_comps, v1 int32 var compptr uintptr var count, num_cols TJDIMENSION var inptr, outptr, startptr, v4, v6 TJSAMPROW var v2 TJSAMPARRAY _, _, _, _, _, _, _, _, _, _, _, _ = ci, compptr, count, inptr, num_cols, out_comps, outptr, startptr, v1, v2, v4, v6 out_comps = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components num_cols = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } /* It seems fastest to make a separate pass for each component. */ v2 = output_buf output_buf += 4 startptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { goto _3 } /* skip uninteresting component */ inptr = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + uintptr(ci)*4)) + uintptr(input_row)*4)) v4 = startptr startptr++ outptr = v4 count = num_cols for { if !(count > uint32(0)) { break } v6 = inptr inptr++ *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(v6)) /* don't need GETJSAMPLE() here */ outptr += uintptr(out_comps) goto _5 _5: ; count-- } goto _3 _3: ; ci++ compptr += 88 } input_row++ } } /* * Color conversion for grayscale: just copy the data. * This also works for YCC -> grayscale conversion, in which * we just copy the Y (luminance) component and ignore chrominance. */ func _grayscale_convert1(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, input_row TJDIMENSION, output_buf TJSAMPARRAY, num_rows int32) { Xjcopy_sample_rows(tls, *(*TJSAMPARRAY)(unsafe.Pointer(input_buf))+uintptr(input_row)*4, output_buf, num_rows, (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width) } /* * Convert grayscale to RGB: just duplicate the graylevel three times. * This is provided to support applications that don't want to cope * with grayscale as a separate case. */ func _gray_rgb_convert(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, input_row TJDIMENSION, output_buf TJSAMPARRAY, num_rows int32) { var col, num_cols, v2 TJDIMENSION var inptr, outptr TJSAMPROW var v1 int32 var v3 TJSAMPARRAY var v5, v6 TJSAMPLE _, _, _, _, _, _, _, _, _ = col, inptr, num_cols, outptr, v1, v2, v3, v5, v6 num_cols = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } v2 = input_row input_row++ inptr = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(v2)*4)) v3 = output_buf output_buf += 4 outptr = *(*TJSAMPROW)(unsafe.Pointer(v3)) col = uint32(0) for { if !(col < num_cols) { break } /* We can dispense with GETJSAMPLE() here */ v6 = *(*TJSAMPLE)(unsafe.Pointer(inptr + uintptr(col))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 2)) = v6 v5 = v6 *(*TJSAMPLE)(unsafe.Pointer(outptr + 1)) = v5 *(*TJSAMPLE)(unsafe.Pointer(outptr)) = v5 outptr += uintptr(RGB_PIXELSIZE) goto _4 _4: ; col++ } } } /* * Convert some rows of samples to the output colorspace. * This version handles Adobe-style YCCK->CMYK conversion, * where we convert YCbCr to R=1-C, G=1-M, and B=1-Y using the * same conversion as above, while passing K (black) unchanged. * We assume build_ycc_rgb_table has been called. */ func _ycck_cmyk_convert(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, input_row TJDIMENSION, output_buf TJSAMPARRAY, num_rows int32) { var Cbbtab, Cbgtab, Crgtab, Crrtab, range_limit uintptr var cb, cr, y, v1 int32 var cconvert Tmy_cconvert_ptr var col, num_cols TJDIMENSION var inptr0, inptr1, inptr2, inptr3, outptr TJSAMPROW var v2 TJSAMPARRAY _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Cbbtab, Cbgtab, Crgtab, Crrtab, cb, cconvert, col, cr, inptr0, inptr1, inptr2, inptr3, num_cols, outptr, range_limit, y, v1, v2 cconvert = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcconvert num_cols = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width /* copy these pointers into registers if possible */ range_limit = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsample_range_limit Crrtab = (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCr_r_tab Cbbtab = (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCb_b_tab Crgtab = (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCr_g_tab Cbgtab = (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FCb_g_tab for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } inptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(input_row)*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 1*4)) + uintptr(input_row)*4)) inptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 2*4)) + uintptr(input_row)*4)) inptr3 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 3*4)) + uintptr(input_row)*4)) input_row++ v2 = output_buf output_buf += 4 outptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) col = uint32(0) for { if !(col < num_cols) { break } y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + uintptr(col)))) cb = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + uintptr(col)))) cr = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr2 + uintptr(col)))) /* Range-limiting is essential due to noise introduced by DCT losses, * and for extended gamut encodings (sYCC). */ *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(int32(MAXJSAMPLE)-(y+*(*int32)(unsafe.Pointer(Crrtab + uintptr(cr)*4)))))) /* red */ *(*TJSAMPLE)(unsafe.Pointer(outptr + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(int32(MAXJSAMPLE)-(y+(*(*TINT32)(unsafe.Pointer(Cbgtab + uintptr(cb)*4))+*(*TINT32)(unsafe.Pointer(Crgtab + uintptr(cr)*4)))>>libc.Int32FromInt32(SCALEBITS))))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(int32(MAXJSAMPLE)-(y+*(*int32)(unsafe.Pointer(Cbbtab + uintptr(cb)*4)))))) /* blue */ /* K passes through unchanged */ *(*TJSAMPLE)(unsafe.Pointer(outptr + 3)) = *(*TJSAMPLE)(unsafe.Pointer(inptr3 + uintptr(col))) /* don't need GETJSAMPLE here */ outptr += uintptr(4) goto _3 _3: ; col++ } } } /* * Convert CMYK to YK part of YCCK for colorless output. * We assume build_rgb_y_table has been called. */ func _cmyk_yk_convert(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, input_row TJDIMENSION, output_buf TJSAMPARRAY, num_rows int32) { var Bytab, Gytab, Rytab uintptr var cconvert Tmy_cconvert_ptr var col, num_cols TJDIMENSION var inptr0, inptr1, inptr2, inptr3, outptr TJSAMPROW var y TINT32 var v1 int32 var v2 TJSAMPARRAY _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Bytab, Gytab, Rytab, cconvert, col, inptr0, inptr1, inptr2, inptr3, num_cols, outptr, y, v1, v2 cconvert = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcconvert Rytab = (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FR_y_tab Gytab = (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FG_y_tab Bytab = (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).FB_y_tab num_cols = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width for { num_rows-- v1 = num_rows if !(v1 >= 0) { break } inptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(input_row)*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 1*4)) + uintptr(input_row)*4)) inptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 2*4)) + uintptr(input_row)*4)) inptr3 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 3*4)) + uintptr(input_row)*4)) input_row++ v2 = output_buf output_buf += 4 outptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) col = uint32(0) for { if !(col < num_cols) { break } y = *(*TINT32)(unsafe.Pointer(Rytab + uintptr(int32(MAXJSAMPLE)-libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0 + uintptr(col)))))*4)) y += *(*TINT32)(unsafe.Pointer(Gytab + uintptr(int32(MAXJSAMPLE)-libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1 + uintptr(col)))))*4)) y += *(*TINT32)(unsafe.Pointer(Bytab + uintptr(int32(MAXJSAMPLE)-libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr2 + uintptr(col)))))*4)) *(*TJSAMPLE)(unsafe.Pointer(outptr)) = libc.Uint8FromInt32(y >> libc.Int32FromInt32(SCALEBITS)) /* K passes through unchanged */ *(*TJSAMPLE)(unsafe.Pointer(outptr + 1)) = *(*TJSAMPLE)(unsafe.Pointer(inptr3 + uintptr(col))) /* don't need GETJSAMPLE here */ outptr += uintptr(2) goto _3 _3: ; col++ } } } /* * Empty method for start_pass. */ func _start_pass_dcolor(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* no work needed */ } /* * Module initialization routine for output colorspace conversion. */ func Xjinit_color_deconverter(tls *libc.TLS, cinfo Tj_decompress_ptr) { var cconvert Tmy_cconvert_ptr var ci, i int32 _, _, _ = cconvert, ci, i cconvert = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(36)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcconvert = cconvert (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_dcolor) /* Make sure num_components agrees with jpeg_color_space */ switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space { case int32(JCS_GRAYSCALE): if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components != int32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } case int32(JCS_RGB): fallthrough case int32(JCS_YCbCr): fallthrough case int32(JCS_BG_RGB): fallthrough case int32(JCS_BG_YCC): if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components != int32(3) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } case int32(JCS_CMYK): fallthrough case int32(JCS_YCCK): if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components != int32(4) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } default: /* JCS_UNKNOWN can be anything */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components < int32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_J_COLORSPACE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* Support color transform only for RGB colorspaces */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform != 0 && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space != int32(JCS_RGB) && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space != int32(JCS_BG_RGB) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Set out_color_components and conversion method based on requested space. * Also adjust the component_needed flags for any unused components, * so that earlier pipeline stages can avoid useless computation. */ switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_space { case int32(JCS_GRAYSCALE): goto _1 case int32(JCS_RGB): goto _2 case int32(JCS_BG_RGB): goto _3 case int32(JCS_CMYK): goto _4 case int32(JCS_YCCK): goto _5 default: goto _6 } goto _7 _1: ; (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components = int32(1) switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space { case int32(JCS_GRAYSCALE): fallthrough case int32(JCS_YCbCr): fallthrough case int32(JCS_BG_YCC): (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_grayscale_convert1) /* For color->grayscale conversion, only the Y (0) component is needed */ ci = int32(1) for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + uintptr(ci)*88))).Fcomponent_needed = int32(FALSE1) goto _8 _8: ; ci++ } case int32(JCS_RGB): switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform { case int32(JCT_NONE): (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb_gray_convert1) case int32(JCT_SUBTRACT_GREEN): (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb1_gray_convert) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } _build_rgb_y_table(tls, cinfo) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } goto _7 _2: ; (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components = int32(RGB_PIXELSIZE) switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space { case int32(JCS_GRAYSCALE): (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_gray_rgb_convert) case int32(JCS_YCbCr): (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_ycc_rgb_convert) _build_ycc_rgb_table(tls, cinfo) case int32(JCS_BG_YCC): (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_ycc_rgb_convert) _build_bg_ycc_rgb_table(tls, cinfo) case int32(JCS_RGB): switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform { case int32(JCT_NONE): (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb_convert1) case int32(JCT_SUBTRACT_GREEN): (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb1_rgb_convert) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } goto _7 _3: ; if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space != int32(JCS_BG_RGB) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components = int32(RGB_PIXELSIZE) switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform { case int32(JCT_NONE): (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb_convert1) case int32(JCT_SUBTRACT_GREEN): (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_rgb1_rgb_convert) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } goto _7 _4: ; if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space != int32(JCS_YCCK) { goto def_label } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components = int32(4) (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_ycck_cmyk_convert) _build_ycc_rgb_table(tls, cinfo) goto _7 _5: ; if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space != int32(JCS_CMYK) || !((*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info))).Fcomponent_needed != 0) || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).Fcomponent_needed != 0 || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).Fcomponent_needed != 0 || !((*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 3*88))).Fcomponent_needed != 0) { goto def_label } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components = int32(2) /* Need all components on input side */ (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).Fcomponent_needed = int32(TRUE1) (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).Fcomponent_needed = int32(TRUE1) (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_cmyk_yk_convert) _build_rgb_y_table(tls, cinfo) goto _7 _6: ; goto def_label def_label: ; /* permit null conversion to same output space */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_space != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space { /* unsupported non-null conversion */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } i = 0 ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + uintptr(ci)*88))).Fcomponent_needed != 0 { i++ } goto _9 _9: ; ci++ } /* count output color components */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components = i (*Tmy_color_deconverter)(unsafe.Pointer(cconvert)).Fpub.Fcolor_convert = __ccgo_fp(_null_convert1) _7: ; if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fquantize_colors != 0 { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_components = int32(1) } else { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_components = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components } } /* * Macros for handling fixed-point arithmetic; these are used by many * but not all of the DCT/IDCT modules. * * All values are expected to be of type INT32. * Fractional constants are scaled left by CONST_BITS bits. * CONST_BITS is defined within each module using these macros, * and may differ from one module to the next. */ /* Convert a positive real constant to an integer scaled by CONST_SCALE. * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, * thus causing a lot of useless floating-point operations at run time. */ /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * This macro is used only when the two inputs will actually be no more than * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a * full 32x32 multiply. This provides a useful speedup on many machines. * Unfortunately there is no way to specify a 16x16->32 multiply portably * in C, but some C compilers will do the right thing if you provide the * correct combination of casts. */ /* Same except both inputs are variables. */ /* Like RIGHT_SHIFT, but applies to a DCTELEM. * We assume that int right shift is unsigned if INT32 right shift is. */ /* * The decompressor input side (jdinput.c) saves away the appropriate * quantization table for each component at the start of the first scan * involving that component. (This is necessary in order to correctly * decode files that reuse Q-table slots.) * When we are ready to make an output pass, the saved Q-table is converted * to a multiplier table that will actually be used by the IDCT routine. * The multiplier table contents are IDCT-method-dependent. To support * application changes in IDCT method between scans, we can remake the * multiplier tables if necessary. * In buffered-image mode, the first output pass may occur before any data * has been seen for some components, and thus before their Q-tables have * been saved away. To handle this case, multiplier tables are preset * to zeroes; the result of the IDCT will be a neutral gray level. */ /* Private subobject for this module */ type Tmy_idct_controller = struct { Fpub Tjpeg_inverse_dct Fcur_method [10]int32 } type Tmy_idct_ptr = uintptr /* Allocated multiplier tables: big enough for any supported variant */ type Tmultiplier_table = struct { Fifast_array [0][64]TIFAST_MULT_TYPE Ffloat_array [0][64]TFLOAT_MULT_TYPE Fislow_array [64]TISLOW_MULT_TYPE } /* The current scaled-IDCT routines require ISLOW-style multiplier tables, * so be sure to compile that code if either ISLOW or SCALING is requested. */ /* * Prepare for an output pass. * Here we select the proper IDCT routine for each component and build * a matching multiplier table. */ func _start_pass2(tls *libc.TLS, cinfo Tj_decompress_ptr) { var ci, col, i, method, row int32 var compptr, fmtbl, ifmtbl, ismtbl, qtbl uintptr var idct Tmy_idct_ptr var method_ptr Tinverse_DCT_method_ptr _, _, _, _, _, _, _, _, _, _, _, _ = ci, col, compptr, fmtbl, i, idct, ifmtbl, ismtbl, method, method_ptr, qtbl, row idct = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fidct method = 0 method_ptr = libc.UintptrFromInt32(0) ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Select the proper IDCT routine for this component's scaling */ switch (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size<> (libc.Int32FromInt32(CONST_BITS) - libc.Int32FromInt32(IFAST_SCALE_BITS)) goto _3 _3: ; i++ } case int32(JDCT_FLOAT): /* For float AA&N IDCT method, multipliers are equal to quantization * coefficients scaled by scalefactor[row]*scalefactor[col], where * scalefactor[0] = 1 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 * We apply a further scale factor of 1/8. */ fmtbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdct_table i = 0 row = 0 for { if !(row < int32(DCTSIZE)) { break } col = 0 for { if !(col < int32(DCTSIZE)) { break } *(*TFLOAT_MULT_TYPE)(unsafe.Pointer(fmtbl + uintptr(i)*4)) = float32(float64(*(*TUINT16)(unsafe.Pointer(qtbl + uintptr(i)*2))) * _aanscalefactor1[row] * _aanscalefactor1[col] * libc.Float64FromFloat64(0.125)) i++ goto _5 _5: ; col++ } goto _4 _4: ; row++ } default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NOT_COMPILED) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) break } goto _1 _1: ; ci++ compptr += 88 } } var _aanscales1 = [64]TINT16{ 0: int16(16384), 1: int16(22725), 2: int16(21407), 3: int16(19266), 4: int16(16384), 5: int16(12873), 6: int16(8867), 7: int16(4520), 8: int16(22725), 9: int16(31521), 10: int16(29692), 11: int16(26722), 12: int16(22725), 13: int16(17855), 14: int16(12299), 15: int16(6270), 16: int16(21407), 17: int16(29692), 18: int16(27969), 19: int16(25172), 20: int16(21407), 21: int16(16819), 22: int16(11585), 23: int16(5906), 24: int16(19266), 25: int16(26722), 26: int16(25172), 27: int16(22654), 28: int16(19266), 29: int16(15137), 30: int16(10426), 31: int16(5315), 32: int16(16384), 33: int16(22725), 34: int16(21407), 35: int16(19266), 36: int16(16384), 37: int16(12873), 38: int16(8867), 39: int16(4520), 40: int16(12873), 41: int16(17855), 42: int16(16819), 43: int16(15137), 44: int16(12873), 45: int16(10114), 46: int16(6967), 47: int16(3552), 48: int16(8867), 49: int16(12299), 50: int16(11585), 51: int16(10426), 52: int16(8867), 53: int16(6967), 54: int16(4799), 55: int16(2446), 56: int16(4520), 57: int16(6270), 58: int16(5906), 59: int16(5315), 60: int16(4520), 61: int16(3552), 62: int16(2446), 63: int16(1247), } var _aanscalefactor1 = [8]float64{ 0: float64(1), 1: float64(1.387039845), 2: float64(1.306562965), 3: float64(1.175875602), 4: float64(1), 5: float64(0.785694958), 6: float64(0.5411961), 7: float64(0.275899379), } /* * Initialize IDCT manager. */ func Xjinit_inverse_dct(tls *libc.TLS, cinfo Tj_decompress_ptr) { var ci int32 var compptr uintptr var idct Tmy_idct_ptr _, _, _ = ci, compptr, idct idct = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(84)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fidct = idct (*Tmy_idct_controller)(unsafe.Pointer(idct)).Fpub.Fstart_pass = __ccgo_fp(_start_pass2) ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Allocate and pre-zero a multiplier table for each component */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdct_table = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(256)) libc.Xmemset(tls, (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdct_table, 0, libc.Uint32FromInt64(256)) /* Mark multiplier table not yet set up for any method */ *(*int32)(unsafe.Pointer(idct + 44 + uintptr(ci)*4)) = -int32(1) goto _1 _1: ; ci++ compptr += 88 } } const BIT_BUF_SIZE = 32 const HUFF_LOOKAHEAD = 8 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Derived data constructed for each Huffman table */ type Td_derived_tbl = struct { Fmaxcode [18]TINT32 Fvaloffset [17]TINT32 Fpub uintptr Flook_nbits [256]int32 Flook_sym [256]TUINT8 } /* * Fetching the next N bits from the input stream is a time-critical operation * for the Huffman decoders. We implement it with a combination of inline * macros and out-of-line subroutines. Note that N (the number of bits * demanded at one time) never exceeds 15 for JPEG use. * * We read source bytes into get_buffer and dole out bits as needed. * If get_buffer already contains enough bits, they are fetched in-line * by the macros CHECK_BIT_BUFFER and GET_BITS. When there aren't enough * bits, jpeg_fill_bit_buffer is called; it will attempt to fill get_buffer * as full as possible (not just to the number of bits needed; this * prefetching reduces the overhead cost of calling jpeg_fill_bit_buffer). * Note that jpeg_fill_bit_buffer may return FALSE to indicate suspension. * On TRUE return, jpeg_fill_bit_buffer guarantees that get_buffer contains * at least the requested number of bits --- dummy zeroes are inserted if * necessary. */ type Tbit_buf_type = int32 /* type of bit-extraction buffer */ /* If long is > 32 bits on your machine, and shifting/masking longs is * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE * appropriately should be a win. Unfortunately we can't define the size * with something like #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8) * because not all machines measure sizeof in 8-bit bytes. */ type Tbitread_perm_state = struct { Fget_buffer Tbit_buf_type Fbits_left int32 } type Tbitread_working_state = struct { Fnext_input_byte uintptr Fbytes_in_buffer Tsize_t Fget_buffer Tbit_buf_type Fbits_left int32 Fcinfo Tj_decompress_ptr } /* Macros to declare and load/save bitread local variables. */ /* * These macros provide the in-line portion of bit fetching. * Use CHECK_BIT_BUFFER to ensure there are N bits in get_buffer * before using GET_BITS, PEEK_BITS, or DROP_BITS. * The variables get_buffer and bits_left are assumed to be locals, * but the state struct might not be (jpeg_huff_decode needs this). * CHECK_BIT_BUFFER(state,n,action); * Ensure there are N bits in get_buffer; if suspend, take action. * val = GET_BITS(n); * Fetch next N bits. * val = PEEK_BITS(n); * Fetch next N bits without removing them from the buffer. * DROP_BITS(n); * Discard next N bits. * The value N should be a simple variable, not an expression, because it * is evaluated multiple times. */ /* * Code for extracting next Huffman-coded symbol from input bit stream. * Again, this is time-critical and we make the main paths be macros. * * We use a lookahead table to process codes of up to HUFF_LOOKAHEAD bits * without looping. Usually, more than 95% of the Huffman codes will be 8 * or fewer bits long. The few overlength codes are handled with a loop, * which need not be inline code. * * Notes about the HUFF_DECODE macro: * 1. Near the end of the data segment, we may fail to get enough bits * for a lookahead. In that case, we do it the hard way. * 2. If the lookahead table contains no entry, the next code must be * more than HUFF_LOOKAHEAD bits long. * 3. jpeg_huff_decode returns -1 if forced to suspend. */ /* * Expanded entropy decoder object for Huffman decoding. * * The savable_state subrecord contains fields that change within an MCU, * but must not be updated permanently until we complete the MCU. */ type Tsavable_state = struct { FEOBRUN uint32 Flast_dc_val [4]int32 } /* This macro is to work around compilers with missing or broken * structure assignment. You'll need to fix this code if you have * such a compiler and you change MAX_COMPS_IN_SCAN. */ type Thuff_entropy_decoder = struct { Fpub Tjpeg_entropy_decoder Fbitstate Tbitread_perm_state Fsaved Tsavable_state Finsufficient_data Tboolean Frestarts_to_go uint32 Fderived_tbls [4]uintptr Fac_derived_tbl uintptr Fdc_derived_tbls [4]uintptr Fac_derived_tbls [4]uintptr Fdc_cur_tbls [10]uintptr Fac_cur_tbls [10]uintptr Fcoef_limit [10]int32 } type Thuff_entropy_ptr = uintptr var _jpeg_zigzag_order = [8][8]int32{ 0: { 1: int32(1), 2: int32(5), 3: int32(6), 4: int32(14), 5: int32(15), 6: int32(27), 7: int32(28), }, 1: { 0: int32(2), 1: int32(4), 2: int32(7), 3: int32(13), 4: int32(16), 5: int32(26), 6: int32(29), 7: int32(42), }, 2: { 0: int32(3), 1: int32(8), 2: int32(12), 3: int32(17), 4: int32(25), 5: int32(30), 6: int32(41), 7: int32(43), }, 3: { 0: int32(9), 1: int32(11), 2: int32(18), 3: int32(24), 4: int32(31), 5: int32(40), 6: int32(44), 7: int32(53), }, 4: { 0: int32(10), 1: int32(19), 2: int32(23), 3: int32(32), 4: int32(39), 5: int32(45), 6: int32(52), 7: int32(54), }, 5: { 0: int32(20), 1: int32(22), 2: int32(33), 3: int32(38), 4: int32(46), 5: int32(51), 6: int32(55), 7: int32(60), }, 6: { 0: int32(21), 1: int32(34), 2: int32(37), 3: int32(47), 4: int32(50), 5: int32(56), 6: int32(59), 7: int32(61), }, 7: { 0: int32(35), 1: int32(36), 2: int32(48), 3: int32(49), 4: int32(57), 5: int32(58), 6: int32(62), 7: int32(63), }, } var _jpeg_zigzag_order7 = [7][7]int32{ 0: { 1: int32(1), 2: int32(5), 3: int32(6), 4: int32(14), 5: int32(15), 6: int32(27), }, 1: { 0: int32(2), 1: int32(4), 2: int32(7), 3: int32(13), 4: int32(16), 5: int32(26), 6: int32(28), }, 2: { 0: int32(3), 1: int32(8), 2: int32(12), 3: int32(17), 4: int32(25), 5: int32(29), 6: int32(38), }, 3: { 0: int32(9), 1: int32(11), 2: int32(18), 3: int32(24), 4: int32(30), 5: int32(37), 6: int32(39), }, 4: { 0: int32(10), 1: int32(19), 2: int32(23), 3: int32(31), 4: int32(36), 5: int32(40), 6: int32(45), }, 5: { 0: int32(20), 1: int32(22), 2: int32(32), 3: int32(35), 4: int32(41), 5: int32(44), 6: int32(46), }, 6: { 0: int32(21), 1: int32(33), 2: int32(34), 3: int32(42), 4: int32(43), 5: int32(47), 6: int32(48), }, } var _jpeg_zigzag_order6 = [6][6]int32{ 0: { 1: int32(1), 2: int32(5), 3: int32(6), 4: int32(14), 5: int32(15), }, 1: { 0: int32(2), 1: int32(4), 2: int32(7), 3: int32(13), 4: int32(16), 5: int32(25), }, 2: { 0: int32(3), 1: int32(8), 2: int32(12), 3: int32(17), 4: int32(24), 5: int32(26), }, 3: { 0: int32(9), 1: int32(11), 2: int32(18), 3: int32(23), 4: int32(27), 5: int32(32), }, 4: { 0: int32(10), 1: int32(19), 2: int32(22), 3: int32(28), 4: int32(31), 5: int32(33), }, 5: { 0: int32(20), 1: int32(21), 2: int32(29), 3: int32(30), 4: int32(34), 5: int32(35), }, } var _jpeg_zigzag_order5 = [5][5]int32{ 0: { 1: int32(1), 2: int32(5), 3: int32(6), 4: int32(14), }, 1: { 0: int32(2), 1: int32(4), 2: int32(7), 3: int32(13), 4: int32(15), }, 2: { 0: int32(3), 1: int32(8), 2: int32(12), 3: int32(16), 4: int32(21), }, 3: { 0: int32(9), 1: int32(11), 2: int32(17), 3: int32(20), 4: int32(22), }, 4: { 0: int32(10), 1: int32(18), 2: int32(19), 3: int32(23), 4: int32(24), }, } var _jpeg_zigzag_order4 = [4][4]int32{ 0: { 1: int32(1), 2: int32(5), 3: int32(6), }, 1: { 0: int32(2), 1: int32(4), 2: int32(7), 3: int32(12), }, 2: { 0: int32(3), 1: int32(8), 2: int32(11), 3: int32(13), }, 3: { 0: int32(9), 1: int32(10), 2: int32(14), 3: int32(15), }, } var _jpeg_zigzag_order3 = [3][3]int32{ 0: { 1: int32(1), 2: int32(5), }, 1: { 0: int32(2), 1: int32(4), 2: int32(6), }, 2: { 0: int32(3), 1: int32(7), 2: int32(8), }, } var _jpeg_zigzag_order2 = [2][2]int32{ 0: { 1: int32(1), }, 1: { 0: int32(2), 1: int32(3), }, } /* * Compute the derived values for a Huffman table. * This routine also performs some validation checks on the table. */ func _jpeg_make_d_derived_tbl(tls *libc.TLS, cinfo Tj_decompress_ptr, isDC Tboolean, tblno int32, pdtbl uintptr) { var code uint32 var ctr, i, l, lookbits, numsymbols, p, si, sym, v3, v4, v5 int32 var dtbl, htbl, v1 uintptr var huffcode [257]uint32 var huffsize [257]uint8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = code, ctr, dtbl, htbl, huffcode, huffsize, i, l, lookbits, numsymbols, p, si, sym, v1, v3, v4, v5 /* Note that huffsize[] and huffcode[] are filled in code-length order, * paralleling the order of the symbols themselves in htbl->huffval[]. */ /* Find the input Huffman table */ if tblno < 0 || tblno >= int32(NUM_HUFF_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_HUFF_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = tblno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if isDC != 0 { v1 = *(*uintptr)(unsafe.Pointer(cinfo + 180 + uintptr(tblno)*4)) } else { v1 = *(*uintptr)(unsafe.Pointer(cinfo + 196 + uintptr(tblno)*4)) } htbl = v1 if htbl == libc.UintptrFromInt32(0) { htbl = Xjpeg_std_huff_table(tls, cinfo, isDC, tblno) } /* Allocate a workspace if we haven't already done so. */ if *(*uintptr)(unsafe.Pointer(pdtbl)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(pdtbl)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(1424)) } dtbl = *(*uintptr)(unsafe.Pointer(pdtbl)) (*Td_derived_tbl)(unsafe.Pointer(dtbl)).Fpub = htbl /* fill in back link */ /* Figure C.1: make table of Huffman code length for each symbol */ p = 0 l = int32(1) for { if !(l <= int32(16)) { break } i = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + uintptr(l)))) if i < 0 || p+i > int32(256) { /* protect against table overrun */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_HUFF_TABLE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } for { v3 = i i-- if !(v3 != 0) { break } v4 = p p++ huffsize[v4] = libc.Uint8FromInt32(l) } goto _2 _2: ; l++ } huffsize[p] = uint8(0) numsymbols = p /* Figure C.2: generate the codes themselves */ /* We also validate that the counts represent a legal Huffman code tree. */ code = uint32(0) si = libc.Int32FromUint8(huffsize[0]) p = 0 for huffsize[p] != 0 { for libc.Int32FromUint8(huffsize[p]) == si { v5 = p p++ huffcode[v5] = code code++ } /* code is now 1 more than the last code used for codelength si; but * it must still fit in si bits, since no code is allowed to be all ones. */ if libc.Int32FromUint32(code) >= libc.Int32FromInt32(1)< 0) { break } *(*int32)(unsafe.Pointer(dtbl + 144 + uintptr(lookbits)*4)) = l *(*TUINT8)(unsafe.Pointer(dtbl + 1168 + uintptr(lookbits))) = *(*TUINT8)(unsafe.Pointer(htbl + 17 + uintptr(p))) lookbits++ goto _9 _9: ; ctr-- } goto _8 _8: ; i++ p++ } goto _7 _7: ; l++ } /* Validate symbols as being reasonable. * For AC tables, we make no check, but accept all byte values 0..255. * For DC tables, we require the symbols to be in range 0..15. * (Tighter bounds could be applied depending on the data depth and mode, * but this is sufficient to ensure safe decoding.) */ if isDC != 0 { i = 0 for { if !(i < numsymbols) { break } sym = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + 17 + uintptr(i)))) if sym < 0 || sym > int32(15) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_HUFF_TABLE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } goto _10 _10: ; i++ } } } /* * Out-of-line code for bit fetching. * Note: current values of get_buffer and bits_left are passed as parameters, * but are returned in the corresponding fields of the state struct. * * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width * of get_buffer to be used. (On machines with wider words, an even larger * buffer could be used.) However, on some machines 32-bit shifts are * quite slow and take time proportional to the number of places shifted. * (This is true with most PC compilers, for instance.) In this case it may * be a win to set MIN_GET_BITS to the minimum value of 15. This reduces the * average shift distance at the cost of more calls to jpeg_fill_bit_buffer. */ func _jpeg_fill_bit_buffer(tls *libc.TLS, state uintptr, get_buffer Tbit_buf_type, bits_left int32, nbits int32) (r Tboolean) { /* Load up the bit buffer to a depth of at least nbits */ var bytes_in_buffer Tsize_t var c int32 var cinfo Tj_decompress_ptr var next_input_byte, v3, v4 uintptr _, _, _, _, _, _ = bytes_in_buffer, c, cinfo, next_input_byte, v3, v4 /* Copy heavily used state fields into locals (hopefully registers) */ next_input_byte = (*Tbitread_working_state)(unsafe.Pointer(state)).Fnext_input_byte bytes_in_buffer = (*Tbitread_working_state)(unsafe.Pointer(state)).Fbytes_in_buffer cinfo = (*Tbitread_working_state)(unsafe.Pointer(state)).Fcinfo /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */ /* (It is assumed that no request will be for more than that many bits.) */ /* We fail to do so only if we hit a marker or are forced to suspend. */ if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker == 0) { goto _1 } /* cannot advance past a marker */ for bits_left < libc.Int32FromInt32(BIT_BUF_SIZE)-libc.Int32FromInt32(7) { /* Attempt to read a byte */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer } bytes_in_buffer-- v3 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v3))) /* If it's 0xFF, check and discard stuffed zero byte */ if c == int32(0xFF) { /* Loop here to discard any padding FF's on terminating marker, * so that we can save a valid unread_marker value. NOTE: we will * accept multiple FF's followed by a 0 as meaning a single FF data * byte. This data pattern is not valid according to the standard. */ for cond := true; cond; cond = c == int32(0xFF) { if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer } bytes_in_buffer-- v4 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v4))) } if c == 0 { /* Found FF/00, which represents an FF data byte */ c = int32(0xFF) } else { /* Oops, it's actually a marker indicating end of compressed data. * Save the marker code for later use. * Fine point: it might appear that we should save the marker into * bitread working state, not straight into permanent state. But * once we have hit a marker, we cannot need to suspend within the * current MCU, because we will read no more bytes from the data * source. So it is OK to update permanent state right away. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker = c /* See if we need to insert some fake zero bits. */ goto no_more_bytes } } /* OK, load c into get_buffer */ get_buffer = get_buffer< bits_left { /* Uh-oh. Report corrupted data to user and stuff zeroes into * the data stream, so that we can produce some kind of image. * We use a nonvolatile flag to ensure that only one warning message * appears per data segment. */ if !((*Thuff_entropy_decoder)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Finsufficient_data != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_HIT_MARKER) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Thuff_entropy_decoder)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Finsufficient_data = int32(TRUE1) } /* Fill the buffer with zero bits */ get_buffer <<= libc.Int32FromInt32(BIT_BUF_SIZE) - libc.Int32FromInt32(7) - bits_left bits_left = libc.Int32FromInt32(BIT_BUF_SIZE) - libc.Int32FromInt32(7) } _2: ; /* Unload the local registers */ (*Tbitread_working_state)(unsafe.Pointer(state)).Fnext_input_byte = next_input_byte (*Tbitread_working_state)(unsafe.Pointer(state)).Fbytes_in_buffer = bytes_in_buffer (*Tbitread_working_state)(unsafe.Pointer(state)).Fget_buffer = get_buffer (*Tbitread_working_state)(unsafe.Pointer(state)).Fbits_left = bits_left return int32(TRUE1) } /* * Figure F.12: extend sign bit. * On some machines, a shift and sub will be faster than a table lookup. */ var _bmask = [16]int32{ 1: int32(0x0001), 2: int32(0x0003), 3: int32(0x0007), 4: int32(0x000F), 5: int32(0x001F), 6: int32(0x003F), 7: int32(0x007F), 8: int32(0x00FF), 9: int32(0x01FF), 10: int32(0x03FF), 11: int32(0x07FF), 12: int32(0x0FFF), 13: int32(0x1FFF), 14: int32(0x3FFF), 15: int32(0x7FFF), } /* * Out-of-line code for Huffman code decoding. */ func _jpeg_huff_decode(tls *libc.TLS, state uintptr, get_buffer Tbit_buf_type, bits_left int32, htbl uintptr, min_bits int32) (r int32) { var code TINT32 var l int32 _, _ = code, l l = min_bits /* HUFF_DECODE has determined that the code is at least min_bits */ /* bits long, so fetch that many bits in one swoop. */ if bits_left < l { if !(_jpeg_fill_bit_buffer(tls, state, get_buffer, bits_left, l) != 0) { return -int32(1) } get_buffer = (*Tbitread_working_state)(unsafe.Pointer(state)).Fget_buffer bits_left = (*Tbitread_working_state)(unsafe.Pointer(state)).Fbits_left } bits_left -= l code = get_buffer >> bits_left & _bmask[l] /* Collect the rest of the Huffman code one bit at a time. */ /* This is per Figure F.16 in the JPEG spec. */ for code > *(*TINT32)(unsafe.Pointer(htbl + uintptr(l)*4)) { code <<= int32(1) if bits_left < int32(1) { if !(_jpeg_fill_bit_buffer(tls, state, get_buffer, bits_left, int32(1)) != 0) { return -int32(1) } get_buffer = (*Tbitread_working_state)(unsafe.Pointer(state)).Fget_buffer bits_left = (*Tbitread_working_state)(unsafe.Pointer(state)).Fbits_left } bits_left -= int32(1) code |= get_buffer >> bits_left & _bmask[int32(1)] l++ } /* Unload the local registers */ (*Tbitread_working_state)(unsafe.Pointer(state)).Fget_buffer = get_buffer (*Tbitread_working_state)(unsafe.Pointer(state)).Fbits_left = bits_left /* With garbage input we may reach the sentinel value l = 17. */ if l > int32(16) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer((*Tbitread_working_state)(unsafe.Pointer(state)).Fcinfo)).Ferr)).Fmsg_code = int32(JWRN_HUFF_BAD_CODE) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer((*Tbitread_working_state)(unsafe.Pointer(state)).Fcinfo)).Ferr)).Femit_message})))(tls, (*Tbitread_working_state)(unsafe.Pointer(state)).Fcinfo, -int32(1)) return 0 /* fake a zero as the safest result */ } return libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer((*Td_derived_tbl)(unsafe.Pointer(htbl)).Fpub + 17 + uintptr(code+*(*TINT32)(unsafe.Pointer(htbl + 72 + uintptr(l)*4)))))) } /* * Finish up at the end of a Huffman-compressed scan. */ func _finish_pass_huff(tls *libc.TLS, cinfo Tj_decompress_ptr) { var entropy Thuff_entropy_ptr _ = entropy entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Throw away any unused bits remaining in bit buffer; */ /* include any full bytes in next_marker's count of discarded bytes */ *(*uint32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker + 24)) += libc.Uint32FromInt32((*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left / int32(8)) (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left = 0 } /* * Check for a restart marker & resynchronize decoder. * Returns FALSE if must suspend. */ func _process_restart1(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { var ci int32 var entropy Thuff_entropy_ptr _, _ = ci, entropy entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy _finish_pass_huff(tls, cinfo) /* Advance past the RSTn marker */ if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fread_restart_marker})))(tls, cinfo) != 0) { return int32(FALSE1) } /* Re-initialize DC predictions to 0 */ ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } *(*int32)(unsafe.Pointer(entropy + 20 + 4 + uintptr(ci)*4)) = 0 goto _1 _1: ; ci++ } /* Re-init EOB run count, too */ (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved.FEOBRUN = uint32(0) /* Reset restart counter */ (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval /* Reset out-of-data flag, unless read_restart_marker left us smack up * against a marker. In that case we will end up treating the next data * segment as empty, and we can avoid producing bogus output pixels by * leaving the flag set. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker == 0 { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Finsufficient_data = int32(FALSE1) } return int32(TRUE1) } /* * Huffman MCU decoding. * Each of these routines decodes and returns one MCU's worth of * Huffman-compressed coefficients. * The coefficients are reordered from zigzag order into natural array order, * but are not dequantized. * * The i'th block of the MCU is stored into the block pointed to by * MCU_data[i]. WE ASSUME THIS AREA IS INITIALLY ZEROED BY THE CALLER. * (Wholesale zeroing is usually a little faster than retail...) * * We return FALSE if data source requested suspension. In that case no * changes have been made to permanent state. (Exception: some output * coefficients may already have been assigned. This is harmless for * spectral selection, since we'll just re-assign them on the next call. * Successive approximation AC refinement has to be more careful, however.) */ /* * MCU decoding for DC initial scan (either spectral selection, * or first pass of successive approximation). */ func _decode_mcu_DC_first1(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r1 Tboolean) { bp := tls.Alloc(48) defer tls.Free(48) var Al, bits_left, blkn, ci, look, nb, r, s, v4, v5, v6 int32 var block TJBLOCKROW var compptr, tbl uintptr var entropy Thuff_entropy_ptr var get_buffer Tbit_buf_type var _ /* br_state at bp+0 */ Tbitread_working_state var _ /* state at bp+20 */ Tsavable_state _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Al, bits_left, blkn, block, ci, compptr, entropy, get_buffer, look, nb, r, s, tbl, v4, v5, v6 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy Al = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl /* Process restart marker if needed; may have to suspend */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { if !(_process_restart1(tls, cinfo) != 0) { return int32(FALSE1) } } } /* If we've run out of data, just leave the MCU set to zeroes. * This way, we return uniform gray for the remainder of the segment. */ if !((*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Finsufficient_data != 0) { /* Load up working state */ (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fcinfo = cinfo (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer get_buffer = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer bits_left = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left *(*Tsavable_state)(unsafe.Pointer(bp + 20)) = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved /* Outer loop handles each block in the MCU */ blkn = 0 for { if !(blkn < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)) ci = *(*int32)(unsafe.Pointer(cinfo + 372 + uintptr(blkn)*4)) compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) tbl = *(*uintptr)(unsafe.Pointer(entropy + 48 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no)*4)) /* Decode a single block's worth of coefficients */ /* Section F.2.2.1: decode the DC coefficient difference */ if bits_left < int32(HUFF_LOOKAHEAD) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, 0) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left if bits_left < int32(HUFF_LOOKAHEAD) { nb = int32(1) goto label1 } } look = get_buffer >> (bits_left - libc.Int32FromInt32(HUFF_LOOKAHEAD)) & _bmask[int32(HUFF_LOOKAHEAD)] v4 = *(*int32)(unsafe.Pointer(tbl + 144 + uintptr(look)*4)) nb = v4 if !(v4 != 0) { goto _2 } bits_left -= nb s = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(tbl + 1168 + uintptr(look)))) goto _3 _2: ; nb = libc.Int32FromInt32(HUFF_LOOKAHEAD) + libc.Int32FromInt32(1) goto label1 label1: ; v5 = _jpeg_huff_decode(tls, bp, get_buffer, bits_left, tbl, nb) s = v5 if v5 < 0 { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left _3: ; if s != 0 { if bits_left < s { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, s) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= s r = get_buffer >> bits_left & _bmask[s] if r <= _bmask[s-int32(1)] { v6 = r - _bmask[s] } else { v6 = r } s = v6 } /* Convert DC difference to actual value, update last_dc_val */ s += *(*int32)(unsafe.Pointer(bp + 20 + 4 + uintptr(ci)*4)) *(*int32)(unsafe.Pointer(bp + 20 + 4 + uintptr(ci)*4)) = s /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */ *(*TJCOEF)(unsafe.Pointer(block)) = int16(s << Al) goto _1 _1: ; blkn++ } /* Completed MCU, so update state */ (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer = get_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left = bits_left (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved = *(*Tsavable_state)(unsafe.Pointer(bp + 20)) } /* Account for restart interval if using restarts */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) } /* * MCU decoding for AC initial scan (either spectral selection, * or first pass of successive approximation). */ func _decode_mcu_AC_first1(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r1 Tboolean) { bp := tls.Alloc(32) defer tls.Free(32) var Al, Se, bits_left, k, look, nb, r, s, v4, v5, v6 int32 var EOBRUN uint32 var block TJBLOCKROW var entropy Thuff_entropy_ptr var get_buffer Tbit_buf_type var natural_order, tbl uintptr var _ /* br_state at bp+0 */ Tbitread_working_state _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Al, EOBRUN, Se, bits_left, block, entropy, get_buffer, k, look, natural_order, nb, r, s, tbl, v4, v5, v6 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Process restart marker if needed; may have to suspend */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { if !(_process_restart1(tls, cinfo) != 0) { return int32(FALSE1) } } } /* If we've run out of data, just leave the MCU set to zeroes. * This way, we return uniform gray for the remainder of the segment. */ if !((*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Finsufficient_data != 0) { /* Load up working state. * We can avoid loading/saving bitread state if in an EOB run. */ EOBRUN = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved.FEOBRUN /* only part of saved state we need */ /* There is always only one block per MCU */ if EOBRUN != 0 { /* if it's a band of zeroes... */ EOBRUN-- } else { (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fcinfo = cinfo (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer get_buffer = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer bits_left = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left Se = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe Al = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl natural_order = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data)) tbl = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fac_derived_tbl k = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs for { if !(k <= Se) { break } if bits_left < int32(HUFF_LOOKAHEAD) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, 0) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left if bits_left < int32(HUFF_LOOKAHEAD) { nb = int32(1) goto label2 } } look = get_buffer >> (bits_left - libc.Int32FromInt32(HUFF_LOOKAHEAD)) & _bmask[int32(HUFF_LOOKAHEAD)] v4 = *(*int32)(unsafe.Pointer(tbl + 144 + uintptr(look)*4)) nb = v4 if !(v4 != 0) { goto _2 } bits_left -= nb s = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(tbl + 1168 + uintptr(look)))) goto _3 _2: ; nb = libc.Int32FromInt32(HUFF_LOOKAHEAD) + libc.Int32FromInt32(1) goto label2 label2: ; v5 = _jpeg_huff_decode(tls, bp, get_buffer, bits_left, tbl, nb) s = v5 if v5 < 0 { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left _3: ; r = s >> int32(4) s &= int32(15) if s != 0 { k += r if bits_left < s { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, s) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= s r = get_buffer >> bits_left & _bmask[s] if r <= _bmask[s-int32(1)] { v6 = r - _bmask[s] } else { v6 = r } s = v6 /* Scale and output coefficient in natural (dezigzagged) order */ *(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)))*2)) = int16(s << Al) } else { if r != int32(15) { /* EOBr, run length is 2^r + appended bits */ if r != 0 { /* EOBr, r > 0 */ EOBRUN = libc.Uint32FromInt32(int32(1) << r) if bits_left < r { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, r) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= r r = get_buffer >> bits_left & _bmask[r] EOBRUN += libc.Uint32FromInt32(r) EOBRUN-- /* this band is processed at this moment */ } break /* force end-of-band */ } k += int32(15) /* ZRL: skip 15 zeroes in band */ } goto _1 _1: ; k++ } (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer = get_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left = bits_left } /* Completed MCU, so update state */ (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved.FEOBRUN = EOBRUN /* only part of saved state we need */ } /* Account for restart interval if using restarts */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) } /* * MCU decoding for DC successive approximation refinement scan. * Note: we assume such scans can be multi-component, * although the spec is not very clear on the point. */ func _decode_mcu_DC_refine1(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { bp := tls.Alloc(32) defer tls.Free(32) var bits_left, blkn int32 var entropy Thuff_entropy_ptr var get_buffer Tbit_buf_type var p1 TJCOEF var p2 uintptr var _ /* br_state at bp+0 */ Tbitread_working_state _, _, _, _, _, _ = bits_left, blkn, entropy, get_buffer, p1, p2 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Process restart marker if needed; may have to suspend */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { if !(_process_restart1(tls, cinfo) != 0) { return int32(FALSE1) } } } /* Not worth the cycles to check insufficient_data here, * since we will not change the data anyway if we read zeroes. */ /* Load up working state */ (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fcinfo = cinfo (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer get_buffer = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer bits_left = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left p1 = int16(int32(1) << (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl) /* 1 in the bit position being coded */ /* Outer loop handles each block in the MCU */ blkn = 0 for { if !(blkn < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } /* Encoded data is simply the next bit of the two's-complement DC value */ if bits_left < int32(1) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, int32(1)) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= int32(1) if get_buffer>>bits_left&_bmask[int32(1)] != 0 { p2 = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)) *(*TJCOEF)(unsafe.Pointer(p2)) = TJCOEF(int32(*(*TJCOEF)(unsafe.Pointer(p2))) | int32(p1)) } /* Note: since we use |=, repeating the assignment later is safe */ goto _1 _1: ; blkn++ } /* Completed MCU, so update state */ (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer = get_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left = bits_left /* Account for restart interval if using restarts */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) } /* * MCU decoding for AC successive approximation refinement scan. */ func _decode_mcu_AC_refine1(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r1 Tboolean) { bp := tls.Alloc(32) defer tls.Free(32) var EOBRUN uint32 var Se, bits_left, k, look, nb, num_newnz, pos, r, s, v11, v3, v4, v7, v8 int32 var block TJBLOCKROW var entropy Thuff_entropy_ptr var get_buffer Tbit_buf_type var m1, p1 TJCOEF var natural_order, tbl, p10, p5, p6, p9 uintptr var newnz_pos [64]int32 var thiscoef TJCOEFPTR var _ /* br_state at bp+0 */ Tbitread_working_state _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = EOBRUN, Se, bits_left, block, entropy, get_buffer, k, look, m1, natural_order, nb, newnz_pos, num_newnz, p1, pos, r, s, tbl, thiscoef, v11, v3, v4, v7, v8, p10, p5, p6, p9 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Process restart marker if needed; may have to suspend */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { if !(_process_restart1(tls, cinfo) != 0) { return int32(FALSE1) } } } /* If we've run out of data, don't modify the MCU. */ if !((*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Finsufficient_data != 0) { Se = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe p1 = int16(int32(1) << (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl) /* 1 in the bit position being coded */ m1 = int16(-int32(p1)) /* -1 in the bit position being coded */ natural_order = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order /* Load up working state */ (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fcinfo = cinfo (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer get_buffer = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer bits_left = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left EOBRUN = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved.FEOBRUN /* only part of saved state we need */ /* There is always only one block per MCU */ block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data)) tbl = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fac_derived_tbl /* If we are forced to suspend, we must undo the assignments to any newly * nonzero coefficients in the block, because otherwise we'd get confused * next time about which coefficients were already nonzero. * But we need not undo addition of bits to already-nonzero coefficients; * instead, we can test the current bit to see if we already did it. */ num_newnz = 0 /* initialize coefficient loop counter to start of band */ k = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs if EOBRUN == uint32(0) { for cond := true; cond; cond = k <= Se { if bits_left < int32(HUFF_LOOKAHEAD) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, 0) != 0) { goto undoit } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left if bits_left < int32(HUFF_LOOKAHEAD) { nb = int32(1) goto label3 } } look = get_buffer >> (bits_left - libc.Int32FromInt32(HUFF_LOOKAHEAD)) & _bmask[int32(HUFF_LOOKAHEAD)] v3 = *(*int32)(unsafe.Pointer(tbl + 144 + uintptr(look)*4)) nb = v3 if !(v3 != 0) { goto _1 } bits_left -= nb s = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(tbl + 1168 + uintptr(look)))) goto _2 _1: ; nb = libc.Int32FromInt32(HUFF_LOOKAHEAD) + libc.Int32FromInt32(1) goto label3 label3: ; v4 = _jpeg_huff_decode(tls, bp, get_buffer, bits_left, tbl, nb) s = v4 if v4 < 0 { goto undoit } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left _2: ; r = s >> int32(4) s &= int32(15) if s != 0 { if s != int32(1) { /* size of new coef should always be 1 */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_HUFF_BAD_CODE) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) } if bits_left < int32(1) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, int32(1)) != 0) { goto undoit } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= int32(1) if get_buffer>>bits_left&_bmask[int32(1)] != 0 { s = int32(p1) } else { s = int32(m1) } /* newly nonzero coef is negative */ } else { if r != int32(15) { EOBRUN = libc.Uint32FromInt32(int32(1) << r) /* EOBr, run length is 2^r + appended bits */ if r != 0 { if bits_left < r { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, r) != 0) { goto undoit } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= r r = get_buffer >> bits_left & _bmask[r] EOBRUN += libc.Uint32FromInt32(r) } break /* rest of block is handled by EOB logic */ } /* note s = 0 for processing ZRL */ } /* Advance over already-nonzero coefs and r still-zero coefs, * appending correction bits to the nonzeroes. A correction bit is 1 * if the absolute value of the coefficient must be increased. */ for cond := true; cond; cond = k <= Se { thiscoef = block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)))*2 if *(*TJCOEF)(unsafe.Pointer(thiscoef)) != 0 { if bits_left < int32(1) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, int32(1)) != 0) { goto undoit } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= int32(1) if get_buffer>>bits_left&_bmask[int32(1)] != 0 { if int32(*(*TJCOEF)(unsafe.Pointer(thiscoef)))&int32(p1) == 0 { /* do nothing if already set it */ if int32(*(*TJCOEF)(unsafe.Pointer(thiscoef))) >= 0 { p5 = thiscoef *(*TJCOEF)(unsafe.Pointer(p5)) = TJCOEF(int32(*(*TJCOEF)(unsafe.Pointer(p5))) + int32(p1)) } else { p6 = thiscoef *(*TJCOEF)(unsafe.Pointer(p6)) = TJCOEF(int32(*(*TJCOEF)(unsafe.Pointer(p6))) + int32(m1)) } } } } else { r-- v7 = r if v7 < 0 { break } /* reached target zero coefficient */ } k++ } if s != 0 { pos = *(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)) /* Output newly nonzero coefficient */ *(*TJCOEF)(unsafe.Pointer(block + uintptr(pos)*2)) = int16(s) /* Remember its position in case we have to suspend */ v8 = num_newnz num_newnz++ newnz_pos[v8] = pos } k++ } } if EOBRUN != 0 { /* Scan any remaining coefficient positions after the end-of-band * (the last newly nonzero coefficient, if any). Append a correction * bit to each already-nonzero coefficient. A correction bit is 1 * if the absolute value of the coefficient must be increased. */ for cond := true; cond; cond = k <= Se { thiscoef = block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)))*2 if *(*TJCOEF)(unsafe.Pointer(thiscoef)) != 0 { if bits_left < int32(1) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, int32(1)) != 0) { goto undoit } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= int32(1) if get_buffer>>bits_left&_bmask[int32(1)] != 0 { if int32(*(*TJCOEF)(unsafe.Pointer(thiscoef)))&int32(p1) == 0 { /* do nothing if already changed it */ if int32(*(*TJCOEF)(unsafe.Pointer(thiscoef))) >= 0 { p9 = thiscoef *(*TJCOEF)(unsafe.Pointer(p9)) = TJCOEF(int32(*(*TJCOEF)(unsafe.Pointer(p9))) + int32(p1)) } else { p10 = thiscoef *(*TJCOEF)(unsafe.Pointer(p10)) = TJCOEF(int32(*(*TJCOEF)(unsafe.Pointer(p10))) + int32(m1)) } } } } k++ } /* Count one block completed in EOB run */ EOBRUN-- } /* Completed MCU, so update state */ (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer = get_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left = bits_left (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved.FEOBRUN = EOBRUN /* only part of saved state we need */ } /* Account for restart interval if using restarts */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) goto undoit undoit: ; /* Re-zero any output coefficients that we made newly nonzero */ for num_newnz != 0 { num_newnz-- v11 = num_newnz *(*TJCOEF)(unsafe.Pointer(block + uintptr(newnz_pos[v11])*2)) = 0 } return int32(FALSE1) } /* * Decode one MCU's worth of Huffman-compressed coefficients, * partial blocks. */ func _decode_mcu_sub(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r1 Tboolean) { bp := tls.Alloc(48) defer tls.Free(48) var Se, bits_left, blkn, ci, coef_limit, k, look, look1, look2, nb, nb1, nb2, r, s, v10, v11, v12, v16, v17, v4, v5, v6 int32 var block TJBLOCKROW var entropy Thuff_entropy_ptr var get_buffer Tbit_buf_type var htbl, natural_order uintptr var _ /* br_state at bp+0 */ Tbitread_working_state var _ /* state at bp+20 */ Tsavable_state _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Se, bits_left, blkn, block, ci, coef_limit, entropy, get_buffer, htbl, k, look, look1, look2, natural_order, nb, nb1, nb2, r, s, v10, v11, v12, v16, v17, v4, v5, v6 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Process restart marker if needed; may have to suspend */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { if !(_process_restart1(tls, cinfo) != 0) { return int32(FALSE1) } } } /* If we've run out of data, just leave the MCU set to zeroes. * This way, we return uniform gray for the remainder of the segment. */ if !((*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Finsufficient_data != 0) { natural_order = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order Se = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se /* Load up working state */ (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fcinfo = cinfo (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer get_buffer = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer bits_left = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left *(*Tsavable_state)(unsafe.Pointer(bp + 20)) = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved /* Outer loop handles each block in the MCU */ blkn = 0 for { if !(blkn < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)) /* Decode a single block's worth of coefficients */ /* Section F.2.2.1: decode the DC coefficient difference */ htbl = *(*uintptr)(unsafe.Pointer(entropy + 100 + uintptr(blkn)*4)) if bits_left < int32(HUFF_LOOKAHEAD) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, 0) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left if bits_left < int32(HUFF_LOOKAHEAD) { nb = int32(1) goto label1 } } look = get_buffer >> (bits_left - libc.Int32FromInt32(HUFF_LOOKAHEAD)) & _bmask[int32(HUFF_LOOKAHEAD)] v4 = *(*int32)(unsafe.Pointer(htbl + 144 + uintptr(look)*4)) nb = v4 if !(v4 != 0) { goto _2 } bits_left -= nb s = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + 1168 + uintptr(look)))) goto _3 _2: ; nb = libc.Int32FromInt32(HUFF_LOOKAHEAD) + libc.Int32FromInt32(1) goto label1 label1: ; v5 = _jpeg_huff_decode(tls, bp, get_buffer, bits_left, htbl, nb) s = v5 if v5 < 0 { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left _3: ; htbl = *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(blkn)*4)) k = int32(1) coef_limit = *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) if coef_limit != 0 { /* Convert DC difference to actual value, update last_dc_val */ if s != 0 { if bits_left < s { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, s) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= s r = get_buffer >> bits_left & _bmask[s] if r <= _bmask[s-int32(1)] { v6 = r - _bmask[s] } else { v6 = r } s = v6 } ci = *(*int32)(unsafe.Pointer(cinfo + 372 + uintptr(blkn)*4)) s += *(*int32)(unsafe.Pointer(bp + 20 + 4 + uintptr(ci)*4)) *(*int32)(unsafe.Pointer(bp + 20 + 4 + uintptr(ci)*4)) = s /* Output the DC coefficient */ *(*TJCOEF)(unsafe.Pointer(block)) = int16(s) /* Section F.2.2.2: decode the AC coefficients */ /* Since zeroes are skipped, output area must be cleared beforehand */ for { if !(k < coef_limit) { break } if bits_left < int32(HUFF_LOOKAHEAD) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, 0) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left if bits_left < int32(HUFF_LOOKAHEAD) { nb1 = int32(1) goto label2 } } look1 = get_buffer >> (bits_left - libc.Int32FromInt32(HUFF_LOOKAHEAD)) & _bmask[int32(HUFF_LOOKAHEAD)] v10 = *(*int32)(unsafe.Pointer(htbl + 144 + uintptr(look1)*4)) nb1 = v10 if !(v10 != 0) { goto _8 } bits_left -= nb1 s = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + 1168 + uintptr(look1)))) goto _9 _8: ; nb1 = libc.Int32FromInt32(HUFF_LOOKAHEAD) + libc.Int32FromInt32(1) goto label2 label2: ; v11 = _jpeg_huff_decode(tls, bp, get_buffer, bits_left, htbl, nb1) s = v11 if v11 < 0 { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left _9: ; r = s >> int32(4) s &= int32(15) if s != 0 { k += r if bits_left < s { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, s) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= s r = get_buffer >> bits_left & _bmask[s] if r <= _bmask[s-int32(1)] { v12 = r - _bmask[s] } else { v12 = r } s = v12 /* Output coefficient in natural (dezigzagged) order. * Note: the extra entries in natural_order[] will save us * if k > Se, which could happen if the data is corrupted. */ *(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)))*2)) = int16(s) } else { if r != int32(15) { goto EndOfBlock } k += int32(15) } goto _7 _7: ; k++ } } else { if s != 0 { if bits_left < s { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, s) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= s } } /* Section F.2.2.2: decode the AC coefficients */ /* In this path we just discard the values */ for { if !(k <= Se) { break } if bits_left < int32(HUFF_LOOKAHEAD) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, 0) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left if bits_left < int32(HUFF_LOOKAHEAD) { nb2 = int32(1) goto label3 } } look2 = get_buffer >> (bits_left - libc.Int32FromInt32(HUFF_LOOKAHEAD)) & _bmask[int32(HUFF_LOOKAHEAD)] v16 = *(*int32)(unsafe.Pointer(htbl + 144 + uintptr(look2)*4)) nb2 = v16 if !(v16 != 0) { goto _14 } bits_left -= nb2 s = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + 1168 + uintptr(look2)))) goto _15 _14: ; nb2 = libc.Int32FromInt32(HUFF_LOOKAHEAD) + libc.Int32FromInt32(1) goto label3 label3: ; v17 = _jpeg_huff_decode(tls, bp, get_buffer, bits_left, htbl, nb2) s = v17 if v17 < 0 { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left _15: ; r = s >> int32(4) s &= int32(15) if s != 0 { k += r if bits_left < s { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, s) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= s } else { if r != int32(15) { break } k += int32(15) } goto _13 _13: ; k++ } goto EndOfBlock EndOfBlock: ; goto _1 _1: ; blkn++ } /* Completed MCU, so update state */ (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer = get_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left = bits_left (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved = *(*Tsavable_state)(unsafe.Pointer(bp + 20)) } /* Account for restart interval if using restarts */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) } /* * Decode one MCU's worth of Huffman-compressed coefficients, * full-size blocks. */ func _decode_mcu1(tls *libc.TLS, cinfo Tj_decompress_ptr, MCU_data TJBLOCKARRAY) (r1 Tboolean) { bp := tls.Alloc(48) defer tls.Free(48) var bits_left, blkn, ci, coef_limit, k, look, look1, look2, nb, nb1, nb2, r, s, v10, v11, v12, v16, v17, v4, v5, v6 int32 var block TJBLOCKROW var entropy Thuff_entropy_ptr var get_buffer Tbit_buf_type var htbl uintptr var _ /* br_state at bp+0 */ Tbitread_working_state var _ /* state at bp+20 */ Tsavable_state _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bits_left, blkn, block, ci, coef_limit, entropy, get_buffer, htbl, k, look, look1, look2, nb, nb1, nb2, r, s, v10, v11, v12, v16, v17, v4, v5, v6 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Process restart marker if needed; may have to suspend */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { if !(_process_restart1(tls, cinfo) != 0) { return int32(FALSE1) } } } /* If we've run out of data, just leave the MCU set to zeroes. * This way, we return uniform gray for the remainder of the segment. */ if !((*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Finsufficient_data != 0) { /* Load up working state */ (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fcinfo = cinfo (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer get_buffer = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer bits_left = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left *(*Tsavable_state)(unsafe.Pointer(bp + 20)) = (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved /* Outer loop handles each block in the MCU */ blkn = 0 for { if !(blkn < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)) /* Decode a single block's worth of coefficients */ /* Section F.2.2.1: decode the DC coefficient difference */ htbl = *(*uintptr)(unsafe.Pointer(entropy + 100 + uintptr(blkn)*4)) if bits_left < int32(HUFF_LOOKAHEAD) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, 0) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left if bits_left < int32(HUFF_LOOKAHEAD) { nb = int32(1) goto label1 } } look = get_buffer >> (bits_left - libc.Int32FromInt32(HUFF_LOOKAHEAD)) & _bmask[int32(HUFF_LOOKAHEAD)] v4 = *(*int32)(unsafe.Pointer(htbl + 144 + uintptr(look)*4)) nb = v4 if !(v4 != 0) { goto _2 } bits_left -= nb s = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + 1168 + uintptr(look)))) goto _3 _2: ; nb = libc.Int32FromInt32(HUFF_LOOKAHEAD) + libc.Int32FromInt32(1) goto label1 label1: ; v5 = _jpeg_huff_decode(tls, bp, get_buffer, bits_left, htbl, nb) s = v5 if v5 < 0 { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left _3: ; htbl = *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(blkn)*4)) k = int32(1) coef_limit = *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) if coef_limit != 0 { /* Convert DC difference to actual value, update last_dc_val */ if s != 0 { if bits_left < s { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, s) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= s r = get_buffer >> bits_left & _bmask[s] if r <= _bmask[s-int32(1)] { v6 = r - _bmask[s] } else { v6 = r } s = v6 } ci = *(*int32)(unsafe.Pointer(cinfo + 372 + uintptr(blkn)*4)) s += *(*int32)(unsafe.Pointer(bp + 20 + 4 + uintptr(ci)*4)) *(*int32)(unsafe.Pointer(bp + 20 + 4 + uintptr(ci)*4)) = s /* Output the DC coefficient */ *(*TJCOEF)(unsafe.Pointer(block)) = int16(s) /* Section F.2.2.2: decode the AC coefficients */ /* Since zeroes are skipped, output area must be cleared beforehand */ for { if !(k < coef_limit) { break } if bits_left < int32(HUFF_LOOKAHEAD) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, 0) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left if bits_left < int32(HUFF_LOOKAHEAD) { nb1 = int32(1) goto label2 } } look1 = get_buffer >> (bits_left - libc.Int32FromInt32(HUFF_LOOKAHEAD)) & _bmask[int32(HUFF_LOOKAHEAD)] v10 = *(*int32)(unsafe.Pointer(htbl + 144 + uintptr(look1)*4)) nb1 = v10 if !(v10 != 0) { goto _8 } bits_left -= nb1 s = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + 1168 + uintptr(look1)))) goto _9 _8: ; nb1 = libc.Int32FromInt32(HUFF_LOOKAHEAD) + libc.Int32FromInt32(1) goto label2 label2: ; v11 = _jpeg_huff_decode(tls, bp, get_buffer, bits_left, htbl, nb1) s = v11 if v11 < 0 { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left _9: ; r = s >> int32(4) s &= int32(15) if s != 0 { k += r if bits_left < s { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, s) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= s r = get_buffer >> bits_left & _bmask[s] if r <= _bmask[s-int32(1)] { v12 = r - _bmask[s] } else { v12 = r } s = v12 /* Output coefficient in natural (dezigzagged) order. * Note: the extra entries in jpeg_natural_order[] will save us * if k >= DCTSIZE2, which could happen if the data is corrupted. */ *(*TJCOEF)(unsafe.Pointer(block + uintptr(Xjpeg_natural_order[k])*2)) = int16(s) } else { if r != int32(15) { goto EndOfBlock } k += int32(15) } goto _7 _7: ; k++ } } else { if s != 0 { if bits_left < s { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, s) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= s } } /* Section F.2.2.2: decode the AC coefficients */ /* In this path we just discard the values */ for { if !(k < int32(DCTSIZE2)) { break } if bits_left < int32(HUFF_LOOKAHEAD) { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, 0) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left if bits_left < int32(HUFF_LOOKAHEAD) { nb2 = int32(1) goto label3 } } look2 = get_buffer >> (bits_left - libc.Int32FromInt32(HUFF_LOOKAHEAD)) & _bmask[int32(HUFF_LOOKAHEAD)] v16 = *(*int32)(unsafe.Pointer(htbl + 144 + uintptr(look2)*4)) nb2 = v16 if !(v16 != 0) { goto _14 } bits_left -= nb2 s = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + 1168 + uintptr(look2)))) goto _15 _14: ; nb2 = libc.Int32FromInt32(HUFF_LOOKAHEAD) + libc.Int32FromInt32(1) goto label3 label3: ; v17 = _jpeg_huff_decode(tls, bp, get_buffer, bits_left, htbl, nb2) s = v17 if v17 < 0 { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left _15: ; r = s >> int32(4) s &= int32(15) if s != 0 { k += r if bits_left < s { if !(_jpeg_fill_bit_buffer(tls, bp, get_buffer, bits_left, s) != 0) { return int32(FALSE1) } get_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fget_buffer bits_left = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbits_left } bits_left -= s } else { if r != int32(15) { break } k += int32(15) } goto _13 _13: ; k++ } goto EndOfBlock EndOfBlock: ; goto _1 _1: ; blkn++ } /* Completed MCU, so update state */ (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fnext_input_byte = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fnext_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fbytes_in_buffer = (*(*Tbitread_working_state)(unsafe.Pointer(bp))).Fbytes_in_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer = get_buffer (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left = bits_left (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved = *(*Tsavable_state)(unsafe.Pointer(bp + 20)) } /* Account for restart interval if using restarts */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) } /* * Initialize for a Huffman-compressed scan. */ func _start_pass_huff_decoder(tls *libc.TLS, cinfo Tj_decompress_ptr) { var blkn, ci, cindex, coefi, expected, i, tbl, v6 int32 var coef_bit_ptr, compptr, v10 uintptr var entropy Thuff_entropy_ptr _, _, _, _, _, _, _, _, _, _, _, _ = blkn, ci, cindex, coef_bit_ptr, coefi, compptr, entropy, expected, i, tbl, v10, v6 entropy = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0) { goto _1 } /* Validate progressive scan parameters */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe != 0 { goto bad } } else { /* need not check Ss/Se < 0 since they came from unsigned bytes */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe > (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se { goto bad } /* AC scans may have only one component */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan != int32(1) { goto bad } } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh != 0 { /* Successive approximation refinement scan: must have Al = Ah-1. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh-int32(1) != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl { goto bad } } if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl > int32(13)) { goto _3 } /* need not check for < 0 */ /* Arguably the maximum Al value should be less than 13 for 8-bit * precision, but the spec doesn't say so, and we try to be liberal * about what we accept. Note: large Al values could result in * out-of-range DC coefficients during early scans, leading to bizarre * displays due to overflows in the IDCT math. But we won't crash. */ goto bad bad: ; (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PROGRESSION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 2*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 3*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) _3: ; /* Update progression status, and verify that scan order is legal. * Note that inter-scan inconsistencies are treated as warnings * not fatal errors ... not clear if this is right way to behave. */ ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } cindex = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)))).Fcomponent_index coef_bit_ptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef_bits + uintptr(cindex)*256 if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs != 0 && *(*int32)(unsafe.Pointer(coef_bit_ptr)) < 0 { /* AC without prior DC scan */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_BOGUS_PROGRESSION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = cindex *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = 0 (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) } coefi = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs for { if !(coefi <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe) { break } if *(*int32)(unsafe.Pointer(coef_bit_ptr + uintptr(coefi)*4)) < 0 { v6 = 0 } else { v6 = *(*int32)(unsafe.Pointer(coef_bit_ptr + uintptr(coefi)*4)) } expected = v6 if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh != expected { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_BOGUS_PROGRESSION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = cindex *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = coefi (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) } *(*int32)(unsafe.Pointer(coef_bit_ptr + uintptr(coefi)*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl goto _5 _5: ; coefi++ } goto _4 _4: ; ci++ } /* Select MCU decoding routine */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu_DC_first1) } else { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu_AC_first1) } } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu_DC_refine1) } else { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu_AC_refine1) } } ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) /* Make sure requested tables are present, and compute derived tables. * We may build same derived table more than once, but it's not expensive. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { /* DC refinement needs no table */ tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no _jpeg_make_d_derived_tbl(tls, cinfo, int32(TRUE1), tbl, entropy+48+uintptr(tbl)*4) } } else { tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no _jpeg_make_d_derived_tbl(tls, cinfo, int32(FALSE1), tbl, entropy+48+uintptr(tbl)*4) /* remember the single active table */ (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fac_derived_tbl = *(*uintptr)(unsafe.Pointer(entropy + 48 + uintptr(tbl)*4)) } /* Initialize DC predictions to 0 */ *(*int32)(unsafe.Pointer(entropy + 20 + 4 + uintptr(ci)*4)) = 0 goto _7 _7: ; ci++ } /* Initialize private state variables */ (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fsaved.FEOBRUN = uint32(0) goto _2 _1: ; /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG. * This ought to be an error condition, but we make it a warning because * there are some baseline files out there with all zeroes in these bytes. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs != 0 || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh != 0 || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl != 0 || ((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fis_baseline != 0 || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe < int32(DCTSIZE2)) && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_NOT_SEQUENTIAL) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) } /* Select MCU decoding routine */ /* We retain the hard-coded case for full-size blocks. * This is not necessary, but it appears that this version is slightly * more performant in the given implementation. * With an improved implementation we would prefer a single optimized * function. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se != libc.Int32FromInt32(DCTSIZE2)-libc.Int32FromInt32(1) { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu_sub) } else { (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fdecode_mcu = __ccgo_fp(_decode_mcu1) } ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) /* Compute derived values for Huffman tables */ /* We may do this more than once for a table, but it's not expensive */ tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no _jpeg_make_d_derived_tbl(tls, cinfo, int32(TRUE1), tbl, entropy+68+uintptr(tbl)*4) if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se != 0 { /* AC needs no table when not present */ tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no _jpeg_make_d_derived_tbl(tls, cinfo, int32(FALSE1), tbl, entropy+84+uintptr(tbl)*4) } /* Initialize DC predictions to 0 */ *(*int32)(unsafe.Pointer(entropy + 20 + 4 + uintptr(ci)*4)) = 0 goto _8 _8: ; ci++ } /* Precalculate decoding info for each block in an MCU of this scan */ blkn = 0 for { if !(blkn < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } ci = *(*int32)(unsafe.Pointer(cinfo + 372 + uintptr(blkn)*4)) compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) /* Precalculate which table to use for each block */ *(*uintptr)(unsafe.Pointer(entropy + 100 + uintptr(blkn)*4)) = *(*uintptr)(unsafe.Pointer(entropy + 68 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no)*4)) if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se != 0 { v10 = *(*uintptr)(unsafe.Pointer(entropy + 84 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no)*4)) } else { v10 = libc.UintptrFromInt32(0) } *(*uintptr)(unsafe.Pointer(entropy + 140 + uintptr(blkn)*4)) = v10 /* Decide whether we really care about the coefficient values */ if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0 { ci = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size i = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se { case libc.Int32FromInt32(1)*libc.Int32FromInt32(1) - libc.Int32FromInt32(1): *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) = int32(1) case libc.Int32FromInt32(2)*libc.Int32FromInt32(2) - libc.Int32FromInt32(1): if ci <= 0 || ci > int32(2) { ci = int32(2) } if i <= 0 || i > int32(2) { i = int32(2) } *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) = int32(1) + *(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_jpeg_zigzag_order2)) + uintptr(ci-int32(1))*8 + uintptr(i-int32(1))*4)) case libc.Int32FromInt32(3)*libc.Int32FromInt32(3) - libc.Int32FromInt32(1): if ci <= 0 || ci > int32(3) { ci = int32(3) } if i <= 0 || i > int32(3) { i = int32(3) } *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) = int32(1) + *(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_jpeg_zigzag_order3)) + uintptr(ci-int32(1))*12 + uintptr(i-int32(1))*4)) case libc.Int32FromInt32(4)*libc.Int32FromInt32(4) - libc.Int32FromInt32(1): if ci <= 0 || ci > int32(4) { ci = int32(4) } if i <= 0 || i > int32(4) { i = int32(4) } *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) = int32(1) + *(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_jpeg_zigzag_order4)) + uintptr(ci-int32(1))*16 + uintptr(i-int32(1))*4)) case libc.Int32FromInt32(5)*libc.Int32FromInt32(5) - libc.Int32FromInt32(1): if ci <= 0 || ci > int32(5) { ci = int32(5) } if i <= 0 || i > int32(5) { i = int32(5) } *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) = int32(1) + *(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_jpeg_zigzag_order5)) + uintptr(ci-int32(1))*20 + uintptr(i-int32(1))*4)) case libc.Int32FromInt32(6)*libc.Int32FromInt32(6) - libc.Int32FromInt32(1): if ci <= 0 || ci > int32(6) { ci = int32(6) } if i <= 0 || i > int32(6) { i = int32(6) } *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) = int32(1) + *(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_jpeg_zigzag_order6)) + uintptr(ci-int32(1))*24 + uintptr(i-int32(1))*4)) case libc.Int32FromInt32(7)*libc.Int32FromInt32(7) - libc.Int32FromInt32(1): if ci <= 0 || ci > int32(7) { ci = int32(7) } if i <= 0 || i > int32(7) { i = int32(7) } *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) = int32(1) + *(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_jpeg_zigzag_order7)) + uintptr(ci-int32(1))*28 + uintptr(i-int32(1))*4)) default: if ci <= 0 || ci > int32(8) { ci = int32(8) } if i <= 0 || i > int32(8) { i = int32(8) } *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) = int32(1) + *(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_jpeg_zigzag_order)) + uintptr(ci-int32(1))*32 + uintptr(i-int32(1))*4)) } } else { *(*int32)(unsafe.Pointer(entropy + 180 + uintptr(blkn)*4)) = 0 } goto _9 _9: ; blkn++ } _2: ; /* Initialize bitread state variables */ (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fbits_left = 0 (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fbitstate.Fget_buffer = 0 /* unnecessary, but keeps Purify quiet */ (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Finsufficient_data = int32(FALSE1) /* Initialize restart counter */ (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval } /* * Module initialization routine for Huffman entropy decoding. */ func Xjinit_huff_decoder(tls *libc.TLS, cinfo Tj_decompress_ptr) { var ci, i int32 var coef_bit_ptr, v3, v6 uintptr var entropy Thuff_entropy_ptr _, _, _, _, _, _ = ci, coef_bit_ptr, entropy, i, v3, v6 entropy = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(220)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy = entropy (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_huff_decoder) (*Thuff_entropy_decoder)(unsafe.Pointer(entropy)).Fpub.Ffinish_pass = __ccgo_fp(_finish_pass_huff) if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef_bits = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components*int32(DCTSIZE2))*libc.Uint32FromInt64(4)) coef_bit_ptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef_bits ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } i = 0 for { if !(i < int32(DCTSIZE2)) { break } v3 = coef_bit_ptr coef_bit_ptr += 4 *(*int32)(unsafe.Pointer(v3)) = -int32(1) goto _2 _2: ; i++ } goto _1 _1: ; ci++ } /* Mark derived tables unallocated */ i = 0 for { if !(i < int32(NUM_HUFF_TBLS)) { break } *(*uintptr)(unsafe.Pointer(entropy + 48 + uintptr(i)*4)) = libc.UintptrFromInt32(0) goto _4 _4: ; i++ } } else { /* Mark derived tables unallocated */ i = 0 for { if !(i < int32(NUM_HUFF_TBLS)) { break } v6 = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(entropy + 84 + uintptr(i)*4)) = v6 *(*uintptr)(unsafe.Pointer(entropy + 68 + uintptr(i)*4)) = v6 goto _5 _5: ; i++ } } } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Private state */ type Tmy_input_controller = struct { Fpub Tjpeg_input_controller Finheaders int32 } type Tmy_inputctl_ptr = uintptr /* * Routines to calculate various quantities related to the size of the image. */ /* * Compute output image dimensions and related values. * NOTE: this is exported for possible use by application. * Hence it mustn't do anything that can't be done twice. */ func Xjpeg_core_output_dimensions(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Do computations that are needed before master selection phase. * This function is used for transcoding and full decompression. */ var ci int32 var compptr uintptr _, _ = ci, compptr /* Compute actual output image dimensions and DCT scaling choices. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom { /* Provide 1/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(1) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(2) { /* Provide 2/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(2), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(2), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(2) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(2) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(3) { /* Provide 3/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(3), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(3), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(3) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(3) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(4) { /* Provide 4/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(4), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(4), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(4) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(4) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(5) { /* Provide 5/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(5), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(5), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(5) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(5) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(6) { /* Provide 6/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(6), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(6), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(6) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(6) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(7) { /* Provide 7/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(7), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(7), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(7) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(7) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(8) { /* Provide 8/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(8), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(8), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(8) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(8) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(9) { /* Provide 9/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(9), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(9), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(9) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(9) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(10) { /* Provide 10/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(10), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(10), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(10) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(10) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(11) { /* Provide 11/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(11), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(11), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(11) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(11) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(12) { /* Provide 12/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(12), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(12), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(12) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(12) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(13) { /* Provide 13/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(13), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(13), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(13) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(13) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(14) { /* Provide 14/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(14), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(14), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(14) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(14) } else { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_num*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size) <= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fscale_denom*uint32(15) { /* Provide 15/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(15), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(15), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(15) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(15) } else { /* Provide 16/block_size scaling */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*int32(16), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*int32(16), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = int32(16) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = int32(16) } } } } } } } } } } } } } } } /* Recompute dimensions of components */ ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size goto _1 _1: ; ci++ compptr += 88 } } func _initial_setup1(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Called once, when first SOS marker is reached */ var ci, v2, v3 int32 var compptr uintptr _, _, _, _ = ci, compptr, v2, v3 /* Make sure image isn't bigger than I can handle */ if libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height) > libc.Int32FromInt32(65500) || libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width) > libc.Int32FromInt32(65500) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_IMAGE_TOO_BIG) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint32(libc.Uint32FromInt32(65500)) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Only 8 to 12 bits data precision are supported for DCT based JPEG */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdata_precision < int32(8) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdata_precision > int32(12) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PRECISION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdata_precision (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Check that number of components won't exceed internal array sizes */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components > int32(MAX_COMPONENTS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_COMPONENT_COUNT) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = int32(MAX_COMPONENTS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Compute maximum sampling factors; check factor validity */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor = int32(1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor = int32(1) ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor <= 0 || (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor > int32(MAX_SAMP_FACTOR) || (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor <= 0 || (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor > int32(MAX_SAMP_FACTOR) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_SAMPLING) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor > (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor { v2 = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor } else { v2 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor = v2 if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor > (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor { v3 = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor } else { v3 = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor = v3 goto _1 _1: ; ci++ compptr += 88 } /* Derive block_size, natural_order, and lim_Se */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fis_baseline != 0 || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan != 0 { /* no pseudo SOS marker */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(DCTSIZE) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) } else { switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe { case libc.Int32FromInt32(1)*libc.Int32FromInt32(1) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) /* not needed */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe case libc.Int32FromInt32(2)*libc.Int32FromInt32(2) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(2) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order2)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe case libc.Int32FromInt32(3)*libc.Int32FromInt32(3) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(3) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order3)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe case libc.Int32FromInt32(4)*libc.Int32FromInt32(4) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(4) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order4)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe case libc.Int32FromInt32(5)*libc.Int32FromInt32(5) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(5) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order5)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe case libc.Int32FromInt32(6)*libc.Int32FromInt32(6) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(6) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order6)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe case libc.Int32FromInt32(7)*libc.Int32FromInt32(7) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(7) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order7)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe case libc.Int32FromInt32(8)*libc.Int32FromInt32(8) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(8) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) case libc.Int32FromInt32(9)*libc.Int32FromInt32(9) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(9) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) case libc.Int32FromInt32(10)*libc.Int32FromInt32(10) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(10) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) case libc.Int32FromInt32(11)*libc.Int32FromInt32(11) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(11) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) case libc.Int32FromInt32(12)*libc.Int32FromInt32(12) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(12) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) case libc.Int32FromInt32(13)*libc.Int32FromInt32(13) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(13) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) case libc.Int32FromInt32(14)*libc.Int32FromInt32(14) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(14) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) case libc.Int32FromInt32(15)*libc.Int32FromInt32(15) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(15) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) case libc.Int32FromInt32(16)*libc.Int32FromInt32(16) - libc.Int32FromInt32(1): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size = int32(16) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnatural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Flim_Se = libc.Int32FromInt32(DCTSIZE2) - libc.Int32FromInt32(1) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_PROGRESSION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 2*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 3*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* We initialize DCT_scaled_size and min_DCT_scaled_size to block_size. * In the full decompressor, * this will be overridden by jpeg_calc_output_dimensions in jdmaster.c; * but in the transcoder, * jpeg_calc_output_dimensions is not used, so we must do it here. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size /* Compute dimensions of components */ ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size /* Size in DCT blocks */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor, (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor*(*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor, (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor*(*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) /* downsampled_width and downsampled_height will also be overridden by * jdmaster.c if we are doing full decompression. The transcoder library * doesn't use these values, but the calling application might. */ /* Size in samples */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdownsampled_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor, (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor)) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdownsampled_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor, (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor)) /* Mark component needed, until color conversion says otherwise */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed = int32(TRUE1) /* Mark no quantization table yet saved for component */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_table = libc.UintptrFromInt32(0) goto _4 _4: ; ci++ compptr += 88 } /* Compute number of fully interleaved MCU rows. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor*(*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) /* Decide whether file contains multiple scans */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { (*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fhas_multiple_scans = int32(TRUE1) } else { (*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fhas_multiple_scans = int32(FALSE1) } } func _per_scan_setup1(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Do computations that are needed before processing a JPEG scan */ /* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */ var ci, mcublks, tmp, v2, v3 int32 var compptr, v4 uintptr _, _, _, _, _, _, _ = ci, compptr, mcublks, tmp, v2, v3, v4 if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan == int32(1) { /* Noninterleaved (single-component) scan */ compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344)) /* Overall image size in MCUs */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FMCUs_per_row = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FMCU_rows_in_scan = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks /* For noninterleaved scan, always one block per MCU */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_blocks = int32(1) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_sample_width = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_col_width = int32(1) /* For noninterleaved scans, it is convenient to define last_row_height * as the number of block rows present in the last iMCU row. */ tmp = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks % libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor)) if tmp == 0 { tmp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_row_height = tmp /* Prepare array describing MCU composition */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU = int32(1) *(*int32)(unsafe.Pointer(cinfo + 372)) = 0 } else { /* Interleaved (multi-component) scan */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan <= 0 || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan > int32(MAX_COMPS_IN_SCAN) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_COMPONENT_COUNT) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = int32(MAX_COMPS_IN_SCAN) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Overall image size in MCUs */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FMCUs_per_row = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor*(*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FMCU_rows_in_scan = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU = 0 ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) /* Sampling factors give # of blocks of component in each MCU */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_blocks = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_sample_width = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size /* Figure number of non-dummy blocks in last MCU column & row */ tmp = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks % libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width)) if tmp == 0 { tmp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_width } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_col_width = tmp tmp = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks % libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height)) if tmp == 0 { tmp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_height } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Flast_row_height = tmp /* Prepare array describing MCU composition */ mcublks = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FMCU_blocks if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU+mcublks > int32(D_MAX_BLOCKS_IN_MCU) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_MCU_SIZE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } for { v2 = mcublks mcublks-- if !(v2 > 0) { break } v4 = cinfo + 368 v3 = *(*int32)(unsafe.Pointer(v4)) *(*int32)(unsafe.Pointer(v4))++ *(*int32)(unsafe.Pointer(cinfo + 372 + uintptr(v3)*4)) = ci } goto _1 _1: ; ci++ } } } /* * Save away a copy of the Q-table referenced by each component present * in the current scan, unless already saved during a prior scan. * * In a multiple-scan JPEG file, the encoder could assign different components * the same Q-table slot number, but change table definitions between scans * so that each component uses a different Q-table. (The IJG encoder is not * currently capable of doing this, but other encoders might.) Since we want * to be able to dequantize all the components at the end of the file, this * means that we have to save away the table actually used for each component. * We do this by copying the table at the start of the first scan containing * the component. * The JPEG spec prohibits the encoder from changing the contents of a Q-table * slot between scans of a component using that slot. If the encoder does so * anyway, this decoder will simply use the Q-table values that were current * at the start of the first scan for the component. * * The decompressor output side looks only at the saved quant tables, * not at the current Q-table slots. */ func _latch_quant_tables(tls *libc.TLS, cinfo Tj_decompress_ptr) { var ci, qtblno int32 var compptr, qtbl uintptr _, _, _, _ = ci, compptr, qtbl, qtblno ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) /* No work if we already saved Q-table for this component */ if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_table != libc.UintptrFromInt32(0) { goto _1 } /* Make sure specified quantization table is present */ qtblno = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no if qtblno < 0 || qtblno >= int32(NUM_QUANT_TBLS) || *(*uintptr)(unsafe.Pointer(cinfo + 164 + uintptr(qtblno)*4)) == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_QUANT_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = qtblno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* OK, save away the quantization table */ qtbl = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(132)) libc.Xmemcpy(tls, qtbl, *(*uintptr)(unsafe.Pointer(cinfo + 164 + uintptr(qtblno)*4)), libc.Uint32FromInt64(132)) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_table = qtbl goto _1 _1: ; ci++ } } /* * Initialize the input modules to read a scan of compressed data. * The first call to this is done by jdmaster.c after initializing * the entire decompressor (during jpeg_start_decompress). * Subsequent calls come from consume_markers, below. */ func _start_input_pass1(tls *libc.TLS, cinfo Tj_decompress_ptr) { _per_scan_setup1(tls, cinfo) _latch_quant_tables(tls, cinfo) (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_decoder)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Fstart_pass})))(tls, cinfo) (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_d_coef_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fstart_input_pass})))(tls, cinfo) (*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fconsume_input = (*Tjpeg_d_coef_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fconsume_data } /* * Finish up after inputting a compressed-data scan. * This is called by the coefficient controller after it's read all * the expected data of the scan. */ func _finish_input_pass(tls *libc.TLS, cinfo Tj_decompress_ptr) { (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_entropy_decoder)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fentropy)).Ffinish_pass})))(tls, cinfo) (*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fconsume_input = __ccgo_fp(_consume_markers) } /* * Read JPEG markers before, between, or after compressed-data scans. * Change state as necessary when a new scan is reached. * Return value is JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. * * The consume_input method pointer points either here or to the * coefficient controller's consume_data routine, depending on whether * we are reading a compressed data segment or inter-segment markers. * * Note: This function should NOT return a pseudo SOS marker (with zero * component number) to the caller. A pseudo marker received by * read_markers is processed and then skipped for other markers. */ func _consume_markers(tls *libc.TLS, cinfo Tj_decompress_ptr) (r int32) { var inputctl Tmy_inputctl_ptr var val int32 _, _ = inputctl, val inputctl = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl if (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Feoi_reached != 0 { /* After hitting EOI, read no further */ return int32(JPEG_REACHED_EOI) } for { /* Loop to pass pseudo SOS marker */ val = (*(*func(*libc.TLS, Tj_decompress_ptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fread_markers})))(tls, cinfo) switch val { case int32(JPEG_REACHED_SOS): /* Found SOS */ if (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Finheaders != 0 { /* 1st SOS */ if (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Finheaders == int32(1) { _initial_setup1(tls, cinfo) } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan == 0 { /* pseudo SOS marker */ (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Finheaders = int32(2) break } (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Finheaders = 0 /* Note: start_input_pass must be called by jdmaster.c * before any more input can be consumed. jdapimin.c is * responsible for enforcing this sequencing. */ } else { /* 2nd or later SOS marker */ if !((*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Fhas_multiple_scans != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_EOI_EXPECTED) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Oops, I wasn't expecting this! */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan == 0 { /* unexpected pseudo SOS marker */ break } _start_input_pass1(tls, cinfo) } return val case int32(JPEG_REACHED_EOI): /* Found EOI */ (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Feoi_reached = int32(TRUE1) if (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Finheaders != 0 { /* Tables-only datastream, apparently */ if (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fsaw_SOF != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_SOF_NO_SOS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } else { /* Prevent infinite loop in coef ctlr's decompress_data routine * if user set output_scan_number larger than number of scans. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scan_number > (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_scan_number = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number } } return val case JPEG_SUSPENDED: return val default: return val } goto _1 _1: } return r } /* * Reset state to begin a fresh datastream. */ func _reset_input_controller(tls *libc.TLS, cinfo Tj_decompress_ptr) { var inputctl Tmy_inputctl_ptr _ = inputctl inputctl = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Fconsume_input = __ccgo_fp(_consume_markers) (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Fhas_multiple_scans = int32(FALSE1) /* "unknown" would be better */ (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Feoi_reached = int32(FALSE1) (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Finheaders = int32(1) /* Reset other modules */ (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Freset_error_mgr})))(tls, cinfo) (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Freset_marker_reader})))(tls, cinfo) /* Reset progression state -- would be cleaner if entropy decoder did this */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef_bits = libc.UintptrFromInt32(0) } /* * Initialize the input controller module. * This is called only once, when the decompression object is created. */ func Xjinit_input_controller(tls *libc.TLS, cinfo Tj_decompress_ptr) { var inputctl Tmy_inputctl_ptr _ = inputctl /* Create subobject in permanent pool */ inputctl = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, libc.Uint32FromInt64(28)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl = inputctl /* Initialize method pointers */ (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Fconsume_input = __ccgo_fp(_consume_markers) (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Freset_input_controller = __ccgo_fp(_reset_input_controller) (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Fstart_input_pass = __ccgo_fp(_start_input_pass1) (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Ffinish_input_pass = __ccgo_fp(_finish_input_pass) /* Initialize state: can't use reset_input_controller since we don't * want to try to reset other modules yet. */ (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Fhas_multiple_scans = int32(FALSE1) /* "unknown" would be better */ (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Fpub.Feoi_reached = int32(FALSE1) (*Tmy_input_controller)(unsafe.Pointer(inputctl)).Finheaders = int32(1) } const CTX_POSTPONED_ROW = 2 const CTX_PREPARE_FOR_IMCU = 0 const CTX_PROCESS_IMCU = 1 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* * In the current system design, the main buffer need never be a full-image * buffer; any full-height buffers will be found inside the coefficient or * postprocessing controllers. Nonetheless, the main controller is not * trivial. Its responsibility is to provide context rows for upsampling/ * rescaling, and doing this in an efficient fashion is a bit tricky. * * Postprocessor input data is counted in "row groups". A row group is * defined to be (v_samp_factor * DCT_v_scaled_size / min_DCT_v_scaled_size) * sample rows of each component. (We require DCT_scaled_size values to be * chosen such that these numbers are integers. In practice DCT_scaled_size * values will likely be powers of two, so we actually have the stronger * condition that DCT_scaled_size / min_DCT_scaled_size is an integer.) * Upsampling will typically produce max_v_samp_factor pixel rows from each * row group (times any additional scale factor that the upsampler is * applying). * * The coefficient controller will deliver data to us one iMCU row at a time; * each iMCU row contains v_samp_factor * DCT_v_scaled_size sample rows, or * exactly min_DCT_v_scaled_size row groups. (This amount of data corresponds * to one row of MCUs when the image is fully interleaved.) Note that the * number of sample rows varies across components, but the number of row * groups does not. Some garbage sample rows may be included in the last iMCU * row at the bottom of the image. * * Depending on the vertical scaling algorithm used, the upsampler may need * access to the sample row(s) above and below its current input row group. * The upsampler is required to set need_context_rows TRUE at global selection * time if so. When need_context_rows is FALSE, this controller can simply * obtain one iMCU row at a time from the coefficient controller and dole it * out as row groups to the postprocessor. * * When need_context_rows is TRUE, this controller guarantees that the buffer * passed to postprocessing contains at least one row group's worth of samples * above and below the row group(s) being processed. Note that the context * rows "above" the first passed row group appear at negative row offsets in * the passed buffer. At the top and bottom of the image, the required * context rows are manufactured by duplicating the first or last real sample * row; this avoids having special cases in the upsampling inner loops. * * The amount of context is fixed at one row group just because that's a * convenient number for this controller to work with. The existing * upsamplers really only need one sample row of context. An upsampler * supporting arbitrary output rescaling might wish for more than one row * group of context when shrinking the image; tough, we don't handle that. * (This is justified by the assumption that downsizing will be handled mostly * by adjusting the DCT_scaled_size values, so that the actual scale factor at * the upsample step needn't be much less than one.) * * To provide the desired context, we have to retain the last two row groups * of one iMCU row while reading in the next iMCU row. (The last row group * can't be processed until we have another row group for its below-context, * and so we have to save the next-to-last group too for its above-context.) * We could do this most simply by copying data around in our buffer, but * that'd be very slow. We can avoid copying any data by creating a rather * strange pointer structure. Here's how it works. We allocate a workspace * consisting of M+2 row groups (where M = min_DCT_v_scaled_size is the number * of row groups per iMCU row). We create two sets of redundant pointers to * the workspace. Labeling the physical row groups 0 to M+1, the synthesized * pointer lists look like this: * M+1 M-1 * master pointer --> 0 master pointer --> 0 * 1 1 * ... ... * M-3 M-3 * M-2 M * M-1 M+1 * M M-2 * M+1 M-1 * 0 0 * We read alternate iMCU rows using each master pointer; thus the last two * row groups of the previous iMCU row remain un-overwritten in the workspace. * The pointer lists are set up so that the required context rows appear to * be adjacent to the proper places when we pass the pointer lists to the * upsampler. * * The above pictures describe the normal state of the pointer lists. * At top and bottom of the image, we diddle the pointer lists to duplicate * the first or last sample row as necessary (this is cheaper than copying * sample rows around). * * This scheme breaks down if M < 2, ie, min_DCT_v_scaled_size is 1. In that * situation each iMCU row provides only one row group so the buffering logic * must be different (eg, we must read two iMCU rows before we can emit the * first row group). For now, we simply do not support providing context * rows when min_DCT_v_scaled_size is 1. That combination seems unlikely to * be worth providing --- if someone wants a 1/8th-size preview, they probably * want it quick and dirty, so a context-free upsampler is sufficient. */ /* Private buffer controller object */ type Tmy_main_controller1 = struct { Fpub Tjpeg_d_main_controller Fbuffer [10]TJSAMPARRAY Frowgroup_ctr TJDIMENSION Frowgroups_avail TJDIMENSION Fbuffer_full Tboolean Fxbuffer [2]TJSAMPIMAGE Fwhichptr int32 Fcontext_state int32 FiMCU_row_ctr TJDIMENSION } func _alloc_funny_pointers(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Allocate space for the funny pointer lists. * This is done only once, not once per pass. */ var M, ci, rgroup int32 var compptr uintptr var mainp Tmy_main_ptr var xbuf TJSAMPARRAY _, _, _, _, _, _ = M, ci, compptr, mainp, rgroup, xbuf mainp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmain1 M = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size /* Get top-level space for component array pointers. * We alloc both arrays with one call to save a few cycles. */ *(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components*int32(2))*libc.Uint32FromInt64(4)) *(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60 + 1*4)) = *(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60)) + uintptr((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components)*4 ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { goto _1 } /* skip uninteresting component */ rgroup = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size / (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size /* height of a row group of component */ /* Get space for pointer lists --- M+4 row groups in each list. * We alloc both pointer lists with one call to save a few cycles. */ xbuf = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(int32(2)*(rgroup*(M+int32(4))))*libc.Uint32FromInt64(4)) xbuf += uintptr(rgroup) * 4 /* want one row group at negative offsets */ *(*TJSAMPARRAY)(unsafe.Pointer(*(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60)) + uintptr(ci)*4)) = xbuf xbuf += uintptr(rgroup*(M+int32(4))) * 4 *(*TJSAMPARRAY)(unsafe.Pointer(*(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60 + 1*4)) + uintptr(ci)*4)) = xbuf goto _1 _1: ; ci++ compptr += 88 } } func _make_funny_pointers(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Create the funny pointer lists discussed in the comments above. * The actual workspace is already allocated (in mainp->buffer), * and the space for the pointer lists is allocated too. * This routine just fills in the curiously ordered lists. * This will be repeated at the beginning of each pass. */ var M, ci, i, rgroup int32 var buf, xbuf0, xbuf1 TJSAMPARRAY var compptr uintptr var mainp Tmy_main_ptr var v3 TJSAMPROW _, _, _, _, _, _, _, _, _, _ = M, buf, ci, compptr, i, mainp, rgroup, xbuf0, xbuf1, v3 mainp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmain1 M = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { goto _1 } /* skip uninteresting component */ rgroup = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size / (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size /* height of a row group of component */ xbuf0 = *(*TJSAMPARRAY)(unsafe.Pointer(*(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60)) + uintptr(ci)*4)) xbuf1 = *(*TJSAMPARRAY)(unsafe.Pointer(*(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60 + 1*4)) + uintptr(ci)*4)) /* First copy the workspace pointers as-is */ buf = *(*TJSAMPARRAY)(unsafe.Pointer(mainp + 8 + uintptr(ci)*4)) i = 0 for { if !(i < rgroup*(M+int32(2))) { break } v3 = *(*TJSAMPROW)(unsafe.Pointer(buf + uintptr(i)*4)) *(*TJSAMPROW)(unsafe.Pointer(xbuf1 + uintptr(i)*4)) = v3 *(*TJSAMPROW)(unsafe.Pointer(xbuf0 + uintptr(i)*4)) = v3 goto _2 _2: ; i++ } /* In the second list, put the last four row groups in swapped order */ i = 0 for { if !(i < rgroup*int32(2)) { break } *(*TJSAMPROW)(unsafe.Pointer(xbuf1 + uintptr(rgroup*(M-int32(2))+i)*4)) = *(*TJSAMPROW)(unsafe.Pointer(buf + uintptr(rgroup*M+i)*4)) *(*TJSAMPROW)(unsafe.Pointer(xbuf1 + uintptr(rgroup*M+i)*4)) = *(*TJSAMPROW)(unsafe.Pointer(buf + uintptr(rgroup*(M-int32(2))+i)*4)) goto _4 _4: ; i++ } /* The wraparound pointers at top and bottom will be filled later * (see set_wraparound_pointers, below). Initially we want the "above" * pointers to duplicate the first actual data line. This only needs * to happen in xbuffer[0]. */ i = 0 for { if !(i < rgroup) { break } *(*TJSAMPROW)(unsafe.Pointer(xbuf0 + uintptr(i-rgroup)*4)) = *(*TJSAMPROW)(unsafe.Pointer(xbuf0)) goto _5 _5: ; i++ } goto _1 _1: ; ci++ compptr += 88 } } func _set_wraparound_pointers(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Set up the "wraparound" pointers at top and bottom of the pointer lists. * This changes the pointer list state from top-of-image to the normal state. */ var M, ci, i, rgroup int32 var compptr uintptr var mainp Tmy_main_ptr var xbuf0, xbuf1 TJSAMPARRAY _, _, _, _, _, _, _, _ = M, ci, compptr, i, mainp, rgroup, xbuf0, xbuf1 mainp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmain1 M = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { goto _1 } /* skip uninteresting component */ rgroup = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size / (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size /* height of a row group of component */ xbuf0 = *(*TJSAMPARRAY)(unsafe.Pointer(*(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60)) + uintptr(ci)*4)) xbuf1 = *(*TJSAMPARRAY)(unsafe.Pointer(*(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60 + 1*4)) + uintptr(ci)*4)) i = 0 for { if !(i < rgroup) { break } *(*TJSAMPROW)(unsafe.Pointer(xbuf0 + uintptr(i-rgroup)*4)) = *(*TJSAMPROW)(unsafe.Pointer(xbuf0 + uintptr(rgroup*(M+int32(1))+i)*4)) *(*TJSAMPROW)(unsafe.Pointer(xbuf1 + uintptr(i-rgroup)*4)) = *(*TJSAMPROW)(unsafe.Pointer(xbuf1 + uintptr(rgroup*(M+int32(1))+i)*4)) *(*TJSAMPROW)(unsafe.Pointer(xbuf0 + uintptr(rgroup*(M+int32(2))+i)*4)) = *(*TJSAMPROW)(unsafe.Pointer(xbuf0 + uintptr(i)*4)) *(*TJSAMPROW)(unsafe.Pointer(xbuf1 + uintptr(rgroup*(M+int32(2))+i)*4)) = *(*TJSAMPROW)(unsafe.Pointer(xbuf1 + uintptr(i)*4)) goto _2 _2: ; i++ } goto _1 _1: ; ci++ compptr += 88 } } func _set_bottom_pointers(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Change the pointer lists to duplicate the last sample row at the bottom * of the image. whichptr indicates which xbuffer holds the final iMCU row. * Also sets rowgroups_avail to indicate number of nondummy row groups in row. */ var ci, i, iMCUheight, rgroup, rows_left int32 var compptr uintptr var mainp Tmy_main_ptr var xbuf TJSAMPARRAY _, _, _, _, _, _, _, _ = ci, compptr, i, iMCUheight, mainp, rgroup, rows_left, xbuf mainp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmain1 ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { goto _1 } /* skip uninteresting component */ /* Count sample rows in one iMCU row and in one row group */ iMCUheight = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size rgroup = iMCUheight / (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size /* Count nondummy sample rows remaining for this component */ rows_left = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdownsampled_height % libc.Uint32FromInt32(iMCUheight)) if rows_left == 0 { rows_left = iMCUheight } /* Count nondummy row groups. Should get same answer for each component, * so we need only do it once. */ if ci == 0 { (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail = libc.Uint32FromInt32((rows_left-libc.Int32FromInt32(1))/rgroup + libc.Int32FromInt32(1)) } /* Duplicate the last real sample row rgroup*2 times; this pads out the * last partial rowgroup and ensures at least one full rowgroup of context. */ xbuf = *(*TJSAMPARRAY)(unsafe.Pointer(*(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60 + uintptr((*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fwhichptr)*4)) + uintptr(ci)*4)) i = 0 for { if !(i < rgroup*int32(2)) { break } *(*TJSAMPROW)(unsafe.Pointer(xbuf + uintptr(rows_left+i)*4)) = *(*TJSAMPROW)(unsafe.Pointer(xbuf + uintptr(rows_left-int32(1))*4)) goto _2 _2: ; i++ } goto _1 _1: ; ci++ compptr += 88 } } /* * Initialize for a processing pass. */ func _start_pass_main1(tls *libc.TLS, cinfo Tj_decompress_ptr, pass_mode TJ_BUF_MODE) { var mainp Tmy_main_ptr _ = mainp mainp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmain1 switch pass_mode { case int32(JBUF_PASS_THRU): if (*Tjpeg_upsampler)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample)).Fneed_context_rows != 0 { (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fpub.Fprocess_data = __ccgo_fp(_process_data_context_main) _make_funny_pointers(tls, cinfo) /* Create the xbuffer[] lists */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fwhichptr = 0 /* Read first iMCU row into xbuffer[0] */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fcontext_state = CTX_PREPARE_FOR_IMCU (*Tmy_main_controller1)(unsafe.Pointer(mainp)).FiMCU_row_ctr = uint32(0) (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fbuffer_full = int32(FALSE1) /* Mark buffer empty */ } else { /* Simple case with no context needed */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fpub.Fprocess_data = __ccgo_fp(_process_data_simple_main1) (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroup_ctr = (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail /* Mark buffer empty */ } case int32(JBUF_CRANK_DEST): /* For last pass of 2-pass quantization, just crank the postprocessor */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fpub.Fprocess_data = __ccgo_fp(_process_data_crank_post) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* * Process some data. * This handles the simple case where no context is required. */ func _process_data_simple_main1(tls *libc.TLS, cinfo Tj_decompress_ptr, output_buf TJSAMPARRAY, out_row_ctr uintptr, out_rows_avail TJDIMENSION) { var mainp Tmy_main_ptr _ = mainp mainp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmain1 /* Read input data if we haven't filled the main buffer yet */ if (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroup_ctr >= (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail { if !((*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_d_coef_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fdecompress_data})))(tls, cinfo, mainp+8) != 0) { return } /* suspension forced, can do nothing more */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroup_ctr = uint32(0) /* OK, we have an iMCU row to work with */ } /* Note: at the bottom of the image, we may pass extra garbage row groups * to the postprocessor. The postprocessor has to check for bottom * of image anyway (at row resolution), so no point in us doing it too. */ /* Feed the postprocessor */ (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE, uintptr, TJDIMENSION, TJSAMPARRAY, uintptr, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_d_post_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fpost)).Fpost_process_data})))(tls, cinfo, mainp+8, mainp+48, (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail, output_buf, out_row_ctr, out_rows_avail) } /* * Process some data. * This handles the case where context rows must be provided. */ func _process_data_context_main(tls *libc.TLS, cinfo Tj_decompress_ptr, output_buf TJSAMPARRAY, out_row_ctr uintptr, out_rows_avail TJDIMENSION) { var mainp Tmy_main_ptr _ = mainp mainp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmain1 /* Read input data if we haven't filled the main buffer yet */ if !((*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fbuffer_full != 0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_d_coef_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fdecompress_data})))(tls, cinfo, *(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60 + uintptr((*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fwhichptr)*4))) != 0) { return } /* suspension forced, can do nothing more */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fbuffer_full = int32(TRUE1) /* OK, we have an iMCU row to work with */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).FiMCU_row_ctr++ /* count rows received */ } /* Postprocessor typically will not swallow all the input data it is handed * in one call (due to filling the output buffer first). Must be prepared * to exit and restart. This switch lets us keep track of how far we got. * Note that each case falls through to the next on successful completion. */ switch (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fcontext_state { case int32(CTX_POSTPONED_ROW): /* Call postprocessor using previously set pointers for postponed row */ (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE, uintptr, TJDIMENSION, TJSAMPARRAY, uintptr, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_d_post_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fpost)).Fpost_process_data})))(tls, cinfo, *(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60 + uintptr((*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fwhichptr)*4)), mainp+48, (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail, output_buf, out_row_ctr, out_rows_avail) if (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroup_ctr < (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail { return } /* Need to suspend */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fcontext_state = CTX_PREPARE_FOR_IMCU if *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)) >= out_rows_avail { return } /* Postprocessor exactly filled output buf */ /*FALLTHROUGH*/ fallthrough case CTX_PREPARE_FOR_IMCU: /* Prepare to process first M-1 row groups of this iMCU row */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroup_ctr = uint32(0) (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail = libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size - libc.Int32FromInt32(1)) /* Check for bottom of image: if so, tweak pointers to "duplicate" * the last sample row, and adjust rowgroups_avail to ignore padding rows. */ if (*Tmy_main_controller1)(unsafe.Pointer(mainp)).FiMCU_row_ctr == (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows { _set_bottom_pointers(tls, cinfo) } (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fcontext_state = int32(CTX_PROCESS_IMCU) /*FALLTHROUGH*/ fallthrough case int32(CTX_PROCESS_IMCU): /* Call postprocessor using previously set pointers */ (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE, uintptr, TJDIMENSION, TJSAMPARRAY, uintptr, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_d_post_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fpost)).Fpost_process_data})))(tls, cinfo, *(*TJSAMPIMAGE)(unsafe.Pointer(mainp + 60 + uintptr((*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fwhichptr)*4)), mainp+48, (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail, output_buf, out_row_ctr, out_rows_avail) if (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroup_ctr < (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail { return } /* Need to suspend */ /* After the first iMCU, change wraparound pointers to normal state */ if (*Tmy_main_controller1)(unsafe.Pointer(mainp)).FiMCU_row_ctr == uint32(1) { _set_wraparound_pointers(tls, cinfo) } /* Prepare to load new iMCU row using other xbuffer list */ *(*int32)(unsafe.Pointer(mainp + 68)) ^= int32(1) /* 0=>1 or 1=>0 */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fbuffer_full = int32(FALSE1) /* Still need to process last row group of this iMCU row, */ /* which is saved at index M+1 of the other xbuffer */ (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroup_ctr = libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size + libc.Int32FromInt32(1)) (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail = libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size + libc.Int32FromInt32(2)) (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fcontext_state = int32(CTX_POSTPONED_ROW) } } /* * Process some data. * Final pass of two-pass quantization: just call the postprocessor. * Source data will be the postprocessor controller's internal buffer. */ func _process_data_crank_post(tls *libc.TLS, cinfo Tj_decompress_ptr, output_buf TJSAMPARRAY, out_row_ctr uintptr, out_rows_avail TJDIMENSION) { (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE, uintptr, TJDIMENSION, TJSAMPARRAY, uintptr, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_d_post_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fpost)).Fpost_process_data})))(tls, cinfo, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.Uint32FromInt32(0), output_buf, out_row_ctr, out_rows_avail) } /* * Initialize main buffer controller. */ func Xjinit_d_main_controller(tls *libc.TLS, cinfo Tj_decompress_ptr, need_full_buffer Tboolean) { var ci, ngroups, rgroup int32 var compptr uintptr var mainp Tmy_main_ptr _, _, _, _, _ = ci, compptr, mainp, ngroups, rgroup mainp = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(80)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmain1 = mainp (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_main1) if need_full_buffer != 0 { /* shouldn't happen */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Allocate the workspace. * ngroups is the number of row groups we need. */ if (*Tjpeg_upsampler)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample)).Fneed_context_rows != 0 { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size < int32(2) { /* unsupported, see comments above */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } _alloc_funny_pointers(tls, cinfo) /* Alloc space for xbuffer[] lists */ ngroups = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size + int32(2) } else { /* There are always min_DCT_v_scaled_size row groups in an iMCU row. */ ngroups = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size (*Tmy_main_controller1)(unsafe.Pointer(mainp)).Frowgroups_avail = libc.Uint32FromInt32(ngroups) } ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { goto _1 } /* skip uninteresting component */ rgroup = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size / (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size /* height of a row group of component */ *(*TJSAMPARRAY)(unsafe.Pointer(mainp + 8 + uintptr(ci)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks*libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size), libc.Uint32FromInt32(rgroup*ngroups)) goto _1 _1: ; ci++ compptr += 88 } } const APP0_DATA_LEN = 14 const APP14_DATA_LEN = 12 const APPN_DATA_LEN = 14 /* Private state */ type Tmy_marker_reader = struct { Fpub Tjpeg_marker_reader Fprocess_COM Tjpeg_marker_parser_method Fprocess_APPn [16]Tjpeg_marker_parser_method Flength_limit_COM uint32 Flength_limit_APPn [16]uint32 Fcur_marker Tjpeg_saved_marker_ptr Fbytes_read uint32 } /* * Macros for fetching data from the data source module. * * At all times, cinfo->src->next_input_byte and ->bytes_in_buffer reflect * the current restart point; we update them only when we have reached a * suitable place to restart if a suspension occurs. */ /* Declare and initialize local copies of input pointer/count */ /* Unload the local copies --- do this only at a restart boundary */ /* Reload the local copies --- used only in MAKE_BYTE_AVAIL */ /* Internal macro for INPUT_BYTE and INPUT_2BYTES: make a byte available. * Note we do *not* do INPUT_SYNC before calling fill_input_buffer, * but we must reload the local copies after a successful fill. */ /* Read a byte into variable V. * If must suspend, take the specified action (typically "return FALSE"). */ /* As above, but read two bytes interpreted as an unsigned 16-bit integer. * V should be declared unsigned int or perhaps INT32. */ /* * Routines to process JPEG markers. * * Entry condition: JPEG marker itself has been read and its code saved * in cinfo->unread_marker; input restart point is just after the marker. * * Exit: if return TRUE, have read and processed any parameters, and have * updated the restart point to point after the parameters. * If return FALSE, was forced to suspend before reaching end of * marker parameters; restart point has not been moved. Same routine * will be called again after application supplies more input data. * * This approach to suspension assumes that all of a marker's parameters * can fit into a single input bufferload. This should hold for "normal" * markers. Some COM/APPn markers might have large parameter segments * that might not fit. If we are simply dropping such a marker, we use * skip_input_data to get past it, and thereby put the problem on the * source manager's shoulders. If we are saving the marker's contents * into memory, we use a slightly different convention: when forced to * suspend, the marker processor updates the restart point to the end of * what it's consumed (ie, the end of the buffer) before returning FALSE. * On resumption, cinfo->unread_marker still contains the marker code, * but the data source will point to the next chunk of marker data. * The marker processor must retain internal state to deal with this. * * Note that we don't bother to avoid duplicate trace messages if a * suspension occurs within marker parameters. Other side effects * require more care. */ func _get_soi(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Process an SOI marker */ var i int32 _ = i (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_SOI) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) if (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fsaw_SOI != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_SOI_DUPLICATE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Reset all parameters that are defined to be reset by SOI */ i = 0 for { if !(i < int32(NUM_ARITH_TBLS)) { break } *(*TUINT8)(unsafe.Pointer(cinfo + 232 + uintptr(i))) = uint8(0) *(*TUINT8)(unsafe.Pointer(cinfo + 248 + uintptr(i))) = uint8(1) *(*TUINT8)(unsafe.Pointer(cinfo + 264 + uintptr(i))) = uint8(5) goto _1 _1: ; i++ } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval = uint32(0) /* Set initial assumptions for colorspace etc */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space = int32(JCS_UNKNOWN) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform = int32(JCT_NONE) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FCCIR601_sampling = int32(FALSE1) /* Assume non-CCIR sampling??? */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsaw_JFIF_marker = int32(FALSE1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FJFIF_major_version = uint8(1) /* set default JFIF APP0 values */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FJFIF_minor_version = uint8(1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdensity_unit = uint8(0) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FX_density = uint16(1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FY_density = uint16(1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsaw_Adobe_marker = int32(FALSE1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAdobe_transform = uint8(0) (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fsaw_SOI = int32(TRUE1) return int32(TRUE1) } func _get_sof(tls *libc.TLS, cinfo Tj_decompress_ptr, is_baseline Tboolean, is_prog Tboolean, is_arith Tboolean) (r Tboolean) { /* Process a SOFn marker */ var _mp, _mp1, compptr, datasrc, next_input_byte, v1, v10, v13, v14, v2, v3, v4, v5, v6, v7, v8 uintptr var bytes_in_buffer Tsize_t var c, ci, i int32 var length TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = _mp, _mp1, bytes_in_buffer, c, ci, compptr, datasrc, i, length, next_input_byte, v1, v10, v13, v14, v2, v3, v4, v5, v6, v7, v8 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fis_baseline = is_baseline (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode = is_prog (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Farith_code = is_arith if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v1 = next_input_byte next_input_byte++ length = libc.Int32FromUint32(uint32(*(*TJOCTET)(unsafe.Pointer(v1))) << int32(8)) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ length += libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v3 = next_input_byte next_input_byte++ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdata_precision = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v3))) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v4 = next_input_byte next_input_byte++ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height = uint32(*(*TJOCTET)(unsafe.Pointer(v4))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v5 = next_input_byte next_input_byte++ *(*TJDIMENSION)(unsafe.Pointer(cinfo + 32)) += uint32(*(*TJOCTET)(unsafe.Pointer(v5))) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v6 = next_input_byte next_input_byte++ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width = uint32(*(*TJOCTET)(unsafe.Pointer(v6))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v7 = next_input_byte next_input_byte++ *(*TJDIMENSION)(unsafe.Pointer(cinfo + 28)) += uint32(*(*TJOCTET)(unsafe.Pointer(v7))) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v8 = next_input_byte next_input_byte++ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v8))) length -= int32(8) _mp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 *(*int32)(unsafe.Pointer(_mp)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker *(*int32)(unsafe.Pointer(_mp + 1*4)) = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width) *(*int32)(unsafe.Pointer(_mp + 2*4)) = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height) *(*int32)(unsafe.Pointer(_mp + 3*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_SOF) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) if (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fsaw_SOF != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_SOF_DUPLICATE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* We don't support files in which the image height is initially specified */ /* as 0 and is later redefined by DNL. As long as we have to check that, */ /* might as well have a general sanity check. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height <= uint32(0) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width <= uint32(0) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components <= 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_EMPTY_IMAGE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if length != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components*libc.Int32FromInt32(3) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_LENGTH) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info == libc.UintptrFromInt32(0) { /* do only once, even if suspend */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components)*libc.Uint32FromInt64(88)) } ci = 0 for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v10 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v10))) /* Check to see whether component id has already been seen */ /* (in violation of the spec, but unfortunately seen in some */ /* files). If so, create "fake" component id equal to the */ /* max id seen so far + 1. */ i = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(i < ci) { break } if c == (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id { compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info c = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id compptr += 88 i = int32(1) for { if !(i < ci) { break } if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id > c { c = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id } goto _12 _12: ; i++ compptr += 88 } c++ break } goto _11 _11: ; i++ compptr += 88 } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id = c (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index = ci if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v13 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v13))) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor = c >> int32(4) & int32(15) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor = c & int32(15) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v14 = next_input_byte next_input_byte++ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v14))) _mp1 = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 *(*int32)(unsafe.Pointer(_mp1)) = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id *(*int32)(unsafe.Pointer(_mp1 + 1*4)) = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor *(*int32)(unsafe.Pointer(_mp1 + 2*4)) = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor *(*int32)(unsafe.Pointer(_mp1 + 3*4)) = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fquant_tbl_no (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_SOF_COMPONENT) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) goto _9 _9: ; ci++ } (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fsaw_SOF = int32(TRUE1) (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer return int32(TRUE1) } func _get_sos(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Process a SOS marker */ var _mp, _mp1, compptr, datasrc, next_input_byte, v1, v10, v11, v12, v2, v3, v5, v9 uintptr var bytes_in_buffer Tsize_t var c, ci, i, n int32 var length TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = _mp, _mp1, bytes_in_buffer, c, ci, compptr, datasrc, i, length, n, next_input_byte, v1, v10, v11, v12, v2, v3, v5, v9 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer if !((*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fsaw_SOF != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_SOF_BEFORE) libc.Xstrncpy(tls, (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr+24, __ccgo_ts+4700, uint32(JMSG_STR_PARM_MAX)) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v1 = next_input_byte next_input_byte++ length = libc.Int32FromUint32(uint32(*(*TJOCTET)(unsafe.Pointer(v1))) << int32(8)) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ length += libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v3 = next_input_byte next_input_byte++ n = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v3))) /* Number of components */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_SOS) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = n (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) if length != n*libc.Int32FromInt32(2)+libc.Int32FromInt32(6) || n > int32(MAX_COMPS_IN_SCAN) || n == 0 && !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0) { /* pseudo SOS marker only allowed in progressive mode */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_LENGTH) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan = n /* Collect the component-spec parameters */ i = 0 for { if !(i < n) { break } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v5 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v5))) /* Detect the case where component id's are not unique, and, if so, */ /* create a fake component id using the same logic as in get_sof. */ /* Note: This also ensures that all of the SOF components are */ /* referenced in the single scan case, which prevents access to */ /* uninitialized memory in later decoding stages. */ ci = 0 for { if !(ci < i) { break } if c == (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)))).Fcomponent_id { c = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 344)))).Fcomponent_id ci = int32(1) for { if !(ci < i) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(ci)*4)) if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id > c { c = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id } goto _7 _7: ; ci++ } c++ break } goto _6 _6: ; ci++ } ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if c == (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id { goto id_found } goto _8 _8: ; ci++ compptr += 88 } (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_COMPONENT_ID) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = c (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) goto id_found id_found: ; *(*uintptr)(unsafe.Pointer(cinfo + 344 + uintptr(i)*4)) = compptr if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v9 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v9))) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no = c >> int32(4) & int32(15) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no = c & int32(15) _mp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 *(*int32)(unsafe.Pointer(_mp)) = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_id *(*int32)(unsafe.Pointer(_mp + 1*4)) = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no *(*int32)(unsafe.Pointer(_mp + 2*4)) = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_SOS_COMPONENT) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) goto _4 _4: ; i++ } /* Collect the additional scan parameters Ss, Se, Ah/Al. */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v10 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v10))) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs = c if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v11 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v11))) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe = c if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v12 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v12))) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh = c >> int32(4) & int32(15) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl = c & int32(15) _mp1 = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 *(*int32)(unsafe.Pointer(_mp1)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSs *(*int32)(unsafe.Pointer(_mp1 + 1*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FSe *(*int32)(unsafe.Pointer(_mp1 + 2*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAh *(*int32)(unsafe.Pointer(_mp1 + 3*4)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FAl (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_SOS_PARAMS) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) /* Prepare to scan data & restart markers */ (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fnext_restart_num = 0 /* Count another (non-pseudo) SOS marker */ if n != 0 { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number++ } (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer return int32(TRUE1) } func _get_dac(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Process a DAC marker */ var bytes_in_buffer Tsize_t var datasrc, next_input_byte, v1, v2, v3, v4 uintptr var index, val int32 var length TINT32 _, _, _, _, _, _, _, _, _, _ = bytes_in_buffer, datasrc, index, length, next_input_byte, val, v1, v2, v3, v4 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v1 = next_input_byte next_input_byte++ length = libc.Int32FromUint32(uint32(*(*TJOCTET)(unsafe.Pointer(v1))) << int32(8)) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ length += libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) length -= int32(2) for length > 0 { if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v3 = next_input_byte next_input_byte++ index = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v3))) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v4 = next_input_byte next_input_byte++ val = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v4))) length -= int32(2) (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_DAC) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = index *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = val (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) if index < 0 || index >= libc.Int32FromInt32(2)*libc.Int32FromInt32(NUM_ARITH_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_DAC_INDEX) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = index (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if index >= int32(NUM_ARITH_TBLS) { /* define AC table */ *(*TUINT8)(unsafe.Pointer(cinfo + 264 + uintptr(index-int32(NUM_ARITH_TBLS)))) = libc.Uint8FromInt32(val) } else { /* define DC table */ *(*TUINT8)(unsafe.Pointer(cinfo + 232 + uintptr(index))) = libc.Uint8FromInt32(val & libc.Int32FromInt32(0x0F)) *(*TUINT8)(unsafe.Pointer(cinfo + 248 + uintptr(index))) = libc.Uint8FromInt32(val >> libc.Int32FromInt32(4)) if libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 232 + uintptr(index)))) > libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(cinfo + 248 + uintptr(index)))) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_DAC_VALUE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = val (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } } if length != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_LENGTH) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer return int32(TRUE1) } func _get_dht(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { bp := tls.Alloc(288) defer tls.Free(288) /* Process a DHT marker */ var _mp, _mp1, datasrc, htblptr, next_input_byte, v1, v2, v3, v5, v7 uintptr var bytes_in_buffer Tsize_t var count, i, index int32 var length TINT32 var _ /* bits at bp+0 */ [17]TUINT8 var _ /* huffval at bp+17 */ [256]TUINT8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = _mp, _mp1, bytes_in_buffer, count, datasrc, htblptr, i, index, length, next_input_byte, v1, v2, v3, v5, v7 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v1 = next_input_byte next_input_byte++ length = libc.Int32FromUint32(uint32(*(*TJOCTET)(unsafe.Pointer(v1))) << int32(8)) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ length += libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) length -= int32(2) for length > int32(16) { if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v3 = next_input_byte next_input_byte++ index = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v3))) (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_DHT) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = index (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) (*(*[17]TUINT8)(unsafe.Pointer(bp)))[0] = uint8(0) count = 0 i = int32(1) for { if !(i <= int32(16)) { break } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v5 = next_input_byte next_input_byte++ (*(*[17]TUINT8)(unsafe.Pointer(bp)))[i] = *(*TJOCTET)(unsafe.Pointer(v5)) count += libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[i]) goto _4 _4: ; i++ } length -= libc.Int32FromInt32(1) + libc.Int32FromInt32(16) _mp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 *(*int32)(unsafe.Pointer(_mp)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(1)]) *(*int32)(unsafe.Pointer(_mp + 1*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(2)]) *(*int32)(unsafe.Pointer(_mp + 2*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(3)]) *(*int32)(unsafe.Pointer(_mp + 3*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(4)]) *(*int32)(unsafe.Pointer(_mp + 4*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(5)]) *(*int32)(unsafe.Pointer(_mp + 5*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(6)]) *(*int32)(unsafe.Pointer(_mp + 6*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(7)]) *(*int32)(unsafe.Pointer(_mp + 7*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(8)]) (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_HUFFBITS) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(2)) _mp1 = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 *(*int32)(unsafe.Pointer(_mp1)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(9)]) *(*int32)(unsafe.Pointer(_mp1 + 1*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(10)]) *(*int32)(unsafe.Pointer(_mp1 + 2*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(11)]) *(*int32)(unsafe.Pointer(_mp1 + 3*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(12)]) *(*int32)(unsafe.Pointer(_mp1 + 4*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(13)]) *(*int32)(unsafe.Pointer(_mp1 + 5*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(14)]) *(*int32)(unsafe.Pointer(_mp1 + 6*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(15)]) *(*int32)(unsafe.Pointer(_mp1 + 7*4)) = libc.Int32FromUint8((*(*[17]TUINT8)(unsafe.Pointer(bp)))[int32(16)]) (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_HUFFBITS) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(2)) /* Here we just do minimal validation of the counts to avoid walking * off the end of our table space. jdhuff.c will check more carefully. */ if count > int32(256) || count > length { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_HUFF_TABLE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } i = 0 for { if !(i < count) { break } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v7 = next_input_byte next_input_byte++ (*(*[256]TUINT8)(unsafe.Pointer(bp + 17)))[i] = *(*TJOCTET)(unsafe.Pointer(v7)) goto _6 _6: ; i++ } length -= count if index&int32(0x10) != 0 { /* AC table definition */ index -= int32(0x10) htblptr = cinfo + 196 + uintptr(index)*4 } else { /* DC table definition */ htblptr = cinfo + 180 + uintptr(index)*4 } if index < 0 || index >= int32(NUM_HUFF_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_DHT_INDEX) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = index (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if *(*uintptr)(unsafe.Pointer(htblptr)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(htblptr)) = Xjpeg_alloc_huff_table(tls, cinfo) } libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(htblptr)), bp, libc.Uint32FromInt64(17)) if count > 0 { libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(htblptr))+17, bp+17, libc.Uint32FromInt32(count)*libc.Uint32FromInt64(1)) } } if length != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_LENGTH) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer return int32(TRUE1) } func _get_dqt(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Process a DQT marker */ var _mp, datasrc, natural_order, next_input_byte, quant_ptr, v1, v2, v3, v7, v8, v9 uintptr var bytes_in_buffer Tsize_t var count, i, length TINT32 var n, prec int32 var tmp uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = _mp, bytes_in_buffer, count, datasrc, i, length, n, natural_order, next_input_byte, prec, quant_ptr, tmp, v1, v2, v3, v7, v8, v9 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v1 = next_input_byte next_input_byte++ length = libc.Int32FromUint32(uint32(*(*TJOCTET)(unsafe.Pointer(v1))) << int32(8)) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ length += libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) length -= int32(2) for length > 0 { length-- if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v3 = next_input_byte next_input_byte++ n = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v3))) prec = n >> int32(4) n &= int32(0x0F) (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_DQT) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = n *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = prec (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) if n >= int32(NUM_QUANT_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_DQT_INDEX) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = n (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if *(*uintptr)(unsafe.Pointer(cinfo + 164 + uintptr(n)*4)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(cinfo + 164 + uintptr(n)*4)) = Xjpeg_alloc_quant_table(tls, cinfo) } quant_ptr = *(*uintptr)(unsafe.Pointer(cinfo + 164 + uintptr(n)*4)) if prec != 0 { if length < libc.Int32FromInt32(DCTSIZE2)*libc.Int32FromInt32(2) { /* Initialize full table for safety. */ i = 0 for { if !(i < int32(DCTSIZE2)) { break } *(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(i)*2)) = uint16(1) goto _4 _4: ; i++ } count = length >> int32(1) } else { count = int32(DCTSIZE2) } } else { if length < int32(DCTSIZE2) { /* Initialize full table for safety. */ i = 0 for { if !(i < int32(DCTSIZE2)) { break } *(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(i)*2)) = uint16(1) goto _5 _5: ; i++ } count = length } else { count = int32(DCTSIZE2) } } switch count { case libc.Int32FromInt32(2) * libc.Int32FromInt32(2): natural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order2)) case libc.Int32FromInt32(3) * libc.Int32FromInt32(3): natural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order3)) case libc.Int32FromInt32(4) * libc.Int32FromInt32(4): natural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order4)) case libc.Int32FromInt32(5) * libc.Int32FromInt32(5): natural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order5)) case libc.Int32FromInt32(6) * libc.Int32FromInt32(6): natural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order6)) case libc.Int32FromInt32(7) * libc.Int32FromInt32(7): natural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order7)) default: natural_order = uintptr(unsafe.Pointer(&Xjpeg_natural_order)) } i = 0 for { if !(i < count) { break } if prec != 0 { if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v7 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v7))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v8 = next_input_byte next_input_byte++ tmp += uint32(*(*TJOCTET)(unsafe.Pointer(v8))) } else { if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v9 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v9))) } /* We convert the zigzag-order table to natural array order. */ *(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(i)*4)))*2)) = uint16(tmp) goto _6 _6: ; i++ } if (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ftrace_level >= int32(2) { i = 0 for { if !(i < int32(DCTSIZE2)) { break } _mp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 *(*int32)(unsafe.Pointer(_mp)) = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(i)*2))) *(*int32)(unsafe.Pointer(_mp + 1*4)) = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(i+int32(1))*2))) *(*int32)(unsafe.Pointer(_mp + 2*4)) = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(i+int32(2))*2))) *(*int32)(unsafe.Pointer(_mp + 3*4)) = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(i+int32(3))*2))) *(*int32)(unsafe.Pointer(_mp + 4*4)) = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(i+int32(4))*2))) *(*int32)(unsafe.Pointer(_mp + 5*4)) = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(i+int32(5))*2))) *(*int32)(unsafe.Pointer(_mp + 6*4)) = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(i+int32(6))*2))) *(*int32)(unsafe.Pointer(_mp + 7*4)) = libc.Int32FromUint16(*(*TUINT16)(unsafe.Pointer(quant_ptr + uintptr(i+int32(7))*2))) (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_QUANTVALS) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(2)) goto _10 _10: ; i += int32(8) } } length -= count if prec != 0 { length -= count } } if length != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_LENGTH) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer return int32(TRUE1) } func _get_dri(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Process a DRI marker */ var bytes_in_buffer Tsize_t var datasrc, next_input_byte, v1, v2, v3, v4 uintptr var length TINT32 var tmp uint32 _, _, _, _, _, _, _, _, _ = bytes_in_buffer, datasrc, length, next_input_byte, tmp, v1, v2, v3, v4 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v1 = next_input_byte next_input_byte++ length = libc.Int32FromUint32(uint32(*(*TJOCTET)(unsafe.Pointer(v1))) << int32(8)) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ length += libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) if length != int32(4) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_LENGTH) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v3 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v3))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v4 = next_input_byte next_input_byte++ tmp += uint32(*(*TJOCTET)(unsafe.Pointer(v4))) (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_DRI) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint32(tmp) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frestart_interval = tmp (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer return int32(TRUE1) } func _get_lse(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Process an LSE marker */ var bytes_in_buffer Tsize_t var cid int32 var datasrc, next_input_byte, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v3, v4, v5, v6, v7, v8, v9 uintptr var length TINT32 var tmp uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bytes_in_buffer, cid, datasrc, length, next_input_byte, tmp, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v3, v4, v5, v6, v7, v8, v9 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer if !((*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fsaw_SOF != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_SOF_BEFORE) libc.Xstrncpy(tls, (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr+24, __ccgo_ts+4704, uint32(JMSG_STR_PARM_MAX)) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components < int32(3) { goto bad } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v1 = next_input_byte next_input_byte++ length = libc.Int32FromUint32(uint32(*(*TJOCTET)(unsafe.Pointer(v1))) << int32(8)) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ length += libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) if length != int32(24) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_LENGTH) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v3 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v3))) if tmp != uint32(0x0D) { /* ID inverse transform specification */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_UNKNOWN_MARKER) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v4 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v4))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v5 = next_input_byte next_input_byte++ tmp += uint32(*(*TJOCTET)(unsafe.Pointer(v5))) if tmp != uint32(MAXJSAMPLE) { goto bad } /* MAXTRANS */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v6 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v6))) if tmp != uint32(3) { goto bad } /* Nt=3 */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v7 = next_input_byte next_input_byte++ cid = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v7))) if cid != (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).Fcomponent_id { goto bad } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v8 = next_input_byte next_input_byte++ cid = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v8))) if cid != (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info))).Fcomponent_id { goto bad } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v9 = next_input_byte next_input_byte++ cid = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v9))) if cid != (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).Fcomponent_id { goto bad } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v10 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v10))) if tmp != uint32(0x80) { goto bad } /* F1: CENTER1=1, NORM1=0 */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v11 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v11))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v12 = next_input_byte next_input_byte++ tmp += uint32(*(*TJOCTET)(unsafe.Pointer(v12))) if tmp != uint32(0) { goto bad } /* A(1,1)=0 */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v13 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v13))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v14 = next_input_byte next_input_byte++ tmp += uint32(*(*TJOCTET)(unsafe.Pointer(v14))) if tmp != uint32(0) { goto bad } /* A(1,2)=0 */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v15 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v15))) if tmp != uint32(0) { goto bad } /* F2: CENTER2=0, NORM2=0 */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v16 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v16))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v17 = next_input_byte next_input_byte++ tmp += uint32(*(*TJOCTET)(unsafe.Pointer(v17))) if tmp != uint32(1) { goto bad } /* A(2,1)=1 */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v18 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v18))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v19 = next_input_byte next_input_byte++ tmp += uint32(*(*TJOCTET)(unsafe.Pointer(v19))) if tmp != uint32(0) { goto bad } /* A(2,2)=0 */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v20 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v20))) if tmp != uint32(0) { goto bad } /* F3: CENTER3=0, NORM3=0 */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v21 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v21))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v22 = next_input_byte next_input_byte++ tmp += uint32(*(*TJOCTET)(unsafe.Pointer(v22))) if tmp != uint32(1) { goto bad } /* A(3,1)=1 */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v23 = next_input_byte next_input_byte++ tmp = uint32(*(*TJOCTET)(unsafe.Pointer(v23))) << int32(8) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v24 = next_input_byte next_input_byte++ tmp += uint32(*(*TJOCTET)(unsafe.Pointer(v24))) if !(tmp != uint32(0)) { goto _25 } /* A(3,2)=0 */ goto bad bad: ; (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CONVERSION_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) _25: ; /* OK, valid transform that we can handle. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform = int32(JCT_SUBTRACT_GREEN) (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer return int32(TRUE1) } /* * Routines for processing APPn and COM markers. * These are either saved in memory or discarded, per application request. * APP0 and APP14 are specially checked to see if they are * JFIF and Adobe markers, respectively. */ func _examine_app0(tls *libc.TLS, cinfo Tj_decompress_ptr, data uintptr, datalen uint32, remaining TINT32) { /* Examine first few bytes from an APP0. * Take appropriate action if it is a JFIF marker. * datalen is # of bytes at data[], remaining is length of rest of marker data. */ var _mp uintptr var totallen TINT32 _, _ = _mp, totallen totallen = libc.Int32FromUint32(datalen) + remaining if datalen >= uint32(APP0_DATA_LEN) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data))) == int32(0x4A) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 1))) == int32(0x46) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 2))) == int32(0x49) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 3))) == int32(0x46) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 4))) == 0 { /* Found JFIF APP0 marker: save info */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsaw_JFIF_marker = int32(TRUE1) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FJFIF_major_version = *(*TJOCTET)(unsafe.Pointer(data + 5)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FJFIF_minor_version = *(*TJOCTET)(unsafe.Pointer(data + 6)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdensity_unit = *(*TJOCTET)(unsafe.Pointer(data + 7)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FX_density = libc.Uint16FromInt32(libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 8)))<= uint32(6) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data))) == int32(0x4A) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 1))) == int32(0x46) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 2))) == int32(0x58) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 3))) == int32(0x58) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 4))) == 0 { /* Found JFIF "JFXX" extension APP0 marker */ /* The library doesn't actually do anything with these, * but we try to produce a helpful trace message. */ switch libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 5))) { case int32(0x10): (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_THUMB_JPEG) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = totallen (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) case int32(0x11): (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_THUMB_PALETTE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = totallen (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) case int32(0x13): (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_THUMB_RGB) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = totallen (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_JFIF_EXTENSION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 5))) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = totallen (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) } } else { /* Start of APP0 does not match "JFIF" or "JFXX", or too short */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_APP0) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = totallen (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) } } } func _examine_app14(tls *libc.TLS, cinfo Tj_decompress_ptr, data uintptr, datalen uint32, remaining TINT32) { /* Examine first few bytes from an APP14. * Take appropriate action if it is an Adobe marker. * datalen is # of bytes at data[], remaining is length of rest of marker data. */ var _mp uintptr var flags0, flags1, transform, version uint32 _, _, _, _, _ = _mp, flags0, flags1, transform, version if datalen >= uint32(APP14_DATA_LEN) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data))) == int32(0x41) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 1))) == int32(0x64) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 2))) == int32(0x6F) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 3))) == int32(0x62) && libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 4))) == int32(0x65) { /* Found Adobe APP14 marker */ version = libc.Uint32FromInt32(libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(data + 5)))<= int32(APPN_DATA_LEN) { numtoread = uint32(APPN_DATA_LEN) } else { if length > 0 { numtoread = libc.Uint32FromInt32(length) } else { numtoread = uint32(0) } } i = uint32(0) for { if !(i < numtoread) { break } if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v4 = next_input_byte next_input_byte++ (*(*[14]TJOCTET)(unsafe.Pointer(bp)))[i] = *(*TJOCTET)(unsafe.Pointer(v4)) goto _3 _3: ; i++ } length = TINT32(uint32(length) - numtoread) /* process it */ switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker { case int32(M_APP0): _examine_app0(tls, cinfo, bp, numtoread, length) case int32(M_APP14): _examine_app14(tls, cinfo, bp, numtoread, length) default: /* can't get here unless jpeg_save_markers chooses wrong processor */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_UNKNOWN_MARKER) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* skip any remaining data -- could be lots */ (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer if length > 0 { (*(*func(*libc.TLS, Tj_decompress_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fskip_input_data})))(tls, cinfo, length) } return int32(TRUE1) } func _save_marker(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Save an APPn or COM marker into the marker list */ var bytes_in_buffer Tsize_t var bytes_read, data_length, limit, v4 uint32 var cur_marker, prev Tjpeg_saved_marker_ptr var data, datasrc, next_input_byte, v1, v2, v3, v5, v6 uintptr var length TINT32 var marker Tmy_marker_ptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bytes_in_buffer, bytes_read, cur_marker, data, data_length, datasrc, length, limit, marker, next_input_byte, prev, v1, v2, v3, v4, v5, v6 marker = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker cur_marker = (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fcur_marker length = 0 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer if cur_marker == libc.UintptrFromInt32(0) { /* begin reading a marker */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v1 = next_input_byte next_input_byte++ length = libc.Int32FromUint32(uint32(*(*TJOCTET)(unsafe.Pointer(v1))) << int32(8)) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ length += libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) length -= int32(2) if length >= 0 { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker == int32(M_COM) { limit = (*Tmy_marker_reader)(unsafe.Pointer(marker)).Flength_limit_COM } else { limit = *(*uint32)(unsafe.Pointer(marker + 100 + uintptr((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker-int32(M_APP0))*4)) } if libc.Uint32FromInt32(length) < limit { limit = libc.Uint32FromInt32(length) } /* allocate and initialize the marker item */ cur_marker = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_large})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(20)+limit) (*Tjpeg_marker_struct)(unsafe.Pointer(cur_marker)).Fnext = libc.UintptrFromInt32(0) (*Tjpeg_marker_struct)(unsafe.Pointer(cur_marker)).Fmarker = libc.Uint8FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker) (*Tjpeg_marker_struct)(unsafe.Pointer(cur_marker)).Foriginal_length = libc.Uint32FromInt32(length) (*Tjpeg_marker_struct)(unsafe.Pointer(cur_marker)).Fdata_length = limit /* data area is just beyond the jpeg_marker_struct */ v3 = cur_marker + libc.UintptrFromInt32(1)*20 (*Tjpeg_marker_struct)(unsafe.Pointer(cur_marker)).Fdata = v3 data = v3 (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fcur_marker = cur_marker (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fbytes_read = uint32(0) bytes_read = uint32(0) data_length = limit } else { /* deal with bogus length word */ v4 = libc.Uint32FromInt32(0) data_length = v4 bytes_read = v4 data = libc.UintptrFromInt32(0) } } else { /* resume reading a marker */ bytes_read = (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fbytes_read data_length = (*Tjpeg_marker_struct)(unsafe.Pointer(cur_marker)).Fdata_length data = (*Tjpeg_marker_struct)(unsafe.Pointer(cur_marker)).Fdata + uintptr(bytes_read) } for bytes_read < data_length { (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer /* move the restart point to here */ (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fbytes_read = bytes_read /* If there's not at least one byte in buffer, suspend */ if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } /* Copy bytes with reasonable rapidity */ for bytes_read < data_length && bytes_in_buffer > uint32(0) { v5 = data data++ v6 = next_input_byte next_input_byte++ *(*TJOCTET)(unsafe.Pointer(v5)) = *(*TJOCTET)(unsafe.Pointer(v6)) bytes_in_buffer-- bytes_read++ } } /* Done reading what we want to read */ if cur_marker != libc.UintptrFromInt32(0) { /* will be NULL if bogus length word */ /* Add new marker to end of list */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker_list == libc.UintptrFromInt32(0) { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker_list = cur_marker } else { prev = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker_list for (*Tjpeg_marker_struct)(unsafe.Pointer(prev)).Fnext != libc.UintptrFromInt32(0) { prev = (*Tjpeg_marker_struct)(unsafe.Pointer(prev)).Fnext } (*Tjpeg_marker_struct)(unsafe.Pointer(prev)).Fnext = cur_marker } /* Reset pointer & calc remaining data length */ data = (*Tjpeg_marker_struct)(unsafe.Pointer(cur_marker)).Fdata length = libc.Int32FromUint32((*Tjpeg_marker_struct)(unsafe.Pointer(cur_marker)).Foriginal_length - data_length) } /* Reset to initial state for next marker */ (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fcur_marker = libc.UintptrFromInt32(0) /* Process the marker if interesting; else just make a generic trace msg */ switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker { case int32(M_APP0): _examine_app0(tls, cinfo, data, data_length, length) case int32(M_APP14): _examine_app14(tls, cinfo, data, data_length, length) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_MISC_MARKER) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = libc.Int32FromUint32(data_length + libc.Uint32FromInt32(length)) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) } /* skip any remaining data -- could be lots */ (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer /* do before skip_input_data */ if length > 0 { (*(*func(*libc.TLS, Tj_decompress_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fskip_input_data})))(tls, cinfo, length) } return int32(TRUE1) } func _skip_variable(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Skip over an unknown or uninteresting variable-length marker */ var bytes_in_buffer Tsize_t var datasrc, next_input_byte, v1, v2 uintptr var length TINT32 _, _, _, _, _, _ = bytes_in_buffer, datasrc, length, next_input_byte, v1, v2 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v1 = next_input_byte next_input_byte++ length = libc.Int32FromUint32(uint32(*(*TJOCTET)(unsafe.Pointer(v1))) << int32(8)) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ length += libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) length -= int32(2) (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_MISC_MARKER) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = length (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer /* do before skip_input_data */ if length > 0 { (*(*func(*libc.TLS, Tj_decompress_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fskip_input_data})))(tls, cinfo, length) } return int32(TRUE1) } /* * Find the next JPEG marker, save it in cinfo->unread_marker. * Returns FALSE if had to suspend before reaching a marker; * in that case cinfo->unread_marker is unchanged. * * Note that the result might not be a valid marker code, * but it will never be 0 or FF. */ func _next_marker(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { var bytes_in_buffer Tsize_t var c int32 var datasrc, next_input_byte, v2, v3, v4 uintptr _, _, _, _, _, _, _ = bytes_in_buffer, c, datasrc, next_input_byte, v2, v3, v4 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer for { if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) /* Skip any non-FF bytes. * This may look a bit inefficient, but it will not occur in a valid file. * We sync after each discarded byte so that a suspending data source * can discard the byte from its buffer. */ for c != int32(0xFF) { (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fdiscarded_bytes++ (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v3 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v3))) } /* This loop swallows any duplicate FF bytes. Extra FFs are legal as * pad bytes, so don't count them in discarded_bytes. We assume there * will not be so many consecutive FF bytes as to overflow a suspending * data source's input buffer. */ for cond := true; cond; cond = c == int32(0xFF) { if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v4 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v4))) } if c != 0 { break } /* found a valid marker, exit loop */ /* Reach here if we found a stuffed-zero data sequence (FF/00). * Discard it and loop back to try again. */ *(*uint32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker + 24)) += uint32(2) (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer goto _1 _1: } if (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fdiscarded_bytes != uint32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_EXTRANEOUS_DATA) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromUint32((*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fdiscarded_bytes) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = c (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fdiscarded_bytes = uint32(0) } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker = c (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer return int32(TRUE1) } func _first_marker(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Like next_marker, but used to obtain the initial SOI marker. */ /* For this marker, we do not allow preceding garbage or fill; otherwise, * we might well scan an entire input file before realizing it ain't JPEG. * If an application wants to process non-JFIF files, it must seek to the * SOI before calling the JPEG library. */ var bytes_in_buffer Tsize_t var c, c2 int32 var datasrc, next_input_byte, v1, v2 uintptr _, _, _, _, _, _, _ = bytes_in_buffer, c, c2, datasrc, next_input_byte, v1, v2 datasrc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v1 = next_input_byte next_input_byte++ c = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v1))) if bytes_in_buffer == uint32(0) { if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Ffill_input_buffer})))(tls, cinfo) != 0) { return int32(FALSE1) } next_input_byte = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte bytes_in_buffer = (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer } bytes_in_buffer-- v2 = next_input_byte next_input_byte++ c2 = libc.Int32FromUint8(*(*TJOCTET)(unsafe.Pointer(v2))) if c != int32(0xFF) || c2 != int32(M_SOI) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_SOI) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = c *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = c2 (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker = c2 (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fnext_input_byte = next_input_byte (*Tjpeg_source_mgr)(unsafe.Pointer(datasrc)).Fbytes_in_buffer = bytes_in_buffer return int32(TRUE1) } /* * Read markers until SOS or EOI. * * Returns same codes as are defined for jpeg_consume_input: * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. * * Note: This function may return a pseudo SOS marker (with zero * component number) for treat by input controller's consume_input. * consume_input itself should filter out (skip) the pseudo marker * after processing for the caller. */ func _read_markers(tls *libc.TLS, cinfo Tj_decompress_ptr) (r int32) { /* Outer loop repeats once for each marker. */ for { /* Collect the marker proper, unless we already did. */ /* NB: first_marker() enforces the requirement that SOI appear first. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker == 0 { if !((*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fsaw_SOI != 0) { if !(_first_marker(tls, cinfo) != 0) { return JPEG_SUSPENDED } } else { if !(_next_marker(tls, cinfo) != 0) { return JPEG_SUSPENDED } } } /* At this point cinfo->unread_marker contains the marker code and the * input point is just past the marker proper, but before any parameters. * A suspension will cause us to return with this state still true. */ switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker { case int32(M_SOI): if !(_get_soi(tls, cinfo) != 0) { return JPEG_SUSPENDED } case int32(M_SOF0): /* Baseline */ if !(_get_sof(tls, cinfo, int32(TRUE1), int32(FALSE1), int32(FALSE1)) != 0) { return JPEG_SUSPENDED } case int32(M_SOF1): /* Extended sequential, Huffman */ if !(_get_sof(tls, cinfo, int32(FALSE1), int32(FALSE1), int32(FALSE1)) != 0) { return JPEG_SUSPENDED } case int32(M_SOF2): /* Progressive, Huffman */ if !(_get_sof(tls, cinfo, int32(FALSE1), int32(TRUE1), int32(FALSE1)) != 0) { return JPEG_SUSPENDED } case int32(M_SOF9): /* Extended sequential, arithmetic */ if !(_get_sof(tls, cinfo, int32(FALSE1), int32(FALSE1), int32(TRUE1)) != 0) { return JPEG_SUSPENDED } case int32(M_SOF10): /* Progressive, arithmetic */ if !(_get_sof(tls, cinfo, int32(FALSE1), int32(TRUE1), int32(TRUE1)) != 0) { return JPEG_SUSPENDED } break /* Currently unsupported SOFn types */ fallthrough case int32(M_SOF3): /* Lossless, Huffman */ fallthrough case int32(M_SOF5): /* Differential sequential, Huffman */ fallthrough case int32(M_SOF6): /* Differential progressive, Huffman */ fallthrough case int32(M_SOF7): /* Differential lossless, Huffman */ fallthrough case int32(M_JPG): /* Reserved for JPEG extensions */ fallthrough case int32(M_SOF11): /* Lossless, arithmetic */ fallthrough case int32(M_SOF13): /* Differential sequential, arithmetic */ fallthrough case int32(M_SOF14): /* Differential progressive, arithmetic */ fallthrough case int32(M_SOF15): /* Differential lossless, arithmetic */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_SOF_UNSUPPORTED) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) case int32(M_SOS): if !(_get_sos(tls, cinfo) != 0) { return JPEG_SUSPENDED } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker = 0 /* processed the marker */ return int32(JPEG_REACHED_SOS) case int32(M_EOI): (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_EOI) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker = 0 /* processed the marker */ return int32(JPEG_REACHED_EOI) case int32(M_DAC): if !(_get_dac(tls, cinfo) != 0) { return JPEG_SUSPENDED } case int32(M_DHT): if !(_get_dht(tls, cinfo) != 0) { return JPEG_SUSPENDED } case int32(M_DQT): if !(_get_dqt(tls, cinfo) != 0) { return JPEG_SUSPENDED } case int32(M_DRI): if !(_get_dri(tls, cinfo) != 0) { return JPEG_SUSPENDED } case int32(M_JPG8): if !(_get_lse(tls, cinfo) != 0) { return JPEG_SUSPENDED } case int32(M_APP0): fallthrough case int32(M_APP1): fallthrough case int32(M_APP2): fallthrough case int32(M_APP3): fallthrough case int32(M_APP4): fallthrough case int32(M_APP5): fallthrough case int32(M_APP6): fallthrough case int32(M_APP7): fallthrough case int32(M_APP8): fallthrough case int32(M_APP9): fallthrough case int32(M_APP10): fallthrough case int32(M_APP11): fallthrough case int32(M_APP12): fallthrough case int32(M_APP13): fallthrough case int32(M_APP14): fallthrough case int32(M_APP15): if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{*(*Tjpeg_marker_parser_method)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker + 32 + uintptr((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker-int32(M_APP0))*4))})))(tls, cinfo) != 0) { return JPEG_SUSPENDED } case int32(M_COM): if !((*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tmy_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fprocess_COM})))(tls, cinfo) != 0) { return JPEG_SUSPENDED } case int32(M_RST0): /* these are all parameterless */ fallthrough case int32(M_RST1): fallthrough case int32(M_RST2): fallthrough case int32(M_RST3): fallthrough case int32(M_RST4): fallthrough case int32(M_RST5): fallthrough case int32(M_RST6): fallthrough case int32(M_RST7): fallthrough case int32(M_TEM): (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_PARMLESS_MARKER) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) case int32(M_DNL): /* Ignore DNL ... perhaps the wrong thing */ if !(_skip_variable(tls, cinfo) != 0) { return JPEG_SUSPENDED } default: /* must be DHP, EXP, JPGn, or RESn */ /* For now, we treat the reserved markers as fatal errors since they are * likely to be used to signal incompatible JPEG Part 3 extensions. * Once the JPEG 3 version-number marker is well defined, this code * ought to change! */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_UNKNOWN_MARKER) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Successfully processed marker, so reset state variable */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker = 0 goto _1 _1: } /* end loop */ return r } /* * Read a restart marker, which is expected to appear next in the datastream; * if the marker is not there, take appropriate recovery action. * Returns FALSE if suspension is required. * * This is called by the entropy decoder after it has read an appropriate * number of MCUs. cinfo->unread_marker may be nonzero if the entropy decoder * has already read a marker from the data source. Under normal conditions * cinfo->unread_marker will be reset to 0 before returning; if not reset, * it holds a marker which the decoder will be unable to read past. */ func _read_restart_marker(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Obtain a marker unless we already did. */ /* Note that next_marker will complain if it skips any data. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker == 0 { if !(_next_marker(tls, cinfo) != 0) { return int32(FALSE1) } } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker == int32(M_RST0)+(*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fnext_restart_num { /* Normal case --- swallow the marker and let entropy decoder continue */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_RST) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fnext_restart_num (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(3)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker = 0 } else { /* Uh-oh, the restart markers have been messed up. */ /* Let the data source manager determine how to resync. */ if !((*(*func(*libc.TLS, Tj_decompress_ptr, int32) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_source_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsrc)).Fresync_to_restart})))(tls, cinfo, (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fnext_restart_num) != 0) { return int32(FALSE1) } } /* Update next-restart state */ (*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fnext_restart_num = ((*Tjpeg_marker_reader)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker)).Fnext_restart_num + int32(1)) & int32(7) return int32(TRUE1) } /* * This is the default resync_to_restart method for data source managers * to use if they don't have any better approach. Some data source managers * may be able to back up, or may have additional knowledge about the data * which permits a more intelligent recovery strategy; such managers would * presumably supply their own resync method. * * read_restart_marker calls resync_to_restart if it finds a marker other than * the restart marker it was expecting. (This code is *not* used unless * a nonzero restart interval has been declared.) cinfo->unread_marker is * the marker code actually found (might be anything, except 0 or FF). * The desired restart marker number (0..7) is passed as a parameter. * This routine is supposed to apply whatever error recovery strategy seems * appropriate in order to position the input stream to the next data segment. * Note that cinfo->unread_marker is treated as a marker appearing before * the current data-source input point; usually it should be reset to zero * before returning. * Returns FALSE if suspension is required. * * This implementation is substantially constrained by wanting to treat the * input as a data stream; this means we can't back up. Therefore, we have * only the following actions to work with: * 1. Simply discard the marker and let the entropy decoder resume at next * byte of file. * 2. Read forward until we find another marker, discarding intervening * data. (In theory we could look ahead within the current bufferload, * without having to discard data if we don't find the desired marker. * This idea is not implemented here, in part because it makes behavior * dependent on buffer size and chance buffer-boundary positions.) * 3. Leave the marker unread (by failing to zero cinfo->unread_marker). * This will cause the entropy decoder to process an empty data segment, * inserting dummy zeroes, and then we will reprocess the marker. * * #2 is appropriate if we think the desired marker lies ahead, while #3 is * appropriate if the found marker is a future restart marker (indicating * that we have missed the desired restart marker, probably because it got * corrupted). * We apply #2 or #3 if the found marker is a restart marker no more than * two counts behind or ahead of the expected one. We also apply #2 if the * found marker is not a legal JPEG marker code (it's certainly bogus data). * If the found marker is a restart marker more than 2 counts away, we do #1 * (too much risk that the marker is erroneous; with luck we will be able to * resync at some future point). * For any valid non-restart JPEG marker, we apply #3. This keeps us from * overrunning the end of a scan. An implementation limited to single-scan * files might find it better to apply #2 for markers other than EOI, since * any other marker would have to be bogus data in that case. */ func Xjpeg_resync_to_restart(tls *libc.TLS, cinfo Tj_decompress_ptr, desired int32) (r Tboolean) { var action, marker int32 _, _ = action, marker marker = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker action = int32(1) /* Always put up a warning. */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_MUST_RESYNC) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = marker *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = desired (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) /* Outer loop handles repeated decision after scanning forward. */ for { if marker < int32(M_SOF0) { action = int32(2) } else { if marker < int32(M_RST0) || marker > int32(M_RST7) { action = int32(3) } else { if marker == int32(M_RST0)+(desired+int32(1))&int32(7) || marker == int32(M_RST0)+(desired+int32(2))&int32(7) { action = int32(3) } else { if marker == int32(M_RST0)+(desired-int32(1))&int32(7) || marker == int32(M_RST0)+(desired-int32(2))&int32(7) { action = int32(2) } else { action = int32(1) } } /* desired restart or too far away */ } } (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_RECOVERY_ACTION) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = marker *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 + 1*4)) = action (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(4)) switch action { case int32(1): /* Discard marker and let entropy decoder resume processing. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker = 0 return int32(TRUE1) case int32(2): /* Scan to the next marker, and repeat the decision loop. */ if !(_next_marker(tls, cinfo) != 0) { return int32(FALSE1) } marker = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker case int32(3): /* Return without advancing past this marker. */ /* Entropy decoder will be forced to process an empty segment. */ return int32(TRUE1) } goto _1 _1: } /* end loop */ return r } /* * Reset marker processing state to begin a fresh datastream. */ func _reset_marker_reader(tls *libc.TLS, cinfo Tj_decompress_ptr) { var marker Tmy_marker_ptr _ = marker marker = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info = libc.UintptrFromInt32(0) /* until allocated by get_sof */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number = 0 /* no SOS seen yet */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Funread_marker = 0 /* no pending marker */ (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fpub.Fsaw_SOI = int32(FALSE1) /* set internal state too */ (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fpub.Fsaw_SOF = int32(FALSE1) (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fpub.Fdiscarded_bytes = uint32(0) (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fcur_marker = libc.UintptrFromInt32(0) } /* * Initialize the marker reader module. * This is called only once, when the decompression object is created. */ func Xjinit_marker_reader(tls *libc.TLS, cinfo Tj_decompress_ptr) { var i int32 var marker Tmy_marker_ptr _, _ = i, marker /* Create subobject in permanent pool */ marker = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, JPOOL_PERMANENT, libc.Uint32FromInt64(172)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker = marker /* Initialize public method pointers */ (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fpub.Freset_marker_reader = __ccgo_fp(_reset_marker_reader) (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fpub.Fread_markers = __ccgo_fp(_read_markers) (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fpub.Fread_restart_marker = __ccgo_fp(_read_restart_marker) /* Initialize COM/APPn processing. * By default, we examine and then discard APP0 and APP14, * but simply discard COM and all other APPn. */ (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fprocess_COM = __ccgo_fp(_skip_variable) (*Tmy_marker_reader)(unsafe.Pointer(marker)).Flength_limit_COM = uint32(0) i = 0 for { if !(i < int32(16)) { break } *(*Tjpeg_marker_parser_method)(unsafe.Pointer(marker + 32 + uintptr(i)*4)) = __ccgo_fp(_skip_variable) *(*uint32)(unsafe.Pointer(marker + 100 + uintptr(i)*4)) = uint32(0) goto _1 _1: ; i++ } *(*Tjpeg_marker_parser_method)(unsafe.Pointer(marker + 32)) = __ccgo_fp(_get_interesting_appn) *(*Tjpeg_marker_parser_method)(unsafe.Pointer(marker + 32 + 14*4)) = __ccgo_fp(_get_interesting_appn) /* Reset marker processing state */ _reset_marker_reader(tls, cinfo) } /* * Control saving of COM and APPn markers into marker_list. */ func Xjpeg_save_markers(tls *libc.TLS, cinfo Tj_decompress_ptr, marker_code int32, length_limit uint32) { var marker Tmy_marker_ptr var maxlength int32 var processor Tjpeg_marker_parser_method _, _, _ = marker, maxlength, processor marker = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker /* Length limit mustn't be larger than what we can allocate * (should only be a concern in a 16-bit environment). */ maxlength = libc.Int32FromUint32(libc.Uint32FromInt32((*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Fmax_alloc_chunk) - libc.Uint32FromInt64(20)) if libc.Int32FromUint32(length_limit) > maxlength { length_limit = libc.Uint32FromInt32(maxlength) } /* Choose processor routine to use. * APP0/APP14 have special requirements. */ if length_limit != 0 { processor = __ccgo_fp(_save_marker) /* If saving APP0/APP14, save at least enough for our internal use. */ if marker_code == int32(M_APP0) && length_limit < uint32(APP0_DATA_LEN) { length_limit = uint32(APP0_DATA_LEN) } else { if marker_code == int32(M_APP14) && length_limit < uint32(APP14_DATA_LEN) { length_limit = uint32(APP14_DATA_LEN) } } } else { processor = __ccgo_fp(_skip_variable) /* If discarding APP0/APP14, use our regular on-the-fly processor. */ if marker_code == int32(M_APP0) || marker_code == int32(M_APP14) { processor = __ccgo_fp(_get_interesting_appn) } } if marker_code == int32(M_COM) { (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fprocess_COM = processor (*Tmy_marker_reader)(unsafe.Pointer(marker)).Flength_limit_COM = length_limit } else { if marker_code >= int32(M_APP0) && marker_code <= int32(M_APP15) { *(*Tjpeg_marker_parser_method)(unsafe.Pointer(marker + 32 + uintptr(marker_code-int32(M_APP0))*4)) = processor *(*uint32)(unsafe.Pointer(marker + 100 + uintptr(marker_code-int32(M_APP0))*4)) = length_limit } else { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_UNKNOWN_MARKER) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = marker_code (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } } /* * Install a special processing method for COM or APPn markers. */ func Xjpeg_set_marker_processor(tls *libc.TLS, cinfo Tj_decompress_ptr, marker_code int32, routine Tjpeg_marker_parser_method) { var marker Tmy_marker_ptr _ = marker marker = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmarker if marker_code == int32(M_COM) { (*Tmy_marker_reader)(unsafe.Pointer(marker)).Fprocess_COM = routine } else { if marker_code >= int32(M_APP0) && marker_code <= int32(M_APP15) { *(*Tjpeg_marker_parser_method)(unsafe.Pointer(marker + 32 + uintptr(marker_code-int32(M_APP0))*4)) = routine } else { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_UNKNOWN_MARKER) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = marker_code (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Private state */ type Tmy_decomp_master = struct { Fpub Tjpeg_decomp_master Fpass_number int32 Fusing_merged_upsample Tboolean Fquantizer_1pass uintptr Fquantizer_2pass uintptr } /* * Determine whether merged upsample/color conversion should be used. * CRUCIAL: this must match the actual capabilities of jdmerge.c! */ func _use_merged_upsample(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { /* Merging is the equivalent of plain box-filter upsampling. */ /* The following condition is only needed if fancy shall select * a different upsampling method. In our current implementation * fancy only affects the DCT scaling, thus we can use fancy * upsampling and merged upsample simultaneously, in particular * with scaled DCT sizes larger than the default DCTSIZE. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FCCIR601_sampling != 0 { return int32(FALSE1) } /* jdmerge.c only supports YCC=>RGB color conversion */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space != int32(JCS_YCbCr) && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space != int32(JCS_BG_YCC) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components != int32(3) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_space != int32(JCS_RGB) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components != int32(RGB_PIXELSIZE) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolor_transform != 0 { return int32(FALSE1) } /* and it only handles 2h1v or 2h2v sampling ratios */ if (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info))).Fh_samp_factor != int32(2) || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).Fh_samp_factor != int32(1) || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).Fh_samp_factor != int32(1) || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info))).Fv_samp_factor > int32(2) || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).Fv_samp_factor != int32(1) || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).Fv_samp_factor != int32(1) { return int32(FALSE1) } /* furthermore, it doesn't work if we've scaled the IDCTs differently */ if (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info))).FDCT_h_scaled_size != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).FDCT_h_scaled_size != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).FDCT_h_scaled_size != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info))).FDCT_v_scaled_size != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 1*88))).FDCT_v_scaled_size != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size || (*(*Tjpeg_component_info)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info + 2*88))).FDCT_v_scaled_size != (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size { return int32(FALSE1) } /* ??? also need to test for upsample-time rescaling, when & if supported */ return int32(TRUE1) /* by golly, it'll work... */ } /* * Compute output image dimensions and related values. * NOTE: this is exported for possible use by application. * Hence it mustn't do anything that can't be done twice. * Also note that it may be called before the master module is initialized! */ func Xjpeg_calc_output_dimensions(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Do computations that are needed before master selection phase. * This function is used for full decompression. */ var ci, i, ssize, v2, v3, v5 int32 var compptr uintptr _, _, _, _, _, _, _ = ci, compptr, i, ssize, v2, v3, v5 /* Prevent application from calling me at wrong times */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state != int32(DSTATE_READY) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Compute core output image dimensions and DCT scaling choices. */ Xjpeg_core_output_dimensions(tls, cinfo) /* In selecting the actual DCT scaling for each component, we try to * scale up the chroma components via IDCT scaling rather than upsampling. * This saves time if the upsampler gets to use 1:1 scaling. * Note this code adapts subsampling ratios which are powers of 2. */ ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } ssize = int32(1) if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fraw_data_out != 0) { for { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdo_fancy_upsampling != 0 { v2 = int32(DCTSIZE) } else { v2 = libc.Int32FromInt32(DCTSIZE) / libc.Int32FromInt32(2) } if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size*ssize <= v2 && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor%((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor*ssize*int32(2)) == 0) { break } ssize = ssize * int32(2) } } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size * ssize ssize = int32(1) if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fraw_data_out != 0) { for { if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdo_fancy_upsampling != 0 { v3 = int32(DCTSIZE) } else { v3 = libc.Int32FromInt32(DCTSIZE) / libc.Int32FromInt32(2) } if !((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size*ssize <= v3 && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor%((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor*ssize*int32(2)) == 0) { break } ssize = ssize * int32(2) } } (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size * ssize /* We don't support IDCT ratios larger than 2. */ if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size > (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size*int32(2) { (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size * int32(2) } else { if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size > (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size*int32(2) { (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size * int32(2) } } /* Recompute downsampled dimensions of components; * application needs to know these if using raw downsampled data. */ /* Size in samples, after IDCT scaling */ (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdownsampled_width = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_width)*((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor*(*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdownsampled_height = libc.Uint32FromInt32(Xjdiv_round_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fimage_height)*((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor*(*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor*(*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fblock_size)) goto _1 _1: ; ci++ compptr += 88 } /* Report number of components in selected colorspace. */ /* This should correspond to the actual code in the color conversion module. */ switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_space { case int32(JCS_GRAYSCALE): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components = int32(1) case int32(JCS_RGB): fallthrough case int32(JCS_BG_RGB): (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components = int32(RGB_PIXELSIZE) default: /* YCCK <=> CMYK conversion or same colorspace as in file */ i = 0 ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0 { i++ } goto _4 _4: ; ci++ compptr += 88 } /* count output color components */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components = i } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fquantize_colors != 0 { v5 = int32(1) } else { v5 = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_components = v5 /* See if upsampler will want to emit more than one row at a time */ if _use_merged_upsample(tls, cinfo) != 0 { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frec_outbuf_height = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor } else { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Frec_outbuf_height = int32(1) } } /* * Several decompression processes need to range-limit values to the range * 0..MAXJSAMPLE; the input value may fall somewhat outside this range * due to noise introduced by quantization, roundoff error, etc. These * processes are inner loops and need to be as fast as possible. On most * machines, particularly CPUs with pipelines or instruction prefetch, * a (subscript-check-less) C table lookup * x = sample_range_limit[x]; * is faster than explicit tests * if (x < 0) x = 0; * else if (x > MAXJSAMPLE) x = MAXJSAMPLE; * These processes all use a common table prepared by the routine below. * * For most steps we can mathematically guarantee that the initial value * of x is within 2*(MAXJSAMPLE+1) of the legal range, so a table running * from -2*(MAXJSAMPLE+1) to 3*MAXJSAMPLE+2 is sufficient. But for the * initial limiting step (just after the IDCT), a wildly out-of-range value * is possible if the input data is corrupt. To avoid any chance of indexing * off the end of memory and getting a bad-pointer trap, we perform the * post-IDCT limiting thus: * x = (sample_range_limit - SUBSET)[(x + CENTER) & MASK]; * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit * samples. Under normal circumstances this is more than enough range and * a correct output will be generated; with bogus input data the mask will * cause wraparound, and we will safely generate a bogus-but-in-range output. * For the post-IDCT step, we want to convert the data from signed to unsigned * representation by adding CENTERJSAMPLE at the same time that we limit it. * This is accomplished with SUBSET = CENTER - CENTERJSAMPLE. * * Note that the table is allocated in near data space on PCs; it's small * enough and used often enough to justify this. */ func _prepare_range_limit_table(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Allocate and fill in the sample_range_limit table */ var i int32 var table uintptr _, _ = i, table table = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(CENTERJSAMPLE)< MAXJSAMPLE */ for { if !(i <= libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(CENTERJSAMPLE)<RGB and BG_YCC->RGB colorspace conversion. * This is taken directly from jdcolor.c; see that file for more info. */ func _build_ycc_rgb_table1(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Normal case, sYCC */ var i int32 var upsample Tmy_upsample_ptr var x TINT32 _, _, _ = i, upsample, x upsample = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCr_r_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCb_b_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCr_g_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCb_g_tab = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) i = 0 x = -libc.Int32FromInt32(CENTERJSAMPLE) for { if !(i <= int32(MAXJSAMPLE)) { break } /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ /* Cr=>R value is nearest int to 1.402 * x */ *(*int32)(unsafe.Pointer((*Tmy_upsampler)(unsafe.Pointer(upsample)).FCr_r_tab + uintptr(i)*4)) = (int32(libc.Float64FromFloat64(1.402)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(SCALEBITS) /* Cb=>B value is nearest int to 1.772 * x */ *(*int32)(unsafe.Pointer((*Tmy_upsampler)(unsafe.Pointer(upsample)).FCb_b_tab + uintptr(i)*4)) = (int32(libc.Float64FromFloat64(1.772)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(SCALEBITS) /* Cr=>G value is scaled-up -0.714136286 * x */ *(*TINT32)(unsafe.Pointer((*Tmy_upsampler)(unsafe.Pointer(upsample)).FCr_g_tab + uintptr(i)*4)) = -int32(libc.Float64FromFloat64(0.714136286)*float64(libc.Int32FromInt32(1)<G value is scaled-up -0.344136286 * x */ /* We also add in ONE_HALF so that need not do it in inner loop */ *(*TINT32)(unsafe.Pointer((*Tmy_upsampler)(unsafe.Pointer(upsample)).FCb_g_tab + uintptr(i)*4)) = -int32(libc.Float64FromFloat64(0.344136286)*float64(libc.Int32FromInt32(1)<R value is nearest int to 2.804 * x */ *(*int32)(unsafe.Pointer((*Tmy_upsampler)(unsafe.Pointer(upsample)).FCr_r_tab + uintptr(i)*4)) = (int32(libc.Float64FromFloat64(2.804)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(SCALEBITS) /* Cb=>B value is nearest int to 3.544 * x */ *(*int32)(unsafe.Pointer((*Tmy_upsampler)(unsafe.Pointer(upsample)).FCb_b_tab + uintptr(i)*4)) = (int32(libc.Float64FromFloat64(3.544)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(SCALEBITS) /* Cr=>G value is scaled-up -1.428272572 * x */ *(*TINT32)(unsafe.Pointer((*Tmy_upsampler)(unsafe.Pointer(upsample)).FCr_g_tab + uintptr(i)*4)) = -int32(libc.Float64FromFloat64(1.428272572)*float64(libc.Int32FromInt32(1)<G value is scaled-up -0.688272572 * x */ /* We also add in ONE_HALF so that need not do it in inner loop */ *(*TINT32)(unsafe.Pointer((*Tmy_upsampler)(unsafe.Pointer(upsample)).FCb_g_tab + uintptr(i)*4)) = -int32(libc.Float64FromFloat64(0.688272572)*float64(libc.Int32FromInt32(1)< (*Tmy_upsampler)(unsafe.Pointer(upsample)).Frows_to_go { num_rows = (*Tmy_upsampler)(unsafe.Pointer(upsample)).Frows_to_go } /* And not more than what the client can accept: */ out_rows_avail -= *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)) if num_rows > out_rows_avail { num_rows = out_rows_avail } /* Create output pointer array for upsampler. */ (*(*[2]TJSAMPROW)(unsafe.Pointer(bp)))[0] = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(*(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)))*4)) if num_rows > uint32(1) { (*(*[2]TJSAMPROW)(unsafe.Pointer(bp)))[int32(1)] = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(*(*TJDIMENSION)(unsafe.Pointer(out_row_ctr))+uint32(1))*4)) } else { (*(*[2]TJSAMPROW)(unsafe.Pointer(bp)))[int32(1)] = (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fspare_row (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fspare_full = int32(TRUE1) } /* Now do the upsampling. */ (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE, TJDIMENSION, TJSAMPARRAY))(unsafe.Pointer(&struct{ uintptr }{(*Tmy_upsampler)(unsafe.Pointer(upsample)).Fupmethod})))(tls, cinfo, input_buf, *(*TJDIMENSION)(unsafe.Pointer(in_row_group_ctr)), bp) } /* Adjust counts */ *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)) += num_rows *(*TJDIMENSION)(unsafe.Pointer(upsample + 44)) -= num_rows /* When the buffer is emptied, declare this input row group consumed */ if !((*Tmy_upsampler)(unsafe.Pointer(upsample)).Fspare_full != 0) { *(*TJDIMENSION)(unsafe.Pointer(in_row_group_ctr))++ } } func _merged_1v_upsample(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, in_row_group_ctr uintptr, in_row_groups_avail TJDIMENSION, output_buf TJSAMPARRAY, out_row_ctr uintptr, out_rows_avail TJDIMENSION) { /* 1:1 vertical sampling case: much easier, never need a spare row. */ var upsample Tmy_upsample_ptr _ = upsample upsample = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample /* Just do the upsampling. */ (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE, TJDIMENSION, TJSAMPARRAY))(unsafe.Pointer(&struct{ uintptr }{(*Tmy_upsampler)(unsafe.Pointer(upsample)).Fupmethod})))(tls, cinfo, input_buf, *(*TJDIMENSION)(unsafe.Pointer(in_row_group_ctr)), output_buf+uintptr(*(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)))*4) /* Adjust counts */ *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr))++ *(*TJDIMENSION)(unsafe.Pointer(in_row_group_ctr))++ } /* * These are the routines invoked by the control routines to do * the actual upsampling/conversion. One row group is processed per call. * * Note: since we may be writing directly into application-supplied buffers, * we have to be honest about the output width; we can't assume the buffer * has been rounded up to an even width. */ /* * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. */ func _h2v1_merged_upsample(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, in_row_group_ctr TJDIMENSION, output_buf TJSAMPARRAY) { var Cbbtab, Cbgtab, Crgtab, Crrtab, range_limit uintptr var cb, cblue, cgreen, cr, cred, y int32 var col TJDIMENSION var inptr0, inptr1, inptr2, outptr, v2, v3, v4, v5 TJSAMPROW var upsample Tmy_upsample_ptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Cbbtab, Cbgtab, Crgtab, Crrtab, cb, cblue, cgreen, col, cr, cred, inptr0, inptr1, inptr2, outptr, range_limit, upsample, y, v2, v3, v4, v5 upsample = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample /* copy these pointers into registers if possible */ range_limit = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsample_range_limit Crrtab = (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCr_r_tab Cbbtab = (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCb_b_tab Crgtab = (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCr_g_tab Cbgtab = (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCb_g_tab inptr0 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(in_row_group_ctr)*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 1*4)) + uintptr(in_row_group_ctr)*4)) inptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 2*4)) + uintptr(in_row_group_ctr)*4)) outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf)) /* Loop for each pair of output pixels */ col = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width >> int32(1) for { if !(col > uint32(0)) { break } /* Do the chroma part of the calculation */ v2 = inptr1 inptr1++ cb = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v2))) v3 = inptr2 inptr2++ cr = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v3))) cgreen = (*(*TINT32)(unsafe.Pointer(Cbgtab + uintptr(cb)*4)) + *(*TINT32)(unsafe.Pointer(Crgtab + uintptr(cr)*4))) >> libc.Int32FromInt32(SCALEBITS) cblue = *(*int32)(unsafe.Pointer(Cbbtab + uintptr(cb)*4)) cred = *(*int32)(unsafe.Pointer(Crrtab + uintptr(cr)*4)) /* Fetch 2 Y values and emit 2 pixels */ v4 = inptr0 inptr0++ y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v4))) *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cred))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cgreen))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cblue))) outptr += uintptr(RGB_PIXELSIZE) v5 = inptr0 inptr0++ y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v5))) *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cred))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cgreen))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cblue))) outptr += uintptr(RGB_PIXELSIZE) goto _1 _1: ; col-- } /* If image width is odd, do the last output column separately */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width&uint32(1) != 0 { y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr0))) cb = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1))) cr = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr2))) *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+*(*int32)(unsafe.Pointer(Crrtab + uintptr(cr)*4))))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+(*(*TINT32)(unsafe.Pointer(Cbgtab + uintptr(cb)*4))+*(*TINT32)(unsafe.Pointer(Crgtab + uintptr(cr)*4)))>>libc.Int32FromInt32(SCALEBITS)))) *(*TJSAMPLE)(unsafe.Pointer(outptr + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+*(*int32)(unsafe.Pointer(Cbbtab + uintptr(cb)*4))))) } } /* * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. */ func _h2v2_merged_upsample(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, in_row_group_ctr TJDIMENSION, output_buf TJSAMPARRAY) { var Cbbtab, Cbgtab, Crgtab, Crrtab, range_limit uintptr var cb, cblue, cgreen, cr, cred, y int32 var col TJDIMENSION var inptr00, inptr01, inptr1, inptr2, outptr0, outptr1, v2, v3, v4, v5, v6, v7 TJSAMPROW var upsample Tmy_upsample_ptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Cbbtab, Cbgtab, Crgtab, Crrtab, cb, cblue, cgreen, col, cr, cred, inptr00, inptr01, inptr1, inptr2, outptr0, outptr1, range_limit, upsample, y, v2, v3, v4, v5, v6, v7 upsample = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample /* copy these pointers into registers if possible */ range_limit = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsample_range_limit Crrtab = (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCr_r_tab Cbbtab = (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCb_b_tab Crgtab = (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCr_g_tab Cbgtab = (*Tmy_upsampler)(unsafe.Pointer(upsample)).FCb_g_tab inptr00 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(in_row_group_ctr*uint32(2))*4)) inptr01 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf)) + uintptr(in_row_group_ctr*uint32(2)+uint32(1))*4)) inptr1 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 1*4)) + uintptr(in_row_group_ctr)*4)) inptr2 = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(input_buf + 2*4)) + uintptr(in_row_group_ctr)*4)) outptr0 = *(*TJSAMPROW)(unsafe.Pointer(output_buf)) outptr1 = *(*TJSAMPROW)(unsafe.Pointer(output_buf + 1*4)) /* Loop for each group of output pixels */ col = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width >> int32(1) for { if !(col > uint32(0)) { break } /* Do the chroma part of the calculation */ v2 = inptr1 inptr1++ cb = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v2))) v3 = inptr2 inptr2++ cr = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v3))) cgreen = (*(*TINT32)(unsafe.Pointer(Cbgtab + uintptr(cb)*4)) + *(*TINT32)(unsafe.Pointer(Crgtab + uintptr(cr)*4))) >> libc.Int32FromInt32(SCALEBITS) cblue = *(*int32)(unsafe.Pointer(Cbbtab + uintptr(cb)*4)) cred = *(*int32)(unsafe.Pointer(Crrtab + uintptr(cr)*4)) /* Fetch 4 Y values and emit 4 pixels */ v4 = inptr00 inptr00++ y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v4))) *(*TJSAMPLE)(unsafe.Pointer(outptr0)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cred))) *(*TJSAMPLE)(unsafe.Pointer(outptr0 + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cgreen))) *(*TJSAMPLE)(unsafe.Pointer(outptr0 + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cblue))) outptr0 += uintptr(RGB_PIXELSIZE) v5 = inptr00 inptr00++ y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v5))) *(*TJSAMPLE)(unsafe.Pointer(outptr0)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cred))) *(*TJSAMPLE)(unsafe.Pointer(outptr0 + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cgreen))) *(*TJSAMPLE)(unsafe.Pointer(outptr0 + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cblue))) outptr0 += uintptr(RGB_PIXELSIZE) v6 = inptr01 inptr01++ y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v6))) *(*TJSAMPLE)(unsafe.Pointer(outptr1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cred))) *(*TJSAMPLE)(unsafe.Pointer(outptr1 + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cgreen))) *(*TJSAMPLE)(unsafe.Pointer(outptr1 + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cblue))) outptr1 += uintptr(RGB_PIXELSIZE) v7 = inptr01 inptr01++ y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v7))) *(*TJSAMPLE)(unsafe.Pointer(outptr1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cred))) *(*TJSAMPLE)(unsafe.Pointer(outptr1 + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cgreen))) *(*TJSAMPLE)(unsafe.Pointer(outptr1 + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cblue))) outptr1 += uintptr(RGB_PIXELSIZE) goto _1 _1: ; col-- } /* If image width is odd, do the last output column separately */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width&uint32(1) != 0 { cb = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr1))) cr = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr2))) cgreen = (*(*TINT32)(unsafe.Pointer(Cbgtab + uintptr(cb)*4)) + *(*TINT32)(unsafe.Pointer(Crgtab + uintptr(cr)*4))) >> libc.Int32FromInt32(SCALEBITS) cblue = *(*int32)(unsafe.Pointer(Cbbtab + uintptr(cb)*4)) cred = *(*int32)(unsafe.Pointer(Crrtab + uintptr(cr)*4)) y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr00))) *(*TJSAMPLE)(unsafe.Pointer(outptr0)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cred))) *(*TJSAMPLE)(unsafe.Pointer(outptr0 + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cgreen))) *(*TJSAMPLE)(unsafe.Pointer(outptr0 + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cblue))) y = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr01))) *(*TJSAMPLE)(unsafe.Pointer(outptr1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cred))) *(*TJSAMPLE)(unsafe.Pointer(outptr1 + 1)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cgreen))) *(*TJSAMPLE)(unsafe.Pointer(outptr1 + 2)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(y+cblue))) } } /* * Module initialization routine for merged upsampling/color conversion. * * NB: this is called under the conditions determined by use_merged_upsample() * in jdmaster.c. That routine MUST correspond to the actual capabilities * of this module; no safety checks are made here. */ func Xjinit_merged_upsampler(tls *libc.TLS, cinfo Tj_decompress_ptr) { var upsample Tmy_upsample_ptr _ = upsample upsample = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(48)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample = upsample (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_merged_upsample) (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fpub.Fneed_context_rows = int32(FALSE1) (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fout_row_width = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width * libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components) if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor == int32(2) { (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fpub.Fupsample = __ccgo_fp(_merged_2v_upsample) (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fupmethod = __ccgo_fp(_h2v2_merged_upsample) /* Allocate a spare row buffer */ (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fspare_row = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_large})))(tls, cinfo, int32(JPOOL_IMAGE), (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fout_row_width*libc.Uint32FromInt64(1)) } else { (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fpub.Fupsample = __ccgo_fp(_merged_1v_upsample) (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fupmethod = __ccgo_fp(_h2v1_merged_upsample) /* No spare row needed */ (*Tmy_upsampler)(unsafe.Pointer(upsample)).Fspare_row = libc.UintptrFromInt32(0) } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fjpeg_color_space == int32(JCS_BG_YCC) { _build_bg_ycc_rgb_table1(tls, cinfo) } else { _build_ycc_rgb_table1(tls, cinfo) } } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* Private buffer controller object */ type Tmy_post_controller = struct { Fpub Tjpeg_d_post_controller Fwhole_image Tjvirt_sarray_ptr Fbuffer TJSAMPARRAY Fstrip_height TJDIMENSION Fstarting_row TJDIMENSION Fnext_row TJDIMENSION } type Tmy_post_ptr = uintptr /* * Initialize for a processing pass. */ func _start_pass_dpost(tls *libc.TLS, cinfo Tj_decompress_ptr, pass_mode TJ_BUF_MODE) { var post Tmy_post_ptr var v1 TJDIMENSION _, _ = post, v1 post = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fpost switch pass_mode { case int32(JBUF_PASS_THRU): if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fquantize_colors != 0 { /* Single-pass processing with color quantization. */ (*Tmy_post_controller)(unsafe.Pointer(post)).Fpub.Fpost_process_data = __ccgo_fp(_post_process_1pass) /* We could be doing buffered-image output before starting a 2-pass * color quantization; in that case, jinit_d_post_controller did not * allocate a strip buffer. Use the virtual-array buffer as workspace. */ if (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer == libc.UintptrFromInt32(0) { (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer = (*(*func(*libc.TLS, Tj_common_ptr, Tjvirt_sarray_ptr, TJDIMENSION, TJDIMENSION, Tboolean) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Faccess_virt_sarray})))(tls, cinfo, (*Tmy_post_controller)(unsafe.Pointer(post)).Fwhole_image, libc.Uint32FromInt32(0), (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height, int32(TRUE1)) } } else { /* For single-pass processing without color quantization, * I have no work to do; just call the upsampler directly. */ (*Tmy_post_controller)(unsafe.Pointer(post)).Fpub.Fpost_process_data = (*Tjpeg_upsampler)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample)).Fupsample } case int32(JBUF_SAVE_AND_PASS): /* First pass of 2-pass quantization */ if (*Tmy_post_controller)(unsafe.Pointer(post)).Fwhole_image == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_post_controller)(unsafe.Pointer(post)).Fpub.Fpost_process_data = __ccgo_fp(_post_process_prepass) case int32(JBUF_CRANK_DEST): /* Second pass of 2-pass quantization */ if (*Tmy_post_controller)(unsafe.Pointer(post)).Fwhole_image == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_post_controller)(unsafe.Pointer(post)).Fpub.Fpost_process_data = __ccgo_fp(_post_process_2pass) default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_BUFFER_MODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) break } v1 = libc.Uint32FromInt32(0) (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row = v1 (*Tmy_post_controller)(unsafe.Pointer(post)).Fstarting_row = v1 } /* * Process some data in the one-pass (strip buffer) case. * This is used for color precision reduction as well as one-pass quantization. */ func _post_process_1pass(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, in_row_group_ctr uintptr, in_row_groups_avail TJDIMENSION, output_buf TJSAMPARRAY, out_row_ctr uintptr, out_rows_avail TJDIMENSION) { bp := tls.Alloc(16) defer tls.Free(16) var max_rows TJDIMENSION var post Tmy_post_ptr var _ /* num_rows at bp+0 */ TJDIMENSION _, _ = max_rows, post post = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fpost /* Fill the buffer, but not more than what we can dump out in one go. */ /* Note we rely on the upsampler to detect bottom of image. */ max_rows = out_rows_avail - *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)) if max_rows > (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height { max_rows = (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height } *(*TJDIMENSION)(unsafe.Pointer(bp)) = uint32(0) (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE, uintptr, TJDIMENSION, TJSAMPARRAY, uintptr, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_upsampler)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample)).Fupsample})))(tls, cinfo, input_buf, in_row_group_ctr, in_row_groups_avail, (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer, bp, max_rows) /* Quantize and emit data. */ (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPARRAY, TJSAMPARRAY, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_color_quantizer)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize)).Fcolor_quantize})))(tls, cinfo, (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer, output_buf+uintptr(*(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)))*4, libc.Int32FromUint32(*(*TJDIMENSION)(unsafe.Pointer(bp)))) *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)) += *(*TJDIMENSION)(unsafe.Pointer(bp)) } /* * Process some data in the first pass of 2-pass quantization. */ func _post_process_prepass(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, in_row_group_ctr uintptr, in_row_groups_avail TJDIMENSION, output_buf TJSAMPARRAY, out_row_ctr uintptr, out_rows_avail TJDIMENSION) { var num_rows, old_next_row TJDIMENSION var post Tmy_post_ptr _, _, _ = num_rows, old_next_row, post post = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fpost /* Reposition virtual buffer if at start of strip. */ if (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row == uint32(0) { (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer = (*(*func(*libc.TLS, Tj_common_ptr, Tjvirt_sarray_ptr, TJDIMENSION, TJDIMENSION, Tboolean) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Faccess_virt_sarray})))(tls, cinfo, (*Tmy_post_controller)(unsafe.Pointer(post)).Fwhole_image, (*Tmy_post_controller)(unsafe.Pointer(post)).Fstarting_row, (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height, int32(TRUE1)) } /* Upsample some data (up to a strip height's worth). */ old_next_row = (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE, uintptr, TJDIMENSION, TJSAMPARRAY, uintptr, TJDIMENSION))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_upsampler)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample)).Fupsample})))(tls, cinfo, input_buf, in_row_group_ctr, in_row_groups_avail, (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer, post+24, (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height) /* Allow quantizer to scan new data. No data is emitted, */ /* but we advance out_row_ctr so outer loop can tell when we're done. */ if (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row > old_next_row { num_rows = (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row - old_next_row (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPARRAY, TJSAMPARRAY, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_color_quantizer)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize)).Fcolor_quantize})))(tls, cinfo, (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer+uintptr(old_next_row)*4, libc.UintptrFromInt32(0), libc.Int32FromUint32(num_rows)) *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)) += num_rows } /* Advance if we filled the strip. */ if (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row >= (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height { *(*TJDIMENSION)(unsafe.Pointer(post + 20)) += (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row = uint32(0) } } /* * Process some data in the second pass of 2-pass quantization. */ func _post_process_2pass(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, in_row_group_ctr uintptr, in_row_groups_avail TJDIMENSION, output_buf TJSAMPARRAY, out_row_ctr uintptr, out_rows_avail TJDIMENSION) { var max_rows, num_rows TJDIMENSION var post Tmy_post_ptr _, _, _ = max_rows, num_rows, post post = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fpost /* Reposition virtual buffer if at start of strip. */ if (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row == uint32(0) { (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer = (*(*func(*libc.TLS, Tj_common_ptr, Tjvirt_sarray_ptr, TJDIMENSION, TJDIMENSION, Tboolean) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Faccess_virt_sarray})))(tls, cinfo, (*Tmy_post_controller)(unsafe.Pointer(post)).Fwhole_image, (*Tmy_post_controller)(unsafe.Pointer(post)).Fstarting_row, (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height, int32(FALSE1)) } /* Determine number of rows to emit. */ num_rows = (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height - (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row /* available in strip */ max_rows = out_rows_avail - *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)) /* available in output area */ if num_rows > max_rows { num_rows = max_rows } /* We have to check bottom of image here, can't depend on upsampler. */ max_rows = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height - (*Tmy_post_controller)(unsafe.Pointer(post)).Fstarting_row if num_rows > max_rows { num_rows = max_rows } /* Quantize and emit data. */ (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPARRAY, TJSAMPARRAY, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_color_quantizer)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize)).Fcolor_quantize})))(tls, cinfo, (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer+uintptr((*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row)*4, output_buf+uintptr(*(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)))*4, libc.Int32FromUint32(num_rows)) *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)) += num_rows /* Advance if we filled the strip. */ *(*TJDIMENSION)(unsafe.Pointer(post + 24)) += num_rows if (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row >= (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height { *(*TJDIMENSION)(unsafe.Pointer(post + 20)) += (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height (*Tmy_post_controller)(unsafe.Pointer(post)).Fnext_row = uint32(0) } } /* * Initialize postprocessing controller. */ func Xjinit_d_post_controller(tls *libc.TLS, cinfo Tj_decompress_ptr, need_full_buffer Tboolean) { var post Tmy_post_ptr _ = post post = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(28)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fpost = post (*Tmy_post_controller)(unsafe.Pointer(post)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_dpost) (*Tmy_post_controller)(unsafe.Pointer(post)).Fwhole_image = libc.UintptrFromInt32(0) /* flag for no virtual arrays */ (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer = libc.UintptrFromInt32(0) /* flag for no strip buffer */ /* Create the quantization buffer, if needed */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fquantize_colors != 0 { /* The buffer strip height is max_v_samp_factor, which is typically * an efficient number of rows for upsampling to return. * (In the presence of output rescaling, we might want to be smarter?) */ (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height = libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor) if need_full_buffer != 0 { /* Two-pass color quantization: need full-image storage. */ /* We round up the number of rows to a multiple of the strip height. */ (*Tmy_post_controller)(unsafe.Pointer(post)).Fwhole_image = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tboolean, TJDIMENSION, TJDIMENSION, TJDIMENSION) Tjvirt_sarray_ptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Frequest_virt_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), int32(FALSE1), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components), libc.Uint32FromInt32(Xjround_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height), libc.Int32FromUint32((*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height))), (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height) } else { /* One-pass color quantization: just make a strip buffer. */ (*Tmy_post_controller)(unsafe.Pointer(post)).Fbuffer = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width*libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components), (*Tmy_post_controller)(unsafe.Pointer(post)).Fstrip_height) } } } /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ // C documentation // // /* Pointer to routine to upsample a single component */ type Tupsample1_ptr = uintptr /* Private subobject */ type Tmy_upsampler1 = struct { Fpub Tjpeg_upsampler Fcolor_buf [10]TJSAMPARRAY Fmethods [10]Tupsample1_ptr Fnext_row_out int32 Frows_to_go TJDIMENSION Frowgroup_height [10]int32 Fh_expand [10]TUINT8 Fv_expand [10]TUINT8 } /* * Initialize for an upsampling pass. */ func _start_pass_upsample(tls *libc.TLS, cinfo Tj_decompress_ptr) { var upsample Tmy_upsample_ptr _ = upsample upsample = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample /* Mark the conversion buffer empty */ (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Fnext_row_out = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor /* Initialize total-height counter for detecting bottom of image */ (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Frows_to_go = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_height } /* * Control routine to do upsampling (and color conversion). * * In this version we upsample each component independently. * We upsample one row group into the conversion buffer, then apply * color conversion a row at a time. */ func _sep_upsample(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPIMAGE, in_row_group_ctr uintptr, in_row_groups_avail TJDIMENSION, output_buf TJSAMPARRAY, out_row_ctr uintptr, out_rows_avail TJDIMENSION) { var ci int32 var compptr, p2 uintptr var num_rows TJDIMENSION var upsample Tmy_upsample_ptr _, _, _, _, _ = ci, compptr, num_rows, upsample, p2 upsample = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample /* Fill the conversion buffer, if it's empty */ if (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Fnext_row_out >= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor { ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Don't bother to upsample an uninteresting component. */ if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { goto _1 } /* Invoke per-component upsample method. Notice we pass a POINTER * to color_buf[ci], so that fullsize_upsample can change it. */ (*(*func(*libc.TLS, Tj_decompress_ptr, uintptr, TJSAMPARRAY, TJSAMPIMAGE))(unsafe.Pointer(&struct{ uintptr }{*(*Tupsample1_ptr)(unsafe.Pointer(upsample + 52 + uintptr(ci)*4))})))(tls, cinfo, compptr, *(*TJSAMPARRAY)(unsafe.Pointer(input_buf + uintptr(ci)*4))+uintptr(*(*TJDIMENSION)(unsafe.Pointer(in_row_group_ctr))*libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(upsample + 100 + uintptr(ci)*4))))*4, upsample+12+uintptr(ci)*4) goto _1 _1: ; ci++ compptr += 88 } (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Fnext_row_out = 0 } /* Color-convert and emit rows */ /* How many we have in the buffer: */ num_rows = libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor - (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Fnext_row_out) /* Not more than the distance to the end of the image. Need this test * in case the image height is not a multiple of max_v_samp_factor: */ if num_rows > (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Frows_to_go { num_rows = (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Frows_to_go } /* And not more than what the client can accept: */ out_rows_avail -= *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)) if num_rows > out_rows_avail { num_rows = out_rows_avail } (*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE, TJDIMENSION, TJSAMPARRAY, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_color_deconverter)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcconvert)).Fcolor_convert})))(tls, cinfo, upsample+12, libc.Uint32FromInt32((*Tmy_upsampler1)(unsafe.Pointer(upsample)).Fnext_row_out), output_buf+uintptr(*(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)))*4, libc.Int32FromUint32(num_rows)) /* Adjust counts */ *(*TJDIMENSION)(unsafe.Pointer(out_row_ctr)) += num_rows *(*TJDIMENSION)(unsafe.Pointer(upsample + 96)) -= num_rows p2 = upsample + 92 *(*int32)(unsafe.Pointer(p2)) = int32(uint32(*(*int32)(unsafe.Pointer(p2))) + num_rows) /* When the buffer is emptied, declare this input row group consumed */ if (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Fnext_row_out >= (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor { *(*TJDIMENSION)(unsafe.Pointer(in_row_group_ctr))++ } } /* * These are the routines invoked by sep_upsample to upsample pixel values * of a single component. One row group is processed per call. */ /* * For full-size components, we just make color_buf[ci] point at the * input buffer, and thus avoid copying any data. Note that this is * safe only because sep_upsample doesn't declare the input row group * "consumed" until we are done color converting and emitting it. */ func _fullsize_upsample(tls *libc.TLS, cinfo Tj_decompress_ptr, compptr uintptr, input_data TJSAMPARRAY, output_data_ptr TJSAMPIMAGE) { *(*TJSAMPARRAY)(unsafe.Pointer(output_data_ptr)) = input_data } /* * This version handles any integral sampling ratios. * This is not used for typical JPEG files, so it need not be fast. * Nor, for that matter, is it particularly accurate: the algorithm is * simple replication of the input pixel onto the corresponding output * pixels. The hi-falutin sampling literature refers to this as a * "box filter". A box filter tends to introduce visible artifacts, * so if you are actually going to use 3:1 or 4:1 sampling ratios * you would be well advised to improve this code. */ func _int_upsample(tls *libc.TLS, cinfo Tj_decompress_ptr, compptr uintptr, input_data TJSAMPARRAY, output_data_ptr TJSAMPIMAGE) { var h, h_expand, v_expand int32 var inptr, outend, outptr, v3, v5 TJSAMPROW var invalue TJSAMPLE var output_data, output_end, v2 TJSAMPARRAY var upsample Tmy_upsample_ptr _, _, _, _, _, _, _, _, _, _, _, _, _ = h, h_expand, inptr, invalue, outend, outptr, output_data, output_end, upsample, v_expand, v2, v3, v5 upsample = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample h_expand = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(upsample + 140 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)))) v_expand = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(upsample + 150 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_index)))) output_data = *(*TJSAMPARRAY)(unsafe.Pointer(output_data_ptr)) output_end = output_data + uintptr((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor)*4 for { if !(output_data < output_end) { break } /* Generate one output row with proper horizontal expansion */ v2 = input_data input_data += 4 inptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) outptr = *(*TJSAMPROW)(unsafe.Pointer(output_data)) outend = outptr + uintptr((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width) for outptr < outend { v3 = inptr inptr++ invalue = *(*TJSAMPLE)(unsafe.Pointer(v3)) /* don't need GETJSAMPLE() here */ h = h_expand for { if !(h > 0) { break } v5 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v5)) = invalue goto _4 _4: ; h-- } } /* Generate any additional output rows by duplicating the first one */ if v_expand > int32(1) { Xjcopy_sample_rows(tls, output_data, output_data+uintptr(1)*4, v_expand-int32(1), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width) } goto _1 _1: ; output_data += uintptr(v_expand) * 4 } } /* * Fast processing for the common case of 2:1 horizontal and 1:1 vertical. * It's still a box filter. */ func _h2v1_upsample(tls *libc.TLS, cinfo Tj_decompress_ptr, compptr uintptr, input_data TJSAMPARRAY, output_data_ptr TJSAMPIMAGE) { var inptr, outend, outptr, v2, v3, v4 TJSAMPROW var invalue TJSAMPLE var output_data TJSAMPARRAY var outrow int32 _, _, _, _, _, _, _, _, _ = inptr, invalue, outend, outptr, output_data, outrow, v2, v3, v4 output_data = *(*TJSAMPARRAY)(unsafe.Pointer(output_data_ptr)) outrow = 0 for { if !(outrow < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor) { break } inptr = *(*TJSAMPROW)(unsafe.Pointer(input_data + uintptr(outrow)*4)) outptr = *(*TJSAMPROW)(unsafe.Pointer(output_data + uintptr(outrow)*4)) outend = outptr + uintptr((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width) for outptr < outend { v2 = inptr inptr++ invalue = *(*TJSAMPLE)(unsafe.Pointer(v2)) /* don't need GETJSAMPLE() here */ v3 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v3)) = invalue v4 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v4)) = invalue } goto _1 _1: ; outrow++ } } /* * Fast processing for the common case of 2:1 horizontal and 2:1 vertical. * It's still a box filter. */ func _h2v2_upsample(tls *libc.TLS, cinfo Tj_decompress_ptr, compptr uintptr, input_data TJSAMPARRAY, output_data_ptr TJSAMPIMAGE) { var inptr, outend, outptr, v3, v4, v5 TJSAMPROW var invalue TJSAMPLE var output_data, output_end, v2 TJSAMPARRAY _, _, _, _, _, _, _, _, _, _ = inptr, invalue, outend, outptr, output_data, output_end, v2, v3, v4, v5 output_data = *(*TJSAMPARRAY)(unsafe.Pointer(output_data_ptr)) output_end = output_data + uintptr((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor)*4 for { if !(output_data < output_end) { break } v2 = input_data input_data += 4 inptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) outptr = *(*TJSAMPROW)(unsafe.Pointer(output_data)) outend = outptr + uintptr((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width) for outptr < outend { v3 = inptr inptr++ invalue = *(*TJSAMPLE)(unsafe.Pointer(v3)) /* don't need GETJSAMPLE() here */ v4 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v4)) = invalue v5 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v5)) = invalue } Xjcopy_sample_rows(tls, output_data, output_data+uintptr(1)*4, int32(1), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width) goto _1 _1: ; output_data += uintptr(2) * 4 } } /* * Module initialization routine for upsampling. */ func Xjinit_upsampler(tls *libc.TLS, cinfo Tj_decompress_ptr) { var ci, h_in_group, h_out_group, v_in_group, v_out_group int32 var compptr uintptr var upsample Tmy_upsample_ptr _, _, _, _, _, _, _ = ci, compptr, h_in_group, h_out_group, upsample, v_in_group, v_out_group upsample = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(160)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fupsample = upsample (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_upsample) (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Fpub.Fupsample = __ccgo_fp(_sep_upsample) (*Tmy_upsampler1)(unsafe.Pointer(upsample)).Fpub.Fneed_context_rows = int32(FALSE1) /* until we find out differently */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).FCCIR601_sampling != 0 { /* this isn't supported */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CCIR601_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Verify we can handle the sampling factors, select per-component methods, * and create storage as needed. */ ci = 0 compptr = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcomp_info for { if !(ci < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components) { break } /* Don't bother to upsample an uninteresting component. */ if !((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fcomponent_needed != 0) { goto _1 } /* Compute size of an "input group" after IDCT scaling. This many samples * are to be converted to max_h_samp_factor * max_v_samp_factor pixels. */ h_in_group = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_h_scaled_size / (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_h_scaled_size v_in_group = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).FDCT_v_scaled_size / (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmin_DCT_v_scaled_size h_out_group = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor v_out_group = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor *(*int32)(unsafe.Pointer(upsample + 100 + uintptr(ci)*4)) = v_in_group /* save for use later */ if h_in_group == h_out_group && v_in_group == v_out_group { /* Fullsize components can be processed without any work. */ *(*Tupsample1_ptr)(unsafe.Pointer(upsample + 52 + uintptr(ci)*4)) = __ccgo_fp(_fullsize_upsample) goto _1 /* don't need to allocate buffer */ } if h_in_group*int32(2) == h_out_group && v_in_group == v_out_group { /* Special case for 2h1v upsampling */ *(*Tupsample1_ptr)(unsafe.Pointer(upsample + 52 + uintptr(ci)*4)) = __ccgo_fp(_h2v1_upsample) } else { if h_in_group*int32(2) == h_out_group && v_in_group*int32(2) == v_out_group { /* Special case for 2h2v upsampling */ *(*Tupsample1_ptr)(unsafe.Pointer(upsample + 52 + uintptr(ci)*4)) = __ccgo_fp(_h2v2_upsample) } else { if h_out_group%h_in_group == 0 && v_out_group%v_in_group == 0 { /* Generic integral-factors upsampling method */ *(*Tupsample1_ptr)(unsafe.Pointer(upsample + 52 + uintptr(ci)*4)) = __ccgo_fp(_int_upsample) *(*TUINT8)(unsafe.Pointer(upsample + 140 + uintptr(ci))) = libc.Uint8FromInt32(h_out_group / h_in_group) *(*TUINT8)(unsafe.Pointer(upsample + 150 + uintptr(ci))) = libc.Uint8FromInt32(v_out_group / v_in_group) } else { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_FRACT_SAMPLE_NOTIMPL) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } } *(*TJSAMPARRAY)(unsafe.Pointer(upsample + 12 + uintptr(ci)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(Xjround_up(tls, libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width), (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_h_samp_factor)), libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmax_v_samp_factor)) goto _1 _1: ; ci++ compptr += 88 } } /* * Read the coefficient arrays from a JPEG file. * jpeg_read_header must be completed before calling this. * * The entire image is read into a set of virtual coefficient-block arrays, * one per component. The return value is a pointer to the array of * virtual-array descriptors. These can be manipulated directly via the * JPEG memory manager, or handed off to jpeg_write_coefficients(). * To release the memory occupied by the virtual arrays, call * jpeg_finish_decompress() when done with the data. * * An alternative usage is to simply obtain access to the coefficient arrays * during a buffered-image-mode decompression operation. This is allowed * after any jpeg_finish_output() call. The arrays can be accessed until * jpeg_finish_decompress() is called. (Note that any call to the library * may reposition the arrays, so don't rely on access_virt_barray() results * to stay valid across library calls.) * * Returns NULL if suspended. This case need be checked only if * a suspending data source is used. */ func Xjpeg_read_coefficients(tls *libc.TLS, cinfo Tj_decompress_ptr) (r uintptr) { var retcode, v2 int32 var v3 uintptr _, _, _ = retcode, v2, v3 if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_READY) { /* First call: initialize active modules */ _transdecode_master_selection(tls, cinfo) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_RDCOEFS) } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_RDCOEFS) { /* Absorb whole file into the coef buffer */ for { /* Call progress monitor hook if present */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fprogress_monitor})))(tls, cinfo) } /* Absorb some more input */ retcode = (*(*func(*libc.TLS, Tj_decompress_ptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fconsume_input})))(tls, cinfo) if retcode == JPEG_SUSPENDED { return libc.UintptrFromInt32(0) } if retcode == int32(JPEG_REACHED_EOI) { break } /* Advance progress counter if appropriate */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) && (retcode == int32(JPEG_ROW_COMPLETED) || retcode == int32(JPEG_REACHED_SOS)) { v3 = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress + 4 *(*int32)(unsafe.Pointer(v3))++ v2 = *(*int32)(unsafe.Pointer(v3)) if v2 >= (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_limit { /* startup underestimated number of scans; ratchet up one scan */ *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress + 8)) += libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows) } } goto _1 _1: } /* Set state so that jpeg_finish_decompress does the right thing */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state = int32(DSTATE_STOPPING) } /* At this point we should be in state DSTATE_STOPPING if being used * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access * to the coefficients during a full buffered-image-mode decompression. */ if ((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_STOPPING) || (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state == int32(DSTATE_BUFIMAGE)) && (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fbuffered_image != 0 { return (*Tjpeg_d_coef_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcoef)).Fcoef_arrays } /* Oops, improper usage */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_STATE) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fglobal_state (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) return libc.UintptrFromInt32(0) /* keep compiler happy */ } /* * Master selection of decompression modules for transcoding. * This substitutes for jdmaster.c's initialization of the full decompressor. */ func _transdecode_master_selection(tls *libc.TLS, cinfo Tj_decompress_ptr) { var nscans int32 _ = nscans /* This is effectively a buffered-image operation. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fbuffered_image = int32(TRUE1) /* Compute output image dimensions and related values. */ Xjpeg_core_output_dimensions(tls, cinfo) /* Entropy decoding: either Huffman or arithmetic coding. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Farith_code != 0 { Xjinit_arith_decoder(tls, cinfo) } else { Xjinit_huff_decoder(tls, cinfo) } /* Always get a full-image coefficient buffer. */ Xjinit_d_coef_controller(tls, cinfo, int32(TRUE1)) /* We can now tell the memory manager to allocate virtual arrays. */ (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Frealize_virt_arrays})))(tls, cinfo) /* Initialize input side of decompressor to consume first scan. */ (*(*func(*libc.TLS, Tj_decompress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fstart_input_pass})))(tls, cinfo) /* Initialize progress monitoring. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress != libc.UintptrFromInt32(0) { /* Estimate number of scans to set pass_limit. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ nscans = int32(2) + int32(3)*(*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components } else { if (*Tjpeg_input_controller)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finputctl)).Fhas_multiple_scans != 0 { /* For a nonprogressive multiscan file, estimate 1 scan per component. */ nscans = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fnum_components } else { nscans = int32(1) } } (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_counter = 0 (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fpass_limit = libc.Int32FromUint32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ftotal_iMCU_rows) * nscans (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Fcompleted_passes = 0 (*Tjpeg_progress_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fprogress)).Ftotal_passes = int32(1) } } const JCOPYRIGHT = "Copyright (C) 2024, Thomas G. Lane, Guido Vollbeding" const JVERSION = "9f 14-Jan-2024" /* * Error exit handler: must not return to caller. * * Applications may override this if they want to get control back after * an error. Typically one would longjmp somewhere instead of exiting. * The setjmp buffer can be made a private field within an expanded error * handler object. Note that the info needed to generate an error message * is stored in the error object, so you can generate the message now or * later, at your convenience. * You should make sure that the JPEG object is cleaned up (with jpeg_abort * or jpeg_destroy) at some point. */ func _error_exit(tls *libc.TLS, cinfo Tj_common_ptr) { /* Always display the message */ (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Foutput_message})))(tls, cinfo) /* Let the memory manager delete any temp files before we die */ Xjpeg_destroy(tls, cinfo) libc.Xexit(tls, int32(EXIT_FAILURE)) } /* * Actual output of an error or trace message. * Applications may override this method to send JPEG messages somewhere * other than stderr. * * On Windows, printing to stderr is generally completely useless, * so we provide optional code to produce an error-dialog popup. * Most Windows applications will still prefer to override this routine, * but if they don't, it'll do something at least marginally useful. * * NOTE: to use the library in an environment that doesn't support the * C stdio library, you may have to delete the call to fprintf() entirely, * not just not use this routine. */ func _output_message(tls *libc.TLS, cinfo Tj_common_ptr) { bp := tls.Alloc(224) defer tls.Free(224) var _ /* buffer at bp+0 */ [200]uint8 /* Create the message */ (*(*func(*libc.TLS, Tj_common_ptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fformat_message})))(tls, cinfo, bp) /* Send it to stderr, adding a newline */ libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1161, libc.VaList(bp+208, bp)) } /* * Decide whether to emit a trace or warning message. * msg_level is one of: * -1: recoverable corrupt-data warning, may want to abort. * 0: important advisory messages (always display to user). * 1: first level of tracing detail. * 2,3,...: successively more detailed tracing messages. * An application might override this method if it wanted to abort on warnings * or change the policy about which messages to display. */ func _emit_message(tls *libc.TLS, cinfo Tj_common_ptr, msg_level int32) { var err uintptr _ = err err = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr if msg_level < 0 { /* It's a warning message. Since corrupt files may generate many warnings, * the policy implemented here is to show only the first warning, * unless trace_level >= 3. */ if (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Fnum_warnings == 0 || (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Ftrace_level >= int32(3) { (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer(err)).Foutput_message})))(tls, cinfo) } /* Always count warnings in num_warnings. */ (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Fnum_warnings++ } else { /* It's a trace message. Show it if trace_level >= msg_level. */ if (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Ftrace_level >= msg_level { (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer(err)).Foutput_message})))(tls, cinfo) } } } /* * Format a message string for the most recent JPEG error or message. * The message is stored into buffer, which should be at least JMSG_LENGTH_MAX * characters. Note that no '\n' character is added to the string. * Few applications should need to override this method. */ func _format_message(tls *libc.TLS, cinfo Tj_common_ptr, buffer uintptr) { bp := tls.Alloc(80) defer tls.Free(80) var ch, v1 uint8 var err, msgptr, msgtext, v2 uintptr var isstring Tboolean var msg_code int32 _, _, _, _, _, _, _, _ = ch, err, isstring, msg_code, msgptr, msgtext, v1, v2 err = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr msg_code = (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Fmsg_code msgtext = libc.UintptrFromInt32(0) /* Look up message string in proper table */ if msg_code > 0 && msg_code <= (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Flast_jpeg_message { msgtext = *(*uintptr)(unsafe.Pointer((*Tjpeg_error_mgr)(unsafe.Pointer(err)).Fjpeg_message_table + uintptr(msg_code)*4)) } else { if (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Faddon_message_table != libc.UintptrFromInt32(0) && msg_code >= (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Ffirst_addon_message && msg_code <= (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Flast_addon_message { msgtext = *(*uintptr)(unsafe.Pointer((*Tjpeg_error_mgr)(unsafe.Pointer(err)).Faddon_message_table + uintptr(msg_code-(*Tjpeg_error_mgr)(unsafe.Pointer(err)).Ffirst_addon_message)*4)) } } /* Defend against bogus message number */ if msgtext == libc.UintptrFromInt32(0) { *(*int32)(unsafe.Pointer(err + 24)) = msg_code msgtext = *(*uintptr)(unsafe.Pointer((*Tjpeg_error_mgr)(unsafe.Pointer(err)).Fjpeg_message_table)) } /* Check for string parameter, as indicated by %s in the message text */ isstring = int32(FALSE1) msgptr = msgtext for { v2 = msgptr msgptr++ v1 = *(*uint8)(unsafe.Pointer(v2)) ch = v1 if !(libc.Int32FromUint8(v1) != int32('\000')) { break } if libc.Int32FromUint8(ch) == int32('%') { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(msgptr))) == int32('s') { isstring = int32(TRUE1) } break } } /* Format the message into the passed buffer */ if isstring != 0 { libc.Xsprintf(tls, buffer, msgtext, libc.VaList(bp+8, err+24)) } else { libc.Xsprintf(tls, buffer, msgtext, libc.VaList(bp+8, *(*int32)(unsafe.Pointer(err + 24)), *(*int32)(unsafe.Pointer(err + 24 + 1*4)), *(*int32)(unsafe.Pointer(err + 24 + 2*4)), *(*int32)(unsafe.Pointer(err + 24 + 3*4)), *(*int32)(unsafe.Pointer(err + 24 + 4*4)), *(*int32)(unsafe.Pointer(err + 24 + 5*4)), *(*int32)(unsafe.Pointer(err + 24 + 6*4)), *(*int32)(unsafe.Pointer(err + 24 + 7*4)))) } } /* * Reset error state variables at start of a new image. * This is called during compression startup to reset trace/error * processing to default state, without losing any application-specific * method pointers. An application might possibly want to override * this method if it has additional error processing state. */ func _reset_error_mgr(tls *libc.TLS, cinfo Tj_common_ptr) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fnum_warnings = 0 /* trace_level is not reset since it is an application-supplied parameter */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = 0 /* may be useful as a flag for "no error" */ } /* * Fill in the standard error-handling methods in a jpeg_error_mgr object. * Typical call is: * struct jpeg_compress_struct cinfo; * struct jpeg_error_mgr err; * * cinfo.err = jpeg_std_error(&err); * after which the application may override some of the methods. */ func Xjpeg_std_error(tls *libc.TLS, err uintptr) (r uintptr) { (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Ferror_exit = __ccgo_fp(_error_exit) (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Femit_message = __ccgo_fp(_emit_message) (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Foutput_message = __ccgo_fp(_output_message) (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Fformat_message = __ccgo_fp(_format_message) (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Freset_error_mgr = __ccgo_fp(_reset_error_mgr) (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Ftrace_level = 0 /* default = no tracing */ (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Fnum_warnings = 0 /* no warnings emitted yet */ (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Fmsg_code = 0 /* may be useful as a flag for "no error" */ /* Initialize message table pointers */ (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Fjpeg_message_table = uintptr(unsafe.Pointer(&Xjpeg_std_message_table)) (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Flast_jpeg_message = int32(JMSG_LASTMSGCODE) - libc.Int32FromInt32(1) (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Faddon_message_table = libc.UintptrFromInt32(0) (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Ffirst_addon_message = 0 /* for safety */ (*Tjpeg_error_mgr)(unsafe.Pointer(err)).Flast_addon_message = 0 return err } /* * Macros for handling fixed-point arithmetic; these are used by many * but not all of the DCT/IDCT modules. * * All values are expected to be of type INT32. * Fractional constants are scaled left by CONST_BITS bits. * CONST_BITS is defined within each module using these macros, * and may differ from one module to the next. */ /* Convert a positive real constant to an integer scaled by CONST_SCALE. * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, * thus causing a lot of useless floating-point operations at run time. */ /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * This macro is used only when the two inputs will actually be no more than * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a * full 32x32 multiply. This provides a useful speedup on many machines. * Unfortunately there is no way to specify a 16x16->32 multiply portably * in C, but some C compilers will do the right thing if you provide the * correct combination of casts. */ /* Same except both inputs are variables. */ /* Like RIGHT_SHIFT, but applies to a DCTELEM. * We assume that int right shift is unsigned if INT32 right shift is. */ /* * This module is specialized to the case DCTSIZE = 8. */ /* * Perform the forward DCT on one block of samples. * * cK represents cos(K*pi/16). */ func Xjpeg_fdct_float(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, z1, z11, z13, z2, z3, z4, z5 float32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, z1, z11, z13, z2, z3, z4, z5 /* Pass 1: process rows. */ dataptr = data ctr = 0 for { if !(ctr < int32(DCTSIZE)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Load data into workspace */ tmp0 = float32(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7)))) tmp7 = float32(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7)))) tmp1 = float32(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6)))) tmp6 = float32(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6)))) tmp2 = float32(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5)))) tmp5 = float32(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5)))) tmp3 = float32(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4)))) tmp4 = float32(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4)))) /* Even part */ tmp10 = tmp0 + tmp3 /* phase 2 */ tmp13 = tmp0 - tmp3 tmp11 = tmp1 + tmp2 tmp12 = tmp1 - tmp2 /* Apply unsigned->signed conversion. */ *(*float32)(unsafe.Pointer(dataptr)) = tmp10 + tmp11 - float32(libc.Int32FromInt32(8)*libc.Int32FromInt32(CENTERJSAMPLE)) /* phase 3 */ *(*float32)(unsafe.Pointer(dataptr + 4*4)) = tmp10 - tmp11 z1 = (tmp12 + tmp13) * libc.Float32FromFloat64(0.707106781) /* c4 */ *(*float32)(unsafe.Pointer(dataptr + 2*4)) = tmp13 + z1 /* phase 5 */ *(*float32)(unsafe.Pointer(dataptr + 6*4)) = tmp13 - z1 /* Odd part */ tmp10 = tmp4 + tmp5 /* phase 2 */ tmp11 = tmp5 + tmp6 tmp12 = tmp6 + tmp7 /* The rotator is modified from fig 4-8 to avoid extra negations. */ z5 = (tmp10 - tmp12) * libc.Float32FromFloat64(0.382683433) /* c6 */ z2 = libc.Float32FromFloat64(0.5411961)*tmp10 + z5 /* c2-c6 */ z4 = libc.Float32FromFloat64(1.306562965)*tmp12 + z5 /* c2+c6 */ z3 = tmp11 * libc.Float32FromFloat64(0.707106781) /* c4 */ z11 = tmp7 + z3 /* phase 5 */ z13 = tmp7 - z3 *(*float32)(unsafe.Pointer(dataptr + 5*4)) = z13 + z2 /* phase 6 */ *(*float32)(unsafe.Pointer(dataptr + 3*4)) = z13 - z2 *(*float32)(unsafe.Pointer(dataptr + 1*4)) = z11 + z4 *(*float32)(unsafe.Pointer(dataptr + 7*4)) = z11 - z4 dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. */ dataptr = data ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } tmp0 = *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp7 = *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp6 = *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp5 = *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp4 = *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) /* Even part */ tmp10 = tmp0 + tmp3 /* phase 2 */ tmp13 = tmp0 - tmp3 tmp11 = tmp1 + tmp2 tmp12 = tmp1 - tmp2 *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = tmp10 + tmp11 /* phase 3 */ *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = tmp10 - tmp11 z1 = (tmp12 + tmp13) * libc.Float32FromFloat64(0.707106781) /* c4 */ *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = tmp13 + z1 /* phase 5 */ *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = tmp13 - z1 /* Odd part */ tmp10 = tmp4 + tmp5 /* phase 2 */ tmp11 = tmp5 + tmp6 tmp12 = tmp6 + tmp7 /* The rotator is modified from fig 4-8 to avoid extra negations. */ z5 = (tmp10 - tmp12) * libc.Float32FromFloat64(0.382683433) /* c6 */ z2 = libc.Float32FromFloat64(0.5411961)*tmp10 + z5 /* c2-c6 */ z4 = libc.Float32FromFloat64(1.306562965)*tmp12 + z5 /* c2+c6 */ z3 = tmp11 * libc.Float32FromFloat64(0.707106781) /* c4 */ z11 = tmp7 + z3 /* phase 5 */ z13 = tmp7 - z3 *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = z13 + z2 /* phase 6 */ *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = z13 - z2 *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = z11 + z4 *(*float32)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = z11 - z4 dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } const CONST_BITS1 = 8 /* * Macros for handling fixed-point arithmetic; these are used by many * but not all of the DCT/IDCT modules. * * All values are expected to be of type INT32. * Fractional constants are scaled left by CONST_BITS bits. * CONST_BITS is defined within each module using these macros, * and may differ from one module to the next. */ /* Convert a positive real constant to an integer scaled by CONST_SCALE. * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, * thus causing a lot of useless floating-point operations at run time. */ /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * This macro is used only when the two inputs will actually be no more than * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a * full 32x32 multiply. This provides a useful speedup on many machines. * Unfortunately there is no way to specify a 16x16->32 multiply portably * in C, but some C compilers will do the right thing if you provide the * correct combination of casts. */ /* Same except both inputs are variables. */ /* Like RIGHT_SHIFT, but applies to a DCTELEM. * We assume that int right shift is unsigned if INT32 right shift is. */ /* * This module is specialized to the case DCTSIZE = 8. */ /* Scaling decisions are generally the same as in the LL&M algorithm; * see jfdctint.c for more details. However, we choose to descale * (right shift) multiplication products as soon as they are formed, * rather than carrying additional fractional bits into subsequent additions. * This compromises accuracy slightly, but it lets us save a few shifts. * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples) * everywhere except in the multiplications proper; this saves a good deal * of work on 16-bit-int machines. * * Again to save a few shifts, the intermediate results between pass 1 and * pass 2 are not upscaled, but are represented only to integral precision. * * A final compromise is to represent the multiplicative constants to only * 8 fractional bits, rather than 13. This saves some shifting work on some * machines, and may also reduce the cost of multiplication (since there * are fewer one-bits in the constants). */ /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus * causing a lot of useless floating-point operations at run time. * To get around this we use the following pre-calculated constants. * If you change CONST_BITS you may want to add appropriate values. * (With a reasonable C compiler, you can just rely on the FIX() macro...) */ /* We can gain a little more speed, with a further compromise in accuracy, * by omitting the addition in a descaling shift. This yields an incorrectly * rounded result half the time... */ /* Multiply a DCTELEM variable by an INT32 constant, and immediately * descale to yield a DCTELEM result. */ /* * Perform the forward DCT on one block of samples. * * cK represents cos(K*pi/16). */ func Xjpeg_fdct_ifast(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, z1, z11, z13, z2, z3, z4, z5 TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, z1, z11, z13, z2, z3, z4, z5 /* Pass 1: process rows. */ dataptr = data ctr = 0 for { if !(ctr < int32(DCTSIZE)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Load data into workspace */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp7 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) /* Even part */ tmp10 = tmp0 + tmp3 /* phase 2 */ tmp13 = tmp0 - tmp3 tmp11 = tmp1 + tmp2 tmp12 = tmp1 - tmp2 /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = tmp10 + tmp11 - libc.Int32FromInt32(8)*libc.Int32FromInt32(CENTERJSAMPLE) /* phase 3 */ *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = tmp10 - tmp11 z1 = (tmp12 + tmp13) * libc.Int32FromInt32(181) >> libc.Int32FromInt32(CONST_BITS1) /* c4 */ *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = tmp13 + z1 /* phase 5 */ *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = tmp13 - z1 /* Odd part */ tmp10 = tmp4 + tmp5 /* phase 2 */ tmp11 = tmp5 + tmp6 tmp12 = tmp6 + tmp7 /* The rotator is modified from fig 4-8 to avoid extra negations. */ z5 = (tmp10 - tmp12) * libc.Int32FromInt32(98) >> libc.Int32FromInt32(CONST_BITS1) /* c6 */ z2 = tmp10*libc.Int32FromInt32(139)>>libc.Int32FromInt32(CONST_BITS1) + z5 /* c2-c6 */ z4 = tmp12*libc.Int32FromInt32(334)>>libc.Int32FromInt32(CONST_BITS1) + z5 /* c2+c6 */ z3 = tmp11 * libc.Int32FromInt32(181) >> libc.Int32FromInt32(CONST_BITS1) /* c4 */ z11 = tmp7 + z3 /* phase 5 */ z13 = tmp7 - z3 *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = z13 + z2 /* phase 6 */ *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = z13 - z2 *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = z11 + z4 *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = z11 - z4 dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. */ dataptr = data ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp7 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) /* Even part */ tmp10 = tmp0 + tmp3 /* phase 2 */ tmp13 = tmp0 - tmp3 tmp11 = tmp1 + tmp2 tmp12 = tmp1 - tmp2 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = tmp10 + tmp11 /* phase 3 */ *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = tmp10 - tmp11 z1 = (tmp12 + tmp13) * libc.Int32FromInt32(181) >> libc.Int32FromInt32(CONST_BITS1) /* c4 */ *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = tmp13 + z1 /* phase 5 */ *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = tmp13 - z1 /* Odd part */ tmp10 = tmp4 + tmp5 /* phase 2 */ tmp11 = tmp5 + tmp6 tmp12 = tmp6 + tmp7 /* The rotator is modified from fig 4-8 to avoid extra negations. */ z5 = (tmp10 - tmp12) * libc.Int32FromInt32(98) >> libc.Int32FromInt32(CONST_BITS1) /* c6 */ z2 = tmp10*libc.Int32FromInt32(139)>>libc.Int32FromInt32(CONST_BITS1) + z5 /* c2-c6 */ z4 = tmp12*libc.Int32FromInt32(334)>>libc.Int32FromInt32(CONST_BITS1) + z5 /* c2+c6 */ z3 = tmp11 * libc.Int32FromInt32(181) >> libc.Int32FromInt32(CONST_BITS1) /* c4 */ z11 = tmp7 + z3 /* phase 5 */ z13 = tmp7 - z3 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = z13 + z2 /* phase 6 */ *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = z13 - z2 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = z11 + z4 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = z11 - z4 dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } const CONST_BITS2 = 13 const PASS1_BITS = 2 /* * Macros for handling fixed-point arithmetic; these are used by many * but not all of the DCT/IDCT modules. * * All values are expected to be of type INT32. * Fractional constants are scaled left by CONST_BITS bits. * CONST_BITS is defined within each module using these macros, * and may differ from one module to the next. */ /* Convert a positive real constant to an integer scaled by CONST_SCALE. * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, * thus causing a lot of useless floating-point operations at run time. */ /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * This macro is used only when the two inputs will actually be no more than * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a * full 32x32 multiply. This provides a useful speedup on many machines. * Unfortunately there is no way to specify a 16x16->32 multiply portably * in C, but some C compilers will do the right thing if you provide the * correct combination of casts. */ /* Same except both inputs are variables. */ /* Like RIGHT_SHIFT, but applies to a DCTELEM. * We assume that int right shift is unsigned if INT32 right shift is. */ /* * This module is specialized to the case DCTSIZE = 8. */ /* * The poop on this scaling stuff is as follows: * * Each 1-D DCT step produces outputs which are a factor of sqrt(N) * larger than the true DCT outputs. The final outputs are therefore * a factor of N larger than desired; since N=8 this can be cured by * a simple right shift at the end of the algorithm. The advantage of * this arrangement is that we save two multiplications per 1-D DCT, * because the y0 and y4 outputs need not be divided by sqrt(N). * In the IJG code, this factor of 8 is removed by the quantization step * (in jcdctmgr.c), NOT in this module. * * We have to do addition and subtraction of the integer inputs, which * is no problem, and multiplication by fractional constants, which is * a problem to do in integer arithmetic. We multiply all the constants * by CONST_SCALE and convert them to integer constants (thus retaining * CONST_BITS bits of precision in the constants). After doing a * multiplication we have to divide the product by CONST_SCALE, with proper * rounding, to produce the correct output. This division can be done * cheaply as a right shift of CONST_BITS bits. We postpone shifting * as long as possible so that partial sums can be added together with * full fractional precision. * * The outputs of the first pass are scaled up by PASS1_BITS bits so that * they are represented to better-than-integral precision. These outputs * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word * with the recommended scaling. (For 12-bit sample data, the intermediate * array is INT32 anyway.) * * To avoid overflow of the 32-bit intermediate results in pass 2, we must * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis * shows that the values given below are the most effective. */ /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus * causing a lot of useless floating-point operations at run time. * To get around this we use the following pre-calculated constants. * If you change CONST_BITS you may want to add appropriate values. * (With a reasonable C compiler, you can just rely on the FIX() macro...) */ /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * For 8-bit samples with the recommended scaling, all the variable * and constant values involved are no more than 16 bits wide, so a * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. * For 12-bit samples, a full 32-bit multiplication will be needed. */ /* * Perform the forward DCT on one block of samples. */ func Xjpeg_fdct_islow(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, z1 TINT32 _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, z1 /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * cK represents sqrt(2) * cos(K*pi/16). */ dataptr = data ctr = 0 for { if !(ctr < int32(DCTSIZE)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "c1" should be "c6". */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp10 = tmp0 + tmp3 tmp12 = tmp0 - tmp3 tmp11 = tmp1 + tmp2 tmp13 = tmp1 - tmp2 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 - libc.Int32FromInt32(8)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = (tmp10 - tmp11) << libc.Int32FromInt32(PASS1_BITS) z1 = (tmp12 + tmp13) * libc.Int32FromInt32(4433) /* c6 */ /* Add fudge factor here for final descale. */ z1 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (z1 + tmp12*libc.Int32FromInt32(6270)) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (z1 - tmp13*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * i0..i3 in the paper are tmp0..tmp3 here. */ tmp12 = tmp0 + tmp2 tmp13 = tmp1 + tmp3 z1 = (tmp12 + tmp13) * libc.Int32FromInt32(9633) /* c3 */ /* Add fudge factor here for final descale. */ z1 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) tmp12 = tmp12 * -libc.Int32FromInt32(3196) /* -c3+c5 */ tmp13 = tmp13 * -libc.Int32FromInt32(16069) /* -c3-c5 */ tmp12 += z1 tmp13 += z1 z1 = (tmp0 + tmp3) * -libc.Int32FromInt32(7373) /* -c3+c7 */ tmp0 = tmp0 * libc.Int32FromInt32(12299) /* c1+c3-c5-c7 */ tmp3 = tmp3 * libc.Int32FromInt32(2446) /* -c1+c3+c5-c7 */ tmp0 += z1 + tmp12 tmp3 += z1 + tmp13 z1 = (tmp1 + tmp2) * -libc.Int32FromInt32(20995) /* -c1-c3 */ tmp1 = tmp1 * libc.Int32FromInt32(25172) /* c1+c3+c5-c7 */ tmp2 = tmp2 * libc.Int32FromInt32(16819) /* c1+c3-c5+c7 */ tmp1 += z1 + tmp13 tmp2 += z1 + tmp12 *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = tmp0 >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = tmp1 >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = tmp2 >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = tmp3 >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * cK represents sqrt(2) * cos(K*pi/16). */ dataptr = data ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "c1" should be "c6". */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) /* Add fudge factor here for final descale. */ tmp10 = tmp0 + tmp3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1)) tmp12 = tmp0 - tmp3 tmp11 = tmp1 + tmp2 tmp13 = tmp1 - tmp2 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp10 + tmp11) >> libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = (tmp10 - tmp11) >> libc.Int32FromInt32(PASS1_BITS) z1 = (tmp12 + tmp13) * libc.Int32FromInt32(4433) /* c6 */ /* Add fudge factor here for final descale. */ z1 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (z1 + tmp12*libc.Int32FromInt32(6270)) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (z1 - tmp13*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * i0..i3 in the paper are tmp0..tmp3 here. */ tmp12 = tmp0 + tmp2 tmp13 = tmp1 + tmp3 z1 = (tmp12 + tmp13) * libc.Int32FromInt32(9633) /* c3 */ /* Add fudge factor here for final descale. */ z1 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) tmp12 = tmp12 * -libc.Int32FromInt32(3196) /* -c3+c5 */ tmp13 = tmp13 * -libc.Int32FromInt32(16069) /* -c3-c5 */ tmp12 += z1 tmp13 += z1 z1 = (tmp0 + tmp3) * -libc.Int32FromInt32(7373) /* -c3+c7 */ tmp0 = tmp0 * libc.Int32FromInt32(12299) /* c1+c3-c5-c7 */ tmp3 = tmp3 * libc.Int32FromInt32(2446) /* -c1+c3+c5-c7 */ tmp0 += z1 + tmp12 tmp3 += z1 + tmp13 z1 = (tmp1 + tmp2) * -libc.Int32FromInt32(20995) /* -c1-c3 */ tmp1 = tmp1 * libc.Int32FromInt32(25172) /* c1+c3+c5-c7 */ tmp2 = tmp2 * libc.Int32FromInt32(16819) /* c1+c3-c5+c7 */ tmp1 += z1 + tmp13 tmp2 += z1 + tmp12 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = tmp0 >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = tmp1 >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = tmp2 >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = tmp3 >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 7x7 sample block. */ func Xjpeg_fdct_7x7(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp2, tmp3, z1, z2, z3 TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp2, tmp3, z1, z2, z3 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * cK represents sqrt(2) * cos(K*pi/14). */ dataptr = data ctr = 0 for { if !(ctr < int32(7)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp10 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp12 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) z1 = tmp0 + tmp2 /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (z1 + tmp1 + tmp3 - libc.Int32FromInt32(7)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) tmp3 += tmp3 z1 -= tmp3 z1 -= tmp3 z1 = z1 * int32(libc.Float64FromFloat64(0.353553391)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) z1 -= z2 z2 = (tmp0 - tmp1) * int32(libc.Float64FromFloat64(0.881747734)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (z1 + z2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp1 = (tmp10 + tmp11) * int32(libc.Float64FromFloat64(0.935414347)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/7)**2 = 64/49, which we fold * into the constant multipliers: * cK now represents sqrt(2) * cos(K*pi/14) * 64/49. */ dataptr = data ctr = 0 for { if !(ctr < int32(7)) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp10 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp12 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) z1 = tmp0 + tmp2 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((z1+tmp1+tmp3)*int32(libc.Float64FromFloat64(1.306122449)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp3 += tmp3 z1 -= tmp3 z1 -= tmp3 z1 = z1 * int32(libc.Float64FromFloat64(0.46178402)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) z1 -= z2 z2 = (tmp0 - tmp1) * int32(libc.Float64FromFloat64(1.151670509)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (z1 + z2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp1 = (tmp10 + tmp11) * int32(libc.Float64FromFloat64(1.221765677)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 6x6 sample block. */ func Xjpeg_fdct_6x6(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp2 TINT32 _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp2 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * cK represents sqrt(2) * cos(K*pi/12). */ dataptr = data ctr = 0 for { if !(ctr < int32(6)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp10 = tmp0 + tmp2 tmp12 = tmp0 - tmp2 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 - libc.Int32FromInt32(6)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (tmp12*int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp11-tmp11)*int32(libc.Float64FromFloat64(0.707106781)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = ((tmp0+tmp2)*int32(libc.Float64FromFloat64(0.366025404)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = tmp10 + (tmp0+tmp1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (tmp12*int32(libc.Float64FromFloat64(2.177324216)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp11-tmp11)*int32(libc.Float64FromFloat64(1.257078722)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = (tmp0 + tmp2) * int32(libc.Float64FromFloat64(0.650711829)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = ((tmp0-tmp1-tmp2)*int32(libc.Float64FromFloat64(1.777777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp10 + (tmp2-tmp1)*int32(libc.Float64FromFloat64(1.777777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 5x5 sample block. */ func Xjpeg_fdct_5x5(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp2 TINT32 _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp2 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * We scale the results further by 2 as part of output adaption * scaling for different DCT size. * cK represents sqrt(2) * cos(K*pi/10). */ dataptr = data ctr = 0 for { if !(ctr < int32(5)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) tmp10 = tmp0 + tmp1 tmp11 = tmp0 - tmp1 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp2 - libc.Int32FromInt32(5)*libc.Int32FromInt32(CENTERJSAMPLE)) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) tmp11 = tmp11 * int32(libc.Float64FromFloat64(0.790569415)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = (tmp11 - tmp10 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) /* Odd part */ tmp10 = (tmp0 + tmp1) * int32(libc.Float64FromFloat64(0.831253876)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp10 - tmp1*int32(libc.Float64FromFloat64(2.176250899)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/5)**2 = 64/25, which we partially * fold into the constant multipliers (other part was done in pass 1): * cK now represents sqrt(2) * cos(K*pi/10) * 32/25. */ dataptr = data ctr = 0 for { if !(ctr < int32(5)) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp10 = tmp0 + tmp1 tmp11 = tmp0 - tmp1 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp10+tmp2)*int32(libc.Float64FromFloat64(1.28)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp11 = tmp11 * int32(libc.Float64FromFloat64(1.011928851)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = (tmp11 - tmp10 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = (tmp0 + tmp1) * int32(libc.Float64FromFloat64(1.064004961)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp10 - tmp1*int32(libc.Float64FromFloat64(2.785601151)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 4x4 sample block. */ func Xjpeg_fdct_4x4(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11 TINT32 _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * We must also scale the output by (8/4)**2 = 2**2, which we add here. * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT]. */ dataptr = data ctr = 0 for { if !(ctr < int32(4)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) tmp10 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp0 + tmp1 - libc.Int32FromInt32(4)*libc.Int32FromInt32(CENTERJSAMPLE)) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (tmp0 - tmp1) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) /* Odd part */ tmp0 = (tmp10 + tmp11) * libc.Int32FromInt32(4433) /* c6 */ /* Add fudge factor here for final descale. */ tmp0 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(3)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = (tmp0 + tmp10*libc.Int32FromInt32(6270)) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp0 - tmp11*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(2)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT]. */ dataptr = data ctr = 0 for { if !(ctr < int32(4)) { break } /* Even part */ /* Add fudge factor here for final descale. */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp10 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp0 + tmp1) >> libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (tmp0 - tmp1) >> libc.Int32FromInt32(PASS1_BITS) /* Odd part */ tmp0 = (tmp10 + tmp11) * libc.Int32FromInt32(4433) /* c6 */ /* Add fudge factor here for final descale. */ tmp0 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp0 + tmp10*libc.Int32FromInt32(6270)) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp0 - tmp11*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 3x3 sample block. */ func Xjpeg_fdct_3x3(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp2 TINT32 _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp2 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * We scale the results further by 2**2 as part of output adaption * scaling for different DCT size. * cK represents sqrt(2) * cos(K*pi/6). */ dataptr = data ctr = 0 for { if !(ctr < int32(3)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp0 + tmp1 - libc.Int32FromInt32(3)*libc.Int32FromInt32(CENTERJSAMPLE)) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = ((tmp0-tmp1-tmp1)*int32(libc.Float64FromFloat64(0.707106781)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(2)) /* Odd part */ *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = (tmp2*int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(2)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/3)**2 = 64/9, which we partially * fold into the constant multipliers (other part was done in pass 1): * cK now represents sqrt(2) * cos(K*pi/6) * 16/9. */ dataptr = data ctr = 0 for { if !(ctr < int32(3)) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp0+tmp1)*int32(libc.Float64FromFloat64(1.777777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = ((tmp0-tmp1-tmp1)*int32(libc.Float64FromFloat64(1.257078722)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp2*int32(libc.Float64FromFloat64(2.177324216)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 2x2 sample block. */ func Xjpeg_fdct_2x2(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var elemptr TJSAMPROW var tmp0, tmp1, tmp2, tmp3 TDCTELEM _, _, _, _, _ = elemptr, tmp0, tmp1, tmp2, tmp3 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT. */ /* Row 0 */ elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data)) + uintptr(start_col) tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) /* Row 1 */ elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + 1*4)) + uintptr(start_col) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/2)**2 = 2**4. */ /* Column 0 */ /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp0 + tmp2 - libc.Int32FromInt32(4)*libc.Int32FromInt32(CENTERJSAMPLE)) << int32(4) *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp0 - tmp2) << int32(4) /* Column 1 */ *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0)+libc.Int32FromInt32(1))*4)) = (tmp1 + tmp3) << int32(4) *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1)+libc.Int32FromInt32(1))*4)) = (tmp1 - tmp3) << int32(4) } /* * Perform the forward DCT on a 1x1 sample block. */ func Xjpeg_fdct_1x1(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var dcval TDCTELEM _ = dcval /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) dcval = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer(sample_data)) + uintptr(start_col)))) /* We leave the result scaled up by an overall factor of 8. */ /* We must also scale the output by (8/1)**2 = 2**6. */ /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(data)) = (dcval - int32(CENTERJSAMPLE)) << int32(6) } /* * Perform the forward DCT on a 9x9 sample block. */ func Xjpeg_fdct_9x9(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(32) defer tls.Free(32) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, z1, z2 TINT32 var _ /* workspace at bp+0 */ [8]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, wsptr, z1, z2 /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * we scale the results further by 2 as part of output adaption * scaling for different DCT size. * cK represents sqrt(2) * cos(K*pi/18). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp10 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp12 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp13 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) z1 = tmp0 + tmp2 + tmp3 z2 = tmp1 + tmp4 /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (z1 + z2 - libc.Int32FromInt32(9)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(1) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = ((z1-z2-z2)*int32(libc.Float64FromFloat64(0.707106781)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) z1 = (tmp0 - tmp2) * int32(libc.Float64FromFloat64(1.328926049)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp3-tmp0)*int32(libc.Float64FromFloat64(0.245575608)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) /* Odd part */ *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = ((tmp10-tmp12-tmp13)*int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) tmp11 = tmp11 * int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) tmp2 = (tmp12 - tmp13) * int32(libc.Float64FromFloat64(1.392728481)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp1 - tmp11 + tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) ctr++ if ctr != int32(DCTSIZE) { if ctr == int32(9) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/9)**2 = 64/81, which we partially * fold into the constant multipliers and final/initial shifting: * cK now represents sqrt(2) * cos(K*pi/18) * 128/81. */ dataptr = data wsptr = bp ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp10 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp12 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp13 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) z1 = tmp0 + tmp2 + tmp3 z2 = tmp1 + tmp4 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((z1+z2)*int32(libc.Float64FromFloat64(1.580246914)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = ((z1-z2-z2)*int32(libc.Float64FromFloat64(1.117403309)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) z1 = (tmp0 - tmp2) * int32(libc.Float64FromFloat64(2.100031287)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp3-tmp0)*int32(libc.Float64FromFloat64(0.388070096)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) /* Odd part */ *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = ((tmp10-tmp12-tmp13)*int32(libc.Float64FromFloat64(1.935399303)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) tmp11 = tmp11 * int32(libc.Float64FromFloat64(1.935399303)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) tmp2 = (tmp12 - tmp13) * int32(libc.Float64FromFloat64(2.200854883)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp1 - tmp11 + tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 10x10 sample block. */ func Xjpeg_fdct_10x10(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(64) defer tls.Free(64) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp2, tmp3, tmp4 TINT32 var _ /* workspace at bp+0 */ [16]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp2, tmp3, tmp4, wsptr /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * we scale the results further by 2 as part of output adaption * scaling for different DCT size. * cK represents sqrt(2) * cos(K*pi/20). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp12 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp10 = tmp0 + tmp4 tmp13 = tmp0 - tmp4 tmp11 = tmp1 + tmp3 tmp14 = tmp1 - tmp3 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 + tmp12 - libc.Int32FromInt32(10)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(1) tmp12 += tmp12 *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp12)*int32(libc.Float64FromFloat64(1.144122806)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) tmp10 = (tmp13 + tmp14) * int32(libc.Float64FromFloat64(0.831253876)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (tmp10 - tmp14*int32(libc.Float64FromFloat64(2.176250899)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) /* Odd part */ tmp10 = tmp0 + tmp4 tmp11 = tmp1 - tmp3 *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp10 - tmp11 - tmp2) << libc.Int32FromInt32(1) tmp2 <<= int32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = (tmp0*int32(libc.Float64FromFloat64(1.396802247)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) tmp12 = (tmp0-tmp4)*int32(libc.Float64FromFloat64(0.951056516)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp12 - tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) ctr++ if ctr != int32(DCTSIZE) { if ctr == int32(10) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/10)**2 = 16/25, which we partially * fold into the constant multipliers and final/initial shifting: * cK now represents sqrt(2) * cos(K*pi/20) * 32/25. */ dataptr = data wsptr = bp ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp12 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp10 = tmp0 + tmp4 tmp13 = tmp0 - tmp4 tmp11 = tmp1 + tmp3 tmp14 = tmp1 - tmp3 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp10+tmp11+tmp12)*int32(libc.Float64FromFloat64(1.28)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) tmp12 += tmp12 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp12)*int32(libc.Float64FromFloat64(1.464477191)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) tmp10 = (tmp13 + tmp14) * int32(libc.Float64FromFloat64(1.064004961)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (tmp10 - tmp14*int32(libc.Float64FromFloat64(2.785601151)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) /* Odd part */ tmp10 = tmp0 + tmp4 tmp11 = tmp1 - tmp3 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = ((tmp10-tmp11-tmp2)*int32(libc.Float64FromFloat64(1.28)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) tmp2 = tmp2 * int32(libc.Float64FromFloat64(1.28)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) tmp12 = (tmp0-tmp4)*int32(libc.Float64FromFloat64(1.217352341)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp12 - tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on an 11x11 sample block. */ func Xjpeg_fdct_11x11(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(96) defer tls.Free(96) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp2, tmp3, tmp4, tmp5, z1, z2, z3 TINT32 var _ /* workspace at bp+0 */ [24]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp2, tmp3, tmp4, tmp5, wsptr, z1, z2, z3 /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * we scale the results further by 2 as part of output adaption * scaling for different DCT size. * cK represents sqrt(2) * cos(K*pi/22). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp10 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp12 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp13 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp14 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp0 + tmp1 + tmp2 + tmp3 + tmp4 + tmp5 - libc.Int32FromInt32(11)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(1) tmp5 += tmp5 tmp0 -= tmp5 tmp1 -= tmp5 tmp2 -= tmp5 tmp3 -= tmp5 tmp4 -= tmp5 z1 = (tmp0+tmp3)*int32(libc.Float64FromFloat64(1.356927976)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = (z2 + z3 + tmp1*int32(libc.Float64FromFloat64(0.06233565)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (z1 + z3 - tmp0*int32(libc.Float64FromFloat64(1.6205272)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) /* Odd part */ tmp1 = (tmp10 + tmp11) * int32(libc.Float64FromFloat64(1.286413905)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(1)) ctr++ if ctr != int32(DCTSIZE) { if ctr == int32(11) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/11)**2 = 64/121, which we partially * fold into the constant multipliers and final/initial shifting: * cK now represents sqrt(2) * cos(K*pi/22) * 128/121. */ dataptr = data wsptr = bp ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp10 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp12 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp13 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp14 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp0+tmp1+tmp2+tmp3+tmp4+tmp5)*int32(libc.Float64FromFloat64(1.05785124)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) tmp5 += tmp5 tmp0 -= tmp5 tmp1 -= tmp5 tmp2 -= tmp5 tmp3 -= tmp5 tmp4 -= tmp5 z1 = (tmp0+tmp3)*int32(libc.Float64FromFloat64(1.435427942)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = (z2 + z3 + tmp1*int32(libc.Float64FromFloat64(0.065941844)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (z1 + z3 - tmp0*int32(libc.Float64FromFloat64(1.714276708)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) /* Odd part */ tmp1 = (tmp10 + tmp11) * int32(libc.Float64FromFloat64(1.360834544)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 12x12 sample block. */ func Xjpeg_fdct_12x12(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(128) defer tls.Free(128) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp2, tmp3, tmp4, tmp5 TINT32 var _ /* workspace at bp+0 */ [32]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp2, tmp3, tmp4, tmp5, wsptr /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT. * cK represents sqrt(2) * cos(K*pi/24). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp10 = tmp0 + tmp5 tmp13 = tmp0 - tmp5 tmp11 = tmp1 + tmp4 tmp14 = tmp1 - tmp4 tmp12 = tmp2 + tmp3 tmp15 = tmp2 - tmp3 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = tmp10 + tmp11 + tmp12 - libc.Int32FromInt32(12)*libc.Int32FromInt32(CENTERJSAMPLE) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = tmp13 - tmp14 - tmp15 *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp12)*int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (tmp14 - tmp15 + (tmp13+tmp15)*int32(libc.Float64FromFloat64(1.366025404)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) /* Odd part */ tmp10 = (tmp1 + tmp4) * libc.Int32FromInt32(4433) /* c9 */ tmp14 = tmp10 + tmp1*libc.Int32FromInt32(6270) /* c3-c9 */ tmp15 = tmp10 - tmp4*libc.Int32FromInt32(15137) /* c3+c9 */ tmp12 = (tmp0 + tmp2) * int32(libc.Float64FromFloat64(1.121971054)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp11 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp12 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) ctr++ if ctr != int32(DCTSIZE) { if ctr == int32(12) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/12)**2 = 4/9, which we partially * fold into the constant multipliers and final shifting: * cK now represents sqrt(2) * cos(K*pi/24) * 8/9. */ dataptr = data wsptr = bp ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp10 = tmp0 + tmp5 tmp13 = tmp0 - tmp5 tmp11 = tmp1 + tmp4 tmp14 = tmp1 - tmp4 tmp12 = tmp2 + tmp3 tmp15 = tmp2 - tmp3 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp10+tmp11+tmp12)*int32(libc.Float64FromFloat64(0.888888889)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = ((tmp13-tmp14-tmp15)*int32(libc.Float64FromFloat64(0.888888889)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp12)*int32(libc.Float64FromFloat64(1.088662108)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = ((tmp14-tmp15)*int32(libc.Float64FromFloat64(0.888888889)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) /* Odd part */ tmp10 = (tmp1 + tmp4) * int32(libc.Float64FromFloat64(0.4810632)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp11 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp12 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 13x13 sample block. */ func Xjpeg_fdct_13x13(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(160) defer tls.Free(160) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp2, tmp3, tmp4, tmp5, tmp6, z1, z2 TINT32 var _ /* workspace at bp+0 */ [40]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp2, tmp3, tmp4, tmp5, tmp6, wsptr, z1, z2 /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT. * cK represents sqrt(2) * cos(K*pi/26). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp10 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp12 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp13 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp14 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp15 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = tmp0 + tmp1 + tmp2 + tmp3 + tmp4 + tmp5 + tmp6 - libc.Int32FromInt32(13)*libc.Int32FromInt32(CENTERJSAMPLE) tmp6 += tmp6 tmp0 -= tmp6 tmp1 -= tmp6 tmp2 -= tmp6 tmp3 -= tmp6 tmp4 -= tmp6 tmp5 -= tmp6 *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (tmp0*int32(libc.Float64FromFloat64(1.373119086)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) z1 = (tmp0-tmp2)*int32(libc.Float64FromFloat64(1.155388986)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (z1 - z2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) /* Odd part */ tmp1 = (tmp10 + tmp11) * int32(libc.Float64FromFloat64(1.322312651)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) ctr++ if ctr != int32(DCTSIZE) { if ctr == int32(13) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/13)**2 = 64/169, which we partially * fold into the constant multipliers and final shifting: * cK now represents sqrt(2) * cos(K*pi/26) * 128/169. */ dataptr = data wsptr = bp ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp10 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp12 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp13 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp14 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp15 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp0+tmp1+tmp2+tmp3+tmp4+tmp5+tmp6)*int32(libc.Float64FromFloat64(0.75739645)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) tmp6 += tmp6 tmp0 -= tmp6 tmp1 -= tmp6 tmp2 -= tmp6 tmp3 -= tmp6 tmp4 -= tmp6 tmp5 -= tmp6 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (tmp0*int32(libc.Float64FromFloat64(1.039995521)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) z1 = (tmp0-tmp2)*int32(libc.Float64FromFloat64(0.875087516)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (z1 - z2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) /* Odd part */ tmp1 = (tmp10 + tmp11) * int32(libc.Float64FromFloat64(1.001514908)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 14x14 sample block. */ func Xjpeg_fdct_14x14(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(192) defer tls.Free(192) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp2, tmp3, tmp4, tmp5, tmp6 TINT32 var _ /* workspace at bp+0 */ [48]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp2, tmp3, tmp4, tmp5, tmp6, wsptr /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT. * cK represents sqrt(2) * cos(K*pi/28). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 13))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp13 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp10 = tmp0 + tmp6 tmp14 = tmp0 - tmp6 tmp11 = tmp1 + tmp5 tmp15 = tmp1 - tmp5 tmp12 = tmp2 + tmp4 tmp16 = tmp2 - tmp4 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 13))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = tmp10 + tmp11 + tmp12 + tmp13 - libc.Int32FromInt32(14)*libc.Int32FromInt32(CENTERJSAMPLE) tmp13 += tmp13 *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp13)*int32(libc.Float64FromFloat64(1.274162392)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) tmp10 = (tmp14 + tmp15) * int32(libc.Float64FromFloat64(1.105676686)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (tmp10 - tmp15*int32(libc.Float64FromFloat64(1.719280954)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) /* Odd part */ tmp10 = tmp1 + tmp2 tmp11 = tmp5 - tmp4 *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = tmp0 - tmp10 + tmp3 - tmp11 - tmp6 tmp3 <<= int32(CONST_BITS2) tmp10 = tmp10 * -int32(libc.Float64FromFloat64(0.158341681)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) tmp12 = (tmp0+tmp1)*int32(libc.Float64FromFloat64(1.334852607)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = (tmp11 + tmp12 + tmp3 + tmp6 - (tmp0+tmp6)*int32(libc.Float64FromFloat64(1.126980169)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) ctr++ if ctr != int32(DCTSIZE) { if ctr == int32(14) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/14)**2 = 16/49, which we partially * fold into the constant multipliers and final shifting: * cK now represents sqrt(2) * cos(K*pi/28) * 32/49. */ dataptr = data wsptr = bp ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp13 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp10 = tmp0 + tmp6 tmp14 = tmp0 - tmp6 tmp11 = tmp1 + tmp5 tmp15 = tmp1 - tmp5 tmp12 = tmp2 + tmp4 tmp16 = tmp2 - tmp4 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp10+tmp11+tmp12+tmp13)*int32(libc.Float64FromFloat64(0.653061224)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) tmp13 += tmp13 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp13)*int32(libc.Float64FromFloat64(0.832106052)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) tmp10 = (tmp14 + tmp15) * int32(libc.Float64FromFloat64(0.72207457)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (tmp10 - tmp15*int32(libc.Float64FromFloat64(1.122795725)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) /* Odd part */ tmp10 = tmp1 + tmp2 tmp11 = tmp5 - tmp4 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = ((tmp0-tmp10+tmp3-tmp11-tmp6)*int32(libc.Float64FromFloat64(0.653061224)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) tmp3 = tmp3 * int32(libc.Float64FromFloat64(0.653061224)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) tmp12 = (tmp0+tmp1)*int32(libc.Float64FromFloat64(0.871740478)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp11 + tmp12 + tmp3 - tmp0*int32(libc.Float64FromFloat64(0.735987049)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(1)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 15x15 sample block. */ func Xjpeg_fdct_15x15(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(224) defer tls.Free(224) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, z1, z2, z3 TINT32 var _ /* workspace at bp+0 */ [56]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, wsptr, z1, z2, z3 /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT. * cK represents sqrt(2) * cos(K*pi/30). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 14))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 13))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp7 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp10 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 14))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 13))) tmp12 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp13 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp14 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp15 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp16 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) z1 = tmp0 + tmp4 + tmp5 z2 = tmp1 + tmp3 + tmp6 z3 = tmp2 + tmp7 /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = z1 + z2 + z3 - libc.Int32FromInt32(15)*libc.Int32FromInt32(CENTERJSAMPLE) z3 += z3 *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = ((z1-z3)*int32(libc.Float64FromFloat64(1.144122806)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) tmp2 += (tmp1+tmp4)>>int32(1) - tmp7 - tmp7 z1 = (tmp3-tmp2)*int32(libc.Float64FromFloat64(1.531135173)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = (z2 + z3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) /* Odd part */ tmp2 = (tmp10 - tmp12 - tmp13 + tmp15 + tmp16) * int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(CONST_BITS2) ctr++ if ctr != int32(DCTSIZE) { if ctr == int32(15) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/15)**2 = 64/225, which we partially * fold into the constant multipliers and final shifting: * cK now represents sqrt(2) * cos(K*pi/30) * 256/225. */ dataptr = data wsptr = bp ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp7 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp10 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp12 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp13 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp14 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp15 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp16 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) z1 = tmp0 + tmp4 + tmp5 z2 = tmp1 + tmp3 + tmp6 z3 = tmp2 + tmp7 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((z1+z2+z3)*int32(libc.Float64FromFloat64(1.137777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) z3 += z3 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = ((z1-z3)*int32(libc.Float64FromFloat64(1.301757503)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) tmp2 += (tmp1+tmp4)>>int32(1) - tmp7 - tmp7 z1 = (tmp3-tmp2)*int32(libc.Float64FromFloat64(1.742091575)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = (z2 + z3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) /* Odd part */ tmp2 = (tmp10 - tmp12 - tmp13 + tmp15 + tmp16) * int32(libc.Float64FromFloat64(1.393487498)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(2)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 16x16 sample block. */ func Xjpeg_fdct_16x16(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(256) defer tls.Free(256) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7 TINT32 var _ /* workspace at bp+0 */ [64]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, wsptr /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * cK represents sqrt(2) * cos(K*pi/32). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 15))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 14))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 13))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp7 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp10 = tmp0 + tmp7 tmp14 = tmp0 - tmp7 tmp11 = tmp1 + tmp6 tmp15 = tmp1 - tmp6 tmp12 = tmp2 + tmp5 tmp16 = tmp2 - tmp5 tmp13 = tmp3 + tmp4 tmp17 = tmp3 - tmp4 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 15))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 14))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 13))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp7 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 + tmp12 + tmp13 - libc.Int32FromInt32(16)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp13)*int32(libc.Float64FromFloat64(1.306562965)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) tmp10 = (tmp17-tmp15)*int32(libc.Float64FromFloat64(0.275899379)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (tmp10 - tmp14*int32(libc.Float64FromFloat64(0.211164243)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp11 = (tmp0+tmp1)*int32(libc.Float64FromFloat64(1.353318001)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp11 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp12 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) ctr++ if ctr != int32(DCTSIZE) { if ctr == libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/16)**2 = 1/2**2. * cK represents sqrt(2) * cos(K*pi/32). */ dataptr = data wsptr = bp ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp7 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp10 = tmp0 + tmp7 tmp14 = tmp0 - tmp7 tmp11 = tmp1 + tmp6 tmp15 = tmp1 - tmp6 tmp12 = tmp2 + tmp5 tmp16 = tmp2 - tmp5 tmp13 = tmp3 + tmp4 tmp17 = tmp3 - tmp4 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp7 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp10 + tmp11 + tmp12 + tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp13)*int32(libc.Float64FromFloat64(1.306562965)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) tmp10 = (tmp17-tmp15)*int32(libc.Float64FromFloat64(0.275899379)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (tmp10 - tmp14*int32(libc.Float64FromFloat64(0.211164243)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) /* Odd part */ tmp11 = (tmp0+tmp1)*int32(libc.Float64FromFloat64(1.353318001)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp11 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp12 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(2)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(2)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 16x8 sample block. * * 16-point FDCT in pass 1 (rows), 8-point in pass 2 (columns). */ func Xjpeg_fdct_16x8(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, z1 TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, z1 /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * 16-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/32). */ dataptr = data ctr = 0 ctr = 0 for { if !(ctr < int32(DCTSIZE)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 15))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 14))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 13))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp7 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp10 = tmp0 + tmp7 tmp14 = tmp0 - tmp7 tmp11 = tmp1 + tmp6 tmp15 = tmp1 - tmp6 tmp12 = tmp2 + tmp5 tmp16 = tmp2 - tmp5 tmp13 = tmp3 + tmp4 tmp17 = tmp3 - tmp4 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 15))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 14))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 13))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp7 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 + tmp12 + tmp13 - libc.Int32FromInt32(16)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp13)*int32(libc.Float64FromFloat64(1.306562965)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) tmp10 = (tmp17-tmp15)*int32(libc.Float64FromFloat64(0.275899379)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (tmp10 - tmp14*int32(libc.Float64FromFloat64(0.211164243)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp11 = (tmp0+tmp1)*int32(libc.Float64FromFloat64(1.353318001)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp11 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp12 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by 8/16 = 1/2. * 8-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/16). */ dataptr = data ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "c1" should be "c6". */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp10 = tmp0 + tmp3 tmp12 = tmp0 - tmp3 tmp11 = tmp1 + tmp2 tmp13 = tmp1 - tmp2 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp10 + tmp11 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = (tmp10 - tmp11 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) z1 = (tmp12 + tmp13) * libc.Int32FromInt32(4433) /* c6 */ *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (z1 + tmp12*libc.Int32FromInt32(6270) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (z1 - tmp13*libc.Int32FromInt32(15137) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * i0..i3 in the paper are tmp0..tmp3 here. */ tmp12 = tmp0 + tmp2 tmp13 = tmp1 + tmp3 z1 = (tmp12 + tmp13) * libc.Int32FromInt32(9633) /* c3 */ tmp12 = tmp12 * -libc.Int32FromInt32(3196) /* -c3+c5 */ tmp13 = tmp13 * -libc.Int32FromInt32(16069) /* -c3-c5 */ tmp12 += z1 tmp13 += z1 z1 = (tmp0 + tmp3) * -libc.Int32FromInt32(7373) /* -c3+c7 */ tmp0 = tmp0 * libc.Int32FromInt32(12299) /* c1+c3-c5-c7 */ tmp3 = tmp3 * libc.Int32FromInt32(2446) /* -c1+c3+c5-c7 */ tmp0 += z1 + tmp12 tmp3 += z1 + tmp13 z1 = (tmp1 + tmp2) * -libc.Int32FromInt32(20995) /* -c1-c3 */ tmp1 = tmp1 * libc.Int32FromInt32(25172) /* c1+c3+c5-c7 */ tmp2 = tmp2 * libc.Int32FromInt32(16819) /* c1+c3-c5+c7 */ tmp1 += z1 + tmp13 tmp2 += z1 + tmp12 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp0 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 14x7 sample block. * * 14-point FDCT in pass 1 (rows), 7-point in pass 2 (columns). */ func Xjpeg_fdct_14x7(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp2, tmp3, tmp4, tmp5, tmp6, z1, z2, z3 TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp2, tmp3, tmp4, tmp5, tmp6, z1, z2, z3 /* Zero bottom row of output coefficient block. */ libc.Xmemset(tls, data+uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * 14-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/28). */ dataptr = data ctr = 0 for { if !(ctr < int32(7)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 13))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp13 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp10 = tmp0 + tmp6 tmp14 = tmp0 - tmp6 tmp11 = tmp1 + tmp5 tmp15 = tmp1 - tmp5 tmp12 = tmp2 + tmp4 tmp16 = tmp2 - tmp4 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 13))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 12))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp6 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 + tmp12 + tmp13 - libc.Int32FromInt32(14)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) tmp13 += tmp13 *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp13)*int32(libc.Float64FromFloat64(1.274162392)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) tmp10 = (tmp14 + tmp15) * int32(libc.Float64FromFloat64(1.105676686)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (tmp10 - tmp15*int32(libc.Float64FromFloat64(1.719280954)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = tmp1 + tmp2 tmp11 = tmp5 - tmp4 *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp0 - tmp10 + tmp3 - tmp11 - tmp6) << libc.Int32FromInt32(PASS1_BITS) tmp3 <<= int32(CONST_BITS2) tmp10 = tmp10 * -int32(libc.Float64FromFloat64(0.158341681)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) tmp12 = (tmp0+tmp1)*int32(libc.Float64FromFloat64(1.334852607)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = (tmp11 + tmp12 + tmp3 + tmp6 - (tmp0+tmp6)*int32(libc.Float64FromFloat64(1.126980169)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/14)*(8/7) = 32/49, which we * partially fold into the constant multipliers and final shifting: * 7-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/14) * 64/49. */ dataptr = data ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp10 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp12 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) z1 = tmp0 + tmp2 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((z1+tmp1+tmp3)*int32(libc.Float64FromFloat64(1.306122449)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) tmp3 += tmp3 z1 -= tmp3 z1 -= tmp3 z1 = z1 * int32(libc.Float64FromFloat64(0.46178402)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) z1 -= z2 z2 = (tmp0 - tmp1) * int32(libc.Float64FromFloat64(1.151670509)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (z1 + z2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) /* Odd part */ tmp1 = (tmp10 + tmp11) * int32(libc.Float64FromFloat64(1.221765677)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 12x6 sample block. * * 12-point FDCT in pass 1 (rows), 6-point in pass 2 (columns). */ func Xjpeg_fdct_12x6(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp2, tmp3, tmp4, tmp5 TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp2, tmp3, tmp4, tmp5 /* Zero 2 bottom rows of output coefficient block. */ libc.Xmemset(tls, data+uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE)*libc.Uint32FromInt32(2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * 12-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/24). */ dataptr = data ctr = 0 for { if !(ctr < int32(6)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp10 = tmp0 + tmp5 tmp13 = tmp0 - tmp5 tmp11 = tmp1 + tmp4 tmp14 = tmp1 - tmp4 tmp12 = tmp2 + tmp3 tmp15 = tmp2 - tmp3 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 11))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 10))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 + tmp12 - libc.Int32FromInt32(12)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (tmp13 - tmp14 - tmp15) << libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp12)*int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (tmp14 - tmp15 + (tmp13+tmp15)*int32(libc.Float64FromFloat64(1.366025404)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = (tmp1 + tmp4) * libc.Int32FromInt32(4433) /* c9 */ tmp14 = tmp10 + tmp1*libc.Int32FromInt32(6270) /* c3-c9 */ tmp15 = tmp10 - tmp4*libc.Int32FromInt32(15137) /* c3+c9 */ tmp12 = (tmp0 + tmp2) * int32(libc.Float64FromFloat64(1.121971054)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp11 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp12 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/12)*(8/6) = 8/9, which we * partially fold into the constant multipliers and final shifting: * 6-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/12) * 16/9. */ dataptr = data ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp10 = tmp0 + tmp2 tmp12 = tmp0 - tmp2 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp10+tmp11)*int32(libc.Float64FromFloat64(1.777777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (tmp12*int32(libc.Float64FromFloat64(2.177324216)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp11-tmp11)*int32(libc.Float64FromFloat64(1.257078722)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) /* Odd part */ tmp10 = (tmp0 + tmp2) * int32(libc.Float64FromFloat64(0.650711829)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = ((tmp0-tmp1-tmp2)*int32(libc.Float64FromFloat64(1.777777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp10 + (tmp2-tmp1)*int32(libc.Float64FromFloat64(1.777777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 10x5 sample block. * * 10-point FDCT in pass 1 (rows), 5-point in pass 2 (columns). */ func Xjpeg_fdct_10x5(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp2, tmp3, tmp4 TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp2, tmp3, tmp4 /* Zero 3 bottom rows of output coefficient block. */ libc.Xmemset(tls, data+uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE)*libc.Uint32FromInt32(3)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * 10-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/20). */ dataptr = data ctr = 0 for { if !(ctr < int32(5)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp12 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp10 = tmp0 + tmp4 tmp13 = tmp0 - tmp4 tmp11 = tmp1 + tmp3 tmp14 = tmp1 - tmp3 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 9))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 8))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 + tmp12 - libc.Int32FromInt32(10)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) tmp12 += tmp12 *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp12)*int32(libc.Float64FromFloat64(1.144122806)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) tmp10 = (tmp13 + tmp14) * int32(libc.Float64FromFloat64(0.831253876)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (tmp10 - tmp14*int32(libc.Float64FromFloat64(2.176250899)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = tmp0 + tmp4 tmp11 = tmp1 - tmp3 *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp10 - tmp11 - tmp2) << libc.Int32FromInt32(PASS1_BITS) tmp2 <<= int32(CONST_BITS2) *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = (tmp0*int32(libc.Float64FromFloat64(1.396802247)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) tmp12 = (tmp0-tmp4)*int32(libc.Float64FromFloat64(0.951056516)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp12 - tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/10)*(8/5) = 32/25, which we * fold into the constant multipliers: * 5-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/10) * 32/25. */ dataptr = data ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp10 = tmp0 + tmp1 tmp11 = tmp0 - tmp1 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp10+tmp2)*int32(libc.Float64FromFloat64(1.28)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp11 = tmp11 * int32(libc.Float64FromFloat64(1.011928851)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = (tmp11 - tmp10 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = (tmp0 + tmp1) * int32(libc.Float64FromFloat64(1.064004961)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp10 - tmp1*int32(libc.Float64FromFloat64(2.785601151)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on an 8x4 sample block. * * 8-point FDCT in pass 1 (rows), 4-point in pass 2 (columns). */ func Xjpeg_fdct_8x4(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, z1 TINT32 _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, z1 /* Zero 4 bottom rows of output coefficient block. */ libc.Xmemset(tls, data+uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE)*libc.Uint32FromInt32(4)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * We must also scale the output by 8/4 = 2, which we add here. * 8-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/16). */ dataptr = data ctr = 0 for { if !(ctr < int32(4)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "c1" should be "c6". */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp10 = tmp0 + tmp3 tmp12 = tmp0 - tmp3 tmp11 = tmp1 + tmp2 tmp13 = tmp1 - tmp2 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 - libc.Int32FromInt32(8)*libc.Int32FromInt32(CENTERJSAMPLE)) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = (tmp10 - tmp11) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) z1 = (tmp12 + tmp13) * libc.Int32FromInt32(4433) /* c6 */ /* Add fudge factor here for final descale. */ z1 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (z1 + tmp12*libc.Int32FromInt32(6270)) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (z1 - tmp13*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * i0..i3 in the paper are tmp0..tmp3 here. */ tmp12 = tmp0 + tmp2 tmp13 = tmp1 + tmp3 z1 = (tmp12 + tmp13) * libc.Int32FromInt32(9633) /* c3 */ /* Add fudge factor here for final descale. */ z1 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(2)) tmp12 = tmp12 * -libc.Int32FromInt32(3196) /* -c3+c5 */ tmp13 = tmp13 * -libc.Int32FromInt32(16069) /* -c3-c5 */ tmp12 += z1 tmp13 += z1 z1 = (tmp0 + tmp3) * -libc.Int32FromInt32(7373) /* -c3+c7 */ tmp0 = tmp0 * libc.Int32FromInt32(12299) /* c1+c3-c5-c7 */ tmp3 = tmp3 * libc.Int32FromInt32(2446) /* -c1+c3+c5-c7 */ tmp0 += z1 + tmp12 tmp3 += z1 + tmp13 z1 = (tmp1 + tmp2) * -libc.Int32FromInt32(20995) /* -c1-c3 */ tmp1 = tmp1 * libc.Int32FromInt32(25172) /* c1+c3+c5-c7 */ tmp2 = tmp2 * libc.Int32FromInt32(16819) /* c1+c3-c5+c7 */ tmp1 += z1 + tmp13 tmp2 += z1 + tmp12 *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = tmp0 >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = tmp1 >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = tmp2 >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = tmp3 >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * 4-point FDCT kernel, * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT]. */ dataptr = data ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ /* Add fudge factor here for final descale. */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp10 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp0 + tmp1) >> libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (tmp0 - tmp1) >> libc.Int32FromInt32(PASS1_BITS) /* Odd part */ tmp0 = (tmp10 + tmp11) * libc.Int32FromInt32(4433) /* c6 */ /* Add fudge factor here for final descale. */ tmp0 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp0 + tmp10*libc.Int32FromInt32(6270)) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp0 - tmp11*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 6x3 sample block. * * 6-point FDCT in pass 1 (rows), 3-point in pass 2 (columns). */ func Xjpeg_fdct_6x3(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp2 TINT32 _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp2 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * We scale the results further by 2 as part of output adaption * scaling for different DCT size. * 6-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/12). */ dataptr = data ctr = 0 for { if !(ctr < int32(3)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp10 = tmp0 + tmp2 tmp12 = tmp0 - tmp2 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 - libc.Int32FromInt32(6)*libc.Int32FromInt32(CENTERJSAMPLE)) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (tmp12*int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp11-tmp11)*int32(libc.Float64FromFloat64(0.707106781)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) /* Odd part */ tmp10 = ((tmp0+tmp2)*int32(libc.Float64FromFloat64(0.366025404)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = tmp10 + (tmp0+tmp1)<<(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp0 - tmp1 - tmp2) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = tmp10 + (tmp2-tmp1)<<(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/6)*(8/3) = 32/9, which we partially * fold into the constant multipliers (other part was done in pass 1): * 3-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/6) * 16/9. */ dataptr = data ctr = 0 for { if !(ctr < int32(6)) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp0+tmp1)*int32(libc.Float64FromFloat64(1.777777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = ((tmp0-tmp1-tmp1)*int32(libc.Float64FromFloat64(1.257078722)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp2*int32(libc.Float64FromFloat64(2.177324216)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 4x2 sample block. * * 4-point FDCT in pass 1 (rows), 2-point in pass 2 (columns). */ func Xjpeg_fdct_4x2(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var elemptr TJSAMPROW var tmp0, tmp10, tmp12, tmp2, tmp4, tmp5 TDCTELEM var tmp1, tmp11, tmp13, tmp3, z1, z2, z3 TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _ = elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, tmp5, z1, z2, z3 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT. * 4-point FDCT kernel, * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT]. */ /* Row 0 */ elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data)) + uintptr(start_col) /* Even part */ tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) tmp0 = tmp4 + tmp5 tmp2 = tmp4 - tmp5 /* Odd part */ z2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) z3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) z1 = (z2 + z3) * libc.Int32FromInt32(4433) /* c6 */ /* Add fudge factor here for final descale. */ z1 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(3) - libc.Int32FromInt32(1)) tmp1 = z1 + z2*libc.Int32FromInt32(6270) /* c2-c6 */ tmp3 = z1 - z3*libc.Int32FromInt32(15137) /* c2+c6 */ /* Row 1 */ elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + 1*4)) + uintptr(start_col) /* Even part */ tmp4 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp5 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) tmp10 = tmp4 + tmp5 tmp12 = tmp4 - tmp5 /* Odd part */ z2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) z3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) z1 = (z2 + z3) * libc.Int32FromInt32(4433) /* c6 */ tmp11 = z1 + z2*libc.Int32FromInt32(6270) /* c2-c6 */ tmp13 = z1 - z3*libc.Int32FromInt32(15137) /* c2+c6 */ /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/4)*(8/2) = 2**3. */ /* Column 0 */ /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp0 + tmp10 - libc.Int32FromInt32(8)*libc.Int32FromInt32(CENTERJSAMPLE)) << int32(3) *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp0 - tmp10) << int32(3) /* Column 1 */ *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0)+libc.Int32FromInt32(1))*4)) = (tmp1 + tmp11) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(3)) *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1)+libc.Int32FromInt32(1))*4)) = (tmp1 - tmp11) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(3)) /* Column 2 */ *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0)+libc.Int32FromInt32(2))*4)) = (tmp2 + tmp12) << int32(3) *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1)+libc.Int32FromInt32(2))*4)) = (tmp2 - tmp12) << int32(3) /* Column 3 */ *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0)+libc.Int32FromInt32(3))*4)) = (tmp3 + tmp13) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(3)) *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1)+libc.Int32FromInt32(3))*4)) = (tmp3 - tmp13) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(3)) } /* * Perform the forward DCT on a 2x1 sample block. * * 2-point FDCT in pass 1 (rows), 1-point in pass 2 (columns). */ func Xjpeg_fdct_2x1(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var elemptr TJSAMPROW var tmp0, tmp1 TDCTELEM _, _, _ = elemptr, tmp0, tmp1 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data)) + uintptr(start_col) tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) /* We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/2)*(8/1) = 2**5. */ /* Even part */ /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(data)) = (tmp0 + tmp1 - libc.Int32FromInt32(2)*libc.Int32FromInt32(CENTERJSAMPLE)) << int32(5) /* Odd part */ *(*TDCTELEM)(unsafe.Pointer(data + 1*4)) = (tmp0 - tmp1) << int32(5) } /* * Perform the forward DCT on an 8x16 sample block. * * 8-point FDCT in pass 1 (rows), 16-point in pass 2 (columns). */ func Xjpeg_fdct_8x16(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(256) defer tls.Free(256) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, z1 TINT32 var _ /* workspace at bp+0 */ [64]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, wsptr, z1 /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * 8-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/16). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "c1" should be "c6". */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp10 = tmp0 + tmp3 tmp12 = tmp0 - tmp3 tmp11 = tmp1 + tmp2 tmp13 = tmp1 - tmp2 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 7))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 - libc.Int32FromInt32(8)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = (tmp10 - tmp11) << libc.Int32FromInt32(PASS1_BITS) z1 = (tmp12 + tmp13) * libc.Int32FromInt32(4433) /* c6 */ *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (z1 + tmp12*libc.Int32FromInt32(6270) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (z1 - tmp13*libc.Int32FromInt32(15137) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * i0..i3 in the paper are tmp0..tmp3 here. */ tmp12 = tmp0 + tmp2 tmp13 = tmp1 + tmp3 z1 = (tmp12 + tmp13) * libc.Int32FromInt32(9633) /* c3 */ tmp12 = tmp12 * -libc.Int32FromInt32(3196) /* -c3+c5 */ tmp13 = tmp13 * -libc.Int32FromInt32(16069) /* -c3-c5 */ tmp12 += z1 tmp13 += z1 z1 = (tmp0 + tmp3) * -libc.Int32FromInt32(7373) /* -c3+c7 */ tmp0 = tmp0 * libc.Int32FromInt32(12299) /* c1+c3-c5-c7 */ tmp3 = tmp3 * libc.Int32FromInt32(2446) /* -c1+c3+c5-c7 */ tmp0 += z1 + tmp12 tmp3 += z1 + tmp13 z1 = (tmp1 + tmp2) * -libc.Int32FromInt32(20995) /* -c1-c3 */ tmp1 = tmp1 * libc.Int32FromInt32(25172) /* c1+c3+c5-c7 */ tmp2 = tmp2 * libc.Int32FromInt32(16819) /* c1+c3-c5+c7 */ tmp1 += z1 + tmp13 tmp2 += z1 + tmp12 *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = (tmp0 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 7*4)) = (tmp3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) ctr++ if ctr != int32(DCTSIZE) { if ctr == libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by 8/16 = 1/2. * 16-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/32). */ dataptr = data wsptr = bp ctr = libc.Int32FromInt32(DCTSIZE) - libc.Int32FromInt32(1) for { if !(ctr >= 0) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp7 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp10 = tmp0 + tmp7 tmp14 = tmp0 - tmp7 tmp11 = tmp1 + tmp6 tmp15 = tmp1 - tmp6 tmp12 = tmp2 + tmp5 tmp16 = tmp2 - tmp5 tmp13 = tmp3 + tmp4 tmp17 = tmp3 - tmp4 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp7 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp10 + tmp11 + tmp12 + tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp13)*int32(libc.Float64FromFloat64(1.306562965)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) tmp10 = (tmp17-tmp15)*int32(libc.Float64FromFloat64(0.275899379)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (tmp10 - tmp14*int32(libc.Float64FromFloat64(0.211164243)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) /* Odd part */ tmp11 = (tmp0+tmp1)*int32(libc.Float64FromFloat64(1.353318001)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp11 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp12 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(1)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr-- } } /* * Perform the forward DCT on a 7x14 sample block. * * 7-point FDCT in pass 1 (rows), 14-point in pass 2 (columns). */ func Xjpeg_fdct_7x14(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(192) defer tls.Free(192) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp2, tmp3, tmp4, tmp5, tmp6, z1, z2, z3 TINT32 var _ /* workspace at bp+0 */ [48]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp2, tmp3, tmp4, tmp5, tmp6, wsptr, z1, z2, z3 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * 7-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/14). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp3 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp10 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 6))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp12 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) z1 = tmp0 + tmp2 /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (z1 + tmp1 + tmp3 - libc.Int32FromInt32(7)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) tmp3 += tmp3 z1 -= tmp3 z1 -= tmp3 z1 = z1 * int32(libc.Float64FromFloat64(0.353553391)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) z1 -= z2 z2 = (tmp0 - tmp1) * int32(libc.Float64FromFloat64(0.881747734)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 6*4)) = (z1 + z2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp1 = (tmp10 + tmp11) * int32(libc.Float64FromFloat64(0.935414347)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp1 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 5*4)) = (tmp2 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) ctr++ if ctr != int32(DCTSIZE) { if ctr == int32(14) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/7)*(8/14) = 32/49, which we * fold into the constant multipliers: * 14-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/28) * 32/49. */ dataptr = data wsptr = bp ctr = 0 for { if !(ctr < int32(7)) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp13 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp10 = tmp0 + tmp6 tmp14 = tmp0 - tmp6 tmp11 = tmp1 + tmp5 tmp15 = tmp1 - tmp5 tmp12 = tmp2 + tmp4 tmp16 = tmp2 - tmp4 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp5 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp6 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp10+tmp11+tmp12+tmp13)*int32(libc.Float64FromFloat64(0.653061224)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp13 += tmp13 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp13)*int32(libc.Float64FromFloat64(0.832106052)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp10 = (tmp14 + tmp15) * int32(libc.Float64FromFloat64(0.72207457)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (tmp10 - tmp15*int32(libc.Float64FromFloat64(1.122795725)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = tmp1 + tmp2 tmp11 = tmp5 - tmp4 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = ((tmp0-tmp10+tmp3-tmp11-tmp6)*int32(libc.Float64FromFloat64(0.653061224)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp3 = tmp3 * int32(libc.Float64FromFloat64(0.653061224)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp12 = (tmp0+tmp1)*int32(libc.Float64FromFloat64(0.871740478)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp11 + tmp12 + tmp3 - tmp0*int32(libc.Float64FromFloat64(0.735987049)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 6x12 sample block. * * 6-point FDCT in pass 1 (rows), 12-point in pass 2 (columns). */ func Xjpeg_fdct_6x12(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(128) defer tls.Free(128) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp2, tmp3, tmp4, tmp5 TINT32 var _ /* workspace at bp+0 */ [32]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp2, tmp3, tmp4, tmp5, wsptr /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * 6-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/12). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp10 = tmp0 + tmp2 tmp12 = tmp0 - tmp2 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 5))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp11 - libc.Int32FromInt32(6)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (tmp12*int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = ((tmp10-tmp11-tmp11)*int32(libc.Float64FromFloat64(0.707106781)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = ((tmp0+tmp2)*int32(libc.Float64FromFloat64(0.366025404)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = tmp10 + (tmp0+tmp1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = ((tmp13-tmp14-tmp15)*int32(libc.Float64FromFloat64(0.888888889)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp12)*int32(libc.Float64FromFloat64(1.088662108)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = ((tmp14-tmp15)*int32(libc.Float64FromFloat64(0.888888889)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = (tmp1 + tmp4) * int32(libc.Float64FromFloat64(0.4810632)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp11 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp12 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 5x10 sample block. * * 5-point FDCT in pass 1 (rows), 10-point in pass 2 (columns). */ func Xjpeg_fdct_5x10(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { bp := tls.Alloc(64) defer tls.Free(64) var ctr int32 var dataptr, wsptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp2, tmp3, tmp4 TINT32 var _ /* workspace at bp+0 */ [16]TDCTELEM _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp14, tmp2, tmp3, tmp4, wsptr /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * 5-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/10). */ dataptr = data ctr = 0 for { elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) tmp10 = tmp0 + tmp1 tmp11 = tmp0 - tmp1 tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 4))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp10 + tmp2 - libc.Int32FromInt32(5)*libc.Int32FromInt32(CENTERJSAMPLE)) << libc.Int32FromInt32(PASS1_BITS) tmp11 = tmp11 * int32(libc.Float64FromFloat64(0.790569415)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 4*4)) = (tmp11 - tmp10 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)-libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = (tmp0 + tmp1) * int32(libc.Float64FromFloat64(0.831253876)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp10 - tmp1*int32(libc.Float64FromFloat64(2.176250899)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS)) ctr++ if ctr != int32(DCTSIZE) { if ctr == int32(10) { break } /* Done. */ dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ } else { dataptr = bp } /* switch pointer to extended workspace */ goto _1 _1: } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/5)*(8/10) = 32/25, which we * fold into the constant multipliers: * 10-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/20) * 32/25. */ dataptr = data wsptr = bp ctr = 0 for { if !(ctr < int32(5)) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp12 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp10 = tmp0 + tmp4 tmp13 = tmp0 - tmp4 tmp11 = tmp1 + tmp3 tmp14 = tmp1 - tmp3 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp4 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp10+tmp11+tmp12)*int32(libc.Float64FromFloat64(1.28)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp12 += tmp12 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp12)*int32(libc.Float64FromFloat64(1.464477191)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp10 = (tmp13 + tmp14) * int32(libc.Float64FromFloat64(1.064004961)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (tmp10 - tmp14*int32(libc.Float64FromFloat64(2.785601151)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = tmp0 + tmp4 tmp11 = tmp1 - tmp3 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = ((tmp10-tmp11-tmp2)*int32(libc.Float64FromFloat64(1.28)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp2 = tmp2 * int32(libc.Float64FromFloat64(1.28)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) tmp12 = (tmp0-tmp4)*int32(libc.Float64FromFloat64(1.217352341)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp12 - tmp13 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(CONST_BITS2)+libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1))) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ wsptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 4x8 sample block. * * 4-point FDCT in pass 1 (rows), 8-point in pass 2 (columns). */ func Xjpeg_fdct_4x8(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, z1 TINT32 _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, z1 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * We must also scale the output by 8/4 = 2, which we add here. * 4-point FDCT kernel, * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT]. */ dataptr = data ctr = 0 for { if !(ctr < int32(DCTSIZE)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) tmp10 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 3))) tmp11 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp0 + tmp1 - libc.Int32FromInt32(4)*libc.Int32FromInt32(CENTERJSAMPLE)) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = (tmp0 - tmp1) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) /* Odd part */ tmp0 = (tmp10 + tmp11) * libc.Int32FromInt32(4433) /* c6 */ /* Add fudge factor here for final descale. */ tmp0 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(2)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = (tmp0 + tmp10*libc.Int32FromInt32(6270)) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 3*4)) = (tmp0 - tmp11*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * 8-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/16). */ dataptr = data ctr = 0 for { if !(ctr < int32(4)) { break } /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "c1" should be "c6". */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) /* Add fudge factor here for final descale. */ tmp10 = tmp0 + tmp3 + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(PASS1_BITS)-libc.Int32FromInt32(1)) tmp12 = tmp0 - tmp3 tmp11 = tmp1 + tmp2 tmp13 = tmp1 - tmp2 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp3 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp10 + tmp11) >> libc.Int32FromInt32(PASS1_BITS) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = (tmp10 - tmp11) >> libc.Int32FromInt32(PASS1_BITS) z1 = (tmp12 + tmp13) * libc.Int32FromInt32(4433) /* c6 */ /* Add fudge factor here for final descale. */ z1 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (z1 + tmp12*libc.Int32FromInt32(6270)) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (z1 - tmp13*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * i0..i3 in the paper are tmp0..tmp3 here. */ tmp12 = tmp0 + tmp2 tmp13 = tmp1 + tmp3 z1 = (tmp12 + tmp13) * libc.Int32FromInt32(9633) /* c3 */ /* Add fudge factor here for final descale. */ z1 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) tmp12 = tmp12 * -libc.Int32FromInt32(3196) /* -c3+c5 */ tmp13 = tmp13 * -libc.Int32FromInt32(16069) /* -c3-c5 */ tmp12 += z1 tmp13 += z1 z1 = (tmp0 + tmp3) * -libc.Int32FromInt32(7373) /* -c3+c7 */ tmp0 = tmp0 * libc.Int32FromInt32(12299) /* c1+c3-c5-c7 */ tmp3 = tmp3 * libc.Int32FromInt32(2446) /* -c1+c3+c5-c7 */ tmp0 += z1 + tmp12 tmp3 += z1 + tmp13 z1 = (tmp1 + tmp2) * -libc.Int32FromInt32(20995) /* -c1-c3 */ tmp1 = tmp1 * libc.Int32FromInt32(25172) /* c1+c3+c5-c7 */ tmp2 = tmp2 * libc.Int32FromInt32(16819) /* c1+c3-c5+c7 */ tmp1 += z1 + tmp13 tmp2 += z1 + tmp12 *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = tmp0 >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = tmp1 >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = tmp2 >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = tmp3 >> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 3x6 sample block. * * 3-point FDCT in pass 1 (rows), 6-point in pass 2 (columns). */ func Xjpeg_fdct_3x6(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11, tmp12, tmp2 TINT32 _, _, _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11, tmp12, tmp2 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT; * furthermore, we scale the results by 2**PASS1_BITS. * We scale the results further by 2 as part of output adaption * scaling for different DCT size. * 3-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/6). */ dataptr = data ctr = 0 for { if !(ctr < int32(6)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) tmp2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 2))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = (tmp0 + tmp1 - libc.Int32FromInt32(3)*libc.Int32FromInt32(CENTERJSAMPLE)) << (libc.Int32FromInt32(PASS1_BITS) + libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + 2*4)) = ((tmp0-tmp1-tmp1)*int32(libc.Float64FromFloat64(0.707106781)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) /* Odd part */ *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = (tmp2*int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We remove the PASS1_BITS scaling, but leave the results scaled up * by an overall factor of 8. * We must also scale the output by (8/6)*(8/3) = 32/9, which we partially * fold into the constant multipliers (other part was done in pass 1): * 6-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/12) * 16/9. */ dataptr = data ctr = 0 for { if !(ctr < int32(3)) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp10 = tmp0 + tmp2 tmp12 = tmp0 - tmp2 tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp2 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = ((tmp10+tmp11)*int32(libc.Float64FromFloat64(1.777777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (tmp12*int32(libc.Float64FromFloat64(2.177324216)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = ((tmp10-tmp11-tmp11)*int32(libc.Float64FromFloat64(1.257078722)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) /* Odd part */ tmp10 = (tmp0 + tmp2) * int32(libc.Float64FromFloat64(0.650711829)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = ((tmp0-tmp1-tmp2)*int32(libc.Float64FromFloat64(1.777777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp10 + (tmp2-tmp1)*int32(libc.Float64FromFloat64(1.777777778)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS2) + libc.Int32FromInt32(PASS1_BITS)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 2x4 sample block. * * 2-point FDCT in pass 1 (rows), 4-point in pass 2 (columns). */ func Xjpeg_fdct_2x4(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var ctr int32 var dataptr uintptr var elemptr TJSAMPROW var tmp0, tmp1, tmp10, tmp11 TINT32 _, _, _, _, _, _, _ = ctr, dataptr, elemptr, tmp0, tmp1, tmp10, tmp11 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: process rows. * Note results are scaled up by sqrt(8) compared to a true DCT. */ dataptr = data ctr = 0 for { if !(ctr < int32(4)) { break } elemptr = *(*TJSAMPROW)(unsafe.Pointer(sample_data + uintptr(ctr)*4)) + uintptr(start_col) /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(elemptr + 1))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(dataptr)) = tmp0 + tmp1 - libc.Int32FromInt32(2)*libc.Int32FromInt32(CENTERJSAMPLE) /* Odd part */ *(*TDCTELEM)(unsafe.Pointer(dataptr + 1*4)) = tmp0 - tmp1 dataptr += uintptr(DCTSIZE) * 4 /* advance pointer to next row */ goto _1 _1: ; ctr++ } /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/2)*(8/4) = 2**3. * 4-point FDCT kernel, * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT]. */ dataptr = data ctr = 0 for { if !(ctr < int32(2)) { break } /* Even part */ tmp0 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp1 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) + *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp10 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp11 = *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) - *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp0 + tmp1) << libc.Int32FromInt32(3) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (tmp0 - tmp1) << libc.Int32FromInt32(3) /* Odd part */ tmp0 = (tmp10 + tmp11) * libc.Int32FromInt32(4433) /* c6 */ /* Add fudge factor here for final descale. */ tmp0 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(3) - libc.Int32FromInt32(1)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp0 + tmp10*libc.Int32FromInt32(6270)) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(3)) *(*TDCTELEM)(unsafe.Pointer(dataptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp0 - tmp11*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS2) - libc.Int32FromInt32(3)) dataptr += 4 /* advance pointer to next column */ goto _2 _2: ; ctr++ } } /* * Perform the forward DCT on a 1x2 sample block. * * 1-point FDCT in pass 1 (rows), 2-point in pass 2 (columns). */ func Xjpeg_fdct_1x2(tls *libc.TLS, data uintptr, sample_data TJSAMPARRAY, start_col TJDIMENSION) { var tmp0, tmp1 TDCTELEM _, _ = tmp0, tmp1 /* Pre-zero output coefficient block. */ libc.Xmemset(tls, data, 0, libc.Uint32FromInt64(4)*libc.Uint32FromInt32(DCTSIZE2)) /* Pass 1: empty. */ /* Pass 2: process columns. * We leave the results scaled up by an overall factor of 8. * We must also scale the output by (8/1)*(8/2) = 2**5. */ /* Even part */ tmp0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer(sample_data)) + uintptr(start_col)))) tmp1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer(sample_data + 1*4)) + uintptr(start_col)))) /* Apply unsigned->signed conversion. */ *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp0 + tmp1 - libc.Int32FromInt32(2)*libc.Int32FromInt32(CENTERJSAMPLE)) << int32(5) /* Odd part */ *(*TDCTELEM)(unsafe.Pointer(data + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp0 - tmp1) << int32(5) } const JPEG_RST03 = 208 const MAX_CLEN = 32 const MAX_CORR_BITS = 1000 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* The legal range of a DCT coefficient is * -1024 .. +1023 for 8-bit sample data precision; * -16384 .. +16383 for 12-bit sample data precision. * Hence the magnitude should always fit in sample data precision + 2 bits. */ /* Derived data constructed for each Huffman table */ type Tc_derived_tbl = struct { Fehufco [256]uint32 Fehufsi [256]uint8 } /* Expanded entropy encoder object for Huffman encoding. * * The savable_state subrecord contains fields that change within an MCU, * but must not be updated permanently until we complete the MCU. */ type Tsavable_state1 = struct { Fput_buffer TINT32 Fput_bits int32 Flast_dc_val [4]int32 } /* This macro is to work around compilers with missing or broken * structure assignment. You'll need to fix this code if you have * such a compiler and you change MAX_COMPS_IN_SCAN. */ type Thuff_entropy_encoder = struct { Fpub Tjpeg_entropy_encoder Fsaved Tsavable_state1 Frestarts_to_go uint32 Fnext_restart_num int32 Fdc_derived_tbls [4]uintptr Fac_derived_tbls [4]uintptr Fdc_count_ptrs [4]uintptr Fac_count_ptrs [4]uintptr Fgather_statistics Tboolean Fnext_output_byte uintptr Ffree_in_buffer Tsize_t Fcinfo Tj_compress_ptr Fac_tbl_no int32 FEOBRUN uint32 FBE uint32 Fbit_buffer uintptr } /* Working state while writing an MCU (sequential mode). * This struct contains all the fields that are needed by subroutines. */ type Tworking_state = struct { Fnext_output_byte uintptr Ffree_in_buffer Tsize_t Fcur Tsavable_state1 Fcinfo Tj_compress_ptr } /* MAX_CORR_BITS is the number of bits the AC refinement correction-bit * buffer can hold. Larger sizes may slightly improve compression, but * 1000 is already well into the realm of overkill. * The minimum safe size is 64 bits. */ /* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32. * We assume that int right shift is unsigned if INT32 right shift is, * which should be safe. */ /* * Compute the derived values for a Huffman table. * This routine also performs some validation checks on the table. */ func _jpeg_make_c_derived_tbl(tls *libc.TLS, cinfo Tj_compress_ptr, isDC Tboolean, tblno int32, pdtbl uintptr) { var code uint32 var dtbl, htbl, v1 uintptr var huffcode [257]uint32 var huffsize [257]uint8 var i, l, lastp, maxsymbol, p, si, v3, v4, v5, v6 int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = code, dtbl, htbl, huffcode, huffsize, i, l, lastp, maxsymbol, p, si, v1, v3, v4, v5, v6 /* Note that huffsize[] and huffcode[] are filled in code-length order, * paralleling the order of the symbols themselves in htbl->huffval[]. */ /* Find the input Huffman table */ if tblno < 0 || tblno >= int32(NUM_HUFF_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_HUFF_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = tblno (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if isDC != 0 { v1 = *(*uintptr)(unsafe.Pointer(cinfo + 120 + uintptr(tblno)*4)) } else { v1 = *(*uintptr)(unsafe.Pointer(cinfo + 136 + uintptr(tblno)*4)) } htbl = v1 if htbl == libc.UintptrFromInt32(0) { htbl = Xjpeg_std_huff_table(tls, cinfo, isDC, tblno) } /* Allocate a workspace if we haven't already done so. */ if *(*uintptr)(unsafe.Pointer(pdtbl)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(pdtbl)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(1280)) } dtbl = *(*uintptr)(unsafe.Pointer(pdtbl)) /* Figure C.1: make table of Huffman code length for each symbol */ p = 0 l = int32(1) for { if !(l <= int32(16)) { break } i = libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(htbl + uintptr(l)))) if i < 0 || p+i > int32(256) { /* protect against table overrun */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_HUFF_TABLE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } for { v3 = i i-- if !(v3 != 0) { break } v4 = p p++ huffsize[v4] = libc.Uint8FromInt32(l) } goto _2 _2: ; l++ } huffsize[p] = uint8(0) lastp = p /* Figure C.2: generate the codes themselves */ /* We also validate that the counts represent a legal Huffman code tree. */ code = uint32(0) si = libc.Int32FromUint8(huffsize[0]) p = 0 for huffsize[p] != 0 { for libc.Int32FromUint8(huffsize[p]) == si { v5 = p p++ huffcode[v5] = code code++ } /* code is now 1 more than the last code used for codelength si; but * it must still fit in si bits, since no code is allowed to be all ones. */ if libc.Int32FromUint32(code) >= libc.Int32FromInt32(1)< maxsymbol || *(*uint8)(unsafe.Pointer(dtbl + 1024 + uintptr(i))) != 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_HUFF_TABLE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } *(*uint32)(unsafe.Pointer(dtbl + uintptr(i)*4)) = huffcode[p] *(*uint8)(unsafe.Pointer(dtbl + 1024 + uintptr(i))) = huffsize[p] goto _7 _7: ; p++ } } /* Outputting bytes to the file. * NB: these must be called only when actually outputting, * that is, entropy->gather_statistics == FALSE. */ /* Emit a byte, taking 'action' if must suspend. */ /* Emit a byte */ func _dump_buffer_s(tls *libc.TLS, state uintptr) (r Tboolean) { /* Empty the output buffer; return TRUE if successful, FALSE if must suspend */ var dest uintptr _ = dest dest = (*Tjpeg_compress_struct)(unsafe.Pointer((*Tworking_state)(unsafe.Pointer(state)).Fcinfo)).Fdest if !((*(*func(*libc.TLS, Tj_compress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_destination_mgr)(unsafe.Pointer(dest)).Fempty_output_buffer})))(tls, (*Tworking_state)(unsafe.Pointer(state)).Fcinfo) != 0) { return int32(FALSE1) } /* After a successful buffer dump, must reset buffer pointers */ (*Tworking_state)(unsafe.Pointer(state)).Fnext_output_byte = (*Tjpeg_destination_mgr)(unsafe.Pointer(dest)).Fnext_output_byte (*Tworking_state)(unsafe.Pointer(state)).Ffree_in_buffer = (*Tjpeg_destination_mgr)(unsafe.Pointer(dest)).Ffree_in_buffer return int32(TRUE1) } func _dump_buffer_e(tls *libc.TLS, entropy Thuff_entropy_ptr) { /* Empty the output buffer; we do not support suspension in this case. */ var dest uintptr _ = dest dest = (*Tjpeg_compress_struct)(unsafe.Pointer((*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo)).Fdest if !((*(*func(*libc.TLS, Tj_compress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_destination_mgr)(unsafe.Pointer(dest)).Fempty_output_buffer})))(tls, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo) != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo)).Ferr)).Fmsg_code = int32(JERR_CANT_SUSPEND) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo)).Ferr)).Ferror_exit})))(tls, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo) } /* After a successful buffer dump, must reset buffer pointers */ (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_output_byte = (*Tjpeg_destination_mgr)(unsafe.Pointer(dest)).Fnext_output_byte (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Ffree_in_buffer = (*Tjpeg_destination_mgr)(unsafe.Pointer(dest)).Ffree_in_buffer } /* Outputting bits to the file */ /* Only the right 24 bits of put_buffer are used; the valid bits are * left-justified in this part. At most 16 bits can be passed to emit_bits * in one call, and we never retain more than 7 bits in put_buffer * between calls, so 24 bits are sufficient. */ func _emit_bits_s(tls *libc.TLS, state uintptr, code uint32, size int32) (r Tboolean) { /* Emit some bits; return TRUE if successful, FALSE if must suspend */ var c, put_bits int32 var put_buffer TINT32 var v1, v2, v4, v5, v6, v8 uintptr var v3, v7 Tsize_t _, _, _, _, _, _, _, _, _, _, _ = c, put_bits, put_buffer, v1, v2, v3, v4, v5, v6, v7, v8 /* if size is 0, caller used an invalid Huffman table entry */ if size == 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Tworking_state)(unsafe.Pointer(state)).Fcinfo)).Ferr)).Fmsg_code = int32(JERR_HUFF_MISSING_CODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Tworking_state)(unsafe.Pointer(state)).Fcinfo)).Ferr)).Ferror_exit})))(tls, (*Tworking_state)(unsafe.Pointer(state)).Fcinfo) } /* mask off any extra bits in code */ put_buffer = libc.Int32FromUint32(code) & (libc.Int32FromInt32(1)<= int32(8) { c = put_buffer >> libc.Int32FromInt32(16) & libc.Int32FromInt32(0xFF) v2 = state v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ *(*TJOCTET)(unsafe.Pointer(v1)) = libc.Uint8FromInt32(c) v4 = state + 4 *(*Tsize_t)(unsafe.Pointer(v4))-- v3 = *(*Tsize_t)(unsafe.Pointer(v4)) if v3 == uint32(0) { if !(_dump_buffer_s(tls, state) != 0) { return int32(FALSE1) } } if c == int32(0xFF) { /* need to stuff a zero byte? */ v6 = state v5 = *(*uintptr)(unsafe.Pointer(v6)) *(*uintptr)(unsafe.Pointer(v6))++ *(*TJOCTET)(unsafe.Pointer(v5)) = libc.Uint8FromInt32(libc.Int32FromInt32(0)) v8 = state + 4 *(*Tsize_t)(unsafe.Pointer(v8))-- v7 = *(*Tsize_t)(unsafe.Pointer(v8)) if v7 == uint32(0) { if !(_dump_buffer_s(tls, state) != 0) { return int32(FALSE1) } } } put_buffer <<= int32(8) put_bits -= int32(8) } (*Tworking_state)(unsafe.Pointer(state)).Fcur.Fput_buffer = put_buffer /* update state variables */ (*Tworking_state)(unsafe.Pointer(state)).Fcur.Fput_bits = put_bits return int32(TRUE1) } func _emit_bits_e(tls *libc.TLS, entropy Thuff_entropy_ptr, code uint32, size int32) { /* Emit some bits, unless we are in gather mode */ var c, put_bits int32 var put_buffer TINT32 var v1, v2, v4, v5, v6, v8 uintptr var v3, v7 Tsize_t _, _, _, _, _, _, _, _, _, _, _ = c, put_bits, put_buffer, v1, v2, v3, v4, v5, v6, v7, v8 /* if size is 0, caller used an invalid Huffman table entry */ if size == 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo)).Ferr)).Fmsg_code = int32(JERR_HUFF_MISSING_CODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo)).Ferr)).Ferror_exit})))(tls, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo) } if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fgather_statistics != 0 { return } /* do nothing if we're only getting stats */ /* mask off any extra bits in code */ put_buffer = libc.Int32FromUint32(code) & (libc.Int32FromInt32(1)<= int32(8) { c = put_buffer >> libc.Int32FromInt32(16) & libc.Int32FromInt32(0xFF) v2 = entropy + 112 v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ *(*TJOCTET)(unsafe.Pointer(v1)) = libc.Uint8FromInt32(c) v4 = entropy + 116 *(*Tsize_t)(unsafe.Pointer(v4))-- v3 = *(*Tsize_t)(unsafe.Pointer(v4)) if v3 == uint32(0) { _dump_buffer_e(tls, entropy) } if c == int32(0xFF) { /* need to stuff a zero byte? */ v6 = entropy + 112 v5 = *(*uintptr)(unsafe.Pointer(v6)) *(*uintptr)(unsafe.Pointer(v6))++ *(*TJOCTET)(unsafe.Pointer(v5)) = libc.Uint8FromInt32(libc.Int32FromInt32(0)) v8 = entropy + 116 *(*Tsize_t)(unsafe.Pointer(v8))-- v7 = *(*Tsize_t)(unsafe.Pointer(v8)) if v7 == uint32(0) { _dump_buffer_e(tls, entropy) } } put_buffer <<= int32(8) put_bits -= int32(8) } (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fsaved.Fput_buffer = put_buffer /* update variables */ (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fsaved.Fput_bits = put_bits } func _flush_bits_s(tls *libc.TLS, state uintptr) (r Tboolean) { if !(_emit_bits_s(tls, state, uint32(0x7F), int32(7)) != 0) { /* fill any partial byte with ones */ return int32(FALSE1) } (*Tworking_state)(unsafe.Pointer(state)).Fcur.Fput_buffer = 0 /* and reset bit-buffer to empty */ (*Tworking_state)(unsafe.Pointer(state)).Fcur.Fput_bits = 0 return int32(TRUE1) } func _flush_bits_e(tls *libc.TLS, entropy Thuff_entropy_ptr) { _emit_bits_e(tls, entropy, uint32(0x7F), int32(7)) /* fill any partial byte with ones */ (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fsaved.Fput_buffer = 0 /* and reset bit-buffer to empty */ (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fsaved.Fput_bits = 0 } /* * Emit (or just count) a Huffman symbol. */ func _emit_dc_symbol(tls *libc.TLS, entropy Thuff_entropy_ptr, tbl_no int32, symbol int32) { var tbl uintptr _ = tbl if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fgather_statistics != 0 { *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl_no)*4)) + uintptr(symbol)*4))++ } else { tbl = *(*uintptr)(unsafe.Pointer(entropy + 44 + uintptr(tbl_no)*4)) _emit_bits_e(tls, entropy, *(*uint32)(unsafe.Pointer(tbl + uintptr(symbol)*4)), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tbl + 1024 + uintptr(symbol))))) } } func _emit_ac_symbol(tls *libc.TLS, entropy Thuff_entropy_ptr, tbl_no int32, symbol int32) { var tbl uintptr _ = tbl if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fgather_statistics != 0 { *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(entropy + 92 + uintptr(tbl_no)*4)) + uintptr(symbol)*4))++ } else { tbl = *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr(tbl_no)*4)) _emit_bits_e(tls, entropy, *(*uint32)(unsafe.Pointer(tbl + uintptr(symbol)*4)), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tbl + 1024 + uintptr(symbol))))) } } /* * Emit bits from a correction bit buffer. */ func _emit_buffered_bits(tls *libc.TLS, entropy Thuff_entropy_ptr, bufstart uintptr, nbits uint32) { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fgather_statistics != 0 { return } /* no real work */ for nbits > uint32(0) { _emit_bits_e(tls, entropy, uint32(*(*uint8)(unsafe.Pointer(bufstart))), int32(1)) bufstart++ nbits-- } } /* * Emit any pending EOBRUN symbol. */ func _emit_eobrun(tls *libc.TLS, entropy Thuff_entropy_ptr) { var nbits, temp int32 _, _ = nbits, temp if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FEOBRUN > uint32(0) { /* if there is any pending EOBRUN */ temp = libc.Int32FromUint32((*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FEOBRUN) nbits = 0 for { temp >>= int32(1) if !(temp != 0) { break } nbits++ } /* safety check: shouldn't happen given limited correction-bit buffer */ if nbits > int32(14) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo)).Ferr)).Fmsg_code = int32(JERR_HUFF_MISSING_CODE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo)).Ferr)).Ferror_exit})))(tls, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo) } _emit_ac_symbol(tls, entropy, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fac_tbl_no, nbits<> (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl /* DC differences are figured on the point-transformed values. */ v2 = temp - *(*int32)(unsafe.Pointer(entropy + 12 + 8 + uintptr(ci)*4)) temp2 = v2 if v2 == 0 { /* Count/emit the Huffman-coded symbol for the number of bits */ _emit_dc_symbol(tls, entropy, tbl, 0) goto _1 } *(*int32)(unsafe.Pointer(entropy + 12 + 8 + uintptr(ci)*4)) = temp /* Encode the DC coefficient difference per section G.1.2.1 */ v3 = temp2 temp = v3 if v3 < 0 { temp = -temp /* temp is abs value of input */ /* For a negative input, want temp2 = bitwise complement of abs(input) */ /* This code assumes we are on a two's complement machine */ temp2-- } /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0 for { nbits++ goto _4 _4: ; temp >>= int32(1) if !(temp != 0) { break } } /* Check for out-of-range coefficient values */ if nbits > max_coef_bits { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_DCT_COEF) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Count/emit the Huffman-coded symbol for the number of bits */ _emit_dc_symbol(tls, entropy, tbl, nbits) /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ _emit_bits_e(tls, entropy, libc.Uint32FromInt32(temp2), nbits) goto _1 _1: ; blkn++ } (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_output_byte (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Ffree_in_buffer /* Update restart-interval state too */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num++ *(*int32)(unsafe.Pointer(entropy + 40)) &= int32(7) } (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) } /* * MCU encoding for AC initial scan (either spectral selection, * or first pass of successive approximation). */ func _encode_mcu_AC_first1(tls *libc.TLS, cinfo Tj_compress_ptr, MCU_data TJBLOCKARRAY) (r1 Tboolean) { var Al, Se, k, max_coef_bits, nbits, r, temp, temp2, v2 int32 var block TJBLOCKROW var entropy Thuff_entropy_ptr var natural_order uintptr _, _, _, _, _, _, _, _, _, _, _, _ = Al, Se, block, entropy, k, max_coef_bits, natural_order, nbits, r, temp, temp2, v2 entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_output_byte = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Ffree_in_buffer = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer /* Emit restart marker if needed */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _emit_restart_e(tls, entropy, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num) } } Se = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe Al = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl natural_order = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order max_coef_bits = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision + int32(2) /* Encode the MCU data block */ block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data)) /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */ r = 0 /* r = run length of zeros */ k = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs for { if !(k <= Se) { break } v2 = int32(*(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)))*2))) temp = v2 if v2 == 0 { r++ goto _1 } /* We must apply the point transform by Al. For AC coefficients this * is an integer division with rounding towards 0. To do this portably * in C, we shift after obtaining the absolute value; so the code is * interwoven with finding the abs value (temp) and output bits (temp2). */ if temp < 0 { temp = -temp /* temp is abs value of input */ /* Apply the point transform, and watch out for case */ /* that nonzero coef is zero after point transform. */ temp >>= Al if temp == 0 { r++ goto _1 } /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ temp2 = ^temp } else { /* Apply the point transform, and watch out for case */ /* that nonzero coef is zero after point transform. */ temp >>= Al if temp == 0 { r++ goto _1 } temp2 = temp } /* Emit any pending EOBRUN */ if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FEOBRUN > uint32(0) { _emit_eobrun(tls, entropy) } /* if run length > 15, must emit special run-length-16 codes (0xF0) */ for r > int32(15) { _emit_ac_symbol(tls, entropy, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fac_tbl_no, int32(0xF0)) r -= int32(16) } /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0 for { nbits++ goto _3 _3: ; temp >>= int32(1) if !(temp != 0) { break } } /* Check for out-of-range coefficient values */ if nbits > max_coef_bits { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_DCT_COEF) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Count/emit Huffman symbol for run length / number of bits */ _emit_ac_symbol(tls, entropy, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fac_tbl_no, r< 0 { /* If there are trailing zeroes, */ (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FEOBRUN++ /* count an EOB */ if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FEOBRUN == uint32(0x7FFF) { _emit_eobrun(tls, entropy) } /* force it out to avoid overflow */ } (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_output_byte (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Ffree_in_buffer /* Update restart-interval state too */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num++ *(*int32)(unsafe.Pointer(entropy + 40)) &= int32(7) } (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) } /* * MCU encoding for DC successive approximation refinement scan. * Note: we assume such scans can be multi-component, * although the spec is not very clear on the point. */ func _encode_mcu_DC_refine1(tls *libc.TLS, cinfo Tj_compress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var Al, blkn int32 var entropy Thuff_entropy_ptr _, _, _ = Al, blkn, entropy entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_output_byte = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Ffree_in_buffer = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer /* Emit restart marker if needed */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _emit_restart_e(tls, entropy, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num) } } Al = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl /* Encode the MCU data blocks */ blkn = 0 for { if !(blkn < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } /* We simply emit the Al'th bit of the DC coefficient value. */ _emit_bits_e(tls, entropy, libc.Uint32FromInt32(int32(*(*TJCOEF)(unsafe.Pointer(*(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)))))>>Al), int32(1)) goto _1 _1: ; blkn++ } (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_output_byte (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Ffree_in_buffer /* Update restart-interval state too */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num++ *(*int32)(unsafe.Pointer(entropy + 40)) &= int32(7) } (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) } /* * MCU encoding for AC successive approximation refinement scan. */ func _encode_mcu_AC_refine1(tls *libc.TLS, cinfo Tj_compress_ptr, MCU_data TJBLOCKARRAY) (r1 Tboolean) { var Al, EOB, Se, k, r, temp, v3, v5 int32 var BR, v4 uint32 var BR_buffer, natural_order uintptr var absvalues [64]int32 var block TJBLOCKROW var entropy Thuff_entropy_ptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Al, BR, BR_buffer, EOB, Se, absvalues, block, entropy, k, natural_order, r, temp, v3, v4, v5 entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_output_byte = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Ffree_in_buffer = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer /* Emit restart marker if needed */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { _emit_restart_e(tls, entropy, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num) } } Se = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe Al = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAl natural_order = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order /* Encode the MCU data block */ block = *(*TJBLOCKROW)(unsafe.Pointer(MCU_data)) /* It is convenient to make a pre-pass to determine the transformed * coefficients' absolute values and the EOB position. */ EOB = 0 k = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs for { if !(k <= Se) { break } temp = int32(*(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)))*2))) /* We must apply the point transform by Al. For AC coefficients this * is an integer division with rounding towards 0. To do this portably * in C, we shift after obtaining the absolute value. */ if temp < 0 { temp = -temp } /* temp is abs value of input */ temp >>= Al /* apply the point transform */ absvalues[k] = temp /* save abs value for main pass */ if temp == int32(1) { EOB = k } /* EOB = index of last newly-nonzero coef */ goto _1 _1: ; k++ } /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */ r = 0 /* r = run length of zeros */ BR = uint32(0) /* BR = count of buffered bits added now */ BR_buffer = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fbit_buffer + uintptr((*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FBE) /* Append bits to buffer */ k = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs for { if !(k <= Se) { break } v3 = absvalues[k] temp = v3 if v3 == 0 { r++ goto _2 } /* Emit any required ZRLs, but not if they can be folded into EOB */ for r > int32(15) && k <= EOB { /* emit any pending EOBRUN and the BE correction bits */ _emit_eobrun(tls, entropy) /* Emit ZRL */ _emit_ac_symbol(tls, entropy, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fac_tbl_no, int32(0xF0)) r -= int32(16) /* Emit buffered correction bits that must be associated with ZRL */ _emit_buffered_bits(tls, entropy, BR_buffer, BR) BR_buffer = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fbit_buffer /* BE bits are gone now */ BR = uint32(0) } /* If the coef was previously nonzero, it only needs a correction bit. * NOTE: a straight translation of the spec's figure G.7 would suggest * that we also need to test r > 15. But if r > 15, we can only get here * if k > EOB, which implies that this coefficient is not 1. */ if temp > int32(1) { /* The correction bit is the next bit of the absolute value. */ v4 = BR BR++ *(*uint8)(unsafe.Pointer(BR_buffer + uintptr(v4))) = libc.Uint8FromInt32(temp & libc.Int32FromInt32(1)) goto _2 } /* Emit any pending EOBRUN and the BE correction bits */ _emit_eobrun(tls, entropy) /* Count/emit Huffman symbol for run length / number of bits */ _emit_ac_symbol(tls, entropy, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fac_tbl_no, r< 0 || BR > uint32(0) { /* If there are trailing zeroes, */ (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FEOBRUN++ /* count an EOB */ *(*uint32)(unsafe.Pointer(entropy + 132)) += BR /* concat my correction bits to older ones */ /* We force out the EOB if we risk either: * 1. overflow of the EOB counter; * 2. overflow of the correction bit buffer during the next MCU. */ if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FEOBRUN == uint32(0x7FFF) || (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FBE > libc.Uint32FromInt32(libc.Int32FromInt32(MAX_CORR_BITS)-libc.Int32FromInt32(DCTSIZE2)+libc.Int32FromInt32(1)) { _emit_eobrun(tls, entropy) } } (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_output_byte (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Ffree_in_buffer /* Update restart-interval state too */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num++ *(*int32)(unsafe.Pointer(entropy + 40)) &= int32(7) } (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) } /* Encode a single block's worth of coefficients */ func _encode_one_block(tls *libc.TLS, state uintptr, block TJCOEFPTR, last_dc_val int32, dctbl uintptr, actbl uintptr) (r1 Tboolean) { var Se, k, max_coef_bits, nbits, r, temp, temp2, v1, v2, v5, v6 int32 var natural_order uintptr _, _, _, _, _, _, _, _, _, _, _, _ = Se, k, max_coef_bits, natural_order, nbits, r, temp, temp2, v1, v2, v5, v6 Se = (*Tjpeg_compress_struct)(unsafe.Pointer((*Tworking_state)(unsafe.Pointer(state)).Fcinfo)).Flim_Se max_coef_bits = (*Tjpeg_compress_struct)(unsafe.Pointer((*Tworking_state)(unsafe.Pointer(state)).Fcinfo)).Fdata_precision + int32(3) natural_order = (*Tjpeg_compress_struct)(unsafe.Pointer((*Tworking_state)(unsafe.Pointer(state)).Fcinfo)).Fnatural_order /* Encode the DC coefficient difference per section F.1.2.1 */ v1 = int32(*(*TJCOEF)(unsafe.Pointer(block))) - last_dc_val temp = v1 if v1 == 0 { /* Emit the Huffman-coded symbol for the number of bits */ if !(_emit_bits_s(tls, state, *(*uint32)(unsafe.Pointer(dctbl)), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dctbl + 1024)))) != 0) { return int32(FALSE1) } } else { v2 = temp temp2 = v2 if v2 < 0 { temp = -temp /* temp is abs value of input */ /* For a negative input, want temp2 = bitwise complement of abs(input) */ /* This code assumes we are on a two's complement machine */ temp2-- } /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0 for { nbits++ goto _3 _3: ; temp >>= int32(1) if !(temp != 0) { break } } /* Check for out-of-range coefficient values. * Since we're encoding a difference, the range limit is twice as much. */ if nbits > max_coef_bits { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Tworking_state)(unsafe.Pointer(state)).Fcinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_DCT_COEF) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Tworking_state)(unsafe.Pointer(state)).Fcinfo)).Ferr)).Ferror_exit})))(tls, (*Tworking_state)(unsafe.Pointer(state)).Fcinfo) } /* Emit the Huffman-coded symbol for the number of bits */ if !(_emit_bits_s(tls, state, *(*uint32)(unsafe.Pointer(dctbl + uintptr(nbits)*4)), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(dctbl + 1024 + uintptr(nbits))))) != 0) { return int32(FALSE1) } /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ if !(_emit_bits_s(tls, state, libc.Uint32FromInt32(temp2), nbits) != 0) { return int32(FALSE1) } } /* Encode the AC coefficients per section F.1.2.2 */ r = 0 /* r = run length of zeros */ k = int32(1) for { if !(k <= Se) { break } v5 = int32(*(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)))*2))) temp = v5 if v5 == 0 { r++ goto _4 } /* if run length > 15, must emit special run-length-16 codes (0xF0) */ for r > int32(15) { if !(_emit_bits_s(tls, state, *(*uint32)(unsafe.Pointer(actbl + 240*4)), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(actbl + 1024 + 240)))) != 0) { return int32(FALSE1) } r -= int32(16) } v6 = temp temp2 = v6 if v6 < 0 { temp = -temp /* temp is abs value of input */ /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ /* This code assumes we are on a two's complement machine */ temp2-- } /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0 for { nbits++ goto _7 _7: ; temp >>= int32(1) if !(temp != 0) { break } } /* Check for out-of-range coefficient values. * Use ">=" instead of ">" so can use the * same one larger limit from DC check here. */ if nbits >= max_coef_bits { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Tworking_state)(unsafe.Pointer(state)).Fcinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_DCT_COEF) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer((*Tworking_state)(unsafe.Pointer(state)).Fcinfo)).Ferr)).Ferror_exit})))(tls, (*Tworking_state)(unsafe.Pointer(state)).Fcinfo) } /* Emit Huffman symbol for run length / number of bits */ temp = r< 0 { if !(_emit_bits_s(tls, state, *(*uint32)(unsafe.Pointer(actbl)), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(actbl + 1024)))) != 0) { return int32(FALSE1) } } return int32(TRUE1) } /* * Encode and output one MCU's worth of Huffman-compressed coefficients. */ func _encode_mcu_huff(tls *libc.TLS, cinfo Tj_compress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { bp := tls.Alloc(48) defer tls.Free(48) var blkn, ci int32 var compptr uintptr var entropy Thuff_entropy_ptr var _ /* state at bp+0 */ Tworking_state _, _, _, _ = blkn, ci, compptr, entropy entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Load up working state */ (*(*Tworking_state)(unsafe.Pointer(bp))).Fnext_output_byte = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte (*(*Tworking_state)(unsafe.Pointer(bp))).Ffree_in_buffer = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer (*(*Tworking_state)(unsafe.Pointer(bp))).Fcur = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fsaved (*(*Tworking_state)(unsafe.Pointer(bp))).Fcinfo = cinfo /* Emit restart marker if needed */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { if !(_emit_restart_s(tls, bp, (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num) != 0) { return int32(FALSE1) } } } /* Encode the MCU data blocks */ blkn = 0 for { if !(blkn < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } ci = *(*int32)(unsafe.Pointer(cinfo + 324 + uintptr(blkn)*4)) compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) if !(_encode_one_block(tls, bp, *(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)), *(*int32)(unsafe.Pointer(bp + 8 + 8 + uintptr(ci)*4)), *(*uintptr)(unsafe.Pointer(entropy + 44 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no)*4)), *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no)*4))) != 0) { return int32(FALSE1) } /* Update last_dc_val */ *(*int32)(unsafe.Pointer(bp + 8 + 8 + uintptr(ci)*4)) = int32(*(*TJCOEF)(unsafe.Pointer(*(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4))))) goto _1 _1: ; blkn++ } /* Completed MCU, so update state */ (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte = (*(*Tworking_state)(unsafe.Pointer(bp))).Fnext_output_byte (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer = (*(*Tworking_state)(unsafe.Pointer(bp))).Ffree_in_buffer (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fsaved = (*(*Tworking_state)(unsafe.Pointer(bp))).Fcur /* Update restart-interval state too */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num++ *(*int32)(unsafe.Pointer(entropy + 40)) &= int32(7) } (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } return int32(TRUE1) } /* * Finish up at the end of a Huffman-compressed scan. */ func _finish_pass_huff1(tls *libc.TLS, cinfo Tj_compress_ptr) { bp := tls.Alloc(48) defer tls.Free(48) var entropy Thuff_entropy_ptr var _ /* state at bp+0 */ Tworking_state _ = entropy entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_output_byte = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Ffree_in_buffer = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer /* Flush out any buffered data */ _emit_eobrun(tls, entropy) _flush_bits_e(tls, entropy) (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_output_byte (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Ffree_in_buffer } else { /* Load up working state ... flush_bits needs it */ (*(*Tworking_state)(unsafe.Pointer(bp))).Fnext_output_byte = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte (*(*Tworking_state)(unsafe.Pointer(bp))).Ffree_in_buffer = (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer (*(*Tworking_state)(unsafe.Pointer(bp))).Fcur = (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fsaved (*(*Tworking_state)(unsafe.Pointer(bp))).Fcinfo = cinfo /* Flush out the last data */ if !(_flush_bits_s(tls, bp) != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_CANT_SUSPEND) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Update state */ (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Fnext_output_byte = (*(*Tworking_state)(unsafe.Pointer(bp))).Fnext_output_byte (*Tjpeg_destination_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdest)).Ffree_in_buffer = (*(*Tworking_state)(unsafe.Pointer(bp))).Ffree_in_buffer (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fsaved = (*(*Tworking_state)(unsafe.Pointer(bp))).Fcur } } /* * Huffman coding optimization. * * We first scan the supplied data and count the number of uses of each symbol * that is to be Huffman-coded. (This process MUST agree with the code above.) * Then we build a Huffman coding tree for the observed counts. * Symbols which are not needed at all for the particular image are not * assigned any code, which saves space in the DHT marker as well as in * the compressed data. */ /* Process a single block's worth of coefficients */ func _htest_one_block(tls *libc.TLS, cinfo Tj_compress_ptr, block TJCOEFPTR, last_dc_val int32, dc_counts uintptr, ac_counts uintptr) { var Se, k, max_coef_bits, nbits, r, temp, v1, v4 int32 var natural_order uintptr _, _, _, _, _, _, _, _, _ = Se, k, max_coef_bits, natural_order, nbits, r, temp, v1, v4 Se = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Flim_Se max_coef_bits = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fdata_precision + int32(3) natural_order = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fnatural_order /* Encode the DC coefficient difference per section F.1.2.1 */ v1 = int32(*(*TJCOEF)(unsafe.Pointer(block))) - last_dc_val temp = v1 if v1 == 0 { /* Count the Huffman symbol for the number of bits */ *(*int32)(unsafe.Pointer(dc_counts))++ } else { if temp < 0 { temp = -temp } /* temp is abs value of input */ /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0 for { nbits++ goto _2 _2: ; temp >>= int32(1) if !(temp != 0) { break } } /* Check for out-of-range coefficient values. * Since we're encoding a difference, the range limit is twice as much. */ if nbits > max_coef_bits { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_DCT_COEF) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Count the Huffman symbol for the number of bits */ *(*int32)(unsafe.Pointer(dc_counts + uintptr(nbits)*4))++ } /* Encode the AC coefficients per section F.1.2.2 */ r = 0 /* r = run length of zeros */ k = int32(1) for { if !(k <= Se) { break } v4 = int32(*(*TJCOEF)(unsafe.Pointer(block + uintptr(*(*int32)(unsafe.Pointer(natural_order + uintptr(k)*4)))*2))) temp = v4 if v4 == 0 { r++ goto _3 } /* if run length > 15, must emit special run-length-16 codes (0xF0) */ for r > int32(15) { *(*int32)(unsafe.Pointer(ac_counts + 240*4))++ r -= int32(16) } if temp < 0 { temp = -temp } /* temp is abs value of input */ /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0 for { nbits++ goto _5 _5: ; temp >>= int32(1) if !(temp != 0) { break } } /* Check for out-of-range coefficient values. * Use ">=" instead of ">" so can use the * same one larger limit from DC check here. */ if nbits >= max_coef_bits { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_DCT_COEF) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Count Huffman symbol for run length / number of bits */ *(*int32)(unsafe.Pointer(ac_counts + uintptr(r< 0 { *(*int32)(unsafe.Pointer(ac_counts))++ } } /* * Trial-encode one MCU's worth of Huffman-compressed coefficients. * No data is actually output, so no suspension return is possible. */ func _encode_mcu_gather(tls *libc.TLS, cinfo Tj_compress_ptr, MCU_data TJBLOCKARRAY) (r Tboolean) { var blkn, ci int32 var compptr uintptr var entropy Thuff_entropy_ptr _, _, _, _ = blkn, ci, compptr, entropy entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy /* Take care of restart intervals if needed */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval != 0 { if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go == uint32(0) { /* Re-initialize DC predictions to 0 */ ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } *(*int32)(unsafe.Pointer(entropy + 12 + 8 + uintptr(ci)*4)) = 0 goto _1 _1: ; ci++ } /* Update restart state */ (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval } (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go-- } blkn = 0 for { if !(blkn < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fblocks_in_MCU) { break } ci = *(*int32)(unsafe.Pointer(cinfo + 324 + uintptr(blkn)*4)) compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) _htest_one_block(tls, cinfo, *(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4)), *(*int32)(unsafe.Pointer(entropy + 12 + 8 + uintptr(ci)*4)), *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no)*4)), *(*uintptr)(unsafe.Pointer(entropy + 92 + uintptr((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no)*4))) *(*int32)(unsafe.Pointer(entropy + 12 + 8 + uintptr(ci)*4)) = int32(*(*TJCOEF)(unsafe.Pointer(*(*TJBLOCKROW)(unsafe.Pointer(MCU_data + uintptr(blkn)*4))))) goto _2 _2: ; blkn++ } return int32(TRUE1) } /* * Generate the best Huffman code table for the given counts, fill htbl. * * The JPEG standard requires that no symbol be assigned a codeword of all * one bits (so that padding bits added at the end of a compressed segment * can't look like a valid code). Because of the canonical ordering of * codewords, this just means that there must be an unused slot in the * longest codeword length category. Section K.2 of the JPEG spec suggests * reserving such a slot by pretending that symbol 256 is a valid symbol * with count 1. In theory that's not optimal; giving it count zero but * including it in the symbol set anyway should give a better Huffman code. * But the theoretically better code actually seems to come out worse in * practice, because it produces more all-ones bytes (which incur stuffed * zero bytes in the final file). In any case the difference is tiny. * * The JPEG standard requires Huffman codes to be no more than 16 bits long. * If some symbols have a very small but nonzero probability, the Huffman tree * must be adjusted to meet the code length restriction. We currently use * the adjustment method suggested in JPEG section K.2. This method is *not* * optimal; it may not choose the best possible limited-length code. But * typically only very-low-frequency symbols will be given less-than-optimal * lengths, so the code is almost optimal. Experimental comparisons against * an optimal limited-length-code algorithm indicate that the difference is * microscopic --- usually less than a hundredth of a percent of total size. * So the extra complexity of an optimal algorithm doesn't seem worthwhile. */ func _jpeg_gen_optimal_table(tls *libc.TLS, cinfo Tj_compress_ptr, htbl uintptr, freq uintptr) { bp := tls.Alloc(1072) defer tls.Free(1072) var c1, c2, i, j, v, v2, v3 int32 var others [257]int32 var p, v4, p11, p12 uintptr var _ /* bits at bp+0 */ [33]TUINT8 var _ /* codesize at bp+36 */ [257]int32 _, _, _, _, _, _, _, _, _, _, _, _ = c1, c2, i, j, others, p, v, v2, v3, v4, p11, p12 *(*int32)(unsafe.Pointer(freq + 256*4)) = int32(1) /* make sure 256 has a nonzero count */ /* Including the pseudo-symbol 256 in the Huffman procedure guarantees * that no real symbol is given code-value of all ones, because 256 * will be placed last in the largest codeword category. * In the symbol list build procedure this element serves as sentinel * for the zero run loop. */ /* Build list of symbols sorted in order of descending frequency */ /* This approach has several benefits (thank to John Korejwa for the idea): * 1. * If a codelength category is split during the length limiting procedure * below, the feature that more frequent symbols are assigned shorter * codewords remains valid for the adjusted code. * 2. * To reduce consecutive ones in a Huffman data stream (thus reducing the * number of stuff bytes in JPEG) it is preferable to follow 0 branches * (and avoid 1 branches) as much as possible. This is easily done by * assigning symbols to leaves of the Huffman tree in order of decreasing * frequency, with no secondary sort based on codelengths. * 3. * The symbol list can be built independently from the assignment of code * lengths by the Huffman procedure below. * Note: The symbol list build procedure must be performed first, because * the Huffman procedure assigning the codelengths clobbers the frequency * counts! */ /* Here we use the others array as a linked list of nonzero frequencies * to be sorted. Already sorted elements are removed from the list. */ /* Building list */ /* This item does not correspond to a valid symbol frequency and is used * as starting index. */ j = int32(256) i = 0 for { if *(*int32)(unsafe.Pointer(freq + uintptr(i)*4)) == 0 { /* skip zero frequencies */ goto _1 } if i > int32(255) { break } others[j] = i /* this symbol value */ j = i /* previous symbol value */ goto _1 _1: ; i++ } others[j] = -int32(1) /* mark end of list */ /* Sorting list */ p = htbl + 17 for { v2 = others[int32(256)] c1 = v2 if !(v2 >= 0) { break } v = *(*int32)(unsafe.Pointer(freq + uintptr(c1)*4)) i = c1 /* first symbol value */ j = int32(256) /* pseudo symbol value for starting index */ for { v3 = others[c1] c2 = v3 if !(v3 >= 0) { break } if *(*int32)(unsafe.Pointer(freq + uintptr(c2)*4)) > v { v = *(*int32)(unsafe.Pointer(freq + uintptr(c2)*4)) i = c2 /* this symbol value */ j = c1 /* previous symbol value */ } c1 = c2 } others[j] = others[i] /* remove this symbol i from list */ v4 = p p++ *(*TUINT8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(i) } /* This algorithm is explained in section K.2 of the JPEG standard */ libc.Xmemset(tls, bp, 0, libc.Uint32FromInt64(33)) libc.Xmemset(tls, bp+36, 0, libc.Uint32FromInt64(1028)) i = 0 for { if !(i < int32(257)) { break } others[i] = -int32(1) goto _5 _5: ; i++ } /* init links to empty */ /* Huffman's basic algorithm to assign optimal code lengths to symbols */ for { /* Find the smallest nonzero frequency, set c1 = its symbol */ /* In case of ties, take the larger symbol number */ c1 = -int32(1) v = int32(1000000000) i = 0 for { if !(i <= int32(256)) { break } if *(*int32)(unsafe.Pointer(freq + uintptr(i)*4)) != 0 && *(*int32)(unsafe.Pointer(freq + uintptr(i)*4)) <= v { v = *(*int32)(unsafe.Pointer(freq + uintptr(i)*4)) c1 = i } goto _7 _7: ; i++ } /* Find the next smallest nonzero frequency, set c2 = its symbol */ /* In case of ties, take the larger symbol number */ c2 = -int32(1) v = int32(1000000000) i = 0 for { if !(i <= int32(256)) { break } if *(*int32)(unsafe.Pointer(freq + uintptr(i)*4)) != 0 && *(*int32)(unsafe.Pointer(freq + uintptr(i)*4)) <= v && i != c1 { v = *(*int32)(unsafe.Pointer(freq + uintptr(i)*4)) c2 = i } goto _8 _8: ; i++ } /* Done if we've merged everything into one frequency */ if c2 < 0 { break } /* Else merge the two counts/trees */ *(*int32)(unsafe.Pointer(freq + uintptr(c1)*4)) += *(*int32)(unsafe.Pointer(freq + uintptr(c2)*4)) *(*int32)(unsafe.Pointer(freq + uintptr(c2)*4)) = 0 /* Increment the codesize of everything in c1's tree branch */ (*(*[257]int32)(unsafe.Pointer(bp + 36)))[c1]++ for others[c1] >= 0 { c1 = others[c1] (*(*[257]int32)(unsafe.Pointer(bp + 36)))[c1]++ } others[c1] = c2 /* chain c2 onto c1's tree branch */ /* Increment the codesize of everything in c2's tree branch */ (*(*[257]int32)(unsafe.Pointer(bp + 36)))[c2]++ for others[c2] >= 0 { c2 = others[c2] (*(*[257]int32)(unsafe.Pointer(bp + 36)))[c2]++ } goto _6 _6: } /* Now count the number of symbols of each code length */ i = 0 for { if !(i <= int32(256)) { break } if (*(*[257]int32)(unsafe.Pointer(bp + 36)))[i] != 0 { /* The JPEG standard seems to think that this can't happen, */ /* but I'm paranoid... */ if (*(*[257]int32)(unsafe.Pointer(bp + 36)))[i] > int32(MAX_CLEN) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_HUFF_CLEN_OUTOFBOUNDS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*(*[33]TUINT8)(unsafe.Pointer(bp)))[(*(*[257]int32)(unsafe.Pointer(bp + 36)))[i]]++ } goto _9 _9: ; i++ } /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure * Huffman procedure assigned any such lengths, we must adjust the coding. * Here is what the JPEG spec says about how this next bit works: * Since symbols are paired for the longest Huffman code, the symbols are * removed from this length category two at a time. The prefix for the pair * (which is one bit shorter) is allocated to one of the pair; then, * skipping the BITS entry for that prefix length, a code word from the next * shortest nonzero BITS entry is converted into a prefix for two code words * one bit longer. */ i = int32(MAX_CLEN) for { if !(i > int32(16)) { break } for libc.Int32FromUint8((*(*[33]TUINT8)(unsafe.Pointer(bp)))[i]) > 0 { j = i - int32(2) /* find length of new prefix to be used */ for libc.Int32FromUint8((*(*[33]TUINT8)(unsafe.Pointer(bp)))[j]) == 0 { if j == 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_HUFF_CLEN_OUTOFBOUNDS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } j-- } p11 = bp + uintptr(i) *(*TUINT8)(unsafe.Pointer(p11)) = TUINT8(int32(*(*TUINT8)(unsafe.Pointer(p11))) - libc.Int32FromInt32(2)) /* remove two symbols */ (*(*[33]TUINT8)(unsafe.Pointer(bp)))[i-int32(1)]++ /* one goes in this length */ p12 = bp + uintptr(j+int32(1)) *(*TUINT8)(unsafe.Pointer(p12)) = TUINT8(int32(*(*TUINT8)(unsafe.Pointer(p12))) + libc.Int32FromInt32(2)) /* two new symbols in this length */ (*(*[33]TUINT8)(unsafe.Pointer(bp)))[j]-- /* symbol of this length is now a prefix */ } goto _10 _10: ; i-- } /* Remove the count for the pseudo-symbol 256 from the largest codelength */ for libc.Int32FromUint8((*(*[33]TUINT8)(unsafe.Pointer(bp)))[i]) == 0 { /* find largest codelength still in use */ i-- } (*(*[33]TUINT8)(unsafe.Pointer(bp)))[i]-- /* Return final symbol counts (only for lengths 0..16) */ libc.Xmemcpy(tls, htbl, bp, libc.Uint32FromInt64(17)) /* Set sent_table FALSE so updated table will be written to JPEG file. */ (*TJHUFF_TBL)(unsafe.Pointer(htbl)).Fsent_table = int32(FALSE1) } /* * Finish up a statistics-gathering pass and create the new Huffman tables. */ func _finish_pass_gather(tls *libc.TLS, cinfo Tj_compress_ptr) { bp := tls.Alloc(32) defer tls.Free(32) var ci, tbl int32 var compptr, htblptr uintptr var entropy Thuff_entropy_ptr var _ /* did_ac at bp+16 */ [4]Tboolean var _ /* did_dc at bp+0 */ [4]Tboolean _, _, _, _, _ = ci, compptr, entropy, htblptr, tbl entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { /* Flush out buffered data (all we care about is counting the EOB symbol) */ _emit_eobrun(tls, entropy) } /* It's important not to apply jpeg_gen_optimal_table more than once * per table, because it clobbers the input frequency counts! */ libc.Xmemset(tls, bp, 0, libc.Uint32FromInt64(16)) libc.Xmemset(tls, bp+16, 0, libc.Uint32FromInt64(16)) ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) /* DC needs no table for refinement scan */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs == 0 && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no if !((*(*[4]Tboolean)(unsafe.Pointer(bp)))[tbl] != 0) { htblptr = cinfo + 120 + uintptr(tbl)*4 if *(*uintptr)(unsafe.Pointer(htblptr)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(htblptr)) = Xjpeg_alloc_huff_table(tls, cinfo) } _jpeg_gen_optimal_table(tls, cinfo, *(*uintptr)(unsafe.Pointer(htblptr)), *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4))) (*(*[4]Tboolean)(unsafe.Pointer(bp)))[tbl] = int32(TRUE1) } } /* AC needs no table when not present */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe != 0 { tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no if !((*(*[4]Tboolean)(unsafe.Pointer(bp + 16)))[tbl] != 0) { htblptr = cinfo + 136 + uintptr(tbl)*4 if *(*uintptr)(unsafe.Pointer(htblptr)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(htblptr)) = Xjpeg_alloc_huff_table(tls, cinfo) } _jpeg_gen_optimal_table(tls, cinfo, *(*uintptr)(unsafe.Pointer(htblptr)), *(*uintptr)(unsafe.Pointer(entropy + 92 + uintptr(tbl)*4))) (*(*[4]Tboolean)(unsafe.Pointer(bp + 16)))[tbl] = int32(TRUE1) } } goto _1 _1: ; ci++ } } /* * Initialize for a Huffman-compressed scan. * If gather_statistics is TRUE, we do not output anything during the scan, * just count the Huffman symbols used and generate Huffman code tables. */ func _start_pass_huff(tls *libc.TLS, cinfo Tj_compress_ptr, gather_statistics Tboolean) { var ci, tbl int32 var compptr uintptr var entropy Thuff_entropy_ptr _, _, _, _ = ci, compptr, entropy, tbl entropy = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy if gather_statistics != 0 { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Ffinish_pass = __ccgo_fp(_finish_pass_gather) } else { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Ffinish_pass = __ccgo_fp(_finish_pass_huff1) } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fcinfo = cinfo (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fgather_statistics = gather_statistics /* We assume jcmaster.c already validated the scan parameters. */ /* Select execution routine */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu_DC_first1) } else { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu_AC_first1) } } else { if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs == 0 { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu_DC_refine1) } else { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu_AC_refine1) /* AC refinement needs a correction bit buffer */ if (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fbit_buffer == libc.UintptrFromInt32(0) { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fbit_buffer = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(MAX_CORR_BITS)*libc.Uint32FromInt64(1)) } } } /* Initialize AC stuff */ (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fac_tbl_no = (*Tjpeg_component_info)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(cinfo + 296)))).Fac_tbl_no (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FEOBRUN = uint32(0) (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).FBE = uint32(0) } else { if gather_statistics != 0 { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu_gather) } else { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fencode_mcu = __ccgo_fp(_encode_mcu_huff) } } ci = 0 for { if !(ci < (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fcomps_in_scan) { break } compptr = *(*uintptr)(unsafe.Pointer(cinfo + 296 + uintptr(ci)*4)) /* DC needs no table for refinement scan */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSs == 0 && (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FAh == 0 { tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fdc_tbl_no if gather_statistics != 0 { /* Check for invalid table index */ /* (make_c_derived_tbl does this in the other path) */ if tbl < 0 || tbl >= int32(NUM_HUFF_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_HUFF_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = tbl (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Allocate and zero the statistics tables */ /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ if *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(257)*libc.Uint32FromInt64(4)) } libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(tbl)*4)), 0, libc.Uint32FromInt32(257)*libc.Uint32FromInt64(4)) } else { /* Compute derived values for Huffman tables */ /* We may do this more than once for a table, but it's not expensive */ _jpeg_make_c_derived_tbl(tls, cinfo, int32(TRUE1), tbl, entropy+44+uintptr(tbl)*4) } /* Initialize DC predictions to 0 */ *(*int32)(unsafe.Pointer(entropy + 12 + 8 + uintptr(ci)*4)) = 0 } /* AC needs no table when not present */ if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).FSe != 0 { tbl = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fac_tbl_no if gather_statistics != 0 { if tbl < 0 || tbl >= int32(NUM_HUFF_TBLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NO_HUFF_TABLE) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = tbl (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if *(*uintptr)(unsafe.Pointer(entropy + 92 + uintptr(tbl)*4)) == libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(entropy + 92 + uintptr(tbl)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(257)*libc.Uint32FromInt64(4)) } libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer(entropy + 92 + uintptr(tbl)*4)), 0, libc.Uint32FromInt32(257)*libc.Uint32FromInt64(4)) } else { _jpeg_make_c_derived_tbl(tls, cinfo, int32(FALSE1), tbl, entropy+60+uintptr(tbl)*4) } } goto _1 _1: ; ci++ } /* Initialize bit buffer to empty */ (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fsaved.Fput_buffer = 0 (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fsaved.Fput_bits = 0 /* Initialize restart stuff */ (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Frestarts_to_go = (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Frestart_interval (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fnext_restart_num = 0 } /* * Module initialization routine for Huffman entropy encoding. */ func Xjinit_huff_encoder(tls *libc.TLS, cinfo Tj_compress_ptr) { var entropy Thuff_entropy_ptr var i int32 var v2, v3 uintptr _, _, _, _ = entropy, i, v2, v3 entropy = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(140)) (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fentropy = entropy (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_huff) /* Mark tables unallocated */ i = 0 for { if !(i < int32(NUM_HUFF_TBLS)) { break } v2 = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(entropy + 60 + uintptr(i)*4)) = v2 *(*uintptr)(unsafe.Pointer(entropy + 44 + uintptr(i)*4)) = v2 v3 = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(entropy + 92 + uintptr(i)*4)) = v3 *(*uintptr)(unsafe.Pointer(entropy + 76 + uintptr(i)*4)) = v3 goto _1 _1: ; i++ } if (*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Fprogressive_mode != 0 { (*Thuff_entropy_encoder)(unsafe.Pointer(entropy)).Fbit_buffer = libc.UintptrFromInt32(0) } /* needed only in AC refinement scan */ } const JPEG_RST04 = 0xD0 /* * Macros for handling fixed-point arithmetic; these are used by many * but not all of the DCT/IDCT modules. * * All values are expected to be of type INT32. * Fractional constants are scaled left by CONST_BITS bits. * CONST_BITS is defined within each module using these macros, * and may differ from one module to the next. */ /* Convert a positive real constant to an integer scaled by CONST_SCALE. * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, * thus causing a lot of useless floating-point operations at run time. */ /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * This macro is used only when the two inputs will actually be no more than * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a * full 32x32 multiply. This provides a useful speedup on many machines. * Unfortunately there is no way to specify a 16x16->32 multiply portably * in C, but some C compilers will do the right thing if you provide the * correct combination of casts. */ /* Same except both inputs are variables. */ /* Like RIGHT_SHIFT, but applies to a DCTELEM. * We assume that int right shift is unsigned if INT32 right shift is. */ /* * This module is specialized to the case DCTSIZE = 8. */ /* Dequantize a coefficient by multiplying it by the multiplier-table * entry; produce a float result. */ /* * Perform dequantization and inverse DCT on one block of coefficients. * * cK represents cos(K*pi/16). */ func Xjpeg_idct_float(tls *libc.TLS, cinfo Tj_decompress_ptr, compptr uintptr, coef_block TJCOEFPTR, output_buf TJSAMPARRAY, output_col TJDIMENSION) { bp := tls.Alloc(256) defer tls.Free(256) var ctr int32 var dcval, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, z10, z11, z12, z13, z5 float32 var inptr TJCOEFPTR var outptr TJSAMPROW var quantptr, range_limit, wsptr uintptr var _ /* workspace at bp+0 */ [64]float32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dcval, inptr, outptr, quantptr, range_limit, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, wsptr, z10, z11, z12, z13, z5 range_limit = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsample_range_limit - uintptr(libc.Int32FromInt32(CENTERJSAMPLE)< 0) { break } /* Due to quantization, we will usually find that many of the input * coefficients are zero, especially the AC terms. We can exploit this * by short-circuiting the IDCT calculation for any column in which all * the AC terms are zero. In that case each output is equal to the * DC coefficient (with scale factor as needed). * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ if int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*2))) == 0 { /* AC terms all zero */ dcval = float32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*2))) * *(*TFLOAT_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = dcval *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = dcval *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = dcval *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = dcval *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = dcval *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = dcval *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = dcval *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = dcval inptr += 2 /* advance pointers to next column */ quantptr += 4 wsptr += 4 goto _1 } /* Even part */ tmp0 = float32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*2))) * *(*TFLOAT_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp1 = float32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TFLOAT_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp2 = float32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*2))) * *(*TFLOAT_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp3 = float32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) * *(*TFLOAT_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp10 = tmp0 + tmp2 /* phase 3 */ tmp11 = tmp0 - tmp2 tmp13 = tmp1 + tmp3 /* phases 5-3 */ tmp12 = (tmp1-tmp3)*libc.Float32FromFloat64(1.414213562) - tmp13 /* 2*c4 */ tmp0 = tmp10 + tmp13 /* phase 2 */ tmp3 = tmp10 - tmp13 tmp1 = tmp11 + tmp12 tmp2 = tmp11 - tmp12 /* Odd part */ tmp4 = float32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*2))) * *(*TFLOAT_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp5 = float32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*2))) * *(*TFLOAT_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp6 = float32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*2))) * *(*TFLOAT_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp7 = float32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*2))) * *(*TFLOAT_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) z13 = tmp6 + tmp5 /* phase 6 */ z10 = tmp6 - tmp5 z11 = tmp4 + tmp7 z12 = tmp4 - tmp7 tmp7 = z11 + z13 /* phase 5 */ tmp11 = (z11 - z13) * libc.Float32FromFloat64(1.414213562) /* 2*c4 */ z5 = (z10 + z12) * libc.Float32FromFloat64(1.847759065) /* 2*c2 */ tmp10 = z5 - z12*libc.Float32FromFloat64(1.0823922) /* 2*(c2-c6) */ tmp12 = z5 - z10*libc.Float32FromFloat64(2.61312593) /* 2*(c2+c6) */ tmp6 = tmp12 - tmp7 /* phase 2 */ tmp5 = tmp11 - tmp6 tmp4 = tmp10 - tmp5 *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = tmp0 + tmp7 *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = tmp0 - tmp7 *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = tmp1 + tmp6 *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = tmp1 - tmp6 *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = tmp2 + tmp5 *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = tmp2 - tmp5 *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = tmp3 + tmp4 *(*float32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = tmp3 - tmp4 inptr += 2 /* advance pointers to next column */ quantptr += 4 wsptr += 4 goto _1 _1: ; ctr-- } /* Pass 2: process rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(DCTSIZE)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Rows of zeroes can be exploited in the same way as we did with columns. * However, the column calculation has created many nonzero AC terms, so * the simplification applies less often (typically 5% to 10% of the time). * And testing floats for zero is relatively expensive, so we don't bother. */ /* Even part */ /* Prepare range-limit and float->int conversion */ z5 = *(*float32)(unsafe.Pointer(wsptr)) + (float32(libc.Int32FromInt32(CENTERJSAMPLE)<int conversion and range-limit */ *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(int32(tmp0+tmp7)&(libc.Int32FromInt32(CENTERJSAMPLE)<32 bit multiply can be used instead of a * full 32x32 multiply. This provides a useful speedup on many machines. * Unfortunately there is no way to specify a 16x16->32 multiply portably * in C, but some C compilers will do the right thing if you provide the * correct combination of casts. */ /* Same except both inputs are variables. */ /* Like RIGHT_SHIFT, but applies to a DCTELEM. * We assume that int right shift is unsigned if INT32 right shift is. */ /* * This module is specialized to the case DCTSIZE = 8. */ /* Scaling decisions are generally the same as in the LL&M algorithm; * see jidctint.c for more details. However, we choose to descale * (right shift) multiplication products as soon as they are formed, * rather than carrying additional fractional bits into subsequent additions. * This compromises accuracy slightly, but it lets us save a few shifts. * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples) * everywhere except in the multiplications proper; this saves a good deal * of work on 16-bit-int machines. * * The dequantized coefficients are not integers because the AA&N scaling * factors have been incorporated. We represent them scaled up by PASS1_BITS, * so that the first and second IDCT rounds have the same input scaling. * For 8-bit JSAMPLEs, we choose IFAST_SCALE_BITS = PASS1_BITS so as to * avoid a descaling shift; this compromises accuracy rather drastically * for small quantization table entries, but it saves a lot of shifts. * For 12-bit JSAMPLEs, there's no hope of using 16x16 multiplies anyway, * so we use a much larger scaling factor to preserve accuracy. * * A final compromise is to represent the multiplicative constants to only * 8 fractional bits, rather than 13. This saves some shifting work on some * machines, and may also reduce the cost of multiplication (since there * are fewer one-bits in the constants). */ /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus * causing a lot of useless floating-point operations at run time. * To get around this we use the following pre-calculated constants. * If you change CONST_BITS you may want to add appropriate values. * (With a reasonable C compiler, you can just rely on the FIX() macro...) */ /* We can gain a little more speed, with a further compromise in accuracy, * by omitting the addition in a descaling shift. This yields an incorrectly * rounded result half the time... */ /* Multiply a DCTELEM variable by an INT32 constant, and immediately * descale to yield a DCTELEM result. */ /* Dequantize a coefficient by multiplying it by the multiplier-table * entry; produce a DCTELEM result. For 8-bit data a 16x16->16 * multiplication will do. For 12-bit data, the multiplier table is * declared INT32, so a 32-bit multiply will be used. */ /* * Perform dequantization and inverse DCT on one block of coefficients. * * cK represents cos(K*pi/16). */ func Xjpeg_idct_ifast(tls *libc.TLS, cinfo Tj_decompress_ptr, compptr uintptr, coef_block TJCOEFPTR, output_buf TJSAMPARRAY, output_col TJDIMENSION) { bp := tls.Alloc(256) defer tls.Free(256) var ctr, dcval int32 var dcval1 TJSAMPLE var inptr TJCOEFPTR var outptr TJSAMPROW var quantptr, range_limit, wsptr uintptr var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, z10, z11, z12, z13, z5 TDCTELEM var _ /* workspace at bp+0 */ [64]int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dcval, dcval1, inptr, outptr, quantptr, range_limit, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, wsptr, z10, z11, z12, z13, z5 range_limit = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsample_range_limit - uintptr(libc.Int32FromInt32(CENTERJSAMPLE)< 0) { break } /* Due to quantization, we will usually find that many of the input * coefficients are zero, especially the AC terms. We can exploit this * by short-circuiting the IDCT calculation for any column in which all * the AC terms are zero. In that case each output is equal to the * DC coefficient (with scale factor as needed). * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ if int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*2))) == 0 { /* AC terms all zero */ dcval = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*2))) * *(*TIFAST_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = dcval inptr += 2 /* advance pointers to next column */ quantptr += 4 wsptr += 4 goto _1 } /* Even part */ tmp0 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*2))) * *(*TIFAST_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) tmp1 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TIFAST_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*2))) * *(*TIFAST_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) tmp3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) * *(*TIFAST_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) tmp10 = tmp0 + tmp2 /* phase 3 */ tmp11 = tmp0 - tmp2 tmp13 = tmp1 + tmp3 /* phases 5-3 */ tmp12 = (tmp1-tmp3)*libc.Int32FromInt32(362)>>libc.Int32FromInt32(CONST_BITS3) - tmp13 /* 2*c4 */ tmp0 = tmp10 + tmp13 /* phase 2 */ tmp3 = tmp10 - tmp13 tmp1 = tmp11 + tmp12 tmp2 = tmp11 - tmp12 /* Odd part */ tmp4 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*2))) * *(*TIFAST_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) tmp5 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*2))) * *(*TIFAST_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp6 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*2))) * *(*TIFAST_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp7 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*2))) * *(*TIFAST_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) z13 = tmp6 + tmp5 /* phase 6 */ z10 = tmp6 - tmp5 z11 = tmp4 + tmp7 z12 = tmp4 - tmp7 tmp7 = z11 + z13 /* phase 5 */ tmp11 = (z11 - z13) * libc.Int32FromInt32(362) >> libc.Int32FromInt32(CONST_BITS3) /* 2*c4 */ z5 = (z10 + z12) * libc.Int32FromInt32(473) >> libc.Int32FromInt32(CONST_BITS3) /* 2*c2 */ tmp10 = z5 - z12*libc.Int32FromInt32(277)>>libc.Int32FromInt32(CONST_BITS3) /* 2*(c2-c6) */ tmp12 = z5 - z10*libc.Int32FromInt32(669)>>libc.Int32FromInt32(CONST_BITS3) /* 2*(c2+c6) */ tmp6 = tmp12 - tmp7 /* phase 2 */ tmp5 = tmp11 - tmp6 tmp4 = tmp10 - tmp5 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = tmp0 + tmp7 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = tmp0 - tmp7 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = tmp1 + tmp6 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = tmp1 - tmp6 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = tmp2 + tmp5 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = tmp2 - tmp5 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = tmp3 + tmp4 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = tmp3 - tmp4 inptr += 2 /* advance pointers to next column */ quantptr += 4 wsptr += 4 goto _1 _1: ; ctr-- } /* Pass 2: process rows from work array, store into output array. * Note that we must descale the results by a factor of 8 == 2**3, * and also undo the PASS1_BITS scaling. */ wsptr = bp ctr = 0 for { if !(ctr < int32(DCTSIZE)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Add range center and fudge factor for final descale and range-limit. */ z5 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>libc.Int32FromInt32(CONST_BITS3) - tmp13 /* 2*c4 */ tmp0 = tmp10 + tmp13 tmp3 = tmp10 - tmp13 tmp1 = tmp11 + tmp12 tmp2 = tmp11 - tmp12 /* Odd part */ z13 = *(*int32)(unsafe.Pointer(wsptr + 5*4)) + *(*int32)(unsafe.Pointer(wsptr + 3*4)) z10 = *(*int32)(unsafe.Pointer(wsptr + 5*4)) - *(*int32)(unsafe.Pointer(wsptr + 3*4)) z11 = *(*int32)(unsafe.Pointer(wsptr + 1*4)) + *(*int32)(unsafe.Pointer(wsptr + 7*4)) z12 = *(*int32)(unsafe.Pointer(wsptr + 1*4)) - *(*int32)(unsafe.Pointer(wsptr + 7*4)) tmp7 = z11 + z13 /* phase 5 */ tmp11 = (z11 - z13) * libc.Int32FromInt32(362) >> libc.Int32FromInt32(CONST_BITS3) /* 2*c4 */ z5 = (z10 + z12) * libc.Int32FromInt32(473) >> libc.Int32FromInt32(CONST_BITS3) /* 2*c2 */ tmp10 = z5 - z12*libc.Int32FromInt32(277)>>libc.Int32FromInt32(CONST_BITS3) /* 2*(c2-c6) */ tmp12 = z5 - z10*libc.Int32FromInt32(669)>>libc.Int32FromInt32(CONST_BITS3) /* 2*(c2+c6) */ tmp6 = tmp12 - tmp7 /* phase 2 */ tmp5 = tmp11 - tmp6 tmp4 = tmp10 - tmp5 /* Final output stage: scale down by a factor of 8 and range-limit */ *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr((tmp0+tmp7)>>(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<32 bit multiply can be used instead of a * full 32x32 multiply. This provides a useful speedup on many machines. * Unfortunately there is no way to specify a 16x16->32 multiply portably * in C, but some C compilers will do the right thing if you provide the * correct combination of casts. */ /* Same except both inputs are variables. */ /* Like RIGHT_SHIFT, but applies to a DCTELEM. * We assume that int right shift is unsigned if INT32 right shift is. */ /* * This module is specialized to the case DCTSIZE = 8. */ /* * The poop on this scaling stuff is as follows: * * Each 1-D IDCT step produces outputs which are a factor of sqrt(N) * larger than the true IDCT outputs. The final outputs are therefore * a factor of N larger than desired; since N=8 this can be cured by * a simple right shift at the end of the algorithm. The advantage of * this arrangement is that we save two multiplications per 1-D IDCT, * because the y0 and y4 inputs need not be divided by sqrt(N). * * We have to do addition and subtraction of the integer inputs, which * is no problem, and multiplication by fractional constants, which is * a problem to do in integer arithmetic. We multiply all the constants * by CONST_SCALE and convert them to integer constants (thus retaining * CONST_BITS bits of precision in the constants). After doing a * multiplication we have to divide the product by CONST_SCALE, with proper * rounding, to produce the correct output. This division can be done * cheaply as a right shift of CONST_BITS bits. We postpone shifting * as long as possible so that partial sums can be added together with * full fractional precision. * * The outputs of the first pass are scaled up by PASS1_BITS bits so that * they are represented to better-than-integral precision. These outputs * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word * with the recommended scaling. (To scale up 12-bit sample data further, an * intermediate INT32 array would be needed.) * * To avoid overflow of the 32-bit intermediate results in pass 2, we must * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis * shows that the values given below are the most effective. */ /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus * causing a lot of useless floating-point operations at run time. * To get around this we use the following pre-calculated constants. * If you change CONST_BITS you may want to add appropriate values. * (With a reasonable C compiler, you can just rely on the FIX() macro...) */ /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. * For 8-bit samples with the recommended scaling, all the variable * and constant values involved are no more than 16 bits wide, so a * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. * For 12-bit samples, a full 32-bit multiplication will be needed. */ /* Dequantize a coefficient by multiplying it by the multiplier-table * entry; produce an int result. In this module, both inputs and result * are 16 bits or less, so either int or short multiply will work. */ /* * Perform dequantization and inverse DCT on one block of coefficients. * * Optimized algorithm with 12 multiplications in the 1-D kernel. * cK represents sqrt(2) * cos(K*pi/16). */ func Xjpeg_idct_islow(tls *libc.TLS, cinfo Tj_decompress_ptr, compptr uintptr, coef_block TJCOEFPTR, output_buf TJSAMPARRAY, output_col TJDIMENSION) { bp := tls.Alloc(256) defer tls.Free(256) var ctr, dcval int32 var dcval1 TJSAMPLE var inptr TJCOEFPTR var outptr TJSAMPROW var quantptr, range_limit, wsptr uintptr var tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, z1, z2, z3 TINT32 var _ /* workspace at bp+0 */ [64]int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ctr, dcval, dcval1, inptr, outptr, quantptr, range_limit, tmp0, tmp1, tmp10, tmp11, tmp12, tmp13, tmp2, tmp3, wsptr, z1, z2, z3 range_limit = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsample_range_limit - uintptr(libc.Int32FromInt32(CENTERJSAMPLE)< 0) { break } /* Due to quantization, we will usually find that many of the input * coefficients are zero, especially the AC terms. We can exploit this * by short-circuiting the IDCT calculation for any column in which all * the AC terms are zero. In that case each output is equal to the * DC coefficient (with scale factor as needed). * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ if int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*2))) == 0 { /* AC terms all zero */ dcval = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) << int32(PASS1_BITS) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = dcval inptr += 2 /* advance pointers to next column */ quantptr += 4 wsptr += 4 goto _1 } /* Even part: reverse the even part of the forward DCT. * The rotator is c(-6). */ z2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) z3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) z2 <<= int32(CONST_BITS4) z3 <<= int32(CONST_BITS4) /* Add fudge factor here for final descale. */ z2 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) tmp0 = z2 + z3 tmp1 = z2 - z3 z2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) z3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) z1 = (z2 + z3) * libc.Int32FromInt32(4433) /* c6 */ tmp2 = z1 + z2*libc.Int32FromInt32(6270) /* c2-c6 */ tmp3 = z1 - z3*libc.Int32FromInt32(15137) /* c2+c6 */ tmp10 = tmp0 + tmp2 tmp13 = tmp0 - tmp2 tmp11 = tmp1 + tmp3 tmp12 = tmp1 - tmp3 /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ tmp0 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) z2 = tmp0 + tmp2 z3 = tmp1 + tmp3 z1 = (z2 + z3) * libc.Int32FromInt32(9633) /* c3 */ z2 = z2 * -libc.Int32FromInt32(16069) /* -c3-c5 */ z3 = z3 * -libc.Int32FromInt32(3196) /* -c3+c5 */ z2 += z1 z3 += z1 z1 = (tmp0 + tmp3) * -libc.Int32FromInt32(7373) /* -c3+c7 */ tmp0 = tmp0 * libc.Int32FromInt32(2446) /* -c1+c3+c5-c7 */ tmp3 = tmp3 * libc.Int32FromInt32(12299) /* c1+c3-c5-c7 */ tmp0 += z1 + z2 tmp3 += z1 + z3 z1 = (tmp1 + tmp2) * -libc.Int32FromInt32(20995) /* -c1-c3 */ tmp1 = tmp1 * libc.Int32FromInt32(16819) /* c1+c3-c5+c7 */ tmp2 = tmp2 * libc.Int32FromInt32(25172) /* c1+c3+c5-c7 */ tmp1 += z1 + z3 tmp2 += z1 + z2 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp10 + tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp10 - tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp11 + tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (tmp11 - tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (tmp12 + tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp12 - tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp13 + tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = (tmp13 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) inptr += 2 /* advance pointers to next column */ quantptr += 4 wsptr += 4 goto _1 _1: ; ctr-- } /* Pass 2: process rows from work array, store into output array. * Note that we must descale the results by a factor of 8 == 2**3, * and also undo the PASS1_BITS scaling. */ wsptr = bp ctr = 0 for { if !(ctr < int32(DCTSIZE)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Add range center and fudge factor for final descale and range-limit. */ z2 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(6))*4)) = (tmp10 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(1))*4)) = (tmp11 + tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(5))*4)) = (tmp11 - tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(2))*4)) = (tmp12 + tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(4))*4)) = (tmp12 - tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(3))*4)) = tmp13 >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 7 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(7)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp13 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) tmp10 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp0 = tmp10 * int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(5))*4)) = (tmp10 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))*4)) = tmp11 + tmp1 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(4))*4)) = tmp11 - tmp1 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))*4)) = (tmp12 + tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(3))*4)) = (tmp12 - tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 6 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(6)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp0 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(4))*4)) = (tmp10 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(1))*4)) = (tmp11 + tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(3))*4)) = (tmp11 - tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(2))*4)) = tmp12 >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 5 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(5)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp12 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) tmp2 = (z1 - z3*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) /* Final output stage */ *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(0))*4)) = tmp10 + tmp0 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(3))*4)) = tmp10 - tmp0 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(1))*4)) = tmp12 + tmp2 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2))*4)) = tmp12 - tmp2 goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 4 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(4)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp0 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2))*4)) = (tmp10 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(1))*4)) = tmp2 >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 3 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(3)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp0 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>libc.Int32FromInt32(3)&(libc.Int32FromInt32(CENTERJSAMPLE)<>libc.Int32FromInt32(3)&(libc.Int32FromInt32(CENTERJSAMPLE)<>libc.Int32FromInt32(3)&(libc.Int32FromInt32(CENTERJSAMPLE)<>libc.Int32FromInt32(3)&(libc.Int32FromInt32(CENTERJSAMPLE)<>libc.Int32FromInt32(3)&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(8))*4)) = (tmp10 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp11 + tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(7))*4)) = (tmp11 - tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = (tmp12 + tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(6))*4)) = (tmp12 - tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = (tmp13 + tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = (tmp13 - tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = tmp14 >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 9 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(9)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp0 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) z2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) z3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) z1 = (z2 + z3) * int32(libc.Float64FromFloat64(0.831253876)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(9))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(8))*4)) = (tmp21 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = tmp22 + tmp12 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(7))*4)) = tmp22 - tmp12 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = (tmp23 + tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(6))*4)) = (tmp23 - tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = (tmp24 - tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 10 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(10)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ z3 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(10))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(9))*4)) = (tmp21 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(8))*4)) = (tmp22 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = (tmp23 + tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(7))*4)) = (tmp23 - tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(6))*4)) = (tmp24 - tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = tmp25 >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 11 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(11)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp10 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(11))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(10))*4)) = (tmp21 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(9))*4)) = (tmp22 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = (tmp23 + tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(8))*4)) = (tmp23 - tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(7))*4)) = (tmp24 - tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = (tmp25 + tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(6))*4)) = (tmp25 - tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 12 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(12)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ z3 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(12))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(11))*4)) = (tmp21 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(10))*4)) = (tmp22 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = (tmp23 + tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(9))*4)) = (tmp23 - tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(8))*4)) = (tmp24 - tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = (tmp25 + tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(7))*4)) = (tmp25 - tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(6))*4)) = tmp26 >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 13 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(13)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ z1 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) z1 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) z2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) z3 = (z1 + z2) * int32(libc.Float64FromFloat64(1.105676686)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(13))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(12))*4)) = (tmp21 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(11))*4)) = (tmp22 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = tmp23 + tmp13 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(10))*4)) = tmp23 - tmp13 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(9))*4)) = (tmp24 - tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = (tmp25 + tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(8))*4)) = (tmp25 - tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(6))*4)) = (tmp26 + tmp16) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(7))*4)) = (tmp26 - tmp16) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 14 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(14)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ z1 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(14))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(13))*4)) = (tmp21 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(12))*4)) = (tmp22 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = (tmp23 + tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(11))*4)) = (tmp23 - tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(10))*4)) = (tmp24 - tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = (tmp25 + tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(9))*4)) = (tmp25 - tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(6))*4)) = (tmp26 + tmp16) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(8))*4)) = (tmp26 - tmp16) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(7))*4)) = tmp27 >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 15 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(15)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ z1 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(15))*4)) = (tmp20 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(14))*4)) = (tmp21 - tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(13))*4)) = (tmp22 - tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = (tmp23 + tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(12))*4)) = (tmp23 - tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(11))*4)) = (tmp24 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = (tmp25 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(10))*4)) = (tmp25 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(6))*4)) = (tmp26 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(9))*4)) = (tmp26 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(7))*4)) = (tmp27 + tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(8))*4)) = (tmp27 - tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 16 rows from work array, store into output array. */ wsptr = bp ctr = 0 for { if !(ctr < int32(16)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp0 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)< 0) { break } /* Due to quantization, we will usually find that many of the input * coefficients are zero, especially the AC terms. We can exploit this * by short-circuiting the IDCT calculation for any column in which all * the AC terms are zero. In that case each output is equal to the * DC coefficient (with scale factor as needed). * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ if int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*2))) == 0 { /* AC terms all zero */ dcval = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) << int32(PASS1_BITS) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = dcval inptr += 2 /* advance pointers to next column */ quantptr += 4 wsptr += 4 goto _1 } /* Even part: reverse the even part of the forward DCT. * The rotator is c(-6). */ z2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) z3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) z2 <<= int32(CONST_BITS4) z3 <<= int32(CONST_BITS4) /* Add fudge factor here for final descale. */ z2 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) tmp0 = z2 + z3 tmp1 = z2 - z3 z2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) z3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) z1 = (z2 + z3) * libc.Int32FromInt32(4433) /* c6 */ tmp2 = z1 + z2*libc.Int32FromInt32(6270) /* c2-c6 */ tmp3 = z1 - z3*libc.Int32FromInt32(15137) /* c2+c6 */ tmp10 = tmp0 + tmp2 tmp13 = tmp0 - tmp2 tmp11 = tmp1 + tmp3 tmp12 = tmp1 - tmp3 /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ tmp0 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) z2 = tmp0 + tmp2 z3 = tmp1 + tmp3 z1 = (z2 + z3) * libc.Int32FromInt32(9633) /* c3 */ z2 = z2 * -libc.Int32FromInt32(16069) /* -c3-c5 */ z3 = z3 * -libc.Int32FromInt32(3196) /* -c3+c5 */ z2 += z1 z3 += z1 z1 = (tmp0 + tmp3) * -libc.Int32FromInt32(7373) /* -c3+c7 */ tmp0 = tmp0 * libc.Int32FromInt32(2446) /* -c1+c3+c5-c7 */ tmp3 = tmp3 * libc.Int32FromInt32(12299) /* c1+c3-c5-c7 */ tmp0 += z1 + z2 tmp3 += z1 + z3 z1 = (tmp1 + tmp2) * -libc.Int32FromInt32(20995) /* -c1-c3 */ tmp1 = tmp1 * libc.Int32FromInt32(16819) /* c1+c3-c5+c7 */ tmp2 = tmp2 * libc.Int32FromInt32(25172) /* c1+c3+c5-c7 */ tmp1 += z1 + z3 tmp2 += z1 + z2 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) = (tmp10 + tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) = (tmp10 - tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) = (tmp11 + tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) = (tmp11 - tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) = (tmp12 + tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) = (tmp12 - tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) = (tmp13 + tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) = (tmp13 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) inptr += 2 /* advance pointers to next column */ quantptr += 4 wsptr += 4 goto _1 _1: ; ctr-- } /* Pass 2: process 8 rows from work array, store into output array. * 16-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/32). */ wsptr = bp ctr = 0 for { if !(ctr < int32(8)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp0 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(6))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = (tmp21 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = (tmp22 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = tmp23 >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 7 rows from work array, store into output array. * 14-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/28). */ wsptr = bp ctr = 0 for { if !(ctr < int32(7)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ z1 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) tmp20 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp10 = tmp20 * int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = tmp21 + tmp11 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = tmp21 - tmp11 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = (tmp22 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 6 rows from work array, store into output array. * 12-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/24). */ wsptr = bp ctr = 0 for { if !(ctr < int32(6)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ z3 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = (tmp10 - tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp11 + tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = (tmp11 - tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = tmp12 >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 5 rows from work array, store into output array. * 10-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/20). */ wsptr = bp ctr = 0 for { if !(ctr < int32(5)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ z3 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) tmp2 = (z1 - z3*libc.Int32FromInt32(15137)) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) /* Final output stage */ *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(0))*4)) = tmp10 + tmp0 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = tmp10 - tmp0 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = tmp12 + tmp2 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = tmp12 - tmp2 goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process rows from work array, store into output array. * Note that we must descale the results by a factor of 8 == 2**3, * and also undo the PASS1_BITS scaling. * 8-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/16). */ wsptr = bp ctr = 0 for { if !(ctr < int32(4)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part: reverse the even part of the forward DCT. * The rotator is c(-6). */ /* Add range center and fudge factor for final descale and range-limit. */ z2 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))*4)) = (tmp10 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))*4)) = tmp2 >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 3 rows from work array, store into output array. * 6-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/12). */ wsptr = bp ctr = 0 for { if !(ctr < int32(3)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp0 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>libc.Int32FromInt32(3)&(libc.Int32FromInt32(CENTERJSAMPLE)<>libc.Int32FromInt32(3)&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(15))*4)) = (tmp20 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(14))*4)) = (tmp21 - tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(13))*4)) = (tmp22 - tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(3))*4)) = (tmp23 + tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(12))*4)) = (tmp23 - tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(11))*4)) = (tmp24 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(5))*4)) = (tmp25 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(10))*4)) = (tmp25 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(6))*4)) = (tmp26 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(9))*4)) = (tmp26 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(7))*4)) = (tmp27 + tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(8)*libc.Int32FromInt32(8))*4)) = (tmp27 - tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process rows from work array, store into output array. * Note that we must descale the results by a factor of 8 == 2**3, * and also undo the PASS1_BITS scaling. * 8-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/16). */ wsptr = bp ctr = 0 for { if !(ctr < int32(16)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part: reverse the even part of the forward DCT. * The rotator is c(-6). */ /* Add range center and fudge factor for final descale and range-limit. */ z2 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) z1 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) z2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) z3 = (z1 + z2) * int32(libc.Float64FromFloat64(1.105676686)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(13))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(12))*4)) = (tmp21 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(11))*4)) = (tmp22 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(3))*4)) = tmp23 + tmp13 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(10))*4)) = tmp23 - tmp13 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(9))*4)) = (tmp24 - tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(5))*4)) = (tmp25 + tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(8))*4)) = (tmp25 - tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(6))*4)) = (tmp26 + tmp16) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(7)*libc.Int32FromInt32(7))*4)) = (tmp26 - tmp16) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 14 rows from work array, store into output array. * 7-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/14). */ wsptr = bp ctr = 0 for { if !(ctr < int32(14)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp23 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(11))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(10))*4)) = (tmp21 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))*4)) = (tmp22 + tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(9))*4)) = (tmp22 - tmp12) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(3))*4)) = (tmp23 + tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(8))*4)) = (tmp23 - tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(7))*4)) = (tmp24 - tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(5))*4)) = (tmp25 + tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(6)*libc.Int32FromInt32(6))*4)) = (tmp25 - tmp15) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 12 rows from work array, store into output array. * 6-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/12). */ wsptr = bp ctr = 0 for { if !(ctr < int32(12)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp10 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) z2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) z3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) z1 = (z2 + z3) * int32(libc.Float64FromFloat64(0.831253876)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(9))*4)) = (tmp20 - tmp10) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(1))*4)) = (tmp21 + tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(8))*4)) = (tmp21 - tmp11) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(2))*4)) = tmp22 + tmp12 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(7))*4)) = tmp22 - tmp12 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(3))*4)) = (tmp23 + tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(6))*4)) = (tmp23 - tmp13) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(4))*4)) = (tmp24 + tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(5)*libc.Int32FromInt32(5))*4)) = (tmp24 - tmp14) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 10 rows from work array, store into output array. * 5-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/10). */ wsptr = bp ctr = 0 for { if !(ctr < int32(10)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp12 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)< 0) { break } /* Due to quantization, we will usually find that many of the input * coefficients are zero, especially the AC terms. We can exploit this * by short-circuiting the IDCT calculation for any column in which all * the AC terms are zero. In that case each output is equal to the * DC coefficient (with scale factor as needed). * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ if int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) == 0 && int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*2))) == 0 { /* AC terms all zero */ dcval = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) << int32(PASS1_BITS) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(0))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(1))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(3))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(4))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(5))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(6))*4)) = dcval *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(7))*4)) = dcval inptr += 2 /* advance pointers to next column */ quantptr += 4 wsptr += 4 goto _1 } /* Even part: reverse the even part of the forward DCT. * The rotator is c(-6). */ z2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(0))*4)) z3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(4))*4)) z2 <<= int32(CONST_BITS4) z3 <<= int32(CONST_BITS4) /* Add fudge factor here for final descale. */ z2 += libc.Int32FromInt32(1) << (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS) - libc.Int32FromInt32(1)) tmp0 = z2 + z3 tmp1 = z2 - z3 z2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) z3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(6))*4)) z1 = (z2 + z3) * libc.Int32FromInt32(4433) /* c6 */ tmp2 = z1 + z2*libc.Int32FromInt32(6270) /* c2-c6 */ tmp3 = z1 - z3*libc.Int32FromInt32(15137) /* c2+c6 */ tmp10 = tmp0 + tmp2 tmp13 = tmp0 - tmp2 tmp11 = tmp1 + tmp3 tmp12 = tmp1 - tmp3 /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ tmp0 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(7))*4)) tmp1 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(5))*4)) tmp2 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(3))*4)) tmp3 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(1))*4)) z2 = tmp0 + tmp2 z3 = tmp1 + tmp3 z1 = (z2 + z3) * libc.Int32FromInt32(9633) /* c3 */ z2 = z2 * -libc.Int32FromInt32(16069) /* -c3-c5 */ z3 = z3 * -libc.Int32FromInt32(3196) /* -c3+c5 */ z2 += z1 z3 += z1 z1 = (tmp0 + tmp3) * -libc.Int32FromInt32(7373) /* -c3+c7 */ tmp0 = tmp0 * libc.Int32FromInt32(2446) /* -c1+c3+c5-c7 */ tmp3 = tmp3 * libc.Int32FromInt32(12299) /* c1+c3-c5-c7 */ tmp0 += z1 + z2 tmp3 += z1 + z3 z1 = (tmp1 + tmp2) * -libc.Int32FromInt32(20995) /* -c1-c3 */ tmp1 = tmp1 * libc.Int32FromInt32(16819) /* c1+c3-c5+c7 */ tmp2 = tmp2 * libc.Int32FromInt32(25172) /* c1+c3+c5-c7 */ tmp1 += z1 + z3 tmp2 += z1 + z2 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(0))*4)) = (tmp10 + tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(7))*4)) = (tmp10 - tmp3) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(1))*4)) = (tmp11 + tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(6))*4)) = (tmp11 - tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2))*4)) = (tmp12 + tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(5))*4)) = (tmp12 - tmp1) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(3))*4)) = (tmp13 + tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(4))*4)) = (tmp13 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) inptr += 2 /* advance pointers to next column */ quantptr += 4 wsptr += 4 goto _1 _1: ; ctr-- } /* Pass 2: process 8 rows from work array, store into output array. * 4-point IDCT kernel, * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point IDCT]. */ wsptr = bp ctr = 0 for { if !(ctr < int32(8)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp0 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) tmp10 = int32(*(*TJCOEF)(unsafe.Pointer(inptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*2))) * *(*TISLOW_MULT_TYPE)(unsafe.Pointer(quantptr + uintptr(libc.Int32FromInt32(DCTSIZE)*libc.Int32FromInt32(2))*4)) tmp0 = tmp10 * int32(libc.Float64FromFloat64(1.224744871)*float64(libc.Int32FromInt32(1)<> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(5))*4)) = (tmp10 - tmp0) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(1))*4)) = tmp11 + tmp1 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(4))*4)) = tmp11 - tmp1 *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(2))*4)) = (tmp12 + tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) *(*int32)(unsafe.Pointer(wsptr + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(3))*4)) = (tmp12 - tmp2) >> (libc.Int32FromInt32(CONST_BITS4) - libc.Int32FromInt32(PASS1_BITS)) goto _1 _1: ; ctr++ inptr += 2 quantptr += 4 wsptr += 4 } /* Pass 2: process 6 rows from work array, store into output array. * 3-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/6). */ wsptr = bp ctr = 0 for { if !(ctr < int32(6)) { break } outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(ctr)*4)) + uintptr(output_col) /* Even part */ /* Add range center and fudge factor for final descale and range-limit. */ tmp0 = *(*int32)(unsafe.Pointer(wsptr)) + (libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(PASS1_BITS)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>(libc.Int32FromInt32(CONST_BITS4)+libc.Int32FromInt32(3))&(libc.Int32FromInt32(CENTERJSAMPLE)<>libc.Int32FromInt32(3)&(libc.Int32FromInt32(CENTERJSAMPLE)<>libc.Int32FromInt32(3)&(libc.Int32FromInt32(CENTERJSAMPLE)<temp_name[] at all; * indeed, we can't even find out the actual name of the temp file. */ func Xjpeg_open_backing_store(tls *libc.TLS, cinfo Tj_common_ptr, info Tbacking_store_ptr, total_bytes_needed int32) { var v1 uintptr _ = v1 v1 = libc.Xtmpfile(tls) (*Tbacking_store_struct)(unsafe.Pointer(info)).Ftemp_file = v1 if v1 == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_TFILE_CREATE) libc.Xstrncpy(tls, (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr+24, __ccgo_ts+9405, uint32(JMSG_STR_PARM_MAX)) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tbacking_store_struct)(unsafe.Pointer(info)).Fread_backing_store = __ccgo_fp(_read_backing_store) (*Tbacking_store_struct)(unsafe.Pointer(info)).Fwrite_backing_store = __ccgo_fp(_write_backing_store) (*Tbacking_store_struct)(unsafe.Pointer(info)).Fclose_backing_store = __ccgo_fp(_close_backing_store) } /* * These routines take care of any system-dependent initialization and * cleanup required. */ func Xjpeg_mem_init(tls *libc.TLS, cinfo Tj_common_ptr) (r int32) { return int32(DEFAULT_MAX_MEM) /* default for max_memory_to_use */ } func Xjpeg_mem_term(tls *libc.TLS, cinfo Tj_common_ptr) { /* no work */ } const ALIGN_TYPE = "double" const MIN_SLOP = 50 type Tjvirt_sarray_control = struct { Fmem_buffer TJSAMPARRAY Frows_in_array TJDIMENSION Fsamplesperrow TJDIMENSION Fmaxaccess TJDIMENSION Frows_in_mem TJDIMENSION Frowsperchunk TJDIMENSION Fcur_start_row TJDIMENSION Ffirst_undef_row TJDIMENSION Fpre_zero Tboolean Fdirty Tboolean Fb_s_open Tboolean Fnext Tjvirt_sarray_ptr Fb_s_info Tbacking_store_info } type Tjvirt_barray_control = struct { Fmem_buffer TJBLOCKARRAY Frows_in_array TJDIMENSION Fblocksperrow TJDIMENSION Fmaxaccess TJDIMENSION Frows_in_mem TJDIMENSION Frowsperchunk TJDIMENSION Fcur_start_row TJDIMENSION Ffirst_undef_row TJDIMENSION Fpre_zero Tboolean Fdirty Tboolean Fb_s_open Tboolean Fnext Tjvirt_barray_ptr Fb_s_info Tbacking_store_info } /* * Some important notes: * The allocation routines provided here must never return NULL. * They should exit to error_exit if unsuccessful. * * It's not a good idea to try to merge the sarray and barray routines, * even though they are textually almost the same, because samples are * usually stored as bytes while coefficients are shorts or ints. Thus, * in machines where byte pointers have a different representation from * word pointers, the resulting machine code could not be the same. */ /* * Many machines require storage alignment: longs must start on 4-byte * boundaries, doubles on 8-byte boundaries, etc. On such machines, malloc() * always returns pointers that are multiples of the worst-case alignment * requirement, and we had better do so too. * There isn't any really portable way to determine the worst-case alignment * requirement. This module assumes that the alignment requirement is * multiples of sizeof(ALIGN_TYPE). * By default, we define ALIGN_TYPE as double. This is necessary on some * workstations (where doubles really do need 8-byte alignment) and will work * fine on nearly everything. If your machine has lesser alignment needs, * you can save a few bytes by making ALIGN_TYPE smaller. * The only place I know of where this will NOT work is certain Macintosh * 680x0 compilers that define double as a 10-byte IEEE extended float. * Doing 10-byte alignment is counterproductive because longwords won't be * aligned well. Put "#define ALIGN_TYPE long" in jconfig.h if you have * such a compiler. */ /* * We allocate objects from "pools", where each pool is gotten with a single * request to jpeg_get_small() or jpeg_get_large(). There is no per-object * overhead within a pool, except for alignment padding. Each pool has a * header with a link to the next pool of the same class. * Small and large pool headers are identical except that the latter's * link pointer must be FAR on 80x86 machines. * Notice that the "real" header fields are union'ed with a dummy ALIGN_TYPE * field. This forces the compiler to make SIZEOF(small_pool_hdr) a multiple * of the alignment requirement of ALIGN_TYPE. */ type Tsmall_pool_ptr = uintptr /* * Some important notes: * The allocation routines provided here must never return NULL. * They should exit to error_exit if unsuccessful. * * It's not a good idea to try to merge the sarray and barray routines, * even though they are textually almost the same, because samples are * usually stored as bytes while coefficients are shorts or ints. Thus, * in machines where byte pointers have a different representation from * word pointers, the resulting machine code could not be the same. */ /* * Many machines require storage alignment: longs must start on 4-byte * boundaries, doubles on 8-byte boundaries, etc. On such machines, malloc() * always returns pointers that are multiples of the worst-case alignment * requirement, and we had better do so too. * There isn't any really portable way to determine the worst-case alignment * requirement. This module assumes that the alignment requirement is * multiples of sizeof(ALIGN_TYPE). * By default, we define ALIGN_TYPE as double. This is necessary on some * workstations (where doubles really do need 8-byte alignment) and will work * fine on nearly everything. If your machine has lesser alignment needs, * you can save a few bytes by making ALIGN_TYPE smaller. * The only place I know of where this will NOT work is certain Macintosh * 680x0 compilers that define double as a 10-byte IEEE extended float. * Doing 10-byte alignment is counterproductive because longwords won't be * aligned well. Put "#define ALIGN_TYPE long" in jconfig.h if you have * such a compiler. */ /* * We allocate objects from "pools", where each pool is gotten with a single * request to jpeg_get_small() or jpeg_get_large(). There is no per-object * overhead within a pool, except for alignment padding. Each pool has a * header with a link to the next pool of the same class. * Small and large pool headers are identical except that the latter's * link pointer must be FAR on 80x86 machines. * Notice that the "real" header fields are union'ed with a dummy ALIGN_TYPE * field. This forces the compiler to make SIZEOF(small_pool_hdr) a multiple * of the alignment requirement of ALIGN_TYPE. */ type Tsmall_pool_struct = struct { F__ccgo_align [0]uint32 Fdummy [0]float64 Fhdr struct { Fnext Tsmall_pool_ptr Fbytes_used Tsize_t Fbytes_left Tsize_t } F__ccgo_pad2 [4]byte } type Tsmall_pool_hdr = struct { F__ccgo_align [0]uint32 Fdummy [0]float64 Fhdr struct { Fnext Tsmall_pool_ptr Fbytes_used Tsize_t Fbytes_left Tsize_t } F__ccgo_pad2 [4]byte } type Tlarge_pool_ptr = uintptr type Tlarge_pool_struct = struct { F__ccgo_align [0]uint32 Fdummy [0]float64 Fhdr struct { Fnext Tlarge_pool_ptr Fbytes_used Tsize_t Fbytes_left Tsize_t } F__ccgo_pad2 [4]byte } type Tlarge_pool_hdr = struct { F__ccgo_align [0]uint32 Fdummy [0]float64 Fhdr struct { Fnext Tlarge_pool_ptr Fbytes_used Tsize_t Fbytes_left Tsize_t } F__ccgo_pad2 [4]byte } /* * Here is the full definition of a memory manager object. */ type Tmy_memory_mgr = struct { Fpub Tjpeg_memory_mgr Fsmall_list [2]Tsmall_pool_ptr Flarge_list [2]Tlarge_pool_ptr Fvirt_sarray_list Tjvirt_sarray_ptr Fvirt_barray_list Tjvirt_barray_ptr Ftotal_space_allocated Tsize_t Flast_rowsperchunk TJDIMENSION } type Tmy_mem_ptr = uintptr func _out_of_memory(tls *libc.TLS, cinfo Tj_common_ptr, which int32) { /* Report an out-of-memory error and stop execution */ /* If we compiled MEM_STATS support, report alloc requests before dying */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_OUT_OF_MEMORY) *(*int32)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = which (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* * Allocation of "small" objects. * * For these, we use pooled storage. When a new pool must be created, * we try to get enough space for the current request plus a "slop" factor, * where the slop will be the amount of leftover space in the new pool. * The speed vs. space tradeoff is largely determined by the slop values. * A different slop value is provided for each pool class (lifetime), * and we also distinguish the first pool of a class from later ones. * NOTE: the values given work fairly well on both 16- and 32-bit-int * machines, but may be too small if longs are 64 bits or more. */ var _first_pool_slop = [2]Tsize_t{ 0: uint32(1600), 1: uint32(16000), } var _extra_pool_slop = [2]Tsize_t{ 1: uint32(5000), } func _alloc_small(tls *libc.TLS, cinfo Tj_common_ptr, pool_id int32, sizeofobject Tsize_t) (r uintptr) { /* Allocate a "small" object */ var data_ptr uintptr var hdr_ptr, prev_hdr_ptr Tsmall_pool_ptr var mem Tmy_mem_ptr var min_request, odd_bytes, slop Tsize_t _, _, _, _, _, _, _ = data_ptr, hdr_ptr, mem, min_request, odd_bytes, prev_hdr_ptr, slop mem = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem /* Check for unsatisfiable request (do now to ensure no overflow below) */ if sizeofobject > libc.Uint32FromInt32(1000000000)-libc.Uint32FromInt64(16) { _out_of_memory(tls, cinfo, int32(1)) } /* request exceeds malloc's ability */ /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */ odd_bytes = sizeofobject % libc.Uint32FromInt64(8) if odd_bytes > uint32(0) { sizeofobject += libc.Uint32FromInt64(8) - odd_bytes } /* See if space is available in any existing pool */ if pool_id < 0 || pool_id >= int32(JPOOL_NUMPOOLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_POOL_ID) *(*int32)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = pool_id (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* safety check */ prev_hdr_ptr = libc.UintptrFromInt32(0) hdr_ptr = *(*Tsmall_pool_ptr)(unsafe.Pointer(mem + 52 + uintptr(pool_id)*4)) for hdr_ptr != libc.UintptrFromInt32(0) { if (*Tsmall_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fbytes_left >= sizeofobject { break } /* found pool with enough space */ prev_hdr_ptr = hdr_ptr hdr_ptr = (*Tsmall_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fnext } /* Time to make a new pool? */ if hdr_ptr == libc.UintptrFromInt32(0) { /* min_request is what we need now, slop is what will be leftover */ min_request = sizeofobject + libc.Uint32FromInt64(16) if prev_hdr_ptr == libc.UintptrFromInt32(0) { /* first pool in class? */ slop = _first_pool_slop[pool_id] } else { slop = _extra_pool_slop[pool_id] } /* Don't ask for more than MAX_ALLOC_CHUNK */ if slop > libc.Uint32FromInt32(1000000000)-min_request { slop = libc.Uint32FromInt32(1000000000) - min_request } /* Try to get space, if fail reduce slop and try again */ for { hdr_ptr = Xjpeg_get_small(tls, cinfo, min_request+slop) if hdr_ptr != libc.UintptrFromInt32(0) { break } slop /= uint32(2) if slop < uint32(MIN_SLOP) { /* give up when it gets real small */ _out_of_memory(tls, cinfo, int32(2)) } /* jpeg_get_small failed */ goto _1 _1: } *(*Tsize_t)(unsafe.Pointer(mem + 76)) += min_request + slop /* Success, initialize the new pool header and add to end of list */ (*Tsmall_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fnext = libc.UintptrFromInt32(0) (*Tsmall_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fbytes_used = uint32(0) (*Tsmall_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fbytes_left = sizeofobject + slop if prev_hdr_ptr == libc.UintptrFromInt32(0) { /* first pool in class? */ *(*Tsmall_pool_ptr)(unsafe.Pointer(mem + 52 + uintptr(pool_id)*4)) = hdr_ptr } else { (*Tsmall_pool_struct)(unsafe.Pointer(prev_hdr_ptr)).Fhdr.Fnext = hdr_ptr } } /* OK, allocate the object from the current pool */ data_ptr = hdr_ptr + libc.UintptrFromInt32(1)*16 /* point to first data byte in pool */ data_ptr += uintptr((*Tsmall_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fbytes_used) /* point to place for object */ (*Tsmall_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fbytes_used += sizeofobject (*Tsmall_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fbytes_left -= sizeofobject return data_ptr } /* * Allocation of "large" objects. * * The external semantics of these are the same as "small" objects, * except that FAR pointers are used on 80x86. However the pool * management heuristics are quite different. We assume that each * request is large enough that it may as well be passed directly to * jpeg_get_large; the pool management just links everything together * so that we can free it all on demand. * Note: the major use of "large" objects is in JSAMPARRAY and JBLOCKARRAY * structures. The routines that create these structures (see below) * deliberately bunch rows together to ensure a large request size. */ func _alloc_large(tls *libc.TLS, cinfo Tj_common_ptr, pool_id int32, sizeofobject Tsize_t) (r uintptr) { /* Allocate a "large" object */ var hdr_ptr Tlarge_pool_ptr var mem Tmy_mem_ptr var odd_bytes Tsize_t _, _, _ = hdr_ptr, mem, odd_bytes mem = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem /* Check for unsatisfiable request (do now to ensure no overflow below) */ if sizeofobject > libc.Uint32FromInt32(1000000000)-libc.Uint32FromInt64(16) { _out_of_memory(tls, cinfo, int32(3)) } /* request exceeds malloc's ability */ /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */ odd_bytes = sizeofobject % libc.Uint32FromInt64(8) if odd_bytes > uint32(0) { sizeofobject += libc.Uint32FromInt64(8) - odd_bytes } /* Always make a new pool */ if pool_id < 0 || pool_id >= int32(JPOOL_NUMPOOLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_POOL_ID) *(*int32)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = pool_id (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* safety check */ hdr_ptr = Xjpeg_get_large(tls, cinfo, sizeofobject+libc.Uint32FromInt64(16)) if hdr_ptr == libc.UintptrFromInt32(0) { _out_of_memory(tls, cinfo, int32(4)) } /* jpeg_get_large failed */ *(*Tsize_t)(unsafe.Pointer(mem + 76)) += sizeofobject + libc.Uint32FromInt64(16) /* Success, initialize the new pool header and add to list */ (*Tlarge_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fnext = *(*Tlarge_pool_ptr)(unsafe.Pointer(mem + 60 + uintptr(pool_id)*4)) /* We maintain space counts in each pool header for statistical purposes, * even though they are not needed for allocation. */ (*Tlarge_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fbytes_used = sizeofobject (*Tlarge_pool_struct)(unsafe.Pointer(hdr_ptr)).Fhdr.Fbytes_left = uint32(0) *(*Tlarge_pool_ptr)(unsafe.Pointer(mem + 60 + uintptr(pool_id)*4)) = hdr_ptr return hdr_ptr + libc.UintptrFromInt32(1)*16 /* point to first data byte in pool */ } /* * Creation of 2-D sample arrays. * The pointers are in near heap, the samples themselves in FAR heap. * * To minimize allocation overhead and to allow I/O of large contiguous * blocks, we allocate the sample rows in groups of as many rows as possible * without exceeding MAX_ALLOC_CHUNK total bytes per allocation request. * NB: the virtual array control routines, later in this file, know about * this chunking of rows. The rowsperchunk value is left in the mem manager * object so that it can be saved away if this sarray is the workspace for * a virtual array. */ func _alloc_sarray(tls *libc.TLS, cinfo Tj_common_ptr, pool_id int32, samplesperrow TJDIMENSION, numrows TJDIMENSION) (r TJSAMPARRAY) { /* Allocate a 2-D sample array */ var currow, i, rowsperchunk, v3 TJDIMENSION var ltemp int32 var mem Tmy_mem_ptr var result TJSAMPARRAY var workspace TJSAMPROW var v1 uint32 _, _, _, _, _, _, _, _, _ = currow, i, ltemp, mem, result, rowsperchunk, workspace, v1, v3 mem = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem /* Calculate max # of rows allowed in one allocation chunk */ ltemp = libc.Int32FromUint32((libc.Uint32FromInt32(1000000000) - libc.Uint32FromInt64(16)) / (libc.Uint32FromInt32(libc.Int32FromUint32(samplesperrow)) * libc.Uint32FromInt64(1))) if ltemp <= 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_WIDTH_OVERFLOW) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if ltemp < libc.Int32FromUint32(numrows) { rowsperchunk = libc.Uint32FromInt32(ltemp) } else { rowsperchunk = numrows } (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Flast_rowsperchunk = rowsperchunk /* Get space for row pointers (small object) */ result = _alloc_small(tls, cinfo, pool_id, numrows*libc.Uint32FromInt64(4)) /* Get the rows themselves (large objects) */ currow = uint32(0) for currow < numrows { if rowsperchunk < numrows-currow { v1 = rowsperchunk } else { v1 = numrows - currow } rowsperchunk = v1 workspace = _alloc_large(tls, cinfo, pool_id, rowsperchunk*samplesperrow*libc.Uint32FromInt64(1)) i = rowsperchunk for { if !(i > uint32(0)) { break } v3 = currow currow++ *(*TJSAMPROW)(unsafe.Pointer(result + uintptr(v3)*4)) = workspace workspace += uintptr(samplesperrow) goto _2 _2: ; i-- } } return result } /* * Creation of 2-D coefficient-block arrays. * This is essentially the same as the code for sample arrays, above. */ func _alloc_barray(tls *libc.TLS, cinfo Tj_common_ptr, pool_id int32, blocksperrow TJDIMENSION, numrows TJDIMENSION) (r TJBLOCKARRAY) { /* Allocate a 2-D coefficient-block array */ var currow, i, rowsperchunk, v3 TJDIMENSION var ltemp int32 var mem Tmy_mem_ptr var result TJBLOCKARRAY var workspace TJBLOCKROW var v1 uint32 _, _, _, _, _, _, _, _, _ = currow, i, ltemp, mem, result, rowsperchunk, workspace, v1, v3 mem = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem /* Calculate max # of rows allowed in one allocation chunk */ ltemp = libc.Int32FromUint32((libc.Uint32FromInt32(1000000000) - libc.Uint32FromInt64(16)) / (libc.Uint32FromInt32(libc.Int32FromUint32(blocksperrow)) * libc.Uint32FromInt64(128))) if ltemp <= 0 { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_WIDTH_OVERFLOW) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if ltemp < libc.Int32FromUint32(numrows) { rowsperchunk = libc.Uint32FromInt32(ltemp) } else { rowsperchunk = numrows } (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Flast_rowsperchunk = rowsperchunk /* Get space for row pointers (small object) */ result = _alloc_small(tls, cinfo, pool_id, numrows*libc.Uint32FromInt64(4)) /* Get the rows themselves (large objects) */ currow = uint32(0) for currow < numrows { if rowsperchunk < numrows-currow { v1 = rowsperchunk } else { v1 = numrows - currow } rowsperchunk = v1 workspace = _alloc_large(tls, cinfo, pool_id, rowsperchunk*blocksperrow*libc.Uint32FromInt64(128)) i = rowsperchunk for { if !(i > uint32(0)) { break } v3 = currow currow++ *(*TJBLOCKROW)(unsafe.Pointer(result + uintptr(v3)*4)) = workspace workspace += uintptr(blocksperrow) * 128 goto _2 _2: ; i-- } } return result } /* * About virtual array management: * * The above "normal" array routines are only used to allocate strip buffers * (as wide as the image, but just a few rows high). Full-image-sized buffers * are handled as "virtual" arrays. The array is still accessed a strip at a * time, but the memory manager must save the whole array for repeated * accesses. The intended implementation is that there is a strip buffer in * memory (as high as is possible given the desired memory limit), plus a * backing file that holds the rest of the array. * * The request_virt_array routines are told the total size of the image and * the maximum number of rows that will be accessed at once. The in-memory * buffer must be at least as large as the maxaccess value. * * The request routines create control blocks but not the in-memory buffers. * That is postponed until realize_virt_arrays is called. At that time the * total amount of space needed is known (approximately, anyway), so free * memory can be divided up fairly. * * The access_virt_array routines are responsible for making a specific strip * area accessible (after reading or writing the backing file, if necessary). * Note that the access routines are told whether the caller intends to modify * the accessed strip; during a read-only pass this saves having to rewrite * data to disk. The access routines are also responsible for pre-zeroing * any newly accessed rows, if pre-zeroing was requested. * * In current usage, the access requests are usually for nonoverlapping * strips; that is, successive access start_row numbers differ by exactly * num_rows = maxaccess. This means we can get good performance with simple * buffer dump/reload logic, by making the in-memory buffer be a multiple * of the access height; then there will never be accesses across bufferload * boundaries. The code will still work with overlapping access requests, * but it doesn't handle bufferload overlaps very efficiently. */ func _request_virt_sarray(tls *libc.TLS, cinfo Tj_common_ptr, pool_id int32, pre_zero Tboolean, samplesperrow TJDIMENSION, numrows TJDIMENSION, maxaccess TJDIMENSION) (r Tjvirt_sarray_ptr) { /* Request a virtual 2-D sample array */ var mem Tmy_mem_ptr var result Tjvirt_sarray_ptr _, _ = mem, result mem = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem /* Only IMAGE-lifetime virtual arrays are currently supported */ if pool_id != int32(JPOOL_IMAGE) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_POOL_ID) *(*int32)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = pool_id (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* safety check */ /* get control block */ result = _alloc_small(tls, cinfo, pool_id, libc.Uint32FromInt64(128)) (*Tjvirt_sarray_control)(unsafe.Pointer(result)).Fmem_buffer = libc.UintptrFromInt32(0) /* marks array not yet realized */ (*Tjvirt_sarray_control)(unsafe.Pointer(result)).Frows_in_array = numrows (*Tjvirt_sarray_control)(unsafe.Pointer(result)).Fsamplesperrow = samplesperrow (*Tjvirt_sarray_control)(unsafe.Pointer(result)).Fmaxaccess = maxaccess (*Tjvirt_sarray_control)(unsafe.Pointer(result)).Fpre_zero = pre_zero (*Tjvirt_sarray_control)(unsafe.Pointer(result)).Fb_s_open = int32(FALSE1) /* no associated backing-store object */ (*Tjvirt_sarray_control)(unsafe.Pointer(result)).Fnext = (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_sarray_list /* add to list of virtual arrays */ (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_sarray_list = result return result } func _request_virt_barray(tls *libc.TLS, cinfo Tj_common_ptr, pool_id int32, pre_zero Tboolean, blocksperrow TJDIMENSION, numrows TJDIMENSION, maxaccess TJDIMENSION) (r Tjvirt_barray_ptr) { /* Request a virtual 2-D coefficient-block array */ var mem Tmy_mem_ptr var result Tjvirt_barray_ptr _, _ = mem, result mem = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem /* Only IMAGE-lifetime virtual arrays are currently supported */ if pool_id != int32(JPOOL_IMAGE) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_POOL_ID) *(*int32)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = pool_id (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* safety check */ /* get control block */ result = _alloc_small(tls, cinfo, pool_id, libc.Uint32FromInt64(128)) (*Tjvirt_barray_control)(unsafe.Pointer(result)).Fmem_buffer = libc.UintptrFromInt32(0) /* marks array not yet realized */ (*Tjvirt_barray_control)(unsafe.Pointer(result)).Frows_in_array = numrows (*Tjvirt_barray_control)(unsafe.Pointer(result)).Fblocksperrow = blocksperrow (*Tjvirt_barray_control)(unsafe.Pointer(result)).Fmaxaccess = maxaccess (*Tjvirt_barray_control)(unsafe.Pointer(result)).Fpre_zero = pre_zero (*Tjvirt_barray_control)(unsafe.Pointer(result)).Fb_s_open = int32(FALSE1) /* no associated backing-store object */ (*Tjvirt_barray_control)(unsafe.Pointer(result)).Fnext = (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_barray_list /* add to list of virtual arrays */ (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_barray_list = result return result } func _realize_virt_arrays(tls *libc.TLS, cinfo Tj_common_ptr) { /* Allocate the in-memory buffers for any unrealized virtual arrays */ var avail_mem, bytesperrow, max_minheights, maximum_space, minheights, space_per_minheight int32 var bptr Tjvirt_barray_ptr var mem Tmy_mem_ptr var sptr Tjvirt_sarray_ptr _, _, _, _, _, _, _, _, _ = avail_mem, bptr, bytesperrow, max_minheights, maximum_space, mem, minheights, space_per_minheight, sptr mem = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem /* Compute the minimum space needed (maxaccess rows in each buffer) * and the maximum space needed (full image height in each buffer). * These may be of use to the system-dependent jpeg_mem_available routine. */ space_per_minheight = 0 maximum_space = 0 sptr = (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_sarray_list for { if !(sptr != libc.UintptrFromInt32(0)) { break } if (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fmem_buffer == libc.UintptrFromInt32(0) { /* if not realized yet */ bytesperrow = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fsamplesperrow)) * libc.Uint32FromInt64(1)) space_per_minheight += libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fmaxaccess) * bytesperrow maximum_space += libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Frows_in_array) * bytesperrow } goto _1 _1: ; sptr = (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fnext } bptr = (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_barray_list for { if !(bptr != libc.UintptrFromInt32(0)) { break } if (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fmem_buffer == libc.UintptrFromInt32(0) { /* if not realized yet */ bytesperrow = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fblocksperrow)) * libc.Uint32FromInt64(128)) space_per_minheight += libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fmaxaccess) * bytesperrow maximum_space += libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Frows_in_array) * bytesperrow } goto _2 _2: ; bptr = (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fnext } if space_per_minheight <= 0 { return } /* no unrealized arrays, no work */ /* Determine amount of memory to actually use; this is system-dependent. */ avail_mem = Xjpeg_mem_available(tls, cinfo, space_per_minheight, maximum_space, libc.Int32FromUint32((*Tmy_memory_mgr)(unsafe.Pointer(mem)).Ftotal_space_allocated)) /* If the maximum space needed is available, make all the buffers full * height; otherwise parcel it out with the same number of minheights * in each buffer. */ if avail_mem >= maximum_space { max_minheights = int32(1000000000) } else { max_minheights = avail_mem / space_per_minheight /* If there doesn't seem to be enough space, try to get the minimum * anyway. This allows a "stub" implementation of jpeg_mem_available(). */ if max_minheights <= 0 { max_minheights = int32(1) } } /* Allocate the in-memory buffers and initialize backing store as needed. */ sptr = (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_sarray_list for { if !(sptr != libc.UintptrFromInt32(0)) { break } if (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fmem_buffer == libc.UintptrFromInt32(0) { /* if not realized yet */ minheights = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Frows_in_array)-libc.Int32FromInt32(1))/(*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fmaxaccess + uint32(1)) if minheights <= max_minheights { /* This buffer fits in memory */ (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Frows_in_mem = (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Frows_in_array } else { /* It doesn't fit in memory, create backing store. */ (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Frows_in_mem = libc.Uint32FromInt32(max_minheights) * (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fmaxaccess Xjpeg_open_backing_store(tls, cinfo, sptr+48, libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Frows_in_array)*libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fsamplesperrow)*libc.Int32FromUint32(libc.Uint32FromInt64(1))) (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fb_s_open = int32(TRUE1) } (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fmem_buffer = _alloc_sarray(tls, cinfo, int32(JPOOL_IMAGE), (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fsamplesperrow, (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Frows_in_mem) (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Frowsperchunk = (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Flast_rowsperchunk (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fcur_start_row = uint32(0) (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Ffirst_undef_row = uint32(0) (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fdirty = int32(FALSE1) } goto _3 _3: ; sptr = (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fnext } bptr = (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_barray_list for { if !(bptr != libc.UintptrFromInt32(0)) { break } if (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fmem_buffer == libc.UintptrFromInt32(0) { /* if not realized yet */ minheights = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Frows_in_array)-libc.Int32FromInt32(1))/(*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fmaxaccess + uint32(1)) if minheights <= max_minheights { /* This buffer fits in memory */ (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Frows_in_mem = (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Frows_in_array } else { /* It doesn't fit in memory, create backing store. */ (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Frows_in_mem = libc.Uint32FromInt32(max_minheights) * (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fmaxaccess Xjpeg_open_backing_store(tls, cinfo, bptr+48, libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Frows_in_array)*libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fblocksperrow)*libc.Int32FromUint32(libc.Uint32FromInt64(128))) (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fb_s_open = int32(TRUE1) } (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fmem_buffer = _alloc_barray(tls, cinfo, int32(JPOOL_IMAGE), (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fblocksperrow, (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Frows_in_mem) (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Frowsperchunk = (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Flast_rowsperchunk (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fcur_start_row = uint32(0) (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Ffirst_undef_row = uint32(0) (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fdirty = int32(FALSE1) } goto _4 _4: ; bptr = (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fnext } } func _do_sarray_io(tls *libc.TLS, cinfo Tj_common_ptr, ptr Tjvirt_sarray_ptr, writing Tboolean) { /* Do backing store read or write of a virtual sample array */ var byte_count, bytesperrow, file_offset, i, rows, thisrow, v2, v3, v4 int32 _, _, _, _, _, _, _, _, _ = byte_count, bytesperrow, file_offset, i, rows, thisrow, v2, v3, v4 bytesperrow = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fsamplesperrow)) * libc.Uint32FromInt64(1)) file_offset = libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fcur_start_row) * bytesperrow /* Loop to read or write each allocation chunk in mem_buffer */ i = 0 for { if !(i < libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frows_in_mem)) { break } /* One chunk, but check for short chunk at end of buffer */ if libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frowsperchunk) < libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frows_in_mem)-i { v2 = libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frowsperchunk) } else { v2 = libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frows_in_mem) - i } rows = v2 /* Transfer no more than is currently defined */ thisrow = libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fcur_start_row) + i if rows < libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row)-thisrow { v3 = rows } else { v3 = libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row) - thisrow } rows = v3 /* Transfer no more than fits in file */ if rows < libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frows_in_array)-thisrow { v4 = rows } else { v4 = libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frows_in_array) - thisrow } rows = v4 if rows <= 0 { /* this chunk might be past end of file! */ break } byte_count = rows * bytesperrow if writing != 0 { (*(*func(*libc.TLS, Tj_common_ptr, Tbacking_store_ptr, uintptr, int32, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fb_s_info.Fwrite_backing_store})))(tls, cinfo, ptr+48, *(*TJSAMPROW)(unsafe.Pointer((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fmem_buffer + uintptr(i)*4)), file_offset, byte_count) } else { (*(*func(*libc.TLS, Tj_common_ptr, Tbacking_store_ptr, uintptr, int32, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fb_s_info.Fread_backing_store})))(tls, cinfo, ptr+48, *(*TJSAMPROW)(unsafe.Pointer((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fmem_buffer + uintptr(i)*4)), file_offset, byte_count) } file_offset += byte_count goto _1 _1: ; i = int32(uint32(i) + (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frowsperchunk) } } func _do_barray_io(tls *libc.TLS, cinfo Tj_common_ptr, ptr Tjvirt_barray_ptr, writing Tboolean) { /* Do backing store read or write of a virtual coefficient-block array */ var byte_count, bytesperrow, file_offset, i, rows, thisrow, v2, v3, v4 int32 _, _, _, _, _, _, _, _, _ = byte_count, bytesperrow, file_offset, i, rows, thisrow, v2, v3, v4 bytesperrow = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fblocksperrow)) * libc.Uint32FromInt64(128)) file_offset = libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fcur_start_row) * bytesperrow /* Loop to read or write each allocation chunk in mem_buffer */ i = 0 for { if !(i < libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frows_in_mem)) { break } /* One chunk, but check for short chunk at end of buffer */ if libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frowsperchunk) < libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frows_in_mem)-i { v2 = libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frowsperchunk) } else { v2 = libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frows_in_mem) - i } rows = v2 /* Transfer no more than is currently defined */ thisrow = libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fcur_start_row) + i if rows < libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row)-thisrow { v3 = rows } else { v3 = libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row) - thisrow } rows = v3 /* Transfer no more than fits in file */ if rows < libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frows_in_array)-thisrow { v4 = rows } else { v4 = libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frows_in_array) - thisrow } rows = v4 if rows <= 0 { /* this chunk might be past end of file! */ break } byte_count = rows * bytesperrow if writing != 0 { (*(*func(*libc.TLS, Tj_common_ptr, Tbacking_store_ptr, uintptr, int32, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fb_s_info.Fwrite_backing_store})))(tls, cinfo, ptr+48, *(*TJBLOCKROW)(unsafe.Pointer((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fmem_buffer + uintptr(i)*4)), file_offset, byte_count) } else { (*(*func(*libc.TLS, Tj_common_ptr, Tbacking_store_ptr, uintptr, int32, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fb_s_info.Fread_backing_store})))(tls, cinfo, ptr+48, *(*TJBLOCKROW)(unsafe.Pointer((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fmem_buffer + uintptr(i)*4)), file_offset, byte_count) } file_offset += byte_count goto _1 _1: ; i = int32(uint32(i) + (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frowsperchunk) } } func _access_virt_sarray(tls *libc.TLS, cinfo Tj_common_ptr, ptr Tjvirt_sarray_ptr, start_row TJDIMENSION, num_rows TJDIMENSION, writable Tboolean) (r TJSAMPARRAY) { /* Access the part of a virtual sample array starting at start_row */ /* and extending for num_rows rows. writable is true if */ /* caller intends to modify the accessed area. */ var bytesperrow Tsize_t var end_row, undef_row TJDIMENSION var ltemp int32 _, _, _, _ = bytesperrow, end_row, ltemp, undef_row end_row = start_row + num_rows /* debugging check */ if end_row > (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frows_in_array || num_rows > (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fmaxaccess || (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fmem_buffer == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_VIRTUAL_ACCESS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Make the desired part of the virtual array accessible */ if start_row < (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fcur_start_row || end_row > (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fcur_start_row+(*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frows_in_mem { if !((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fb_s_open != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_VIRTUAL_BUG) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Flush old buffer contents if necessary */ if (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fdirty != 0 { _do_sarray_io(tls, cinfo, ptr, int32(TRUE1)) (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fdirty = int32(FALSE1) } /* Decide what part of virtual array to access. * Algorithm: if target address > current window, assume forward scan, * load starting at target address. If target address < current window, * assume backward scan, load so that target area is top of window. * Note that when switching from forward write to forward read, will have * start_row = 0, so the limiting case applies and we load from 0 anyway. */ if start_row > (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fcur_start_row { (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fcur_start_row = start_row } else { ltemp = libc.Int32FromUint32(end_row) - libc.Int32FromUint32((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Frows_in_mem) if ltemp < 0 { ltemp = 0 } /* don't fall off front end of file */ (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fcur_start_row = libc.Uint32FromInt32(ltemp) } /* Read in the selected part of the array. * During the initial write pass, we will do no actual read * because the selected part is all undefined. */ _do_sarray_io(tls, cinfo, ptr, int32(FALSE1)) } /* Ensure the accessed part of the array is defined; prezero if needed. * To improve locality of access, we only prezero the part of the array * that the caller is about to access, not the entire in-memory array. */ if (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row < end_row { if (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row < start_row { if writable != 0 { /* writer skipped over a section of array */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_VIRTUAL_ACCESS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } undef_row = start_row /* but reader is allowed to read ahead */ } else { undef_row = (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row } if writable != 0 { (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row = end_row } if (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fpre_zero != 0 { bytesperrow = (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fsamplesperrow * libc.Uint32FromInt64(1) undef_row -= (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fcur_start_row /* make indexes relative to buffer */ end_row -= (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fcur_start_row for undef_row < end_row { libc.Xmemset(tls, *(*TJSAMPROW)(unsafe.Pointer((*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fmem_buffer + uintptr(undef_row)*4)), 0, bytesperrow) undef_row++ } } else { if !(writable != 0) { /* reader looking at undefined data */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_VIRTUAL_ACCESS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } } /* Flag the buffer dirty if caller will write in it */ if writable != 0 { (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fdirty = int32(TRUE1) } /* Return address of proper part of the buffer */ return (*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fmem_buffer + uintptr(start_row-(*Tjvirt_sarray_control)(unsafe.Pointer(ptr)).Fcur_start_row)*4 } func _access_virt_barray(tls *libc.TLS, cinfo Tj_common_ptr, ptr Tjvirt_barray_ptr, start_row TJDIMENSION, num_rows TJDIMENSION, writable Tboolean) (r TJBLOCKARRAY) { /* Access the part of a virtual block array starting at start_row */ /* and extending for num_rows rows. writable is true if */ /* caller intends to modify the accessed area. */ var bytesperrow Tsize_t var end_row, undef_row TJDIMENSION var ltemp int32 _, _, _, _ = bytesperrow, end_row, ltemp, undef_row end_row = start_row + num_rows /* debugging check */ if end_row > (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frows_in_array || num_rows > (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fmaxaccess || (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fmem_buffer == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_VIRTUAL_ACCESS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Make the desired part of the virtual array accessible */ if start_row < (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fcur_start_row || end_row > (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fcur_start_row+(*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frows_in_mem { if !((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fb_s_open != 0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_VIRTUAL_BUG) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Flush old buffer contents if necessary */ if (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fdirty != 0 { _do_barray_io(tls, cinfo, ptr, int32(TRUE1)) (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fdirty = int32(FALSE1) } /* Decide what part of virtual array to access. * Algorithm: if target address > current window, assume forward scan, * load starting at target address. If target address < current window, * assume backward scan, load so that target area is top of window. * Note that when switching from forward write to forward read, will have * start_row = 0, so the limiting case applies and we load from 0 anyway. */ if start_row > (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fcur_start_row { (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fcur_start_row = start_row } else { ltemp = libc.Int32FromUint32(end_row) - libc.Int32FromUint32((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Frows_in_mem) if ltemp < 0 { ltemp = 0 } /* don't fall off front end of file */ (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fcur_start_row = libc.Uint32FromInt32(ltemp) } /* Read in the selected part of the array. * During the initial write pass, we will do no actual read * because the selected part is all undefined. */ _do_barray_io(tls, cinfo, ptr, int32(FALSE1)) } /* Ensure the accessed part of the array is defined; prezero if needed. * To improve locality of access, we only prezero the part of the array * that the caller is about to access, not the entire in-memory array. */ if (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row < end_row { if (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row < start_row { if writable != 0 { /* writer skipped over a section of array */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_VIRTUAL_ACCESS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } undef_row = start_row /* but reader is allowed to read ahead */ } else { undef_row = (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row } if writable != 0 { (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Ffirst_undef_row = end_row } if (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fpre_zero != 0 { bytesperrow = (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fblocksperrow * libc.Uint32FromInt64(128) undef_row -= (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fcur_start_row /* make indexes relative to buffer */ end_row -= (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fcur_start_row for undef_row < end_row { libc.Xmemset(tls, *(*TJBLOCKROW)(unsafe.Pointer((*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fmem_buffer + uintptr(undef_row)*4)), 0, bytesperrow) undef_row++ } } else { if !(writable != 0) { /* reader looking at undefined data */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_VIRTUAL_ACCESS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } } /* Flag the buffer dirty if caller will write in it */ if writable != 0 { (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fdirty = int32(TRUE1) } /* Return address of proper part of the buffer */ return (*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fmem_buffer + uintptr(start_row-(*Tjvirt_barray_control)(unsafe.Pointer(ptr)).Fcur_start_row)*4 } /* * Release all objects belonging to a specified pool. */ func _free_pool(tls *libc.TLS, cinfo Tj_common_ptr, pool_id int32) { var bptr Tjvirt_barray_ptr var lhdr_ptr, next_lhdr_ptr Tlarge_pool_ptr var mem Tmy_mem_ptr var next_shdr_ptr, shdr_ptr Tsmall_pool_ptr var space_freed Tsize_t var sptr Tjvirt_sarray_ptr _, _, _, _, _, _, _, _ = bptr, lhdr_ptr, mem, next_lhdr_ptr, next_shdr_ptr, shdr_ptr, space_freed, sptr mem = (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem if pool_id < 0 || pool_id >= int32(JPOOL_NUMPOOLS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_POOL_ID) *(*int32)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = pool_id (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* safety check */ /* If freeing IMAGE pool, close any virtual arrays first */ if pool_id == int32(JPOOL_IMAGE) { sptr = (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_sarray_list for { if !(sptr != libc.UintptrFromInt32(0)) { break } if (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fb_s_open != 0 { /* there may be no backing store */ (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fb_s_open = int32(FALSE1) /* prevent recursive close if error */ (*(*func(*libc.TLS, Tj_common_ptr, Tbacking_store_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fb_s_info.Fclose_backing_store})))(tls, cinfo, sptr+48) } goto _1 _1: ; sptr = (*Tjvirt_sarray_control)(unsafe.Pointer(sptr)).Fnext } (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_sarray_list = libc.UintptrFromInt32(0) bptr = (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_barray_list for { if !(bptr != libc.UintptrFromInt32(0)) { break } if (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fb_s_open != 0 { /* there may be no backing store */ (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fb_s_open = int32(FALSE1) /* prevent recursive close if error */ (*(*func(*libc.TLS, Tj_common_ptr, Tbacking_store_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fb_s_info.Fclose_backing_store})))(tls, cinfo, bptr+48) } goto _2 _2: ; bptr = (*Tjvirt_barray_control)(unsafe.Pointer(bptr)).Fnext } (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_barray_list = libc.UintptrFromInt32(0) } /* Release large objects */ lhdr_ptr = *(*Tlarge_pool_ptr)(unsafe.Pointer(mem + 60 + uintptr(pool_id)*4)) *(*Tlarge_pool_ptr)(unsafe.Pointer(mem + 60 + uintptr(pool_id)*4)) = libc.UintptrFromInt32(0) for lhdr_ptr != libc.UintptrFromInt32(0) { next_lhdr_ptr = (*Tlarge_pool_struct)(unsafe.Pointer(lhdr_ptr)).Fhdr.Fnext space_freed = (*Tlarge_pool_struct)(unsafe.Pointer(lhdr_ptr)).Fhdr.Fbytes_used + (*Tlarge_pool_struct)(unsafe.Pointer(lhdr_ptr)).Fhdr.Fbytes_left + libc.Uint32FromInt64(16) Xjpeg_free_large(tls, cinfo, lhdr_ptr, space_freed) *(*Tsize_t)(unsafe.Pointer(mem + 76)) -= space_freed lhdr_ptr = next_lhdr_ptr } /* Release small objects */ shdr_ptr = *(*Tsmall_pool_ptr)(unsafe.Pointer(mem + 52 + uintptr(pool_id)*4)) *(*Tsmall_pool_ptr)(unsafe.Pointer(mem + 52 + uintptr(pool_id)*4)) = libc.UintptrFromInt32(0) for shdr_ptr != libc.UintptrFromInt32(0) { next_shdr_ptr = (*Tsmall_pool_struct)(unsafe.Pointer(shdr_ptr)).Fhdr.Fnext space_freed = (*Tsmall_pool_struct)(unsafe.Pointer(shdr_ptr)).Fhdr.Fbytes_used + (*Tsmall_pool_struct)(unsafe.Pointer(shdr_ptr)).Fhdr.Fbytes_left + libc.Uint32FromInt64(16) Xjpeg_free_small(tls, cinfo, shdr_ptr, space_freed) *(*Tsize_t)(unsafe.Pointer(mem + 76)) -= space_freed shdr_ptr = next_shdr_ptr } } /* * Close up shop entirely. * Note that this cannot be called unless cinfo->mem is non-NULL. */ func _self_destruct(tls *libc.TLS, cinfo Tj_common_ptr) { var pool int32 _ = pool /* Close all backing store, release all memory. * Releasing pools in reverse order might help avoid fragmentation * with some (brain-damaged) malloc libraries. */ pool = libc.Int32FromInt32(JPOOL_NUMPOOLS) - libc.Int32FromInt32(1) for { if !(pool >= JPOOL_PERMANENT) { break } _free_pool(tls, cinfo, pool) goto _1 _1: ; pool-- } /* Release the memory manager control block too. */ Xjpeg_free_small(tls, cinfo, (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem, libc.Uint32FromInt64(84)) (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem = libc.UintptrFromInt32(0) /* ensures I will be called only once */ Xjpeg_mem_term(tls, cinfo) /* system-dependent cleanup */ } /* * Memory manager initialization. * When this is called, only the error manager pointer is valid in cinfo! */ func Xjinit_memory_mgr(tls *libc.TLS, cinfo Tj_common_ptr) { bp := tls.Alloc(32) defer tls.Free(32) var mem Tmy_mem_ptr var memenv, v2 uintptr var pool int32 var test_mac Tsize_t var _ /* ch at bp+4 */ uint8 var _ /* max_to_use at bp+0 */ int32 _, _, _, _, _ = mem, memenv, pool, test_mac, v2 (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem = libc.UintptrFromInt32(0) /* for safety if init fails */ /* Check for configuration errors. * SIZEOF(ALIGN_TYPE) should be a power of 2; otherwise, it probably * doesn't reflect any real hardware alignment requirement. * The test is a little tricky: for X>0, X and X-1 have no one-bits * in common if and only if X is a power of 2, ie has only one one-bit. * Some compilers may give an "unreachable code" warning here; ignore it. */ if libc.Uint32FromInt64(8)&(libc.Uint32FromInt64(8)-libc.Uint32FromInt32(1)) != uint32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_ALIGN_TYPE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be * a multiple of SIZEOF(ALIGN_TYPE). * Again, an "unreachable code" warning may be ignored here. * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK. */ test_mac = libc.Uint32FromInt32(1000000000) if libc.Int32FromUint32(test_mac) != int32(1000000000) || libc.Bool(libc.Uint32FromInt32(1000000000)%libc.Uint32FromInt64(8) != uint32(0)) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_BAD_ALLOC_CHUNK) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } *(*int32)(unsafe.Pointer(bp)) = Xjpeg_mem_init(tls, cinfo) /* system-dependent initialization */ /* Attempt to allocate memory manager's control block */ mem = Xjpeg_get_small(tls, cinfo, libc.Uint32FromInt64(84)) if mem == libc.UintptrFromInt32(0) { Xjpeg_mem_term(tls, cinfo) /* system-dependent cleanup */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_OUT_OF_MEMORY) *(*int32)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = 0 (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* OK, fill in the method pointers */ (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Falloc_small = __ccgo_fp(_alloc_small) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Falloc_large = __ccgo_fp(_alloc_large) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Falloc_sarray = __ccgo_fp(_alloc_sarray) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Falloc_barray = __ccgo_fp(_alloc_barray) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Frequest_virt_sarray = __ccgo_fp(_request_virt_sarray) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Frequest_virt_barray = __ccgo_fp(_request_virt_barray) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Frealize_virt_arrays = __ccgo_fp(_realize_virt_arrays) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Faccess_virt_sarray = __ccgo_fp(_access_virt_sarray) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Faccess_virt_barray = __ccgo_fp(_access_virt_barray) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Ffree_pool = __ccgo_fp(_free_pool) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Fself_destruct = __ccgo_fp(_self_destruct) /* Make MAX_ALLOC_CHUNK accessible to other modules */ (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Fmax_alloc_chunk = int32(1000000000) /* Initialize working state */ (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Fmax_memory_to_use = *(*int32)(unsafe.Pointer(bp)) pool = libc.Int32FromInt32(JPOOL_NUMPOOLS) - libc.Int32FromInt32(1) for { if !(pool >= JPOOL_PERMANENT) { break } *(*Tsmall_pool_ptr)(unsafe.Pointer(mem + 52 + uintptr(pool)*4)) = libc.UintptrFromInt32(0) *(*Tlarge_pool_ptr)(unsafe.Pointer(mem + 60 + uintptr(pool)*4)) = libc.UintptrFromInt32(0) goto _1 _1: ; pool-- } (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_sarray_list = libc.UintptrFromInt32(0) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fvirt_barray_list = libc.UintptrFromInt32(0) (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Ftotal_space_allocated = libc.Uint32FromInt64(84) /* Declare ourselves open for business */ (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fmem = mem /* Check for an environment variable JPEGMEM; if found, override the * default max_memory setting from jpeg_mem_init. Note that the * surrounding application may again override this value. * If your system doesn't support getenv(), define NO_GETENV to disable * this feature. */ v2 = libc.Xgetenv(tls, __ccgo_ts+9406) memenv = v2 if v2 != libc.UintptrFromInt32(0) { *(*uint8)(unsafe.Pointer(bp + 4)) = uint8('x') if libc.Xsscanf(tls, memenv, __ccgo_ts+9414, libc.VaList(bp+16, bp, bp+4)) > 0 { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 4))) == int32('m') || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 4))) == int32('M') { *(*int32)(unsafe.Pointer(bp)) *= int32(1000) } (*Tmy_memory_mgr)(unsafe.Pointer(mem)).Fpub.Fmax_memory_to_use = *(*int32)(unsafe.Pointer(bp)) * int32(1000) } } } /* *---------------------------------------------------------------------------- * * Jpegtcl_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, * loads xml package. * *---------------------------------------------------------------------------- */ func XJpegtcl_Init(tls *libc.TLS, interp uintptr) (r int32) { /* Interpreter to initialise. */ if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)< max_colors { break } /* won't fit, done with this pass */ *(*int32)(unsafe.Pointer(Ncolors + uintptr(j)*4))++ /* OK, apply the increment */ total_colors = temp changed = int32(TRUE1) goto _3 _3: ; i++ } } return total_colors } var _RGB_order = [3]int32{ 0: int32(RGB_GREEN), 2: int32(RGB_BLUE), } func _output_value(tls *libc.TLS, cinfo Tj_decompress_ptr, ci int32, j int32, maxj int32) (r int32) { /* Return j'th output value, where j will range from 0 to maxj */ /* The output values must fall in 0..MAXJSAMPLE in increasing order */ /* We always provide values 0 and MAXJSAMPLE for each component; * any additional values are equally spaced between these limits. * (Forcing the upper and lower values to the limits ensures that * dithering can't produce a color outside the selected gamut.) */ return (j*libc.Int32FromInt32(MAXJSAMPLE) + maxj/libc.Int32FromInt32(2)) / maxj } func _largest_input_value(tls *libc.TLS, cinfo Tj_decompress_ptr, ci int32, j int32, maxj int32) (r int32) { /* Return largest input value that should map to j'th output value */ /* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */ /* Breakpoints are halfway between values returned by output_value */ return ((libc.Int32FromInt32(2)*j+libc.Int32FromInt32(1))*libc.Int32FromInt32(MAXJSAMPLE) + maxj) / (libc.Int32FromInt32(2) * maxj) } /* * Create the colormap. */ func _create_colormap(tls *libc.TLS, cinfo Tj_decompress_ptr) { var _mp uintptr var blkdist, blksize, i, j, k, nci, ptr, total_colors, val int32 var colormap TJSAMPARRAY var cquantize Tmy_cquantize_ptr _, _, _, _, _, _, _, _, _, _, _, _ = _mp, blkdist, blksize, colormap, cquantize, i, j, k, nci, ptr, total_colors, val cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize /* Select number of colors for each component */ total_colors = _select_ncolors(tls, cinfo, cquantize+32) /* Report selected color counts */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components == int32(3) { _mp = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24 *(*int32)(unsafe.Pointer(_mp)) = total_colors *(*int32)(unsafe.Pointer(_mp + 1*4)) = *(*int32)(unsafe.Pointer(cquantize + 32)) *(*int32)(unsafe.Pointer(_mp + 2*4)) = *(*int32)(unsafe.Pointer(cquantize + 32 + 1*4)) *(*int32)(unsafe.Pointer(_mp + 3*4)) = *(*int32)(unsafe.Pointer(cquantize + 32 + 2*4)) (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_QUANT_3_NCOLORS) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) } else { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_QUANT_NCOLORS) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = total_colors (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) } /* Allocate and fill in the colormap. */ /* The colors are ordered in the map in standard row-major order, */ /* i.e. rightmost (highest-indexed) color changes most rapidly. */ colormap = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(total_colors), libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components)) /* blksize is number of adjacent repeated entries for a component */ /* blkdist is distance between groups of identical entries for a component */ blkdist = total_colors i = 0 for { if !(i < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components) { break } /* fill in colormap entries for i'th color component */ nci = *(*int32)(unsafe.Pointer(cquantize + 32 + uintptr(i)*4)) /* # of distinct values for this color */ blksize = blkdist / nci j = 0 for { if !(j < nci) { break } /* Compute j'th output value (out of nci) for component */ val = _output_value(tls, cinfo, i, j, nci-int32(1)) /* Fill in all colormap entries that have this value of this component */ ptr = j * blksize for { if !(ptr < total_colors) { break } /* fill in blksize entries beginning at ptr */ k = 0 for { if !(k < blksize) { break } *(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer(colormap + uintptr(i)*4)) + uintptr(ptr+k))) = libc.Uint8FromInt32(val) goto _4 _4: ; k++ } goto _3 _3: ; ptr += blkdist } goto _2 _2: ; j++ } blkdist = blksize /* blksize of this color is blkdist of next */ goto _1 _1: ; i++ } /* Save the colormap in private storage, * where it will survive color quantization mode changes. */ (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fsv_colormap = colormap (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fsv_actual = total_colors } /* * Create the color index table. */ func _create_colorindex(tls *libc.TLS, cinfo Tj_decompress_ptr) { var blksize, i, j, k, nci, pad, val, v3 int32 var cquantize Tmy_cquantize_ptr var indexptr TJSAMPROW _, _, _, _, _, _, _, _, _, _ = blksize, cquantize, i, indexptr, j, k, nci, pad, val, v3 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize /* For ordered dither, we pad the color index tables by MAXJSAMPLE in * each direction (input index values can be -MAXJSAMPLE .. 2*MAXJSAMPLE). * This is not necessary in the other dithering modes. However, we * flag whether it was done in case user changes dithering mode. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode == int32(JDITHER_ORDERED) { pad = libc.Int32FromInt32(MAXJSAMPLE) * libc.Int32FromInt32(2) (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fis_padded = int32(TRUE1) } else { pad = 0 (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fis_padded = int32(FALSE1) } (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1)+pad), libc.Uint32FromInt32((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components)) /* blksize is number of adjacent repeated entries for a component */ blksize = (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fsv_actual i = 0 for { if !(i < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components) { break } /* fill in colorindex entries for i'th color component */ nci = *(*int32)(unsafe.Pointer(cquantize + 32 + uintptr(i)*4)) /* # of distinct values for this color */ blksize = blksize / nci /* adjust colorindex pointers to provide padding at negative indexes. */ if pad != 0 { *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex + uintptr(i)*4)) += uintptr(MAXJSAMPLE) } /* in loop, val = index of current output value, */ /* and k = largest j that maps to current val */ indexptr = *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex + uintptr(i)*4)) val = 0 k = _largest_input_value(tls, cinfo, i, 0, nci-int32(1)) j = 0 for { if !(j <= int32(MAXJSAMPLE)) { break } for j > k { /* advance val if past boundary */ val++ v3 = val k = _largest_input_value(tls, cinfo, i, v3, nci-int32(1)) } /* premultiply so that no multiplication needed in main processing */ *(*TJSAMPLE)(unsafe.Pointer(indexptr + uintptr(j))) = libc.Uint8FromInt32(val * blksize) goto _2 _2: ; j++ } /* Pad at both ends if necessary */ if pad != 0 { j = int32(1) for { if !(j <= int32(MAXJSAMPLE)) { break } *(*TJSAMPLE)(unsafe.Pointer(indexptr + uintptr(-j))) = *(*TJSAMPLE)(unsafe.Pointer(indexptr)) *(*TJSAMPLE)(unsafe.Pointer(indexptr + uintptr(int32(MAXJSAMPLE)+j))) = *(*TJSAMPLE)(unsafe.Pointer(indexptr + 255)) goto _4 _4: ; j++ } } goto _1 _1: ; i++ } } /* * Create an ordered-dither array for a component having ncolors * distinct output values. */ func _make_odither_array(tls *libc.TLS, cinfo Tj_decompress_ptr, ncolors int32) (r TODITHER_MATRIX_PTR) { var den, num TINT32 var j, k, v3 int32 var odither TODITHER_MATRIX_PTR _, _, _, _, _, _ = den, j, k, num, odither, v3 odither = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(1024)) /* The inter-value distance for this color is MAXJSAMPLE/(ncolors-1). * Hence the dither value for the matrix cell with fill order f * (f=0..N-1) should be (N-1-2*f)/(2*N) * MAXJSAMPLE/(ncolors-1). * On 16-bit-int machine, be careful to avoid overflow. */ den = libc.Int32FromInt32(2) * (libc.Int32FromInt32(ODITHER_SIZE) * libc.Int32FromInt32(ODITHER_SIZE)) * (ncolors - libc.Int32FromInt32(1)) j = 0 for { if !(j < int32(ODITHER_SIZE)) { break } k = 0 for { if !(k < int32(ODITHER_SIZE)) { break } num = (libc.Int32FromInt32(ODITHER_SIZE)*libc.Int32FromInt32(ODITHER_SIZE) - libc.Int32FromInt32(1) - libc.Int32FromInt32(2)*libc.Int32FromUint8(*(*TUINT8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_base_dither_matrix)) + uintptr(j)*16 + uintptr(k))))) * int32(MAXJSAMPLE) /* Ensure round towards zero despite C's lack of consistency * about rounding negative values in integer division... */ if num < 0 { v3 = -(-num / den) } else { v3 = num / den } *(*int32)(unsafe.Pointer(odither + uintptr(j)*64 + uintptr(k)*4)) = v3 goto _2 _2: ; k++ } goto _1 _1: ; j++ } return odither } /* * Create the ordered-dither tables. * Components having the same number of representative colors may * share a dither table. */ func _create_odither_tables(tls *libc.TLS, cinfo Tj_decompress_ptr) { var cquantize Tmy_cquantize_ptr var i, j, nci int32 var odither TODITHER_MATRIX_PTR _, _, _, _, _ = cquantize, i, j, nci, odither cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize i = 0 for { if !(i < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components) { break } nci = *(*int32)(unsafe.Pointer(cquantize + 32 + uintptr(i)*4)) /* # of distinct values for this color */ odither = libc.UintptrFromInt32(0) /* search for matching prior component */ j = 0 for { if !(j < i) { break } if nci == *(*int32)(unsafe.Pointer(cquantize + 32 + uintptr(j)*4)) { odither = *(*TODITHER_MATRIX_PTR)(unsafe.Pointer(cquantize + 52 + uintptr(j)*4)) break } goto _2 _2: ; j++ } if odither == libc.UintptrFromInt32(0) { /* need a new table? */ odither = _make_odither_array(tls, cinfo, nci) } *(*TODITHER_MATRIX_PTR)(unsafe.Pointer(cquantize + 52 + uintptr(i)*4)) = odither goto _1 _1: ; i++ } } /* * Map some rows of pixels to the output colormapped representation. */ func _color_quantize(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPARRAY, num_rows int32) { /* General case, no dithering */ var ci, nc, pixcode, row int32 var col, width TJDIMENSION var colorindex TJSAMPARRAY var cquantize Tmy_cquantize_ptr var ptrin, ptrout, v4, v5 TJSAMPROW _, _, _, _, _, _, _, _, _, _, _, _ = ci, col, colorindex, cquantize, nc, pixcode, ptrin, ptrout, row, width, v4, v5 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize colorindex = (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex width = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width nc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components row = 0 for { if !(row < num_rows) { break } ptrin = *(*TJSAMPROW)(unsafe.Pointer(input_buf + uintptr(row)*4)) ptrout = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(row)*4)) col = width for { if !(col > uint32(0)) { break } pixcode = 0 ci = 0 for { if !(ci < nc) { break } v4 = ptrin ptrin++ pixcode += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer(colorindex + uintptr(ci)*4)) + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v4))))))) goto _3 _3: ; ci++ } v5 = ptrout ptrout++ *(*TJSAMPLE)(unsafe.Pointer(v5)) = libc.Uint8FromInt32(pixcode) goto _2 _2: ; col-- } goto _1 _1: ; row++ } } func _color_quantize3(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPARRAY, num_rows int32) { /* Fast path for out_color_components==3, no dithering */ var col, width TJDIMENSION var colorindex0, colorindex1, colorindex2, ptrin, ptrout, v3, v4, v5, v6 TJSAMPROW var cquantize Tmy_cquantize_ptr var pixcode, row int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _ = col, colorindex0, colorindex1, colorindex2, cquantize, pixcode, ptrin, ptrout, row, width, v3, v4, v5, v6 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize colorindex0 = *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex)) colorindex1 = *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex + 1*4)) colorindex2 = *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex + 2*4)) width = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width row = 0 for { if !(row < num_rows) { break } ptrin = *(*TJSAMPROW)(unsafe.Pointer(input_buf + uintptr(row)*4)) ptrout = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(row)*4)) col = width for { if !(col > uint32(0)) { break } v3 = ptrin ptrin++ pixcode = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colorindex0 + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v3))))))) v4 = ptrin ptrin++ pixcode += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colorindex1 + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v4))))))) v5 = ptrin ptrin++ pixcode += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colorindex2 + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v5))))))) v6 = ptrout ptrout++ *(*TJSAMPLE)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(pixcode) goto _2 _2: ; col-- } goto _1 _1: ; row++ } } func _quantize_ord_dither(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPARRAY, num_rows int32) { /* General case, with ordered dithering */ var ci, col_index, nc, row, row_index int32 var col, width TJDIMENSION var colorindex_ci, input_ptr, output_ptr TJSAMPROW var cquantize Tmy_cquantize_ptr var dither, p4 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _ = ci, col, col_index, colorindex_ci, cquantize, dither, input_ptr, nc, output_ptr, row, row_index, width, p4 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize /* current indexes into dither matrix */ nc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components width = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width row = 0 for { if !(row < num_rows) { break } /* Initialize output values to 0 so can process components separately */ libc.Xmemset(tls, *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(row)*4)), 0, width*libc.Uint32FromInt64(1)) row_index = (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Frow_index ci = 0 for { if !(ci < nc) { break } input_ptr = *(*TJSAMPROW)(unsafe.Pointer(input_buf + uintptr(row)*4)) + uintptr(ci) output_ptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(row)*4)) colorindex_ci = *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex + uintptr(ci)*4)) dither = *(*TODITHER_MATRIX_PTR)(unsafe.Pointer(cquantize + 52 + uintptr(ci)*4)) + uintptr(row_index)*64 col_index = 0 col = width for { if !(col > uint32(0)) { break } /* Form pixel value + dither, range-limit to 0..MAXJSAMPLE, * select output value, accumulate into output code for this pixel. * Range-limiting need not be done explicitly, as we have extended * the colorindex table to produce the right answers for out-of-range * inputs. The maximum dither is +- MAXJSAMPLE; this sets the * required amount of padding. */ p4 = output_ptr *(*TJSAMPLE)(unsafe.Pointer(p4)) = TJSAMPLE(int32(*(*TJSAMPLE)(unsafe.Pointer(p4))) + libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colorindex_ci + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(input_ptr)))+*(*int32)(unsafe.Pointer(dither + uintptr(col_index)*4))))))) input_ptr += uintptr(nc) output_ptr++ col_index = (col_index + int32(1)) & (libc.Int32FromInt32(ODITHER_SIZE) - libc.Int32FromInt32(1)) goto _3 _3: ; col-- } goto _2 _2: ; ci++ } /* Advance row index for next row */ row_index = (row_index + int32(1)) & (libc.Int32FromInt32(ODITHER_SIZE) - libc.Int32FromInt32(1)) (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Frow_index = row_index goto _1 _1: ; row++ } } func _quantize3_ord_dither(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPARRAY, num_rows int32) { /* Fast path for out_color_components==3, with ordered dithering */ var col, width TJDIMENSION var col_index, pixcode, row, row_index int32 var colorindex0, colorindex1, colorindex2, input_ptr, output_ptr, v3, v4, v5, v6 TJSAMPROW var cquantize Tmy_cquantize_ptr var dither0, dither1, dither2 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = col, col_index, colorindex0, colorindex1, colorindex2, cquantize, dither0, dither1, dither2, input_ptr, output_ptr, pixcode, row, row_index, width, v3, v4, v5, v6 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize colorindex0 = *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex)) colorindex1 = *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex + 1*4)) colorindex2 = *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex + 2*4)) width = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width row = 0 for { if !(row < num_rows) { break } row_index = (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Frow_index input_ptr = *(*TJSAMPROW)(unsafe.Pointer(input_buf + uintptr(row)*4)) output_ptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(row)*4)) dither0 = *(*TODITHER_MATRIX_PTR)(unsafe.Pointer(cquantize + 52)) + uintptr(row_index)*64 dither1 = *(*TODITHER_MATRIX_PTR)(unsafe.Pointer(cquantize + 52 + 1*4)) + uintptr(row_index)*64 dither2 = *(*TODITHER_MATRIX_PTR)(unsafe.Pointer(cquantize + 52 + 2*4)) + uintptr(row_index)*64 col_index = 0 col = width for { if !(col > uint32(0)) { break } v3 = input_ptr input_ptr++ pixcode = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colorindex0 + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v3)))+*(*int32)(unsafe.Pointer(dither0 + uintptr(col_index)*4)))))) v4 = input_ptr input_ptr++ pixcode += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colorindex1 + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v4)))+*(*int32)(unsafe.Pointer(dither1 + uintptr(col_index)*4)))))) v5 = input_ptr input_ptr++ pixcode += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colorindex2 + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v5)))+*(*int32)(unsafe.Pointer(dither2 + uintptr(col_index)*4)))))) v6 = output_ptr output_ptr++ *(*TJSAMPLE)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(pixcode) col_index = (col_index + int32(1)) & (libc.Int32FromInt32(ODITHER_SIZE) - libc.Int32FromInt32(1)) goto _2 _2: ; col-- } row_index = (row_index + int32(1)) & (libc.Int32FromInt32(ODITHER_SIZE) - libc.Int32FromInt32(1)) (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Frow_index = row_index goto _1 _1: ; row++ } } func _quantize_fs_dither(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPARRAY, num_rows int32) { /* General case, with Floyd-Steinberg dithering */ var belowerr, bnexterr, bpreverr, cur, delta, v3 TLOCFSERROR var ci, dir, dirnc, nc, pixcode, row, v6 int32 var col, width TJDIMENSION var colorindex_ci, colormap_ci, input_ptr, output_ptr TJSAMPROW var cquantize Tmy_cquantize_ptr var errorptr TFSERRPTR var range_limit, p5 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = belowerr, bnexterr, bpreverr, ci, col, colorindex_ci, colormap_ci, cquantize, cur, delta, dir, dirnc, errorptr, input_ptr, nc, output_ptr, pixcode, range_limit, row, width, v3, v6, p5 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize nc = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components width = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width range_limit = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsample_range_limit row = 0 for { if !(row < num_rows) { break } /* Initialize output values to 0 so can process components separately */ libc.Xmemset(tls, *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(row)*4)), 0, width*libc.Uint32FromInt64(1)) ci = 0 for { if !(ci < nc) { break } input_ptr = *(*TJSAMPROW)(unsafe.Pointer(input_buf + uintptr(row)*4)) + uintptr(ci) output_ptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(row)*4)) if (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fon_odd_row != 0 { /* work right to left in this row */ input_ptr += uintptr((width - uint32(1)) * libc.Uint32FromInt32(nc)) /* so point to rightmost pixel */ output_ptr += uintptr(width - uint32(1)) dir = -int32(1) dirnc = -nc errorptr = *(*TFSERRPTR)(unsafe.Pointer(cquantize + 68 + uintptr(ci)*4)) + uintptr(width+libc.Uint32FromInt32(1))*2 /* => entry after last column */ } else { /* work left to right in this row */ dir = int32(1) dirnc = nc errorptr = *(*TFSERRPTR)(unsafe.Pointer(cquantize + 68 + uintptr(ci)*4)) /* => entry before first column */ } colorindex_ci = *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fcolorindex + uintptr(ci)*4)) colormap_ci = *(*TJSAMPROW)(unsafe.Pointer((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fsv_colormap + uintptr(ci)*4)) /* Preset error values: no error propagated to first pixel from left */ cur = 0 /* and no error propagated to row below yet */ v3 = libc.Int32FromInt32(0) bpreverr = v3 belowerr = v3 col = width for { if !(col > uint32(0)) { break } /* cur holds the error propagated from the previous pixel on the * current line. Add the error propagated from the previous line * to form the complete error correction term for this pixel, and * round the error term (which is expressed * 16) to an integer. * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct * for either sign of the error value. * Note: errorptr points to *previous* column's array entry. */ cur = (cur + int32(*(*TFSERROR)(unsafe.Pointer(errorptr + uintptr(dir)*2))) + libc.Int32FromInt32(8)) >> libc.Int32FromInt32(4) /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. * The maximum error is +- MAXJSAMPLE; this sets the required size * of the range_limit array. */ cur += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(input_ptr))) cur = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(cur)))) /* Select output value, accumulate into output code for this pixel */ pixcode = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colorindex_ci + uintptr(cur)))) p5 = output_ptr *(*TJSAMPLE)(unsafe.Pointer(p5)) = TJSAMPLE(int32(*(*TJSAMPLE)(unsafe.Pointer(p5))) + libc.Int32FromUint8(libc.Uint8FromInt32(pixcode))) /* Compute actual representation error at this pixel */ /* Note: we can do this even though we don't have the final */ /* pixel code, because the colormap is orthogonal. */ cur -= libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colormap_ci + uintptr(pixcode)))) /* Compute error fractions to be propagated to adjacent pixels. * Add these into the running sums, and simultaneously shift the * next-line error sums left by 1 column. */ bnexterr = cur delta = cur * int32(2) cur += delta /* form error * 3 */ *(*TFSERROR)(unsafe.Pointer(errorptr)) = int16(bpreverr + cur) cur += delta /* form error * 5 */ bpreverr = belowerr + cur belowerr = bnexterr cur += delta /* form error * 7 */ /* At this point cur contains the 7/16 error value to be propagated * to the next pixel on the current line, and all the errors for the * next line have been shifted over. We are therefore ready to move on. */ input_ptr += uintptr(dirnc) /* advance input ptr to next column */ output_ptr += uintptr(dir) /* advance output ptr to next column */ errorptr += uintptr(dir) * 2 /* advance errorptr to current column */ goto _4 _4: ; col-- } /* Post-loop cleanup: we must unload the final error value into the * final fserrors[] entry. Note we need not unload belowerr because * it is for the dummy column before or after the actual array. */ *(*TFSERROR)(unsafe.Pointer(errorptr)) = int16(bpreverr) /* unload prev err into array */ goto _2 _2: ; ci++ } if (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fon_odd_row != 0 { v6 = int32(FALSE1) } else { v6 = int32(TRUE1) } (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fon_odd_row = v6 goto _1 _1: ; row++ } } /* * Allocate workspace for Floyd-Steinberg errors. */ func _alloc_fs_workspace(tls *libc.TLS, cinfo Tj_decompress_ptr) { var arraysize Tsize_t var cquantize Tmy_cquantize_ptr var i int32 _, _, _ = arraysize, cquantize, i cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize arraysize = ((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width + libc.Uint32FromInt32(2)) * libc.Uint32FromInt64(2) i = 0 for { if !(i < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components) { break } *(*TFSERRPTR)(unsafe.Pointer(cquantize + 68 + uintptr(i)*4)) = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_large})))(tls, cinfo, int32(JPOOL_IMAGE), arraysize) goto _1 _1: ; i++ } } /* * Initialize for one-pass color quantization. */ func _start_pass_1_quant(tls *libc.TLS, cinfo Tj_decompress_ptr, is_pre_scan Tboolean) { var arraysize Tsize_t var cquantize Tmy_cquantize_ptr var i int32 _, _, _ = arraysize, cquantize, i cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize /* Install my colormap. */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap = (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fsv_colormap (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Factual_number_of_colors = (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fsv_actual /* Initialize for desired dithering mode. */ switch (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode { case int32(JDITHER_NONE): if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components == int32(3) { (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fpub.Fcolor_quantize = __ccgo_fp(_color_quantize3) } else { (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fpub.Fcolor_quantize = __ccgo_fp(_color_quantize) } case int32(JDITHER_ORDERED): if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components == int32(3) { (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fpub.Fcolor_quantize = __ccgo_fp(_quantize3_ord_dither) } else { (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fpub.Fcolor_quantize = __ccgo_fp(_quantize_ord_dither) } (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Frow_index = 0 /* initialize state for ordered dither */ /* If user changed to ordered dither from another mode, * we must recreate the color index table with padding. * This will cost extra space, but probably isn't very likely. */ if !((*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fis_padded != 0) { _create_colorindex(tls, cinfo) } /* Create ordered-dither tables if we didn't already. */ if *(*TODITHER_MATRIX_PTR)(unsafe.Pointer(cquantize + 52)) == libc.UintptrFromInt32(0) { _create_odither_tables(tls, cinfo) } case int32(JDITHER_FS): (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fpub.Fcolor_quantize = __ccgo_fp(_quantize_fs_dither) (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fon_odd_row = int32(FALSE1) /* initialize state for F-S dither */ /* Allocate Floyd-Steinberg workspace if didn't already. */ if *(*TFSERRPTR)(unsafe.Pointer(cquantize + 68)) == libc.UintptrFromInt32(0) { _alloc_fs_workspace(tls, cinfo) } /* Initialize the propagated errors to zero. */ arraysize = ((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width + libc.Uint32FromInt32(2)) * libc.Uint32FromInt64(2) i = 0 for { if !(i < (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components) { break } libc.Xmemset(tls, *(*TFSERRPTR)(unsafe.Pointer(cquantize + 68 + uintptr(i)*4)), 0, arraysize) goto _1 _1: ; i++ } default: (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_NOT_COMPILED) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } } /* * Finish up at the end of the pass. */ func _finish_pass_1_quant(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* no work in 1-pass case */ } /* * Switch to a new external colormap between output passes. * Shouldn't get to this module! */ func _new_color_map_1_quant(tls *libc.TLS, cinfo Tj_decompress_ptr) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_MODE_CHANGE) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* * Module initialization routine for 1-pass color quantization. */ func Xjinit_1pass_quantizer(tls *libc.TLS, cinfo Tj_decompress_ptr) { var cquantize Tmy_cquantize_ptr _ = cquantize cquantize = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt64(88)) (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize = cquantize (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fpub.Fstart_pass = __ccgo_fp(_start_pass_1_quant) (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fpub.Ffinish_pass = __ccgo_fp(_finish_pass_1_quant) (*Tmy_cquantizer)(unsafe.Pointer(cquantize)).Fpub.Fnew_color_map = __ccgo_fp(_new_color_map_1_quant) *(*TFSERRPTR)(unsafe.Pointer(cquantize + 68)) = libc.UintptrFromInt32(0) /* Flag FS workspace not allocated */ *(*TODITHER_MATRIX_PTR)(unsafe.Pointer(cquantize + 52)) = libc.UintptrFromInt32(0) /* Also flag odither arrays not allocated */ /* Make sure my internal arrays won't overflow */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fout_color_components > int32(MAX_Q_COMPS) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_QUANT_COMPONENTS) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = int32(MAX_Q_COMPS) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Make sure colormap indexes can be represented by JSAMPLEs */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdesired_number_of_colors > libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_QUANT_MANY_COLORS) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromInt32(MAXJSAMPLE) + libc.Int32FromInt32(1) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Create the colormap and color index table. */ _create_colormap(tls, cinfo) _create_colorindex(tls, cinfo) /* Allocate Floyd-Steinberg workspace now if requested. * We do this now since it is FAR storage and may affect the memory * manager's space calculations. If the user changes to FS dither * mode in a later pass, we will allocate the space then, and will * possibly overrun the max_memory_to_use setting. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode == int32(JDITHER_FS) { _alloc_fs_workspace(tls, cinfo) } } const B_SCALE = 1 const C0_SCALE = "R_SCALE" const C1_SCALE = "G_SCALE" const C2_SCALE = "B_SCALE" const G_SCALE = 3 const HIST_C0_BITS = 5 const HIST_C1_BITS = 6 const HIST_C2_BITS = 5 const R_SCALE = 2 /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* * This module implements the well-known Heckbert paradigm for color * quantization. Most of the ideas used here can be traced back to * Heckbert's seminal paper * Heckbert, Paul. "Color Image Quantization for Frame Buffer Display", * Proc. SIGGRAPH '82, Computer Graphics v.16 #3 (July 1982), pp 297-304. * * In the first pass over the image, we accumulate a histogram showing the * usage count of each possible color. To keep the histogram to a reasonable * size, we reduce the precision of the input; typical practice is to retain * 5 or 6 bits per color, so that 8 or 4 different input values are counted * in the same histogram cell. * * Next, the color-selection step begins with a box representing the whole * color space, and repeatedly splits the "largest" remaining box until we * have as many boxes as desired colors. Then the mean color in each * remaining box becomes one of the possible output colors. * * The second pass over the image maps each input pixel to the closest output * color (optionally after applying a Floyd-Steinberg dithering correction). * This mapping is logically trivial, but making it go fast enough requires * considerable care. * * Heckbert-style quantizers vary a good deal in their policies for choosing * the "largest" box and deciding where to cut it. The particular policies * used here have proved out well in experimental comparisons, but better ones * may yet be found. * * In earlier versions of the IJG code, this module quantized in YCbCr color * space, processing the raw upsampled data without a color conversion step. * This allowed the color conversion math to be done only once per colormap * entry, not once per pixel. However, that optimization precluded other * useful optimizations (such as merging color conversion with upsampling) * and it also interfered with desired capabilities such as quantizing to an * externally-supplied colormap. We have therefore abandoned that approach. * The present code works in the post-conversion color space, typically RGB. * * To improve the visual quality of the results, we actually work in scaled * RGB space, giving G distances more weight than R, and R in turn more than * B. To do everything in integer math, we must use integer scale factors. * The 2/3/1 scale factors used here correspond loosely to the relative * weights of the colors in the NTSC grayscale equation. * If you want to use this code to quantize a non-RGB color space, you'll * probably need to change these scale factors. */ /* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B * and B,G,R orders. If you define some other weird order in jmorecfg.h, * you'll get compile errors until you extend this logic. In that case * you'll probably want to tweak the histogram sizes too. */ /* * First we have the histogram data structure and routines for creating it. * * The number of bits of precision can be adjusted by changing these symbols. * We recommend keeping 6 bits for G and 5 each for R and B. * If you have plenty of memory and cycles, 6 bits all around gives marginally * better results; if you are short of memory, 5 bits all around will save * some space but degrade the results. * To maintain a fully accurate histogram, we'd need to allocate a "long" * (preferably unsigned long) for each cell. In practice this is overkill; * we can get by with 16 bits per cell. Few of the cell counts will overflow, * and clamping those that do overflow to the maximum value will give close- * enough results. This reduces the recommended histogram size from 256Kb * to 128Kb, which is a useful savings on PC-class machines. * (In the second pass the histogram space is re-used for pixel mapping data; * in that capacity, each cell must be able to store zero to the number of * desired colors. 16 bits/cell is plenty for that too.) * Since the JPEG code is intended to run in small memory model on 80x86 * machines, we can't just allocate the histogram in one chunk. Instead * of a true 3-D array, we use a row of pointers to 2-D arrays. Each * pointer corresponds to a C0 value (typically 2^5 = 32 pointers) and * each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries. Note that * on 80x86 machines, the pointer row is in near memory but the actual * arrays are in far memory (same arrangement as we use for image arrays). */ /* These will do the right thing for either R,G,B or B,G,R color order, * but you may not like the results for other color orders. */ /* Number of elements along histogram axes. */ /* These are the amounts to shift an input value to get a histogram index. */ type Thistcell = uint16 /* histogram cell; prefer an unsigned type */ type Thistptr = uintptr /* for pointers to histogram cells */ type Thist1d = [32]Thistcell /* typedefs for the array */ type Thist2d = uintptr /* type for the 2nd-level pointers */ type Thist3d = uintptr /* pointer to error array (in FAR storage!) */ /* Private subobject */ type Tmy_cquantizer1 = struct { Fpub Tjpeg_color_quantizer Fsv_colormap TJSAMPARRAY Fdesired int32 Fhistogram Thist3d Fneeds_zeroed Tboolean Ffserrors TFSERRPTR Fon_odd_row Tboolean Ferror_limiter uintptr } /* * Prescan some rows of pixels. * In this module the prescan simply updates the histogram, which has been * initialized to zeroes by start_pass. * An output_buf parameter is required by the method signature, but no data * is actually output (in fact the buffer controller is probably passing a * NULL pointer). */ func _prescan_quantize(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPARRAY, num_rows int32) { var col, width TJDIMENSION var cquantize Tmy_cquantize_ptr var histogram Thist3d var histp Thistptr var ptr TJSAMPROW var row int32 var v3 Thistcell var v4 uintptr _, _, _, _, _, _, _, _, _ = col, cquantize, histogram, histp, ptr, row, width, v3, v4 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize histogram = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fhistogram width = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width row = 0 for { if !(row < num_rows) { break } ptr = *(*TJSAMPROW)(unsafe.Pointer(input_buf + uintptr(row)*4)) col = width for { if !(col > uint32(0)) { break } /* get pixel value and index into the histogram */ histp = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(ptr)))>>(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS)))*4)) + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(ptr + 1)))>>(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS)))*64 + uintptr(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(ptr + 2)))>>(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS)))*2 /* increment, check for overflow and undo increment if so. */ v4 = histp *(*Thistcell)(unsafe.Pointer(v4))++ v3 = *(*Thistcell)(unsafe.Pointer(v4)) if libc.Int32FromUint16(v3) <= 0 { *(*Thistcell)(unsafe.Pointer(histp))-- } ptr += uintptr(3) goto _2 _2: ; col-- } goto _1 _1: ; row++ } } /* * Next we have the really interesting routines: selection of a colormap * given the completed histogram. * These routines work with a list of "boxes", each representing a rectangular * subset of the input color space (to histogram precision). */ type Tbox = struct { Fc0min int32 Fc0max int32 Fc1min int32 Fc1max int32 Fc2min int32 Fc2max int32 Fvolume TINT32 Fcolorcount int32 } type Tboxptr = uintptr func _find_biggest_color_pop(tls *libc.TLS, boxlist Tboxptr, numboxes int32) (r Tboxptr) { /* Find the splittable box with the largest color population */ /* Returns NULL if no splittable boxes remain */ var boxp, which Tboxptr var i, maxc int32 _, _, _, _ = boxp, i, maxc, which maxc = 0 which = libc.UintptrFromInt32(0) i = 0 boxp = boxlist for { if !(i < numboxes) { break } if (*Tbox)(unsafe.Pointer(boxp)).Fcolorcount > maxc && (*Tbox)(unsafe.Pointer(boxp)).Fvolume > 0 { which = boxp maxc = (*Tbox)(unsafe.Pointer(boxp)).Fcolorcount } goto _1 _1: ; i++ boxp += 32 } return which } func _find_biggest_volume(tls *libc.TLS, boxlist Tboxptr, numboxes int32) (r Tboxptr) { /* Find the splittable box with the largest (scaled) volume */ /* Returns NULL if no splittable boxes remain */ var boxp, which Tboxptr var i int32 var maxv TINT32 _, _, _, _ = boxp, i, maxv, which maxv = 0 which = libc.UintptrFromInt32(0) i = 0 boxp = boxlist for { if !(i < numboxes) { break } if (*Tbox)(unsafe.Pointer(boxp)).Fvolume > maxv { which = boxp maxv = (*Tbox)(unsafe.Pointer(boxp)).Fvolume } goto _1 _1: ; i++ boxp += 32 } return which } func _update_box(tls *libc.TLS, cinfo Tj_decompress_ptr, boxp Tboxptr) { /* Shrink the min/max bounds of a box to enclose only nonzero elements, */ /* and recompute its volume and population */ var c0, c0max, c0min, c1, c1max, c1min, c2, c2max, c2min, ccount, v10, v15, v20, v24, v28, v5 int32 var cquantize Tmy_cquantize_ptr var dist0, dist1, dist2 TINT32 var histogram Thist3d var histp, v14, v19, v4, v9 Thistptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c0, c0max, c0min, c1, c1max, c1min, c2, c2max, c2min, ccount, cquantize, dist0, dist1, dist2, histogram, histp, v10, v14, v15, v19, v20, v24, v28, v4, v5, v9 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize histogram = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fhistogram c0min = (*Tbox)(unsafe.Pointer(boxp)).Fc0min c0max = (*Tbox)(unsafe.Pointer(boxp)).Fc0max c1min = (*Tbox)(unsafe.Pointer(boxp)).Fc1min c1max = (*Tbox)(unsafe.Pointer(boxp)).Fc1max c2min = (*Tbox)(unsafe.Pointer(boxp)).Fc2min c2max = (*Tbox)(unsafe.Pointer(boxp)).Fc2max if c0max > c0min { c0 = c0min for { if !(c0 <= c0max) { break } c1 = c1min for { if !(c1 <= c1max) { break } histp = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(c0)*4)) + uintptr(c1)*64 + uintptr(c2min)*2 c2 = c2min for { if !(c2 <= c2max) { break } v4 = histp histp += 2 if libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(v4))) != 0 { v5 = c0 c0min = v5 (*Tbox)(unsafe.Pointer(boxp)).Fc0min = v5 goto have_c0min } goto _3 _3: ; c2++ } goto _2 _2: ; c1++ } goto _1 _1: ; c0++ } } goto have_c0min have_c0min: ; if c0max > c0min { c0 = c0max for { if !(c0 >= c0min) { break } c1 = c1min for { if !(c1 <= c1max) { break } histp = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(c0)*4)) + uintptr(c1)*64 + uintptr(c2min)*2 c2 = c2min for { if !(c2 <= c2max) { break } v9 = histp histp += 2 if libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(v9))) != 0 { v10 = c0 c0max = v10 (*Tbox)(unsafe.Pointer(boxp)).Fc0max = v10 goto have_c0max } goto _8 _8: ; c2++ } goto _7 _7: ; c1++ } goto _6 _6: ; c0-- } } goto have_c0max have_c0max: ; if c1max > c1min { c1 = c1min for { if !(c1 <= c1max) { break } c0 = c0min for { if !(c0 <= c0max) { break } histp = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(c0)*4)) + uintptr(c1)*64 + uintptr(c2min)*2 c2 = c2min for { if !(c2 <= c2max) { break } v14 = histp histp += 2 if libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(v14))) != 0 { v15 = c1 c1min = v15 (*Tbox)(unsafe.Pointer(boxp)).Fc1min = v15 goto have_c1min } goto _13 _13: ; c2++ } goto _12 _12: ; c0++ } goto _11 _11: ; c1++ } } goto have_c1min have_c1min: ; if c1max > c1min { c1 = c1max for { if !(c1 >= c1min) { break } c0 = c0min for { if !(c0 <= c0max) { break } histp = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(c0)*4)) + uintptr(c1)*64 + uintptr(c2min)*2 c2 = c2min for { if !(c2 <= c2max) { break } v19 = histp histp += 2 if libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(v19))) != 0 { v20 = c1 c1max = v20 (*Tbox)(unsafe.Pointer(boxp)).Fc1max = v20 goto have_c1max } goto _18 _18: ; c2++ } goto _17 _17: ; c0++ } goto _16 _16: ; c1-- } } goto have_c1max have_c1max: ; if c2max > c2min { c2 = c2min for { if !(c2 <= c2max) { break } c0 = c0min for { if !(c0 <= c0max) { break } histp = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(c0)*4)) + uintptr(c1min)*64 + uintptr(c2)*2 c1 = c1min for { if !(c1 <= c1max) { break } if libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(histp))) != 0 { v24 = c2 c2min = v24 (*Tbox)(unsafe.Pointer(boxp)).Fc2min = v24 goto have_c2min } goto _23 _23: ; c1++ histp += uintptr(libc.Int32FromInt32(1)< c2min { c2 = c2max for { if !(c2 >= c2min) { break } c0 = c0min for { if !(c0 <= c0max) { break } histp = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(c0)*4)) + uintptr(c1min)*64 + uintptr(c2)*2 c1 = c1min for { if !(c1 <= c1max) { break } if libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(histp))) != 0 { v28 = c2 c2max = v28 (*Tbox)(unsafe.Pointer(boxp)).Fc2max = v28 goto have_c2max } goto _27 _27: ; c1++ histp += uintptr(libc.Int32FromInt32(1)< 0. * Since the differences are expressed in histogram-cell units, * we have to shift back to JSAMPLE units to get consistent distances; * after which, we scale according to the selected distance scale factors. */ dist0 = (c0max - c0min) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C0_BITS)) * int32(R_SCALE) dist1 = (c1max - c1min) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C1_BITS)) * int32(G_SCALE) dist2 = (c2max - c2min) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C2_BITS)) * int32(B_SCALE) (*Tbox)(unsafe.Pointer(boxp)).Fvolume = dist0*dist0 + dist1*dist1 + dist2*dist2 /* Now scan remaining volume of box and compute population */ ccount = 0 c0 = c0min for { if !(c0 <= c0max) { break } c1 = c1min for { if !(c1 <= c1max) { break } histp = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(c0)*4)) + uintptr(c1)*64 + uintptr(c2min)*2 c2 = c2min for { if !(c2 <= c2max) { break } if libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(histp))) != 0 { ccount++ } goto _31 _31: ; c2++ histp += 2 } goto _30 _30: ; c1++ } goto _29 _29: ; c0++ } (*Tbox)(unsafe.Pointer(boxp)).Fcolorcount = ccount } func _median_cut(tls *libc.TLS, cinfo Tj_decompress_ptr, boxlist Tboxptr, numboxes int32, desired_colors int32) (r int32) { /* Repeatedly select and split the largest box until we have enough boxes */ var b1, b2 Tboxptr var c0, c1, c2, cmax, lb, n int32 _, _, _, _, _, _, _, _ = b1, b2, c0, c1, c2, cmax, lb, n for numboxes < desired_colors { /* Select box to split. * Current algorithm: by population for first half, then by volume. */ if numboxes*int32(2) <= desired_colors { b1 = _find_biggest_color_pop(tls, boxlist, numboxes) } else { b1 = _find_biggest_volume(tls, boxlist, numboxes) } if b1 == libc.UintptrFromInt32(0) { /* no splittable boxes left! */ break } b2 = boxlist + uintptr(numboxes)*32 /* where new box will go */ /* Copy the color bounds to the new box. */ (*Tbox)(unsafe.Pointer(b2)).Fc0max = (*Tbox)(unsafe.Pointer(b1)).Fc0max (*Tbox)(unsafe.Pointer(b2)).Fc1max = (*Tbox)(unsafe.Pointer(b1)).Fc1max (*Tbox)(unsafe.Pointer(b2)).Fc2max = (*Tbox)(unsafe.Pointer(b1)).Fc2max (*Tbox)(unsafe.Pointer(b2)).Fc0min = (*Tbox)(unsafe.Pointer(b1)).Fc0min (*Tbox)(unsafe.Pointer(b2)).Fc1min = (*Tbox)(unsafe.Pointer(b1)).Fc1min (*Tbox)(unsafe.Pointer(b2)).Fc2min = (*Tbox)(unsafe.Pointer(b1)).Fc2min /* Choose which axis to split the box on. * Current algorithm: longest scaled axis. * See notes in update_box about scaling distances. */ c0 = ((*Tbox)(unsafe.Pointer(b1)).Fc0max - (*Tbox)(unsafe.Pointer(b1)).Fc0min) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C0_BITS)) * int32(R_SCALE) c1 = ((*Tbox)(unsafe.Pointer(b1)).Fc1max - (*Tbox)(unsafe.Pointer(b1)).Fc1min) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C1_BITS)) * int32(G_SCALE) c2 = ((*Tbox)(unsafe.Pointer(b1)).Fc2max - (*Tbox)(unsafe.Pointer(b1)).Fc2min) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C2_BITS)) * int32(B_SCALE) /* We want to break any ties in favor of green, then red, blue last. * This code does the right thing for R,G,B or B,G,R color orders only. */ cmax = c1 n = int32(1) if c0 > cmax { cmax = c0 n = 0 } if c2 > cmax { n = int32(2) } /* Choose split point along selected axis, and update box bounds. * Current algorithm: split at halfway point. * (Since the box has been shrunk to minimum volume, * any split will produce two nonempty subboxes.) * Note that lb value is max for lower box, so must be < old max. */ switch n { case 0: lb = ((*Tbox)(unsafe.Pointer(b1)).Fc0max + (*Tbox)(unsafe.Pointer(b1)).Fc0min) / int32(2) (*Tbox)(unsafe.Pointer(b1)).Fc0max = lb (*Tbox)(unsafe.Pointer(b2)).Fc0min = lb + int32(1) case int32(1): lb = ((*Tbox)(unsafe.Pointer(b1)).Fc1max + (*Tbox)(unsafe.Pointer(b1)).Fc1min) / int32(2) (*Tbox)(unsafe.Pointer(b1)).Fc1max = lb (*Tbox)(unsafe.Pointer(b2)).Fc1min = lb + int32(1) case int32(2): lb = ((*Tbox)(unsafe.Pointer(b1)).Fc2max + (*Tbox)(unsafe.Pointer(b1)).Fc2min) / int32(2) (*Tbox)(unsafe.Pointer(b1)).Fc2max = lb (*Tbox)(unsafe.Pointer(b2)).Fc2min = lb + int32(1) break } /* Update stats for boxes */ _update_box(tls, cinfo, b1) _update_box(tls, cinfo, b2) numboxes++ } return numboxes } func _compute_color(tls *libc.TLS, cinfo Tj_decompress_ptr, boxp Tboxptr, icolor int32) { /* Compute representative color for a box, put it in colormap[icolor] */ var c0, c0max, c0min, c0total, c1, c1max, c1min, c1total, c2, c2max, c2min, c2total, count, total, v4 int32 var cquantize Tmy_cquantize_ptr var histogram Thist3d var histp, v5 Thistptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c0, c0max, c0min, c0total, c1, c1max, c1min, c1total, c2, c2max, c2min, c2total, count, cquantize, histogram, histp, total, v4, v5 /* Current algorithm: mean weighted by pixels (not colors) */ /* Note it is important to get the rounding correct! */ cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize histogram = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fhistogram total = 0 c0total = 0 c1total = 0 c2total = 0 c0min = (*Tbox)(unsafe.Pointer(boxp)).Fc0min c0max = (*Tbox)(unsafe.Pointer(boxp)).Fc0max c1min = (*Tbox)(unsafe.Pointer(boxp)).Fc1min c1max = (*Tbox)(unsafe.Pointer(boxp)).Fc1max c2min = (*Tbox)(unsafe.Pointer(boxp)).Fc2min c2max = (*Tbox)(unsafe.Pointer(boxp)).Fc2max c0 = c0min for { if !(c0 <= c0max) { break } c1 = c1min for { if !(c1 <= c1max) { break } histp = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(c0)*4)) + uintptr(c1)*64 + uintptr(c2min)*2 c2 = c2min for { if !(c2 <= c2max) { break } v5 = histp histp += 2 v4 = libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(v5))) count = v4 if v4 != 0 { total += count c0total += (c0<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS)) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS))>>libc.Int32FromInt32(1)) * count c1total += (c1<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS)) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS))>>libc.Int32FromInt32(1)) * count c2total += (c2<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS)) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS))>>libc.Int32FromInt32(1)) * count } goto _3 _3: ; c2++ } goto _2 _2: ; c1++ } goto _1 _1: ; c0++ } *(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap)) + uintptr(icolor))) = libc.Uint8FromInt32((c0total + total>>libc.Int32FromInt32(1)) / total) *(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap + 1*4)) + uintptr(icolor))) = libc.Uint8FromInt32((c1total + total>>libc.Int32FromInt32(1)) / total) *(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap + 2*4)) + uintptr(icolor))) = libc.Uint8FromInt32((c2total + total>>libc.Int32FromInt32(1)) / total) } func _select_colors(tls *libc.TLS, cinfo Tj_decompress_ptr, desired_colors int32) { /* Master routine for color selection */ var boxlist Tboxptr var i, numboxes int32 _, _, _ = boxlist, i, numboxes /* Allocate workspace for box list */ boxlist = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(desired_colors)*libc.Uint32FromInt64(32)) /* Initialize one box containing whole space */ numboxes = int32(1) (*(*Tbox)(unsafe.Pointer(boxlist))).Fc0min = 0 (*(*Tbox)(unsafe.Pointer(boxlist))).Fc0max = libc.Int32FromInt32(MAXJSAMPLE) >> (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C0_BITS)) (*(*Tbox)(unsafe.Pointer(boxlist))).Fc1min = 0 (*(*Tbox)(unsafe.Pointer(boxlist))).Fc1max = libc.Int32FromInt32(MAXJSAMPLE) >> (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C1_BITS)) (*(*Tbox)(unsafe.Pointer(boxlist))).Fc2min = 0 (*(*Tbox)(unsafe.Pointer(boxlist))).Fc2max = libc.Int32FromInt32(MAXJSAMPLE) >> (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C2_BITS)) /* Shrink it to actually-used volume and set its statistics */ _update_box(tls, cinfo, boxlist) /* Perform median-cut to produce final box list */ numboxes = _median_cut(tls, cinfo, boxlist, numboxes, desired_colors) /* Compute the representative color for each box, fill colormap */ i = 0 for { if !(i < numboxes) { break } _compute_color(tls, cinfo, boxlist+uintptr(i)*32, i) goto _1 _1: ; i++ } (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Factual_number_of_colors = numboxes (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JTRC_QUANT_SELECTED) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = numboxes (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, int32(1)) } /* * These routines are concerned with the time-critical task of mapping input * colors to the nearest color in the selected colormap. * * We re-use the histogram space as an "inverse color map", essentially a * cache for the results of nearest-color searches. All colors within a * histogram cell will be mapped to the same colormap entry, namely the one * closest to the cell's center. This may not be quite the closest entry to * the actual input color, but it's almost as good. A zero in the cache * indicates we haven't found the nearest color for that cell yet; the array * is cleared to zeroes before starting the mapping pass. When we find the * nearest color for a cell, its colormap index plus one is recorded in the * cache for future use. The pass2 scanning routines call fill_inverse_cmap * when they need to use an unfilled entry in the cache. * * Our method of efficiently finding nearest colors is based on the "locally * sorted search" idea described by Heckbert and on the incremental distance * calculation described by Spencer W. Thomas in chapter III.1 of Graphics * Gems II (James Arvo, ed. Academic Press, 1991). Thomas points out that * the distances from a given colormap entry to each cell of the histogram can * be computed quickly using an incremental method: the differences between * distances to adjacent cells themselves differ by a constant. This allows a * fairly fast implementation of the "brute force" approach of computing the * distance from every colormap entry to every histogram cell. Unfortunately, * it needs a work array to hold the best-distance-so-far for each histogram * cell (because the inner loop has to be over cells, not colormap entries). * The work array elements have to be INT32s, so the work array would need * 256Kb at our recommended precision. This is not feasible in DOS machines. * * To get around these problems, we apply Thomas' method to compute the * nearest colors for only the cells within a small subbox of the histogram. * The work array need be only as big as the subbox, so the memory usage * problem is solved. Furthermore, we need not fill subboxes that are never * referenced in pass2; many images use only part of the color gamut, so a * fair amount of work is saved. An additional advantage of this * approach is that we can apply Heckbert's locality criterion to quickly * eliminate colormap entries that are far away from the subbox; typically * three-fourths of the colormap entries are rejected by Heckbert's criterion, * and we need not compute their distances to individual cells in the subbox. * The speed of this approach is heavily influenced by the subbox size: too * small means too much overhead, too big loses because Heckbert's criterion * can't eliminate as many colormap entries. Empirically the best subbox * size seems to be about 1/512th of the histogram (1/8th in each direction). * * Thomas' article also describes a refined method which is asymptotically * faster than the brute-force method, but it is also far more complex and * cannot efficiently be applied to small subboxes. It is therefore not * useful for programs intended to be portable to DOS machines. On machines * with plenty of memory, filling the whole histogram in one shot with Thomas' * refined method might be faster than the present code --- but then again, * it might not be any faster, and it's certainly more complicated. */ /* log2(histogram cells in update box) for each axis; this can be adjusted */ /* * The next three routines implement inverse colormap filling. They could * all be folded into one big routine, but splitting them up this way saves * some stack space (the mindist[] and bestdist[] arrays need not coexist) * and may allow some compilers to produce better code by registerizing more * inner-loop variables. */ func _find_nearby_colors(tls *libc.TLS, cinfo Tj_decompress_ptr, minc0 int32, minc1 int32, minc2 int32, colorlist uintptr) (r int32) { /* Locate the colormap entries close enough to an update box to be candidates * for the nearest entry to some cell(s) in the update box. The update box * is specified by the center coordinates of its first cell. The number of * candidate colormap entries is returned, and their colormap indexes are * placed in colorlist[]. * This routine uses Heckbert's "locally sorted search" criterion to select * the colors that need further consideration. */ var centerc0, centerc1, centerc2, i, maxc0, maxc1, maxc2, ncolors, numcolors, x, v3 int32 var max_dist, min_dist, minmaxdist, tdist TINT32 var mindist [256]TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = centerc0, centerc1, centerc2, i, max_dist, maxc0, maxc1, maxc2, min_dist, mindist, minmaxdist, ncolors, numcolors, tdist, x, v3 numcolors = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Factual_number_of_colors /* min distance to colormap entry i */ /* Compute true coordinates of update box's upper corner and center. * Actually we compute the coordinates of the center of the upper-corner * histogram cell, which are the upper bounds of the volume we care about. * Note that since ">>" rounds down, the "center" values may be closer to * min than to max; hence comparisons to them must be "<=", not "<". */ maxc0 = minc0 + (libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS)+(libc.Int32FromInt32(HIST_C0_BITS)-libc.Int32FromInt32(3))) - libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS))) centerc0 = (minc0 + maxc0) >> int32(1) maxc1 = minc1 + (libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS)+(libc.Int32FromInt32(HIST_C1_BITS)-libc.Int32FromInt32(3))) - libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS))) centerc1 = (minc1 + maxc1) >> int32(1) maxc2 = minc2 + (libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS)+(libc.Int32FromInt32(HIST_C2_BITS)-libc.Int32FromInt32(3))) - libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS))) centerc2 = (minc2 + maxc2) >> int32(1) /* For each color in colormap, find: * 1. its minimum squared-distance to any point in the update box * (zero if color is within update box); * 2. its maximum squared-distance to any point in the update box. * Both of these can be found by considering only the corners of the box. * We save the minimum distance for each color in mindist[]; * only the smallest maximum distance is of interest. */ minmaxdist = int32(0x7FFFFFFF) i = 0 for { if !(i < numcolors) { break } /* We compute the squared-c0-distance term, then add in the other two. */ x = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap)) + uintptr(i)))) if x < minc0 { tdist = (x - minc0) * int32(R_SCALE) min_dist = tdist * tdist tdist = (x - maxc0) * int32(R_SCALE) max_dist = tdist * tdist } else { if x > maxc0 { tdist = (x - maxc0) * int32(R_SCALE) min_dist = tdist * tdist tdist = (x - minc0) * int32(R_SCALE) max_dist = tdist * tdist } else { /* within cell range so no contribution to min_dist */ min_dist = 0 if x <= centerc0 { tdist = (x - maxc0) * int32(R_SCALE) max_dist = tdist * tdist } else { tdist = (x - minc0) * int32(R_SCALE) max_dist = tdist * tdist } } } x = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap + 1*4)) + uintptr(i)))) if x < minc1 { tdist = (x - minc1) * int32(G_SCALE) min_dist += tdist * tdist tdist = (x - maxc1) * int32(G_SCALE) max_dist += tdist * tdist } else { if x > maxc1 { tdist = (x - maxc1) * int32(G_SCALE) min_dist += tdist * tdist tdist = (x - minc1) * int32(G_SCALE) max_dist += tdist * tdist } else { /* within cell range so no contribution to min_dist */ if x <= centerc1 { tdist = (x - maxc1) * int32(G_SCALE) max_dist += tdist * tdist } else { tdist = (x - minc1) * int32(G_SCALE) max_dist += tdist * tdist } } } x = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap + 2*4)) + uintptr(i)))) if x < minc2 { tdist = (x - minc2) * int32(B_SCALE) min_dist += tdist * tdist tdist = (x - maxc2) * int32(B_SCALE) max_dist += tdist * tdist } else { if x > maxc2 { tdist = (x - maxc2) * int32(B_SCALE) min_dist += tdist * tdist tdist = (x - minc2) * int32(B_SCALE) max_dist += tdist * tdist } else { /* within cell range so no contribution to min_dist */ if x <= centerc2 { tdist = (x - maxc2) * int32(B_SCALE) max_dist += tdist * tdist } else { tdist = (x - minc2) * int32(B_SCALE) max_dist += tdist * tdist } } } mindist[i] = min_dist /* save away the results */ if max_dist < minmaxdist { minmaxdist = max_dist } goto _1 _1: ; i++ } /* Now we know that no cell in the update box is more than minmaxdist * away from some colormap entry. Therefore, only colors that are * within minmaxdist of some part of the box need be considered. */ ncolors = 0 i = 0 for { if !(i < numcolors) { break } if mindist[i] <= minmaxdist { v3 = ncolors ncolors++ *(*TJSAMPLE)(unsafe.Pointer(colorlist + uintptr(v3))) = libc.Uint8FromInt32(i) } goto _2 _2: ; i++ } return ncolors } func _find_best_colors(tls *libc.TLS, cinfo Tj_decompress_ptr, minc0 int32, minc1 int32, minc2 int32, numcolors int32, colorlist uintptr, bestcolor uintptr) { bp := tls.Alloc(512) defer tls.Free(512) /* Find the closest colormap entry for each cell in the update box, * given the list of candidate colors prepared by find_nearby_colors. * Return the indexes of the closest entries in the bestcolor[] array. * This routine uses Thomas' incremental distance calculation method to * find the distance from a colormap entry to successive cells in the box. */ var bptr, cptr, v2 uintptr var dist0, dist1, dist2, inc0, inc1, inc2, xx0, xx1, xx2 TINT32 var i, ic0, ic1, ic2, icolor int32 var _ /* bestdist at bp+0 */ [128]TINT32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bptr, cptr, dist0, dist1, dist2, i, ic0, ic1, ic2, icolor, inc0, inc1, inc2, xx0, xx1, xx2, v2 /* Initialize best-distance for each cell of the update box */ bptr = bp i = libc.Int32FromInt32(1)<<(libc.Int32FromInt32(HIST_C0_BITS)-libc.Int32FromInt32(3))*(libc.Int32FromInt32(1)<<(libc.Int32FromInt32(HIST_C1_BITS)-libc.Int32FromInt32(3)))*(libc.Int32FromInt32(1)<<(libc.Int32FromInt32(HIST_C2_BITS)-libc.Int32FromInt32(3))) - libc.Int32FromInt32(1) for { if !(i >= 0) { break } v2 = bptr bptr += 4 *(*TINT32)(unsafe.Pointer(v2)) = int32(0x7FFFFFFF) goto _1 _1: ; i-- } /* For each color selected by find_nearby_colors, * compute its distance to the center of each cell in the box. * If that's less than best-so-far, update best distance and color number. */ /* Nominal steps between cell centers ("x" in Thomas article) */ i = 0 for { if !(i < numcolors) { break } icolor = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colorlist + uintptr(i)))) /* Compute (square of) distance from minc0/c1/c2 to this color */ inc0 = (minc0 - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap)) + uintptr(icolor))))) * int32(R_SCALE) dist0 = inc0 * inc0 inc1 = (minc1 - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap + 1*4)) + uintptr(icolor))))) * int32(G_SCALE) dist0 += inc1 * inc1 inc2 = (minc2 - libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(*(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap + 2*4)) + uintptr(icolor))))) * int32(B_SCALE) dist0 += inc2 * inc2 /* Form the initial difference increments */ inc0 = inc0*(libc.Int32FromInt32(2)*(libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS))*libc.Int32FromInt32(R_SCALE))) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS))*libc.Int32FromInt32(R_SCALE)*(libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS))*libc.Int32FromInt32(R_SCALE)) inc1 = inc1*(libc.Int32FromInt32(2)*(libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS))*libc.Int32FromInt32(G_SCALE))) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS))*libc.Int32FromInt32(G_SCALE)*(libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS))*libc.Int32FromInt32(G_SCALE)) inc2 = inc2*(libc.Int32FromInt32(2)*(libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS))*libc.Int32FromInt32(B_SCALE))) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS))*libc.Int32FromInt32(B_SCALE)*(libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS))*libc.Int32FromInt32(B_SCALE)) /* Now loop over all cells in box, updating distance per Thomas method */ bptr = bp cptr = bestcolor xx0 = inc0 ic0 = libc.Int32FromInt32(1)<<(libc.Int32FromInt32(HIST_C0_BITS)-libc.Int32FromInt32(3)) - libc.Int32FromInt32(1) for { if !(ic0 >= 0) { break } dist1 = dist0 xx1 = inc1 ic1 = libc.Int32FromInt32(1)<<(libc.Int32FromInt32(HIST_C1_BITS)-libc.Int32FromInt32(3)) - libc.Int32FromInt32(1) for { if !(ic1 >= 0) { break } dist2 = dist1 xx2 = inc2 ic2 = libc.Int32FromInt32(1)<<(libc.Int32FromInt32(HIST_C2_BITS)-libc.Int32FromInt32(3)) - libc.Int32FromInt32(1) for { if !(ic2 >= 0) { break } if dist2 < *(*TINT32)(unsafe.Pointer(bptr)) { *(*TINT32)(unsafe.Pointer(bptr)) = dist2 *(*TJSAMPLE)(unsafe.Pointer(cptr)) = libc.Uint8FromInt32(icolor) } dist2 += xx2 xx2 += libc.Int32FromInt32(2) * (libc.Int32FromInt32(1) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C2_BITS)) * libc.Int32FromInt32(B_SCALE)) * (libc.Int32FromInt32(1) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C2_BITS)) * libc.Int32FromInt32(B_SCALE)) bptr += 4 cptr++ goto _6 _6: ; ic2-- } dist1 += xx1 xx1 += libc.Int32FromInt32(2) * (libc.Int32FromInt32(1) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C1_BITS)) * libc.Int32FromInt32(G_SCALE)) * (libc.Int32FromInt32(1) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C1_BITS)) * libc.Int32FromInt32(G_SCALE)) goto _5 _5: ; ic1-- } dist0 += xx0 xx0 += libc.Int32FromInt32(2) * (libc.Int32FromInt32(1) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C0_BITS)) * libc.Int32FromInt32(R_SCALE)) * (libc.Int32FromInt32(1) << (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C0_BITS)) * libc.Int32FromInt32(R_SCALE)) goto _4 _4: ; ic0-- } goto _3 _3: ; i++ } } func _fill_inverse_cmap(tls *libc.TLS, cinfo Tj_decompress_ptr, c0 int32, c1 int32, c2 int32) { bp := tls.Alloc(384) defer tls.Free(384) /* Fill the inverse-colormap entries in the update box that contains */ /* histogram cell c0/c1/c2. (Only that one cell MUST be filled, but */ /* we can fill as many others as we wish.) */ var cachep, v4 Thistptr var cptr, v5 uintptr var cquantize Tmy_cquantize_ptr var histogram Thist3d var ic0, ic1, ic2, minc0, minc1, minc2, numcolors int32 var _ /* bestcolor at bp+256 */ [128]TJSAMPLE var _ /* colorlist at bp+0 */ [256]TJSAMPLE _, _, _, _, _, _, _, _, _, _, _, _, _ = cachep, cptr, cquantize, histogram, ic0, ic1, ic2, minc0, minc1, minc2, numcolors, v4, v5 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize histogram = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fhistogram /* Convert cell coordinates to update box ID */ c0 >>= libc.Int32FromInt32(HIST_C0_BITS) - libc.Int32FromInt32(3) c1 >>= libc.Int32FromInt32(HIST_C1_BITS) - libc.Int32FromInt32(3) c2 >>= libc.Int32FromInt32(HIST_C2_BITS) - libc.Int32FromInt32(3) /* Compute true coordinates of update box's origin corner. * Actually we compute the coordinates of the center of the corner * histogram cell, which are the lower bounds of the volume we care about. */ minc0 = c0<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS)+(libc.Int32FromInt32(HIST_C0_BITS)-libc.Int32FromInt32(3))) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS))>>libc.Int32FromInt32(1) minc1 = c1<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS)+(libc.Int32FromInt32(HIST_C1_BITS)-libc.Int32FromInt32(3))) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS))>>libc.Int32FromInt32(1) minc2 = c2<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS)+(libc.Int32FromInt32(HIST_C2_BITS)-libc.Int32FromInt32(3))) + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS))>>libc.Int32FromInt32(1) /* Determine which colormap entries are close enough to be candidates * for the nearest entry to some cell in the update box. */ numcolors = _find_nearby_colors(tls, cinfo, minc0, minc1, minc2, bp) /* Determine the actually nearest colors. */ _find_best_colors(tls, cinfo, minc0, minc1, minc2, numcolors, bp, bp+256) /* Save the best color numbers (plus 1) in the main cache array */ c0 <<= libc.Int32FromInt32(HIST_C0_BITS) - libc.Int32FromInt32(3) /* convert ID back to base cell indexes */ c1 <<= libc.Int32FromInt32(HIST_C1_BITS) - libc.Int32FromInt32(3) c2 <<= libc.Int32FromInt32(HIST_C2_BITS) - libc.Int32FromInt32(3) cptr = bp + 256 ic0 = 0 for { if !(ic0 < libc.Int32FromInt32(1)<<(libc.Int32FromInt32(HIST_C0_BITS)-libc.Int32FromInt32(3))) { break } ic1 = 0 for { if !(ic1 < libc.Int32FromInt32(1)<<(libc.Int32FromInt32(HIST_C1_BITS)-libc.Int32FromInt32(3))) { break } cachep = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(c0+ic0)*4)) + uintptr(c1+ic1)*64 + uintptr(c2)*2 ic2 = 0 for { if !(ic2 < libc.Int32FromInt32(1)<<(libc.Int32FromInt32(HIST_C2_BITS)-libc.Int32FromInt32(3))) { break } v4 = cachep cachep += 2 v5 = cptr cptr++ *(*Thistcell)(unsafe.Pointer(v4)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v5))) + libc.Int32FromInt32(1)) goto _3 _3: ; ic2++ } goto _2 _2: ; ic1++ } goto _1 _1: ; ic0++ } } /* * Map some rows of pixels to the output colormapped representation. */ func _pass2_no_dither(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPARRAY, num_rows int32) { /* This version performs no dithering */ var c0, c1, c2, row int32 var cachep Thistptr var col, width TJDIMENSION var cquantize Tmy_cquantize_ptr var histogram Thist3d var inptr, outptr, v3, v4, v5, v6 TJSAMPROW _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c0, c1, c2, cachep, col, cquantize, histogram, inptr, outptr, row, width, v3, v4, v5, v6 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize histogram = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fhistogram width = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width row = 0 for { if !(row < num_rows) { break } inptr = *(*TJSAMPROW)(unsafe.Pointer(input_buf + uintptr(row)*4)) outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(row)*4)) col = width for { if !(col > uint32(0)) { break } /* get pixel value and index into the cache */ v3 = inptr inptr++ c0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v3))) >> (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C0_BITS)) v4 = inptr inptr++ c1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v4))) >> (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C1_BITS)) v5 = inptr inptr++ c2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(v5))) >> (libc.Int32FromInt32(BITS_IN_JSAMPLE) - libc.Int32FromInt32(HIST_C2_BITS)) cachep = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(c0)*4)) + uintptr(c1)*64 + uintptr(c2)*2 /* If we have not seen this color before, find nearest colormap entry */ /* and update the cache */ if libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(cachep))) == 0 { _fill_inverse_cmap(tls, cinfo, c0, c1, c2) } /* Now emit the colormap index for this cell */ v6 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(cachep))) - libc.Int32FromInt32(1)) goto _2 _2: ; col-- } goto _1 _1: ; row++ } } func _pass2_fs_dither(tls *libc.TLS, cinfo Tj_decompress_ptr, input_buf TJSAMPARRAY, output_buf TJSAMPARRAY, num_rows int32) { /* This version performs Floyd-Steinberg dithering */ var belowerr0, belowerr1, belowerr2, bnexterr, bpreverr0, bpreverr1, bpreverr2, cur0, cur1, cur2, delta, v2, v3, v4, v5, v6, v7 TLOCFSERROR var cachep Thistptr var col, width TJDIMENSION var colormap0, colormap1, colormap2, inptr, outptr TJSAMPROW var cquantize Tmy_cquantize_ptr var dir, dir3, pixcode, row int32 var error_limit, range_limit uintptr var errorptr TFSERRPTR var histogram Thist3d _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = belowerr0, belowerr1, belowerr2, bnexterr, bpreverr0, bpreverr1, bpreverr2, cachep, col, colormap0, colormap1, colormap2, cquantize, cur0, cur1, cur2, delta, dir, dir3, error_limit, errorptr, histogram, inptr, outptr, pixcode, range_limit, row, width, v2, v3, v4, v5, v6, v7 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize histogram = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fhistogram width = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width range_limit = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fsample_range_limit error_limit = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Ferror_limiter colormap0 = *(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap)) colormap1 = *(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap + 1*4)) colormap2 = *(*TJSAMPROW)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap + 2*4)) row = 0 for { if !(row < num_rows) { break } inptr = *(*TJSAMPROW)(unsafe.Pointer(input_buf + uintptr(row)*4)) outptr = *(*TJSAMPROW)(unsafe.Pointer(output_buf + uintptr(row)*4)) if (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fon_odd_row != 0 { /* work right to left in this row */ inptr += uintptr((width - uint32(1)) * uint32(3)) /* so point to rightmost pixel */ outptr += uintptr(width - uint32(1)) dir = -int32(1) dir3 = -int32(3) errorptr = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Ffserrors + uintptr((width+uint32(1))*uint32(3))*2 /* => entry after last column */ (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fon_odd_row = int32(FALSE1) /* flip for next time */ } else { /* work left to right in this row */ dir = int32(1) dir3 = int32(3) errorptr = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Ffserrors /* => entry before first real column */ (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fon_odd_row = int32(TRUE1) /* flip for next time */ } /* Preset error values: no error propagated to first pixel from left */ v3 = libc.Int32FromInt32(0) cur2 = v3 v2 = v3 cur1 = v2 cur0 = v2 /* and no error propagated to row below yet */ v5 = libc.Int32FromInt32(0) belowerr2 = v5 v4 = v5 belowerr1 = v4 belowerr0 = v4 v7 = libc.Int32FromInt32(0) bpreverr2 = v7 v6 = v7 bpreverr1 = v6 bpreverr0 = v6 col = width for { if !(col > uint32(0)) { break } /* curN holds the error propagated from the previous pixel on the * current line. Add the error propagated from the previous line * to form the complete error correction term for this pixel, and * round the error term (which is expressed * 16) to an integer. * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct * for either sign of the error value. * Note: errorptr points to *previous* column's array entry. */ cur0 = (cur0 + int32(*(*TFSERROR)(unsafe.Pointer(errorptr + uintptr(dir3+0)*2))) + libc.Int32FromInt32(8)) >> libc.Int32FromInt32(4) cur1 = (cur1 + int32(*(*TFSERROR)(unsafe.Pointer(errorptr + uintptr(dir3+int32(1))*2))) + libc.Int32FromInt32(8)) >> libc.Int32FromInt32(4) cur2 = (cur2 + int32(*(*TFSERROR)(unsafe.Pointer(errorptr + uintptr(dir3+int32(2))*2))) + libc.Int32FromInt32(8)) >> libc.Int32FromInt32(4) /* Limit the error using transfer function set by init_error_limit. * See comments with init_error_limit for rationale. */ cur0 = *(*int32)(unsafe.Pointer(error_limit + uintptr(cur0)*4)) cur1 = *(*int32)(unsafe.Pointer(error_limit + uintptr(cur1)*4)) cur2 = *(*int32)(unsafe.Pointer(error_limit + uintptr(cur2)*4)) /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. * The maximum error is +- MAXJSAMPLE (or less with error limiting); * this sets the required size of the range_limit array. */ cur0 += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr))) cur1 += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 1))) cur2 += libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(inptr + 2))) cur0 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(cur0)))) cur1 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(cur1)))) cur2 = libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(range_limit + uintptr(cur2)))) /* Index into the cache with adjusted pixel value */ cachep = *(*Thist2d)(unsafe.Pointer(histogram + uintptr(cur0>>(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS)))*4)) + uintptr(cur1>>(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS)))*64 + uintptr(cur2>>(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS)))*2 /* If we have not seen this color before, find nearest colormap */ /* entry and update the cache */ if libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(cachep))) == 0 { _fill_inverse_cmap(tls, cinfo, cur0>>(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C0_BITS)), cur1>>(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C1_BITS)), cur2>>(libc.Int32FromInt32(BITS_IN_JSAMPLE)-libc.Int32FromInt32(HIST_C2_BITS))) } /* Now emit the colormap index for this cell */ pixcode = libc.Int32FromUint16(*(*Thistcell)(unsafe.Pointer(cachep))) - int32(1) *(*TJSAMPLE)(unsafe.Pointer(outptr)) = libc.Uint8FromInt32(pixcode) /* Compute representation error for this pixel */ cur0 -= libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colormap0 + uintptr(pixcode)))) cur1 -= libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colormap1 + uintptr(pixcode)))) cur2 -= libc.Int32FromUint8(*(*TJSAMPLE)(unsafe.Pointer(colormap2 + uintptr(pixcode)))) /* Compute error fractions to be propagated to adjacent pixels. * Add these into the running sums, and simultaneously shift the * next-line error sums left by 1 column. */ bnexterr = cur0 /* Process component 0 */ delta = cur0 * int32(2) cur0 += delta /* form error * 3 */ *(*TFSERROR)(unsafe.Pointer(errorptr)) = int16(bpreverr0 + cur0) cur0 += delta /* form error * 5 */ bpreverr0 = belowerr0 + cur0 belowerr0 = bnexterr cur0 += delta /* form error * 7 */ bnexterr = cur1 /* Process component 1 */ delta = cur1 * int32(2) cur1 += delta /* form error * 3 */ *(*TFSERROR)(unsafe.Pointer(errorptr + 1*2)) = int16(bpreverr1 + cur1) cur1 += delta /* form error * 5 */ bpreverr1 = belowerr1 + cur1 belowerr1 = bnexterr cur1 += delta /* form error * 7 */ bnexterr = cur2 /* Process component 2 */ delta = cur2 * int32(2) cur2 += delta /* form error * 3 */ *(*TFSERROR)(unsafe.Pointer(errorptr + 2*2)) = int16(bpreverr2 + cur2) cur2 += delta /* form error * 5 */ bpreverr2 = belowerr2 + cur2 belowerr2 = bnexterr cur2 += delta /* form error * 7 */ /* At this point curN contains the 7/16 error value to be propagated * to the next pixel on the current line, and all the errors for the * next line have been shifted over. We are therefore ready to move on. */ inptr += uintptr(dir3) /* Advance pixel pointers to next column */ outptr += uintptr(dir) errorptr += uintptr(dir3) * 2 /* advance errorptr to current column */ goto _8 _8: ; col-- } /* Post-loop cleanup: we must unload the final error values into the * final fserrors[] entry. Note we need not unload belowerrN because * it is for the dummy column before or after the actual array. */ *(*TFSERROR)(unsafe.Pointer(errorptr)) = int16(bpreverr0) /* unload prev errs into array */ *(*TFSERROR)(unsafe.Pointer(errorptr + 1*2)) = int16(bpreverr1) *(*TFSERROR)(unsafe.Pointer(errorptr + 2*2)) = int16(bpreverr2) goto _1 _1: ; row++ } } /* * Initialize the error-limiting transfer function (lookup table). * The raw F-S error computation can potentially compute error values of up to * +- MAXJSAMPLE. But we want the maximum correction applied to a pixel to be * much less, otherwise obviously wrong pixels will be created. (Typical * effects include weird fringes at color-area boundaries, isolated bright * pixels in a dark area, etc.) The standard advice for avoiding this problem * is to ensure that the "corners" of the color cube are allocated as output * colors; then repeated errors in the same direction cannot cause cascading * error buildup. However, that only prevents the error from getting * completely out of hand; Aaron Giles reports that error limiting improves * the results even with corner colors allocated. * A simple clamping of the error values to about +- MAXJSAMPLE/8 works pretty * well, but the smoother transfer function used below is even better. Thanks * to Aaron Giles for this idea. */ func _init_error_limit(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* Allocate and fill in the error_limiter table */ var cquantize Tmy_cquantize_ptr var in, out, v3 int32 var table uintptr _, _, _, _, _ = cquantize, in, out, table, v3 cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize table = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_small})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(libc.Int32FromInt32(MAXJSAMPLE)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*libc.Uint32FromInt64(4)) table += uintptr(MAXJSAMPLE) * 4 /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */ (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Ferror_limiter = table /* Map errors 1:1 up to +- MAXJSAMPLE/16 */ out = 0 in = 0 for { if !(in < (libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))/libc.Int32FromInt32(16)) { break } *(*int32)(unsafe.Pointer(table + uintptr(in)*4)) = out *(*int32)(unsafe.Pointer(table + uintptr(-in)*4)) = -out goto _1 _1: ; in++ out++ } /* Map errors 1:2 up to +- 3*MAXJSAMPLE/16 */ for { if !(in < (libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1))/libc.Int32FromInt32(16)*libc.Int32FromInt32(3)) { break } *(*int32)(unsafe.Pointer(table + uintptr(in)*4)) = out *(*int32)(unsafe.Pointer(table + uintptr(-in)*4)) = -out goto _2 _2: ; in++ if in&int32(1) != 0 { v3 = 0 } else { v3 = int32(1) } out += v3 } /* Clamp the rest to final out value (which is (MAXJSAMPLE+1)/8) */ for { if !(in <= int32(MAXJSAMPLE)) { break } *(*int32)(unsafe.Pointer(table + uintptr(in)*4)) = out *(*int32)(unsafe.Pointer(table + uintptr(-in)*4)) = -out goto _4 _4: ; in++ } } /* * Finish up at the end of each pass. */ func _finish_pass11(tls *libc.TLS, cinfo Tj_decompress_ptr) { var cquantize Tmy_cquantize_ptr _ = cquantize cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize /* Select the representative colors and fill in cinfo->colormap */ (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcolormap = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fsv_colormap _select_colors(tls, cinfo, (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fdesired) /* Force next pass to zero the color index table */ (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fneeds_zeroed = int32(TRUE1) } func _finish_pass2(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* no work */ } /* * Initialize for each processing pass. */ func _start_pass_2_quant(tls *libc.TLS, cinfo Tj_decompress_ptr, is_pre_scan Tboolean) { var arraysize Tsize_t var cquantize Tmy_cquantize_ptr var histogram Thist3d var i int32 _, _, _, _ = arraysize, cquantize, histogram, i cquantize = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fcquantize histogram = (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fhistogram /* Only F-S dithering or no dithering is supported. */ /* If user asks for ordered dither, give him F-S. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode != int32(JDITHER_NONE) { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode = int32(JDITHER_FS) } if is_pre_scan != 0 { /* Set up method pointers */ (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fpub.Fcolor_quantize = __ccgo_fp(_prescan_quantize) (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fpub.Ffinish_pass = __ccgo_fp(_finish_pass11) (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fneeds_zeroed = int32(TRUE1) /* Always zero histogram */ } else { /* Set up method pointers */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode == int32(JDITHER_FS) { (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fpub.Fcolor_quantize = __ccgo_fp(_pass2_fs_dither) } else { (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fpub.Fcolor_quantize = __ccgo_fp(_pass2_no_dither) } (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fpub.Ffinish_pass = __ccgo_fp(_finish_pass2) /* Make sure color count is acceptable */ i = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Factual_number_of_colors if i < int32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_QUANT_FEW_COLORS) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = int32(1) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if i > libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_QUANT_MANY_COLORS) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromInt32(MAXJSAMPLE) + libc.Int32FromInt32(1) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode == int32(JDITHER_FS) { arraysize = ((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width + libc.Uint32FromInt32(2)) * (libc.Uint32FromInt32(3) * libc.Uint32FromInt64(2)) /* Allocate Floyd-Steinberg workspace if we didn't already. */ if (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Ffserrors == libc.UintptrFromInt32(0) { (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Ffserrors = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_large})))(tls, cinfo, int32(JPOOL_IMAGE), arraysize) } /* Initialize the propagated errors to zero. */ libc.Xmemset(tls, (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Ffserrors, 0, arraysize) /* Make the error-limit table if we didn't already. */ if (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Ferror_limiter == libc.UintptrFromInt32(0) { _init_error_limit(tls, cinfo) } (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fon_odd_row = int32(FALSE1) } } /* Zero the histogram or inverse color map, if necessary */ if (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fneeds_zeroed != 0 { i = 0 for { if !(i < libc.Int32FromInt32(1)< 0 */ if desired < int32(8) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_QUANT_FEW_COLORS) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = int32(8) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } /* Make sure colormap indexes can be represented by JSAMPLEs */ if desired > libc.Int32FromInt32(MAXJSAMPLE)+libc.Int32FromInt32(1) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_QUANT_MANY_COLORS) *(*int32)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = libc.Int32FromInt32(MAXJSAMPLE) + libc.Int32FromInt32(1) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fsv_colormap = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_sarray})))(tls, cinfo, int32(JPOOL_IMAGE), libc.Uint32FromInt32(desired), libc.Uint32FromInt32(3)) (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fdesired = desired } else { (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Fsv_colormap = libc.UintptrFromInt32(0) } /* Only F-S dithering or no dithering is supported. */ /* If user asks for ordered dither, give him F-S. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode != int32(JDITHER_NONE) { (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode = int32(JDITHER_FS) } /* Allocate Floyd-Steinberg workspace if necessary. * This isn't really needed until pass 2, but again it is FAR storage. * Although we will cope with a later change in dither_mode, * we do not promise to honor max_memory_to_use if dither_mode changes. */ if (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fdither_mode == int32(JDITHER_FS) { (*Tmy_cquantizer1)(unsafe.Pointer(cquantize)).Ffserrors = (*(*func(*libc.TLS, Tj_common_ptr, int32, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Fmem)).Falloc_large})))(tls, cinfo, int32(JPOOL_IMAGE), ((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Foutput_width+libc.Uint32FromInt32(2))*(libc.Uint32FromInt32(3)*libc.Uint32FromInt64(2))) /* Might as well create the error-limiting table too. */ _init_error_limit(tls, cinfo) } } /* * Arithmetic utilities */ func Xjdiv_round_up(tls *libc.TLS, a int32, b int32) (r int32) { /* Compute a/b rounded up to next integer, ie, ceil(a/b) */ /* Assumes a >= 0, b > 0 */ return (a + b - int32(1)) / b } func Xjround_up(tls *libc.TLS, a int32, b int32) (r int32) { /* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */ /* Assumes a >= 0, b > 0 */ a += b - int32(1) return a - a%b } /* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays * and coefficient-block arrays. This won't work on 80x86 because the arrays * are FAR and we're assuming a small-pointer memory model. However, some * DOS compilers provide far-pointer versions of memcpy() and memset() even * in the small-model libraries. These will be used if USE_FMEM is defined. * Otherwise, the routines below do it the hard way. (The performance cost * is not all that great, because these routines aren't very heavily used.) */ func Xjcopy_sample_rows(tls *libc.TLS, input_array TJSAMPARRAY, output_array TJSAMPARRAY, num_rows int32, num_cols TJDIMENSION) { /* Copy some rows of samples from one place to another. * num_rows rows are copied from *input_array++ to *output_array++; * these areas may overlap for duplication. * The source and destination arrays must be at least as wide as num_cols. */ var count Tsize_t var inptr, outptr TJSAMPROW var row int32 var v2, v3 TJSAMPARRAY _, _, _, _, _, _ = count, inptr, outptr, row, v2, v3 count = num_cols * libc.Uint32FromInt64(1) row = num_rows for { if !(row > 0) { break } v2 = input_array input_array += 4 inptr = *(*TJSAMPROW)(unsafe.Pointer(v2)) v3 = output_array output_array += 4 outptr = *(*TJSAMPROW)(unsafe.Pointer(v3)) libc.Xmemcpy(tls, outptr, inptr, count) goto _1 _1: ; row-- } } func Xjcopy_block_row(tls *libc.TLS, input_row TJBLOCKROW, output_row TJBLOCKROW, num_blocks TJDIMENSION) { /* Copy a row of coefficient blocks from one place to another. */ libc.Xmemcpy(tls, output_row, input_row, num_blocks*(libc.Uint32FromInt32(DCTSIZE2)*libc.Uint32FromInt64(2))) } const ARG_MAX = 131072 const BC_BASE_MAX = 99 const BC_DIM_MAX = 2048 const BC_SCALE_MAX = 99 const BC_STRING_MAX = 1000 const CHARCLASS_NAME_MAX = 14 const CHAR_BIT = 8 const CHAR_MAX = 255 const CHAR_MIN = 0 const COLL_WEIGHTS_MAX = 2 const DBL_MAX1 = 1.79769313486231570815e+308 const DELAYTIMER_MAX = 0x7fffffff const EXPR_NEST_MAX = 32 const FILESIZEBITS = 64 const HOST_NAME_MAX = 255 const INT_MAX = 0x7fffffff const IOV_MAX = 1024 const LINE_MAX = 4096 const LLONG_MAX = 0x7fffffffffffffff const LOGIN_NAME_MAX = 256 const LONG_BIT = 32 const LONG_MAX = "__LONG_MAX" const MAX_MEM_LEVEL = 9 const MAX_WBITS = 15 const MB_LEN_MAX = 4 const MQ_PRIO_MAX = 32768 const NAME_MAX = 255 const NGROUPS_MAX = 32 const NL_ARGMAX = 9 const NL_LANGMAX = 32 const NL_MSGMAX = 32767 const NL_NMAX = 16 const NL_SETMAX = 255 const NL_TEXTMAX = 2048 const NZERO = 20 const PACKAGE_NAME8 = "pngtcl" const PACKAGE_STRING8 = "pngtcl 1.6.44" const PACKAGE_TARNAME8 = "pngtcl" const PACKAGE_VERSION2 = "1.6.44" const PATH_MAX = 4096 const PIPE_BUF = 4096 const PNGAPI = "PNGCAPI" const PNGCBAPI = "PNGCAPI" const PNGFAPI = "PNGAPI" const PNG_16_TO_8 = 0x0400 const PNG_ADD_ALPHA = 0x1000000 const PNG_AFTER_IDAT = 0x08 const PNG_ALIGN_ALWAYS = 1 const PNG_ALIGN_NONE = 0 const PNG_ALIGN_OFFSET = 2 const PNG_ALIGN_SIZE = 3 const PNG_ALIGN_TYPE = "PNG_ALIGN_SIZE" const PNG_ALL_MNG_FEATURES = 0x05 const PNG_ALPHA_ASSOCIATED = 1 const PNG_ALPHA_BROKEN = 3 const PNG_ALPHA_OPTIMIZED = 2 const PNG_ALPHA_PNG = 0 const PNG_ALPHA_PREMULTIPLIED = 1 const PNG_ALPHA_STANDARD = 1 const PNG_API_RULE = 0 const PNG_ARM_NEON_IMPLEMENTATION = 0 const PNG_ARM_NEON_OPT = 0 const PNG_BACKGROUND_EXPAND = 0x0100 const PNG_BACKGROUND_GAMMA_FILE = 2 const PNG_BACKGROUND_GAMMA_SCREEN = 1 const PNG_BACKGROUND_GAMMA_UNIQUE = 3 const PNG_BACKGROUND_GAMMA_UNKNOWN = 0 const PNG_BACKGROUND_IS_GRAY = 0x800 const PNG_BGR = 0x0001 const PNG_CHUNK_ERROR = 2 const PNG_CHUNK_WARNING = 0 const PNG_CHUNK_WRITE_ERROR = 1 const PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB = 0x0040 const PNG_COLORSPACE_FROM_cHRM = 0x0010 const PNG_COLORSPACE_FROM_gAMA = 0x0008 const PNG_COLORSPACE_FROM_sRGB = 0x0020 const PNG_COLORSPACE_HAVE_ENDPOINTS = 0x0002 const PNG_COLORSPACE_HAVE_GAMMA = 0x0001 const PNG_COLORSPACE_HAVE_INTENT = 0x0004 const PNG_COLORSPACE_INVALID = 0x8000 const PNG_COLORSPACE_MATCHES_sRGB = 0x0080 const PNG_COLOR_MASK_ALPHA = 4 const PNG_COLOR_MASK_COLOR = 2 const PNG_COLOR_MASK_PALETTE = 1 const PNG_COLOR_TYPE_GA = "PNG_COLOR_TYPE_GRAY_ALPHA" const PNG_COLOR_TYPE_GRAY = 0 const PNG_COLOR_TYPE_GRAY_ALPHA = "PNG_COLOR_MASK_ALPHA" const PNG_COLOR_TYPE_RGB = "PNG_COLOR_MASK_COLOR" const PNG_COLOR_TYPE_RGBA = "PNG_COLOR_TYPE_RGB_ALPHA" const PNG_COMPOSE = 0x0080 const PNG_COMPRESSION_TYPE_BASE = 0 const PNG_COMPRESSION_TYPE_DEFAULT = "PNG_COMPRESSION_TYPE_BASE" const PNG_CONST = "const" const PNG_CRC_DEFAULT = 0 const PNG_CRC_ERROR_QUIT = 1 const PNG_CRC_NO_CHANGE = 5 const PNG_CRC_QUIET_USE = 4 const PNG_CRC_WARN_DISCARD = 2 const PNG_CRC_WARN_USE = 3 const PNG_DEFAULT_READ_MACROS = 1 const PNG_DESTROY_WILL_FREE_DATA = 1 const PNG_ENCODE_ALPHA = 0x800000 const PNG_EQUATION_ARBITRARY = 2 const PNG_EQUATION_BASE_E = 1 const PNG_EQUATION_HYPERBOLIC = 3 const PNG_EQUATION_LAST = 4 const PNG_EQUATION_LINEAR = 0 const PNG_ERROR_ACTION_ERROR = 3 const PNG_ERROR_ACTION_NONE = 1 const PNG_ERROR_ACTION_WARN = 2 const PNG_EXPAND = 0x1000 const PNG_EXPAND_16 = 0x0200 const PNG_EXPAND_tRNS = 0x2000000 const PNG_EXTERN = "MODULE_SCOPE" const PNG_FILLER = 0x8000 const PNG_FILLER_AFTER = 1 const PNG_FILLER_BEFORE = 0 const PNG_FILTER_AVG = 0x40 const PNG_FILTER_HEURISTIC_DEFAULT = 0 const PNG_FILTER_HEURISTIC_LAST = 3 const PNG_FILTER_HEURISTIC_UNWEIGHTED = 1 const PNG_FILTER_HEURISTIC_WEIGHTED = 2 const PNG_FILTER_NONE = 0x08 const PNG_FILTER_PAETH = 0x80 const PNG_FILTER_SUB = 0x10 const PNG_FILTER_TYPE_BASE = 0 const PNG_FILTER_TYPE_DEFAULT = "PNG_FILTER_TYPE_BASE" const PNG_FILTER_UP = 0x20 const PNG_FILTER_VALUE_AVG = 3 const PNG_FILTER_VALUE_LAST = 5 const PNG_FILTER_VALUE_NONE = 0 const PNG_FILTER_VALUE_PAETH = 4 const PNG_FILTER_VALUE_SUB = 1 const PNG_FILTER_VALUE_UP = 2 const PNG_FLAG_APP_ERRORS_WARN = 0x400000 const PNG_FLAG_APP_WARNINGS_WARN = 0x200000 const PNG_FLAG_ASSUME_sRGB = 0x1000 const PNG_FLAG_BENIGN_ERRORS_WARN = 0x100000 const PNG_FLAG_CRC_ANCILLARY_NOWARN = 0x0200 const PNG_FLAG_CRC_ANCILLARY_USE = 0x0100 const PNG_FLAG_CRC_CRITICAL_IGNORE = 0x0800 const PNG_FLAG_CRC_CRITICAL_USE = 0x0400 const PNG_FLAG_DETECT_UNINITIALIZED = 0x4000 const PNG_FLAG_FILLER_AFTER = 0x0080 const PNG_FLAG_LIBRARY_MISMATCH = 0x20000 const PNG_FLAG_MNG_EMPTY_PLTE = 0x01 const PNG_FLAG_MNG_FILTER_64 = 0x04 const PNG_FLAG_OPTIMIZE_ALPHA = 0x2000 const PNG_FLAG_ROW_INIT = 0x0040 const PNG_FLAG_STRIP_ERROR_NUMBERS = 0x40000 const PNG_FLAG_STRIP_ERROR_TEXT = 0x80000 const PNG_FLAG_ZLIB_CUSTOM_STRATEGY = 0x0001 const PNG_FLAG_ZSTREAM_ENDED = 0x0008 const PNG_FLAG_ZSTREAM_INITIALIZED = 0x0002 const PNG_FORMAT_FLAG_AFIRST = 0x20 const PNG_FORMAT_FLAG_ALPHA = 0x01 const PNG_FORMAT_FLAG_ASSOCIATED_ALPHA = 0x40 const PNG_FORMAT_FLAG_BGR = 0x10 const PNG_FORMAT_FLAG_COLOR = 0x02 const PNG_FORMAT_FLAG_COLORMAP = 0x08 const PNG_FORMAT_FLAG_LINEAR = 0x04 const PNG_FORMAT_GA = "PNG_FORMAT_FLAG_ALPHA" const PNG_FORMAT_GRAY = 0 const PNG_FORMAT_LINEAR_Y = "PNG_FORMAT_FLAG_LINEAR" const PNG_FORMAT_RGB = "PNG_FORMAT_FLAG_COLOR" const PNG_FP_1 = 100000 const PNG_FP_EXPONENT = 2 const PNG_FP_FRACTION = 1 const PNG_FP_HALF = 50000 const PNG_FP_INTEGER = 0 const PNG_FP_INVALID = 512 const PNG_FP_MAYBE = 0 const PNG_FP_NEGATIVE = 128 const PNG_FP_NONZERO = 256 const PNG_FP_OK = 1 const PNG_FP_SAW_ANY = 60 const PNG_FP_SAW_DIGIT = 8 const PNG_FP_SAW_DOT = 16 const PNG_FP_SAW_E = 32 const PNG_FP_SAW_SIGN = 4 const PNG_FP_STATE = 3 const PNG_FP_STICKY = 448 const PNG_FP_WAS_VALID = 64 const PNG_FREE_ALL = 0xffff const PNG_FREE_EXIF = 0x8000 const PNG_FREE_HIST = 0x0008 const PNG_FREE_ICCP = 0x0010 const PNG_FREE_MUL = 0x4220 const PNG_FREE_PCAL = 0x0080 const PNG_FREE_PLTE = 0x1000 const PNG_FREE_ROWS = 0x0040 const PNG_FREE_SCAL = 0x0100 const PNG_FREE_SPLT = 0x0020 const PNG_FREE_TEXT = 0x4000 const PNG_FREE_TRNS = 0x2000 const PNG_FREE_UNKN = 0x0200 const PNG_GAMMA = 0x2000 const PNG_GAMMA_LINEAR = "PNG_FP_1" const PNG_GAMMA_MAC_INVERSE = 65909 const PNG_GAMMA_MAC_OLD = 151724 const PNG_GAMMA_THRESHOLD_FIXED = 5000 const PNG_GAMMA_sRGB = 220000 const PNG_GAMMA_sRGB_INVERSE = 45455 const PNG_GRAY_TO_RGB = 0x4000 const PNG_HANDLE_CHUNK_ALWAYS = 3 const PNG_HANDLE_CHUNK_AS_DEFAULT = 0 const PNG_HANDLE_CHUNK_IF_SAFE = 2 const PNG_HANDLE_CHUNK_LAST = 4 const PNG_HANDLE_CHUNK_NEVER = 1 const PNG_HAVE_CHUNK_AFTER_IDAT = 0x2000 const PNG_HAVE_CHUNK_HEADER = 0x100 const PNG_HAVE_IDAT = 0x04 const PNG_HAVE_IEND = 0x10 const PNG_HAVE_IHDR = 0x01 const PNG_HAVE_PLTE = 0x02 const PNG_HAVE_PNG_SIGNATURE = 0x1000 const PNG_IDAT_READ_SIZE = "PNG_ZBUF_SIZE" const PNG_IMAGE_ERROR = 2 const PNG_IMAGE_FLAG_16BIT_sRGB = 0x04 const PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB = 0x01 const PNG_IMAGE_FLAG_FAST = 0x02 const PNG_IMAGE_VERSION = 1 const PNG_IMAGE_WARNING = 1 const PNG_IMPEXP = "MODULE_SCOPE" const PNG_INFLATE_BUF_SIZE = 1024 const PNG_INFO_IDAT = 0x8000 const PNG_INFO_PLTE = 0x0008 const PNG_INFO_bKGD = 0x0020 const PNG_INFO_cHRM = 0x0004 const PNG_INFO_eXIf = 0x10000 const PNG_INFO_gAMA = 0x0001 const PNG_INFO_hIST = 0x0040 const PNG_INFO_iCCP = 0x1000 const PNG_INFO_oFFs = 0x0100 const PNG_INFO_pCAL = 0x0400 const PNG_INFO_pHYs = 0x0080 const PNG_INFO_sBIT = 0x0002 const PNG_INFO_sCAL = 0x4000 const PNG_INFO_sPLT = 0x2000 const PNG_INFO_sRGB = 0x0800 const PNG_INFO_tIME = 0x0200 const PNG_INFO_tRNS = 0x0010 const PNG_INTEL_SSE_IMPLEMENTATION = 0 const PNG_INTEL_SSE_OPT = 0 const PNG_INTERLACE = 0x0002 const PNG_INTERLACE_ADAM7 = 1 const PNG_INTERLACE_ADAM7_PASSES = 7 const PNG_INTERLACE_LAST = 2 const PNG_INTERLACE_NONE = 0 const PNG_INTRAPIXEL_DIFFERENCING = 64 const PNG_INVERT_ALPHA = 0x80000 const PNG_INVERT_MONO = 0x0020 const PNG_IO_CHUNK_CRC = 0x0080 const PNG_IO_CHUNK_DATA = 0x0040 const PNG_IO_CHUNK_HDR = 0x0020 const PNG_IO_MASK_LOC = 0x00f0 const PNG_IO_MASK_OP = 0x000f const PNG_IO_NONE = 0x0000 const PNG_IO_READING = 0x0001 const PNG_IO_SIGNATURE = 0x0010 const PNG_IO_WRITING = 0x0002 const PNG_IS_READ_STRUCT = 0x8000 const PNG_ITXT_COMPRESSION_NONE = 1 const PNG_ITXT_COMPRESSION_zTXt = 2 const PNG_KEYWORD_MAX_LENGTH = 79 const PNG_LIBPNG_BUILD_ALPHA = 1 const PNG_LIBPNG_BUILD_BASE_TYPE = "PNG_LIBPNG_BUILD_STABLE" const PNG_LIBPNG_BUILD_BETA = 2 const PNG_LIBPNG_BUILD_PATCH = 8 const PNG_LIBPNG_BUILD_PRIVATE = 16 const PNG_LIBPNG_BUILD_RC = 3 const PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK = 7 const PNG_LIBPNG_BUILD_SPECIAL = 32 const PNG_LIBPNG_BUILD_STABLE = 4 const PNG_LIBPNG_BUILD_TYPE = "PNG_LIBPNG_BUILD_BASE_TYPE" const PNG_LIBPNG_VER = 10644 const PNG_LIBPNG_VER_BUILD = 0 const PNG_LIBPNG_VER_DLLNUM = "PNG_LIBPNG_VER_SHAREDLIB" const PNG_LIBPNG_VER_MAJOR = 1 const PNG_LIBPNG_VER_MINOR = 6 const PNG_LIBPNG_VER_RELEASE = 44 const PNG_LIBPNG_VER_SHAREDLIB = 16 const PNG_LIBPNG_VER_SONUM = "PNG_LIBPNG_VER_SHAREDLIB" const PNG_LIBPNG_VER_STRING = "1.6.44" const PNG_LINKAGE_DATA = "extern" const PNG_LITERAL_LEFT_SQUARE_BRACKET = 0x5b const PNG_LITERAL_RIGHT_SQUARE_BRACKET = 0x5d const PNG_LITERAL_SHARP = 0x23 const PNG_LOONGARCH_LSX_IMPLEMENTATION = 0 const PNG_LOONGARCH_LSX_OPT = 0 const PNG_MAXIMUM_INFLATE_WINDOW = 2 const PNG_MAX_GAMMA_8 = 11 const PNG_MAX_PALETTE_LENGTH = 256 const PNG_MIPS_MMI_IMPLEMENTATION = 0 const PNG_MIPS_MMI_OPT = 0 const PNG_MIPS_MSA_IMPLEMENTATION = 0 const PNG_MIPS_MSA_OPT = 0 const PNG_NO_FILTERS = 0x00 const PNG_NUMBER_BUFFER_SIZE = 24 const PNG_NUMBER_FORMAT_02d = 2 const PNG_NUMBER_FORMAT_02u = 2 const PNG_NUMBER_FORMAT_02x = 4 const PNG_NUMBER_FORMAT_d = 1 const PNG_NUMBER_FORMAT_fixed = 5 const PNG_NUMBER_FORMAT_u = 1 const PNG_NUMBER_FORMAT_x = 3 const PNG_OFFSET_LAST = 2 const PNG_OFFSET_MICROMETER = 1 const PNG_OFFSET_PIXEL = 0 const PNG_OPTION_INVALID = 1 const PNG_OPTION_NEXT = 14 const PNG_OPTION_OFF = 2 const PNG_OPTION_ON = 3 const PNG_OPTION_UNSET = 0 const PNG_PACK = 0x0004 const PNG_PACKSWAP = 0x10000 const PNG_POWERPC_VSX_IMPLEMENTATION = 0 const PNG_POWERPC_VSX_OPT = 0 const PNG_QUANTIZE = 0x0040 const PNG_QUANTIZE_BLUE_BITS = 5 const PNG_QUANTIZE_GREEN_BITS = 5 const PNG_QUANTIZE_RED_BITS = 5 const PNG_RESOLUTION_LAST = 2 const PNG_RESOLUTION_METER = 1 const PNG_RESOLUTION_UNKNOWN = 0 const PNG_RESTRICT = "__restrict" const PNG_RGBA = 0x0800 const PNG_RGB_TO_GRAY = 0x600000 const PNG_RGB_TO_GRAY_ERR = 0x200000 const PNG_RGB_TO_GRAY_WARN = 0x400000 const PNG_SCALE_16_TO_8 = 0x4000000 const PNG_SCALE_LAST = 3 const PNG_SCALE_METER = 1 const PNG_SCALE_RADIAN = 2 const PNG_SCALE_UNKNOWN = 0 const PNG_SET_WILL_FREE_DATA = 1 const PNG_SHIFT = 0x0008 const PNG_SKIP_sRGB_CHECK_PROFILE = 4 const PNG_STRING_NEWLINE = "\\n" const PNG_STRIP_ALPHA = 0x40000 const PNG_STRUCT_INFO = 0x0002 const PNG_STRUCT_PNG = 0x0001 const PNG_SWAP_ALPHA = 0x20000 const PNG_SWAP_BYTES = 0x0010 const PNG_TEXT_COMPRESSION_LAST = 3 const PNG_TEXT_COMPRESSION_zTXt = 0 const PNG_TEXT_Z_DEFAULT_STRATEGY = 0 const PNG_TRANSFORM_BGR = 0x0080 const PNG_TRANSFORM_EXPAND = 0x0010 const PNG_TRANSFORM_EXPAND_16 = 0x4000 const PNG_TRANSFORM_GRAY_TO_RGB = 0x2000 const PNG_TRANSFORM_IDENTITY = 0x0000 const PNG_TRANSFORM_INVERT_ALPHA = 0x0400 const PNG_TRANSFORM_INVERT_MONO = 0x0020 const PNG_TRANSFORM_PACKING = 0x0004 const PNG_TRANSFORM_PACKSWAP = 0x0008 const PNG_TRANSFORM_SCALE_16 = 0x8000 const PNG_TRANSFORM_SHIFT = 0x0040 const PNG_TRANSFORM_STRIP_16 = 0x0001 const PNG_TRANSFORM_STRIP_ALPHA = 0x0002 const PNG_TRANSFORM_STRIP_FILLER = 0x0800 const PNG_TRANSFORM_STRIP_FILLER_AFTER = 0x1000 const PNG_TRANSFORM_STRIP_FILLER_BEFORE = "PNG_TRANSFORM_STRIP_FILLER" const PNG_TRANSFORM_SWAP_ALPHA = 0x0100 const PNG_TRANSFORM_SWAP_ENDIAN = 0x0200 const PNG_USER_CHUNK_CACHE_MAX = 1000 const PNG_USER_CHUNK_MALLOC_MAX = 8000000 const PNG_USER_HEIGHT_MAX = 1000000 const PNG_USER_TRANSFORM = 0x100000 const PNG_USER_WIDTH_MAX = 1000000 const PNG_USER_WILL_FREE_DATA = 2 const PNG_USE_COMPILE_TIME_MASKS = 1 const PNG_WARNING_PARAMETER_COUNT = 8 const PNG_WARNING_PARAMETER_SIZE = 32 const PNG_WROTE_INFO_BEFORE_PLTE = 0x400 const PNG_WROTE_eXIf = 0x4000 const PNG_WROTE_tIME = 0x200 const PNG_ZBUF_SIZE = 8192 const PNG_ZLIB_VERNUM = 0 const PNG_Z_DEFAULT_NOFILTER_STRATEGY = 0 const PNG_Z_DEFAULT_STRATEGY = 1 const PNG_sCAL_PRECISION = 5 const PNG_sRGB_INTENT_ABSOLUTE = 3 const PNG_sRGB_INTENT_LAST = 4 const PNG_sRGB_INTENT_PERCEPTUAL = 0 const PNG_sRGB_INTENT_RELATIVE = 1 const PNG_sRGB_INTENT_SATURATION = 2 const PNG_sRGB_PROFILE_CHECKS = 2 const PTHREAD_DESTRUCTOR_ITERATIONS = 4 const PTHREAD_KEYS_MAX = 128 const PTHREAD_STACK_MIN = 2048 const RE_DUP_MAX = 255 const SCHAR_MAX = 127 const SEM_NSEMS_MAX = 256 const SEM_VALUE_MAX = 0x7fffffff const SHRT_MAX = 0x7fff const SSIZE_MAX = "LONG_MAX" const SYMLOOP_MAX = 40 const TTY_NAME_MAX = 32 const TZNAME_MAX = 6 const UCHAR_MAX = 255 const UINT_MAX = 0xffffffff const USHRT_MAX = 0xffff const WORD_BIT = 32 const ZEXTERN = "extern" const ZLIBTCL_VERSION = "1.3.1" const ZLIB_VERNUM = 0x1310 const ZLIB_VERSION = "1.3.1" const ZLIB_VER_MAJOR = 1 const ZLIB_VER_MINOR = 3 const ZLIB_VER_REVISION = 1 const ZLIB_VER_SUBREVISION = 0 const Z_ASCII = "Z_TEXT" const Z_BEST_COMPRESSION = 9 const Z_BEST_SPEED = 1 const Z_BINARY = 0 const Z_BLOCK = 5 const Z_DEFAULT_STRATEGY = 0 const Z_DEFLATED = 8 const Z_FILTERED = 1 const Z_FINISH = 4 const Z_FIXED = 4 const Z_FULL_FLUSH = 3 const Z_HUFFMAN_ONLY = 2 const Z_NEED_DICT = 2 const Z_NO_COMPRESSION = 0 const Z_NO_FLUSH = 0 const Z_NULL = 0 const Z_OK = 0 const Z_PARTIAL_FLUSH = 1 const Z_RLE = 3 const Z_STREAM_END = 1 const Z_SYNC_FLUSH = 2 const Z_TEXT = 1 const Z_TREES = 6 const Z_U4 = "unsigned" const Z_UNKNOWN = 2 const _POSIX2_BC_BASE_MAX = 99 const _POSIX2_BC_DIM_MAX = 2048 const _POSIX2_BC_SCALE_MAX = 99 const _POSIX2_BC_STRING_MAX = 1000 const _POSIX2_CHARCLASS_NAME_MAX = 14 const _POSIX2_COLL_WEIGHTS_MAX = 2 const _POSIX2_EXPR_NEST_MAX = 32 const _POSIX2_LINE_MAX = 2048 const _POSIX2_RE_DUP_MAX = 255 const _POSIX_AIO_LISTIO_MAX = 2 const _POSIX_AIO_MAX = 1 const _POSIX_ARG_MAX = 4096 const _POSIX_CHILD_MAX = 25 const _POSIX_CLOCKRES_MIN = 20000000 const _POSIX_DELAYTIMER_MAX = 32 const _POSIX_HOST_NAME_MAX = 255 const _POSIX_LINK_MAX = 8 const _POSIX_LOGIN_NAME_MAX = 9 const _POSIX_MAX_CANON = 255 const _POSIX_MAX_INPUT = 255 const _POSIX_MQ_OPEN_MAX = 8 const _POSIX_MQ_PRIO_MAX = 32 const _POSIX_NAME_MAX = 14 const _POSIX_NGROUPS_MAX = 8 const _POSIX_OPEN_MAX = 20 const _POSIX_PATH_MAX = 256 const _POSIX_PIPE_BUF = 512 const _POSIX_RE_DUP_MAX = 255 const _POSIX_RTSIG_MAX = 8 const _POSIX_SEM_NSEMS_MAX = 256 const _POSIX_SEM_VALUE_MAX = 32767 const _POSIX_SIGQUEUE_MAX = 32 const _POSIX_SOURCE = 1 const _POSIX_SSIZE_MAX = 32767 const _POSIX_SS_REPL_MAX = 4 const _POSIX_STREAM_MAX = 8 const _POSIX_SYMLINK_MAX = 255 const _POSIX_SYMLOOP_MAX = 8 const _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4 const _POSIX_THREAD_KEYS_MAX = 128 const _POSIX_THREAD_THREADS_MAX = 64 const _POSIX_TIMER_MAX = 32 const _POSIX_TRACE_EVENT_NAME_MAX = 30 const _POSIX_TRACE_NAME_MAX = 8 const _POSIX_TRACE_SYS_MAX = 8 const _POSIX_TRACE_USER_EVENT_MAX = 32 const _POSIX_TTY_NAME_MAX = 9 const _POSIX_TZNAME_MAX = 6 const _XOPEN_IOV_MAX = 16 const _XOPEN_NAME_MAX = 255 const _XOPEN_PATH_MAX = 1024 const z_const = "const" const z_off64_t = "z_off_t" const z_off_t = "off_t" type Tpng_byte = uint8 type Tpng_int_16 = int16 type Tpng_uint_16 = uint16 type Tpng_int_32 = int32 type Tpng_uint_32 = uint32 type Tpng_size_t = uint32 type Tpng_ptrdiff_t = int32 type Tpng_alloc_size_t = uint32 type Tpng_fixed_point = int32 type Tpng_voidp = uintptr type Tpng_const_voidp = uintptr type Tpng_bytep = uintptr type Tpng_const_bytep = uintptr type Tpng_uint_32p = uintptr type Tpng_const_uint_32p = uintptr type Tpng_int_32p = uintptr type Tpng_const_int_32p = uintptr type Tpng_uint_16p = uintptr type Tpng_const_uint_16p = uintptr type Tpng_int_16p = uintptr type Tpng_const_int_16p = uintptr type Tpng_charp = uintptr type Tpng_const_charp = uintptr type Tpng_fixed_point_p = uintptr type Tpng_const_fixed_point_p = uintptr type Tpng_size_tp = uintptr type Tpng_const_size_tp = uintptr type Tpng_FILE_p = uintptr type Tpng_doublep = uintptr type Tpng_const_doublep = uintptr type Tpng_bytepp = uintptr type Tpng_uint_32pp = uintptr type Tpng_int_32pp = uintptr type Tpng_uint_16pp = uintptr type Tpng_int_16pp = uintptr type Tpng_const_charpp = uintptr type Tpng_charpp = uintptr type Tpng_fixed_point_pp = uintptr type Tpng_doublepp = uintptr type Tpng_charppp = uintptr type Tpng_libpng_version_1_6_44 = uintptr type Tpng_struct = struct { F__ccgo_align [0]uint32 Fjmp_buf_local Tjmp_buf Flongjmp_fn Tpng_longjmp_ptr Fjmp_buf_ptr uintptr Fjmp_buf_size Tsize_t Ferror_fn Tpng_error_ptr Fwarning_fn Tpng_error_ptr Ferror_ptr Tpng_voidp Fwrite_data_fn Tpng_rw_ptr Fread_data_fn Tpng_rw_ptr Fio_ptr Tpng_voidp Fread_user_transform_fn Tpng_user_transform_ptr Fwrite_user_transform_fn Tpng_user_transform_ptr Fuser_transform_ptr Tpng_voidp Fuser_transform_depth Tpng_byte Fuser_transform_channels Tpng_byte Fmode Tpng_uint_32 Fflags Tpng_uint_32 Ftransformations Tpng_uint_32 Fzowner Tpng_uint_32 Fzstream Tz_stream Fzbuffer_list Tpng_compression_bufferp Fzbuffer_size TuInt Fzlib_level int32 Fzlib_method int32 Fzlib_window_bits int32 Fzlib_mem_level int32 Fzlib_strategy int32 Fzlib_text_level int32 Fzlib_text_method int32 Fzlib_text_window_bits int32 Fzlib_text_mem_level int32 Fzlib_text_strategy int32 Fzlib_set_level int32 Fzlib_set_method int32 Fzlib_set_window_bits int32 Fzlib_set_mem_level int32 Fzlib_set_strategy int32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fnum_rows Tpng_uint_32 Fusr_width Tpng_uint_32 Frowbytes Tsize_t Fiwidth Tpng_uint_32 Frow_number Tpng_uint_32 Fchunk_name Tpng_uint_32 Fprev_row Tpng_bytep Frow_buf Tpng_bytep Ftry_row Tpng_bytep Ftst_row Tpng_bytep Finfo_rowbytes Tsize_t Fidat_size Tpng_uint_32 Fcrc Tpng_uint_32 Fpalette Tpng_colorp Fnum_palette Tpng_uint_16 Fnum_palette_max int32 Fnum_trans Tpng_uint_16 Fcompression Tpng_byte Ffilter Tpng_byte Finterlaced Tpng_byte Fpass Tpng_byte Fdo_filter Tpng_byte Fcolor_type Tpng_byte Fbit_depth Tpng_byte Fusr_bit_depth Tpng_byte Fpixel_depth Tpng_byte Fchannels Tpng_byte Fusr_channels Tpng_byte Fsig_bytes Tpng_byte Fmaximum_pixel_depth Tpng_byte Ftransformed_pixel_depth Tpng_byte Fzstream_start Tpng_byte Ffiller Tpng_uint_16 Fbackground_gamma_type Tpng_byte Fbackground_gamma Tpng_fixed_point Fbackground Tpng_color_16 Fbackground_1 Tpng_color_16 Foutput_flush_fn Tpng_flush_ptr Fflush_dist Tpng_uint_32 Fflush_rows Tpng_uint_32 Fgamma_shift int32 Fscreen_gamma Tpng_fixed_point Fgamma_table Tpng_bytep Fgamma_16_table Tpng_uint_16pp Fgamma_from_1 Tpng_bytep Fgamma_to_1 Tpng_bytep Fgamma_16_from_1 Tpng_uint_16pp Fgamma_16_to_1 Tpng_uint_16pp Fsig_bit Tpng_color_8 Fshift Tpng_color_8 Ftrans_alpha Tpng_bytep Ftrans_color Tpng_color_16 Fread_row_fn Tpng_read_status_ptr Fwrite_row_fn Tpng_write_status_ptr Finfo_fn Tpng_progressive_info_ptr Frow_fn Tpng_progressive_row_ptr Fend_fn Tpng_progressive_end_ptr Fsave_buffer_ptr Tpng_bytep Fsave_buffer Tpng_bytep Fcurrent_buffer_ptr Tpng_bytep Fcurrent_buffer Tpng_bytep Fpush_length Tpng_uint_32 Fskip_length Tpng_uint_32 Fsave_buffer_size Tsize_t Fsave_buffer_max Tsize_t Fbuffer_size Tsize_t Fcurrent_buffer_size Tsize_t Fprocess_mode int32 Fcur_palette int32 Fpalette_lookup Tpng_bytep Fquantize_index Tpng_bytep Foptions Tpng_uint_32 Ftime_buffer [29]uint8 Ffree_me Tpng_uint_32 Fuser_chunk_ptr Tpng_voidp Fread_user_chunk_fn Tpng_user_chunk_ptr Funknown_default int32 Fnum_chunk_list uint32 Fchunk_list Tpng_bytep Frgb_to_gray_status Tpng_byte Frgb_to_gray_coefficients_set Tpng_byte Frgb_to_gray_red_coeff Tpng_uint_16 Frgb_to_gray_green_coeff Tpng_uint_16 Friffled_palette Tpng_bytep Fmng_features_permitted Tpng_uint_32 Ffilter_type Tpng_byte Fmem_ptr Tpng_voidp Fmalloc_fn Tpng_malloc_ptr Ffree_fn Tpng_free_ptr Fbig_row_buf Tpng_bytep Fquantize_sort Tpng_bytep Findex_to_palette Tpng_bytep Fpalette_to_index Tpng_bytep Fcompression_type Tpng_byte Fuser_width_max Tpng_uint_32 Fuser_height_max Tpng_uint_32 Fuser_chunk_cache_max Tpng_uint_32 Fuser_chunk_malloc_max Tpng_alloc_size_t Funknown_chunk Tpng_unknown_chunk Fold_big_row_buf_size Tsize_t Fread_buffer Tpng_bytep Fread_buffer_size Tpng_alloc_size_t FIDAT_read_size TuInt Fio_state Tpng_uint_32 Fbig_prev_row Tpng_bytep Fread_filter [4]uintptr Fcolorspace Tpng_colorspace F__ccgo_pad146 [4]byte } type Tpng_struct_def = Tpng_struct type Tpng_const_structp = uintptr type Tpng_structp = uintptr type Tpng_structpp = uintptr type Tpng_info = struct { Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fvalid Tpng_uint_32 Frowbytes Tsize_t Fpalette Tpng_colorp Fnum_palette Tpng_uint_16 Fnum_trans Tpng_uint_16 Fbit_depth Tpng_byte Fcolor_type Tpng_byte Fcompression_type Tpng_byte Ffilter_type Tpng_byte Finterlace_type Tpng_byte Fchannels Tpng_byte Fpixel_depth Tpng_byte Fspare_byte Tpng_byte Fsignature [8]Tpng_byte Fcolorspace Tpng_colorspace Ficcp_name Tpng_charp Ficcp_profile Tpng_bytep Ficcp_proflen Tpng_uint_32 Fnum_text int32 Fmax_text int32 Ftext Tpng_textp Fmod_time Tpng_time Fsig_bit Tpng_color_8 Ftrans_alpha Tpng_bytep Ftrans_color Tpng_color_16 Fbackground Tpng_color_16 Fx_offset Tpng_int_32 Fy_offset Tpng_int_32 Foffset_unit_type Tpng_byte Fx_pixels_per_unit Tpng_uint_32 Fy_pixels_per_unit Tpng_uint_32 Fphys_unit_type Tpng_byte Fnum_exif int32 Fexif Tpng_bytep FeXIf_buf Tpng_bytep Fhist Tpng_uint_16p Fpcal_purpose Tpng_charp Fpcal_X0 Tpng_int_32 Fpcal_X1 Tpng_int_32 Fpcal_units Tpng_charp Fpcal_params Tpng_charpp Fpcal_type Tpng_byte Fpcal_nparams Tpng_byte Ffree_me Tpng_uint_32 Funknown_chunks Tpng_unknown_chunkp Funknown_chunks_num int32 Fsplt_palettes Tpng_sPLT_tp Fsplt_palettes_num int32 Fscal_unit Tpng_byte Fscal_s_width Tpng_charp Fscal_s_height Tpng_charp Frow_pointers Tpng_bytepp } type Tpng_info_def = Tpng_info type Tpng_infop = uintptr type Tpng_const_infop = uintptr type Tpng_infopp = uintptr type Tpng_structrp = uintptr type Tpng_const_structrp = uintptr type Tpng_inforp = uintptr type Tpng_const_inforp = uintptr type Tpng_color = struct { Fred Tpng_byte Fgreen Tpng_byte Fblue Tpng_byte } type Tpng_color_struct = Tpng_color type Tpng_colorp = uintptr type Tpng_const_colorp = uintptr type Tpng_colorpp = uintptr type Tpng_color_16 = struct { Findex Tpng_byte Fred Tpng_uint_16 Fgreen Tpng_uint_16 Fblue Tpng_uint_16 Fgray Tpng_uint_16 } type Tpng_color_16_struct = Tpng_color_16 type Tpng_color_16p = uintptr type Tpng_const_color_16p = uintptr type Tpng_color_16pp = uintptr type Tpng_color_8 = struct { Fred Tpng_byte Fgreen Tpng_byte Fblue Tpng_byte Fgray Tpng_byte Falpha Tpng_byte } type Tpng_color_8_struct = Tpng_color_8 type Tpng_color_8p = uintptr type Tpng_const_color_8p = uintptr type Tpng_color_8pp = uintptr type Tpng_sPLT_entry = struct { Fred Tpng_uint_16 Fgreen Tpng_uint_16 Fblue Tpng_uint_16 Falpha Tpng_uint_16 Ffrequency Tpng_uint_16 } type Tpng_sPLT_entry_struct = Tpng_sPLT_entry type Tpng_sPLT_entryp = uintptr type Tpng_const_sPLT_entryp = uintptr type Tpng_sPLT_entrypp = uintptr type Tpng_sPLT_t = struct { Fname Tpng_charp Fdepth Tpng_byte Fentries Tpng_sPLT_entryp Fnentries Tpng_int_32 } type Tpng_sPLT_struct = Tpng_sPLT_t type Tpng_sPLT_tp = uintptr type Tpng_const_sPLT_tp = uintptr type Tpng_sPLT_tpp = uintptr type Tpng_text = struct { Fcompression int32 Fkey Tpng_charp Ftext Tpng_charp Ftext_length Tsize_t Fitxt_length Tsize_t Flang Tpng_charp Flang_key Tpng_charp } type Tpng_text_struct = Tpng_text type Tpng_textp = uintptr type Tpng_const_textp = uintptr type Tpng_textpp = uintptr type Tpng_time = struct { Fyear Tpng_uint_16 Fmonth Tpng_byte Fday Tpng_byte Fhour Tpng_byte Fminute Tpng_byte Fsecond Tpng_byte } type Tpng_time_struct = Tpng_time type Tpng_timep = uintptr type Tpng_const_timep = uintptr type Tpng_timepp = uintptr type Tpng_unknown_chunk = struct { Fname [5]Tpng_byte Fdata uintptr Fsize Tsize_t Flocation Tpng_byte } type Tpng_unknown_chunk_t = Tpng_unknown_chunk type Tpng_unknown_chunkp = uintptr type Tpng_const_unknown_chunkp = uintptr type Tpng_unknown_chunkpp = uintptr type Tpng_row_info = struct { Fwidth Tpng_uint_32 Frowbytes Tsize_t Fcolor_type Tpng_byte Fbit_depth Tpng_byte Fchannels Tpng_byte Fpixel_depth Tpng_byte } type Tpng_row_info_struct = Tpng_row_info type Tpng_row_infop = uintptr type Tpng_row_infopp = uintptr type Tpng_error_ptr = uintptr type Tpng_rw_ptr = uintptr type Tpng_flush_ptr = uintptr type Tpng_read_status_ptr = uintptr type Tpng_write_status_ptr = uintptr type Tpng_progressive_info_ptr = uintptr type Tpng_progressive_end_ptr = uintptr type Tpng_progressive_row_ptr = uintptr type Tpng_user_transform_ptr = uintptr type Tpng_user_chunk_ptr = uintptr type Tpng_longjmp_ptr = uintptr type Tpng_malloc_ptr = uintptr type Tpng_free_ptr = uintptr type Tpng_controlp = uintptr type Tpng_control1 = struct { Fpng_ptr Tpng_structp Finfo_ptr Tpng_infop Ferror_buf Tpng_voidp Fmemory Tpng_const_bytep Fsize Tsize_t F__ccgo20 uint8 } type Tpng_image = struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 } type Tpng_imagep = uintptr type Tz_size_t = uint32 type TuInt = uint32 type TuLong = uint32 type TBytef = uint8 type Tcharf = uint8 type Tintf = int32 type TuIntf = uint32 type TuLongf = uint32 type Tvoidpc = uintptr type Tvoidpf = uintptr type Tvoidp = uintptr type Tz_crc_t = uint32 type Talloc_func = uintptr type Tfree_func = uintptr type Tz_stream = struct { Fnext_in uintptr Favail_in TuInt Ftotal_in TuLong Fnext_out uintptr Favail_out TuInt Ftotal_out TuLong Fmsg uintptr Fstate uintptr Fzalloc Talloc_func Fzfree Tfree_func Fopaque Tvoidpf Fdata_type int32 Fadler TuLong Freserved TuLong } type Tz_stream_s = Tz_stream type Tz_streamp = uintptr type Tgz_header = struct { Ftext int32 Ftime TuLong Fxflags int32 Fos int32 Fextra uintptr Fextra_len TuInt Fextra_max TuInt Fname uintptr Fname_max TuInt Fcomment uintptr Fcomm_max TuInt Fhcrc int32 Fdone int32 } type Tgz_header_s = Tgz_header type Tgz_headerp = uintptr type Tin_func = uintptr type Tout_func = uintptr type TgzFile = uintptr type TgzFile_s = struct { F__ccgo_align [0]uint32 Fhave uint32 Fnext uintptr Fpos Toff_t } type TZlibtclStubs = struct { Fmagic int32 Fhooks uintptr FzlibVersionPtr uintptr FzErrorPtr uintptr Fcrc32Ptr uintptr Fadler32Ptr uintptr Freserved4 uintptr Freserved5 uintptr Freserved6 uintptr Freserved7 uintptr Freserved8 uintptr Freserved9 uintptr FdeflateInit_Ptr uintptr FdeflateInit2_Ptr uintptr FdeflatePtr uintptr FdeflateEndPtr uintptr FdeflateSetDictionaryPtr uintptr FdeflateCopyPtr uintptr FdeflateResetPtr uintptr FdeflateParamsPtr uintptr FcompressPtr uintptr Fcompress2Ptr uintptr FinflateInit_Ptr uintptr FinflateInit2_Ptr uintptr FinflatePtr uintptr FinflateEndPtr uintptr FinflateSetDictionaryPtr uintptr FinflateSyncPtr uintptr FinflateResetPtr uintptr FuncompressPtr uintptr FinflateReset2Ptr uintptr FinflateValidatePtr uintptr FgzopenPtr uintptr FgzdopenPtr uintptr FgzsetparamsPtr uintptr FgzreadPtr uintptr FgzwritePtr uintptr FgzprintfPtr uintptr FgzputsPtr uintptr FgzgetsPtr uintptr FgzputcPtr uintptr FgzgetcPtr uintptr FgzflushPtr uintptr FgzseekPtr uintptr FgzrewindPtr uintptr FgztellPtr uintptr FgzeofPtr uintptr FgzclosePtr uintptr FgzerrorPtr uintptr } type Tpng_compression_buffer = struct { Fnext uintptr Foutput [1]Tpng_byte } type Tpng_compression_bufferp = uintptr type Tpng_compression_buffer1 = struct { Fnext uintptr Foutput [1]Tpng_byte } type Tpng_xy = struct { Fredx Tpng_fixed_point Fredy Tpng_fixed_point Fgreenx Tpng_fixed_point Fgreeny Tpng_fixed_point Fbluex Tpng_fixed_point Fbluey Tpng_fixed_point Fwhitex Tpng_fixed_point Fwhitey Tpng_fixed_point } type Tpng_XYZ = struct { Fred_X Tpng_fixed_point Fred_Y Tpng_fixed_point Fred_Z Tpng_fixed_point Fgreen_X Tpng_fixed_point Fgreen_Y Tpng_fixed_point Fgreen_Z Tpng_fixed_point Fblue_X Tpng_fixed_point Fblue_Y Tpng_fixed_point Fblue_Z Tpng_fixed_point } type Tpng_colorspace = struct { Fgamma Tpng_fixed_point Fend_points_xy Tpng_xy Fend_points_XYZ Tpng_XYZ Frendering_intent Tpng_uint_16 Fflags Tpng_uint_16 } type Tpng_colorspacerp = uintptr type Tpng_colorspace1 = struct { Fgamma Tpng_fixed_point Fend_points_xy Tpng_xy Fend_points_XYZ Tpng_XYZ Frendering_intent Tpng_uint_16 Fflags Tpng_uint_16 } type Tpng_const_colorspacerp = uintptr type Tpng_const_uint_16pp = uintptr type Tpng_warning_parameters = [8][32]uint8 type Tpng_control = struct { Fpng_ptr Tpng_structp Finfo_ptr Tpng_infop Ferror_buf Tpng_voidp Fmemory Tpng_const_bytep Fsize Tsize_t F__ccgo20 uint8 } const PNG_FLAG_APP_ERRORS_WARN1 = 4194304 const PNG_FLAG_APP_WARNINGS_WARN1 = 2097152 const PNG_FLAG_BENIGN_ERRORS_WARN1 = 1048576 const PNG_IS_READ_STRUCT1 = 32768 const PNG_LITERAL_LEFT_SQUARE_BRACKET1 = 91 const PNG_LITERAL_RIGHT_SQUARE_BRACKET1 = 93 const PNG_LITERAL_SHARP1 = 35 const PNG_MAX_ERROR_TEXT = 196 const PNG_STRING_NEWLINE1 = "\n" const fixed_message = "fixed point overflow in " // C documentation // // /* This function is called whenever there is a fatal error. This function // * should not be changed. If there is a need to handle errors differently, // * you should supply a replacement error function and use png_set_error_fn() // * to replace the error function at run-time. // */ func Xpng_error(tls *libc.TLS, png_ptr Tpng_const_structrp, error_message Tpng_const_charp) { if png_ptr != libc.UintptrFromInt32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ferror_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_const_charp))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Ferror_fn})))(tls, png_ptr, error_message) } /* If the custom handler doesn't exist, or if it returns, use the default handler, which will not return. */ _png_default_error(tls, png_ptr, error_message) } // C documentation // // /* Utility to safely appends strings to a buffer. This never errors out so // * error checking is not required in the caller. // */ func Xpng_safecat(tls *libc.TLS, buffer Tpng_charp, bufsize Tsize_t, pos Tsize_t, string1 Tpng_const_charp) (r Tsize_t) { var v1 Tsize_t var v2 Tpng_const_charp _, _ = v1, v2 if buffer != libc.UintptrFromInt32(0) && pos < bufsize { if string1 != libc.UintptrFromInt32(0) { for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(string1))) != int32('\000') && pos < bufsize-uint32(1) { v1 = pos pos++ v2 = string1 string1++ *(*uint8)(unsafe.Pointer(buffer + uintptr(v1))) = *(*uint8)(unsafe.Pointer(v2)) } } *(*uint8)(unsafe.Pointer(buffer + uintptr(pos))) = uint8('\000') } return pos } // C documentation // // /* Utility to dump an unsigned value into a buffer, given a start pointer and // * and end pointer (which should point just *beyond* the end of the buffer!) // * Returns the pointer to the start of the formatted string. // */ func Xpng_format_number(tls *libc.TLS, start Tpng_const_charp, end Tpng_charp, format int32, number Tpng_alloc_size_t) (r Tpng_charp) { var count, mincount, output int32 var v1, v2, v3, v4, v5, v6 Tpng_charp _, _, _, _, _, _, _, _, _ = count, mincount, output, v1, v2, v3, v4, v5, v6 count = 0 /* number of digits output */ mincount = int32(1) /* minimum number required */ output = 0 /* digit output (for the fixed point format) */ end-- v1 = end *(*uint8)(unsafe.Pointer(v1)) = uint8('\000') /* This is written so that the loop always runs at least once, even with * number zero. */ for end > start && (number != uint32(0) || count < mincount) { switch format { case int32(PNG_NUMBER_FORMAT_fixed): /* Needs five digits (the fraction) */ mincount = int32(5) if output != 0 || number%uint32(10) != uint32(0) { end-- v2 = end *(*uint8)(unsafe.Pointer(v2)) = _digits[number%uint32(10)] output = int32(1) } number /= uint32(10) case int32(PNG_NUMBER_FORMAT_02u): /* Expects at least 2 digits. */ mincount = int32(2) /* FALLTHROUGH */ fallthrough case int32(PNG_NUMBER_FORMAT_u): end-- v3 = end *(*uint8)(unsafe.Pointer(v3)) = _digits[number%uint32(10)] number /= uint32(10) case int32(PNG_NUMBER_FORMAT_02x): /* This format expects at least two digits */ mincount = int32(2) /* FALLTHROUGH */ fallthrough case int32(PNG_NUMBER_FORMAT_x): end-- v4 = end *(*uint8)(unsafe.Pointer(v4)) = _digits[number&uint32(0xf)] number >>= uint32(4) default: /* an error */ number = uint32(0) break } /* Keep track of the number of digits added */ count++ /* Float a fixed number here: */ if format == int32(PNG_NUMBER_FORMAT_fixed) && count == int32(5) && end > start { /* End of the fraction, but maybe nothing was output? In that case * drop the decimal point. If the number is a true zero handle that * here. */ if output != 0 { end-- v5 = end *(*uint8)(unsafe.Pointer(v5)) = uint8('.') } else { if number == uint32(0) { /* and !output */ end-- v6 = end *(*uint8)(unsafe.Pointer(v6)) = uint8('0') } } } } return end } var _digits = [17]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'} // C documentation // // /* This function is called whenever there is a non-fatal error. This function // * should not be changed. If there is a need to handle warnings differently, // * you should supply a replacement warning function and use // * png_set_error_fn() to replace the warning function at run-time. // */ func Xpng_warning(tls *libc.TLS, png_ptr Tpng_const_structrp, warning_message Tpng_const_charp) { var offset int32 _ = offset offset = 0 if png_ptr != libc.UintptrFromInt32(0) { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(warning_message))) == int32(PNG_LITERAL_SHARP1) { offset = int32(1) for { if !(offset < int32(15)) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(warning_message + uintptr(offset)))) == int32(' ') { break } goto _1 _1: ; offset++ } } } if png_ptr != libc.UintptrFromInt32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwarning_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_const_charp))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwarning_fn})))(tls, png_ptr, warning_message+uintptr(offset)) } else { _png_default_warning(tls, png_ptr, warning_message+uintptr(offset)) } } // C documentation // // /* These functions support 'formatted' warning messages with up to // * PNG_WARNING_PARAMETER_COUNT parameters. In the format string the parameter // * is introduced by @, where 'number' starts at 1. This follows the // * standard established by X/Open for internationalizable error messages. // */ func Xpng_warning_parameter(tls *libc.TLS, p uintptr, number int32, string1 Tpng_const_charp) { if number > 0 && number <= int32(PNG_WARNING_PARAMETER_COUNT) { Xpng_safecat(tls, p+uintptr(number-int32(1))*32, libc.Uint32FromInt64(32), uint32(0), string1) } } func Xpng_warning_parameter_unsigned(tls *libc.TLS, p uintptr, number int32, format int32, value Tpng_alloc_size_t) { bp := tls.Alloc(32) defer tls.Free(32) var _ /* buffer at bp+0 */ [24]uint8 *(*[24]uint8)(unsafe.Pointer(bp)) = [24]uint8{} Xpng_warning_parameter(tls, p, number, Xpng_format_number(tls, bp, bp+uintptr(libc.Uint32FromInt64(24)), format, value)) } func Xpng_warning_parameter_signed(tls *libc.TLS, p uintptr, number int32, format int32, value Tpng_int_32) { bp := tls.Alloc(32) defer tls.Free(32) var str, v1 Tpng_charp var u Tpng_alloc_size_t var _ /* buffer at bp+0 */ [24]uint8 _, _, _ = str, u, v1 *(*[24]uint8)(unsafe.Pointer(bp)) = [24]uint8{} /* Avoid overflow by doing the negate in a png_alloc_size_t: */ u = libc.Uint32FromInt32(value) if value < 0 { u = ^u + uint32(1) } str = Xpng_format_number(tls, bp, bp+uintptr(libc.Uint32FromInt64(24)), format, u) if value < 0 && str > bp { str-- v1 = str *(*uint8)(unsafe.Pointer(v1)) = uint8('-') } Xpng_warning_parameter(tls, p, number, str) } func Xpng_formatted_warning(tls *libc.TLS, png_ptr Tpng_const_structrp, p uintptr, message Tpng_const_charp) { bp := tls.Alloc(192) defer tls.Free(192) var i, v2, v4 Tsize_t var parameter, parameter_char int32 var parm, pend, v1, v3, v5 Tpng_const_charp var _ /* msg at bp+0 */ [192]uint8 _, _, _, _, _, _, _, _, _, _ = i, parameter, parameter_char, parm, pend, v1, v2, v3, v4, v5 /* The internal buffer is just 192 bytes - enough for all our messages, * overflow doesn't happen because this code checks! If someone figures * out how to send us a message longer than 192 bytes, all that will * happen is that the message will be truncated appropriately. */ i = uint32(0) /* Each iteration through the following loop writes at most one character * to msg[i++] then returns here to validate that there is still space for * the trailing '\0'. It may (in the case of a parameter) read more than * one character from message[]; it must check for '\0' and continue to the * test if it finds the end of string. */ for i < libc.Uint32FromInt64(192)-libc.Uint32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(message))) != int32('\000') { /* '@' at end of string is now just printed (previously it was skipped); * it is an error in the calling code to terminate the string with @. */ if p != libc.UintptrFromInt32(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(message))) == int32('@') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(message + 1))) != int32('\000') { message++ v1 = message parameter_char = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v1))) /* Consume the '@' */ parameter = 0 /* Search for the parameter digit, the index in the string is the * parameter to use. */ for libc.Int32FromUint8(_valid_parameters[parameter]) != parameter_char && libc.Int32FromUint8(_valid_parameters[parameter]) != int32('\000') { parameter++ } /* If the parameter digit is out of range it will just get printed. */ if parameter < int32(PNG_WARNING_PARAMETER_COUNT) { /* Append this parameter */ parm = p + uintptr(parameter)*32 pend = p + uintptr(parameter)*32 + uintptr(libc.Uint32FromInt64(32)) /* No need to copy the trailing '\0' here, but there is no guarantee * that parm[] has been initialized, so there is no guarantee of a * trailing '\0': */ for i < libc.Uint32FromInt64(192)-libc.Uint32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(parm))) != int32('\000') && parm < pend { v2 = i i++ v3 = parm parm++ (*(*[192]uint8)(unsafe.Pointer(bp)))[v2] = *(*uint8)(unsafe.Pointer(v3)) } /* Consume the parameter digit too: */ message++ continue } /* else not a parameter and there is a character after the @ sign; just * copy that. This is known not to be '\0' because of the test above. */ } /* At this point *message can't be '\0', even in the bad parameter case * above where there is a lone '@' at the end of the message string. */ v4 = i i++ v5 = message message++ (*(*[192]uint8)(unsafe.Pointer(bp)))[v4] = *(*uint8)(unsafe.Pointer(v5)) } /* i is always less than (sizeof msg), so: */ (*(*[192]uint8)(unsafe.Pointer(bp)))[i] = uint8('\000') /* And this is the formatted message. It may be larger than * PNG_MAX_ERROR_TEXT, but that is only used for 'chunk' errors and these * are not (currently) formatted. */ Xpng_warning(tls, png_ptr, bp) } var _valid_parameters = [10]uint8{'1', '2', '3', '4', '5', '6', '7', '8', '9'} func Xpng_benign_error(tls *libc.TLS, png_ptr Tpng_const_structrp, error_message Tpng_const_charp) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x100000) != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x8000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name != uint32(0) { Xpng_chunk_warning(tls, png_ptr, error_message) } else { Xpng_warning(tls, png_ptr, error_message) } } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x8000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name != uint32(0) { Xpng_chunk_error(tls, png_ptr, error_message) } else { Xpng_error(tls, png_ptr, error_message) } } } func Xpng_app_warning(tls *libc.TLS, png_ptr Tpng_const_structrp, error_message Tpng_const_charp) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x200000) != uint32(0) { Xpng_warning(tls, png_ptr, error_message) } else { Xpng_error(tls, png_ptr, error_message) } } func Xpng_app_error(tls *libc.TLS, png_ptr Tpng_const_structrp, error_message Tpng_const_charp) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x400000) != uint32(0) { Xpng_warning(tls, png_ptr, error_message) } else { Xpng_error(tls, png_ptr, error_message) } } // C documentation // // /* These utilities are used internally to build an error message that relates // * to the current chunk. The chunk name comes from png_ptr->chunk_name, // * which is used to prefix the message. The message is limited in length // * to 63 bytes. The name characters are output as hex digits wrapped in [] // * if the character is invalid. // */ var _png_digit = [16]uint8{ 0: uint8('0'), 1: uint8('1'), 2: uint8('2'), 3: uint8('3'), 4: uint8('4'), 5: uint8('5'), 6: uint8('6'), 7: uint8('7'), 8: uint8('8'), 9: uint8('9'), 10: uint8('A'), 11: uint8('B'), 12: uint8('C'), 13: uint8('D'), 14: uint8('E'), 15: uint8('F'), } func _png_format_buffer(tls *libc.TLS, png_ptr Tpng_const_structrp, buffer Tpng_charp, error_message Tpng_const_charp) { var c, iin, iout, ishift, v1, v2, v3, v4, v5, v6, v7, v8, v9 int32 var chunk_name Tpng_uint_32 _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, chunk_name, iin, iout, ishift, v1, v2, v3, v4, v5, v6, v7, v8, v9 chunk_name = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name iout = 0 ishift = int32(24) for ishift >= 0 { c = libc.Int32FromUint32(chunk_name>>ishift) & int32(0xff) ishift -= int32(8) if libc.BoolInt32(c < int32(65) || c > int32(122) || c > int32(90) && c < int32(97)) != 0 { v1 = iout iout++ *(*uint8)(unsafe.Pointer(buffer + uintptr(v1))) = uint8(PNG_LITERAL_LEFT_SQUARE_BRACKET1) v2 = iout iout++ *(*uint8)(unsafe.Pointer(buffer + uintptr(v2))) = _png_digit[c&int32(0xf0)>>int32(4)] v3 = iout iout++ *(*uint8)(unsafe.Pointer(buffer + uintptr(v3))) = _png_digit[c&int32(0x0f)] v4 = iout iout++ *(*uint8)(unsafe.Pointer(buffer + uintptr(v4))) = uint8(PNG_LITERAL_RIGHT_SQUARE_BRACKET1) } else { v5 = iout iout++ *(*uint8)(unsafe.Pointer(buffer + uintptr(v5))) = libc.Uint8FromInt32(c) } } if error_message == libc.UintptrFromInt32(0) { *(*uint8)(unsafe.Pointer(buffer + uintptr(iout))) = uint8('\000') } else { iin = 0 v6 = iout iout++ *(*uint8)(unsafe.Pointer(buffer + uintptr(v6))) = uint8(':') v7 = iout iout++ *(*uint8)(unsafe.Pointer(buffer + uintptr(v7))) = uint8(' ') for iin < libc.Int32FromInt32(PNG_MAX_ERROR_TEXT)-libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(error_message + uintptr(iin)))) != int32('\000') { v8 = iout iout++ v9 = iin iin++ *(*uint8)(unsafe.Pointer(buffer + uintptr(v8))) = *(*uint8)(unsafe.Pointer(error_message + uintptr(v9))) } /* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */ *(*uint8)(unsafe.Pointer(buffer + uintptr(iout))) = uint8('\000') } } func Xpng_chunk_error(tls *libc.TLS, png_ptr Tpng_const_structrp, error_message Tpng_const_charp) { bp := tls.Alloc(224) defer tls.Free(224) var _ /* msg at bp+0 */ [214]uint8 if png_ptr == libc.UintptrFromInt32(0) { Xpng_error(tls, png_ptr, error_message) } else { _png_format_buffer(tls, png_ptr, bp, error_message) Xpng_error(tls, png_ptr, bp) } } func Xpng_chunk_warning(tls *libc.TLS, png_ptr Tpng_const_structrp, warning_message Tpng_const_charp) { bp := tls.Alloc(224) defer tls.Free(224) var _ /* msg at bp+0 */ [214]uint8 if png_ptr == libc.UintptrFromInt32(0) { Xpng_warning(tls, png_ptr, warning_message) } else { _png_format_buffer(tls, png_ptr, bp, warning_message) Xpng_warning(tls, png_ptr, bp) } } func Xpng_chunk_benign_error(tls *libc.TLS, png_ptr Tpng_const_structrp, error_message Tpng_const_charp) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x100000) != uint32(0) { Xpng_chunk_warning(tls, png_ptr, error_message) } else { Xpng_chunk_error(tls, png_ptr, error_message) } } func Xpng_chunk_report(tls *libc.TLS, png_ptr Tpng_const_structrp, message Tpng_const_charp, error1 int32) { /* This is always supported, but for just read or just write it * unconditionally does the right thing. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x8000) != uint32(0) { if error1 < int32(PNG_CHUNK_ERROR) { Xpng_chunk_warning(tls, png_ptr, message) } else { Xpng_chunk_benign_error(tls, png_ptr, message) } } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x8000) == uint32(0) { if error1 < int32(PNG_CHUNK_WRITE_ERROR) { Xpng_app_warning(tls, png_ptr, message) } else { Xpng_app_error(tls, png_ptr, message) } } } } func Xpng_fixed_error(tls *libc.TLS, png_ptr Tpng_const_structrp, name Tpng_const_charp) { bp := tls.Alloc(224) defer tls.Free(224) var iin uint32 var _ /* msg at bp+0 */ [220]uint8 _ = iin libc.Xmemcpy(tls, bp, __ccgo_ts+9420, libc.Uint32FromInt64(25)-libc.Uint32FromInt32(1)) iin = uint32(0) if name != libc.UintptrFromInt32(0) { for iin < libc.Uint32FromInt32(libc.Int32FromInt32(PNG_MAX_ERROR_TEXT)-libc.Int32FromInt32(1)) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(name + uintptr(iin)))) != 0 { (*(*[220]uint8)(unsafe.Pointer(bp)))[libc.Uint32FromInt64(25)-libc.Uint32FromInt32(1)+iin] = *(*uint8)(unsafe.Pointer(name + uintptr(iin))) iin++ } } (*(*[220]uint8)(unsafe.Pointer(bp)))[libc.Uint32FromInt64(25)-libc.Uint32FromInt32(1)+iin] = uint8(0) Xpng_error(tls, png_ptr, bp) } // C documentation // // /* This API only exists if ANSI-C style error handling is used, // * otherwise it is necessary for png_default_error to be overridden. // */ func Xpng_set_longjmp_fn(tls *libc.TLS, png_ptr Tpng_structrp, longjmp_fn Tpng_longjmp_ptr, jmp_buf_size Tsize_t) (r uintptr) { var size Tsize_t _ = size /* From libpng 1.6.0 the app gets one chance to set a 'jmpbuf_size' value * and it must not change after that. Libpng doesn't care how big the * buffer is, just that it doesn't change. * * If the buffer size is no *larger* than the size of jmp_buf when libpng is * compiled a built in jmp_buf is returned; this preserves the pre-1.6.0 * semantics that this call will not fail. If the size is larger, however, * the buffer is allocated and this may fail, causing the function to return * NULL. */ if png_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr == libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_size = uint32(0) /* not allocated */ if jmp_buf_size <= libc.Uint32FromInt64(392) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr = png_ptr } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr = Xpng_malloc_warn(tls, png_ptr, jmp_buf_size) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } /* new NULL return on OOM */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_size = jmp_buf_size } } else { /* Already allocated: check the size */ size = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_size if size == uint32(0) { size = libc.Uint32FromInt64(392) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr != png_ptr { /* This is an internal error in libpng: somehow we have been left * with a stack allocated jmp_buf when the application regained * control. It's always possible to fix this up, but for the moment * this is a png_error because that makes it easy to detect. */ Xpng_error(tls, png_ptr, __ccgo_ts+9445) /* png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local; */ } } if size != jmp_buf_size { Xpng_warning(tls, png_ptr, __ccgo_ts+9476) return libc.UintptrFromInt32(0) /* caller will probably crash: no choice here */ } } /* Finally fill in the function, now we have a satisfactory buffer. It is * valid to change the function on every call. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Flongjmp_fn = longjmp_fn return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr } func Xpng_free_jmpbuf(tls *libc.TLS, png_ptr Tpng_structrp) { bp := tls.Alloc(400) defer tls.Free(400) var jb, v1 uintptr var _ /* free_jmp_buf at bp+0 */ Tjmp_buf _, _ = jb, v1 if png_ptr != libc.UintptrFromInt32(0) { jb = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr /* A size of 0 is used to indicate a local, stack, allocation of the * pointer; used here and in png.c */ if jb != libc.UintptrFromInt32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_size > uint32(0) { /* This stuff is so that a failure to free the error control structure * does not leave libpng in a state with no valid error handling: the * free always succeeds, if there is an error it gets ignored. */ if jb != png_ptr { v1 = bp tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: default: tls.PopJumpBuffer(v1) } }() { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr = bp /* come back here */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_size = uint32(0) /* stack allocation */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Flongjmp_fn = __ccgo_fp(libc.Xlongjmp) Xpng_free(tls, png_ptr, jb) /* Return to setjmp on error */ } } } /* *Always* cancel everything out: */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_size = uint32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr = libc.UintptrFromInt32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Flongjmp_fn = uintptr(0) } } // C documentation // // /* This is the default error handling function. Note that replacements for // * this function MUST NOT RETURN, or the program will likely crash. This // * function is used by default, or if the program supplies NULL for the // * error function pointer in png_set_error_fn(). // */ func _png_default_error(tls *libc.TLS, png_ptr Tpng_const_structrp, error_message Tpng_const_charp) { bp := tls.Alloc(16) defer tls.Free(16) var v1 Tpng_const_charp _ = v1 if error_message != 0 { v1 = error_message } else { v1 = __ccgo_ts + 9509 } libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+9519, libc.VaList(bp+8, v1)) libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+165, 0) Xpng_longjmp(tls, png_ptr, int32(1)) } func Xpng_longjmp(tls *libc.TLS, png_ptr Tpng_const_structrp, val int32) { if png_ptr != libc.UintptrFromInt32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Flongjmp_fn != libc.UintptrFromInt32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Flongjmp_fn})))(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fjmp_buf_ptr, val) } /* If control reaches this point, png_longjmp() must not return. The only * choice is to terminate the whole process (or maybe the thread); to do * this the ANSI-C abort() function is used unless a different method is * implemented by overriding the default configuration setting for * PNG_ABORT(). */ libc.Xabort(tls) } // C documentation // // /* This function is called when there is a warning, but the library thinks // * it can continue anyway. Replacement functions don't have to do anything // * here if you don't want them to. In the default configuration, png_ptr is // * not used, but it is passed in case it may be useful. // */ func _png_default_warning(tls *libc.TLS, png_ptr Tpng_const_structrp, warning_message Tpng_const_charp) { bp := tls.Alloc(16) defer tls.Free(16) libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+9536, libc.VaList(bp+8, warning_message)) libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+165, 0) _ = png_ptr /* Make compiler happy */ } // C documentation // // /* This function is called when the application wants to use another method // * of handling errors and warnings. Note that the error function MUST NOT // * return to the calling routine or serious problems will occur. The return // * method used in the default routine calls longjmp(png_ptr->jmp_buf_ptr, 1) // */ func Xpng_set_error_fn(tls *libc.TLS, png_ptr Tpng_structrp, error_ptr Tpng_voidp, error_fn Tpng_error_ptr, warning_fn Tpng_error_ptr) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ferror_ptr = error_ptr (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ferror_fn = error_fn (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwarning_fn = warning_fn } // C documentation // // /* This function returns a pointer to the error_ptr associated with the user // * functions. The application should free any memory associated with this // * pointer before png_write_destroy and png_read_destroy are called. // */ func Xpng_get_error_ptr(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_voidp) { if png_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ferror_ptr } // C documentation // // /* Currently the above both depend on SETJMP_SUPPORTED, however it would be // * possible to implement without setjmp support just so long as there is some // * way to handle the error return here: // */ func Xpng_safe_error(tls *libc.TLS, png_nonconst_ptr Tpng_structp, error_message Tpng_const_charp) { var image Tpng_imagep var png_ptr Tpng_const_structrp var pos Tsize_t _, _, _ = image, png_ptr, pos png_ptr = png_nonconst_ptr image = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ferror_ptr /* An error is always logged here, overwriting anything (typically a warning) * that is already there: */ if image != libc.UintptrFromInt32(0) { Xpng_safecat(tls, image+32, libc.Uint32FromInt64(64), uint32(0), error_message) *(*Tpng_uint_32)(unsafe.Pointer(image + 28)) |= uint32(PNG_IMAGE_ERROR) /* Retrieve the jmp_buf from within the png_control, making this work for * C++ compilation too is pretty tricky: C++ wants a pointer to the first * element of a jmp_buf, but C doesn't tell us the type of that. */ if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque != libc.UintptrFromInt32(0) && (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Ferror_buf != libc.UintptrFromInt32(0) { tls.Longjmp((*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Ferror_buf, libc.Int32FromInt32(1)) } /* Missing longjmp buffer, the following is to help debugging: */ pos = Xpng_safecat(tls, image+32, libc.Uint32FromInt64(64), uint32(0), __ccgo_ts+9555) Xpng_safecat(tls, image+32, libc.Uint32FromInt64(64), pos, error_message) } /* Here on an internal programming error. */ libc.Xabort(tls) } func Xpng_safe_warning(tls *libc.TLS, png_nonconst_ptr Tpng_structp, warning_message Tpng_const_charp) { var image Tpng_imagep var png_ptr Tpng_const_structrp _, _ = image, png_ptr png_ptr = png_nonconst_ptr image = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ferror_ptr /* A warning is only logged if there is no prior warning or error. */ if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwarning_or_error == uint32(0) { Xpng_safecat(tls, image+32, libc.Uint32FromInt64(64), uint32(0), warning_message) *(*Tpng_uint_32)(unsafe.Pointer(image + 28)) |= uint32(PNG_IMAGE_WARNING) } } func Xpng_safe_execute(tls *libc.TLS, image Tpng_imagep, function uintptr, arg Tpng_voidp) (r int32) { bp := tls.Alloc(400) defer tls.Free(400) var result int32 var saved_error_buf Tpng_voidp var v1 uintptr var _ /* safe_jmpbuf at bp+0 */ Tjmp_buf _, _, _ = result, saved_error_buf, v1 saved_error_buf = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Ferror_buf /* Safely execute function(arg), with png_error returning back here. */ v1 = bp tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: default: tls.PopJumpBuffer(v1) } }() { (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Ferror_buf = bp result = (*(*func(*libc.TLS, Tpng_voidp) int32)(unsafe.Pointer(&struct{ uintptr }{function})))(tls, arg) (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Ferror_buf = saved_error_buf return result } /* On png_error, return via longjmp, pop the jmpbuf, and free the image. */ (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Ferror_buf = saved_error_buf Xpng_image_free(tls, image) return 0 } const PNG_COLORSPACE_HAVE_ENDPOINTS1 = 2 const PNG_COLORSPACE_HAVE_GAMMA1 = 1 const PNG_FLAG_APP_ERRORS_WARN2 = 0x400000 const PNG_FLAG_APP_WARNINGS_WARN2 = 0x200000 const PNG_FLAG_BENIGN_ERRORS_WARN2 = 0x100000 const PNG_INFO_PLTE1 = 8 const PNG_INFO_bKGD1 = 32 const PNG_INFO_cHRM1 = 4 const PNG_INFO_eXIf1 = 65536 const PNG_INFO_gAMA1 = 1 const PNG_INFO_hIST1 = 64 const PNG_INFO_iCCP1 = 4096 const PNG_INFO_oFFs1 = 256 const PNG_INFO_pCAL1 = 1024 const PNG_INFO_pHYs1 = 128 const PNG_INFO_sBIT1 = 2 const PNG_INFO_sCAL1 = 16384 const PNG_INFO_sRGB1 = 2048 const PNG_INFO_tIME1 = 512 const PNG_INFO_tRNS1 = 16 const PNG_LITERAL_LEFT_SQUARE_BRACKET2 = 0x5b const PNG_LITERAL_RIGHT_SQUARE_BRACKET2 = 0x5d const PNG_LITERAL_SHARP2 = 0x23 const PNG_STRING_NEWLINE2 = "\\n" /* Maintainer: Put new private prototypes here ^ */ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. * * png_debug[1-2]?(level, message ,arg{0-2}) * Expands to a statement (either a simple expression or a compound * do..while(0) statement) that outputs a message with parameter * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG * is undefined, 0 or 1 every png_debug expands to a simple expression * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added * to the message. * arg: 0 to 2 arguments for printf(3) style substitution in message. */ /* These settings control the formatting of messages in png.c and pngerror.c */ /* Moved to pngdebug.h at 1.5.0 */ func Xpng_get_valid(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp, flag Tpng_uint_32) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { /* png_handle_PLTE() may have canceled a valid tRNS chunk but left the * 'valid' flag for the detection of duplicate chunks. Do not report a * valid tRNS chunk in this case. */ if flag == uint32(0x0010) && libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) == 0 { return uint32(0) } return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid & flag } return uint32(0) } func Xpng_get_rowbytes(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tsize_t) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Frowbytes } return uint32(0) } func Xpng_get_rows(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_bytepp) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers } return uintptr(0) } // C documentation // // /* Easy access to info, added in libpng-0.99 */ func Xpng_get_image_width(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fwidth } return uint32(0) } func Xpng_get_image_height(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fheight } return uint32(0) } func Xpng_get_bit_depth(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_byte) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth } return uint8(0) } func Xpng_get_color_type(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_byte) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type } return uint8(0) } func Xpng_get_filter_type(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_byte) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Ffilter_type } return uint8(0) } func Xpng_get_interlace_type(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_byte) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Finterlace_type } return uint8(0) } func Xpng_get_compression_type(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_byte) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcompression_type } return uint8(0) } func Xpng_get_x_pixels_per_meter(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0080) != uint32(0) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fphys_unit_type) == int32(PNG_RESOLUTION_METER) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit } } return uint32(0) } func Xpng_get_y_pixels_per_meter(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0080) != uint32(0) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fphys_unit_type) == int32(PNG_RESOLUTION_METER) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_pixels_per_unit } } return uint32(0) } func Xpng_get_pixels_per_meter(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0080) != uint32(0) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fphys_unit_type) == int32(PNG_RESOLUTION_METER) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit == (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_pixels_per_unit { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit } } return uint32(0) } func Xpng_get_pixel_aspect_ratio(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r float32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0080) != uint32(0) { if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit != uint32(0) { return float32((*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_pixels_per_unit) / float32((*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit) } } return libc.Float32FromFloat64(0) } func Xpng_get_pixel_aspect_ratio_fixed(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_fixed_point) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* res at bp+0 */ Tpng_fixed_point if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0080) != uint32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit > uint32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_pixels_per_unit > uint32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit <= libc.Uint32FromInt32(0x7fffffff) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_pixels_per_unit <= libc.Uint32FromInt32(0x7fffffff) { /* The following casts work because a PNG 4 byte integer only has a valid * range of 0..2^31-1; otherwise the cast might overflow. */ if Xpng_muldiv(tls, bp, libc.Int32FromUint32((*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_pixels_per_unit), int32(PNG_FP_1), libc.Int32FromUint32((*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit)) != 0 { return *(*Tpng_fixed_point)(unsafe.Pointer(bp)) } } return 0 } func Xpng_get_x_offset_microns(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_int_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0100) != uint32(0) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Foffset_unit_type) == int32(PNG_OFFSET_MICROMETER) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_offset } } return 0 } func Xpng_get_y_offset_microns(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_int_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0100) != uint32(0) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Foffset_unit_type) == int32(PNG_OFFSET_MICROMETER) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_offset } } return 0 } func Xpng_get_x_offset_pixels(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_int_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0100) != uint32(0) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Foffset_unit_type) == PNG_OFFSET_PIXEL { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_offset } } return 0 } func Xpng_get_y_offset_pixels(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_int_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0100) != uint32(0) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Foffset_unit_type) == PNG_OFFSET_PIXEL { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_offset } } return 0 } func _ppi_from_ppm(tls *libc.TLS, ppm Tpng_uint_32) (r Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* result at bp+0 */ Tpng_fixed_point if ppm <= libc.Uint32FromInt32(0x7fffffff) && Xpng_muldiv(tls, bp, libc.Int32FromUint32(ppm), int32(127), int32(5000)) != 0 { return libc.Uint32FromInt32(*(*Tpng_fixed_point)(unsafe.Pointer(bp))) } /* Overflow. */ return uint32(0) } func Xpng_get_pixels_per_inch(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_uint_32) { return _ppi_from_ppm(tls, Xpng_get_pixels_per_meter(tls, png_ptr, info_ptr)) } func Xpng_get_x_pixels_per_inch(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_uint_32) { return _ppi_from_ppm(tls, Xpng_get_x_pixels_per_meter(tls, png_ptr, info_ptr)) } func Xpng_get_y_pixels_per_inch(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_uint_32) { return _ppi_from_ppm(tls, Xpng_get_y_pixels_per_meter(tls, png_ptr, info_ptr)) } func _png_fixed_inches_from_microns(tls *libc.TLS, png_ptr Tpng_const_structrp, microns Tpng_int_32) (r Tpng_fixed_point) { /* Convert from meters * 1,000,000 to inches * 100,000, meters to * inches is simply *(100/2.54), so we want *(10/2.54) == 500/127. * Notice that this can overflow - a warning is output and 0 is * returned. */ return Xpng_muldiv_warn(tls, png_ptr, microns, int32(500), int32(127)) } func Xpng_get_x_offset_inches_fixed(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_fixed_point) { return _png_fixed_inches_from_microns(tls, png_ptr, Xpng_get_x_offset_microns(tls, png_ptr, info_ptr)) } func Xpng_get_y_offset_inches_fixed(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_fixed_point) { return _png_fixed_inches_from_microns(tls, png_ptr, Xpng_get_y_offset_microns(tls, png_ptr, info_ptr)) } func Xpng_get_x_offset_inches(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r float32) { /* To avoid the overflow do the conversion directly in floating * point. */ return float32(float64(Xpng_get_x_offset_microns(tls, png_ptr, info_ptr)) * libc.Float64FromFloat64(3.937e-05)) } func Xpng_get_y_offset_inches(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r float32) { /* To avoid the overflow do the conversion directly in floating * point. */ return float32(float64(Xpng_get_y_offset_microns(tls, png_ptr, info_ptr)) * libc.Float64FromFloat64(3.937e-05)) } func Xpng_get_pHYs_dpi(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp, res_x uintptr, res_y uintptr, unit_type uintptr) (r Tpng_uint_32) { var retval Tpng_uint_32 _ = retval retval = uint32(0) if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0080) != uint32(0) { if res_x != libc.UintptrFromInt32(0) { *(*Tpng_uint_32)(unsafe.Pointer(res_x)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit retval |= uint32(0x0080) } if res_y != libc.UintptrFromInt32(0) { *(*Tpng_uint_32)(unsafe.Pointer(res_y)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_pixels_per_unit retval |= uint32(0x0080) } if unit_type != libc.UintptrFromInt32(0) { *(*int32)(unsafe.Pointer(unit_type)) = libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fphys_unit_type) retval |= uint32(0x0080) if *(*int32)(unsafe.Pointer(unit_type)) == int32(1) { if res_x != libc.UintptrFromInt32(0) { *(*Tpng_uint_32)(unsafe.Pointer(res_x)) = uint32(float64(*(*Tpng_uint_32)(unsafe.Pointer(res_x)))*libc.Float64FromFloat64(0.0254) + libc.Float64FromFloat64(0.5)) } if res_y != libc.UintptrFromInt32(0) { *(*Tpng_uint_32)(unsafe.Pointer(res_y)) = uint32(float64(*(*Tpng_uint_32)(unsafe.Pointer(res_y)))*libc.Float64FromFloat64(0.0254) + libc.Float64FromFloat64(0.5)) } } } } return retval } /* png_get_channels really belongs in here, too, but it's been around longer */ func Xpng_get_channels(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_byte) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels } return uint8(0) } func Xpng_get_signature(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp) (r Tpng_const_bytep) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return info_ptr + 32 } return libc.UintptrFromInt32(0) } func Xpng_get_bKGD(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, background uintptr) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0020) != uint32(0) && background != libc.UintptrFromInt32(0) { *(*Tpng_color_16p)(unsafe.Pointer(background)) = info_ptr + 170 return uint32(0x0020) } return uint32(0) } // C documentation // // /* The XYZ APIs were added in 1.5.5 to take advantage of the code added at the // * same time to correct the rgb grayscale coefficient defaults obtained from the // * cHRM chunk in 1.5.4 // */ func Xpng_get_cHRM(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp, white_x uintptr, white_y uintptr, red_x uintptr, red_y uintptr, green_x uintptr, green_y uintptr, blue_x uintptr, blue_y uintptr) (r Tpng_uint_32) { /* Quiet API change: this code used to only return the end points if a cHRM * chunk was present, but the end points can also come from iCCP or sRGB * chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and * the png_set_ APIs merely check that set end points are mutually * consistent. */ if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_ENDPOINTS1) != 0 { if white_x != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(white_x)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fwhitex) } if white_y != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(white_y)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fwhitey) } if red_x != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(red_x)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fredx) } if red_y != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(red_y)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fredy) } if green_x != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(green_x)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fgreenx) } if green_y != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(green_y)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fgreeny) } if blue_x != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(blue_x)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fbluex) } if blue_y != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(blue_y)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fbluey) } return uint32(0x0004) } return uint32(0) } func Xpng_get_cHRM_XYZ(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp, red_X uintptr, red_Y uintptr, red_Z uintptr, green_X uintptr, green_Y uintptr, green_Z uintptr, blue_X uintptr, blue_Y uintptr, blue_Z uintptr) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_ENDPOINTS1) != 0 { if red_X != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(red_X)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fred_X) } if red_Y != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(red_Y)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fred_Y) } if red_Z != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(red_Z)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fred_Z) } if green_X != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(green_X)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fgreen_X) } if green_Y != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(green_Y)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fgreen_Y) } if green_Z != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(green_Z)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fgreen_Z) } if blue_X != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(blue_X)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fblue_X) } if blue_Y != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(blue_Y)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fblue_Y) } if blue_Z != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(blue_Z)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fblue_Z) } return uint32(0x0004) } return uint32(0) } func Xpng_get_cHRM_XYZ_fixed(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp, int_red_X uintptr, int_red_Y uintptr, int_red_Z uintptr, int_green_X uintptr, int_green_Y uintptr, int_green_Z uintptr, int_blue_X uintptr, int_blue_Y uintptr, int_blue_Z uintptr) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_ENDPOINTS1) != 0 { if int_red_X != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(int_red_X)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fred_X } if int_red_Y != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(int_red_Y)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fred_Y } if int_red_Z != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(int_red_Z)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fred_Z } if int_green_X != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(int_green_X)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fgreen_X } if int_green_Y != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(int_green_Y)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fgreen_Y } if int_green_Z != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(int_green_Z)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fgreen_Z } if int_blue_X != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(int_blue_X)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fblue_X } if int_blue_Y != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(int_blue_Y)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fblue_Y } if int_blue_Z != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(int_blue_Z)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_XYZ.Fblue_Z } return uint32(0x0004) } return uint32(0) } func Xpng_get_cHRM_fixed(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp, white_x uintptr, white_y uintptr, red_x uintptr, red_y uintptr, green_x uintptr, green_y uintptr, blue_x uintptr, blue_y uintptr) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_ENDPOINTS1) != 0 { if white_x != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(white_x)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fwhitex } if white_y != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(white_y)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fwhitey } if red_x != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(red_x)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fredx } if red_y != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(red_y)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fredy } if green_x != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(green_x)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fgreenx } if green_y != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(green_y)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fgreeny } if blue_x != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(blue_x)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fbluex } if blue_y != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(blue_y)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fend_points_xy.Fbluey } return uint32(0x0004) } return uint32(0) } func Xpng_get_gAMA_fixed(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp, file_gamma uintptr) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_GAMMA1) != 0 && file_gamma != libc.UintptrFromInt32(0) { *(*Tpng_fixed_point)(unsafe.Pointer(file_gamma)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fgamma return uint32(0x0001) } return uint32(0) } func Xpng_get_gAMA(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp, file_gamma uintptr) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_GAMMA1) != 0 && file_gamma != libc.UintptrFromInt32(0) { *(*float64)(unsafe.Pointer(file_gamma)) = float64(1e-05) * float64((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fgamma) return uint32(0x0001) } return uint32(0) } func Xpng_get_sRGB(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_const_inforp, file_srgb_intent uintptr) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0800) != uint32(0) && file_srgb_intent != libc.UintptrFromInt32(0) { *(*int32)(unsafe.Pointer(file_srgb_intent)) = libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Frendering_intent) return uint32(0x0800) } return uint32(0) } func Xpng_get_iCCP(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, name Tpng_charpp, compression_type uintptr, profile Tpng_bytepp, proflen uintptr) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x1000) != uint32(0) && name != libc.UintptrFromInt32(0) && profile != libc.UintptrFromInt32(0) && proflen != libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(name)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_name *(*uintptr)(unsafe.Pointer(profile)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_profile *(*Tpng_uint_32)(unsafe.Pointer(proflen)) = uint32(*(*Tpng_byte)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_profile)))< 0 { if text_ptr != libc.UintptrFromInt32(0) { *(*Tpng_textp)(unsafe.Pointer(text_ptr)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext } if num_text != libc.UintptrFromInt32(0) { *(*int32)(unsafe.Pointer(num_text)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_text } return (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_text } if num_text != libc.UintptrFromInt32(0) { *(*int32)(unsafe.Pointer(num_text)) = 0 } return 0 } func Xpng_get_tIME(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, mod_time uintptr) (r Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0200) != uint32(0) && mod_time != libc.UintptrFromInt32(0) { *(*Tpng_timep)(unsafe.Pointer(mod_time)) = info_ptr + 140 return uint32(0x0200) } return uint32(0) } func Xpng_get_tRNS(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, trans_alpha uintptr, num_trans uintptr, trans_color uintptr) (r Tpng_uint_32) { var retval Tpng_uint_32 _ = retval retval = uint32(0) if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0010) != uint32(0) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { if trans_alpha != libc.UintptrFromInt32(0) { *(*Tpng_bytep)(unsafe.Pointer(trans_alpha)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftrans_alpha retval |= uint32(0x0010) } if trans_color != libc.UintptrFromInt32(0) { *(*Tpng_color_16p)(unsafe.Pointer(trans_color)) = info_ptr + 160 } } else { /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */ if trans_color != libc.UintptrFromInt32(0) { *(*Tpng_color_16p)(unsafe.Pointer(trans_color)) = info_ptr + 160 retval |= uint32(0x0010) } if trans_alpha != libc.UintptrFromInt32(0) { *(*Tpng_bytep)(unsafe.Pointer(trans_alpha)) = libc.UintptrFromInt32(0) } } if num_trans != libc.UintptrFromInt32(0) { *(*int32)(unsafe.Pointer(num_trans)) = libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_trans) retval |= uint32(0x0010) } } return retval } func Xpng_get_unknown_chunks(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, unknowns Tpng_unknown_chunkpp) (r int32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && unknowns != libc.UintptrFromInt32(0) { *(*uintptr)(unsafe.Pointer(unknowns)) = (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks return (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks_num } return 0 } func Xpng_get_rgb_to_gray_status(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_byte) { var v1 int32 _ = v1 if png_ptr != 0 { v1 = libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_status) } else { v1 = 0 } return libc.Uint8FromInt32(v1) } func Xpng_get_user_chunk_ptr(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_voidp) { var v1 Tpng_voidp _ = v1 if png_ptr != 0 { v1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_ptr } else { v1 = libc.UintptrFromInt32(0) } return v1 } func Xpng_get_compression_buffer_size(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tsize_t) { if png_ptr == libc.UintptrFromInt32(0) { return uint32(0) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x8000) != uint32(0) { return (*Tpng_struct)(unsafe.Pointer(png_ptr)).FIDAT_read_size } else { return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_size } return r } // C documentation // // /* These functions were added to libpng 1.2.6 and were enabled // * by default in libpng-1.4.0 */ func Xpng_get_user_width_max(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_uint_32) { var v1 uint32 _ = v1 if png_ptr != 0 { v1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_width_max } else { v1 = uint32(0) } return v1 } func Xpng_get_user_height_max(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_uint_32) { var v1 uint32 _ = v1 if png_ptr != 0 { v1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_height_max } else { v1 = uint32(0) } return v1 } // C documentation // // /* This function was added to libpng 1.4.0 */ func Xpng_get_chunk_cache_max(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_uint_32) { var v1 uint32 _ = v1 if png_ptr != 0 { v1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max } else { v1 = uint32(0) } return v1 } // C documentation // // /* This function was added to libpng 1.4.1 */ func Xpng_get_chunk_malloc_max(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_alloc_size_t) { var v1 uint32 _ = v1 if png_ptr != 0 { v1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max } else { v1 = uint32(0) } return v1 } // C documentation // // /* These functions were added to libpng 1.4.0 */ func Xpng_get_io_state(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_uint_32) { return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_state } func Xpng_get_io_chunk_type(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_uint_32) { return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name } func Xpng_get_palette_max(tls *libc.TLS, png_ptr Tpng_const_structp, info_ptr Tpng_const_infop) (r int32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max } return -int32(1) } const INT_MAX1 = 2147483647 const PNG_COLORSPACE_HAVE_ENDPOINTS2 = 0x0002 const PNG_COLORSPACE_HAVE_GAMMA2 = 0x0001 const PNG_INFO_PLTE2 = 0x0008 const PNG_INFO_bKGD2 = 0x0020 const PNG_INFO_cHRM2 = 0x0004 const PNG_INFO_eXIf2 = 0x10000 const PNG_INFO_gAMA2 = 0x0001 const PNG_INFO_hIST2 = 0x0040 const PNG_INFO_iCCP2 = 0x1000 const PNG_INFO_oFFs2 = 0x0100 const PNG_INFO_pCAL2 = 0x0400 const PNG_INFO_pHYs2 = 0x0080 const PNG_INFO_sBIT2 = 0x0002 const PNG_INFO_sCAL2 = 0x4000 const PNG_INFO_sRGB2 = 0x0800 const PNG_INFO_tIME2 = 0x0200 const PNG_INFO_tRNS2 = 0x0010 const PNG_IS_READ_STRUCT2 = 0x8000 /* Maintainer: Put new private prototypes here ^ */ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. * * png_debug[1-2]?(level, message ,arg{0-2}) * Expands to a statement (either a simple expression or a compound * do..while(0) statement) that outputs a message with parameter * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG * is undefined, 0 or 1 every png_debug expands to a simple expression * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added * to the message. * arg: 0 to 2 arguments for printf(3) style substitution in message. */ /* These settings control the formatting of messages in png.c and pngerror.c */ /* Moved to pngdebug.h at 1.5.0 */ // C documentation // // /* Free a png_struct */ func Xpng_destroy_png_struct(tls *libc.TLS, png_ptr Tpng_structrp) { bp := tls.Alloc(1120) defer tls.Free(1120) var _ /* dummy_struct at bp+0 */ Tpng_struct if png_ptr != libc.UintptrFromInt32(0) { /* png_free might call png_error and may certainly call * png_get_mem_ptr, so fake a temporary png_struct to support this. */ *(*Tpng_struct)(unsafe.Pointer(bp)) = *(*Tpng_struct)(unsafe.Pointer(png_ptr)) libc.Xmemset(tls, png_ptr, 0, libc.Uint32FromInt64(1120)) Xpng_free(tls, bp, png_ptr) /* We may have a jmp_buf left to deallocate. */ Xpng_free_jmpbuf(tls, bp) } } // C documentation // // /* Allocate memory. For reasonable files, size should never exceed // * 64K. However, zlib may allocate more than 64K if you don't tell // * it not to. See zconf.h and png.h for more information. zlib does // * need to allocate exactly 64K, so whatever you call here must // * have the ability to do that. // */ func Xpng_calloc(tls *libc.TLS, png_ptr Tpng_const_structrp, size Tpng_alloc_size_t) (r Tpng_voidp) { var ret Tpng_voidp _ = ret ret = Xpng_malloc(tls, png_ptr, size) if ret != libc.UintptrFromInt32(0) { libc.Xmemset(tls, ret, 0, size) } return ret } // C documentation // // /* png_malloc_base, an internal function added at libpng 1.6.0, does the work of // * allocating memory, taking into account limits and PNG_USER_MEM_SUPPORTED. // * Checking and error handling must happen outside this routine; it returns NULL // * if the allocation cannot be done (for any reason.) // */ func Xpng_malloc_base(tls *libc.TLS, png_ptr Tpng_const_structrp, size Tpng_alloc_size_t) (r Tpng_voidp) { /* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS * allocators have also been removed in 1.6.0, so any 16-bit system now has * to implement a user memory handler. This checks to be sure it isn't * called with big numbers. */ /* Some compilers complain that this is always true. However, it * can be false when integer overflow happens. */ if size > uint32(0) && size <= libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { if png_ptr != libc.UintptrFromInt32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmalloc_fn != libc.UintptrFromInt32(0) { return (*(*func(*libc.TLS, Tpng_structp, Tpng_alloc_size_t) Tpng_voidp)(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmalloc_fn})))(tls, png_ptr, size) } else { return libc.Xmalloc(tls, size) } /* checked for truncation above */ } else { return libc.UintptrFromInt32(0) } return r } // C documentation // // /* This is really here only to work round a spurious warning in GCC 4.6 and 4.7 // * that arises because of the checks in png_realloc_array that are repeated in // * png_malloc_array. // */ func _png_malloc_array_checked(tls *libc.TLS, png_ptr Tpng_const_structrp, nelements int32, element_size Tsize_t) (r Tpng_voidp) { var req Tpng_alloc_size_t _ = req req = libc.Uint32FromInt32(nelements) /* known to be > 0 */ if req <= libc.Uint32FromInt32(-libc.Int32FromInt32(1))/element_size { return Xpng_malloc_base(tls, png_ptr, req*element_size) } /* The failure case when the request is too large */ return libc.UintptrFromInt32(0) } func Xpng_malloc_array(tls *libc.TLS, png_ptr Tpng_const_structrp, nelements int32, element_size Tsize_t) (r Tpng_voidp) { if nelements <= 0 || element_size == uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+9639) } return _png_malloc_array_checked(tls, png_ptr, nelements, element_size) } func Xpng_realloc_array(tls *libc.TLS, png_ptr Tpng_const_structrp, old_array Tpng_const_voidp, old_elements int32, add_elements int32, element_size Tsize_t) (r Tpng_voidp) { var new_array Tpng_voidp _ = new_array /* These are internal errors: */ if add_elements <= 0 || element_size == uint32(0) || old_elements < 0 || old_array == libc.UintptrFromInt32(0) && old_elements > 0 { Xpng_error(tls, png_ptr, __ccgo_ts+9667) } /* Check for overflow on the elements count (so the caller does not have to * check.) */ if add_elements <= int32(INT_MAX1)-old_elements { new_array = _png_malloc_array_checked(tls, png_ptr, old_elements+add_elements, element_size) if new_array != libc.UintptrFromInt32(0) { /* Because png_malloc_array worked the size calculations below cannot * overflow. */ if old_elements > 0 { libc.Xmemcpy(tls, new_array, old_array, element_size*libc.Uint32FromInt32(old_elements)) } libc.Xmemset(tls, new_array+uintptr(element_size*libc.Uint32FromInt32(old_elements)), 0, element_size*libc.Uint32FromInt32(add_elements)) return new_array } } return libc.UintptrFromInt32(0) /* error */ } // C documentation // // /* Various functions that have different error handling are derived from this. // * png_malloc always exists, but if PNG_USER_MEM_SUPPORTED is defined a separate // * function png_malloc_default is also provided. // */ func Xpng_malloc(tls *libc.TLS, png_ptr Tpng_const_structrp, size Tpng_alloc_size_t) (r Tpng_voidp) { var ret Tpng_voidp _ = ret if png_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } ret = Xpng_malloc_base(tls, png_ptr, size) if ret == libc.UintptrFromInt32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+9697) } /* 'm' means png_malloc */ return ret } func Xpng_malloc_default(tls *libc.TLS, png_ptr Tpng_const_structrp, size Tpng_alloc_size_t) (r Tpng_voidp) { var ret Tpng_voidp _ = ret if png_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } /* Passing 'NULL' here bypasses the application provided memory handler. */ ret = Xpng_malloc_base(tls, libc.UintptrFromInt32(0), size) if ret == libc.UintptrFromInt32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+9711) } /* 'M' means png_malloc_default */ return ret } // C documentation // // /* This function was added at libpng version 1.2.3. The png_malloc_warn() // * function will issue a png_warning and return NULL instead of issuing a // * png_error, if it fails to allocate the requested memory. // */ func Xpng_malloc_warn(tls *libc.TLS, png_ptr Tpng_const_structrp, size Tpng_alloc_size_t) (r Tpng_voidp) { var ret Tpng_voidp _ = ret if png_ptr != libc.UintptrFromInt32(0) { ret = Xpng_malloc_base(tls, png_ptr, size) if ret != libc.UintptrFromInt32(0) { return ret } Xpng_warning(tls, png_ptr, __ccgo_ts+9697) } return libc.UintptrFromInt32(0) } // C documentation // // /* Free a pointer allocated by png_malloc(). If ptr is NULL, return // * without taking any action. // */ func Xpng_free(tls *libc.TLS, png_ptr Tpng_const_structrp, ptr Tpng_voidp) { if png_ptr == libc.UintptrFromInt32(0) || ptr == libc.UintptrFromInt32(0) { return } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ffree_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_voidp))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Ffree_fn})))(tls, png_ptr, ptr) } else { Xpng_free_default(tls, png_ptr, ptr) } } func Xpng_free_default(tls *libc.TLS, png_ptr Tpng_const_structrp, ptr Tpng_voidp) { if png_ptr == libc.UintptrFromInt32(0) || ptr == libc.UintptrFromInt32(0) { return } libc.Xfree(tls, ptr) } // C documentation // // /* This function is called when the application wants to use another method // * of allocating and freeing memory. // */ func Xpng_set_mem_fn(tls *libc.TLS, png_ptr Tpng_structrp, mem_ptr Tpng_voidp, malloc_fn Tpng_malloc_ptr, free_fn Tpng_free_ptr) { if png_ptr != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmem_ptr = mem_ptr (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmalloc_fn = malloc_fn (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ffree_fn = free_fn } } // C documentation // // /* This function returns a pointer to the mem_ptr associated with the user // * functions. The application should free any memory associated with this // * pointer before png_write_destroy and png_read_destroy are called. // */ func Xpng_get_mem_ptr(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_voidp) { if png_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmem_ptr } const DBL_MAX2 = 1.7976931348623157e+308 const DBL_MIN1 = 2.2250738585072014e-308 const INT_MAX2 = 0x7fffffff const PNG_16_TO_81 = 1024 const PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB1 = 64 const PNG_COLORSPACE_FROM_gAMA1 = 8 const PNG_COLORSPACE_FROM_sRGB1 = 32 const PNG_COLORSPACE_HAVE_ENDPOINTS3 = 2 const PNG_COLORSPACE_HAVE_GAMMA3 = 1 const PNG_COLORSPACE_HAVE_INTENT1 = 4 const PNG_COLORSPACE_INVALID1 = 32768 const PNG_COLORSPACE_MATCHES_sRGB1 = 128 const PNG_COMPOSE1 = 128 const PNG_FLAG_CRC_ANCILLARY_NOWARN1 = 512 const PNG_FLAG_CRC_ANCILLARY_USE1 = 256 const PNG_FLAG_CRC_CRITICAL_IGNORE1 = 2048 const PNG_FLAG_LIBRARY_MISMATCH1 = 131072 const PNG_FLAG_MNG_FILTER_641 = 4 const PNG_FREE_ALL1 = 65535 const PNG_FREE_EXIF1 = 32768 const PNG_FREE_HIST1 = 8 const PNG_FREE_ICCP1 = 16 const PNG_FREE_MUL1 = 16928 const PNG_FREE_PCAL1 = 128 const PNG_FREE_PLTE1 = 4096 const PNG_FREE_ROWS1 = 64 const PNG_FREE_SCAL1 = 256 const PNG_FREE_SPLT1 = 32 const PNG_FREE_TEXT1 = 16384 const PNG_FREE_TRNS1 = 8192 const PNG_FREE_UNKN1 = 512 const PNG_HAVE_PNG_SIGNATURE1 = 4096 const PNG_INFO_IDAT1 = 32768 const PNG_INFO_PLTE3 = 8 const PNG_INFO_cHRM3 = 4 const PNG_INFO_eXIf3 = 65536 const PNG_INFO_gAMA3 = 1 const PNG_INFO_hIST3 = 64 const PNG_INFO_iCCP3 = 4096 const PNG_INFO_pCAL3 = 1024 const PNG_INFO_sCAL3 = 16384 const PNG_INFO_sPLT1 = 8192 const PNG_INFO_sRGB3 = 2048 const PNG_INFO_tRNS3 = 16 const PNG_IS_READ_STRUCT3 = 32768 const PNG_RGB_TO_GRAY1 = 6291456 const PNG_SCALE_16_TO_81 = 67108864 const PNG_STRING_NEWLINE3 = "\nlibpng version 1.6.44\nCopyright (c) 2018-2024 Cosmin Truta\nCopyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson\nCopyright (c) 1996-1997 Andreas Dilger\nCopyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n" /* Maintainer: Put new private prototypes here ^ */ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. * * png_debug[1-2]?(level, message ,arg{0-2}) * Expands to a statement (either a simple expression or a compound * do..while(0) statement) that outputs a message with parameter * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG * is undefined, 0 or 1 every png_debug expands to a simple expression * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added * to the message. * arg: 0 to 2 arguments for printf(3) style substitution in message. */ /* These settings control the formatting of messages in png.c and pngerror.c */ /* Moved to pngdebug.h at 1.5.0 */ // C documentation // // /* Generate a compiler error if there is an old png.h in the search path. */ type TYour_png_h_is_not_version_1_6_44 = uintptr /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another * stream we can set num_bytes = 8 so that libpng will not attempt to read * or write any of the magic bytes before it starts on the IHDR. */ func Xpng_set_sig_bytes(tls *libc.TLS, png_ptr Tpng_structrp, num_bytes int32) { var nb uint32 _ = nb nb = libc.Uint32FromInt32(num_bytes) if png_ptr == libc.UintptrFromInt32(0) { return } if num_bytes < 0 { nb = uint32(0) } if nb > uint32(8) { Xpng_error(tls, png_ptr, __ccgo_ts+9725) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bytes = uint8(nb) } // C documentation // // /* Checks whether the supplied bytes match the PNG signature. We allow // * checking less than the full 8-byte signature so that those apps that // * already read the first few bytes of a file to determine the file type // * can simply check the remaining bytes for extra assurance. Returns // * an integer less than, equal to, or greater than zero if sig is found, // * respectively, to be less than, to match, or be greater than the correct // * PNG signature (this is the same behavior as strcmp, memcmp, etc). // */ func Xpng_sig_cmp(tls *libc.TLS, sig Tpng_const_bytep, start Tsize_t, num_to_check Tsize_t) (r int32) { if num_to_check > uint32(8) { num_to_check = uint32(8) } else { if num_to_check < uint32(1) { return -int32(1) } } if start > uint32(7) { return -int32(1) } if start+num_to_check > uint32(8) { num_to_check = uint32(8) - start } return libc.Xmemcmp(tls, sig+uintptr(start), uintptr(unsafe.Pointer(&_png_signature))+uintptr(start), num_to_check) } var _png_signature = [8]Tpng_byte{ 0: uint8(137), 1: uint8(80), 2: uint8(78), 3: uint8(71), 4: uint8(13), 5: uint8(10), 6: uint8(26), 7: uint8(10), } // C documentation // // /* Function to allocate memory for zlib */ func Xpng_zalloc(tls *libc.TLS, png_ptr Tvoidpf, items TuInt, size TuInt) (r Tvoidpf) { var num_bytes Tpng_alloc_size_t _ = num_bytes num_bytes = size if png_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } if items >= ^libc.Uint32FromInt32(0)/size { Xpng_warning(tls, png_ptr, __ccgo_ts+9758) return libc.UintptrFromInt32(0) } num_bytes *= items return Xpng_malloc_warn(tls, png_ptr, num_bytes) } // C documentation // // /* Function to free memory for zlib */ func Xpng_zfree(tls *libc.TLS, png_ptr Tvoidpf, ptr Tvoidpf) { Xpng_free(tls, png_ptr, ptr) } // C documentation // // /* Reset the CRC variable to 32 bits of 1's. Care must be taken // * in case CRC is > 32 bits to leave the top bits 0. // */ func Xpng_reset_crc(tls *libc.TLS, png_ptr Tpng_structrp) { /* The cast is safe because the crc is a 32-bit value. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcrc = (*(*func(*libc.TLS, TuLong, uintptr, TuInt) TuLong)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).Fcrc32Ptr})))(tls, uint32(0), uintptr(Z_NULL), uint32(0)) } // C documentation // // /* Calculate the CRC over a section of data. We can only pass as // * much data to this routine as the largest single buffer size. We // * also check that this data will actually be used before going to the // * trouble of calculating it. // */ func Xpng_calculate_crc(tls *libc.TLS, png_ptr Tpng_structrp, ptr Tpng_const_bytep, length Tsize_t) { var crc TuLong var need_crc int32 var safe_length TuInt _, _, _ = crc, need_crc, safe_length need_crc = int32(1) if uint32(1)&((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name>>libc.Int32FromInt32(29)) != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&(libc.Uint32FromUint32(0x0100)|libc.Uint32FromUint32(0x0200)) == libc.Uint32FromUint32(0x0100)|libc.Uint32FromUint32(0x0200) { need_crc = 0 } } else { /* critical */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0800) != uint32(0) { need_crc = 0 } } /* 'uLong' is defined in zlib.h as unsigned long; this means that on some * systems it is a 64-bit value. crc32, however, returns 32 bits so the * following cast is safe. 'uInt' may be no more than 16 bits, so it is * necessary to perform a loop here. */ if need_crc != 0 && length > uint32(0) { crc = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcrc /* Should never issue a warning */ for cond := true; cond; cond = length > uint32(0) { safe_length = length if safe_length == uint32(0) { safe_length = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) } /* evil, but safe */ crc = (*(*func(*libc.TLS, TuLong, uintptr, TuInt) TuLong)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).Fcrc32Ptr})))(tls, crc, ptr, safe_length) /* The following should never issue compiler warnings; if they do the * target system has characteristics that will probably violate other * assumptions within the libpng code. */ ptr += uintptr(safe_length) length -= safe_length } /* And the following is always safe because the crc is only 32 bits. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcrc = crc } } // C documentation // // /* Check a user supplied version number, called from both read and write // * functions that create a png_struct. // */ func Xpng_user_version_check(tls *libc.TLS, png_ptr Tpng_structrp, user_png_ver Tpng_const_charp) (r int32) { bp := tls.Alloc(128) defer tls.Free(128) var found_dots, i int32 var pos Tsize_t var _ /* m at bp+0 */ [128]uint8 _, _, _ = found_dots, i, pos /* Libpng versions 1.0.0 and later are binary compatible if the version * string matches through the second '.'; we must recompile any * applications that use any older library version. */ if user_png_ver != libc.UintptrFromInt32(0) { i = -int32(1) found_dots = 0 for cond := true; cond; cond = found_dots < int32(2) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(user_png_ver + uintptr(i)))) != 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(__ccgo_ts + 9793 + uintptr(i)))) != 0 { i++ if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(user_png_ver + uintptr(i)))) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(__ccgo_ts + 9793 + uintptr(i)))) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x20000) } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(user_png_ver + uintptr(i)))) == int32('.') { found_dots++ } } } else { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x20000) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x20000) != uint32(0) { pos = uint32(0) pos = Xpng_safecat(tls, bp, libc.Uint32FromInt64(128), pos, __ccgo_ts+9800) pos = Xpng_safecat(tls, bp, libc.Uint32FromInt64(128), pos, user_png_ver) pos = Xpng_safecat(tls, bp, libc.Uint32FromInt64(128), pos, __ccgo_ts+9831) pos = Xpng_safecat(tls, bp, libc.Uint32FromInt64(128), pos, __ccgo_ts+9793) _ = pos Xpng_warning(tls, png_ptr, bp) return 0 } /* Success return. */ return int32(1) } // C documentation // // /* Generic function to create a png_struct for either read or write - this // * contains the common initialization. // */ func Xpng_create_png_struct(tls *libc.TLS, user_png_ver Tpng_const_charp, error_ptr Tpng_voidp, error_fn Tpng_error_ptr, warn_fn Tpng_error_ptr, mem_ptr Tpng_voidp, malloc_fn Tpng_malloc_ptr, free_fn Tpng_free_ptr) (r Tpng_structp) { bp := tls.Alloc(1520) defer tls.Free(1520) var png_ptr Tpng_structrp var v1 uintptr var _ /* create_jmp_buf at bp+1120 */ Tjmp_buf var _ /* create_struct at bp+0 */ Tpng_struct _, _ = png_ptr, v1 /* This temporary stack-allocated structure is used to provide a place to * build enough context to allow the user provided memory allocator (if any) * to be called. */ libc.Xmemset(tls, bp, 0, libc.Uint32FromInt64(1120)) /* Added at libpng-1.2.6 */ (*(*Tpng_struct)(unsafe.Pointer(bp))).Fuser_width_max = uint32(PNG_USER_WIDTH_MAX) (*(*Tpng_struct)(unsafe.Pointer(bp))).Fuser_height_max = uint32(PNG_USER_HEIGHT_MAX) /* Added at libpng-1.2.43 and 1.4.0 */ (*(*Tpng_struct)(unsafe.Pointer(bp))).Fuser_chunk_cache_max = uint32(PNG_USER_CHUNK_CACHE_MAX) /* Added at libpng-1.2.43 and 1.4.1, required only for read but exists * in png_struct regardless. */ (*(*Tpng_struct)(unsafe.Pointer(bp))).Fuser_chunk_malloc_max = uint32(PNG_USER_CHUNK_MALLOC_MAX) /* The following two API calls simply set fields in png_struct, so it is safe * to do them now even though error handling is not yet set up. */ Xpng_set_mem_fn(tls, bp, mem_ptr, malloc_fn, free_fn) /* (*error_fn) can return control to the caller after the error_ptr is set, * this will result in a memory leak unless the error_fn does something * extremely sophisticated. The design lacks merit but is implicit in the * API. */ Xpng_set_error_fn(tls, bp, error_ptr, error_fn, warn_fn) v1 = bp + 1120 tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: default: tls.PopJumpBuffer(v1) } }() { /* Temporarily fake out the longjmp information until we have * successfully completed this function. This only works if we have * setjmp() support compiled in, but it is safe - this stuff should * never happen. */ (*(*Tpng_struct)(unsafe.Pointer(bp))).Fjmp_buf_ptr = bp + 1120 (*(*Tpng_struct)(unsafe.Pointer(bp))).Fjmp_buf_size = uint32(0) /*stack allocation*/ (*(*Tpng_struct)(unsafe.Pointer(bp))).Flongjmp_fn = __ccgo_fp(libc.Xlongjmp) /* Call the general version checker (shared with read and write code): */ if Xpng_user_version_check(tls, bp, user_png_ver) != 0 { png_ptr = Xpng_malloc_warn(tls, bp, libc.Uint32FromInt64(1120)) if png_ptr != libc.UintptrFromInt32(0) { /* png_ptr->zstream holds a back-pointer to the png_struct, so * this can only be done now: */ (*(*Tpng_struct)(unsafe.Pointer(bp))).Fzstream.Fzalloc = __ccgo_fp(Xpng_zalloc) (*(*Tpng_struct)(unsafe.Pointer(bp))).Fzstream.Fzfree = __ccgo_fp(Xpng_zfree) (*(*Tpng_struct)(unsafe.Pointer(bp))).Fzstream.Fopaque = png_ptr /* Eliminate the local error handling: */ (*(*Tpng_struct)(unsafe.Pointer(bp))).Fjmp_buf_ptr = libc.UintptrFromInt32(0) (*(*Tpng_struct)(unsafe.Pointer(bp))).Fjmp_buf_size = uint32(0) (*(*Tpng_struct)(unsafe.Pointer(bp))).Flongjmp_fn = uintptr(0) *(*Tpng_struct)(unsafe.Pointer(png_ptr)) = *(*Tpng_struct)(unsafe.Pointer(bp)) /* This is the successful return point */ return png_ptr } } } /* A longjmp because of a bug in the application storage allocator or a * simple failure to allocate the png_struct. */ return libc.UintptrFromInt32(0) } // C documentation // // /* Allocate the memory for an info_struct for the application. */ func Xpng_create_info_struct(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_infop) { var info_ptr Tpng_inforp _ = info_ptr if png_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } /* Use the internal API that does not (or at least should not) error out, so * that this call always returns ok. The application typically sets up the * error handling *after* creating the info_struct because this is the way it * has always been done in 'example.c'. */ info_ptr = Xpng_malloc_base(tls, png_ptr, libc.Uint32FromInt64(280)) if info_ptr != libc.UintptrFromInt32(0) { libc.Xmemset(tls, info_ptr, 0, libc.Uint32FromInt64(280)) } return info_ptr } // C documentation // // /* This function frees the memory associated with a single info struct. // * Normally, one would use either png_destroy_read_struct() or // * png_destroy_write_struct() to free an info struct, but this may be // * useful for some applications. From libpng 1.6.0 this function is also used // * internally to implement the png_info release part of the 'struct' destroy // * APIs. This ensures that all possible approaches free the same data (all of // * it). // */ func Xpng_destroy_info_struct(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr_ptr Tpng_infopp) { var info_ptr Tpng_inforp _ = info_ptr info_ptr = libc.UintptrFromInt32(0) if png_ptr == libc.UintptrFromInt32(0) { return } if info_ptr_ptr != libc.UintptrFromInt32(0) { info_ptr = *(*uintptr)(unsafe.Pointer(info_ptr_ptr)) } if info_ptr != libc.UintptrFromInt32(0) { /* Do this first in case of an error below; if the app implements its own * memory management this can lead to png_free calling png_error, which * will abort this routine and return control to the app error handler. * An infinite loop may result if it then tries to free the same info * ptr. */ *(*uintptr)(unsafe.Pointer(info_ptr_ptr)) = libc.UintptrFromInt32(0) Xpng_free_data(tls, png_ptr, info_ptr, uint32(0xffff), -int32(1)) libc.Xmemset(tls, info_ptr, 0, libc.Uint32FromInt64(280)) Xpng_free(tls, png_ptr, info_ptr) } } // C documentation // // /* Initialize the info structure. This is now an internal function (0.89) // * and applications using it are urged to use png_create_info_struct() // * instead. Use deprecated in 1.6.0, internal use removed (used internally it // * is just a memset). // * // * NOTE: it is almost inconceivable that this API is used because it bypasses // * the user-memory mechanism and the user error handling/warning mechanisms in // * those cases where it does anything other than a memset. // */ func Xpng_info_init_3(tls *libc.TLS, ptr_ptr Tpng_infopp, png_info_struct_size Tsize_t) { var info_ptr Tpng_inforp _ = info_ptr info_ptr = *(*uintptr)(unsafe.Pointer(ptr_ptr)) if info_ptr == libc.UintptrFromInt32(0) { return } if libc.Uint32FromInt64(280) > png_info_struct_size { *(*uintptr)(unsafe.Pointer(ptr_ptr)) = libc.UintptrFromInt32(0) /* The following line is why this API should not be used: */ libc.Xfree(tls, info_ptr) info_ptr = Xpng_malloc_base(tls, libc.UintptrFromInt32(0), libc.Uint32FromInt64(280)) if info_ptr == libc.UintptrFromInt32(0) { return } *(*uintptr)(unsafe.Pointer(ptr_ptr)) = info_ptr } /* Set everything to 0 */ libc.Xmemset(tls, info_ptr, 0, libc.Uint32FromInt64(280)) } func Xpng_data_freer(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, freer int32, mask Tpng_uint_32) { if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } if freer == int32(PNG_DESTROY_WILL_FREE_DATA) { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= mask } else { if freer == int32(PNG_USER_WILL_FREE_DATA) { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) &= ^mask } else { Xpng_error(tls, png_ptr, __ccgo_ts+9850) } } } func Xpng_free_data(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, mask Tpng_uint_32, num int32) { var i, i1, i2, i3 int32 var row Tpng_uint_32 _, _, _, _, _ = i, i1, i2, i3, row if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } /* Free text item num or (if num == -1) all text items */ if (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext != libc.UintptrFromInt32(0) && mask&uint32(0x4000)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { if num != -int32(1) { Xpng_free(tls, png_ptr, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(num)*28))).Fkey) (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(num)*28))).Fkey = libc.UintptrFromInt32(0) } else { i = 0 for { if !(i < (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_text) { break } Xpng_free(tls, png_ptr, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fkey) goto _1 _1: ; i++ } Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext) (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext = libc.UintptrFromInt32(0) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_text = 0 (*Tpng_info)(unsafe.Pointer(info_ptr)).Fmax_text = 0 } } /* Free any tRNS entry */ if mask&uint32(0x2000)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x0010) Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftrans_alpha) (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftrans_alpha = libc.UintptrFromInt32(0) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_trans = uint16(0) } /* Free any sCAL entry */ if mask&uint32(0x0100)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_width) Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_height) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_width = libc.UintptrFromInt32(0) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_height = libc.UintptrFromInt32(0) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x4000) } /* Free any pCAL entry */ if mask&uint32(0x0080)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_purpose) Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_units) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_purpose = libc.UintptrFromInt32(0) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_units = libc.UintptrFromInt32(0) if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params != libc.UintptrFromInt32(0) { i1 = 0 for { if !(i1 < libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_nparams)) { break } Xpng_free(tls, png_ptr, *(*uintptr)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params + uintptr(i1)*4))) goto _2 _2: ; i1++ } Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params = libc.UintptrFromInt32(0) } *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x0400) } /* Free any profile entry */ if mask&uint32(0x0010)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_name) Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_profile) (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_name = libc.UintptrFromInt32(0) (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_profile = libc.UintptrFromInt32(0) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x1000) } /* Free a given sPLT entry, or (if num == -1) all sPLT entries */ if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes != libc.UintptrFromInt32(0) && mask&uint32(0x0020)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { if num != -int32(1) { Xpng_free(tls, png_ptr, (*(*Tpng_sPLT_t)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes + uintptr(num)*16))).Fname) Xpng_free(tls, png_ptr, (*(*Tpng_sPLT_t)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes + uintptr(num)*16))).Fentries) (*(*Tpng_sPLT_t)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes + uintptr(num)*16))).Fname = libc.UintptrFromInt32(0) (*(*Tpng_sPLT_t)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes + uintptr(num)*16))).Fentries = libc.UintptrFromInt32(0) } else { i2 = 0 for { if !(i2 < (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes_num) { break } Xpng_free(tls, png_ptr, (*(*Tpng_sPLT_t)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes + uintptr(i2)*16))).Fname) Xpng_free(tls, png_ptr, (*(*Tpng_sPLT_t)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes + uintptr(i2)*16))).Fentries) goto _3 _3: ; i2++ } Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes = libc.UintptrFromInt32(0) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes_num = 0 *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x2000) } } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks != libc.UintptrFromInt32(0) && mask&uint32(0x0200)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { if num != -int32(1) { Xpng_free(tls, png_ptr, (*(*Tpng_unknown_chunk)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks + uintptr(num)*20))).Fdata) (*(*Tpng_unknown_chunk)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks + uintptr(num)*20))).Fdata = libc.UintptrFromInt32(0) } else { i3 = 0 for { if !(i3 < (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks_num) { break } Xpng_free(tls, png_ptr, (*(*Tpng_unknown_chunk)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks + uintptr(i3)*20))).Fdata) goto _4 _4: ; i3++ } Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks) (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks = libc.UintptrFromInt32(0) (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks_num = 0 } } /* Free any eXIf entry */ if mask&uint32(0x8000)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { if (*Tpng_info)(unsafe.Pointer(info_ptr)).FeXIf_buf != 0 { Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).FeXIf_buf) (*Tpng_info)(unsafe.Pointer(info_ptr)).FeXIf_buf = libc.UintptrFromInt32(0) } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fexif != 0 { Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fexif) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fexif = libc.UintptrFromInt32(0) } *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x10000) } /* Free any hIST entry */ if mask&uint32(0x0008)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fhist) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fhist = libc.UintptrFromInt32(0) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x0040) } /* Free any PLTE entry that was internally allocated */ if mask&uint32(0x1000)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpalette) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpalette = libc.UintptrFromInt32(0) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x0008) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_palette = uint16(0) } /* Free any image bits attached to the info structure */ if mask&uint32(0x0040)&(*Tpng_info)(unsafe.Pointer(info_ptr)).Ffree_me != uint32(0) { if (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers != libc.UintptrFromInt32(0) { row = uint32(0) for { if !(row < (*Tpng_info)(unsafe.Pointer(info_ptr)).Fheight) { break } Xpng_free(tls, png_ptr, *(*uintptr)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers + uintptr(row)*4))) goto _5 _5: ; row++ } Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers) (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers = libc.UintptrFromInt32(0) } *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x8000) } if num != -int32(1) { mask &= ^libc.Uint32FromUint32(0x4220) } *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) &= ^mask } // C documentation // // /* This function returns a pointer to the io_ptr associated with the user // * functions. The application should free any memory associated with this // * pointer before png_write_destroy() or png_read_destroy() are called. // */ func Xpng_get_io_ptr(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_voidp) { if png_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_ptr } // C documentation // // /* Initialize the default input/output functions for the PNG file. If you // * use your own read or write routines, you can call either png_set_read_fn() // * or png_set_write_fn() instead of png_init_io(). If you have defined // * PNG_NO_STDIO or otherwise disabled PNG_STDIO_SUPPORTED, you must use a // * function of your own because "FILE *" isn't necessarily available. // */ func Xpng_init_io(tls *libc.TLS, png_ptr Tpng_structrp, fp Tpng_FILE_p) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_ptr = fp } // C documentation // // /* PNG signed integers are saved in 32-bit 2's complement format. ANSI C-90 // * defines a cast of a signed integer to an unsigned integer either to preserve // * the value, if it is positive, or to calculate: // * // * (UNSIGNED_MAX+1) + integer // * // * Where UNSIGNED_MAX is the appropriate maximum unsigned value, so when the // * negative integral value is added the result will be an unsigned value // * corresponding to the 2's complement representation. // */ func Xpng_save_int_32(tls *libc.TLS, buf Tpng_bytep, i Tpng_int_32) { Xpng_save_uint_32(tls, buf, libc.Uint32FromInt32(i)) } // C documentation // // /* Convert the supplied time into an RFC 1123 string suitable for use in // * a "Creation Time" or other text-based time string. // */ func Xpng_convert_to_rfc1123_buffer(tls *libc.TLS, out uintptr, ptime Tpng_const_timep) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var pos, v1, v2, v3, v4, v5 Tsize_t var _ /* number_buf at bp+0 */ [5]uint8 _, _, _, _, _, _ = pos, v1, v2, v3, v4, v5 if out == libc.UintptrFromInt32(0) { return 0 } if libc.Int32FromUint16((*Tpng_time)(unsafe.Pointer(ptime)).Fyear) > int32(9999) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(ptime)).Fmonth) == 0 || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(ptime)).Fmonth) > int32(12) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(ptime)).Fday) == 0 || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(ptime)).Fday) > int32(31) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(ptime)).Fhour) > int32(23) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(ptime)).Fminute) > int32(59) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(ptime)).Fsecond) > int32(60) { return 0 } pos = uint32(0) *(*[5]uint8)(unsafe.Pointer(bp)) = [5]uint8{} /* enough for a four-digit year */ pos = Xpng_safecat(tls, out, uint32(29), pos, Xpng_format_number(tls, bp, bp+uintptr(libc.Uint32FromInt64(5)), int32(PNG_NUMBER_FORMAT_u), uint32((*Tpng_time)(unsafe.Pointer(ptime)).Fday))) if pos < uint32(28) { v1 = pos pos++ *(*uint8)(unsafe.Pointer(out + uintptr(v1))) = libc.Uint8FromInt32(libc.Int32FromUint8(' ')) } pos = Xpng_safecat(tls, out, uint32(29), pos, uintptr(unsafe.Pointer(&_short_months))+uintptr(libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(ptime)).Fmonth)-libc.Int32FromInt32(1))*4) if pos < uint32(28) { v2 = pos pos++ *(*uint8)(unsafe.Pointer(out + uintptr(v2))) = libc.Uint8FromInt32(libc.Int32FromUint8(' ')) } pos = Xpng_safecat(tls, out, uint32(29), pos, Xpng_format_number(tls, bp, bp+uintptr(libc.Uint32FromInt64(5)), int32(PNG_NUMBER_FORMAT_u), uint32((*Tpng_time)(unsafe.Pointer(ptime)).Fyear))) if pos < uint32(28) { v3 = pos pos++ *(*uint8)(unsafe.Pointer(out + uintptr(v3))) = libc.Uint8FromInt32(libc.Int32FromUint8(' ')) } pos = Xpng_safecat(tls, out, uint32(29), pos, Xpng_format_number(tls, bp, bp+uintptr(libc.Uint32FromInt64(5)), int32(PNG_NUMBER_FORMAT_02u), uint32((*Tpng_time)(unsafe.Pointer(ptime)).Fhour))) if pos < uint32(28) { v4 = pos pos++ *(*uint8)(unsafe.Pointer(out + uintptr(v4))) = libc.Uint8FromInt32(libc.Int32FromUint8(':')) } pos = Xpng_safecat(tls, out, uint32(29), pos, Xpng_format_number(tls, bp, bp+uintptr(libc.Uint32FromInt64(5)), int32(PNG_NUMBER_FORMAT_02u), uint32((*Tpng_time)(unsafe.Pointer(ptime)).Fminute))) if pos < uint32(28) { v5 = pos pos++ *(*uint8)(unsafe.Pointer(out + uintptr(v5))) = libc.Uint8FromInt32(libc.Int32FromUint8(':')) } pos = Xpng_safecat(tls, out, uint32(29), pos, Xpng_format_number(tls, bp, bp+uintptr(libc.Uint32FromInt64(5)), int32(PNG_NUMBER_FORMAT_02u), uint32((*Tpng_time)(unsafe.Pointer(ptime)).Fsecond))) pos = Xpng_safecat(tls, out, uint32(29), pos, __ccgo_ts+9892) /* This reliably terminates the buffer */ _ = pos return int32(1) } var _short_months = [12][4]uint8{ 0: {'J', 'a', 'n'}, 1: {'F', 'e', 'b'}, 2: {'M', 'a', 'r'}, 3: {'A', 'p', 'r'}, 4: {'M', 'a', 'y'}, 5: {'J', 'u', 'n'}, 6: {'J', 'u', 'l'}, 7: {'A', 'u', 'g'}, 8: {'S', 'e', 'p'}, 9: {'O', 'c', 't'}, 10: {'N', 'o', 'v'}, 11: {'D', 'e', 'c'}, } // C documentation // // /* To do: remove the following from libpng-1.7 */ // /* Original API that uses a private buffer in png_struct. // * Deprecated because it causes png_struct to carry a spurious temporary // * buffer (png_struct::time_buffer), better to have the caller pass this in. // */ func Xpng_convert_to_rfc1123(tls *libc.TLS, png_ptr Tpng_structrp, ptime Tpng_const_timep) (r Tpng_const_charp) { if png_ptr != libc.UintptrFromInt32(0) { /* The only failure above if png_ptr != NULL is from an invalid ptime */ if Xpng_convert_to_rfc1123_buffer(tls, png_ptr+856, ptime) == 0 { Xpng_warning(tls, png_ptr, __ccgo_ts+9899) } else { return png_ptr + 856 } } return libc.UintptrFromInt32(0) } func Xpng_get_copyright(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_const_charp) { _ = png_ptr /* Silence compiler warning about unused png_ptr */ return __ccgo_ts + 9927 } // C documentation // // /* The following return the library version as a short string in the // * format 1.0.0 through 99.99.99zz. To get the version of *.h files // * used with your application, print out PNG_LIBPNG_VER_STRING, which // * is defined in png.h. // * Note: now there is no difference between png_get_libpng_ver() and // * png_get_header_ver(). Due to the version_nn_nn_nn typedef guard, // * it is guaranteed that png.c uses the correct version of png.h. // */ func Xpng_get_libpng_ver(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_const_charp) { /* Version of *.c files used when building libpng */ return Xpng_get_header_ver(tls, png_ptr) } func Xpng_get_header_ver(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_const_charp) { /* Version of *.h files used when building libpng */ _ = png_ptr /* Silence compiler warning about unused png_ptr */ return __ccgo_ts + 9793 } func Xpng_get_header_version(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_const_charp) { /* Returns longer string containing both version and date */ _ = png_ptr /* Silence compiler warning about unused png_ptr */ return __ccgo_ts + 10146 } // C documentation // // /* NOTE: this routine is not used internally! */ // /* Build a grayscale palette. Palette is assumed to be 1 << bit_depth // * large of png_color. This lets grayscale images be treated as // * paletted. Most useful for gamma correction and simplification // * of code. This API is not used internally. // */ func Xpng_build_grayscale_palette(tls *libc.TLS, bit_depth int32, palette Tpng_colorp) { var color_inc, i, num_palette, v int32 _, _, _, _ = color_inc, i, num_palette, v if palette == libc.UintptrFromInt32(0) { return } switch bit_depth { case int32(1): num_palette = int32(2) color_inc = int32(0xff) case int32(2): num_palette = int32(4) color_inc = int32(0x55) case int32(4): num_palette = int32(16) color_inc = int32(0x11) case int32(8): num_palette = int32(256) color_inc = int32(1) default: num_palette = 0 color_inc = 0 break } i = 0 v = libc.Int32FromInt32(0) for { if !(i < num_palette) { break } (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fred = libc.Uint8FromInt32(v & libc.Int32FromInt32(0xff)) (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fgreen = libc.Uint8FromInt32(v & libc.Int32FromInt32(0xff)) (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fblue = libc.Uint8FromInt32(v & libc.Int32FromInt32(0xff)) goto _1 _1: ; i++ v += color_inc } } func Xpng_handle_as_unknown(tls *libc.TLS, png_ptr Tpng_const_structrp, chunk_name Tpng_const_bytep) (r int32) { var p, p_end Tpng_const_bytep _, _ = p, p_end if png_ptr == libc.UintptrFromInt32(0) || chunk_name == libc.UintptrFromInt32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_chunk_list == uint32(0) { return PNG_HANDLE_CHUNK_AS_DEFAULT } p_end = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list p = p_end + uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_chunk_list*uint32(5)) /* beyond end */ /* The code is the fifth byte after each four byte string. Historically this * code was always searched from the end of the list, this is no longer * necessary because the 'set' routine handles duplicate entries correctly. */ for cond := true; cond; cond = p > p_end { /* num_chunk_list > 0, so at least one */ p -= uintptr(5) if libc.Xmemcmp(tls, chunk_name, p, uint32(4)) == 0 { return libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(p + 4))) } } /* This means that known chunks should be processed and unknown chunks should * be handled according to the value of png_ptr->unknown_default; this can be * confusing because, as a result, there are two levels of defaulting for * unknown chunks. */ return PNG_HANDLE_CHUNK_AS_DEFAULT } func Xpng_chunk_unknown_handling(tls *libc.TLS, png_ptr Tpng_const_structrp, chunk_name Tpng_uint_32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* chunk_string at bp+0 */ [5]Tpng_byte *(*uint8)(unsafe.Pointer(bp)) = uint8(chunk_name >> libc.Int32FromInt32(24) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + 1)) = uint8(chunk_name >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + 2)) = uint8(chunk_name >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + 3)) = uint8(chunk_name & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + 4)) = libc.Uint8FromInt32(0) return Xpng_handle_as_unknown(tls, png_ptr, bp) } // C documentation // // /* This function, added to libpng-1.0.6g, is untested. */ func Xpng_reset_zstream(tls *libc.TLS, png_ptr Tpng_structrp) (r int32) { if png_ptr == libc.UintptrFromInt32(0) { return -int32(2) } /* WARNING: this resets the window bits to the maximum! */ return (*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflateResetPtr})))(tls, png_ptr+460) } // C documentation // // /* This function was added to libpng-1.0.7 */ func Xpng_access_version_number(tls *libc.TLS) (r Tpng_uint_32) { /* Version of *.c files used when building libpng */ return libc.Uint32FromInt32(PNG_LIBPNG_VER) } // C documentation // // /* Ensure that png_ptr->zstream.msg holds some appropriate error message string. // * If it doesn't 'ret' is used to set it to something appropriate, even in cases // * like Z_OK or Z_STREAM_END where the error code is apparently a success code. // */ func Xpng_zstream_error(tls *libc.TLS, png_ptr Tpng_structrp, ret int32) { /* Translate 'ret' into an appropriate error string, priority is given to the * one in zstream if set. This always returns a string, even in cases like * Z_OK or Z_STREAM_END where the error code is a success code. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg == libc.UintptrFromInt32(0) { switch ret { default: fallthrough case Z_OK: (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 10171 case int32(Z_STREAM_END): /* Normal exit */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 10199 case int32(Z_NEED_DICT): /* This means the deflate stream did not have a dictionary; this * indicates a bogus PNG. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 10227 case -int32(1): /* gz APIs only: should not happen */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 10249 case -int32(2): /* internal libpng error */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 10263 case -int32(3): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 10286 case -int32(4): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 10304 case -int32(5): /* End of input or output; not a problem if the caller is doing * incremental read or write. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 10324 case -int32(6): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 10334 case -int32(7): /* Compile errors here mean that zlib now uses the value co-opted in * pngpriv.h for PNG_UNEXPECTED_ZLIB_RETURN; update the switch above * and change pngpriv.h. Note that this message is "... return", * whereas the default/Z_OK one is "... return code". */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 10359 break } } } /* png_convert_size: a PNGAPI but no longer in png.h, so deleted * at libpng 1.5.5! */ // C documentation // // /* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */ func _png_colorspace_check_gamma(tls *libc.TLS, png_ptr Tpng_const_structrp, colorspace Tpng_colorspacerp, gAMA Tpng_fixed_point, from int32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) /* This is called to check a new gamma value against an existing one. The * routine returns false if the new gamma value should not be written. * * 'from' says where the new gamma value comes from: * * 0: the new gamma value is the libpng estimate for an ICC profile * 1: the new gamma value comes from a gAMA chunk * 2: the new gamma value comes from an sRGB chunk */ var _ /* gtest at bp+0 */ Tpng_fixed_point if libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fflags)&int32(PNG_COLORSPACE_HAVE_GAMMA3) != 0 && (Xpng_muldiv(tls, bp, (*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fgamma, int32(PNG_FP_1), gAMA) == 0 || Xpng_gamma_significant(tls, *(*Tpng_fixed_point)(unsafe.Pointer(bp))) != 0) { /* Either this is an sRGB image, in which case the calculated gamma * approximation should match, or this is an image with a profile and the * value libpng calculates for the gamma of the profile does not match the * value recorded in the file. The former, sRGB, case is an error, the * latter is just a warning. */ if libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fflags)&int32(PNG_COLORSPACE_FROM_sRGB1) != 0 || from == int32(2) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+10382, int32(PNG_CHUNK_ERROR)) /* Do not overwrite an sRGB value */ return libc.BoolInt32(from == int32(2)) } else { /* sRGB tag not involved */ Xpng_chunk_report(tls, png_ptr, __ccgo_ts+10414, PNG_CHUNK_WARNING) return libc.BoolInt32(from == int32(1)) } } return int32(1) } func Xpng_colorspace_set_gamma(tls *libc.TLS, png_ptr Tpng_const_structrp, colorspace Tpng_colorspacerp, gAMA Tpng_fixed_point) { var errmsg Tpng_const_charp var p1, p2 uintptr _, _, _ = errmsg, p1, p2 if gAMA < int32(16) || gAMA > int32(625000000) { errmsg = __ccgo_ts + 10457 } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x8000) != uint32(0) && libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fflags)&int32(PNG_COLORSPACE_FROM_gAMA1) != 0 { errmsg = __ccgo_ts + 10482 } else { if libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fflags)&int32(PNG_COLORSPACE_INVALID1) != 0 { return } else { if _png_colorspace_check_gamma(tls, png_ptr, colorspace, gAMA, int32(1)) != 0 { /* Store this gamma value. */ (*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fgamma = gAMA p1 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | (libc.Int32FromInt32(PNG_COLORSPACE_HAVE_GAMMA3) | libc.Int32FromInt32(PNG_COLORSPACE_FROM_gAMA1))) } /* At present if the check_gamma test fails the gamma of the colorspace is * not updated however the colorspace is not invalidated. This * corresponds to the case where the existing gamma comes from an sRGB * chunk or profile. An error message has already been output. */ return } } } /* Error exit - errmsg has been set. */ p2 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p2)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID1)) Xpng_chunk_report(tls, png_ptr, errmsg, int32(PNG_CHUNK_WRITE_ERROR)) } func Xpng_colorspace_sync_info(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp) { if libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_INVALID1) != 0 { /* Everything is invalid */ *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^(libc.Uint32FromUint32(0x0001) | libc.Uint32FromUint32(0x0004) | libc.Uint32FromUint32(0x0800) | libc.Uint32FromUint32(0x1000)) /* Clean up the iCCP profile now if it won't be used. */ Xpng_free_data(tls, png_ptr, info_ptr, uint32(0x0010), -int32(1)) } else { /* Leave the INFO_iCCP flag set if the pngset.c code has already set * it; this allows a PNG to contain a profile which matches sRGB and * yet still have that profile retrievable by the application. */ if libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_MATCHES_sRGB1) != 0 { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0800) } else { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x0800) } if libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_ENDPOINTS3) != 0 { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0004) } else { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x0004) } if libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_GAMMA3) != 0 { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0001) } else { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= ^libc.Uint32FromUint32(0x0001) } } } func Xpng_colorspace_sync(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp) { if info_ptr == libc.UintptrFromInt32(0) { /* reduce code size; check here not in the caller */ return } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace Xpng_colorspace_sync_info(tls, png_ptr, info_ptr) } func _png_safe_add(tls *libc.TLS, addend0_and_result uintptr, addend1 Tpng_int_32, addend2 Tpng_int_32) (r int32) { var addend0 int32 _ = addend0 /* Safely add three integers. Returns 0 on success, 1 on overlow. * IMPLEMENTATION NOTE: ANSI requires signed overflow not to occur, therefore * relying on addition of two positive values producing a negative one is not * safe. */ addend0 = *(*Tpng_int_32)(unsafe.Pointer(addend0_and_result)) if int32(0x7fffffff)-addend0 < addend1 { return int32(1) } addend0 += addend1 if int32(0x7fffffff)-addend1 < addend2 { return int32(1) } *(*Tpng_int_32)(unsafe.Pointer(addend0_and_result)) = addend0 + addend2 return 0 } // C documentation // // /* Added at libpng-1.5.5 to support read and write of true CIEXYZ values for // * cHRM, as opposed to using chromaticities. These internal APIs return // * non-zero on a parameter error. The X, Y and Z values are required to be // * positive and less than 1.0. // */ func _png_xy_from_XYZ(tls *libc.TLS, xy uintptr, XYZ uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var dgreen, dred, dwhite, whiteX, whiteY Tpng_int_32 var _ /* d at bp+0 */ Tpng_int_32 _, _, _, _, _ = dgreen, dred, dwhite, whiteX, whiteY /* 'd' in each of the blocks below is just X+Y+Z for each component, * x, y and z are X,Y,Z/(X+Y+Z). */ *(*Tpng_int_32)(unsafe.Pointer(bp)) = (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_X if _png_safe_add(tls, bp, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_Y, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_Z) != 0 { return int32(1) } if Xpng_muldiv(tls, xy, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_X, int32(PNG_FP_1), *(*Tpng_int_32)(unsafe.Pointer(bp))) == 0 { return int32(1) } if Xpng_muldiv(tls, xy+4, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_Y, int32(PNG_FP_1), *(*Tpng_int_32)(unsafe.Pointer(bp))) == 0 { return int32(1) } dred = *(*Tpng_int_32)(unsafe.Pointer(bp)) whiteX = (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_X whiteY = (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_Y *(*Tpng_int_32)(unsafe.Pointer(bp)) = (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_X if _png_safe_add(tls, bp, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_Y, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_Z) != 0 { return int32(1) } if Xpng_muldiv(tls, xy+8, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_X, int32(PNG_FP_1), *(*Tpng_int_32)(unsafe.Pointer(bp))) == 0 { return int32(1) } if Xpng_muldiv(tls, xy+12, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_Y, int32(PNG_FP_1), *(*Tpng_int_32)(unsafe.Pointer(bp))) == 0 { return int32(1) } dgreen = *(*Tpng_int_32)(unsafe.Pointer(bp)) whiteX += (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_X whiteY += (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_Y *(*Tpng_int_32)(unsafe.Pointer(bp)) = (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_X if _png_safe_add(tls, bp, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_Y, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_Z) != 0 { return int32(1) } if Xpng_muldiv(tls, xy+16, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_X, int32(PNG_FP_1), *(*Tpng_int_32)(unsafe.Pointer(bp))) == 0 { return int32(1) } if Xpng_muldiv(tls, xy+20, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_Y, int32(PNG_FP_1), *(*Tpng_int_32)(unsafe.Pointer(bp))) == 0 { return int32(1) } whiteX += (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_X whiteY += (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_Y /* The reference white is simply the sum of the end-point (X,Y,Z) vectors so * the fillowing calculates (X+Y+Z) of the reference white (media white, * encoding white) itself: */ if _png_safe_add(tls, bp, dred, dgreen) != 0 { return int32(1) } dwhite = *(*Tpng_int_32)(unsafe.Pointer(bp)) if Xpng_muldiv(tls, xy+24, whiteX, int32(PNG_FP_1), dwhite) == 0 { return int32(1) } if Xpng_muldiv(tls, xy+28, whiteY, int32(PNG_FP_1), dwhite) == 0 { return int32(1) } return 0 } func _png_XYZ_from_xy(tls *libc.TLS, XYZ uintptr, xy uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var blue_scale, denominator Tpng_fixed_point var _ /* green_inverse at bp+4 */ Tpng_fixed_point var _ /* left at bp+8 */ Tpng_fixed_point var _ /* red_inverse at bp+0 */ Tpng_fixed_point var _ /* right at bp+12 */ Tpng_fixed_point _, _ = blue_scale, denominator /* The reverse calculation is more difficult because the original tristimulus * value had 9 independent values (red,green,blue)x(X,Y,Z) however only 8 * derived values were recorded in the cHRM chunk; * (red,green,blue,white)x(x,y). This loses one degree of freedom and * therefore an arbitrary ninth value has to be introduced to undo the * original transformations. * * Think of the original end-points as points in (X,Y,Z) space. The * chromaticity values (c) have the property: * * C * c = --------- * X + Y + Z * * For each c (x,y,z) from the corresponding original C (X,Y,Z). Thus the * three chromaticity values (x,y,z) for each end-point obey the * relationship: * * x + y + z = 1 * * This describes the plane in (X,Y,Z) space that intersects each axis at the * value 1.0; call this the chromaticity plane. Thus the chromaticity * calculation has scaled each end-point so that it is on the x+y+z=1 plane * and chromaticity is the intersection of the vector from the origin to the * (X,Y,Z) value with the chromaticity plane. * * To fully invert the chromaticity calculation we would need the three * end-point scale factors, (red-scale, green-scale, blue-scale), but these * were not recorded. Instead we calculated the reference white (X,Y,Z) and * recorded the chromaticity of this. The reference white (X,Y,Z) would have * given all three of the scale factors since: * * color-C = color-c * color-scale * white-C = red-C + green-C + blue-C * = red-c*red-scale + green-c*green-scale + blue-c*blue-scale * * But cHRM records only white-x and white-y, so we have lost the white scale * factor: * * white-C = white-c*white-scale * * To handle this the inverse transformation makes an arbitrary assumption * about white-scale: * * Assume: white-Y = 1.0 * Hence: white-scale = 1/white-y * Or: red-Y + green-Y + blue-Y = 1.0 * * Notice the last statement of the assumption gives an equation in three of * the nine values we want to calculate. 8 more equations come from the * above routine as summarised at the top above (the chromaticity * calculation): * * Given: color-x = color-X / (color-X + color-Y + color-Z) * Hence: (color-x - 1)*color-X + color.x*color-Y + color.x*color-Z = 0 * * This is 9 simultaneous equations in the 9 variables "color-C" and can be * solved by Cramer's rule. Cramer's rule requires calculating 10 9x9 matrix * determinants, however this is not as bad as it seems because only 28 of * the total of 90 terms in the various matrices are non-zero. Nevertheless * Cramer's rule is notoriously numerically unstable because the determinant * calculation involves the difference of large, but similar, numbers. It is * difficult to be sure that the calculation is stable for real world values * and it is certain that it becomes unstable where the end points are close * together. * * So this code uses the perhaps slightly less optimal but more * understandable and totally obvious approach of calculating color-scale. * * This algorithm depends on the precision in white-scale and that is * (1/white-y), so we can immediately see that as white-y approaches 0 the * accuracy inherent in the cHRM chunk drops off substantially. * * libpng arithmetic: a simple inversion of the above equations * ------------------------------------------------------------ * * white_scale = 1/white-y * white-X = white-x * white-scale * white-Y = 1.0 * white-Z = (1 - white-x - white-y) * white_scale * * white-C = red-C + green-C + blue-C * = red-c*red-scale + green-c*green-scale + blue-c*blue-scale * * This gives us three equations in (red-scale,green-scale,blue-scale) where * all the coefficients are now known: * * red-x*red-scale + green-x*green-scale + blue-x*blue-scale * = white-x/white-y * red-y*red-scale + green-y*green-scale + blue-y*blue-scale = 1 * red-z*red-scale + green-z*green-scale + blue-z*blue-scale * = (1 - white-x - white-y)/white-y * * In the last equation color-z is (1 - color-x - color-y) so we can add all * three equations together to get an alternative third: * * red-scale + green-scale + blue-scale = 1/white-y = white-scale * * So now we have a Cramer's rule solution where the determinants are just * 3x3 - far more tractible. Unfortunately 3x3 determinants still involve * multiplication of three coefficients so we can't guarantee to avoid * overflow in the libpng fixed point representation. Using Cramer's rule in * floating point is probably a good choice here, but it's not an option for * fixed point. Instead proceed to simplify the first two equations by * eliminating what is likely to be the largest value, blue-scale: * * blue-scale = white-scale - red-scale - green-scale * * Hence: * * (red-x - blue-x)*red-scale + (green-x - blue-x)*green-scale = * (white-x - blue-x)*white-scale * * (red-y - blue-y)*red-scale + (green-y - blue-y)*green-scale = * 1 - blue-y*white-scale * * And now we can trivially solve for (red-scale,green-scale): * * green-scale = * (white-x - blue-x)*white-scale - (red-x - blue-x)*red-scale * ----------------------------------------------------------- * green-x - blue-x * * red-scale = * 1 - blue-y*white-scale - (green-y - blue-y) * green-scale * --------------------------------------------------------- * red-y - blue-y * * Hence: * * red-scale = * ( (green-x - blue-x) * (white-y - blue-y) - * (green-y - blue-y) * (white-x - blue-x) ) / white-y * ------------------------------------------------------------------------- * (green-x - blue-x)*(red-y - blue-y)-(green-y - blue-y)*(red-x - blue-x) * * green-scale = * ( (red-y - blue-y) * (white-x - blue-x) - * (red-x - blue-x) * (white-y - blue-y) ) / white-y * ------------------------------------------------------------------------- * (green-x - blue-x)*(red-y - blue-y)-(green-y - blue-y)*(red-x - blue-x) * * Accuracy: * The input values have 5 decimal digits of accuracy. The values are all in * the range 0 < value < 1, so simple products are in the same range but may * need up to 10 decimal digits to preserve the original precision and avoid * underflow. Because we are using a 32-bit signed representation we cannot * match this; the best is a little over 9 decimal digits, less than 10. * * The approach used here is to preserve the maximum precision within the * signed representation. Because the red-scale calculation above uses the * difference between two products of values that must be in the range -1..+1 * it is sufficient to divide the product by 7; ceil(100,000/32767*2). The * factor is irrelevant in the calculation because it is applied to both * numerator and denominator. * * Note that the values of the differences of the products of the * chromaticities in the above equations tend to be small, for example for * the sRGB chromaticities they are: * * red numerator: -0.04751 * green numerator: -0.08788 * denominator: -0.2241 (without white-y multiplication) * * The resultant Y coefficients from the chromaticities of some widely used * color space definitions are (to 15 decimal places): * * sRGB * 0.212639005871510 0.715168678767756 0.072192315360734 * Kodak ProPhoto * 0.288071128229293 0.711843217810102 0.000085653960605 * Adobe RGB * 0.297344975250536 0.627363566255466 0.075291458493998 * Adobe Wide Gamut RGB * 0.258728243040113 0.724682314948566 0.016589442011321 */ /* By the argument, above overflow should be impossible here. The return * value of 2 indicates an internal error to the caller. */ if Xpng_muldiv(tls, bp+8, (*Tpng_xy)(unsafe.Pointer(xy)).Fgreenx-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluex, (*Tpng_xy)(unsafe.Pointer(xy)).Fredy-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluey, int32(7)) == 0 { return int32(1) } if Xpng_muldiv(tls, bp+12, (*Tpng_xy)(unsafe.Pointer(xy)).Fgreeny-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluey, (*Tpng_xy)(unsafe.Pointer(xy)).Fredx-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluex, int32(7)) == 0 { return int32(1) } denominator = *(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) - *(*Tpng_fixed_point)(unsafe.Pointer(bp + 12)) /* Now find the red numerator. */ if Xpng_muldiv(tls, bp+8, (*Tpng_xy)(unsafe.Pointer(xy)).Fgreenx-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluex, (*Tpng_xy)(unsafe.Pointer(xy)).Fwhitey-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluey, int32(7)) == 0 { return int32(1) } if Xpng_muldiv(tls, bp+12, (*Tpng_xy)(unsafe.Pointer(xy)).Fgreeny-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluey, (*Tpng_xy)(unsafe.Pointer(xy)).Fwhitex-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluex, int32(7)) == 0 { return int32(1) } /* Overflow is possible here and it indicates an extreme set of PNG cHRM * chunk values. This calculation actually returns the reciprocal of the * scale value because this allows us to delay the multiplication of white-y * into the denominator, which tends to produce a small number. */ if Xpng_muldiv(tls, bp, (*Tpng_xy)(unsafe.Pointer(xy)).Fwhitey, denominator, *(*Tpng_fixed_point)(unsafe.Pointer(bp + 8))-*(*Tpng_fixed_point)(unsafe.Pointer(bp + 12))) == 0 || *(*Tpng_fixed_point)(unsafe.Pointer(bp)) <= (*Tpng_xy)(unsafe.Pointer(xy)).Fwhitey { return int32(1) } /* Similarly for green_inverse: */ if Xpng_muldiv(tls, bp+8, (*Tpng_xy)(unsafe.Pointer(xy)).Fredy-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluey, (*Tpng_xy)(unsafe.Pointer(xy)).Fwhitex-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluex, int32(7)) == 0 { return int32(1) } if Xpng_muldiv(tls, bp+12, (*Tpng_xy)(unsafe.Pointer(xy)).Fredx-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluex, (*Tpng_xy)(unsafe.Pointer(xy)).Fwhitey-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluey, int32(7)) == 0 { return int32(1) } if Xpng_muldiv(tls, bp+4, (*Tpng_xy)(unsafe.Pointer(xy)).Fwhitey, denominator, *(*Tpng_fixed_point)(unsafe.Pointer(bp + 8))-*(*Tpng_fixed_point)(unsafe.Pointer(bp + 12))) == 0 || *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4)) <= (*Tpng_xy)(unsafe.Pointer(xy)).Fwhitey { return int32(1) } /* And the blue scale, the checks above guarantee this can't overflow but it * can still produce 0 for extreme cHRM values. */ blue_scale = Xpng_reciprocal(tls, (*Tpng_xy)(unsafe.Pointer(xy)).Fwhitey) - Xpng_reciprocal(tls, *(*Tpng_fixed_point)(unsafe.Pointer(bp))) - Xpng_reciprocal(tls, *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4))) if blue_scale <= 0 { return int32(1) } /* And fill in the png_XYZ: */ if Xpng_muldiv(tls, XYZ, (*Tpng_xy)(unsafe.Pointer(xy)).Fredx, int32(PNG_FP_1), *(*Tpng_fixed_point)(unsafe.Pointer(bp))) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+4, (*Tpng_xy)(unsafe.Pointer(xy)).Fredy, int32(PNG_FP_1), *(*Tpng_fixed_point)(unsafe.Pointer(bp))) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+8, int32(PNG_FP_1)-(*Tpng_xy)(unsafe.Pointer(xy)).Fredx-(*Tpng_xy)(unsafe.Pointer(xy)).Fredy, int32(PNG_FP_1), *(*Tpng_fixed_point)(unsafe.Pointer(bp))) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+12, (*Tpng_xy)(unsafe.Pointer(xy)).Fgreenx, int32(PNG_FP_1), *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4))) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+16, (*Tpng_xy)(unsafe.Pointer(xy)).Fgreeny, int32(PNG_FP_1), *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4))) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+20, int32(PNG_FP_1)-(*Tpng_xy)(unsafe.Pointer(xy)).Fgreenx-(*Tpng_xy)(unsafe.Pointer(xy)).Fgreeny, int32(PNG_FP_1), *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4))) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+24, (*Tpng_xy)(unsafe.Pointer(xy)).Fbluex, blue_scale, int32(PNG_FP_1)) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+28, (*Tpng_xy)(unsafe.Pointer(xy)).Fbluey, blue_scale, int32(PNG_FP_1)) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+32, int32(PNG_FP_1)-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluex-(*Tpng_xy)(unsafe.Pointer(xy)).Fbluey, blue_scale, int32(PNG_FP_1)) == 0 { return int32(1) } return 0 /*success*/ } func _png_XYZ_normalize(tls *libc.TLS, XYZ uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var Y Tpng_int_32 var _ /* Ytemp at bp+0 */ Tpng_int_32 _ = Y /* Normalize by scaling so the sum of the end-point Y values is PNG_FP_1. */ *(*Tpng_int_32)(unsafe.Pointer(bp)) = (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_Y if _png_safe_add(tls, bp, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_Y, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_Y) != 0 { return int32(1) } Y = *(*Tpng_int_32)(unsafe.Pointer(bp)) if Y != int32(PNG_FP_1) { if Xpng_muldiv(tls, XYZ, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_X, int32(PNG_FP_1), Y) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+4, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_Y, int32(PNG_FP_1), Y) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+8, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fred_Z, int32(PNG_FP_1), Y) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+12, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_X, int32(PNG_FP_1), Y) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+16, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_Y, int32(PNG_FP_1), Y) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+20, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fgreen_Z, int32(PNG_FP_1), Y) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+24, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_X, int32(PNG_FP_1), Y) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+28, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_Y, int32(PNG_FP_1), Y) == 0 { return int32(1) } if Xpng_muldiv(tls, XYZ+32, (*Tpng_XYZ)(unsafe.Pointer(XYZ)).Fblue_Z, int32(PNG_FP_1), Y) == 0 { return int32(1) } } return 0 } func _png_colorspace_endpoints_match(tls *libc.TLS, xy1 uintptr, xy2 uintptr, delta int32) (r int32) { /* Allow an error of +/-0.01 (absolute value) on each chromaticity */ if (*Tpng_xy)(unsafe.Pointer(xy1)).Fwhitex < (*Tpng_xy)(unsafe.Pointer(xy2)).Fwhitex-delta || (*Tpng_xy)(unsafe.Pointer(xy1)).Fwhitex > (*Tpng_xy)(unsafe.Pointer(xy2)).Fwhitex+delta || ((*Tpng_xy)(unsafe.Pointer(xy1)).Fwhitey < (*Tpng_xy)(unsafe.Pointer(xy2)).Fwhitey-delta || (*Tpng_xy)(unsafe.Pointer(xy1)).Fwhitey > (*Tpng_xy)(unsafe.Pointer(xy2)).Fwhitey+delta) || ((*Tpng_xy)(unsafe.Pointer(xy1)).Fredx < (*Tpng_xy)(unsafe.Pointer(xy2)).Fredx-delta || (*Tpng_xy)(unsafe.Pointer(xy1)).Fredx > (*Tpng_xy)(unsafe.Pointer(xy2)).Fredx+delta) || ((*Tpng_xy)(unsafe.Pointer(xy1)).Fredy < (*Tpng_xy)(unsafe.Pointer(xy2)).Fredy-delta || (*Tpng_xy)(unsafe.Pointer(xy1)).Fredy > (*Tpng_xy)(unsafe.Pointer(xy2)).Fredy+delta) || ((*Tpng_xy)(unsafe.Pointer(xy1)).Fgreenx < (*Tpng_xy)(unsafe.Pointer(xy2)).Fgreenx-delta || (*Tpng_xy)(unsafe.Pointer(xy1)).Fgreenx > (*Tpng_xy)(unsafe.Pointer(xy2)).Fgreenx+delta) || ((*Tpng_xy)(unsafe.Pointer(xy1)).Fgreeny < (*Tpng_xy)(unsafe.Pointer(xy2)).Fgreeny-delta || (*Tpng_xy)(unsafe.Pointer(xy1)).Fgreeny > (*Tpng_xy)(unsafe.Pointer(xy2)).Fgreeny+delta) || ((*Tpng_xy)(unsafe.Pointer(xy1)).Fbluex < (*Tpng_xy)(unsafe.Pointer(xy2)).Fbluex-delta || (*Tpng_xy)(unsafe.Pointer(xy1)).Fbluex > (*Tpng_xy)(unsafe.Pointer(xy2)).Fbluex+delta) || ((*Tpng_xy)(unsafe.Pointer(xy1)).Fbluey < (*Tpng_xy)(unsafe.Pointer(xy2)).Fbluey-delta || (*Tpng_xy)(unsafe.Pointer(xy1)).Fbluey > (*Tpng_xy)(unsafe.Pointer(xy2)).Fbluey+delta) { return 0 } return int32(1) } // C documentation // // /* Added in libpng-1.6.0, a different check for the validity of a set of cHRM // * chunk chromaticities. Earlier checks used to simply look for the overflow // * condition (where the determinant of the matrix to solve for XYZ ends up zero // * because the chromaticity values are not all distinct.) Despite this it is // * theoretically possible to produce chromaticities that are apparently valid // * but that rapidly degrade to invalid, potentially crashing, sets because of // * arithmetic inaccuracies when calculations are performed on them. The new // * check is to round-trip xy -> XYZ -> xy and then check that the result is // * within a small percentage of the original. // */ func _png_colorspace_check_xy(tls *libc.TLS, XYZ uintptr, xy uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var result int32 var _ /* xy_test at bp+0 */ Tpng_xy _ = result /* As a side-effect this routine also returns the XYZ endpoints. */ result = _png_XYZ_from_xy(tls, XYZ, xy) if result != 0 { return result } result = _png_xy_from_XYZ(tls, bp, XYZ) if result != 0 { return result } if _png_colorspace_endpoints_match(tls, xy, bp, int32(5)) != 0 { return 0 } /* Too much slip */ return int32(1) } // C documentation // // /* This is the check going the other way. The XYZ is modified to normalize it // * (another side-effect) and the xy chromaticities are returned. // */ func _png_colorspace_check_XYZ(tls *libc.TLS, xy uintptr, XYZ uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* XYZtemp at bp+0 */ Tpng_XYZ _ = result result = _png_XYZ_normalize(tls, XYZ) if result != 0 { return result } result = _png_xy_from_XYZ(tls, xy, XYZ) if result != 0 { return result } *(*Tpng_XYZ)(unsafe.Pointer(bp)) = *(*Tpng_XYZ)(unsafe.Pointer(XYZ)) return _png_colorspace_check_xy(tls, bp, xy) } // C documentation // // /* Used to check for an endpoint match against sRGB */ var _sRGB_xy = Tpng_xy{ Fredx: int32(64000), Fredy: int32(33000), Fgreenx: int32(30000), Fgreeny: int32(60000), Fbluex: int32(15000), Fbluey: int32(6000), Fwhitex: int32(31270), Fwhitey: int32(32900), } func _png_colorspace_set_xy_and_XYZ(tls *libc.TLS, png_ptr Tpng_const_structrp, colorspace Tpng_colorspacerp, xy uintptr, XYZ uintptr, preferred int32) (r int32) { var p1, p2, p3, p4 uintptr _, _, _, _ = p1, p2, p3, p4 if libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fflags)&int32(PNG_COLORSPACE_INVALID1) != 0 { return 0 } /* The consistency check is performed on the chromaticities; this factors out * variations because of the normalization (or not) of the end point Y * values. */ if preferred < int32(2) && libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fflags)&int32(PNG_COLORSPACE_HAVE_ENDPOINTS3) != 0 { /* The end points must be reasonably close to any we already have. The * following allows an error of up to +/-.001 */ if _png_colorspace_endpoints_match(tls, xy, colorspace+4, int32(100)) == 0 { p1 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID1)) Xpng_benign_error(tls, png_ptr, __ccgo_ts+10492) return 0 /* failed */ } /* Only overwrite with preferred values */ if preferred == 0 { return int32(1) } /* ok, but no change */ } (*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fend_points_xy = *(*Tpng_xy)(unsafe.Pointer(xy)) (*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fend_points_XYZ = *(*Tpng_XYZ)(unsafe.Pointer(XYZ)) p2 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p2)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PNG_COLORSPACE_HAVE_ENDPOINTS3)) /* The end points are normally quoted to two decimal digits, so allow +/-0.01 * on this test. */ if _png_colorspace_endpoints_match(tls, xy, uintptr(unsafe.Pointer(&_sRGB_xy)), int32(1000)) != 0 { p3 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p3)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB1)) } else { p4 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p4)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p4))) & (libc.Int32FromInt32(0xffff) ^ libc.Int32FromInt32(PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB1))) } return int32(2) /* ok and changed */ } func Xpng_colorspace_set_chromaticities(tls *libc.TLS, png_ptr Tpng_const_structrp, colorspace Tpng_colorspacerp, xy uintptr, preferred int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var p1, p2 uintptr var _ /* XYZ at bp+0 */ Tpng_XYZ _, _ = p1, p2 switch _png_colorspace_check_xy(tls, bp, xy) { case 0: /* success */ return _png_colorspace_set_xy_and_XYZ(tls, png_ptr, colorspace, xy, bp, preferred) case int32(1): /* We can't invert the chromaticities so we can't produce value XYZ * values. Likely as not a color management system will fail too. */ p1 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID1)) Xpng_benign_error(tls, png_ptr, __ccgo_ts+10520) default: /* libpng is broken; this should be a warning but if it happens we * want error reports so for the moment it is an error. */ p2 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p2)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID1)) Xpng_error(tls, png_ptr, __ccgo_ts+10543) } return 0 /* failed */ } func Xpng_colorspace_set_endpoints(tls *libc.TLS, png_ptr Tpng_const_structrp, colorspace Tpng_colorspacerp, XYZ_in uintptr, preferred int32) (r int32) { bp := tls.Alloc(80) defer tls.Free(80) var p1, p2 uintptr var _ /* XYZ at bp+0 */ Tpng_XYZ var _ /* xy at bp+36 */ Tpng_xy _, _ = p1, p2 *(*Tpng_XYZ)(unsafe.Pointer(bp)) = *(*Tpng_XYZ)(unsafe.Pointer(XYZ_in)) switch _png_colorspace_check_XYZ(tls, bp+36, bp) { case 0: return _png_colorspace_set_xy_and_XYZ(tls, png_ptr, colorspace, bp+36, bp, preferred) case int32(1): /* End points are invalid. */ p1 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID1)) Xpng_benign_error(tls, png_ptr, __ccgo_ts+10582) default: p2 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p2)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID1)) Xpng_error(tls, png_ptr, __ccgo_ts+10543) } return 0 /* failed */ } // C documentation // // /* Error message generation */ func _png_icc_tag_char(tls *libc.TLS, byte1 Tpng_uint_32) (r uint8) { byte1 &= uint32(0xff) if byte1 >= uint32(32) && byte1 <= uint32(126) { return uint8(byte1) } else { return uint8('?') } return r } func _png_icc_tag_name(tls *libc.TLS, name uintptr, tag Tpng_uint_32) { *(*uint8)(unsafe.Pointer(name)) = uint8('\'') *(*uint8)(unsafe.Pointer(name + 1)) = _png_icc_tag_char(tls, tag>>int32(24)) *(*uint8)(unsafe.Pointer(name + 2)) = _png_icc_tag_char(tls, tag>>int32(16)) *(*uint8)(unsafe.Pointer(name + 3)) = _png_icc_tag_char(tls, tag>>int32(8)) *(*uint8)(unsafe.Pointer(name + 4)) = _png_icc_tag_char(tls, tag) *(*uint8)(unsafe.Pointer(name + 5)) = uint8('\'') } func _is_ICC_signature_char(tls *libc.TLS, it Tpng_alloc_size_t) (r int32) { return libc.BoolInt32(it == uint32(32) || it >= uint32(48) && it <= uint32(57) || it >= uint32(65) && it <= uint32(90) || it >= uint32(97) && it <= uint32(122)) } func _is_ICC_signature(tls *libc.TLS, it Tpng_alloc_size_t) (r int32) { return libc.BoolInt32(_is_ICC_signature_char(tls, it>>int32(24)) != 0 && _is_ICC_signature_char(tls, it>>libc.Int32FromInt32(16)&uint32(0xff)) != 0 && _is_ICC_signature_char(tls, it>>libc.Int32FromInt32(8)&uint32(0xff)) != 0 && _is_ICC_signature_char(tls, it&uint32(0xff)) != 0) } func _png_icc_profile_error(tls *libc.TLS, png_ptr Tpng_const_structrp, colorspace Tpng_colorspacerp, name Tpng_const_charp, value Tpng_alloc_size_t, reason Tpng_const_charp) (r int32) { bp := tls.Alloc(224) defer tls.Free(224) var pos, v2, v3 Tsize_t var v4 int32 var p1 uintptr var _ /* message at bp+0 */ [196]uint8 var _ /* number at bp+196 */ [24]uint8 _, _, _, _, _ = pos, v2, v3, v4, p1 /* see below for calculation */ if colorspace != libc.UintptrFromInt32(0) { p1 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID1)) } pos = Xpng_safecat(tls, bp, libc.Uint32FromInt64(196), uint32(0), __ccgo_ts+10601) /* 9 chars */ pos = Xpng_safecat(tls, bp, pos+uint32(79), pos, name) /* Truncate to 79 chars */ pos = Xpng_safecat(tls, bp, libc.Uint32FromInt64(196), pos, __ccgo_ts+10611) /* +2 = 90 */ if _is_ICC_signature(tls, value) != 0 { /* So 'value' is at most 4 bytes and the following cast is safe */ _png_icc_tag_name(tls, bp+uintptr(pos), value) pos += uint32(6) /* total +8; less than the else clause */ v2 = pos pos++ (*(*[196]uint8)(unsafe.Pointer(bp)))[v2] = uint8(':') v3 = pos pos++ (*(*[196]uint8)(unsafe.Pointer(bp)))[v3] = uint8(' ') } else { /* +24 = 114 */ pos = Xpng_safecat(tls, bp, libc.Uint32FromInt64(196), pos, Xpng_format_number(tls, bp+196, bp+196+uintptr(libc.Uint32FromInt64(24)), int32(PNG_NUMBER_FORMAT_x), value)) pos = Xpng_safecat(tls, bp, libc.Uint32FromInt64(196), pos, __ccgo_ts+10615) /* +2 = 116 */ } /* The 'reason' is an arbitrary message, allow +79 maximum 195 */ pos = Xpng_safecat(tls, bp, libc.Uint32FromInt64(196), pos, reason) _ = pos /* This is recoverable, but make it unconditionally an app_error on write to * avoid writing invalid ICC profiles into PNG files (i.e., we handle them * on read, with a warning, but on write unless the app turns off * application errors the PNG won't be written.) */ if colorspace != libc.UintptrFromInt32(0) { v4 = int32(PNG_CHUNK_ERROR) } else { v4 = int32(PNG_CHUNK_WRITE_ERROR) } Xpng_chunk_report(tls, png_ptr, bp, v4) return 0 } func Xpng_colorspace_set_sRGB(tls *libc.TLS, png_ptr Tpng_const_structrp, colorspace Tpng_colorspacerp, intent int32) (r int32) { var p1, p2, p3, p4 uintptr _, _, _, _ = p1, p2, p3, p4 /* Do nothing if the colorspace is already invalidated. */ if libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fflags)&int32(PNG_COLORSPACE_INVALID1) != 0 { return 0 } /* Check the intent, then check for existing settings. It is valid for the * PNG file to have cHRM or gAMA chunks along with sRGB, but the values must * be consistent with the correct values. If, however, this function is * called below because an iCCP chunk matches sRGB then it is quite * conceivable that an older app recorded incorrect gAMA and cHRM because of * an incorrect calculation based on the values in the profile - this does * *not* invalidate the profile (though it still produces an error, which can * be ignored.) */ if intent < 0 || intent >= int32(PNG_sRGB_INTENT_LAST) { return _png_icc_profile_error(tls, png_ptr, colorspace, __ccgo_ts+10619, libc.Uint32FromInt32(intent), __ccgo_ts+10624) } if libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fflags)&int32(PNG_COLORSPACE_HAVE_INTENT1) != 0 && libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Frendering_intent) != intent { return _png_icc_profile_error(tls, png_ptr, colorspace, __ccgo_ts+10619, libc.Uint32FromInt32(intent), __ccgo_ts+10654) } if libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fflags)&int32(PNG_COLORSPACE_FROM_sRGB1) != 0 { Xpng_benign_error(tls, png_ptr, __ccgo_ts+10685) return 0 } /* If the standard sRGB cHRM chunk does not match the one from the PNG file * warn but overwrite the value with the correct one. */ if libc.Int32FromUint16((*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fflags)&int32(PNG_COLORSPACE_HAVE_ENDPOINTS3) != 0 && !(_png_colorspace_endpoints_match(tls, uintptr(unsafe.Pointer(&_sRGB_xy)), colorspace+4, int32(100)) != 0) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+10720, int32(PNG_CHUNK_ERROR)) } /* This check is just done for the error reporting - the routine always * returns true when the 'from' argument corresponds to sRGB (2). */ _png_colorspace_check_gamma(tls, png_ptr, colorspace, int32(PNG_GAMMA_sRGB_INVERSE), int32(2)) /* intent: bugs in GCC force 'int' to be used as the parameter type. */ (*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Frendering_intent = libc.Uint16FromInt32(intent) p1 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLORSPACE_HAVE_INTENT1)) /* endpoints */ (*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fend_points_xy = _sRGB_xy (*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fend_points_XYZ = _sRGB_XYZ p2 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p2)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p2))) | (libc.Int32FromInt32(PNG_COLORSPACE_HAVE_ENDPOINTS3) | libc.Int32FromInt32(PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB1))) /* gamma */ (*Tpng_colorspace1)(unsafe.Pointer(colorspace)).Fgamma = int32(PNG_GAMMA_sRGB_INVERSE) p3 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p3)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p3))) | libc.Int32FromInt32(PNG_COLORSPACE_HAVE_GAMMA3)) /* Finally record that we have an sRGB profile */ p4 = colorspace + 74 *(*Tpng_uint_16)(unsafe.Pointer(p4)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p4))) | (libc.Int32FromInt32(PNG_COLORSPACE_MATCHES_sRGB1) | libc.Int32FromInt32(PNG_COLORSPACE_FROM_sRGB1))) return int32(1) /* set */ } /* sRGB sets known gamma, end points and (from the chunk) intent. */ /* IMPORTANT: these are not necessarily the values found in an ICC profile * because ICC profiles store values adapted to a D50 environment; it is * expected that the ICC profile mediaWhitePointTag will be D50; see the * checks and code elsewhere to understand this better. * * These XYZ values, which are accurate to 5dp, produce rgb to gray * coefficients of (6968,23435,2366), which are reduced (because they add up * to 32769 not 32768) to (6968,23434,2366). These are the values that * libpng has traditionally used (and are the best values given the 15bit * algorithm used by the rgb to gray code.) */ var _sRGB_XYZ = Tpng_XYZ{ Fred_X: int32(41239), Fred_Y: int32(21264), Fred_Z: int32(1933), Fgreen_X: int32(35758), Fgreen_Y: int32(71517), Fgreen_Z: int32(11919), Fblue_X: int32(18048), Fblue_Y: int32(7219), Fblue_Z: int32(95053), } // C documentation // // /* Encoded value of D50 as an ICC XYZNumber. From the ICC 2010 spec the value // * is XYZ(0.9642,1.0,0.8249), which scales to: // * // * (63189.8112, 65536, 54060.6464) // */ var _D50_nCIEXYZ = [12]Tpng_byte{ 2: uint8(0xf6), 3: uint8(0xd6), 5: uint8(0x01), 10: uint8(0xd3), 11: uint8(0x2d), } func _icc_check_length(tls *libc.TLS, png_ptr Tpng_const_structrp, colorspace Tpng_colorspacerp, name Tpng_const_charp, profile_length Tpng_uint_32) (r int32) { if profile_length < uint32(132) { return _png_icc_profile_error(tls, png_ptr, colorspace, name, profile_length, __ccgo_ts+10751) } return int32(1) } func Xpng_icc_check_length(tls *libc.TLS, png_ptr Tpng_const_structrp, colorspace Tpng_colorspacerp, name Tpng_const_charp, profile_length Tpng_uint_32) (r int32) { if !(_icc_check_length(tls, png_ptr, colorspace, name, profile_length) != 0) { return 0 } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max > uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max < profile_length { return _png_icc_profile_error(tls, png_ptr, colorspace, name, profile_length, __ccgo_ts+10761) } } return int32(1) } func Xpng_icc_check_header(tls *libc.TLS, png_ptr Tpng_const_structrp, colorspace Tpng_colorspacerp, name Tpng_const_charp, profile_length Tpng_uint_32, profile Tpng_const_bytep, color_type int32) (r int32) { var temp Tpng_uint_32 _ = temp /* Length check; this cannot be ignored in this code because profile_length * is used later to check the tag table, so even if the profile seems over * long profile_length from the caller must be correct. The caller can fix * this up on read or write by just passing in the profile header length. */ temp = uint32(*(*Tpng_byte)(unsafe.Pointer(profile)))< uint32(3) && profile_length&uint32(3) != 0 { return _png_icc_profile_error(tls, png_ptr, colorspace, name, profile_length, __ccgo_ts+10818) } temp = uint32(*(*Tpng_byte)(unsafe.Pointer(profile + libc.UintptrFromInt32(128))))< uint32(357913930) || profile_length < uint32(132)+uint32(12)*temp { /* truncated tag table */ return _png_icc_profile_error(tls, png_ptr, colorspace, name, temp, __ccgo_ts+10833) } /* The 'intent' must be valid or we can't store it, ICC limits the intent to * 16 bits. */ temp = uint32(*(*Tpng_byte)(unsafe.Pointer(profile + libc.UintptrFromInt32(64))))<= uint32(0xffff) { /* The ICC limit */ return _png_icc_profile_error(tls, png_ptr, colorspace, name, temp, __ccgo_ts+10853) } /* This is just a warning because the profile may be valid in future * versions. */ if temp >= uint32(PNG_sRGB_INTENT_LAST) { _png_icc_profile_error(tls, png_ptr, libc.UintptrFromInt32(0), name, temp, __ccgo_ts+10878) } /* At this point the tag table can't be checked because it hasn't necessarily * been loaded; however, various header fields can be checked. These checks * are for values permitted by the PNG spec in an ICC profile; the PNG spec * restricts the profiles that can be passed in an iCCP chunk (they must be * appropriate to processing PNG data!) */ /* Data checks (could be skipped). These checks must be independent of the * version number; however, the version number doesn't accommodate changes in * the header fields (just the known tags and the interpretation of the * data.) */ temp = uint32(*(*Tpng_byte)(unsafe.Pointer(profile + libc.UintptrFromInt32(36))))< profile_length || tag_length > profile_length-tag_start { return _png_icc_profile_error(tls, png_ptr, colorspace, name, tag_id, __ccgo_ts+11249) } if tag_start&uint32(3) != uint32(0) { /* CNHP730S.icc shipped with Microsoft Windows 64 violates this; it is * only a warning here because libpng does not care about the * alignment. */ _png_icc_profile_error(tls, png_ptr, libc.UintptrFromInt32(0), name, tag_id, __ccgo_ts+11281) } goto _1 _1: ; itag++ tag += uintptr(12) } return int32(1) /* success, maybe with warnings */ } // C documentation // // /* Information about the known ICC sRGB profiles */ var _png_sRGB_checks = [7]struct { Fadler Tpng_uint_32 Fcrc Tpng_uint_32 Flength Tpng_uint_32 Fmd5 [4]Tpng_uint_32 Fhave_md5 Tpng_byte Fis_broken Tpng_byte Fintent Tpng_uint_16 }{ 0: { Fadler: uint32(0x0a3fd9f6), Fcrc: uint32(0x3b8772b9), Flength: uint32(3048), Fmd5: [4]Tpng_uint_32{ 0: uint32(0x29f83dde), 1: uint32(0xaff255ae), 2: uint32(0x7842fae4), 3: uint32(0xca83390d), }, Fhave_md5: libc.BoolUint8(libc.Bool(libc.Bool(libc.Bool(int32(0x29f83dde) != int32(0)) || libc.Bool(uint32(0xaff255ae) != uint32(0))) || libc.Bool(int32(0x7842fae4) != int32(0))) || libc.Bool(uint32(0xca83390d) != uint32(0))), }, 1: { Fadler: uint32(0x4909e5e1), Fcrc: uint32(0x427ebb21), Flength: uint32(3052), Fmd5: [4]Tpng_uint_32{ 0: uint32(0xc95bd637), 1: uint32(0xe95d8a3b), 2: uint32(0x0df38f99), 3: uint32(0xc1320389), }, Fhave_md5: libc.BoolUint8(libc.Bool(libc.Bool(libc.Bool(uint32(0xc95bd637) != uint32(0)) || libc.Bool(uint32(0xe95d8a3b) != uint32(0))) || libc.Bool(int32(0x0df38f99) != int32(0))) || libc.Bool(uint32(0xc1320389) != uint32(0))), Fintent: uint16(1), }, 2: { Fadler: uint32(0xfd2144a1), Fcrc: uint32(0x306fd8ae), Flength: uint32(60988), Fmd5: [4]Tpng_uint_32{ 0: uint32(0xfc663378), 1: uint32(0x37e2886b), 2: uint32(0xfd72e983), 3: uint32(0x8228f1b8), }, Fhave_md5: libc.BoolUint8(libc.Bool(libc.Bool(libc.Bool(uint32(0xfc663378) != uint32(0)) || libc.Bool(int32(0x37e2886b) != int32(0))) || libc.Bool(uint32(0xfd72e983) != uint32(0))) || libc.Bool(uint32(0x8228f1b8) != uint32(0))), }, 3: { Fadler: uint32(0x209c35d2), Fcrc: uint32(0xbbef7812), Flength: uint32(60960), Fmd5: [4]Tpng_uint_32{ 0: uint32(0x34562abf), 1: uint32(0x994ccd06), 2: uint32(0x6d2c5721), 3: uint32(0xd0d68c5d), }, Fhave_md5: libc.BoolUint8(libc.Bool(libc.Bool(libc.Bool(int32(0x34562abf) != int32(0)) || libc.Bool(uint32(0x994ccd06) != uint32(0))) || libc.Bool(int32(0x6d2c5721) != int32(0))) || libc.Bool(uint32(0xd0d68c5d) != uint32(0))), }, 4: { Fadler: uint32(0xa054d762), Fcrc: uint32(0x5d5129ce), Flength: uint32(3024), Fintent: uint16(1), }, 5: { Fadler: uint32(0xf784f3fb), Fcrc: uint32(0x182ea552), Flength: uint32(3144), Fis_broken: uint8(1), }, 6: { Fadler: uint32(0x0398f3fc), Fcrc: uint32(0xf29e526d), Flength: uint32(3144), Fis_broken: uint8(1), Fintent: uint16(1), }, } func _png_compare_ICC_profile_with_sRGB(tls *libc.TLS, png_ptr Tpng_const_structrp, profile Tpng_const_bytep, adler TuLong) (r int32) { var crc TuLong var i uint32 var intent, length Tpng_uint_32 _, _, _, _ = crc, i, intent, length /* The quick check is to verify just the MD5 signature and trust the * rest of the data. Because the profile has already been verified for * correctness this is safe. png_colorspace_set_sRGB will check the 'intent' * field too, so if the profile has been edited with an intent not defined * by sRGB (but maybe defined by a later ICC specification) the read of * the profile will fail at that point. */ length = uint32(0) intent = uint32(0x10000) /* invalid */ crc = uint32(0) /* First see if PNG_SKIP_sRGB_CHECK_PROFILE has been set to "on" */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Foptions>>libc.Int32FromInt32(PNG_SKIP_sRGB_CHECK_PROFILE)&uint32(3) == uint32(PNG_OPTION_ON) { return 0 } i = uint32(0) for { if !(i < libc.Uint32FromInt64(224)/libc.Uint32FromInt64(32)) { break } if uint32(*(*Tpng_byte)(unsafe.Pointer(profile + libc.UintptrFromInt32(84))))< 0 && *(*Tpng_fixed_point)(unsafe.Pointer(bp)) >= 0 && Xpng_muldiv(tls, bp, *(*Tpng_fixed_point)(unsafe.Pointer(bp)), int32(32768), total) != 0 && *(*Tpng_fixed_point)(unsafe.Pointer(bp)) >= 0 && *(*Tpng_fixed_point)(unsafe.Pointer(bp)) <= int32(32768) && *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4)) >= 0 && Xpng_muldiv(tls, bp+4, *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4)), int32(32768), total) != 0 && *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4)) >= 0 && *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4)) <= int32(32768) && *(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) >= 0 && Xpng_muldiv(tls, bp+8, *(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)), int32(32768), total) != 0 && *(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) >= 0 && *(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) <= int32(32768) && *(*Tpng_fixed_point)(unsafe.Pointer(bp))+*(*Tpng_fixed_point)(unsafe.Pointer(bp + 4))+*(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) <= int32(32769) { /* We allow 0 coefficients here. r+g+b may be 32769 if two or * all of the coefficients were rounded up. Handle this by * reducing the *largest* coefficient by 1; this matches the * approach used for the default coefficients in pngrtran.c */ add = 0 if *(*Tpng_fixed_point)(unsafe.Pointer(bp))+*(*Tpng_fixed_point)(unsafe.Pointer(bp + 4))+*(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) > int32(32768) { add = -int32(1) } else { if *(*Tpng_fixed_point)(unsafe.Pointer(bp))+*(*Tpng_fixed_point)(unsafe.Pointer(bp + 4))+*(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) < int32(32768) { add = int32(1) } } if add != 0 { if *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4)) >= *(*Tpng_fixed_point)(unsafe.Pointer(bp)) && *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4)) >= *(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) { *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4)) += add } else { if *(*Tpng_fixed_point)(unsafe.Pointer(bp)) >= *(*Tpng_fixed_point)(unsafe.Pointer(bp + 4)) && *(*Tpng_fixed_point)(unsafe.Pointer(bp)) >= *(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) { *(*Tpng_fixed_point)(unsafe.Pointer(bp)) += add } else { *(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) += add } } } /* Check for an internal error. */ if *(*Tpng_fixed_point)(unsafe.Pointer(bp))+*(*Tpng_fixed_point)(unsafe.Pointer(bp + 4))+*(*Tpng_fixed_point)(unsafe.Pointer(bp + 8)) != int32(32768) { Xpng_error(tls, png_ptr, __ccgo_ts+11451) } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_red_coeff = libc.Uint16FromInt32(*(*Tpng_fixed_point)(unsafe.Pointer(bp))) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_green_coeff = libc.Uint16FromInt32(*(*Tpng_fixed_point)(unsafe.Pointer(bp + 4))) } } else { Xpng_error(tls, png_ptr, __ccgo_ts+11493) } } } func Xpng_check_IHDR(tls *libc.TLS, png_ptr Tpng_const_structrp, width Tpng_uint_32, height Tpng_uint_32, bit_depth int32, color_type int32, interlace_type int32, compression_type int32, filter_type int32) { var error1 int32 _ = error1 error1 = 0 /* Check for width and height valid values */ if width == uint32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+11527) error1 = int32(1) } if width > libc.Uint32FromInt32(0x7fffffff) { Xpng_warning(tls, png_ptr, __ccgo_ts+11555) error1 = int32(1) } /* The bit mask on the first line below must be at least as big as a * png_uint_32. "~7U" is not adequate on 16-bit systems because it will * be an unsigned 16-bit value. Casting to (png_alloc_size_t) makes the * type of the result at least as bit (in bits) as the RHS of the > operator * which also avoids a common warning on 64-bit systems that the comparison * of (png_uint_32) against the constant value on the RHS will always be * false. */ if (width+uint32(7)) & ^libc.Uint32FromInt32(7) > (libc.Uint32FromInt32(-libc.Int32FromInt32(1))-libc.Uint32FromInt32(48)-libc.Uint32FromInt32(1))/libc.Uint32FromInt32(8)-libc.Uint32FromInt32(1) { /* extra max_pixel_depth pad */ /* The size of the row must be within the limits of this architecture. * Because the read code can perform arbitrary transformations the * maximum size is checked here. Because the code in png_read_start_row * adds extra space "for safety's sake" in several places a conservative * limit is used here. * * NOTE: it would be far better to check the size that is actually used, * but the effect in the real world is minor and the changes are more * extensive, therefore much more dangerous and much more difficult to * write in a way that avoids compiler warnings. */ Xpng_warning(tls, png_ptr, __ccgo_ts+11583) error1 = int32(1) } if width > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_width_max { Xpng_warning(tls, png_ptr, __ccgo_ts+11630) error1 = int32(1) } if height == uint32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+11669) error1 = int32(1) } if height > libc.Uint32FromInt32(0x7fffffff) { Xpng_warning(tls, png_ptr, __ccgo_ts+11698) error1 = int32(1) } if height > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_height_max { Xpng_warning(tls, png_ptr, __ccgo_ts+11727) error1 = int32(1) } /* Check other values */ if bit_depth != int32(1) && bit_depth != int32(2) && bit_depth != int32(4) && bit_depth != int32(8) && bit_depth != int32(16) { Xpng_warning(tls, png_ptr, __ccgo_ts+11767) error1 = int32(1) } if color_type < 0 || color_type == int32(1) || color_type == int32(5) || color_type > int32(6) { Xpng_warning(tls, png_ptr, __ccgo_ts+11793) error1 = int32(1) } if color_type == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) && bit_depth > int32(8) || (color_type == int32(PNG_COLOR_MASK_COLOR) || color_type == int32(PNG_COLOR_MASK_ALPHA) || color_type == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA)) && bit_depth < int32(8) { Xpng_warning(tls, png_ptr, __ccgo_ts+11820) error1 = int32(1) } if interlace_type >= int32(PNG_INTERLACE_LAST) { Xpng_warning(tls, png_ptr, __ccgo_ts+11869) error1 = int32(1) } if compression_type != PNG_COMPRESSION_TYPE_BASE { Xpng_warning(tls, png_ptr, __ccgo_ts+11902) error1 = int32(1) } /* Accept filter_method 64 (intrapixel differencing) only if * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and * 2. Libpng did not read a PNG signature (this filter_method is only * used in PNG datastreams that are embedded in MNG datastreams) and * 3. The application called png_permit_mng_features with a mask that * included PNG_FLAG_MNG_FILTER_64 and * 4. The filter_method is 64 and * 5. The color_type is RGB or RGBA */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x1000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted != uint32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+11937) } if filter_type != PNG_FILTER_TYPE_BASE { if !((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted&uint32(PNG_FLAG_MNG_FILTER_641) != uint32(0) && filter_type == int32(PNG_INTRAPIXEL_DIFFERENCING) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x1000) == uint32(0) && (color_type == int32(PNG_COLOR_MASK_COLOR) || color_type == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA))) { Xpng_warning(tls, png_ptr, __ccgo_ts+11986) error1 = int32(1) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x1000) != uint32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+12016) error1 = int32(1) } } if error1 == int32(1) { Xpng_error(tls, png_ptr, __ccgo_ts+12046) } } /* ASCII to fp functions */ /* Check an ASCII formatted floating point value, see the more detailed * comments in pngpriv.h */ /* The following is used internally to preserve the sticky flags */ func Xpng_check_fp_number(tls *libc.TLS, string1 Tpng_const_charp, size Tsize_t, statep uintptr, whereami uintptr) (r int32) { var i Tsize_t var state, type1 int32 _, _, _ = i, state, type1 state = *(*int32)(unsafe.Pointer(statep)) i = *(*Tsize_t)(unsafe.Pointer(whereami)) for i < size { /* First find the type of the next character */ switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(string1 + uintptr(i)))) { case int32(43): type1 = int32(PNG_FP_SAW_SIGN) case int32(45): type1 = libc.Int32FromInt32(PNG_FP_SAW_SIGN) + libc.Int32FromInt32(PNG_FP_NEGATIVE) case int32(46): type1 = int32(PNG_FP_SAW_DOT) case int32(48): type1 = int32(PNG_FP_SAW_DIGIT) case int32(49): fallthrough case int32(50): fallthrough case int32(51): fallthrough case int32(52): fallthrough case int32(53): fallthrough case int32(54): fallthrough case int32(55): fallthrough case int32(56): fallthrough case int32(57): type1 = libc.Int32FromInt32(PNG_FP_SAW_DIGIT) + libc.Int32FromInt32(PNG_FP_NONZERO) case int32(69): fallthrough case int32(101): type1 = int32(PNG_FP_SAW_E) default: goto PNG_FP_End } /* Now deal with this type according to the current * state, the type is arranged to not overlap the * bits of the PNG_FP_STATE. */ switch state&libc.Int32FromInt32(PNG_FP_STATE) + type1&libc.Int32FromInt32(PNG_FP_SAW_ANY) { case libc.Int32FromInt32(PNG_FP_INTEGER) + libc.Int32FromInt32(PNG_FP_SAW_SIGN): if state&int32(PNG_FP_SAW_ANY) != 0 { goto PNG_FP_End } /* not a part of the number */ state |= type1 case libc.Int32FromInt32(PNG_FP_INTEGER) + libc.Int32FromInt32(PNG_FP_SAW_DOT): /* Ok as trailer, ok as lead of fraction. */ if state&int32(PNG_FP_SAW_DOT) != 0 { /* two dots */ goto PNG_FP_End } else { if state&int32(PNG_FP_SAW_DIGIT) != 0 { /* trailing dot? */ state |= type1 } else { state = int32(PNG_FP_FRACTION) | type1 | state&int32(PNG_FP_STICKY) } } case libc.Int32FromInt32(PNG_FP_INTEGER) + libc.Int32FromInt32(PNG_FP_SAW_DIGIT): if state&int32(PNG_FP_SAW_DOT) != 0 { /* delayed fraction */ state = libc.Int32FromInt32(PNG_FP_FRACTION) | libc.Int32FromInt32(PNG_FP_SAW_DOT) | state&int32(PNG_FP_STICKY) } state |= type1 | int32(PNG_FP_WAS_VALID) case libc.Int32FromInt32(PNG_FP_INTEGER) + libc.Int32FromInt32(PNG_FP_SAW_E): if state&int32(PNG_FP_SAW_DIGIT) == 0 { goto PNG_FP_End } state = int32(PNG_FP_EXPONENT) | state&int32(PNG_FP_STICKY) break /* case PNG_FP_FRACTION + PNG_FP_SAW_SIGN: goto PNG_FP_End; ** no sign in fraction */ /* case PNG_FP_FRACTION + PNG_FP_SAW_DOT: goto PNG_FP_End; ** Because SAW_DOT is always set */ case libc.Int32FromInt32(PNG_FP_FRACTION) + libc.Int32FromInt32(PNG_FP_SAW_DIGIT): state |= type1 | int32(PNG_FP_WAS_VALID) case libc.Int32FromInt32(PNG_FP_FRACTION) + libc.Int32FromInt32(PNG_FP_SAW_E): /* This is correct because the trailing '.' on an * integer is handled above - so we can only get here * with the sequence ".E" (with no preceding digits). */ if state&int32(PNG_FP_SAW_DIGIT) == 0 { goto PNG_FP_End } state = int32(PNG_FP_EXPONENT) | state&int32(PNG_FP_STICKY) case libc.Int32FromInt32(PNG_FP_EXPONENT) + libc.Int32FromInt32(PNG_FP_SAW_SIGN): if state&int32(PNG_FP_SAW_ANY) != 0 { goto PNG_FP_End } /* not a part of the number */ state |= int32(PNG_FP_SAW_SIGN) break /* case PNG_FP_EXPONENT + PNG_FP_SAW_DOT: goto PNG_FP_End; */ case libc.Int32FromInt32(PNG_FP_EXPONENT) + libc.Int32FromInt32(PNG_FP_SAW_DIGIT): state |= libc.Int32FromInt32(PNG_FP_SAW_DIGIT) | libc.Int32FromInt32(PNG_FP_WAS_VALID) break /* case PNG_FP_EXPONEXT + PNG_FP_SAW_E: goto PNG_FP_End; */ default: goto PNG_FP_End /* I.e. break 2 */ } /* The character seems ok, continue. */ i++ } goto PNG_FP_End PNG_FP_End: ; /* Here at the end, update the state and return the correct * return code. */ *(*int32)(unsafe.Pointer(statep)) = state *(*Tsize_t)(unsafe.Pointer(whereami)) = i return libc.BoolInt32(state&int32(PNG_FP_SAW_DIGIT) != 0) } // C documentation // // /* The same but for a complete string. */ func Xpng_check_fp_string(tls *libc.TLS, string1 Tpng_const_charp, size Tsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* char_index at bp+4 */ Tsize_t var _ /* state at bp+0 */ int32 *(*int32)(unsafe.Pointer(bp)) = 0 *(*Tsize_t)(unsafe.Pointer(bp + 4)) = uint32(0) if Xpng_check_fp_number(tls, string1, size, bp, bp+4) != 0 && (*(*Tsize_t)(unsafe.Pointer(bp + 4)) == size || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(string1 + uintptr(*(*Tsize_t)(unsafe.Pointer(bp + 4)))))) == 0) { return *(*int32)(unsafe.Pointer(bp)) } return 0 /* i.e. fail */ } // C documentation // // /* Utility used below - a simple accurate power of ten from an integral // * exponent. // */ func _png_pow10(tls *libc.TLS, power int32) (r float64) { var d, mult float64 var recip int32 _, _, _ = d, mult, recip recip = 0 d = libc.Float64FromInt32(1) /* Handle negative exponent with a reciprocal at the end because * 10 is exact whereas .1 is inexact in base 2 */ if power < 0 { if power < -int32(307) { return libc.Float64FromInt32(0) } recip = int32(1) power = -power } if power > 0 { /* Decompose power bitwise. */ mult = libc.Float64FromInt32(10) for cond := true; cond; cond = power > 0 { if power&int32(1) != 0 { d *= mult } mult *= mult power >>= int32(1) } if recip != 0 { d = libc.Float64FromInt32(1) / d } } /* else power is 0 and d is 1 */ return d } // C documentation // // /* Function to format a floating point value in ASCII with a given // * precision. // */ func Xpng_ascii_from_fp(tls *libc.TLS, png_ptr Tpng_const_structrp, ascii Tpng_charp, size Tsize_t, fp float64, precision uint32) { bp := tls.Alloc(16) defer tls.Free(16) var base, test float64 var cdigits, clead, czero, uexp_b10, v13, v15 uint32 var ch, ch1, v9 int32 var exponent [10]uint8 var v1, v10, v11, v12, v14, v16, v17, v18, v19, v2, v3, v4, v5, v6, v7, v8 Tpng_charp var _ /* d at bp+8 */ float64 var _ /* exp_b10 at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = base, cdigits, ch, ch1, clead, czero, exponent, test, uexp_b10, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v3, v4, v5, v6, v7, v8, v9 /* We use standard functions from math.h, but not printf because * that would require stdio. The caller must supply a buffer of * sufficient size or we will png_error. The tests on size and * the space in ascii[] consumed are indicated below. */ if precision < uint32(1) { precision = uint32(DBL_DIG) } /* Enforce the limit of the implementation precision too. */ if precision > libc.Uint32FromInt32(libc.Int32FromInt32(DBL_DIG)+libc.Int32FromInt32(1)) { precision = libc.Uint32FromInt32(libc.Int32FromInt32(DBL_DIG) + libc.Int32FromInt32(1)) } /* Basic sanity checks */ if size >= precision+uint32(5) { /* See the requirements below. */ if fp < libc.Float64FromInt32(0) { fp = -fp v1 = ascii ascii++ *(*uint8)(unsafe.Pointer(v1)) = uint8(45) /* '-' PLUS 1 TOTAL 1 */ size-- } if fp >= float64(2.2250738585072014e-308) && fp <= float64(1.7976931348623157e+308) { /* 10^exp_b10 */ /* First extract a base 10 exponent of the number, * the calculation below rounds down when converting * from base 2 to base 10 (multiply by log10(2) - * 0.3010, but 77/256 is 0.3008, so exp_b10 needs to * be increased. Note that the arithmetic shift * performs a floor() unlike C arithmetic - using a * C multiply would break the following for negative * exponents. */ libc.Xfrexp(tls, fp, bp) /* exponent to base 2 */ *(*int32)(unsafe.Pointer(bp)) = *(*int32)(unsafe.Pointer(bp)) * int32(77) >> int32(8) /* <= exponent to base 10 */ /* Avoid underflow here. */ base = _png_pow10(tls, *(*int32)(unsafe.Pointer(bp))) /* May underflow */ for base < float64(2.2250738585072014e-308) || base < fp { /* And this may overflow. */ test = _png_pow10(tls, *(*int32)(unsafe.Pointer(bp))+int32(1)) if test <= float64(1.7976931348623157e+308) { *(*int32)(unsafe.Pointer(bp))++ base = test } else { break } } /* Normalize fp and correct exp_b10, after this fp is in the * range [.1,1) and exp_b10 is both the exponent and the digit * *before* which the decimal point should be inserted * (starting with 0 for the first digit). Note that this * works even if 10^exp_b10 is out of range because of the * test on DBL_MAX above. */ fp /= base for fp >= libc.Float64FromInt32(1) { fp /= libc.Float64FromInt32(10) *(*int32)(unsafe.Pointer(bp))++ } /* Because of the code above fp may, at this point, be * less than .1, this is ok because the code below can * handle the leading zeros this generates, so no attempt * is made to correct that here. */ /* Allow up to two leading zeros - this will not lengthen * the number compared to using E-n. */ if *(*int32)(unsafe.Pointer(bp)) < 0 && *(*int32)(unsafe.Pointer(bp)) > -int32(3) { /* PLUS 3 TOTAL 4 */ czero = 0 - libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(bp))) /* PLUS 2 digits: TOTAL 3 */ *(*int32)(unsafe.Pointer(bp)) = 0 /* Dot added below before first output. */ } else { czero = uint32(0) } /* No zeros to add */ /* Generate the digit list, stripping trailing zeros and * inserting a '.' before a digit if the exponent is 0. */ clead = czero /* Count of leading zeros */ cdigits = uint32(0) /* Count of digits in list. */ for cond := true; cond; cond = cdigits+czero < precision+clead && fp > float64(2.2250738585072014e-308) { fp *= libc.Float64FromInt32(10) /* Use modf here, not floor and subtract, so that * the separation is done in one step. At the end * of the loop don't break the number into parts so * that the final digit is rounded. */ if cdigits+czero+uint32(1) < precision+clead { fp = libc.Xmodf(tls, fp, bp+8) } else { *(*float64)(unsafe.Pointer(bp + 8)) = libc.Xfloor(tls, fp+float64(0.5)) if *(*float64)(unsafe.Pointer(bp + 8)) > libc.Float64FromInt32(9) { /* Rounding up to 10, handle that here. */ if czero > uint32(0) { czero-- *(*float64)(unsafe.Pointer(bp + 8)) = libc.Float64FromInt32(1) if cdigits == uint32(0) { clead-- } } else { for cdigits > uint32(0) && *(*float64)(unsafe.Pointer(bp + 8)) > libc.Float64FromInt32(9) { ascii-- v2 = ascii ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v2))) if *(*int32)(unsafe.Pointer(bp)) != -int32(1) { *(*int32)(unsafe.Pointer(bp))++ } else { if ch == int32(46) { ascii-- v3 = ascii ch = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v3))) size++ /* Advance exp_b10 to '1', so that the * decimal point happens after the * previous digit. */ *(*int32)(unsafe.Pointer(bp)) = int32(1) } } cdigits-- *(*float64)(unsafe.Pointer(bp + 8)) = float64(ch - int32(47)) /* I.e. 1+(ch-48) */ } /* Did we reach the beginning? If so adjust the * exponent but take into account the leading * decimal point. */ if *(*float64)(unsafe.Pointer(bp + 8)) > libc.Float64FromInt32(9) { /* cdigits == 0 */ if *(*int32)(unsafe.Pointer(bp)) == -int32(1) { ascii-- v4 = ascii /* Leading decimal point (plus zeros?), if * we lose the decimal point here it must * be reentered below. */ ch1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v4))) if ch1 == int32(46) { size++ *(*int32)(unsafe.Pointer(bp)) = int32(1) } /* Else lost a leading zero, so 'exp_b10' is * still ok at (-1) */ } else { *(*int32)(unsafe.Pointer(bp))++ } /* In all cases we output a '1' */ *(*float64)(unsafe.Pointer(bp + 8)) = libc.Float64FromInt32(1) } } } fp = libc.Float64FromInt32(0) /* Guarantees termination below. */ } if *(*float64)(unsafe.Pointer(bp + 8)) == libc.Float64FromInt32(0) { czero++ if cdigits == uint32(0) { clead++ } } else { /* Included embedded zeros in the digit count. */ cdigits += czero - clead clead = uint32(0) for czero > uint32(0) { /* exp_b10 == (-1) means we just output the decimal * place - after the DP don't adjust 'exp_b10' any * more! */ if *(*int32)(unsafe.Pointer(bp)) != -int32(1) { if *(*int32)(unsafe.Pointer(bp)) == 0 { v5 = ascii ascii++ *(*uint8)(unsafe.Pointer(v5)) = uint8(46) size-- } /* PLUS 1: TOTAL 4 */ *(*int32)(unsafe.Pointer(bp))-- } v6 = ascii ascii++ *(*uint8)(unsafe.Pointer(v6)) = uint8(48) czero-- } if *(*int32)(unsafe.Pointer(bp)) != -int32(1) { if *(*int32)(unsafe.Pointer(bp)) == 0 { v7 = ascii ascii++ *(*uint8)(unsafe.Pointer(v7)) = uint8(46) size-- /* counted above */ } *(*int32)(unsafe.Pointer(bp))-- } v8 = ascii ascii++ *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromInt32(48) + int32(*(*float64)(unsafe.Pointer(bp + 8)))) cdigits++ } } /* The total output count (max) is now 4+precision */ /* Check for an exponent, if we don't need one we are * done and just need to terminate the string. At this * point, exp_b10==(-1) is effectively a flag: it got * to '-1' because of the decrement, after outputting * the decimal point above. (The exponent required is * *not* -1.) */ if *(*int32)(unsafe.Pointer(bp)) >= -int32(1) && *(*int32)(unsafe.Pointer(bp)) <= int32(2) { /* The following only happens if we didn't output the * leading zeros above for negative exponent, so this * doesn't add to the digit requirement. Note that the * two zeros here can only be output if the two leading * zeros were *not* output, so this doesn't increase * the output count. */ for { v9 = *(*int32)(unsafe.Pointer(bp)) *(*int32)(unsafe.Pointer(bp))-- if !(v9 > 0) { break } v10 = ascii ascii++ *(*uint8)(unsafe.Pointer(v10)) = uint8(48) } *(*uint8)(unsafe.Pointer(ascii)) = uint8(0) /* Total buffer requirement (including the '\0') is * 5+precision - see check at the start. */ return } /* Here if an exponent is required, adjust size for * the digits we output but did not count. The total * digit output here so far is at most 1+precision - no * decimal point and no leading or trailing zeros have * been output. */ size -= cdigits v11 = ascii ascii++ *(*uint8)(unsafe.Pointer(v11)) = uint8(69) size-- /* 'E': PLUS 1 TOTAL 2+precision */ /* The following use of an unsigned temporary avoids ambiguities in * the signed arithmetic on exp_b10 and permits GCC at least to do * better optimization. */ if *(*int32)(unsafe.Pointer(bp)) < 0 { v12 = ascii ascii++ *(*uint8)(unsafe.Pointer(v12)) = uint8(45) size-- /* '-': PLUS 1 TOTAL 3+precision */ uexp_b10 = 0 - libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(bp))) } else { uexp_b10 = 0 + libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(bp))) } cdigits = uint32(0) for uexp_b10 > uint32(0) { v13 = cdigits cdigits++ exponent[v13] = uint8(libc.Uint32FromInt32(48) + uexp_b10%libc.Uint32FromInt32(10)) uexp_b10 /= uint32(10) } /* Need another size check here for the exponent digits, so * this need not be considered above. */ if size > cdigits { for cdigits > uint32(0) { v14 = ascii ascii++ cdigits-- v15 = cdigits *(*uint8)(unsafe.Pointer(v14)) = exponent[v15] } *(*uint8)(unsafe.Pointer(ascii)) = uint8(0) return } } else { if !(fp >= libc.Float64FromFloat64(2.2250738585072014e-308)) { v16 = ascii ascii++ *(*uint8)(unsafe.Pointer(v16)) = uint8(48) /* '0' */ *(*uint8)(unsafe.Pointer(ascii)) = uint8(0) return } else { v17 = ascii ascii++ *(*uint8)(unsafe.Pointer(v17)) = uint8(105) /* 'i' */ v18 = ascii ascii++ *(*uint8)(unsafe.Pointer(v18)) = uint8(110) /* 'n' */ v19 = ascii ascii++ *(*uint8)(unsafe.Pointer(v19)) = uint8(102) /* 'f' */ *(*uint8)(unsafe.Pointer(ascii)) = uint8(0) return } } } /* Here on buffer too small. */ Xpng_error(tls, png_ptr, __ccgo_ts+12064) } // C documentation // // /* Function to format a fixed point value in ASCII. // */ func Xpng_ascii_from_fixed(tls *libc.TLS, png_ptr Tpng_const_structrp, ascii Tpng_charp, size Tsize_t, fp Tpng_fixed_point) { var digits [10]uint8 var first, i, ndigits, tmp, v2, v4, v8 uint32 var num Tpng_uint_32 var v1, v3, v5, v6, v7, v9 Tpng_charp _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = digits, first, i, ndigits, num, tmp, v1, v2, v3, v4, v5, v6, v7, v8, v9 /* Require space for 10 decimal digits, a decimal point, a minus sign and a * trailing \0, 13 characters: */ if size > uint32(12) { /* Avoid overflow here on the minimum integer. */ if fp < 0 { v1 = ascii ascii++ *(*uint8)(unsafe.Pointer(v1)) = uint8(45) num = libc.Uint32FromInt32(-fp) } else { num = libc.Uint32FromInt32(fp) } if num <= uint32(0x80000000) { /* else overflowed */ ndigits = uint32(0) first = uint32(16) digits = [10]uint8{} for num != 0 { /* Split the low digit off num: */ tmp = num / uint32(10) num -= tmp * uint32(10) v2 = ndigits ndigits++ digits[v2] = uint8(libc.Uint32FromInt32(48) + num) /* Record the first non-zero digit, note that this is a number * starting at 1, it's not actually the array index. */ if first == uint32(16) && num > uint32(0) { first = ndigits } num = tmp } if ndigits > uint32(0) { for ndigits > uint32(5) { v3 = ascii ascii++ ndigits-- v4 = ndigits *(*uint8)(unsafe.Pointer(v3)) = digits[v4] } /* The remaining digits are fractional digits, ndigits is '5' or * smaller at this point. It is certainly not zero. Check for a * non-zero fractional digit: */ if first <= uint32(5) { v5 = ascii ascii++ *(*uint8)(unsafe.Pointer(v5)) = uint8(46) /* decimal point */ /* ndigits may be <5 for small numbers, output leading zeros * then ndigits digits to first: */ i = uint32(5) for ndigits < i { v6 = ascii ascii++ *(*uint8)(unsafe.Pointer(v6)) = uint8(48) i-- } for ndigits >= first { v7 = ascii ascii++ ndigits-- v8 = ndigits *(*uint8)(unsafe.Pointer(v7)) = digits[v8] } /* Don't output the trailing zeros! */ } } else { v9 = ascii ascii++ *(*uint8)(unsafe.Pointer(v9)) = uint8(48) } /* And null terminate the string: */ *(*uint8)(unsafe.Pointer(ascii)) = uint8(0) return } } /* Here on buffer too small. */ Xpng_error(tls, png_ptr, __ccgo_ts+12064) } func Xpng_fixed(tls *libc.TLS, png_ptr Tpng_const_structrp, fp float64, text Tpng_const_charp) (r1 Tpng_fixed_point) { var r float64 _ = r r = libc.Xfloor(tls, libc.Float64FromInt32(100000)*fp+float64(0.5)) if r > float64(2.147483647e+09) || r < -libc.Float64FromFloat64(2.147483648e+09) { Xpng_fixed_error(tls, png_ptr, text) } return int32(r) } // C documentation // // /* muldiv functions */ // /* This API takes signed arguments and rounds the result to the nearest // * integer (or, for a fixed point number - the standard argument - to // * the nearest .00001). Overflow and divide by zero are signalled in // * the result, a boolean - true on success, false on overflow. // */ func Xpng_muldiv(tls *libc.TLS, res Tpng_fixed_point_p, a Tpng_fixed_point, times Tpng_int_32, divisor Tpng_int_32) (r1 int32) { var r float64 _ = r /* Return a * times / divisor, rounded. */ if divisor != 0 { if a == 0 || times == 0 { *(*Tpng_fixed_point)(unsafe.Pointer(res)) = 0 return int32(1) } else { r = float64(a) r *= float64(times) r /= float64(divisor) r = libc.Xfloor(tls, r+float64(0.5)) /* A png_fixed_point is a 32-bit integer. */ if r <= float64(2.147483647e+09) && r >= -libc.Float64FromFloat64(2.147483648e+09) { *(*Tpng_fixed_point)(unsafe.Pointer(res)) = int32(r) return int32(1) } } } return 0 } // C documentation // // /* The following is for when the caller doesn't much care about the // * result. // */ func Xpng_muldiv_warn(tls *libc.TLS, png_ptr Tpng_const_structrp, a Tpng_fixed_point, times Tpng_int_32, divisor Tpng_int_32) (r Tpng_fixed_point) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* result at bp+0 */ Tpng_fixed_point if Xpng_muldiv(tls, bp, a, times, divisor) != 0 { return *(*Tpng_fixed_point)(unsafe.Pointer(bp)) } Xpng_warning(tls, png_ptr, __ccgo_ts+12098) return 0 } // C documentation // // /* Calculate a reciprocal, return 0 on div-by-zero or overflow. */ func Xpng_reciprocal(tls *libc.TLS, a Tpng_fixed_point) (r1 Tpng_fixed_point) { var r float64 _ = r r = libc.Xfloor(tls, float64(1e+10)/float64(a)+float64(0.5)) if r <= float64(2.147483647e+09) && r >= -libc.Float64FromFloat64(2.147483648e+09) { return int32(r) } return 0 /* error/overflow */ } // C documentation // // /* This is the shared test on whether a gamma value is 'significant' - whether // * it is worth doing gamma correction. // */ func Xpng_gamma_significant(tls *libc.TLS, gamma_val Tpng_fixed_point) (r int32) { return libc.BoolInt32(gamma_val < libc.Int32FromInt32(PNG_FP_1)-libc.Int32FromInt32(PNG_GAMMA_THRESHOLD_FIXED) || gamma_val > libc.Int32FromInt32(PNG_FP_1)+libc.Int32FromInt32(PNG_GAMMA_THRESHOLD_FIXED)) } // C documentation // // /* A local convenience routine. */ func _png_product2(tls *libc.TLS, a Tpng_fixed_point, b Tpng_fixed_point) (r1 Tpng_fixed_point) { var r float64 _ = r /* The required result is 1/a * 1/b; the following preserves accuracy. */ r = float64(a) * float64(1e-05) r *= float64(b) r = libc.Xfloor(tls, r+float64(0.5)) if r <= float64(2.147483647e+09) && r >= -libc.Float64FromFloat64(2.147483648e+09) { return int32(r) } return 0 /* overflow */ } // C documentation // // /* The inverse of the above. */ func Xpng_reciprocal2(tls *libc.TLS, a Tpng_fixed_point, b Tpng_fixed_point) (r1 Tpng_fixed_point) { var r float64 _ = r /* The required result is 1/a * 1/b; the following preserves accuracy. */ if a != 0 && b != 0 { r = float64(1e+15) / float64(a) r /= float64(b) r = libc.Xfloor(tls, r+float64(0.5)) if r <= float64(2.147483647e+09) && r >= -libc.Float64FromFloat64(2.147483648e+09) { return int32(r) } } return 0 /* overflow */ } func Xpng_gamma_8bit_correct(tls *libc.TLS, value uint32, gamma_val Tpng_fixed_point) (r1 Tpng_byte) { var r float64 _ = r if value > uint32(0) && value < uint32(255) { /* 'value' is unsigned, ANSI-C90 requires the compiler to correctly * convert this to a floating point value. This includes values that * would overflow if 'value' were to be converted to 'int'. * * Apparently GCC, however, does an intermediate conversion to (int) * on some (ARM) but not all (x86) platforms, possibly because of * hardware FP limitations. (E.g. if the hardware conversion always * assumes the integer register contains a signed value.) This results * in ANSI-C undefined behavior for large values. * * Other implementations on the same machine might actually be ANSI-C90 * conformant and therefore compile spurious extra code for the large * values. * * We can be reasonably sure that an unsigned to float conversion * won't be faster than an int to float one. Therefore this code * assumes responsibility for the undefined behavior, which it knows * can't happen because of the check above. * * Note the argument to this routine is an (unsigned int) because, on * 16-bit platforms, it is assigned a value which might be out of * range for an (int); that would result in undefined behavior in the * caller if the *argument* ('value') were to be declared (int). */ r = libc.Xfloor(tls, libc.Float64FromInt32(255)*libc.Xpow(tls, float64(libc.Int32FromUint32(value))/float64(255), float64(gamma_val)*float64(1e-05))+float64(0.5)) return uint8(r) } return uint8(value & libc.Uint32FromInt32(0xff)) } func Xpng_gamma_16bit_correct(tls *libc.TLS, value uint32, gamma_val Tpng_fixed_point) (r1 Tpng_uint_16) { var r float64 _ = r if value > uint32(0) && value < uint32(65535) { /* The same (unsigned int)->(double) constraints apply here as above, * however in this case the (unsigned int) to (int) conversion can * overflow on an ANSI-C90 compliant system so the cast needs to ensure * that this is not possible. */ r = libc.Xfloor(tls, libc.Float64FromInt32(65535)*libc.Xpow(tls, float64(libc.Int32FromUint32(value))/float64(65535), float64(gamma_val)*float64(1e-05))+float64(0.5)) return uint16(r) } return uint16(value) } // C documentation // // /* This does the right thing based on the bit_depth field of the // * png_struct, interpreting values as 8-bit or 16-bit. While the result // * is nominally a 16-bit value if bit depth is 8 then the result is // * 8-bit (as are the arguments.) // */ func Xpng_gamma_correct(tls *libc.TLS, png_ptr Tpng_structrp, value uint32, gamma_val Tpng_fixed_point) (r Tpng_uint_16) { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) == int32(8) { return uint16(Xpng_gamma_8bit_correct(tls, value, gamma_val)) } else { return Xpng_gamma_16bit_correct(tls, value, gamma_val) } return r } // C documentation // // /* Internal function to build a single 16-bit table - the table consists of // * 'num' 256 entry subtables, where 'num' is determined by 'shift' - the amount // * to shift the input values right (or 16-number_of_signifiant_bits). // * // * The caller is responsible for ensuring that the table gets cleaned up on // * png_error (i.e. if one of the mallocs below fails) - i.e. the *table argument // * should be somewhere that will be cleaned. // */ func _png_build_16bit_table(tls *libc.TLS, png_ptr Tpng_structrp, ptable uintptr, shift uint32, gamma_val Tpng_fixed_point) { var d, fmax float64 var i, j, j1, max, max_by_2, num uint32 var ig, ig1 Tpng_uint_32 var sub_table Tpng_uint_16p var table, v1 Tpng_uint_16pp var v3 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d, fmax, i, ig, ig1, j, j1, max, max_by_2, num, sub_table, table, v1, v3 /* Various values derived from 'shift': */ num = uint32(1) << (uint32(8) - shift) /* CSE the division and work round wacky GCC warnings (see the comments * in png_gamma_8bit_correct for where these come from.) */ fmax = float64(1) / float64(libc.Int32FromInt32(1)<<(libc.Uint32FromUint32(16)-shift)-libc.Int32FromInt32(1)) max = uint32(1)<<(uint32(16)-shift) - uint32(1) max_by_2 = uint32(1) << (uint32(15) - shift) v1 = Xpng_calloc(tls, png_ptr, num*libc.Uint32FromInt64(4)) *(*Tpng_uint_16pp)(unsafe.Pointer(ptable)) = v1 table = v1 i = uint32(0) for { if !(i < num) { break } v3 = Xpng_malloc(tls, png_ptr, libc.Uint32FromInt32(256)*libc.Uint32FromInt64(2)) *(*uintptr)(unsafe.Pointer(table + uintptr(i)*4)) = v3 sub_table = v3 /* The 'threshold' test is repeated here because it can arise for one of * the 16-bit tables even if the others don't hit it. */ if Xpng_gamma_significant(tls, gamma_val) != 0 { j = uint32(0) for { if !(j < uint32(256)) { break } ig = j<<(uint32(8)-shift) + i /* Inline the 'max' scaling operation: */ /* See png_gamma_8bit_correct for why the cast to (int) is * required here. */ d = libc.Xfloor(tls, float64(65535)*libc.Xpow(tls, float64(ig)*fmax, float64(gamma_val)*float64(1e-05))+float64(0.5)) *(*Tpng_uint_16)(unsafe.Pointer(sub_table + uintptr(j)*2)) = uint16(d) goto _4 _4: ; j++ } } else { j1 = uint32(0) for { if !(j1 < uint32(256)) { break } ig1 = j1<<(uint32(8)-shift) + i if shift != uint32(0) { ig1 = (ig1*uint32(65535) + max_by_2) / max } *(*Tpng_uint_16)(unsafe.Pointer(sub_table + uintptr(j1)*2)) = uint16(ig1) goto _5 _5: ; j1++ } } goto _2 _2: ; i++ } } // C documentation // // /* NOTE: this function expects the *inverse* of the overall gamma transformation // * required. // */ func _png_build_16to8_table(tls *libc.TLS, png_ptr Tpng_structrp, ptable uintptr, shift uint32, gamma_val Tpng_fixed_point) { var bound, last Tpng_uint_32 var i, max, num uint32 var out Tpng_uint_16 var table, v1 Tpng_uint_16pp _, _, _, _, _, _, _, _ = bound, i, last, max, num, out, table, v1 num = uint32(1) << (uint32(8) - shift) max = uint32(1)<<(uint32(16)-shift) - uint32(1) v1 = Xpng_calloc(tls, png_ptr, num*libc.Uint32FromInt64(4)) *(*Tpng_uint_16pp)(unsafe.Pointer(ptable)) = v1 table = v1 /* 'num' is the number of tables and also the number of low bits of low * bits of the input 16-bit value used to select a table. Each table is * itself indexed by the high 8 bits of the value. */ i = uint32(0) for { if !(i < num) { break } *(*uintptr)(unsafe.Pointer(table + uintptr(i)*4)) = Xpng_malloc(tls, png_ptr, libc.Uint32FromInt32(256)*libc.Uint32FromInt64(2)) goto _2 _2: ; i++ } /* 'gamma_val' is set to the reciprocal of the value calculated above, so * pow(out,g) is an *input* value. 'last' is the last input value set. * * In the loop 'i' is used to find output values. Since the output is * 8-bit there are only 256 possible values. The tables are set up to * select the closest possible output value for each input by finding * the input value at the boundary between each pair of output values * and filling the table up to that boundary with the lower output * value. * * The boundary values are 0.5,1.5..253.5,254.5. Since these are 9-bit * values the code below uses a 16-bit value in i; the values start at * 128.5 (for 0.5) and step by 257, for a total of 254 values (the last * entries are filled with 255). Start i at 128 and fill all 'last' * table entries <= 'max' */ last = uint32(0) i = uint32(0) for { if !(i < uint32(255)) { break } /* 8-bit output value */ /* Find the corresponding maximum input value */ out = uint16(i * libc.Uint32FromUint32(257)) /* 16-bit output value */ /* Find the boundary value in 16 bits: */ bound = uint32(Xpng_gamma_16bit_correct(tls, uint32(out)+uint32(128), gamma_val)) /* Adjust (round) to (16-shift) bits: */ bound = (bound*max+uint32(32768))/uint32(65535) + uint32(1) for last < bound { *(*Tpng_uint_16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(table + uintptr(last&(uint32(0xff)>>shift))*4)) + uintptr(last>>(uint32(8)-shift))*2)) = out last++ } goto _3 _3: ; i++ } /* And fill in the final entries. */ for last < num<>shift))*4)) + uintptr(last>>(uint32(8)-shift))*2)) = uint16(65535) last++ } } // C documentation // // /* Build a single 8-bit table: same as the 16-bit case but much simpler (and // * typically much faster). Note that libpng currently does no sBIT processing // * (apparently contrary to the spec) so a 256-entry table is always generated. // */ func _png_build_8bit_table(tls *libc.TLS, png_ptr Tpng_structrp, ptable Tpng_bytepp, gamma_val Tpng_fixed_point) { var i uint32 var table Tpng_bytep var v1 uintptr _, _, _ = i, table, v1 v1 = Xpng_malloc(tls, png_ptr, uint32(256)) *(*uintptr)(unsafe.Pointer(ptable)) = v1 table = v1 if Xpng_gamma_significant(tls, gamma_val) != 0 { i = uint32(0) for { if !(i < uint32(256)) { break } *(*Tpng_byte)(unsafe.Pointer(table + uintptr(i))) = Xpng_gamma_8bit_correct(tls, i, gamma_val) goto _2 _2: ; i++ } } else { i = uint32(0) for { if !(i < uint32(256)) { break } *(*Tpng_byte)(unsafe.Pointer(table + uintptr(i))) = uint8(i & libc.Uint32FromInt32(0xff)) goto _3 _3: ; i++ } } } // C documentation // // /* Used from png_read_destroy and below to release the memory used by the gamma // * tables. // */ func Xpng_destroy_gamma_table(tls *libc.TLS, png_ptr Tpng_structrp) { var i, i1, i2, istop, istop1, istop2 int32 _, _, _, _, _, _ = i, i1, i2, istop, istop1, istop2 Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table = libc.UintptrFromInt32(0) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_table != libc.UintptrFromInt32(0) { istop = int32(1) << (int32(8) - (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift) i = 0 for { if !(i < istop) { break } Xpng_free(tls, png_ptr, *(*uintptr)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_table + uintptr(i)*4))) goto _1 _1: ; i++ } Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_table) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_table = libc.UintptrFromInt32(0) } Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_from_1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_from_1 = libc.UintptrFromInt32(0) Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 = libc.UintptrFromInt32(0) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_from_1 != libc.UintptrFromInt32(0) { istop1 = int32(1) << (int32(8) - (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift) i1 = 0 for { if !(i1 < istop1) { break } Xpng_free(tls, png_ptr, *(*uintptr)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_from_1 + uintptr(i1)*4))) goto _2 _2: ; i1++ } Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_from_1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_from_1 = libc.UintptrFromInt32(0) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_to_1 != libc.UintptrFromInt32(0) { istop2 = int32(1) << (int32(8) - (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift) i2 = 0 for { if !(i2 < istop2) { break } Xpng_free(tls, png_ptr, *(*uintptr)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_to_1 + uintptr(i2)*4))) goto _3 _3: ; i2++ } Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_to_1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_to_1 = libc.UintptrFromInt32(0) } } // C documentation // // /* We build the 8- or 16-bit gamma tables here. Note that for 16-bit // * tables, we don't make a full table if we are reducing to 8-bit in // * the future. Note also how the gamma_16 tables are segmented so that // * we don't need to allocate > 64K chunks for a full 16-bit table. // */ func Xpng_build_gamma_table(tls *libc.TLS, png_ptr Tpng_structrp, bit_depth int32) { var shift, sig_bit Tpng_byte var v1, v2, v3, v4, v5 int32 _, _, _, _, _, _, _ = shift, sig_bit, v1, v2, v3, v4, v5 /* Remove any existing table; this copes with multiple calls to * png_read_update_info. The warning is because building the gamma tables * multiple times is a performance hit - it's harmless but the ability to * call png_read_update_info() multiple times is new in 1.5.6 so it seems * sensible to warn if the app introduces such a hit. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table != libc.UintptrFromInt32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_table != libc.UintptrFromInt32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+12127) Xpng_destroy_gamma_table(tls, png_ptr) } if bit_depth <= int32(8) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma > 0 { v1 = Xpng_reciprocal2(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) } else { v1 = int32(PNG_FP_1) } _png_build_8bit_table(tls, png_ptr, png_ptr+724, v1) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&(libc.Uint32FromUint32(0x0080)|libc.Uint32FromUint32(0x600000)) != uint32(0) { _png_build_8bit_table(tls, png_ptr, png_ptr+736, Xpng_reciprocal(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma)) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma > 0 { v2 = Xpng_reciprocal(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) } else { v2 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma } _png_build_8bit_table(tls, png_ptr, png_ptr+732, v2) } } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { sig_bit = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fred if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fgreen) > libc.Int32FromUint8(sig_bit) { sig_bit = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fgreen } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fblue) > libc.Int32FromUint8(sig_bit) { sig_bit = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fblue } } else { sig_bit = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fgray } /* 16-bit gamma code uses this equation: * * ov = table[(iv & 0xff) >> gamma_shift][iv >> 8] * * Where 'iv' is the input color value and 'ov' is the output value - * pow(iv, gamma). * * Thus the gamma table consists of up to 256 256-entry tables. The table * is selected by the (8-gamma_shift) most significant of the low 8 bits * of the color value then indexed by the upper 8 bits: * * table[low bits][high 8 bits] * * So the table 'n' corresponds to all those 'iv' of: * * ..<(n+1 << gamma_shift)-1> * */ if libc.Int32FromUint8(sig_bit) > 0 && uint32(sig_bit) < uint32(16) { /* shift == insignificant bits */ shift = uint8((libc.Uint32FromUint32(16) - uint32(sig_bit)) & libc.Uint32FromInt32(0xff)) } else { shift = uint8(0) } /* keep all 16 bits */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&(libc.Uint32FromUint32(0x0400)|libc.Uint32FromUint32(0x4000000)) != uint32(0) { /* PNG_MAX_GAMMA_8 is the number of bits to keep - effectively * the significant bits in the *input* when the output will * eventually be 8 bits. By default it is 11. */ if uint32(shift) < libc.Uint32FromUint32(16)-libc.Uint32FromInt32(PNG_MAX_GAMMA_8) { shift = uint8(libc.Uint32FromUint32(16) - libc.Uint32FromInt32(PNG_MAX_GAMMA_8)) } } if uint32(shift) > uint32(8) { shift = uint8(8) } /* Guarantees at least one table! */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift = libc.Int32FromUint8(shift) /* NOTE: prior to 1.5.4 this test used to include PNG_BACKGROUND (now * PNG_COMPOSE). This effectively smashed the background calculation for * 16-bit output because the 8-bit table assumes the result will be * reduced to 8 bits. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&(libc.Uint32FromUint32(0x0400)|libc.Uint32FromUint32(0x4000000)) != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma > 0 { v3 = _png_product2(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) } else { v3 = int32(PNG_FP_1) } _png_build_16to8_table(tls, png_ptr, png_ptr+728, uint32(shift), v3) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma > 0 { v4 = Xpng_reciprocal2(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) } else { v4 = int32(PNG_FP_1) } _png_build_16bit_table(tls, png_ptr, png_ptr+728, uint32(shift), v4) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&(libc.Uint32FromUint32(0x0080)|libc.Uint32FromUint32(0x600000)) != uint32(0) { _png_build_16bit_table(tls, png_ptr, png_ptr+744, uint32(shift), Xpng_reciprocal(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma)) /* Notice that the '16 from 1' table should be full precision, however * the lookup on this table still uses gamma_shift, so it can't be. * TODO: fix this. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma > 0 { v5 = Xpng_reciprocal(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) } else { v5 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma } _png_build_16bit_table(tls, png_ptr, png_ptr+740, uint32(shift), v5) } } } // C documentation // // /* HARDWARE OR SOFTWARE OPTION SUPPORT */ func Xpng_set_option(tls *libc.TLS, png_ptr Tpng_structrp, option int32, onoff int32) (r int32) { var current, mask, setting Tpng_uint_32 _, _, _ = current, mask, setting if png_ptr != libc.UintptrFromInt32(0) && option >= 0 && option < int32(PNG_OPTION_NEXT) && option&int32(1) == 0 { mask = uint32(3) << option setting = (uint32(2) + libc.BoolUint32(onoff != libc.Int32FromInt32(0))) << option current = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Foptions (*Tpng_struct)(unsafe.Pointer(png_ptr)).Foptions = current & ^mask | setting return libc.Int32FromUint32(current&mask) >> option } return int32(PNG_OPTION_INVALID) } // C documentation // // /* SIMPLIFIED READ/WRITE SUPPORT */ func _png_image_free_function(tls *libc.TLS, argument Tpng_voidp) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var cp Tpng_controlp var fp uintptr var image Tpng_imagep var _ /* c at bp+0 */ Tpng_control _, _, _ = cp, fp, image image = argument cp = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque /* Double check that we have a png_ptr - it should be impossible to get here * without one. */ if (*Tpng_control1)(unsafe.Pointer(cp)).Fpng_ptr == libc.UintptrFromInt32(0) { return 0 } /* First free any data held in the control structure. */ if int32(uint32(*(*uint8)(unsafe.Pointer(cp + 20))&0x2>>1)) != 0 { fp = (*Tpng_struct)(unsafe.Pointer((*Tpng_control1)(unsafe.Pointer(cp)).Fpng_ptr)).Fio_ptr libc.SetBitFieldPtr8Uint32(cp+20, libc.Uint32FromInt32(0), 1, 0x2) /* Ignore errors here. */ if fp != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer((*Tpng_control1)(unsafe.Pointer(cp)).Fpng_ptr)).Fio_ptr = libc.UintptrFromInt32(0) libc.Xfclose(tls, fp) } } /* Copy the control structure so that the original, allocated, version can be * safely freed. Notice that a png_error here stops the remainder of the * cleanup, but this is probably fine because that would indicate bad memory * problems anyway. */ *(*Tpng_control)(unsafe.Pointer(bp)) = *(*Tpng_control1)(unsafe.Pointer(cp)) (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque = bp Xpng_free(tls, (*(*Tpng_control)(unsafe.Pointer(bp))).Fpng_ptr, cp) /* Then the structures, calling the correct API. */ if int32(uint32(*(*uint8)(unsafe.Pointer(bp + 20))&0x1>>0)) != 0 { Xpng_destroy_write_struct(tls, bp, bp+4) } else { Xpng_destroy_read_struct(tls, bp, bp+4, libc.UintptrFromInt32(0)) } /* Success. */ return int32(1) } func Xpng_image_free(tls *libc.TLS, image Tpng_imagep) { /* Safely call the real function, but only if doing so is safe at this point * (if not inside an error handling context). Otherwise assume * png_safe_execute will call this API after the return. */ if image != libc.UintptrFromInt32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque != libc.UintptrFromInt32(0) && (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Ferror_buf == libc.UintptrFromInt32(0) { _png_image_free_function(tls, image) (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque = libc.UintptrFromInt32(0) } } func Xpng_image_error(tls *libc.TLS, image Tpng_imagep, error_message Tpng_const_charp) (r int32) { /* Utility to log an error. */ Xpng_safecat(tls, image+32, libc.Uint32FromInt64(64), uint32(0), error_message) *(*Tpng_uint_32)(unsafe.Pointer(image + 28)) |= uint32(PNG_IMAGE_ERROR) Xpng_image_free(tls, image) return 0 } const DBL_MAX3 = 1.79769313486231570815e+308 const DBL_MIN2 = 2.22507385850720138309e-308 const PNG_16_TO_82 = 0x0400 const PNG_AFTER_IDAT1 = 8 const PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB2 = 0x0040 const PNG_COLORSPACE_FROM_gAMA2 = 0x0008 const PNG_COLORSPACE_FROM_sRGB2 = 0x0020 const PNG_COLORSPACE_HAVE_ENDPOINTS4 = 0x0002 const PNG_COLORSPACE_HAVE_GAMMA4 = 0x0001 const PNG_COLORSPACE_HAVE_INTENT2 = 0x0004 const PNG_COLORSPACE_INVALID2 = 0x8000 const PNG_COLORSPACE_MATCHES_sRGB2 = 0x0080 const PNG_COMPOSE2 = 0x0080 const PNG_ERROR_MODE = 8 const PNG_FLAG_CRC_ANCILLARY_NOWARN2 = 0x0200 const PNG_FLAG_CRC_ANCILLARY_USE2 = 0x0100 const PNG_FLAG_CRC_CRITICAL_IGNORE2 = 0x0800 const PNG_FLAG_LIBRARY_MISMATCH2 = 0x20000 const PNG_FLAG_MNG_FILTER_642 = 0x04 const PNG_FLAG_ZSTREAM_ENDED1 = 8 const PNG_FREE_ALL2 = 0xffff const PNG_FREE_EXIF2 = 0x8000 const PNG_FREE_HIST2 = 0x0008 const PNG_FREE_ICCP2 = 0x0010 const PNG_FREE_MUL2 = 0x4220 const PNG_FREE_PCAL2 = 0x0080 const PNG_FREE_PLTE2 = 0x1000 const PNG_FREE_ROWS2 = 0x0040 const PNG_FREE_SCAL2 = 0x0100 const PNG_FREE_SPLT2 = 0x0020 const PNG_FREE_TEXT2 = 0x4000 const PNG_FREE_TRNS2 = 0x2000 const PNG_FREE_UNKN2 = 0x0200 const PNG_HAVE_CHUNK_AFTER_IDAT1 = 8192 const PNG_HAVE_CHUNK_HEADER1 = 256 const PNG_HAVE_IDAT1 = 4 const PNG_HAVE_IHDR1 = 1 const PNG_HAVE_PLTE1 = 2 const PNG_HAVE_PNG_SIGNATURE2 = 0x1000 const PNG_INFO_IDAT2 = 0x8000 const PNG_INFO_PLTE4 = 0x0008 const PNG_INFO_cHRM4 = 0x0004 const PNG_INFO_eXIf4 = 0x10000 const PNG_INFO_gAMA4 = 0x0001 const PNG_INFO_hIST4 = 0x0040 const PNG_INFO_iCCP4 = 0x1000 const PNG_INFO_pCAL4 = 0x0400 const PNG_INFO_sCAL4 = 0x4000 const PNG_INFO_sPLT2 = 0x2000 const PNG_INFO_sRGB4 = 0x0800 const PNG_INFO_tRNS4 = 0x0010 const PNG_INTERLACE1 = 2 const PNG_IS_READ_STRUCT4 = 0x8000 const PNG_READ_CHUNK_MODE = 1 const PNG_READ_DONE_MODE = 6 const PNG_READ_IDAT_MODE = 2 const PNG_READ_SIG_MODE = 0 const PNG_READ_iTXt_MODE = 7 const PNG_READ_tEXt_MODE = 4 const PNG_READ_zTXt_MODE = 5 const PNG_RGB_TO_GRAY2 = 0x600000 const PNG_SCALE_16_TO_82 = 0x4000000 const PNG_STRING_NEWLINE4 = "\\n" /* Maintainer: Put new private prototypes here ^ */ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. * * png_debug[1-2]?(level, message ,arg{0-2}) * Expands to a statement (either a simple expression or a compound * do..while(0) statement) that outputs a message with parameter * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG * is undefined, 0 or 1 every png_debug expands to a simple expression * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added * to the message. * arg: 0 to 2 arguments for printf(3) style substitution in message. */ /* These settings control the formatting of messages in png.c and pngerror.c */ /* Moved to pngdebug.h at 1.5.0 */ /* Push model modes */ func Xpng_process_data(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, buffer Tpng_bytep, buffer_size Tsize_t) { if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } Xpng_push_restore_buffer(tls, png_ptr, buffer, buffer_size) for (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size != 0 { Xpng_process_some_data(tls, png_ptr, info_ptr) } } func Xpng_process_data_pause(tls *libc.TLS, png_ptr Tpng_structrp, save int32) (r Tsize_t) { var remaining Tsize_t _ = remaining if png_ptr != libc.UintptrFromInt32(0) { /* It's easiest for the caller if we do the save; then the caller doesn't * have to supply the same data again: */ if save != 0 { Xpng_push_save_buffer(tls, png_ptr) } else { /* This includes any pending saved bytes: */ remaining = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size = uint32(0) /* So subtract the saved buffer size, unless all the data * is actually 'saved', in which case we just return 0 */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size < remaining { return remaining - (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size } } } return uint32(0) } func Xpng_process_data_skip(tls *libc.TLS, png_ptr Tpng_structrp) (r Tpng_uint_32) { /* TODO: Deprecate and remove this API. * Somewhere the implementation of this seems to have been lost, * or abandoned. It was only to support some internal back-door access * to png_struct) in libpng-1.4.x. */ Xpng_app_warning(tls, png_ptr, __ccgo_ts+12153) return uint32(0) } // C documentation // // /* What we do with the incoming data depends on what we were previously // * doing before we ran out of data... // */ func Xpng_process_some_data(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp) { if png_ptr == libc.UintptrFromInt32(0) { return } switch (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprocess_mode { case PNG_READ_SIG_MODE: Xpng_push_read_sig(tls, png_ptr, info_ptr) case int32(PNG_READ_CHUNK_MODE): Xpng_push_read_chunk(tls, png_ptr, info_ptr) case int32(PNG_READ_IDAT_MODE): Xpng_push_read_IDAT(tls, png_ptr) default: (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size = uint32(0) break } } // C documentation // // /* Read any remaining signature bytes from the stream and compare them with // * the correct PNG signature. It is possible that this routine is called // * with bytes already read from the signature, either because they have been // * checked by the calling application, or because of multiple calls to this // * routine. // */ func Xpng_push_read_sig(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp) { var num_checked, num_to_check Tsize_t _, _ = num_checked, num_to_check num_checked = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bytes) /* SAFE, does not exceed 8 */ num_to_check = uint32(8) - num_checked if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size < num_to_check { num_to_check = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size } Xpng_push_fill_buffer(tls, png_ptr, info_ptr+32+uintptr(num_checked), num_to_check) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bytes = uint8(uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bytes) + num_to_check) if Xpng_sig_cmp(tls, info_ptr+32, num_checked, num_to_check) != 0 { if num_checked < uint32(4) && Xpng_sig_cmp(tls, info_ptr+32, num_checked, num_to_check-uint32(4)) != 0 { Xpng_error(tls, png_ptr, __ccgo_ts+12227) } else { Xpng_error(tls, png_ptr, __ccgo_ts+12242) } } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bytes) >= int32(8) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprocess_mode = int32(PNG_READ_CHUNK_MODE) } } } func Xpng_push_read_chunk(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp) { bp := tls.Alloc(16) defer tls.Free(16) var chunk_name Tpng_uint_32 var keep, v1 int32 var v2 uint32 var _ /* chunk_length at bp+0 */ [4]Tpng_byte var _ /* chunk_tag at bp+4 */ [4]Tpng_byte _, _, _, _ = chunk_name, keep, v1, v2 /* unknown handling method */ /* First we make sure we have enough data for the 4-byte chunk name * and the 4-byte chunk length before proceeding with decoding the * chunk data. To fully decode each of these chunks, we also make * sure we have enough data in the buffer for the 4-byte CRC at the * end of every chunk (except IDAT, which is handled separately). */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x100) == uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size < uint32(8) { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_push_fill_buffer(tls, png_ptr, bp, uint32(4)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length = Xpng_get_uint_31(tls, png_ptr, bp) Xpng_reset_crc(tls, png_ptr) Xpng_crc_read(tls, png_ptr, bp+4, uint32(4)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name = libc.Uint32FromInt32(libc.Int32FromInt32(0xff)&libc.Int32FromUint8((*(*[4]Tpng_byte)(unsafe.Pointer(bp + 4)))[0]))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_IHDR(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(73))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_IEND(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprocess_mode = int32(PNG_READ_DONE_MODE) Xpng_push_have_end(tls, png_ptr, info_ptr) } else { v1 = Xpng_chunk_unknown_handling(tls, png_ptr, chunk_name) keep = v1 if v1 != 0 { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length+uint32(4) > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_unknown(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length, keep) if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(80))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_PLTE(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(73))<= int32(8) { v2 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth * (uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v2 = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth*uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = v2 + uint32(1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf return } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(103))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_gAMA(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(115))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_sBIT(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(99))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_cHRM(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(101))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_eXIf(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(115))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_sRGB(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(105))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_iCCP(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(115))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_sPLT(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(116))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_tRNS(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(98))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_bKGD(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(104))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_hIST(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(112))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_pHYs(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(111))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_oFFs(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(112))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_pCAL(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(115))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_sCAL(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(116))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_tIME(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(116))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_tEXt(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(122))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_zTXt(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(105))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_iTXt(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length+uint32(4) > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_handle_unknown(tls, png_ptr, info_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length, PNG_HANDLE_CHUNK_AS_DEFAULT) } } } } } } } } } } } } } } } } } } } } } } } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) &= ^libc.Uint32FromUint32(0x100) } func Xpng_push_fill_buffer(tls *libc.TLS, png_ptr Tpng_structp, buffer Tpng_bytep, length Tsize_t) { var ptr Tpng_bytep var save_size, save_size1 Tsize_t _, _, _ = ptr, save_size, save_size1 if png_ptr == libc.UintptrFromInt32(0) { return } ptr = buffer if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size != uint32(0) { if length < (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size { save_size = length } else { save_size = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size } libc.Xmemcpy(tls, ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_ptr, save_size) length -= save_size ptr += uintptr(save_size) *(*Tsize_t)(unsafe.Pointer(png_ptr + 828)) -= save_size *(*Tsize_t)(unsafe.Pointer(png_ptr + 820)) -= save_size *(*Tpng_bytep)(unsafe.Pointer(png_ptr + 796)) += uintptr(save_size) } if length != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size != uint32(0) { if length < (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size { save_size1 = length } else { save_size1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size } libc.Xmemcpy(tls, ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_ptr, save_size1) *(*Tsize_t)(unsafe.Pointer(png_ptr + 828)) -= save_size1 *(*Tsize_t)(unsafe.Pointer(png_ptr + 832)) -= save_size1 *(*Tpng_bytep)(unsafe.Pointer(png_ptr + 804)) += uintptr(save_size1) } } func Xpng_push_save_buffer(tls *libc.TLS, png_ptr Tpng_structrp) { var dp, old_buffer, sp Tpng_bytep var i, istop, new_max Tsize_t _, _, _, _, _, _ = dp, i, istop, new_max, old_buffer, sp if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_ptr != (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer { istop = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size i = uint32(0) sp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_ptr dp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer for { if !(i < istop) { break } *(*Tpng_byte)(unsafe.Pointer(dp)) = *(*Tpng_byte)(unsafe.Pointer(sp)) goto _1 _1: ; i++ sp++ dp++ } } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size+(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_max { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size > libc.Uint32FromInt32(-libc.Int32FromInt32(1))-((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size+uint32(256)) { Xpng_error(tls, png_ptr, __ccgo_ts+12372) } new_max = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size + (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size + uint32(256) old_buffer = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer = Xpng_malloc_warn(tls, png_ptr, new_max) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer == libc.UintptrFromInt32(0) { Xpng_free(tls, png_ptr, old_buffer) Xpng_error(tls, png_ptr, __ccgo_ts+12406) } if old_buffer != 0 { libc.Xmemcpy(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer, old_buffer, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size != 0 { Xpng_error(tls, png_ptr, __ccgo_ts+12442) } } Xpng_free(tls, png_ptr, old_buffer) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_max = new_max } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size != 0 { libc.Xmemcpy(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer+uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size), (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size) *(*Tsize_t)(unsafe.Pointer(png_ptr + 820)) += (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size = uint32(0) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_ptr = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size = uint32(0) } func Xpng_push_restore_buffer(tls *libc.TLS, png_ptr Tpng_structrp, buffer Tpng_bytep, buffer_length Tsize_t) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer = buffer (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_size = buffer_length (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size = buffer_length + (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsave_buffer_size (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer_ptr = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcurrent_buffer } func Xpng_push_read_IDAT(tls *libc.TLS, png_ptr Tpng_structrp) { bp := tls.Alloc(16) defer tls.Free(16) var idat_size, idat_size1 Tpng_uint_32 var save_size, save_size1 Tsize_t var _ /* chunk_length at bp+0 */ [4]Tpng_byte var _ /* chunk_tag at bp+4 */ [4]Tpng_byte _, _, _, _ = idat_size, idat_size1, save_size, save_size1 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x100) == uint32(0) { /* TODO: this code can be commoned up with the same code in push_read */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbuffer_size < uint32(8) { Xpng_push_save_buffer(tls, png_ptr) return } Xpng_push_fill_buffer(tls, png_ptr, bp, uint32(4)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpush_length = Xpng_get_uint_31(tls, png_ptr, bp) Xpng_reset_crc(tls, png_ptr) Xpng_crc_read(tls, png_ptr, bp+4, uint32(4)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name = libc.Uint32FromInt32(libc.Int32FromInt32(0xff)&libc.Int32FromUint8((*(*[4]Tpng_byte)(unsafe.Pointer(bp + 4)))[0]))< libc.Uint32FromInt32(0)) || buffer == libc.UintptrFromInt32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+12487) } /* This routine must process all the data it has been given * before returning, calling the row callback as required to * handle the uncompressed results. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_in = buffer /* TODO: WARNING: TRUNCATION ERROR: DANGER WILL ROBINSON: */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = buffer_length /* Keep going until the decompressed data is all processed * or the stream marked as finished. */ for (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in > uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0008) == uint32(0) { /* We have data for zlib, but we must check that zlib * has someplace to put the results. It doesn't matter * if we don't expect any results -- it may be the input * data is just the LZ end code. */ if !((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out > libc.Uint32FromInt32(0)) { /* TODO: WARNING: TRUNCATION ERROR: DANGER WILL ROBINSON: */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) >= int32(8) { v1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth * (uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v1 = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth*uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = v1 + libc.Uint32FromInt32(1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf } /* Using Z_SYNC_FLUSH here means that an unterminated * LZ stream (a stream with a missing end code) can still * be handled, otherwise (Z_NO_FLUSH) a future zlib * implementation might defer output and therefore * change the current behavior (see comments in inflate.c * for why this doesn't happen at present with zlib 1.2.5). */ ret = Xpng_zlib_inflate(tls, png_ptr, int32(Z_SYNC_FLUSH)) /* Check for any failure before proceeding. */ if ret != Z_OK && ret != int32(Z_STREAM_END) { /* Terminate the decompression. */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0008) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner = uint32(0) /* This may be a truncated stream (missing or * damaged end code). Treat that as a warning. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number >= (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows || libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) > int32(6) { Xpng_warning(tls, png_ptr, __ccgo_ts+12517) } else { if ret == -int32(3) { Xpng_benign_error(tls, png_ptr, __ccgo_ts+12551) } else { Xpng_error(tls, png_ptr, __ccgo_ts+12583) } } /* Skip the check on unprocessed input */ return } /* Did inflate output any data? */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out != (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf { /* Is this unexpected data after the last row? * If it is, artificially terminate the LZ output * here. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number >= (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows || libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) > int32(6) { /* Extra data. */ Xpng_warning(tls, png_ptr, __ccgo_ts+12611) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0008) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner = uint32(0) /* Do no more processing; skip the unprocessed * input check below. */ return } /* Do we have a complete row? */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out == uint32(0) { Xpng_push_process_row(tls, png_ptr) } } /* And check for the end of the stream. */ if ret == int32(Z_STREAM_END) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0008) } } /* All the data should have been processed, if anything * is left at this point we have bytes of IDAT data * after the zlib end code. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in > uint32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+12641) } } func Xpng_push_process_row(tls *libc.TLS, png_ptr Tpng_structrp) { bp := tls.Alloc(16) defer tls.Free(16) var i, i1, i2, i3, i4, i5 int32 var v1 uint32 var _ /* row_info at bp+0 */ Tpng_row_info _, _, _, _, _, _, _ = i, i1, i2, i3, i4, i5, v1 (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fwidth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth /* NOTE: width of current interlaced row */ (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fcolor_type = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fbit_depth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fchannels = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth if libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) >= int32(8) { v1 = (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fwidth * (uint32((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v1 = ((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fwidth*uint32((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) + uint32(7)) >> int32(3) } (*(*Tpng_row_info)(unsafe.Pointer(bp))).Frowbytes = v1 if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf))) > PNG_FILTER_VALUE_NONE { if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf))) < int32(PNG_FILTER_VALUE_LAST) { Xpng_read_filter_row(tls, png_ptr, bp, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row+uintptr(1), libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf)))) } else { Xpng_error(tls, png_ptr, __ccgo_ts+12672) } } /* libpng 1.5.6: the following line was copying png_ptr->rowbytes before * 1.5.6, while the buffer really is this big in current versions of libpng * it may not be in the future, so this was changed just to copy the * interlaced row count: */ libc.Xmemcpy(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf, (*(*Tpng_row_info)(unsafe.Pointer(bp))).Frowbytes+uint32(1)) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations != uint32(0) { Xpng_do_read_transformations(tls, png_ptr, bp) } /* The transformed pixel depth should match the depth now in row_info. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformed_pixel_depth) == 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformed_pixel_depth = (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth if libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) > libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmaximum_pixel_depth) { Xpng_error(tls, png_ptr, __ccgo_ts+12698) } } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformed_pixel_depth) != libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) { Xpng_error(tls, png_ptr, __ccgo_ts+12723) } } /* Expand interlaced rows to full size */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) != uint32(0) { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) < int32(6) { Xpng_do_read_interlace(tls, bp, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass), (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations) } switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) { case 0: i = 0 for { if !(i < int32(8) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == 0) { break } Xpng_push_have_row(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) Xpng_read_push_finish_row(tls, png_ptr) /* Updates png_ptr->pass */ goto _2 _2: ; i++ } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(2) { /* Pass 1 might be empty */ i = 0 for { if !(i < int32(4) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(2)) { break } Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) goto _3 _3: ; i++ } } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(4) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight <= uint32(4) { i = 0 for { if !(i < int32(2) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(4)) { break } Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) goto _4 _4: ; i++ } } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(6) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight <= uint32(4) { Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) } case int32(1): i1 = 0 for { if !(i1 < int32(8) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(1)) { break } Xpng_push_have_row(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) Xpng_read_push_finish_row(tls, png_ptr) goto _5 _5: ; i1++ } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(2) { /* Skip top 4 generated rows */ i1 = 0 for { if !(i1 < int32(4) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(2)) { break } Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) goto _6 _6: ; i1++ } } case int32(2): i2 = 0 for { if !(i2 < int32(4) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(2)) { break } Xpng_push_have_row(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) Xpng_read_push_finish_row(tls, png_ptr) goto _7 _7: ; i2++ } i2 = 0 for { if !(i2 < int32(4) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(2)) { break } Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) goto _8 _8: ; i2++ } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(4) { /* Pass 3 might be empty */ i2 = 0 for { if !(i2 < int32(2) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(4)) { break } Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) goto _9 _9: ; i2++ } } case int32(3): i3 = 0 for { if !(i3 < int32(4) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(3)) { break } Xpng_push_have_row(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) Xpng_read_push_finish_row(tls, png_ptr) goto _10 _10: ; i3++ } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(4) { /* Skip top two generated rows */ i3 = 0 for { if !(i3 < int32(2) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(4)) { break } Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) goto _11 _11: ; i3++ } } case int32(4): i4 = 0 for { if !(i4 < int32(2) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(4)) { break } Xpng_push_have_row(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) Xpng_read_push_finish_row(tls, png_ptr) goto _12 _12: ; i4++ } i4 = 0 for { if !(i4 < int32(2) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(4)) { break } Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) goto _13 _13: ; i4++ } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(6) { /* Pass 5 might be empty */ Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) } case int32(5): i5 = 0 for { if !(i5 < int32(2) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(5)) { break } Xpng_push_have_row(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) Xpng_read_push_finish_row(tls, png_ptr) goto _14 _14: ; i5++ } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(6) { /* Skip top generated row */ Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) } default: fallthrough case int32(6): Xpng_push_have_row(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) Xpng_read_push_finish_row(tls, png_ptr) if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) != int32(6) { break } Xpng_push_have_row(tls, png_ptr, libc.UintptrFromInt32(0)) Xpng_read_push_finish_row(tls, png_ptr) } } else { Xpng_push_have_row(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) Xpng_read_push_finish_row(tls, png_ptr) } } func Xpng_read_push_finish_row(tls *libc.TLS, png_ptr Tpng_structrp) { /* Height of interlace block. This is not currently used - if you need * it, uncomment it here and in png.h static const png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number++ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number < (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows { return } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number = uint32(0) libc.Xmemset(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row, 0, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frowbytes+uint32(1)) for cond := true; cond; cond = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth == uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows == uint32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass++ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(1) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth < uint32(5) || libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(3) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth < uint32(3) || libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == int32(5) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth < uint32(2) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass++ } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) > int32(7) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass-- } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) >= int32(7) { break } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth + uint32(_png_pass_inc[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) - uint32(1) - uint32(_png_pass_start[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass])) / uint32(_png_pass_inc[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) != uint32(0) { break } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight + uint32(_png_pass_yinc[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) - uint32(1) - uint32(_png_pass_ystart[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass])) / uint32(_png_pass_yinc[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) } } } /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ var _png_pass_start = [7]Tpng_byte{ 1: uint8(4), 3: uint8(2), 5: uint8(1), } /* Offset to next interlace block */ var _png_pass_inc = [7]Tpng_byte{ 0: uint8(8), 1: uint8(8), 2: uint8(4), 3: uint8(4), 4: uint8(2), 5: uint8(2), 6: uint8(1), } /* Start of interlace block in the y direction */ var _png_pass_ystart = [7]Tpng_byte{ 2: uint8(4), 4: uint8(2), 6: uint8(1), } /* Offset to next interlace block in the y direction */ var _png_pass_yinc = [7]Tpng_byte{ 0: uint8(8), 1: uint8(8), 2: uint8(8), 3: uint8(4), 4: uint8(4), 5: uint8(2), 6: uint8(2), } func Xpng_push_have_info(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Finfo_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_infop))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Finfo_fn})))(tls, png_ptr, info_ptr) } } func Xpng_push_have_end(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fend_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_infop))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fend_fn})))(tls, png_ptr, info_ptr) } } func Xpng_push_have_row(tls *libc.TLS, png_ptr Tpng_structrp, row Tpng_bytep) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_bytep, Tpng_uint_32, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_fn})))(tls, png_ptr, row, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number, libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass)) } } func Xpng_progressive_combine_row(tls *libc.TLS, png_ptr Tpng_const_structrp, old_row Tpng_bytep, new_row Tpng_const_bytep) { if png_ptr == libc.UintptrFromInt32(0) { return } /* new_row is a flag here - if it is NULL then the app callback was called * from an empty row (see the calls to png_struct::row_fn below), otherwise * it must be png_ptr->row_buf+1 */ if new_row != libc.UintptrFromInt32(0) { Xpng_combine_row(tls, png_ptr, old_row, int32(1)) } } func Xpng_set_progressive_read_fn(tls *libc.TLS, png_ptr Tpng_structrp, progressive_ptr Tpng_voidp, info_fn Tpng_progressive_info_ptr, row_fn Tpng_progressive_row_ptr, end_fn Tpng_progressive_end_ptr) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Finfo_fn = info_fn (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_fn = row_fn (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fend_fn = end_fn Xpng_set_read_fn(tls, png_ptr, progressive_ptr, __ccgo_fp(Xpng_push_fill_buffer)) } func Xpng_get_progressive_ptr(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_voidp) { if png_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_ptr } const E2BIG = 7 const EACCES = 13 const EADDRINUSE = 98 const EADDRNOTAVAIL = 99 const EADV = 68 const EAFNOSUPPORT = 97 const EAGAIN = 11 const EALREADY = 114 const EBADE = 52 const EBADF = 9 const EBADFD = 77 const EBADMSG = 74 const EBADR = 53 const EBADRQC = 56 const EBADSLT = 57 const EBFONT = 59 const EBUSY = 16 const ECANCELED = 125 const ECHILD = 10 const ECHRNG = 44 const ECOMM = 70 const ECONNABORTED = 103 const ECONNREFUSED = 111 const ECONNRESET = 104 const EDEADLK = 35 const EDEADLOCK = "EDEADLK" const EDESTADDRREQ = 89 const EDOM = 33 const EDOTDOT = 73 const EDQUOT = 122 const EEXIST = 17 const EFAULT = 14 const EFBIG = 27 const EHOSTDOWN = 112 const EHOSTUNREACH = 113 const EHWPOISON = 133 const EIDRM = 43 const EILSEQ = 84 const EINPROGRESS = 115 const EINTR = 4 const EINVAL = 22 const EIO = 5 const EISCONN = 106 const EISDIR = 21 const EISNAM = 120 const EKEYEXPIRED = 127 const EKEYREJECTED = 129 const EKEYREVOKED = 128 const EL2HLT = 51 const EL2NSYNC = 45 const EL3HLT = 46 const EL3RST = 47 const ELIBACC = 79 const ELIBBAD = 80 const ELIBEXEC = 83 const ELIBMAX = 82 const ELIBSCN = 81 const ELNRNG = 48 const ELOOP = 40 const EMEDIUMTYPE = 124 const EMFILE = 24 const EMLINK = 31 const EMSGSIZE = 90 const EMULTIHOP = 72 const ENAMETOOLONG = 36 const ENAVAIL = 119 const ENETDOWN = 100 const ENETRESET = 102 const ENETUNREACH = 101 const ENFILE = 23 const ENOANO = 55 const ENOBUFS = 105 const ENOCSI = 50 const ENODATA = 61 const ENODEV = 19 const ENOENT = 2 const ENOEXEC = 8 const ENOKEY = 126 const ENOLCK = 37 const ENOLINK = 67 const ENOMEDIUM = 123 const ENOMEM = 12 const ENOMSG = 42 const ENONET = 64 const ENOPKG = 65 const ENOPROTOOPT = 92 const ENOSPC = 28 const ENOSR = 63 const ENOSTR = 60 const ENOSYS = 38 const ENOTBLK = 15 const ENOTCONN = 107 const ENOTDIR = 20 const ENOTEMPTY = 39 const ENOTNAM = 118 const ENOTRECOVERABLE = 131 const ENOTSOCK = 88 const ENOTSUP = "EOPNOTSUPP" const ENOTTY = 25 const ENOTUNIQ = 76 const ENXIO = 6 const EOPNOTSUPP = 95 const EOVERFLOW = 75 const EOWNERDEAD = 130 const EPERM = 1 const EPFNOSUPPORT = 96 const EPIPE = 32 const EPROTO = 71 const EPROTONOSUPPORT = 93 const EPROTOTYPE = 91 const ERANGE = 34 const EREMCHG = 78 const EREMOTE = 66 const EREMOTEIO = 121 const ERESTART = 85 const ERFKILL = 132 const EROFS = 30 const ESHUTDOWN = 108 const ESOCKTNOSUPPORT = 94 const ESPIPE = 29 const ESRCH = 3 const ESRMNT = 69 const ESTALE = 116 const ESTRPIPE = 86 const ETIME = 62 const ETIMEDOUT = 110 const ETOOMANYREFS = 109 const ETXTBSY = 26 const EUCLEAN = 117 const EUNATCH = 49 const EUSERS = 87 const EWOULDBLOCK = "EAGAIN" const EXDEV = 18 const EXFULL = 54 const PNG_ADD_ALPHA1 = 16777216 const PNG_BGR1 = 1 const PNG_CMAP_GA = 1 const PNG_CMAP_GA_BACKGROUND = 231 const PNG_CMAP_NONE = 0 const PNG_CMAP_NONE_BACKGROUND = 256 const PNG_CMAP_RGB = 3 const PNG_CMAP_RGB_ALPHA = 4 const PNG_CMAP_RGB_ALPHA_BACKGROUND = 216 const PNG_CMAP_RGB_BACKGROUND = 256 const PNG_CMAP_TRANS = 2 const PNG_CMAP_TRANS_BACKGROUND = 254 const PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB3 = 64 const PNG_COLORSPACE_HAVE_ENDPOINTS5 = 2 const PNG_COLORSPACE_HAVE_GAMMA5 = 1 const PNG_COLORSPACE_INVALID3 = 32768 const PNG_COMPOSE3 = 128 const PNG_FLAG_APP_WARNINGS_WARN3 = 2097152 const PNG_FLAG_BENIGN_ERRORS_WARN3 = 1048576 const PNG_FLAG_FILLER_AFTER1 = 128 const PNG_FLAG_MNG_FILTER_643 = 4 const PNG_FLAG_ROW_INIT1 = 64 const PNG_FORMAT_FLAG_AFIRST1 = 32 const PNG_FORMAT_FLAG_ALPHA1 = 1 const PNG_FORMAT_FLAG_ASSOCIATED_ALPHA1 = 64 const PNG_FORMAT_FLAG_BGR1 = 16 const PNG_FORMAT_FLAG_COLOR1 = 2 const PNG_FORMAT_FLAG_COLORMAP1 = 8 const PNG_FORMAT_FLAG_LINEAR1 = 4 const PNG_FREE_PLTE3 = 4096 const PNG_FREE_ROWS3 = 64 const PNG_FREE_TRNS3 = 8192 const PNG_GA_COLORMAP_ENTRIES = 256 const PNG_GRAY_COLORMAP_ENTRIES = 256 const PNG_HAVE_CHUNK_HEADER2 = 0x100 const PNG_HAVE_IEND1 = 16 const PNG_IMAGE_FLAG_16BIT_sRGB1 = 4 const PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB1 = 1 const PNG_INFO_IDAT3 = 32768 const PNG_INFO_sBIT3 = 2 const PNG_IS_READ_STRUCT5 = 32768 const PNG_RGB_COLORMAP_ENTRIES = 216 const PNG_RGB_TO_GRAY3 = 6291456 const PNG_SWAP_ALPHA1 = 131072 const PNG_TRANSFORM_BGR1 = 128 const PNG_TRANSFORM_EXPAND1 = 16 const PNG_TRANSFORM_EXPAND_161 = 16384 const PNG_TRANSFORM_GRAY_TO_RGB1 = 8192 const PNG_TRANSFORM_INVERT_ALPHA1 = 1024 const PNG_TRANSFORM_INVERT_MONO1 = 32 const PNG_TRANSFORM_PACKING1 = 4 const PNG_TRANSFORM_PACKSWAP1 = 8 const PNG_TRANSFORM_SCALE_161 = 32768 const PNG_TRANSFORM_SHIFT1 = 64 const PNG_TRANSFORM_STRIP_161 = 1 const PNG_TRANSFORM_STRIP_ALPHA1 = 2 const PNG_TRANSFORM_SWAP_ALPHA1 = 256 const PNG_TRANSFORM_SWAP_ENDIAN1 = 512 const P_FILE = 3 const P_LINEAR = 2 const P_LINEAR8 = 4 const P_NOTSET = 0 const P_sRGB = 1 // C documentation // // /* Create a PNG structure for reading, and allocate any memory needed. */ func Xpng_create_read_struct(tls *libc.TLS, user_png_ver Tpng_const_charp, error_ptr Tpng_voidp, error_fn Tpng_error_ptr, warn_fn Tpng_error_ptr) (r Tpng_structp) { return Xpng_create_read_struct_2(tls, user_png_ver, error_ptr, error_fn, warn_fn, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0)) } // C documentation // // /* Alternate create PNG structure for reading, and allocate any memory // * needed. // */ func Xpng_create_read_struct_2(tls *libc.TLS, user_png_ver Tpng_const_charp, error_ptr Tpng_voidp, error_fn Tpng_error_ptr, warn_fn Tpng_error_ptr, mem_ptr Tpng_voidp, malloc_fn Tpng_malloc_ptr, free_fn Tpng_free_ptr) (r Tpng_structp) { var png_ptr Tpng_structp _ = png_ptr png_ptr = Xpng_create_png_struct(tls, user_png_ver, error_ptr, error_fn, warn_fn, mem_ptr, malloc_fn, free_fn) if png_ptr != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode = uint32(0x8000) /* Added in libpng-1.6.0; this can be used to detect a read structure if * required (it will be zero in a write structure.) */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).FIDAT_read_size = uint32(PNG_ZBUF_SIZE) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x100000) /* In stable builds only warn if an application error can be completely * handled. */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x200000) /* TODO: delay this, it can be done in png_init_io (if the app doesn't * do it itself) avoiding setting the default function if it is not * required. */ Xpng_set_read_fn(tls, png_ptr, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0)) } return png_ptr } // C documentation // // /* Read the information before the actual image data. This has been // * changed in v0.90 to allow reading a file that already has the magic // * bytes read from the stream. You can tell libpng how many bytes have // * been read from the beginning of the stream (up to the maximum of 8) // * via png_set_sig_bytes(), and we will only check the remaining bytes // * here. The application can then have access to the signature bytes we // * read if it is determined that this isn't a valid PNG file. // */ func Xpng_read_info(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp) { var chunk_name, length Tpng_uint_32 var keep, v2 int32 _, _, _, _ = chunk_name, keep, length, v2 if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } /* Read and check the PNG file signature. */ Xpng_read_sig(tls, png_ptr, info_ptr) for { length = Xpng_read_chunk_header(tls, png_ptr) chunk_name = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name /* IDAT logic needs to happen here to simplify getting the two flags * right. */ if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(73))<> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(rp1 + libc.UintptrFromInt32(1))) = uint8(red & libc.Uint32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(rp1 + libc.UintptrFromInt32(4))) = uint8(blue >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(rp1 + libc.UintptrFromInt32(5))) = uint8(blue & libc.Uint32FromInt32(0xff)) goto _2 _2: ; i1++ rp1 += uintptr(bytes_per_pixel) } } } } } func Xpng_read_row(tls *libc.TLS, png_ptr Tpng_structrp, row Tpng_bytep, dsp_row Tpng_bytep) { bp := tls.Alloc(16) defer tls.Free(16) var v1 uint32 var _ /* row_info at bp+0 */ Tpng_row_info _ = v1 if png_ptr == libc.UintptrFromInt32(0) { return } /* png_read_start_row sets the information (in particular iwidth) for this * interlace pass. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0040) == uint32(0) { Xpng_read_start_row(tls, png_ptr) } /* 1.5.6: row_info moved out of png_struct to a local here. */ (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fwidth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth /* NOTE: width of current interlaced row */ (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fcolor_type = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fbit_depth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fchannels = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth if libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) >= int32(8) { v1 = (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fwidth * (uint32((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v1 = ((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fwidth*uint32((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) + uint32(7)) >> int32(3) } (*(*Tpng_row_info)(unsafe.Pointer(bp))).Frowbytes = v1 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number == uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == 0 { /* Check for transforms that have been set but were defined out */ } /* If interlaced and we do not need a new row, combine row and return. * Notice that the pixels we have from previous rows have been transformed * already; we can only combine like with like (transformed or * untransformed) and, because of the libpng API for interlaced images, this * means we must transform before de-interlacing. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) != uint32(0) { switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) { case 0: if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(0x07) != 0 { if dsp_row != libc.UintptrFromInt32(0) { Xpng_combine_row(tls, png_ptr, dsp_row, int32(1)) } Xpng_read_finish_row(tls, png_ptr) return } case int32(1): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(0x07) != 0 || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth < uint32(5) { if dsp_row != libc.UintptrFromInt32(0) { Xpng_combine_row(tls, png_ptr, dsp_row, int32(1)) } Xpng_read_finish_row(tls, png_ptr) return } case int32(2): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(0x07) != uint32(4) { if dsp_row != libc.UintptrFromInt32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(4) != 0 { Xpng_combine_row(tls, png_ptr, dsp_row, int32(1)) } Xpng_read_finish_row(tls, png_ptr) return } case int32(3): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(3) != 0 || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth < uint32(3) { if dsp_row != libc.UintptrFromInt32(0) { Xpng_combine_row(tls, png_ptr, dsp_row, int32(1)) } Xpng_read_finish_row(tls, png_ptr) return } case int32(4): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(3) != uint32(2) { if dsp_row != libc.UintptrFromInt32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(2) != 0 { Xpng_combine_row(tls, png_ptr, dsp_row, int32(1)) } Xpng_read_finish_row(tls, png_ptr) return } case int32(5): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(1) != 0 || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth < uint32(2) { if dsp_row != libc.UintptrFromInt32(0) { Xpng_combine_row(tls, png_ptr, dsp_row, int32(1)) } Xpng_read_finish_row(tls, png_ptr) return } default: fallthrough case int32(6): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(1) == uint32(0) { Xpng_read_finish_row(tls, png_ptr) return } break } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) == uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+12887) } /* Fill the row with IDAT data: */ *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf)) = uint8(255) /* to force error if no data was found */ Xpng_read_IDAT_data(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf, (*(*Tpng_row_info)(unsafe.Pointer(bp))).Frowbytes+uint32(1)) if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf))) > PNG_FILTER_VALUE_NONE { if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf))) < int32(PNG_FILTER_VALUE_LAST) { Xpng_read_filter_row(tls, png_ptr, bp, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row+uintptr(1), libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf)))) } else { Xpng_error(tls, png_ptr, __ccgo_ts+12672) } } /* libpng 1.5.6: the following line was copying png_ptr->rowbytes before * 1.5.6, while the buffer really is this big in current versions of libpng * it may not be in the future, so this was changed just to copy the * interlaced count: */ libc.Xmemcpy(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf, (*(*Tpng_row_info)(unsafe.Pointer(bp))).Frowbytes+uint32(1)) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted&uint32(PNG_FLAG_MNG_FILTER_643) != uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ffilter_type) == int32(PNG_INTRAPIXEL_DIFFERENCING) { /* Intrapixel differencing */ _png_do_read_intrapixel(tls, bp, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations != 0 || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max >= 0 { Xpng_do_read_transformations(tls, png_ptr, bp) } /* The transformed pixel depth should match the depth now in row_info. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformed_pixel_depth) == 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformed_pixel_depth = (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth if libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) > libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmaximum_pixel_depth) { Xpng_error(tls, png_ptr, __ccgo_ts+12920) } } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformed_pixel_depth) != libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) { Xpng_error(tls, png_ptr, __ccgo_ts+12944) } } /* Expand interlaced rows to full size */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) != uint32(0) { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) < int32(6) { Xpng_do_read_interlace(tls, bp, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass), (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations) } if dsp_row != libc.UintptrFromInt32(0) { Xpng_combine_row(tls, png_ptr, dsp_row, int32(1)) } if row != libc.UintptrFromInt32(0) { Xpng_combine_row(tls, png_ptr, row, 0) } } else { if row != libc.UintptrFromInt32(0) { Xpng_combine_row(tls, png_ptr, row, -int32(1)) } if dsp_row != libc.UintptrFromInt32(0) { Xpng_combine_row(tls, png_ptr, dsp_row, -int32(1)) } } Xpng_read_finish_row(tls, png_ptr) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_row_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_uint_32, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_row_fn})))(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number, libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass)) } } /* Read one or more rows of image data. If the image is interlaced, * and png_set_interlace_handling() has been called, the rows need to * contain the contents of the rows from the previous pass. If the * image has alpha or transparency, and png_handle_alpha()[*] has been * called, the rows contents must be initialized to the contents of the * screen. * * "row" holds the actual image, and pixels are placed in it * as they arrive. If the image is displayed after each pass, it will * appear to "sparkle" in. "display_row" can be used to display a * "chunky" progressive image, with finer detail added as it becomes * available. If you do not want this "chunky" display, you may pass * NULL for display_row. If you do not want the sparkle display, and * you have not called png_handle_alpha(), you may pass NULL for rows. * If you have called png_handle_alpha(), and the image has either an * alpha channel or a transparency chunk, you must provide a buffer for * rows. In this case, you do not have to provide a display_row buffer * also, but you may. If the image is not interlaced, or if you have * not called png_set_interlace_handling(), the display_row buffer will * be ignored, so pass NULL to it. * * [*] png_handle_alpha() does not exist yet, as of this version of libpng */ func Xpng_read_rows(tls *libc.TLS, png_ptr Tpng_structrp, row Tpng_bytepp, display_row Tpng_bytepp, num_rows Tpng_uint_32) { var dp, rp, v2, v3 Tpng_bytepp var dptr, dptr1, rptr, rptr1 Tpng_bytep var i Tpng_uint_32 _, _, _, _, _, _, _, _, _ = dp, dptr, dptr1, i, rp, rptr, rptr1, v2, v3 if png_ptr == libc.UintptrFromInt32(0) { return } rp = row dp = display_row if rp != libc.UintptrFromInt32(0) && dp != libc.UintptrFromInt32(0) { i = uint32(0) for { if !(i < num_rows) { break } v2 = rp rp += 4 rptr = *(*uintptr)(unsafe.Pointer(v2)) v3 = dp dp += 4 dptr = *(*uintptr)(unsafe.Pointer(v3)) Xpng_read_row(tls, png_ptr, rptr, dptr) goto _1 _1: ; i++ } } else { if rp != libc.UintptrFromInt32(0) { i = uint32(0) for { if !(i < num_rows) { break } rptr1 = *(*uintptr)(unsafe.Pointer(rp)) Xpng_read_row(tls, png_ptr, rptr1, libc.UintptrFromInt32(0)) rp += 4 goto _4 _4: ; i++ } } else { if dp != libc.UintptrFromInt32(0) { i = uint32(0) for { if !(i < num_rows) { break } dptr1 = *(*uintptr)(unsafe.Pointer(dp)) Xpng_read_row(tls, png_ptr, libc.UintptrFromInt32(0), dptr1) dp += 4 goto _5 _5: ; i++ } } } } } // C documentation // // /* Read the entire image. If the image has an alpha channel or a tRNS // * chunk, and you have called png_handle_alpha()[*], you will need to // * initialize the image to the current image that PNG will be overlaying. // * We set the num_rows again here, in case it was incorrectly set in // * png_read_start_row() by a call to png_read_update_info() or // * png_start_read_image() if png_set_interlace_handling() wasn't called // * prior to either of these functions like it should have been. You can // * only call this function once. If you desire to have an image for // * each pass of a interlaced image, use png_read_rows() instead. // * // * [*] png_handle_alpha() does not exist yet, as of this version of libpng // */ func Xpng_read_image(tls *libc.TLS, png_ptr Tpng_structrp, image Tpng_bytepp) { var i, image_height Tpng_uint_32 var j, pass int32 var rp Tpng_bytepp _, _, _, _, _ = i, image_height, j, pass, rp if png_ptr == libc.UintptrFromInt32(0) { return } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0040) == uint32(0) { pass = Xpng_set_interlace_handling(tls, png_ptr) /* And make sure transforms are initialized. */ Xpng_start_read_image(tls, png_ptr) } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) == uint32(0) { /* Caller called png_start_read_image or png_read_update_info without * first turning on the PNG_INTERLACE transform. We can fix this here, * but the caller should do it! */ Xpng_warning(tls, png_ptr, __ccgo_ts+12991) /* Make sure this is set correctly */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight } /* Obtain the pass number, which also turns on the PNG_INTERLACE flag in * the above error case. */ pass = Xpng_set_interlace_handling(tls, png_ptr) } image_height = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight j = 0 for { if !(j < pass) { break } rp = image i = uint32(0) for { if !(i < image_height) { break } Xpng_read_row(tls, png_ptr, *(*uintptr)(unsafe.Pointer(rp)), libc.UintptrFromInt32(0)) rp += 4 goto _2 _2: ; i++ } goto _1 _1: ; j++ } } // C documentation // // /* Read the end of the PNG file. Will not read past the end of the // * file, will verify the end is accurate, and will read any comments // * or time information at the end of the file, if info is not NULL. // */ func Xpng_read_end(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp) { var chunk_name, length Tpng_uint_32 var keep, v1 int32 _, _, _, _ = chunk_name, keep, length, v1 if png_ptr == libc.UintptrFromInt32(0) { return } /* If png_read_end is called in the middle of reading the rows there may * still be pending IDAT data and an owned zstream. Deal with this here. */ if Xpng_chunk_unknown_handling(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(73))<= libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) { Xpng_benign_error(tls, png_ptr, __ccgo_ts+13056) } for cond := true; cond; cond = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x10) == uint32(0) { length = Xpng_read_chunk_header(tls, png_ptr) chunk_name = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name if chunk_name != libc.Uint32FromInt32(libc.Int32FromInt32(73))< uint32(0) && !((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&libc.Uint32FromUint32(0x0008) != 0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x2000) != uint32(0) { Xpng_benign_error(tls, png_ptr, __ccgo_ts+13097) } } Xpng_handle_unknown(tls, png_ptr, info_ptr, length, keep) if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(80))< uint32(0) && !((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&libc.Uint32FromUint32(0x0008) != 0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x2000) != uint32(0) { Xpng_benign_error(tls, png_ptr, __ccgo_ts+13119) } Xpng_crc_finish(tls, png_ptr, length) } else { if chunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(80))< libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(4) { Xpng_error(tls, png_ptr, __ccgo_ts+13142) } /* -------------- image transformations start here ------------------- */ /* libpng 1.6.10: add code to cause a png_app_error if a selected TRANSFORM * is not implemented. This will only happen in de-configured (non-default) * libpng builds. The results can be unexpected - png_read_png may return * short or mal-formed rows because the transform is skipped. */ /* Tell libpng to strip 16-bit/color files down to 8 bits per color. */ if transforms&int32(PNG_TRANSFORM_SCALE_161) != 0 { /* Added at libpng-1.5.4. "strip_16" produces the same result that it * did in earlier versions, while "scale_16" is now more accurate. */ Xpng_set_scale_16(tls, png_ptr) } /* If both SCALE and STRIP are required pngrtran will effectively cancel the * latter by doing SCALE first. This is ok and allows apps not to check for * which is supported to get the right answer. */ if transforms&int32(PNG_TRANSFORM_STRIP_161) != 0 { Xpng_set_strip_16(tls, png_ptr) } /* Strip alpha bytes from the input data without combining with * the background (not recommended). */ if transforms&int32(PNG_TRANSFORM_STRIP_ALPHA1) != 0 { Xpng_set_strip_alpha(tls, png_ptr) } /* Extract multiple pixels with bit depths of 1, 2, or 4 from a single * byte into separate bytes (useful for paletted and grayscale images). */ if transforms&int32(PNG_TRANSFORM_PACKING1) != 0 { Xpng_set_packing(tls, png_ptr) } /* Change the order of packed pixels to least significant bit first * (not useful if you are using png_set_packing). */ if transforms&int32(PNG_TRANSFORM_PACKSWAP1) != 0 { Xpng_set_packswap(tls, png_ptr) } /* Expand paletted colors into true RGB triplets * Expand grayscale images to full 8 bits from 1, 2, or 4 bits/pixel * Expand paletted or RGB images with transparency to full alpha * channels so the data will be available as RGBA quartets. */ if transforms&int32(PNG_TRANSFORM_EXPAND1) != 0 { Xpng_set_expand(tls, png_ptr) } /* We don't handle background color or gamma transformation or quantizing. */ /* Invert monochrome files to have 0 as white and 1 as black */ if transforms&int32(PNG_TRANSFORM_INVERT_MONO1) != 0 { Xpng_set_invert_mono(tls, png_ptr) } /* If you want to shift the pixel values from the range [0,255] or * [0,65535] to the original [0,7] or [0,31], or whatever range the * colors were originally in: */ if transforms&int32(PNG_TRANSFORM_SHIFT1) != 0 { if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0002) != uint32(0) { Xpng_set_shift(tls, png_ptr, info_ptr+148) } } /* Flip the RGB pixels to BGR (or RGBA to BGRA) */ if transforms&int32(PNG_TRANSFORM_BGR1) != 0 { Xpng_set_bgr(tls, png_ptr) } /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ if transforms&int32(PNG_TRANSFORM_SWAP_ALPHA1) != 0 { Xpng_set_swap_alpha(tls, png_ptr) } /* Swap bytes of 16-bit files to least significant byte first */ if transforms&int32(PNG_TRANSFORM_SWAP_ENDIAN1) != 0 { Xpng_set_swap(tls, png_ptr) } /* Added at libpng-1.2.41 */ /* Invert the alpha channel from opacity to transparency */ if transforms&int32(PNG_TRANSFORM_INVERT_ALPHA1) != 0 { Xpng_set_invert_alpha(tls, png_ptr) } /* Added at libpng-1.2.41 */ /* Expand grayscale image to RGB */ if transforms&int32(PNG_TRANSFORM_GRAY_TO_RGB1) != 0 { Xpng_set_gray_to_rgb(tls, png_ptr) } /* Added at libpng-1.5.4 */ if transforms&int32(PNG_TRANSFORM_EXPAND_161) != 0 { Xpng_set_expand_16(tls, png_ptr) } /* We don't handle adding filler bytes */ /* We use png_read_image and rely on that for interlace handling, but we also * call png_read_update_info therefore must turn on interlace handling now: */ Xpng_set_interlace_handling(tls, png_ptr) /* Optional call to gamma correct and add the background to the palette * and update info structure. REQUIRED if you are expecting libpng to * update the palette for you (i.e., you selected such a transform above). */ Xpng_read_update_info(tls, png_ptr, info_ptr) /* -------------- image transformations end here ------------------- */ Xpng_free_data(tls, png_ptr, info_ptr, uint32(0x0040), 0) if (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers == libc.UintptrFromInt32(0) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers = Xpng_malloc(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fheight*libc.Uint32FromInt64(4)) iptr = uint32(0) for { if !(iptr < (*Tpng_info)(unsafe.Pointer(info_ptr)).Fheight) { break } *(*uintptr)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers + uintptr(iptr)*4)) = libc.UintptrFromInt32(0) goto _1 _1: ; iptr++ } *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x0040) iptr = uint32(0) for { if !(iptr < (*Tpng_info)(unsafe.Pointer(info_ptr)).Fheight) { break } *(*uintptr)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers + uintptr(iptr)*4)) = Xpng_malloc(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Frowbytes) goto _2 _2: ; iptr++ } } Xpng_read_image(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x8000) /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ Xpng_read_end(tls, png_ptr, info_ptr) _ = params } /* SIMPLIFIED READ * * This code currently relies on the sequential reader, though it could easily * be made to work with the progressive one. */ /* Arguments to png_image_finish_read: */ /* Encoding of PNG data (used by the color-map code) */ /* Color-map processing: after libpng has run on the PNG image further * processing may be needed to convert the data to color-map indices. */ /* The following document where the background is for each processing case. */ type Tpng_image_read_control = struct { Fimage Tpng_imagep Fbuffer Tpng_voidp Frow_stride Tpng_int_32 Fcolormap Tpng_voidp Fbackground Tpng_const_colorp Flocal_row Tpng_voidp Ffirst_row Tpng_voidp Frow_bytes Tptrdiff_t Ffile_encoding int32 Fgamma_to_linear Tpng_fixed_point Fcolormap_processing int32 } // C documentation // // /* Do all the *safe* initialization - 'safe' means that png_error won't be // * called, so setting up the jmp_buf is not required. This means that anything // * called from here must *not* call png_malloc - it has to call png_malloc_warn // * instead so that control is returned safely back to this routine. // */ func _png_image_read_init(tls *libc.TLS, image Tpng_imagep) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var control Tpng_controlp var _ /* info_ptr at bp+4 */ Tpng_infop var _ /* png_ptr at bp+0 */ Tpng_structp _ = control if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque == libc.UintptrFromInt32(0) { *(*Tpng_structp)(unsafe.Pointer(bp)) = Xpng_create_read_struct(tls, __ccgo_ts+9793, image, __ccgo_fp(Xpng_safe_error), __ccgo_fp(Xpng_safe_warning)) /* And set the rest of the structure to NULL to ensure that the various * fields are consistent. */ libc.Xmemset(tls, image, 0, libc.Uint32FromInt64(96)) (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fversion = uint32(PNG_IMAGE_VERSION) if *(*Tpng_structp)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) { *(*Tpng_infop)(unsafe.Pointer(bp + 4)) = Xpng_create_info_struct(tls, *(*Tpng_structp)(unsafe.Pointer(bp))) if *(*Tpng_infop)(unsafe.Pointer(bp + 4)) != libc.UintptrFromInt32(0) { control = Xpng_malloc_warn(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), libc.Uint32FromInt64(24)) if control != libc.UintptrFromInt32(0) { libc.Xmemset(tls, control, 0, libc.Uint32FromInt64(24)) (*Tpng_control1)(unsafe.Pointer(control)).Fpng_ptr = *(*Tpng_structp)(unsafe.Pointer(bp)) (*Tpng_control1)(unsafe.Pointer(control)).Finfo_ptr = *(*Tpng_infop)(unsafe.Pointer(bp + 4)) libc.SetBitFieldPtr8Uint32(control+20, libc.Uint32FromInt32(0), 0, 0x1) (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque = control return int32(1) } /* Error clean up */ Xpng_destroy_info_struct(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), bp+4) } Xpng_destroy_read_struct(tls, bp, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0)) } return Xpng_image_error(tls, image, __ccgo_ts+13191) } return Xpng_image_error(tls, image, __ccgo_ts+13221) } // C documentation // // /* Utility to find the base format of a PNG file from a png_struct. */ func _png_image_format(tls *libc.TLS, png_ptr Tpng_structrp) (r Tpng_uint_32) { var format Tpng_uint_32 _ = format format = uint32(0) if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { format |= uint32(0x02) } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0 { format |= uint32(0x01) } else { if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0 { format |= uint32(0x01) } } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) == int32(16) { format |= uint32(0x04) } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_PALETTE) != 0 { format |= uint32(0x08) } return format } // C documentation // // /* Is the given gamma significantly different from sRGB? The test is the same // * one used in pngrtran.c when deciding whether to do gamma correction. The // * arithmetic optimizes the division by using the fact that the inverse of the // * file sRGB gamma is 2.2 // */ func _png_gamma_not_sRGB(tls *libc.TLS, g Tpng_fixed_point) (r int32) { if g < int32(PNG_FP_1) { /* An uninitialized gamma is assumed to be sRGB for the simplified API. */ if g == 0 { return 0 } return Xpng_gamma_significant(tls, (g*int32(11)+int32(2))/int32(5)) } return int32(1) } // C documentation // // /* Do the main body of a 'png_image_begin_read' function; read the PNG file // * header and fill in all the information. This is executed in a safe context, // * unlike the init routine above. // */ func _png_image_read_header(tls *libc.TLS, argument Tpng_voidp) (r int32) { var cmap_entries, format Tpng_uint_32 var image Tpng_imagep var info_ptr Tpng_inforp var png_ptr Tpng_structrp _, _, _, _, _ = cmap_entries, format, image, info_ptr, png_ptr image = argument png_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr info_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Finfo_ptr Xpng_set_benign_errors(tls, png_ptr, int32(1)) Xpng_read_info(tls, png_ptr, info_ptr) /* Do this the fast way; just read directly out of png_struct. */ (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight format = _png_image_format(tls, png_ptr) (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat = format /* Does the colorspace match sRGB? If there is no color endpoint * (colorant) information assume yes, otherwise require the * 'ENDPOINTS_MATCHP_sRGB' colorspace flag to have been set. If the * colorspace has been determined to be invalid ignore it. */ if format&uint32(0x02) != uint32(0) && libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fflags)&(libc.Int32FromInt32(PNG_COLORSPACE_HAVE_ENDPOINTS5)|libc.Int32FromInt32(PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB3)|libc.Int32FromInt32(PNG_COLORSPACE_INVALID3)) == int32(PNG_COLORSPACE_HAVE_ENDPOINTS5) { *(*Tpng_uint_32)(unsafe.Pointer(image + 20)) |= uint32(PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB1) } /* We need the maximum number of entries regardless of the format the * application sets here. */ switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) { case PNG_COLOR_TYPE_GRAY: cmap_entries = uint32(1) << (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth case libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE): cmap_entries = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) default: cmap_entries = uint32(256) break } if cmap_entries > uint32(256) { cmap_entries = uint32(256) } (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries = cmap_entries return int32(1) } func Xpng_image_begin_read_from_stdio(tls *libc.TLS, image Tpng_imagep, file uintptr) (r int32) { if image != libc.UintptrFromInt32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fversion == uint32(PNG_IMAGE_VERSION) { if file != libc.UintptrFromInt32(0) { if _png_image_read_init(tls, image) != 0 { /* This is slightly evil, but png_init_io doesn't do anything other * than this and we haven't changed the standard IO functions so * this saves a 'safe' function. */ (*Tpng_struct)(unsafe.Pointer((*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr)).Fio_ptr = file return Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_read_header), image) } } else { return Xpng_image_error(tls, image, __ccgo_ts+13261) } } else { if image != libc.UintptrFromInt32(0) { return Xpng_image_error(tls, image, __ccgo_ts+13311) } } return 0 } func Xpng_image_begin_read_from_file(tls *libc.TLS, image Tpng_imagep, file_name uintptr) (r int32) { var fp uintptr _ = fp if image != libc.UintptrFromInt32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fversion == uint32(PNG_IMAGE_VERSION) { if file_name != libc.UintptrFromInt32(0) { fp = libc.Xfopen(tls, file_name, __ccgo_ts+13372) if fp != libc.UintptrFromInt32(0) { if _png_image_read_init(tls, image) != 0 { (*Tpng_struct)(unsafe.Pointer((*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr)).Fio_ptr = fp libc.SetBitFieldPtr8Uint32((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque+20, libc.Uint32FromInt32(1), 1, 0x2) return Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_read_header), image) } /* Clean up: just the opened file. */ libc.Xfclose(tls, fp) } else { return Xpng_image_error(tls, image, libc.Xstrerror(tls, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))))) } } else { return Xpng_image_error(tls, image, __ccgo_ts+13375) } } else { if image != libc.UintptrFromInt32(0) { return Xpng_image_error(tls, image, __ccgo_ts+13424) } } return 0 } func _png_image_memory_read(tls *libc.TLS, png_ptr Tpng_structp, out Tpng_bytep, need Tsize_t) { var cp Tpng_controlp var image Tpng_imagep var memory Tpng_const_bytep var size Tsize_t _, _, _, _ = cp, image, memory, size if png_ptr != libc.UintptrFromInt32(0) { image = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_ptr if image != libc.UintptrFromInt32(0) { cp = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque if cp != libc.UintptrFromInt32(0) { memory = (*Tpng_control1)(unsafe.Pointer(cp)).Fmemory size = (*Tpng_control1)(unsafe.Pointer(cp)).Fsize if memory != libc.UintptrFromInt32(0) && size >= need { libc.Xmemcpy(tls, out, memory, need) (*Tpng_control1)(unsafe.Pointer(cp)).Fmemory = memory + uintptr(need) (*Tpng_control1)(unsafe.Pointer(cp)).Fsize = size - need return } Xpng_error(tls, png_ptr, __ccgo_ts+13484) } } Xpng_error(tls, png_ptr, __ccgo_ts+13508) } } func Xpng_image_begin_read_from_memory(tls *libc.TLS, image Tpng_imagep, memory Tpng_const_voidp, size Tsize_t) (r int32) { if image != libc.UintptrFromInt32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fversion == uint32(PNG_IMAGE_VERSION) { if memory != libc.UintptrFromInt32(0) && size > uint32(0) { if _png_image_read_init(tls, image) != 0 { /* Now set the IO functions to read from the memory buffer and * store it into io_ptr. Again do this in-place to avoid calling a * libpng function that requires error handling. */ (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fmemory = memory (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fsize = size (*Tpng_struct)(unsafe.Pointer((*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr)).Fio_ptr = image (*Tpng_struct)(unsafe.Pointer((*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr)).Fread_data_fn = __ccgo_fp(_png_image_memory_read) return Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_read_header), image) } } else { return Xpng_image_error(tls, image, __ccgo_ts+13528) } } else { if image != libc.UintptrFromInt32(0) { return Xpng_image_error(tls, image, __ccgo_ts+13579) } } return 0 } // C documentation // // /* Utility function to skip chunks that are not used by the simplified image // * read functions and an appropriate macro to call it. // */ func _png_image_skip_unused_chunks(tls *libc.TLS, png_ptr Tpng_structrp) { /* Ignore unknown chunks and all other chunks except for the * IHDR, PLTE, tRNS, IDAT, and IEND chunks. */ Xpng_set_keep_unknown_chunks(tls, png_ptr, int32(PNG_HANDLE_CHUNK_NEVER), libc.UintptrFromInt32(0), -int32(1)) /* But do not ignore image data handling chunks */ Xpng_set_keep_unknown_chunks(tls, png_ptr, PNG_HANDLE_CHUNK_AS_DEFAULT, uintptr(unsafe.Pointer(&_chunks_to_process)), libc.Int32FromUint32(libc.Uint32FromInt64(30))/libc.Int32FromInt32(5)) } /* Prepare the reader to ignore all recognized chunks whose data will not * be used, i.e., all chunks recognized by libpng except for those * involved in basic image reading: * * IHDR, PLTE, IDAT, IEND * * Or image data handling: * * tRNS, bKGD, gAMA, cHRM, sRGB, [iCCP] and sBIT. * * This provides a small performance improvement and eliminates any * potential vulnerability to security problems in the unused chunks. * * At present the iCCP chunk data isn't used, so iCCP chunk can be ignored * too. This allows the simplified API to be compiled without iCCP support, * however if the support is there the chunk is still checked to detect * errors (which are unfortunately quite common.) */ var _chunks_to_process = [30]Tpng_byte{ 0: uint8(98), 1: uint8(75), 2: uint8(71), 3: uint8(68), 5: uint8(99), 6: uint8(72), 7: uint8(82), 8: uint8(77), 10: uint8(103), 11: uint8(65), 12: uint8(77), 13: uint8(65), 15: uint8(105), 16: uint8(67), 17: uint8(67), 18: uint8(80), 20: uint8(115), 21: uint8(66), 22: uint8(73), 23: uint8(84), 25: uint8(115), 26: uint8(82), 27: uint8(71), 28: uint8(66), } /* The following macro gives the exact rounded answer for all values in the * range 0..255 (it actually divides by 51.2, but the rounding still generates * the correct numbers 0..5 */ // C documentation // // /* Utility functions to make particular color-maps */ func _set_file_encoding(tls *libc.TLS, display uintptr) { var g Tpng_fixed_point _ = g g = (*Tpng_struct)(unsafe.Pointer((*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer((*Tpng_image_read_control)(unsafe.Pointer(display)).Fimage)).Fopaque)).Fpng_ptr)).Fcolorspace.Fgamma if Xpng_gamma_significant(tls, g) != 0 { if _png_gamma_not_sRGB(tls, g) != 0 { (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffile_encoding = int32(P_FILE) (*Tpng_image_read_control)(unsafe.Pointer(display)).Fgamma_to_linear = Xpng_reciprocal(tls, g) } else { (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffile_encoding = int32(P_sRGB) } } else { (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffile_encoding = int32(P_LINEAR8) } } func _decode_gamma(tls *libc.TLS, display uintptr, value Tpng_uint_32, encoding int32) (r uint32) { if encoding == int32(P_FILE) { /* double check */ encoding = (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffile_encoding } if encoding == P_NOTSET { /* must be the file encoding */ _set_file_encoding(tls, display) encoding = (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffile_encoding } switch encoding { case int32(P_FILE): value = uint32(Xpng_gamma_16bit_correct(tls, value*uint32(257), (*Tpng_image_read_control)(unsafe.Pointer(display)).Fgamma_to_linear)) case int32(P_sRGB): value = uint32(Xpng_sRGB_table[value]) case int32(P_LINEAR): case int32(P_LINEAR8): value *= uint32(257) default: Xpng_error(tls, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer((*Tpng_image_read_control)(unsafe.Pointer(display)).Fimage)).Fopaque)).Fpng_ptr, __ccgo_ts+13641) } return value } func _png_colormap_compose(tls *libc.TLS, display uintptr, foreground Tpng_uint_32, foreground_encoding int32, alpha Tpng_uint_32, background Tpng_uint_32, encoding int32) (r Tpng_uint_32) { var b, f Tpng_uint_32 _, _ = b, f /* The file value is composed on the background, the background has the given * encoding and so does the result, the file is encoded with P_FILE and the * file and alpha are 8-bit values. The (output) encoding will always be * P_LINEAR or P_sRGB. */ f = _decode_gamma(tls, display, foreground, foreground_encoding) b = _decode_gamma(tls, display, background, encoding) /* The alpha is always an 8-bit value (it comes from the palette), the value * scaled by 255 is what PNG_sRGB_FROM_LINEAR requires. */ f = f*alpha + b*(uint32(255)-alpha) if encoding == int32(P_LINEAR) { /* Scale to 65535; divide by 255, approximately (in fact this is extremely * accurate, it divides by 255.00000005937181414556, with no overflow.) */ f *= uint32(257) /* Now scaled by 65535 */ f += f >> int32(16) f = (f + uint32(32768)) >> int32(16) } else { /* P_sRGB */ f = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[f>>int32(15)]) + f&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[f>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) } return f } // C documentation // // /* NOTE: P_LINEAR values to this routine must be 16-bit, but P_FILE values must // * be 8-bit. // */ func _png_create_colormap_entry(tls *libc.TLS, display uintptr, ip Tpng_uint_32, red Tpng_uint_32, green Tpng_uint_32, blue Tpng_uint_32, alpha Tpng_uint_32, encoding int32) { var afirst, bgr, convert_to_Y, output_encoding, v1, v4, v5, v8 int32 var entry Tpng_uint_16p var entry1 Tpng_bytep var g Tpng_fixed_point var image Tpng_imagep var y, v2, v3, v6, v7 Tpng_uint_32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = afirst, bgr, convert_to_Y, entry, entry1, g, image, output_encoding, y, v1, v2, v3, v4, v5, v6, v7, v8 image = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fimage if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x04) != uint32(0) { v1 = int32(P_LINEAR) } else { v1 = int32(P_sRGB) } output_encoding = v1 convert_to_Y = libc.BoolInt32((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x02) == uint32(0) && (red != green || green != blue)) if ip > uint32(255) { Xpng_error(tls, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr, __ccgo_ts+13678) } /* Update the cache with whether the file gamma is significantly different * from sRGB. */ if encoding == int32(P_FILE) { if (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffile_encoding == P_NOTSET { _set_file_encoding(tls, display) } /* Note that the cached value may be P_FILE too, but if it is then the * gamma_to_linear member has been set. */ encoding = (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffile_encoding } if encoding == int32(P_FILE) { g = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fgamma_to_linear red = uint32(Xpng_gamma_16bit_correct(tls, red*uint32(257), g)) green = uint32(Xpng_gamma_16bit_correct(tls, green*uint32(257), g)) blue = uint32(Xpng_gamma_16bit_correct(tls, blue*uint32(257), g)) if convert_to_Y != 0 || output_encoding == int32(P_LINEAR) { alpha *= uint32(257) encoding = int32(P_LINEAR) } else { red = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[red*uint32(255)>>int32(15)]) + red*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[red*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) green = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[green*uint32(255)>>int32(15)]) + green*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[green*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) blue = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[blue*uint32(255)>>int32(15)]) + blue*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[blue*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) encoding = int32(P_sRGB) } } else { if encoding == int32(P_LINEAR8) { /* This encoding occurs quite frequently in test cases because PngSuite * includes a gAMA 1.0 chunk with most images. */ red *= uint32(257) green *= uint32(257) blue *= uint32(257) alpha *= uint32(257) encoding = int32(P_LINEAR) } else { if encoding == int32(P_sRGB) && (convert_to_Y != 0 || output_encoding == int32(P_LINEAR)) { /* The values are 8-bit sRGB values, but must be converted to 16-bit * linear. */ red = uint32(Xpng_sRGB_table[red]) green = uint32(Xpng_sRGB_table[green]) blue = uint32(Xpng_sRGB_table[blue]) alpha *= uint32(257) encoding = int32(P_LINEAR) } } } /* This is set if the color isn't gray but the output is. */ if encoding == int32(P_LINEAR) { if convert_to_Y != 0 { /* NOTE: these values are copied from png_do_rgb_to_gray */ y = libc.Uint32FromInt32(6968)*red + libc.Uint32FromInt32(23434)*green + libc.Uint32FromInt32(2366)*blue if output_encoding == int32(P_LINEAR) { y = (y + uint32(16384)) >> int32(15) } else { /* y is scaled by 32768, we need it scaled by 255: */ y = (y + uint32(128)) >> int32(8) y *= uint32(255) y = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[(y+uint32(64))>>int32(7)>>int32(15)]) + (y+libc.Uint32FromInt32(64))>>libc.Int32FromInt32(7)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[(y+uint32(64))>>int32(7)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) alpha = (alpha*libc.Uint32FromInt32(255) + libc.Uint32FromInt32(32895)) >> libc.Int32FromInt32(16) encoding = int32(P_sRGB) } v3 = y green = v3 v2 = v3 red = v2 blue = v2 } else { if output_encoding == int32(P_sRGB) { red = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[red*uint32(255)>>int32(15)]) + red*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[red*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) green = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[green*uint32(255)>>int32(15)]) + green*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[green*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) blue = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[blue*uint32(255)>>int32(15)]) + blue*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[blue*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) alpha = (alpha*libc.Uint32FromInt32(255) + libc.Uint32FromInt32(32895)) >> libc.Int32FromInt32(16) encoding = int32(P_sRGB) } } } if encoding != output_encoding { Xpng_error(tls, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr, __ccgo_ts+13707) } /* Store the value. */ afirst = libc.BoolInt32((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x20) != uint32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x01) != uint32(0)) if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x10) != uint32(0) { v4 = int32(2) } else { v4 = 0 } bgr = v4 if output_encoding == int32(P_LINEAR) { entry = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fcolormap entry += uintptr(ip*((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&(libc.Uint32FromUint32(0x02)|libc.Uint32FromUint32(0x01))+uint32(1))) * 2 /* The linear 16-bit values must be pre-multiplied by the alpha channel * value, if less than 65535 (this is, effectively, composite on black * if the alpha channel is removed.) */ switch (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&(libc.Uint32FromUint32(0x02)|libc.Uint32FromUint32(0x01)) + libc.Uint32FromInt32(1) { case uint32(4): if afirst != 0 { v5 = 0 } else { v5 = int32(3) } *(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(v5)*2)) = uint16(alpha) /* FALLTHROUGH */ fallthrough case uint32(3): if alpha < uint32(65535) { if alpha > uint32(0) { blue = (blue*alpha + uint32(32767)) / uint32(65535) green = (green*alpha + uint32(32767)) / uint32(65535) red = (red*alpha + uint32(32767)) / uint32(65535) } else { v7 = libc.Uint32FromInt32(0) blue = v7 v6 = v7 green = v6 red = v6 } } *(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(afirst+(int32(2)^bgr))*2)) = uint16(blue) *(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(afirst+int32(1))*2)) = uint16(green) *(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(afirst+bgr)*2)) = uint16(red) case uint32(2): *(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(int32(1)^afirst)*2)) = uint16(alpha) /* FALLTHROUGH */ fallthrough case uint32(1): if alpha < uint32(65535) { if alpha > uint32(0) { green = (green*alpha + uint32(32767)) / uint32(65535) } else { green = uint32(0) } } *(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(afirst)*2)) = uint16(green) default: break } } else { /* output encoding is P_sRGB */ entry1 = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fcolormap entry1 += uintptr(ip * ((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&(libc.Uint32FromUint32(0x02)|libc.Uint32FromUint32(0x01)) + uint32(1))) switch (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&(libc.Uint32FromUint32(0x02)|libc.Uint32FromUint32(0x01)) + libc.Uint32FromInt32(1) { case uint32(4): if afirst != 0 { v8 = 0 } else { v8 = int32(3) } *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(v8))) = uint8(alpha) /* FALLTHROUGH */ fallthrough case uint32(3): *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(afirst+(int32(2)^bgr)))) = uint8(blue) *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(afirst+int32(1)))) = uint8(green) *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(afirst+bgr))) = uint8(red) case uint32(2): *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(int32(1)^afirst))) = uint8(alpha) /* FALLTHROUGH */ fallthrough case uint32(1): *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(afirst))) = uint8(green) default: break } } } func _make_gray_file_colormap(tls *libc.TLS, display uintptr) (r int32) { var i uint32 _ = i i = uint32(0) for { if !(i < uint32(256)) { break } _png_create_colormap_entry(tls, display, i, i, i, i, uint32(255), int32(P_FILE)) goto _1 _1: ; i++ } return libc.Int32FromUint32(i) } func _make_gray_colormap(tls *libc.TLS, display uintptr) (r int32) { var i uint32 _ = i i = uint32(0) for { if !(i < uint32(256)) { break } _png_create_colormap_entry(tls, display, i, i, i, i, uint32(255), int32(P_sRGB)) goto _1 _1: ; i++ } return libc.Int32FromUint32(i) } func _make_ga_colormap(tls *libc.TLS, display uintptr) (r int32) { var a, g, gray, i, v1, v2, v5 uint32 _, _, _, _, _, _, _ = a, g, gray, i, v1, v2, v5 /* Alpha is retained, the output will be a color-map with entries * selected by six levels of alpha. One transparent entry, 6 gray * levels for all the intermediate alpha values, leaving 230 entries * for the opaque grays. The color-map entries are the six values * [0..5]*51, the GA processing uses PNG_DIV51(value) to find the * relevant entry. * * if (alpha > 229) // opaque * { * // The 231 entries are selected to make the math below work: * base = 0; * entry = (231 * gray + 128) >> 8; * } * else if (alpha < 26) // transparent * { * base = 231; * entry = 0; * } * else // partially opaque * { * base = 226 + 6 * PNG_DIV51(alpha); * entry = PNG_DIV51(gray); * } */ i = uint32(0) for i < uint32(231) { gray = (i*uint32(256) + uint32(115)) / uint32(231) v1 = i i++ _png_create_colormap_entry(tls, display, v1, gray, gray, gray, uint32(255), int32(P_sRGB)) } /* 255 is used here for the component values for consistency with the code * that undoes premultiplication in pngwrite.c. */ v2 = i i++ _png_create_colormap_entry(tls, display, v2, uint32(255), uint32(255), uint32(255), uint32(0), int32(P_sRGB)) a = uint32(1) for { if !(a < uint32(5)) { break } g = uint32(0) for { if !(g < uint32(6)) { break } v5 = i i++ _png_create_colormap_entry(tls, display, v5, g*uint32(51), g*uint32(51), g*uint32(51), a*uint32(51), int32(P_sRGB)) goto _4 _4: ; g++ } goto _3 _3: ; a++ } return libc.Int32FromUint32(i) } func _make_rgb_colormap(tls *libc.TLS, display uintptr) (r1 int32) { var b, g, i, r, v2, v5 uint32 _, _, _, _, _, _ = b, g, i, r, v2, v5 /* Build a 6x6x6 opaque RGB cube */ v2 = libc.Uint32FromInt32(0) r = v2 i = v2 for { if !(r < uint32(6)) { break } g = uint32(0) for { if !(g < uint32(6)) { break } b = uint32(0) for { if !(b < uint32(6)) { break } v5 = i i++ _png_create_colormap_entry(tls, display, v5, r*uint32(51), g*uint32(51), b*uint32(51), uint32(255), int32(P_sRGB)) goto _4 _4: ; b++ } goto _3 _3: ; g++ } goto _1 _1: ; r++ } return libc.Int32FromUint32(i) } /* Return a palette index to the above palette given three 8-bit sRGB values. */ func _png_image_read_colormap(tls *libc.TLS, argument Tpng_voidp) (r2 int32) { bp := tls.Alloc(48) defer tls.Free(48) var a, alpha, b, b1, back_b, back_bx, back_g, back_gx, back_r, back_rx, g1, g2, gray, gray1, gray2, gray3, gray4, i1, output_format, r, r1, v2, v20, v21, v25, v3, v4, v5, v6, v7, v8 Tpng_uint_32 var back_alpha, back_alpha1, background_index, cmap_entries, data_encoding, g, i, i2, num_trans, output_processing, sample_size, step, trans, val, v12, v22, v29, v33, v34, v38, v42, v43 uint32 var colormap Tpng_const_colorp var display, p9 uintptr var do_background, expand_tRNS, output_encoding, v1, v10, v16 int32 var image Tpng_imagep var png_ptr Tpng_structrp var trans1 Tpng_const_bytep var v13, v14, v15, v17, v18, v19, v26, v27, v28, v39 Tpng_uint_16 var v40 Tpng_bytep var _ /* c at bp+0 */ Tpng_color_16 var _ /* c at bp+10 */ Tpng_color_16 var _ /* c at bp+20 */ Tpng_color_16 var _ /* c at bp+30 */ Tpng_color_16 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, alpha, b, b1, back_alpha, back_alpha1, back_b, back_bx, back_g, back_gx, back_r, back_rx, background_index, cmap_entries, colormap, data_encoding, display, do_background, expand_tRNS, g, g1, g2, gray, gray1, gray2, gray3, gray4, i, i1, i2, image, num_trans, output_encoding, output_format, output_processing, png_ptr, r, r1, sample_size, step, trans, trans1, val, v1, v10, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v25, v26, v27, v28, v29, v3, v33, v34, v38, v39, v4, v40, v42, v43, v5, v6, v7, v8, p9 display = argument image = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fimage png_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr output_format = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat if output_format&uint32(0x04) != uint32(0) { v1 = int32(P_LINEAR) } else { v1 = int32(P_sRGB) } output_encoding = v1 /* Output processing option */ data_encoding = uint32(P_NOTSET) /* Encoding libpng must produce */ /* Background information; the background color and the index of this color * in the color-map if it exists (else 256). */ background_index = uint32(256) /* Flags to accumulate things that need to be done to the input. */ expand_tRNS = 0 /* Exclude the NYI feature of compositing onto a color-mapped buffer; it is * very difficult to do, the results look awful, and it is difficult to see * what possible use it is because the application can't control the * color-map. */ if (libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0 || libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0) && output_format&uint32(0x01) == uint32(0) { if output_encoding == int32(P_LINEAR) { /* compose on black */ v3 = libc.Uint32FromInt32(0) back_r = v3 v2 = v3 back_g = v2 back_b = v2 } else { if (*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground == libc.UintptrFromInt32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+13737) } else { back_g = uint32((*Tpng_color)(unsafe.Pointer((*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground)).Fgreen) if output_format&uint32(0x02) != uint32(0) { back_r = uint32((*Tpng_color)(unsafe.Pointer((*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground)).Fred) back_b = uint32((*Tpng_color)(unsafe.Pointer((*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground)).Fblue) } else { v4 = back_g back_r = v4 back_b = v4 } } } } else { if output_encoding == int32(P_LINEAR) { v6 = libc.Uint32FromInt32(65535) back_g = v6 v5 = v6 back_r = v5 back_b = v5 } else { v8 = libc.Uint32FromInt32(255) back_g = v8 v7 = v8 back_r = v7 back_b = v7 } } /* Default the input file gamma if required - this is necessary because * libpng assumes that if no gamma information is present the data is in the * output format, but the simplified API deduces the gamma from the input * format. */ if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_GAMMA5) == 0 { /* Do this directly, not using the png_colorspace functions, to ensure * that it happens even if the colorspace is invalid (though probably if * it is the setting will be ignored) Note that the same thing can be * achieved at the application interface with png_set_gAMA. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) == int32(16) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fflags&uint32(PNG_IMAGE_FLAG_16BIT_sRGB1) == uint32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma = int32(PNG_FP_1) } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma = int32(PNG_GAMMA_sRGB_INVERSE) } p9 = png_ptr + 1040 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p9)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p9))) | libc.Int32FromInt32(PNG_COLORSPACE_HAVE_GAMMA5)) } /* Decide what to do based on the PNG color type of the input data. The * utility function png_create_colormap_entry deals with most aspects of the * output transformations; this code works out how to produce bytes of * color-map entries from the original format. */ switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) { case PNG_COLOR_TYPE_GRAY: if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) <= int32(8) { trans = uint32(256) back_alpha = uint32(0) cmap_entries = uint32(1) << (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth if cmap_entries > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+13800) } step = uint32(255) / (cmap_entries - uint32(1)) output_processing = uint32(PNG_CMAP_NONE) /* If there is a tRNS chunk then this either selects a transparent * value or, if the output has no alpha, the background color. */ if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0 { trans = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgray) if output_format&uint32(0x01) == uint32(0) { if output_encoding == int32(P_LINEAR) { v10 = int32(65535) } else { v10 = int32(255) } back_alpha = libc.Uint32FromInt32(v10) } } /* png_create_colormap_entry just takes an RGBA and writes the * corresponding color-map entry using the format from 'image', * including the required conversion to sRGB or linear as * appropriate. The input values are always either sRGB (if the * gamma correction flag is 0) or 0..255 scaled file encoded values * (if the function must gamma correct them). */ v12 = libc.Uint32FromInt32(0) val = v12 i = v12 for { if !(i < cmap_entries) { break } /* 'i' is a file value. While this will result in duplicated * entries for 8-bit non-sRGB encoded files it is necessary to * have non-gamma corrected values to do tRNS handling. */ if i != trans { _png_create_colormap_entry(tls, display, i, val, val, val, uint32(255), int32(P_FILE)) } else { _png_create_colormap_entry(tls, display, i, back_r, back_g, back_b, back_alpha, output_encoding) } goto _11 _11: ; i++ val += step } /* We need libpng to preserve the original encoding. */ data_encoding = uint32(P_FILE) /* The rows from libpng, while technically gray values, are now also * color-map indices; however, they may need to be expanded to 1 * byte per pixel. This is what png_set_packing does (i.e., it * unpacks the bit values into bytes.) */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) < int32(8) { Xpng_set_packing(tls, png_ptr) } } else { /* bit depth is 16 */ /* The 16-bit input values can be converted directly to 8-bit gamma * encoded values; however, if a tRNS chunk is present 257 color-map * entries are required. This means that the extra entry requires * special processing; add an alpha channel, sacrifice gray level * 254 and convert transparent (alpha==0) entries to that. * * Use libpng to chop the data to 8 bits. Convert it to sRGB at the * same time to minimize quality loss. If a tRNS chunk is present * this means libpng must handle it too; otherwise it is impossible * to do the exact match on the 16-bit value. * * If the output has no alpha channel *and* the background color is * gray then it is possible to let libpng handle the substitution by * ensuring that the corresponding gray level matches the background * color exactly. */ data_encoding = uint32(P_sRGB) if uint32(PNG_GRAY_COLORMAP_ENTRIES) > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+13835) } cmap_entries = libc.Uint32FromInt32(_make_gray_colormap(tls, display)) if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0 { if output_format&uint32(0x01) != uint32(0) { back_alpha1 = uint32(0) } else { if back_r == back_g && back_g == back_b { gray = back_g if output_encoding == int32(P_LINEAR) { gray = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[gray*uint32(255)>>int32(15)]) + gray*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[gray*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) /* And make sure the corresponding palette entry * matches. */ _png_create_colormap_entry(tls, display, gray, back_g, back_g, back_g, uint32(65535), int32(P_LINEAR)) } /* The background passed to libpng, however, must be the * sRGB value. */ (*(*Tpng_color_16)(unsafe.Pointer(bp))).Findex = uint8(0) /*unused*/ v15 = uint16(gray) (*(*Tpng_color_16)(unsafe.Pointer(bp))).Fblue = v15 v14 = v15 (*(*Tpng_color_16)(unsafe.Pointer(bp))).Fgreen = v14 v13 = v14 (*(*Tpng_color_16)(unsafe.Pointer(bp))).Fred = v13 (*(*Tpng_color_16)(unsafe.Pointer(bp))).Fgray = v13 /* NOTE: does this work without expanding tRNS to alpha? * It should be the color->gray case below apparently * doesn't. */ Xpng_set_background_fixed(tls, png_ptr, bp, int32(PNG_BACKGROUND_GAMMA_SCREEN), 0, 0) output_processing = uint32(PNG_CMAP_NONE) break } if output_encoding == int32(P_LINEAR) { v16 = int32(65535) } else { v16 = int32(255) } back_alpha1 = libc.Uint32FromInt32(v16) } /* output_processing means that the libpng-processed row will be * 8-bit GA and it has to be processing to single byte color-map * values. Entry 254 is replaced by either a completely * transparent entry or by the background color at full * precision (and the background color is not a simple gray * level in this case.) */ expand_tRNS = int32(1) output_processing = uint32(PNG_CMAP_TRANS) background_index = uint32(254) /* And set (overwrite) color-map entry 254 to the actual * background color at full precision. */ _png_create_colormap_entry(tls, display, uint32(254), back_r, back_g, back_b, back_alpha1, output_encoding) } else { output_processing = uint32(PNG_CMAP_NONE) } } case int32(PNG_COLOR_MASK_ALPHA): /* 8-bit or 16-bit PNG with two channels - gray and alpha. A minimum * of 65536 combinations. If, however, the alpha channel is to be * removed there are only 256 possibilities if the background is gray. * (Otherwise there is a subset of the 65536 possibilities defined by * the triangle between black, white and the background color.) * * Reduce 16-bit files to 8-bit and sRGB encode the result. No need to * worry about tRNS matching - tRNS is ignored if there is an alpha * channel. */ data_encoding = uint32(P_sRGB) if output_format&uint32(0x01) != uint32(0) { if uint32(PNG_GA_COLORMAP_ENTRIES) > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+13871) } cmap_entries = libc.Uint32FromInt32(_make_ga_colormap(tls, display)) background_index = uint32(PNG_CMAP_GA_BACKGROUND) output_processing = uint32(PNG_CMAP_GA) } else { /* alpha is removed */ /* Alpha must be removed as the PNG data is processed when the * background is a color because the G and A channels are * independent and the vector addition (non-parallel vectors) is a * 2-D problem. * * This can be reduced to the same algorithm as above by making a * colormap containing gray levels (for the opaque grays), a * background entry (for a transparent pixel) and a set of four six * level color values, one set for each intermediate alpha value. * See the comments in make_ga_colormap for how this works in the * per-pixel processing. * * If the background is gray, however, we only need a 256 entry gray * level color map. It is sufficient to make the entry generated * for the background color be exactly the color specified. */ if output_format&uint32(0x02) == uint32(0) || back_r == back_g && back_g == back_b { gray1 = back_g if uint32(PNG_GRAY_COLORMAP_ENTRIES) > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+13909) } cmap_entries = libc.Uint32FromInt32(_make_gray_colormap(tls, display)) if output_encoding == int32(P_LINEAR) { gray1 = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[gray1*uint32(255)>>int32(15)]) + gray1*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[gray1*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) /* And make sure the corresponding palette entry matches. */ _png_create_colormap_entry(tls, display, gray1, back_g, back_g, back_g, uint32(65535), int32(P_LINEAR)) } /* The background passed to libpng, however, must be the sRGB * value. */ (*(*Tpng_color_16)(unsafe.Pointer(bp + 10))).Findex = uint8(0) /*unused*/ v19 = uint16(gray1) (*(*Tpng_color_16)(unsafe.Pointer(bp + 10))).Fblue = v19 v18 = v19 (*(*Tpng_color_16)(unsafe.Pointer(bp + 10))).Fgreen = v18 v17 = v18 (*(*Tpng_color_16)(unsafe.Pointer(bp + 10))).Fred = v17 (*(*Tpng_color_16)(unsafe.Pointer(bp + 10))).Fgray = v17 Xpng_set_background_fixed(tls, png_ptr, bp+10, int32(PNG_BACKGROUND_GAMMA_SCREEN), 0, 0) output_processing = uint32(PNG_CMAP_NONE) } else { /* This is the same as png_make_ga_colormap, above, except that * the entries are all opaque. */ if uint32(PNG_GA_COLORMAP_ENTRIES) > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+13947) } i1 = uint32(0) for i1 < uint32(231) { gray2 = (i1*uint32(256) + uint32(115)) / uint32(231) v20 = i1 i1++ _png_create_colormap_entry(tls, display, v20, gray2, gray2, gray2, uint32(255), int32(P_sRGB)) } /* NOTE: this preserves the full precision of the application * background color. */ background_index = i1 v21 = i1 i1++ if output_encoding == int32(P_LINEAR) { v22 = uint32(65535) } else { v22 = uint32(255) } _png_create_colormap_entry(tls, display, v21, back_r, back_g, back_b, v22, output_encoding) /* For non-opaque input composite on the sRGB background - this * requires inverting the encoding for each component. The input * is still converted to the sRGB encoding because this is a * reasonable approximate to the logarithmic curve of human * visual sensitivity, at least over the narrow range which PNG * represents. Consequently 'G' is always sRGB encoded, while * 'A' is linear. We need the linear background colors. */ if output_encoding == int32(P_sRGB) { /* else already linear */ /* This may produce a value not exactly matching the * background, but that's ok because these numbers are only * used when alpha != 0 */ back_r = uint32(Xpng_sRGB_table[back_r]) back_g = uint32(Xpng_sRGB_table[back_g]) back_b = uint32(Xpng_sRGB_table[back_b]) } a = uint32(1) for { if !(a < uint32(5)) { break } /* PNG_sRGB_FROM_LINEAR expects a 16-bit linear value scaled * by an 8-bit alpha value (0..255). */ alpha = uint32(51) * a back_rx = (uint32(255) - alpha) * back_r back_gx = (uint32(255) - alpha) * back_g back_bx = (uint32(255) - alpha) * back_b g = uint32(0) for { if !(g < uint32(6)) { break } gray3 = uint32(Xpng_sRGB_table[g*uint32(51)]) * alpha v25 = i1 i1++ _png_create_colormap_entry(tls, display, v25, uint32(uint8(libc.Uint32FromInt32(0xff)&((uint32(Xpng_sRGB_base[(gray3+back_rx)>>int32(15)])+(gray3+back_rx)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[(gray3+back_rx)>>int32(15)])>>libc.Int32FromInt32(12))>>libc.Int32FromInt32(8)))), uint32(uint8(libc.Uint32FromInt32(0xff)&((uint32(Xpng_sRGB_base[(gray3+back_gx)>>int32(15)])+(gray3+back_gx)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[(gray3+back_gx)>>int32(15)])>>libc.Int32FromInt32(12))>>libc.Int32FromInt32(8)))), uint32(uint8(libc.Uint32FromInt32(0xff)&((uint32(Xpng_sRGB_base[(gray3+back_bx)>>int32(15)])+(gray3+back_bx)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[(gray3+back_bx)>>int32(15)])>>libc.Int32FromInt32(12))>>libc.Int32FromInt32(8)))), uint32(255), int32(P_sRGB)) goto _24 _24: ; g++ } goto _23 _23: ; a++ } cmap_entries = i1 output_processing = uint32(PNG_CMAP_GA) } } case int32(PNG_COLOR_MASK_COLOR): fallthrough case libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA): /* Exclude the case where the output is gray; we can always handle this * with the cases above. */ if output_format&uint32(0x02) == uint32(0) { /* The color-map will be grayscale, so we may as well convert the * input RGB values to a simple grayscale and use the grayscale * code above. * * NOTE: calling this apparently damages the recognition of the * transparent color in background color handling; call * png_set_tRNS_to_alpha before png_set_background_fixed. */ Xpng_set_rgb_to_gray_fixed(tls, png_ptr, int32(PNG_ERROR_ACTION_NONE), -int32(1), -int32(1)) data_encoding = uint32(P_sRGB) /* The output will now be one or two 8-bit gray or gray+alpha * channels. The more complex case arises when the input has alpha. */ if (libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) || libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0) && output_format&uint32(0x01) != uint32(0) { /* Both input and output have an alpha channel, so no background * processing is required; just map the GA bytes to the right * color-map entry. */ expand_tRNS = int32(1) if uint32(PNG_GA_COLORMAP_ENTRIES) > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+13983) } cmap_entries = libc.Uint32FromInt32(_make_ga_colormap(tls, display)) background_index = uint32(PNG_CMAP_GA_BACKGROUND) output_processing = uint32(PNG_CMAP_GA) } else { /* Either the input or the output has no alpha channel, so there * will be no non-opaque pixels in the color-map; it will just be * grayscale. */ if uint32(PNG_GRAY_COLORMAP_ENTRIES) > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+14018) } /* Ideally this code would use libpng to do the gamma correction, * but if an input alpha channel is to be removed we will hit the * libpng bug in gamma+compose+rgb-to-gray (the double gamma * correction bug). Fix this by dropping the gamma correction in * this case and doing it in the palette; this will result in * duplicate palette entries, but that's better than the * alternative of double gamma correction. */ if (libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) || libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0) && _png_gamma_not_sRGB(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma) != 0 { cmap_entries = libc.Uint32FromInt32(_make_gray_file_colormap(tls, display)) data_encoding = uint32(P_FILE) } else { cmap_entries = libc.Uint32FromInt32(_make_gray_colormap(tls, display)) } /* But if the input has alpha or transparency it must be removed */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) || libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0 { gray4 = back_g /* We need to ensure that the application background exists in * the colormap and that completely transparent pixels map to * it. Achieve this simply by ensuring that the entry * selected for the background really is the background color. */ if data_encoding == uint32(P_FILE) { /* from the fixup above */ /* The app supplied a gray which is in output_encoding, we * need to convert it to a value of the input (P_FILE) * encoding then set this palette entry to the required * output encoding. */ if output_encoding == int32(P_sRGB) { gray4 = uint32(Xpng_sRGB_table[gray4]) } /* now P_LINEAR */ gray4 = (uint32(Xpng_gamma_16bit_correct(tls, gray4, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma))*libc.Uint32FromInt32(255) + libc.Uint32FromInt32(32895)) >> libc.Int32FromInt32(16) /* now P_FILE */ /* And make sure the corresponding palette entry contains * exactly the required sRGB value. */ _png_create_colormap_entry(tls, display, gray4, back_g, back_g, back_g, uint32(0), output_encoding) } else { if output_encoding == int32(P_LINEAR) { gray4 = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[gray4*uint32(255)>>int32(15)]) + gray4*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[gray4*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) /* And make sure the corresponding palette entry matches. */ _png_create_colormap_entry(tls, display, gray4, back_g, back_g, back_g, uint32(0), int32(P_LINEAR)) } } /* The background passed to libpng, however, must be the * output (normally sRGB) value. */ (*(*Tpng_color_16)(unsafe.Pointer(bp + 20))).Findex = uint8(0) /*unused*/ v28 = uint16(gray4) (*(*Tpng_color_16)(unsafe.Pointer(bp + 20))).Fblue = v28 v27 = v28 (*(*Tpng_color_16)(unsafe.Pointer(bp + 20))).Fgreen = v27 v26 = v27 (*(*Tpng_color_16)(unsafe.Pointer(bp + 20))).Fred = v26 (*(*Tpng_color_16)(unsafe.Pointer(bp + 20))).Fgray = v26 /* NOTE: the following is apparently a bug in libpng. Without * it the transparent color recognition in * png_set_background_fixed seems to go wrong. */ expand_tRNS = int32(1) Xpng_set_background_fixed(tls, png_ptr, bp+20, int32(PNG_BACKGROUND_GAMMA_SCREEN), 0, 0) } output_processing = uint32(PNG_CMAP_NONE) } } else { /* output is color */ /* We could use png_quantize here so long as there is no transparent * color or alpha; png_quantize ignores alpha. Easier overall just * to do it once and using PNG_DIV51 on the 6x6x6 reduced RGB cube. * Consequently we always want libpng to produce sRGB data. */ data_encoding = uint32(P_sRGB) /* Is there any transparency or alpha? */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) || libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0 { /* Is there alpha in the output too? If so all four channels are * processed into a special RGB cube with alpha support. */ if output_format&uint32(0x01) != uint32(0) { if libc.Uint32FromInt32(libc.Int32FromInt32(PNG_RGB_COLORMAP_ENTRIES)+libc.Int32FromInt32(1)+libc.Int32FromInt32(27)) > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+14055) } cmap_entries = libc.Uint32FromInt32(_make_rgb_colormap(tls, display)) /* Add a transparent entry. */ _png_create_colormap_entry(tls, display, cmap_entries, uint32(255), uint32(255), uint32(255), uint32(0), int32(P_sRGB)) /* This is stored as the background index for the processing * algorithm. */ v29 = cmap_entries cmap_entries++ background_index = v29 /* Add 27 r,g,b entries each with alpha 0.5. */ r = uint32(0) for { if !(r < uint32(256)) { break } g1 = uint32(0) for { if !(g1 < uint32(256)) { break } /* This generates components with the values 0, 127 and * 255 */ b = uint32(0) for { if !(b < uint32(256)) { break } v33 = cmap_entries cmap_entries++ _png_create_colormap_entry(tls, display, v33, r, g1, b, uint32(128), int32(P_sRGB)) goto _32 _32: ; b = b<>int32(2) + uint32(1)) /* sRGB background */ if libc.Uint32FromInt32(libc.Int32FromInt32(PNG_RGB_COLORMAP_ENTRIES)+libc.Int32FromInt32(1)+libc.Int32FromInt32(27)) > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+14092) } cmap_entries = libc.Uint32FromInt32(_make_rgb_colormap(tls, display)) _png_create_colormap_entry(tls, display, cmap_entries, back_r, back_g, back_b, uint32(0), output_encoding) if output_encoding == int32(P_LINEAR) { r1 = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[back_r*uint32(255)>>int32(15)]) + back_r*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[back_r*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) g2 = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[back_g*uint32(255)>>int32(15)]) + back_g*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[back_g*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) b1 = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[back_b*uint32(255)>>int32(15)]) + back_b*libc.Uint32FromInt32(255)&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[back_b*uint32(255)>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) } else { r1 = back_r g2 = back_g b1 = back_g } /* Compare the newly-created color-map entry with the one the * PNG_CMAP_RGB algorithm will use. If the two entries don't * match, add the new one and set this as the background * index. */ if libc.Xmemcmp(tls, (*Tpng_image_read_control)(unsafe.Pointer(display)).Fcolormap+uintptr(sample_size*cmap_entries), (*Tpng_image_read_control)(unsafe.Pointer(display)).Fcolormap+uintptr(sample_size*uint32(uint8(libc.Uint32FromInt32(6)*(libc.Uint32FromInt32(6)*((r1*libc.Uint32FromInt32(5)+libc.Uint32FromInt32(130))>>libc.Int32FromInt32(8))+(g2*libc.Uint32FromInt32(5)+libc.Uint32FromInt32(130))>>libc.Int32FromInt32(8))+(b1*libc.Uint32FromInt32(5)+libc.Uint32FromInt32(130))>>libc.Int32FromInt32(8)))), sample_size) != 0 { /* The background color must be added. */ v34 = cmap_entries cmap_entries++ background_index = v34 /* Add 27 r,g,b entries each with created by composing with * the background at alpha 0.5. */ r1 = uint32(0) for { if !(r1 < uint32(256)) { break } g2 = uint32(0) for { if !(g2 < uint32(256)) { break } /* This generates components with the values 0, 127 * and 255 */ b1 = uint32(0) for { if !(b1 < uint32(256)) { break } v38 = cmap_entries cmap_entries++ _png_create_colormap_entry(tls, display, v38, _png_colormap_compose(tls, display, r1, int32(P_sRGB), uint32(128), back_r, output_encoding), _png_colormap_compose(tls, display, g2, int32(P_sRGB), uint32(128), back_g, output_encoding), _png_colormap_compose(tls, display, b1, int32(P_sRGB), uint32(128), back_b, output_encoding), uint32(0), output_encoding) goto _37 _37: ; b1 = b1< (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+14129) } cmap_entries = libc.Uint32FromInt32(_make_rgb_colormap(tls, display)) output_processing = uint32(PNG_CMAP_RGB) } } case libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE): /* It's already got a color-map. It may be necessary to eliminate the * tRNS entries though. */ num_trans = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) if num_trans > uint32(0) { v40 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha } else { v40 = libc.UintptrFromInt32(0) } trans1 = v40 colormap = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette do_background = libc.BoolInt32(trans1 != libc.UintptrFromInt32(0) && output_format&uint32(0x01) == uint32(0)) /* Just in case: */ if trans1 == libc.UintptrFromInt32(0) { num_trans = uint32(0) } output_processing = uint32(PNG_CMAP_NONE) data_encoding = uint32(P_FILE) /* Don't change from color-map indices */ cmap_entries = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) if cmap_entries > uint32(256) { cmap_entries = uint32(256) } if cmap_entries > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+14160) } i2 = uint32(0) for { if !(i2 < cmap_entries) { break } if do_background != 0 && i2 < num_trans && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(trans1 + uintptr(i2)))) < int32(255) { if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(trans1 + uintptr(i2)))) == 0 { _png_create_colormap_entry(tls, display, i2, back_r, back_g, back_b, uint32(0), output_encoding) } else { /* Must compose the PNG file color in the color-map entry * on the sRGB color in 'back'. */ if output_encoding == int32(P_LINEAR) { v42 = uint32(*(*Tpng_byte)(unsafe.Pointer(trans1 + uintptr(i2)))) * uint32(257) } else { v42 = uint32(*(*Tpng_byte)(unsafe.Pointer(trans1 + uintptr(i2)))) } _png_create_colormap_entry(tls, display, i2, _png_colormap_compose(tls, display, uint32((*(*Tpng_color)(unsafe.Pointer(colormap + uintptr(i2)*3))).Fred), int32(P_FILE), uint32(*(*Tpng_byte)(unsafe.Pointer(trans1 + uintptr(i2)))), back_r, output_encoding), _png_colormap_compose(tls, display, uint32((*(*Tpng_color)(unsafe.Pointer(colormap + uintptr(i2)*3))).Fgreen), int32(P_FILE), uint32(*(*Tpng_byte)(unsafe.Pointer(trans1 + uintptr(i2)))), back_g, output_encoding), _png_colormap_compose(tls, display, uint32((*(*Tpng_color)(unsafe.Pointer(colormap + uintptr(i2)*3))).Fblue), int32(P_FILE), uint32(*(*Tpng_byte)(unsafe.Pointer(trans1 + uintptr(i2)))), back_b, output_encoding), v42, output_encoding) } } else { if i2 < num_trans { v43 = uint32(*(*Tpng_byte)(unsafe.Pointer(trans1 + uintptr(i2)))) } else { v43 = uint32(255) } _png_create_colormap_entry(tls, display, i2, uint32((*(*Tpng_color)(unsafe.Pointer(colormap + uintptr(i2)*3))).Fred), uint32((*(*Tpng_color)(unsafe.Pointer(colormap + uintptr(i2)*3))).Fgreen), uint32((*(*Tpng_color)(unsafe.Pointer(colormap + uintptr(i2)*3))).Fblue), v43, int32(P_FILE)) } goto _41 _41: ; i2++ } /* The PNG data may have indices packed in fewer than 8 bits, it * must be expanded if so. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) < int32(8) { Xpng_set_packing(tls, png_ptr) } default: Xpng_error(tls, png_ptr, __ccgo_ts+14195) /*NOT REACHED*/ } /* Now deal with the output processing */ if expand_tRNS != 0 && libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0 && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) == 0 { Xpng_set_tRNS_to_alpha(tls, png_ptr) } switch data_encoding { case uint32(P_sRGB): /* Change to 8-bit sRGB */ Xpng_set_alpha_mode_fixed(tls, png_ptr, PNG_ALPHA_PNG, int32(PNG_GAMMA_sRGB)) /* FALLTHROUGH */ fallthrough case uint32(P_FILE): if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) > int32(8) { Xpng_set_scale_16(tls, png_ptr) } default: Xpng_error(tls, png_ptr, __ccgo_ts+14218) } if cmap_entries > uint32(256) || cmap_entries > (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries { Xpng_error(tls, png_ptr, __ccgo_ts+14251) } (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries = cmap_entries /* Double check using the recorded background index */ switch output_processing { case uint32(PNG_CMAP_NONE): goto _44 case uint32(PNG_CMAP_GA): goto _45 case uint32(PNG_CMAP_TRANS): goto _46 case uint32(PNG_CMAP_RGB): goto _47 case uint32(PNG_CMAP_RGB_ALPHA): goto _48 default: goto _49 } goto _50 _44: ; if background_index != uint32(PNG_CMAP_NONE_BACKGROUND) { goto bad_background } goto _50 _45: ; if background_index != uint32(PNG_CMAP_GA_BACKGROUND) { goto bad_background } goto _50 _46: ; if background_index >= cmap_entries || background_index != uint32(PNG_CMAP_TRANS_BACKGROUND) { goto bad_background } goto _50 _47: ; if background_index != uint32(PNG_CMAP_RGB_BACKGROUND) { goto bad_background } goto _50 _48: ; if background_index != uint32(PNG_CMAP_RGB_ALPHA_BACKGROUND) { goto bad_background } goto _50 _49: ; Xpng_error(tls, png_ptr, __ccgo_ts+14291) goto bad_background bad_background: ; Xpng_error(tls, png_ptr, __ccgo_ts+14330) _50: ; (*Tpng_image_read_control)(unsafe.Pointer(display)).Fcolormap_processing = libc.Int32FromUint32(output_processing) return int32(1) } // C documentation // // /* The final part of the color-map read called from png_image_finish_read. */ func _png_image_read_and_map(tls *libc.TLS, argument Tpng_voidp) (r int32) { var alpha, alpha2, back_i, entry, gray, startx, stepx, stepy, v5 uint32 var alpha1, gray1 Tpng_byte var display uintptr var end_row Tpng_const_bytep var first_row, inrow, outrow, v16, v17, v19, v20 Tpng_bytep var height, width, y Tpng_uint_32 var image Tpng_imagep var pass, passes, proc, v2, v3, v4 int32 var png_ptr Tpng_structrp var step_row Tptrdiff_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alpha, alpha1, alpha2, back_i, display, end_row, entry, first_row, gray, gray1, height, image, inrow, outrow, pass, passes, png_ptr, proc, startx, step_row, stepx, stepy, width, y, v16, v17, v19, v2, v20, v3, v4, v5 display = argument image = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fimage png_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr /* Called when the libpng data must be transformed into the color-mapped * form. There is a local row buffer in display->local and this routine must * do the interlace handling. */ switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) { case PNG_INTERLACE_NONE: passes = int32(1) case int32(PNG_INTERLACE_ADAM7): passes = int32(PNG_INTERLACE_ADAM7_PASSES) default: Xpng_error(tls, png_ptr, __ccgo_ts+14368) } height = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight width = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth proc = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fcolormap_processing first_row = (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffirst_row step_row = (*Tpng_image_read_control)(unsafe.Pointer(display)).Frow_bytes pass = 0 for { if !(pass < passes) { break } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) == int32(PNG_INTERLACE_ADAM7) { /* The row may be empty for a short image: */ if pass > int32(1) { v2 = (int32(7) - pass) >> int32(1) } else { v2 = int32(3) } if pass > int32(1) { v3 = (int32(7) - pass) >> int32(1) } else { v3 = int32(3) } if (width+libc.Uint32FromInt32(libc.Int32FromInt32(1)<>libc.Int32FromInt32(1))&libc.Int32FromInt32(7)))>>v3 == uint32(0) { goto _1 } startx = libc.Uint32FromInt32(libc.Int32FromInt32(1) & pass << (libc.Int32FromInt32(3) - (pass+libc.Int32FromInt32(1))>>libc.Int32FromInt32(1)) & libc.Int32FromInt32(7)) stepx = libc.Uint32FromInt32(libc.Int32FromInt32(1) << ((libc.Int32FromInt32(7) - pass) >> libc.Int32FromInt32(1))) y = libc.Uint32FromInt32(libc.Int32FromInt32(1) & ^pass << (libc.Int32FromInt32(3) - pass>>libc.Int32FromInt32(1)) & libc.Int32FromInt32(7)) if pass > int32(2) { v4 = int32(8) >> ((pass - int32(1)) >> int32(1)) } else { v4 = int32(8) } stepy = libc.Uint32FromInt32(v4) } else { y = uint32(0) startx = uint32(0) v5 = libc.Uint32FromInt32(1) stepy = v5 stepx = v5 } for { if !(y < height) { break } inrow = (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row outrow = first_row + uintptr(y*libc.Uint32FromInt32(step_row)) end_row = outrow + uintptr(width) /* Read read the libpng data into the temporary buffer. */ Xpng_read_row(tls, png_ptr, inrow, libc.UintptrFromInt32(0)) /* Now process the row according to the processing option, note * that the caller verifies that the format of the libpng output * data is as required. */ outrow += uintptr(startx) switch proc { case int32(PNG_CMAP_GA): goto _7 case int32(PNG_CMAP_TRANS): goto _8 case int32(PNG_CMAP_RGB): goto _9 case int32(PNG_CMAP_RGB_ALPHA): goto _10 default: goto _11 } goto _12 _7: ; _15: ; if !(outrow < end_row) { goto _13 } v16 = inrow inrow++ /* The data is always in the PNG order */ gray = uint32(*(*Tpng_byte)(unsafe.Pointer(v16))) v17 = inrow inrow++ alpha = uint32(*(*Tpng_byte)(unsafe.Pointer(v17))) /* NOTE: this code is copied as a comment in * make_ga_colormap above. Please update the * comment if you change this code! */ if alpha > uint32(229) { /* opaque */ entry = (uint32(231)*gray + uint32(128)) >> int32(8) } else { if alpha < uint32(26) { /* transparent */ entry = uint32(231) } else { /* partially opaque */ entry = uint32(226) + uint32(6)*((alpha*uint32(5)+uint32(130))>>int32(8)) + (gray*uint32(5)+uint32(130))>>int32(8) } } *(*Tpng_byte)(unsafe.Pointer(outrow)) = uint8(entry) goto _14 _14: ; outrow += uintptr(stepx) goto _15 goto _13 _13: ; goto _12 _8: ; for { if !(outrow < end_row) { break } v19 = inrow inrow++ gray1 = *(*Tpng_byte)(unsafe.Pointer(v19)) v20 = inrow inrow++ alpha1 = *(*Tpng_byte)(unsafe.Pointer(v20)) if libc.Int32FromUint8(alpha1) == 0 { *(*Tpng_byte)(unsafe.Pointer(outrow)) = uint8(PNG_CMAP_TRANS_BACKGROUND) } else { if libc.Int32FromUint8(gray1) != int32(PNG_CMAP_TRANS_BACKGROUND) { *(*Tpng_byte)(unsafe.Pointer(outrow)) = gray1 } else { *(*Tpng_byte)(unsafe.Pointer(outrow)) = libc.Uint8FromInt32(libc.Int32FromInt32(PNG_CMAP_TRANS_BACKGROUND) + libc.Int32FromInt32(1)) } } goto _18 _18: ; outrow += uintptr(stepx) } goto _12 _9: ; for { if !(outrow < end_row) { break } *(*Tpng_byte)(unsafe.Pointer(outrow)) = libc.Uint8FromInt32(libc.Int32FromInt32(6)*(libc.Int32FromInt32(6)*((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow)))*libc.Int32FromInt32(5)+libc.Int32FromInt32(130))>>libc.Int32FromInt32(8))+(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow + 1)))*libc.Int32FromInt32(5)+libc.Int32FromInt32(130))>>libc.Int32FromInt32(8)) + (libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow + 2)))*libc.Int32FromInt32(5)+libc.Int32FromInt32(130))>>libc.Int32FromInt32(8)) inrow += uintptr(3) goto _21 _21: ; outrow += uintptr(stepx) } goto _12 _10: ; for { if !(outrow < end_row) { break } alpha2 = uint32(*(*Tpng_byte)(unsafe.Pointer(inrow + 3))) /* Because the alpha entries only hold alpha==0.5 values * split the processing at alpha==0.25 (64) and 0.75 * (196). */ if alpha2 >= uint32(196) { *(*Tpng_byte)(unsafe.Pointer(outrow)) = libc.Uint8FromInt32(libc.Int32FromInt32(6)*(libc.Int32FromInt32(6)*((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow)))*libc.Int32FromInt32(5)+libc.Int32FromInt32(130))>>libc.Int32FromInt32(8))+(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow + 1)))*libc.Int32FromInt32(5)+libc.Int32FromInt32(130))>>libc.Int32FromInt32(8)) + (libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow + 2)))*libc.Int32FromInt32(5)+libc.Int32FromInt32(130))>>libc.Int32FromInt32(8)) } else { if alpha2 < uint32(64) { *(*Tpng_byte)(unsafe.Pointer(outrow)) = uint8(PNG_CMAP_RGB_ALPHA_BACKGROUND) } else { /* Likewise there are three entries for each of r, g * and b. We could select the entry by popcount on * the top two bits on those architectures that * support it, this is what the code below does, * crudely. */ back_i = libc.Uint32FromInt32(libc.Int32FromInt32(PNG_CMAP_RGB_ALPHA_BACKGROUND) + libc.Int32FromInt32(1)) /* Here are how the values map: * * 0x00 .. 0x3f -> 0 * 0x40 .. 0xbf -> 1 * 0xc0 .. 0xff -> 2 * * So, as above with the explicit alpha checks, the * breakpoints are at 64 and 196. */ if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow)))&int32(0x80) != 0 { back_i += uint32(9) } /* red */ if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow)))&int32(0x40) != 0 { back_i += uint32(9) } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow)))&int32(0x80) != 0 { back_i += uint32(3) } /* green */ if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow)))&int32(0x40) != 0 { back_i += uint32(3) } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow)))&int32(0x80) != 0 { back_i += uint32(1) } /* blue */ if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(inrow)))&int32(0x40) != 0 { back_i += uint32(1) } *(*Tpng_byte)(unsafe.Pointer(outrow)) = uint8(back_i) } } inrow += uintptr(4) goto _22 _22: ; outrow += uintptr(stepx) } goto _12 _11: ; goto _12 _12: ; goto _6 _6: ; y += stepy } goto _1 _1: ; pass++ } return int32(1) } func _png_image_read_colormapped(tls *libc.TLS, argument Tpng_voidp) (r int32) { var control Tpng_controlp var display, ptr uintptr var first_row, row Tpng_voidp var image Tpng_imagep var info_ptr Tpng_inforp var passes, result, v8 int32 var png_ptr Tpng_structrp var row1 Tpng_bytep var row_bytes Tptrdiff_t var row_bytes1 Tpng_alloc_size_t var y Tpng_uint_32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = control, display, first_row, image, info_ptr, passes, png_ptr, ptr, result, row, row1, row_bytes, row_bytes1, y, v8 display = argument image = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fimage control = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque png_ptr = (*Tpng_control1)(unsafe.Pointer(control)).Fpng_ptr info_ptr = (*Tpng_control1)(unsafe.Pointer(control)).Finfo_ptr passes = 0 /* As a flag */ _png_image_skip_unused_chunks(tls, png_ptr) /* Update the 'info' structure and make sure the result is as required; first * make sure to turn on the interlace handling if it will be required * (because it can't be turned on *after* the call to png_read_update_info!) */ if (*Tpng_image_read_control)(unsafe.Pointer(display)).Fcolormap_processing == PNG_CMAP_NONE { passes = Xpng_set_interlace_handling(tls, png_ptr) } Xpng_read_update_info(tls, png_ptr, info_ptr) /* The expected output can be deduced from the colormap_processing option. */ switch (*Tpng_image_read_control)(unsafe.Pointer(display)).Fcolormap_processing { case PNG_CMAP_NONE: goto _1 case int32(PNG_CMAP_GA): goto _2 case int32(PNG_CMAP_TRANS): goto _3 case int32(PNG_CMAP_RGB): goto _4 case int32(PNG_CMAP_RGB_ALPHA): goto _5 default: goto _6 } goto _7 _1: ; /* Output must be one channel and one byte per pixel, the output * encoding can be anything. */ if (libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) || libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == PNG_COLOR_TYPE_GRAY) && libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) == int32(8) { goto _7 } goto bad_output _3: ; _2: ; /* Output must be two channels and the 'G' one must be sRGB, the latter * can be checked with an exact number because it should have been set * to this number above! */ if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA) && libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) == int32(8) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma == int32(PNG_GAMMA_sRGB) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries == uint32(256) { goto _7 } goto bad_output _4: ; /* Output must be 8-bit sRGB encoded RGB */ if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) && libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) == int32(8) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma == int32(PNG_GAMMA_sRGB) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries == uint32(216) { goto _7 } goto bad_output _5: ; /* Output must be 8-bit sRGB encoded RGBA */ if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) && libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) == int32(8) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma == int32(PNG_GAMMA_sRGB) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries == uint32(244) { goto _7 } goto bad_output _6: ; goto bad_output bad_output: ; Xpng_error(tls, png_ptr, __ccgo_ts+14391) _7: ; /* Now read the rows. Do this here if it is possible to read directly into * the output buffer, otherwise allocate a local row buffer of the maximum * size libpng requires and call the relevant processing routine safely. */ first_row = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fbuffer row_bytes = (*Tpng_image_read_control)(unsafe.Pointer(display)).Frow_stride /* The following expression is designed to work correctly whether it gives * a signed or an unsigned result. */ if row_bytes < 0 { ptr = first_row ptr += uintptr(((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight - uint32(1)) * libc.Uint32FromInt32(-row_bytes)) first_row = ptr } (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffirst_row = first_row (*Tpng_image_read_control)(unsafe.Pointer(display)).Frow_bytes = row_bytes if passes == 0 { row = Xpng_malloc(tls, png_ptr, Xpng_get_rowbytes(tls, png_ptr, info_ptr)) (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row = row result = Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_read_and_map), display) (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row = libc.UintptrFromInt32(0) Xpng_free(tls, png_ptr, row) return result } else { row_bytes1 = libc.Uint32FromInt32((*Tpng_image_read_control)(unsafe.Pointer(display)).Frow_bytes) for { passes-- v8 = passes if !(v8 >= 0) { break } y = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight row1 = (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffirst_row for { if !(y > uint32(0)) { break } Xpng_read_row(tls, png_ptr, row1, libc.UintptrFromInt32(0)) row1 += uintptr(row_bytes1) goto _9 _9: ; y-- } } return int32(1) } return r } // C documentation // // /* Just the row reading part of png_image_read. */ func _png_image_read_composite(tls *libc.TLS, argument Tpng_voidp) (r int32) { var alpha Tpng_byte var c, channels, startx, stepx, stepy uint32 var component, height, width, y Tpng_uint_32 var display uintptr var end_row Tpng_const_bytep var image Tpng_imagep var inrow, outrow Tpng_bytep var pass, passes, v1, v3, v4, v5 int32 var png_ptr Tpng_structrp var step_row Tptrdiff_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alpha, c, channels, component, display, end_row, height, image, inrow, outrow, pass, passes, png_ptr, startx, step_row, stepx, stepy, width, y, v1, v3, v4, v5 display = argument image = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fimage png_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) { case PNG_INTERLACE_NONE: passes = int32(1) case int32(PNG_INTERLACE_ADAM7): passes = int32(PNG_INTERLACE_ADAM7_PASSES) default: Xpng_error(tls, png_ptr, __ccgo_ts+14368) } height = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight width = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth step_row = (*Tpng_image_read_control)(unsafe.Pointer(display)).Frow_bytes if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x02) != uint32(0) { v1 = int32(3) } else { v1 = int32(1) } channels = libc.Uint32FromInt32(v1) pass = 0 for { if !(pass < passes) { break } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) == int32(PNG_INTERLACE_ADAM7) { /* The row may be empty for a short image: */ if pass > int32(1) { v3 = (int32(7) - pass) >> int32(1) } else { v3 = int32(3) } if pass > int32(1) { v4 = (int32(7) - pass) >> int32(1) } else { v4 = int32(3) } if (width+libc.Uint32FromInt32(libc.Int32FromInt32(1)<>libc.Int32FromInt32(1))&libc.Int32FromInt32(7)))>>v4 == uint32(0) { goto _2 } startx = libc.Uint32FromInt32(libc.Int32FromInt32(1)&pass<<(libc.Int32FromInt32(3)-(pass+libc.Int32FromInt32(1))>>libc.Int32FromInt32(1))&libc.Int32FromInt32(7)) * channels stepx = libc.Uint32FromInt32(libc.Int32FromInt32(1)<<((libc.Int32FromInt32(7)-pass)>>libc.Int32FromInt32(1))) * channels y = libc.Uint32FromInt32(libc.Int32FromInt32(1) & ^pass << (libc.Int32FromInt32(3) - pass>>libc.Int32FromInt32(1)) & libc.Int32FromInt32(7)) if pass > int32(2) { v5 = int32(8) >> ((pass - int32(1)) >> int32(1)) } else { v5 = int32(8) } stepy = libc.Uint32FromInt32(v5) } else { y = uint32(0) startx = uint32(0) stepx = channels stepy = uint32(1) } for { if !(y < height) { break } inrow = (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row /* Read the row, which is packed: */ Xpng_read_row(tls, png_ptr, inrow, libc.UintptrFromInt32(0)) outrow = (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffirst_row outrow += uintptr(y * libc.Uint32FromInt32(step_row)) end_row = outrow + uintptr(width*channels) /* Now do the composition on each pixel in this row. */ outrow += uintptr(startx) for { if !(outrow < end_row) { break } alpha = *(*Tpng_byte)(unsafe.Pointer(inrow + uintptr(channels))) if libc.Int32FromUint8(alpha) > 0 { /* else no change to the output */ c = uint32(0) for { if !(c < channels) { break } component = uint32(*(*Tpng_byte)(unsafe.Pointer(inrow + uintptr(c)))) if libc.Int32FromUint8(alpha) < int32(255) { /* else just use component */ /* This is PNG_OPTIMIZED_ALPHA, the component value * is a linear 8-bit value. Combine this with the * current outrow[c] value which is sRGB encoded. * Arithmetic here is 16-bits to preserve the output * values correctly. */ component *= libc.Uint32FromInt32(libc.Int32FromInt32(257) * libc.Int32FromInt32(255)) /* =65535 */ component += libc.Uint32FromInt32((int32(255) - libc.Int32FromUint8(alpha)) * libc.Int32FromUint16(Xpng_sRGB_table[*(*Tpng_byte)(unsafe.Pointer(outrow + uintptr(c)))])) /* So 'component' is scaled by 255*65535 and is * therefore appropriate for the sRGB to linear * conversion table. */ component = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[component>>int32(15)]) + component&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[component>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) } *(*Tpng_byte)(unsafe.Pointer(outrow + uintptr(c))) = uint8(component) goto _8 _8: ; c++ } } inrow += uintptr(channels + uint32(1)) /* components and alpha channel */ goto _7 _7: ; outrow += uintptr(stepx) } goto _6 _6: ; y += stepy } goto _2 _2: ; pass++ } return int32(1) } // C documentation // // /* The do_local_background case; called when all the following transforms are to // * be done: // * // * PNG_RGB_TO_GRAY // * PNG_COMPOSITE // * PNG_GAMMA // * // * This is a work-around for the fact that both the PNG_RGB_TO_GRAY and // * PNG_COMPOSITE code performs gamma correction, so we get double gamma // * correction. The fix-up is to prevent the PNG_COMPOSITE operation from // * happening inside libpng, so this routine sees an 8 or 16-bit gray+alpha // * row and handles the removal or pre-multiplication of the alpha channel. // */ func _png_image_read_background(tls *libc.TLS, argument Tpng_voidp) (r int32) { var alpha, alpha1, background8 Tpng_byte var alpha2, background Tpng_uint_16 var component, component1, component2, height, width, y, y1 Tpng_uint_32 var display uintptr var end_row, end_row1 Tpng_const_bytep var end_row2, first_row1, outrow2 Tpng_uint_16p var first_row, inrow, inrow1, outrow, outrow1 Tpng_bytep var image Tpng_imagep var info_ptr Tpng_inforp var inrow2 Tpng_const_uint_16p var outchannels, preserve_alpha, startx, startx1, stepx, stepx1, stepy, stepy1, v5 uint32 var pass, passes, swap_alpha, v11, v12, v13, v2, v3, v4 int32 var png_ptr Tpng_structrp var step_row, step_row1 Tptrdiff_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alpha, alpha1, alpha2, background, background8, component, component1, component2, display, end_row, end_row1, end_row2, first_row, first_row1, height, image, info_ptr, inrow, inrow1, inrow2, outchannels, outrow, outrow1, outrow2, pass, passes, png_ptr, preserve_alpha, startx, startx1, step_row, step_row1, stepx, stepx1, stepy, stepy1, swap_alpha, width, y, y1, v11, v12, v13, v2, v3, v4, v5 display = argument image = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fimage png_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr info_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Finfo_ptr height = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight width = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth /* Double check the convoluted logic below. We expect to get here with * libpng doing rgb to gray and gamma correction but background processing * left to the png_image_read_background function. The rows libpng produce * might be 8 or 16-bit but should always have two channels; gray plus alpha. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x600000) == uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+14433) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+14450) } if libc.Int32FromUint8(Xpng_get_channels(tls, png_ptr, info_ptr)) != int32(2) { Xpng_error(tls, png_ptr, __ccgo_ts+14469) } /* Expect the 8-bit case to always remove the alpha channel */ if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x04) == uint32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x01) != uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+14490) } switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) { case PNG_INTERLACE_NONE: passes = int32(1) case int32(PNG_INTERLACE_ADAM7): passes = int32(PNG_INTERLACE_ADAM7_PASSES) default: Xpng_error(tls, png_ptr, __ccgo_ts+14368) } /* Use direct access to info_ptr here because otherwise the simplified API * would require PNG_EASY_ACCESS_SUPPORTED (just for this.) Note this is * checking the value after libpng expansions, not the original value in the * PNG. */ switch libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) { case int32(8): /* 8-bit sRGB gray values with an alpha channel; the alpha channel is * to be removed by composing on a background: either the row if * display->background is NULL or display->background->green if not. * Unlike the code above ALPHA_OPTIMIZED has *not* been done. */ first_row = (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffirst_row step_row = (*Tpng_image_read_control)(unsafe.Pointer(display)).Frow_bytes pass = 0 for { if !(pass < passes) { break } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) == int32(PNG_INTERLACE_ADAM7) { /* The row may be empty for a short image: */ if pass > int32(1) { v2 = (int32(7) - pass) >> int32(1) } else { v2 = int32(3) } if pass > int32(1) { v3 = (int32(7) - pass) >> int32(1) } else { v3 = int32(3) } if (width+libc.Uint32FromInt32(libc.Int32FromInt32(1)<>libc.Int32FromInt32(1))&libc.Int32FromInt32(7)))>>v3 == uint32(0) { goto _1 } startx = libc.Uint32FromInt32(libc.Int32FromInt32(1) & pass << (libc.Int32FromInt32(3) - (pass+libc.Int32FromInt32(1))>>libc.Int32FromInt32(1)) & libc.Int32FromInt32(7)) stepx = libc.Uint32FromInt32(libc.Int32FromInt32(1) << ((libc.Int32FromInt32(7) - pass) >> libc.Int32FromInt32(1))) y = libc.Uint32FromInt32(libc.Int32FromInt32(1) & ^pass << (libc.Int32FromInt32(3) - pass>>libc.Int32FromInt32(1)) & libc.Int32FromInt32(7)) if pass > int32(2) { v4 = int32(8) >> ((pass - int32(1)) >> int32(1)) } else { v4 = int32(8) } stepy = libc.Uint32FromInt32(v4) } else { y = uint32(0) startx = uint32(0) v5 = libc.Uint32FromInt32(1) stepy = v5 stepx = v5 } if (*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground == libc.UintptrFromInt32(0) { for { if !(y < height) { break } inrow = (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row outrow = first_row + uintptr(y*libc.Uint32FromInt32(step_row)) end_row = outrow + uintptr(width) /* Read the row, which is packed: */ Xpng_read_row(tls, png_ptr, inrow, libc.UintptrFromInt32(0)) /* Now do the composition on each pixel in this row. */ outrow += uintptr(startx) for { if !(outrow < end_row) { break } alpha = *(*Tpng_byte)(unsafe.Pointer(inrow + 1)) if libc.Int32FromUint8(alpha) > 0 { /* else no change to the output */ component = uint32(*(*Tpng_byte)(unsafe.Pointer(inrow))) if libc.Int32FromUint8(alpha) < int32(255) { /* else just use component */ /* Since PNG_OPTIMIZED_ALPHA was not set it is * necessary to invert the sRGB transfer * function and multiply the alpha out. */ component = libc.Uint32FromInt32(libc.Int32FromUint16(Xpng_sRGB_table[component]) * libc.Int32FromUint8(alpha)) component += libc.Uint32FromInt32(libc.Int32FromUint16(Xpng_sRGB_table[*(*Tpng_byte)(unsafe.Pointer(outrow))]) * (int32(255) - libc.Int32FromUint8(alpha))) component = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[component>>int32(15)]) + component&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[component>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) } *(*Tpng_byte)(unsafe.Pointer(outrow)) = uint8(component) } inrow += uintptr(2) /* gray and alpha channel */ goto _7 _7: ; outrow += uintptr(stepx) } goto _6 _6: ; y += stepy } } else { /* constant background value */ background8 = (*Tpng_color)(unsafe.Pointer((*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground)).Fgreen background = Xpng_sRGB_table[background8] for { if !(y < height) { break } inrow1 = (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row outrow1 = first_row + uintptr(y*libc.Uint32FromInt32(step_row)) end_row1 = outrow1 + uintptr(width) /* Read the row, which is packed: */ Xpng_read_row(tls, png_ptr, inrow1, libc.UintptrFromInt32(0)) /* Now do the composition on each pixel in this row. */ outrow1 += uintptr(startx) for { if !(outrow1 < end_row1) { break } alpha1 = *(*Tpng_byte)(unsafe.Pointer(inrow1 + 1)) if libc.Int32FromUint8(alpha1) > 0 { /* else use background */ component1 = uint32(*(*Tpng_byte)(unsafe.Pointer(inrow1))) if libc.Int32FromUint8(alpha1) < int32(255) { /* else just use component */ component1 = libc.Uint32FromInt32(libc.Int32FromUint16(Xpng_sRGB_table[component1]) * libc.Int32FromUint8(alpha1)) component1 += libc.Uint32FromInt32(libc.Int32FromUint16(background) * (int32(255) - libc.Int32FromUint8(alpha1))) component1 = uint32(uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[component1>>int32(15)]) + component1&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[component1>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8)))) } *(*Tpng_byte)(unsafe.Pointer(outrow1)) = uint8(component1) } else { *(*Tpng_byte)(unsafe.Pointer(outrow1)) = background8 } inrow1 += uintptr(2) /* gray and alpha channel */ goto _9 _9: ; outrow1 += uintptr(stepx) } goto _8 _8: ; y += stepy } } goto _1 _1: ; pass++ } case int32(16): /* 16-bit linear with pre-multiplied alpha; the pre-multiplication must * still be done and, maybe, the alpha channel removed. This code also * handles the alpha-first option. */ first_row1 = (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffirst_row /* The division by two is safe because the caller passed in a * stride which was multiplied by 2 (below) to get row_bytes. */ step_row1 = (*Tpng_image_read_control)(unsafe.Pointer(display)).Frow_bytes / int32(2) preserve_alpha = libc.BoolUint32((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x01) != uint32(0)) outchannels = uint32(1) + preserve_alpha swap_alpha = 0 if preserve_alpha != uint32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x20) != uint32(0) { swap_alpha = int32(1) } pass = 0 for { if !(pass < passes) { break } /* The 'x' start and step are adjusted to output components here. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) == int32(PNG_INTERLACE_ADAM7) { /* The row may be empty for a short image: */ if pass > int32(1) { v11 = (int32(7) - pass) >> int32(1) } else { v11 = int32(3) } if pass > int32(1) { v12 = (int32(7) - pass) >> int32(1) } else { v12 = int32(3) } if (width+libc.Uint32FromInt32(libc.Int32FromInt32(1)<>libc.Int32FromInt32(1))&libc.Int32FromInt32(7)))>>v12 == uint32(0) { goto _10 } startx1 = libc.Uint32FromInt32(libc.Int32FromInt32(1)&pass<<(libc.Int32FromInt32(3)-(pass+libc.Int32FromInt32(1))>>libc.Int32FromInt32(1))&libc.Int32FromInt32(7)) * outchannels stepx1 = libc.Uint32FromInt32(libc.Int32FromInt32(1)<<((libc.Int32FromInt32(7)-pass)>>libc.Int32FromInt32(1))) * outchannels y1 = libc.Uint32FromInt32(libc.Int32FromInt32(1) & ^pass << (libc.Int32FromInt32(3) - pass>>libc.Int32FromInt32(1)) & libc.Int32FromInt32(7)) if pass > int32(2) { v13 = int32(8) >> ((pass - int32(1)) >> int32(1)) } else { v13 = int32(8) } stepy1 = libc.Uint32FromInt32(v13) } else { y1 = uint32(0) startx1 = uint32(0) stepx1 = outchannels stepy1 = uint32(1) } for { if !(y1 < height) { break } outrow2 = first_row1 + uintptr(y1*libc.Uint32FromInt32(step_row1))*2 end_row2 = outrow2 + uintptr(width*outchannels)*2 /* Read the row, which is packed: */ Xpng_read_row(tls, png_ptr, (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row, libc.UintptrFromInt32(0)) inrow2 = (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row /* Now do the pre-multiplication on each pixel in this row. */ outrow2 += uintptr(startx1) * 2 for { if !(outrow2 < end_row2) { break } component2 = uint32(*(*Tpng_uint_16)(unsafe.Pointer(inrow2))) alpha2 = *(*Tpng_uint_16)(unsafe.Pointer(inrow2 + 1*2)) if libc.Int32FromUint16(alpha2) > 0 { /* else 0 */ if libc.Int32FromUint16(alpha2) < int32(65535) { /* else just use component */ component2 *= uint32(alpha2) component2 += uint32(32767) component2 /= uint32(65535) } } else { component2 = uint32(0) } *(*Tpng_uint_16)(unsafe.Pointer(outrow2 + uintptr(swap_alpha)*2)) = uint16(component2) if preserve_alpha != uint32(0) { *(*Tpng_uint_16)(unsafe.Pointer(outrow2 + uintptr(int32(1)^swap_alpha)*2)) = alpha2 } inrow2 += uintptr(2) * 2 /* components and alpha channel */ goto _15 _15: ; outrow2 += uintptr(stepx1) * 2 } goto _14 _14: ; y1 += stepy1 } goto _10 _10: ; pass++ } default: Xpng_error(tls, png_ptr, __ccgo_ts+14522) } return int32(1) } // C documentation // // /* The guts of png_image_finish_read as a png_safe_execute callback. */ func _png_image_read_direct(tls *libc.TLS, argument Tpng_voidp) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var base_format, change, filler, format, info_format, y Tpng_uint_32 var display, ptr uintptr var do_local_background, do_local_compose, linear, mode, passes, result, result1, where, v1 int32 var first_row, row, row1 Tpng_voidp var image Tpng_imagep var info_ptr Tpng_inforp var input_gamma_default, output_gamma Tpng_fixed_point var png_ptr Tpng_structrp var row2 Tpng_bytep var row_bytes Tptrdiff_t var row_bytes1 Tpng_alloc_size_t var _ /* c at bp+4 */ Tpng_color_16 var _ /* gtest at bp+0 */ Tpng_fixed_point var _ /* le at bp+14 */ Tpng_uint_16 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = base_format, change, display, do_local_background, do_local_compose, filler, first_row, format, image, info_format, info_ptr, input_gamma_default, linear, mode, output_gamma, passes, png_ptr, ptr, result, result1, row, row1, row2, row_bytes, row_bytes1, where, y, v1 display = argument image = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fimage png_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr info_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Finfo_ptr format = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat linear = libc.BoolInt32(format&uint32(0x04) != uint32(0)) do_local_compose = 0 do_local_background = 0 /* to avoid double gamma correction bug */ passes = 0 /* Add transforms to ensure the correct output format is produced then check * that the required implementation support is there. Always expand; always * need 8 bits minimum, no palette and expanded tRNS. */ Xpng_set_expand(tls, png_ptr) /* Now check the format to see if it was modified. */ base_format = _png_image_format(tls, png_ptr) & ^libc.Uint32FromUint32(0x08) change = format ^ base_format /* alpha mode */ /* Do this first so that we have a record if rgb to gray is happening. */ if change&uint32(0x02) != uint32(0) { /* gray<->color transformation required. */ if format&uint32(0x02) != uint32(0) { Xpng_set_gray_to_rgb(tls, png_ptr) } else { /* libpng can't do both rgb to gray and * background/pre-multiplication if there is also significant gamma * correction, because both operations require linear colors and * the code only supports one transform doing the gamma correction. * Handle this by doing the pre-multiplication or background * operation in this code, if necessary. * * TODO: fix this by rewriting pngrtran.c (!) * * For the moment (given that fixing this in pngrtran.c is an * enormous change) 'do_local_background' is used to indicate that * the problem exists. */ if base_format&uint32(0x01) != uint32(0) { do_local_background = int32(1) } Xpng_set_rgb_to_gray_fixed(tls, png_ptr, int32(PNG_ERROR_ACTION_NONE), -libc.Int32FromInt32(1), -libc.Int32FromInt32(1)) } change &= ^libc.Uint32FromUint32(0x02) } /* Set the gamma appropriately, linear for 16-bit input, sRGB otherwise. */ if base_format&uint32(0x04) != uint32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fflags&uint32(PNG_IMAGE_FLAG_16BIT_sRGB1) == uint32(0) { input_gamma_default = int32(PNG_FP_1) } else { input_gamma_default = -int32(1) } /* Call png_set_alpha_mode to set the default for the input gamma; the * output gamma is set by a second call below. */ Xpng_set_alpha_mode_fixed(tls, png_ptr, PNG_ALPHA_PNG, input_gamma_default) if linear != 0 { /* If there *is* an alpha channel in the input it must be multiplied * out; use PNG_ALPHA_STANDARD, otherwise just use PNG_ALPHA_PNG. */ if base_format&uint32(0x01) != uint32(0) { mode = int32(PNG_ALPHA_STANDARD) } else { mode = PNG_ALPHA_PNG } output_gamma = int32(PNG_FP_1) } else { mode = PNG_ALPHA_PNG output_gamma = -int32(1) } if change&uint32(0x40) != uint32(0) { mode = int32(PNG_ALPHA_OPTIMIZED) change &= ^libc.Uint32FromUint32(0x40) } /* If 'do_local_background' is set check for the presence of gamma * correction; this is part of the work-round for the libpng bug * described above. * * TODO: fix libpng and remove this. */ if do_local_background != 0 { /* This is 'png_gamma_threshold' from pngrtran.c; the test used for * gamma correction, the screen gamma hasn't been set on png_struct * yet; it's set below. png_struct::gamma, however, is set to the * final value. */ if Xpng_muldiv(tls, bp, output_gamma, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma, int32(PNG_FP_1)) != 0 && Xpng_gamma_significant(tls, *(*Tpng_fixed_point)(unsafe.Pointer(bp))) == 0 { do_local_background = 0 } else { if mode == int32(PNG_ALPHA_STANDARD) { do_local_background = int32(2) mode = PNG_ALPHA_PNG /* prevent libpng doing it */ } } /* else leave as 1 for the checks below */ } /* If the bit-depth changes then handle that here. */ if change&uint32(0x04) != uint32(0) { if linear != 0 { Xpng_set_expand_16(tls, png_ptr) } else { /* 8-bit output */ Xpng_set_scale_16(tls, png_ptr) } change &= ^libc.Uint32FromUint32(0x04) } /* Now the background/alpha channel changes. */ if change&uint32(0x01) != uint32(0) { /* Removing an alpha channel requires composition for the 8-bit * formats; for the 16-bit it is already done, above, by the * pre-multiplication and the channel just needs to be stripped. */ if base_format&uint32(0x01) != uint32(0) { /* If RGB->gray is happening the alpha channel must be left and the * operation completed locally. * * TODO: fix libpng and remove this. */ if do_local_background != 0 { do_local_background = int32(2) } else { if linear != 0 { /* compose on black (well, pre-multiply) */ Xpng_set_strip_alpha(tls, png_ptr) } else { if (*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground != libc.UintptrFromInt32(0) { (*(*Tpng_color_16)(unsafe.Pointer(bp + 4))).Findex = uint8(0) /*unused*/ (*(*Tpng_color_16)(unsafe.Pointer(bp + 4))).Fred = uint16((*Tpng_color)(unsafe.Pointer((*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground)).Fred) (*(*Tpng_color_16)(unsafe.Pointer(bp + 4))).Fgreen = uint16((*Tpng_color)(unsafe.Pointer((*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground)).Fgreen) (*(*Tpng_color_16)(unsafe.Pointer(bp + 4))).Fblue = uint16((*Tpng_color)(unsafe.Pointer((*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground)).Fblue) (*(*Tpng_color_16)(unsafe.Pointer(bp + 4))).Fgray = uint16((*Tpng_color)(unsafe.Pointer((*Tpng_image_read_control)(unsafe.Pointer(display)).Fbackground)).Fgreen) /* This is always an 8-bit sRGB value, using the 'green' channel * for gray is much better than calculating the luminance here; * we can get off-by-one errors in that calculation relative to * the app expectations and that will show up in transparent * pixels. */ Xpng_set_background_fixed(tls, png_ptr, bp+4, int32(PNG_BACKGROUND_GAMMA_SCREEN), 0, 0) } else { /* compose on row: implemented below. */ do_local_compose = int32(1) /* This leaves the alpha channel in the output, so it has to be * removed by the code below. Set the encoding to the 'OPTIMIZE' * one so the code only has to hack on the pixels that require * composition. */ mode = int32(PNG_ALPHA_OPTIMIZED) } } } } else { /* output needs an alpha channel */ if linear != 0 { filler = uint32(65535) } else { filler = uint32(255) } if format&uint32(0x20) != uint32(0) { where = PNG_FILLER_BEFORE change &= ^libc.Uint32FromUint32(0x20) } else { where = int32(PNG_FILLER_AFTER) } Xpng_set_add_alpha(tls, png_ptr, filler, where) } /* This stops the (irrelevant) call to swap_alpha below. */ change &= ^libc.Uint32FromUint32(0x01) } /* Now set the alpha mode correctly; this is always done, even if there is * no alpha channel in either the input or the output because it correctly * sets the output gamma. */ Xpng_set_alpha_mode_fixed(tls, png_ptr, mode, output_gamma) if change&uint32(0x10) != uint32(0) { /* Check only the output format; PNG is never BGR; don't do this if * the output is gray, but fix up the 'format' value in that case. */ if format&uint32(0x02) != uint32(0) { Xpng_set_bgr(tls, png_ptr) } else { format &= ^libc.Uint32FromUint32(0x10) } change &= ^libc.Uint32FromUint32(0x10) } if change&uint32(0x20) != uint32(0) { /* Only relevant if there is an alpha channel - it's particularly * important to handle this correctly because do_local_compose may * be set above and then libpng will keep the alpha channel for this * code to remove. */ if format&uint32(0x01) != uint32(0) { /* Disable this if doing a local background, * TODO: remove this when local background is no longer required. */ if do_local_background != int32(2) { Xpng_set_swap_alpha(tls, png_ptr) } } else { format &= ^libc.Uint32FromUint32(0x20) } change &= ^libc.Uint32FromUint32(0x20) } /* If the *output* is 16-bit then we need to check for a byte-swap on this * architecture. */ if linear != 0 { *(*Tpng_uint_16)(unsafe.Pointer(bp + 14)) = uint16(0x0001) if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(bp + 14))) != 0 { Xpng_set_swap(tls, png_ptr) } } /* If change is not now 0 some transformation is missing - error out. */ if change != uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+14543) } _png_image_skip_unused_chunks(tls, png_ptr) /* Update the 'info' structure and make sure the result is as required; first * make sure to turn on the interlace handling if it will be required * (because it can't be turned on *after* the call to png_read_update_info!) * * TODO: remove the do_local_background fixup below. */ if do_local_compose == 0 && do_local_background != int32(2) { passes = Xpng_set_interlace_handling(tls, png_ptr) } Xpng_read_update_info(tls, png_ptr, info_ptr) info_format = uint32(0) if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { info_format |= uint32(0x02) } if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0 { /* do_local_compose removes this channel below. */ if do_local_compose == 0 { /* do_local_background does the same if required. */ if do_local_background != int32(2) || format&uint32(0x01) != uint32(0) { info_format |= uint32(0x01) } } } else { if do_local_compose != 0 { /* internal error */ Xpng_error(tls, png_ptr, __ccgo_ts+14586) } } if format&uint32(0x40) != uint32(0) { info_format |= uint32(0x40) } if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) == int32(16) { info_format |= uint32(0x04) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0001) != uint32(0) { info_format |= uint32(0x10) } if do_local_background == int32(2) { if format&uint32(0x20) != uint32(0) { info_format |= uint32(0x20) } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x20000) != uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0080) == uint32(0) { if do_local_background == int32(2) { Xpng_error(tls, png_ptr, __ccgo_ts+14621) } info_format |= uint32(0x20) } /* This is actually an internal error. */ if info_format != format { Xpng_error(tls, png_ptr, __ccgo_ts+14658) } /* Now read the rows. If do_local_compose is set then it is necessary to use * a local row buffer. The output will be GA, RGBA or BGRA and must be * converted to G, RGB or BGR as appropriate. The 'local_row' member of the * display acts as a flag. */ first_row = (*Tpng_image_read_control)(unsafe.Pointer(display)).Fbuffer row_bytes = (*Tpng_image_read_control)(unsafe.Pointer(display)).Frow_stride if linear != 0 { row_bytes *= int32(2) } /* The following expression is designed to work correctly whether it gives * a signed or an unsigned result. */ if row_bytes < 0 { ptr = first_row ptr += uintptr(((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight - uint32(1)) * libc.Uint32FromInt32(-row_bytes)) first_row = ptr } (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffirst_row = first_row (*Tpng_image_read_control)(unsafe.Pointer(display)).Frow_bytes = row_bytes if do_local_compose != 0 { row = Xpng_malloc(tls, png_ptr, Xpng_get_rowbytes(tls, png_ptr, info_ptr)) (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row = row result = Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_read_composite), display) (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row = libc.UintptrFromInt32(0) Xpng_free(tls, png_ptr, row) return result } else { if do_local_background == int32(2) { row1 = Xpng_malloc(tls, png_ptr, Xpng_get_rowbytes(tls, png_ptr, info_ptr)) (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row = row1 result1 = Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_read_background), display) (*Tpng_image_read_control)(unsafe.Pointer(display)).Flocal_row = libc.UintptrFromInt32(0) Xpng_free(tls, png_ptr, row1) return result1 } else { row_bytes1 = libc.Uint32FromInt32((*Tpng_image_read_control)(unsafe.Pointer(display)).Frow_bytes) for { passes-- v1 = passes if !(v1 >= 0) { break } y = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight row2 = (*Tpng_image_read_control)(unsafe.Pointer(display)).Ffirst_row for { if !(y > uint32(0)) { break } Xpng_read_row(tls, png_ptr, row2, libc.UintptrFromInt32(0)) row2 += uintptr(row_bytes1) goto _2 _2: ; y-- } } return int32(1) } } return r } func Xpng_image_finish_read(tls *libc.TLS, image Tpng_imagep, background Tpng_const_colorp, buffer uintptr, row_stride Tpng_int_32, colormap uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var channels, v1, v2 uint32 var check, png_row_stride Tpng_uint_32 var result int32 var _ /* display at bp+0 */ Tpng_image_read_control _, _, _, _, _, _ = channels, check, png_row_stride, result, v1, v2 if image != libc.UintptrFromInt32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fversion == uint32(PNG_IMAGE_VERSION) { if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x08) != 0 { v1 = uint32(1) } else { v1 = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&(libc.Uint32FromUint32(0x02)|libc.Uint32FromUint32(0x01)) + uint32(1) } /* Check for row_stride overflow. This check is not performed on the * original PNG format because it may not occur in the output PNG format * and libpng deals with the issues of reading the original. */ channels = v1 /* The following checks just the 'row_stride' calculation to ensure it * fits in a signed 32-bit value. Because channels/components can be * either 1 or 2 bytes in size the length of a row can still overflow 32 * bits; this is just to verify that the 'row_stride' argument can be * represented. */ if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth <= uint32(0x7fffffff)/channels { /* no overflow */ png_row_stride = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth * channels if row_stride == 0 { row_stride = libc.Int32FromUint32(png_row_stride) } if row_stride < 0 { check = libc.Uint32FromInt32(-row_stride) } else { check = libc.Uint32FromInt32(row_stride) } /* This verifies 'check', the absolute value of the actual stride * passed in and detects overflow in the application calculation (i.e. * if the app did actually pass in a non-zero 'row_stride'. */ if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque != libc.UintptrFromInt32(0) && buffer != libc.UintptrFromInt32(0) && check >= png_row_stride { /* Now check for overflow of the image buffer calculation; this * limits the whole image size to 32 bits for API compatibility with * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro. * * The PNG_IMAGE_BUFFER_SIZE macro is: * * (PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)*height*(row_stride)) * * And the component size is always 1 or 2, so make sure that the * number of *bytes* that the application is saying are available * does actually fit into a 32-bit number. * * NOTE: this will be changed in 1.7 because PNG_IMAGE_BUFFER_SIZE * will be changed to use png_alloc_size_t; bigger images can be * accommodated on 64-bit systems. */ if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x08) != 0 { v2 = uint32(1) } else { v2 = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x04)>>int32(2) + uint32(1) } if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight <= uint32(0xffffffff)/v2/check { if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x08) == uint32(0) || (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries > uint32(0) && colormap != libc.UintptrFromInt32(0) { libc.Xmemset(tls, bp, 0, libc.Uint32FromInt64(44)) (*(*Tpng_image_read_control)(unsafe.Pointer(bp))).Fimage = image (*(*Tpng_image_read_control)(unsafe.Pointer(bp))).Fbuffer = buffer (*(*Tpng_image_read_control)(unsafe.Pointer(bp))).Frow_stride = row_stride (*(*Tpng_image_read_control)(unsafe.Pointer(bp))).Fcolormap = colormap (*(*Tpng_image_read_control)(unsafe.Pointer(bp))).Fbackground = background (*(*Tpng_image_read_control)(unsafe.Pointer(bp))).Flocal_row = libc.UintptrFromInt32(0) /* Choose the correct 'end' routine; for the color-map case * all the setup has already been done. */ if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x08) != uint32(0) { result = libc.BoolInt32(Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_read_colormap), bp) != 0 && Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_read_colormapped), bp) != 0) } else { result = Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_read_direct), bp) } Xpng_image_free(tls, image) return result } else { return Xpng_image_error(tls, image, __ccgo_ts+14698) } } else { return Xpng_image_error(tls, image, __ccgo_ts+14745) } } else { return Xpng_image_error(tls, image, __ccgo_ts+14784) } } else { return Xpng_image_error(tls, image, __ccgo_ts+14824) } } else { if image != libc.UintptrFromInt32(0) { return Xpng_image_error(tls, image, __ccgo_ts+14868) } } return 0 } const PNG_ADD_ALPHA2 = 0x1000000 const PNG_AFTER_IDAT2 = 0x08 const PNG_BGR2 = 0x0001 const PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB4 = 0x0040 const PNG_COLORSPACE_HAVE_ENDPOINTS6 = 0x0002 const PNG_COLORSPACE_HAVE_GAMMA6 = 0x0001 const PNG_COLORSPACE_INVALID4 = 0x8000 const PNG_COMPOSE4 = 0x0080 const PNG_FLAG_APP_WARNINGS_WARN4 = 0x200000 const PNG_FLAG_BENIGN_ERRORS_WARN4 = 0x100000 const PNG_FLAG_FILLER_AFTER2 = 0x0080 const PNG_FLAG_MNG_FILTER_644 = 0x04 const PNG_FLAG_ROW_INIT2 = 0x0040 const PNG_FLAG_ZSTREAM_ENDED2 = 0x0008 const PNG_FORMAT_FLAG_AFIRST2 = 0x20 const PNG_FORMAT_FLAG_ALPHA2 = 0x01 const PNG_FORMAT_FLAG_ASSOCIATED_ALPHA2 = 0x40 const PNG_FORMAT_FLAG_BGR2 = 0x10 const PNG_FORMAT_FLAG_COLOR2 = 0x02 const PNG_FORMAT_FLAG_COLORMAP2 = 0x08 const PNG_FORMAT_FLAG_LINEAR2 = 0x04 const PNG_FREE_PLTE4 = 0x1000 const PNG_FREE_ROWS4 = 0x0040 const PNG_FREE_TRNS4 = 0x2000 const PNG_HAVE_CHUNK_AFTER_IDAT2 = 0x2000 const PNG_HAVE_IDAT2 = 0x04 const PNG_HAVE_IEND2 = 0x10 const PNG_HAVE_IHDR2 = 0x01 const PNG_HAVE_PLTE2 = 0x02 const PNG_IMAGE_FLAG_16BIT_sRGB2 = 0x04 const PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB2 = 0x01 const PNG_INFO_IDAT4 = 0x8000 const PNG_INFO_sBIT4 = 0x0002 const PNG_INTERLACE2 = 0x0002 const PNG_IS_READ_STRUCT6 = 0x8000 const PNG_RGB_TO_GRAY4 = 0x600000 const PNG_SWAP_ALPHA2 = 0x20000 const PNG_TRANSFORM_BGR2 = 0x0080 const PNG_TRANSFORM_EXPAND2 = 0x0010 const PNG_TRANSFORM_EXPAND_162 = 0x4000 const PNG_TRANSFORM_GRAY_TO_RGB2 = 0x2000 const PNG_TRANSFORM_INVERT_ALPHA2 = 0x0400 const PNG_TRANSFORM_INVERT_MONO2 = 0x0020 const PNG_TRANSFORM_PACKING2 = 0x0004 const PNG_TRANSFORM_PACKSWAP2 = 0x0008 const PNG_TRANSFORM_SCALE_162 = 0x8000 const PNG_TRANSFORM_SHIFT2 = 0x0040 const PNG_TRANSFORM_STRIP_162 = 0x0001 const PNG_TRANSFORM_STRIP_ALPHA2 = 0x0002 const PNG_TRANSFORM_SWAP_ALPHA2 = 0x0100 const PNG_TRANSFORM_SWAP_ENDIAN2 = 0x0200 /* Maintainer: Put new private prototypes here ^ */ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. * * png_debug[1-2]?(level, message ,arg{0-2}) * Expands to a statement (either a simple expression or a compound * do..while(0) statement) that outputs a message with parameter * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG * is undefined, 0 or 1 every png_debug expands to a simple expression * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added * to the message. * arg: 0 to 2 arguments for printf(3) style substitution in message. */ /* These settings control the formatting of messages in png.c and pngerror.c */ /* Moved to pngdebug.h at 1.5.0 */ // C documentation // // /* Read the data from whatever input you are using. The default routine // * reads from a file pointer. Note that this routine sometimes gets called // * with very small lengths, so you should implement some kind of simple // * buffering if you are using unbuffered reads. This should never be asked // * to read more than 64K on a 16-bit machine. // */ func Xpng_read_data(tls *libc.TLS, png_ptr Tpng_structrp, data Tpng_bytep, length Tsize_t) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_data_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_bytep, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_data_fn})))(tls, png_ptr, data, length) } else { Xpng_error(tls, png_ptr, __ccgo_ts+14917) } } // C documentation // // /* This is the function that does the actual reading of data. If you are // * not reading from a standard C stream, you should create a replacement // * read_data function and use it at run time with png_set_read_fn(), rather // * than changing the library. // */ func Xpng_default_read_data(tls *libc.TLS, png_ptr Tpng_structp, data Tpng_bytep, length Tsize_t) { var check Tsize_t _ = check if png_ptr == libc.UintptrFromInt32(0) { return } /* fread() returns 0 on error, so it is OK to store this in a size_t * instead of an int, which is what fread() actually returns. */ check = libc.Xfread(tls, data, uint32(1), length, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_ptr) if check != length { Xpng_error(tls, png_ptr, __ccgo_ts+14944) } } // C documentation // // /* This function allows the application to supply a new input function // * for libpng if standard C streams aren't being used. // * // * This function takes as its arguments: // * // * png_ptr - pointer to a png input data structure // * // * io_ptr - pointer to user supplied structure containing info about // * the input functions. May be NULL. // * // * read_data_fn - pointer to a new input function that takes as its // * arguments a pointer to a png_struct, a pointer to // * a location where input data can be stored, and a 32-bit // * unsigned int that is the number of bytes to be read. // * To exit and output any fatal error messages the new write // * function should call png_error(png_ptr, "Error msg"). // * May be NULL, in which case libpng's default function will // * be used. // */ func Xpng_set_read_fn(tls *libc.TLS, png_ptr Tpng_structrp, io_ptr Tpng_voidp, read_data_fn Tpng_rw_ptr) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_ptr = io_ptr if read_data_fn != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_data_fn = read_data_fn } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_data_fn = __ccgo_fp(Xpng_default_read_data) } /* It is an error to write to a read device */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_data_fn != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_data_fn = libc.UintptrFromInt32(0) Xpng_warning(tls, png_ptr, __ccgo_ts+14955) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Foutput_flush_fn = libc.UintptrFromInt32(0) } const PNG_16_TO_83 = 1024 const PNG_ADD_ALPHA3 = 16777216 const PNG_BACKGROUND_EXPAND1 = 256 const PNG_BACKGROUND_IS_GRAY1 = 2048 const PNG_BGR3 = 1 const PNG_COLORSPACE_HAVE_GAMMA7 = 1 const PNG_COMPOSE5 = 128 const PNG_ENCODE_ALPHA1 = 8388608 const PNG_EXPAND1 = 4096 const PNG_EXPAND_161 = 512 const PNG_EXPAND_tRNS1 = 33554432 const PNG_FILLER1 = 32768 const PNG_FLAG_ASSUME_sRGB1 = 4096 const PNG_FLAG_CRC_ANCILLARY_NOWARN3 = 512 const PNG_FLAG_CRC_ANCILLARY_USE3 = 256 const PNG_FLAG_CRC_CRITICAL_IGNORE3 = 2048 const PNG_FLAG_CRC_CRITICAL_USE1 = 1024 const PNG_FLAG_DETECT_UNINITIALIZED1 = 16384 const PNG_FLAG_FILLER_AFTER3 = 128 const PNG_FLAG_OPTIMIZE_ALPHA1 = 8192 const PNG_FLAG_ROW_INIT3 = 64 const PNG_GAMMA1 = 8192 const PNG_GRAY_TO_RGB1 = 16384 const PNG_HAVE_IHDR3 = 1 const PNG_INVERT_ALPHA1 = 524288 const PNG_INVERT_MONO1 = 32 const PNG_PACK1 = 4 const PNG_PACKSWAP1 = 65536 const PNG_QUANTIZE1 = 64 const PNG_RGB_TO_GRAY5 = 6291456 const PNG_RGB_TO_GRAY_ERR1 = 2097152 const PNG_RGB_TO_GRAY_WARN1 = 4194304 const PNG_SCALE_16_TO_83 = 67108864 const PNG_SHIFT1 = 8 const PNG_STRIP_ALPHA1 = 262144 const PNG_SWAP_ALPHA3 = 131072 const PNG_SWAP_BYTES1 = 16 const PNG_USER_TRANSFORM1 = 1048576 /* Maintainer: Put new private prototypes here ^ */ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. * * png_debug[1-2]?(level, message ,arg{0-2}) * Expands to a statement (either a simple expression or a compound * do..while(0) statement) that outputs a message with parameter * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG * is undefined, 0 or 1 every png_debug expands to a simple expression * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added * to the message. * arg: 0 to 2 arguments for printf(3) style substitution in message. */ /* These settings control the formatting of messages in png.c and pngerror.c */ /* Moved to pngdebug.h at 1.5.0 */ // C documentation // // /* Set the action on getting a CRC error for an ancillary or critical chunk. */ func Xpng_set_crc_action(tls *libc.TLS, png_ptr Tpng_structrp, crit_action int32, ancil_action int32) { if png_ptr == libc.UintptrFromInt32(0) { return } /* Tell libpng how we react to CRC errors in critical chunks */ switch crit_action { case int32(PNG_CRC_NO_CHANGE): /* Leave setting as is */ case int32(PNG_CRC_WARN_USE): /* Warn/use data */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^(libc.Uint32FromUint32(0x0400) | libc.Uint32FromUint32(0x0800)) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0400) case int32(PNG_CRC_QUIET_USE): /* Quiet/use data */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^(libc.Uint32FromUint32(0x0400) | libc.Uint32FromUint32(0x0800)) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= libc.Uint32FromUint32(0x0400) | libc.Uint32FromUint32(0x0800) case int32(PNG_CRC_WARN_DISCARD): /* Not a valid action for critical data */ Xpng_warning(tls, png_ptr, __ccgo_ts+15023) /* FALLTHROUGH */ fallthrough case int32(PNG_CRC_ERROR_QUIT): /* Error/quit */ fallthrough case PNG_CRC_DEFAULT: fallthrough default: *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^(libc.Uint32FromUint32(0x0400) | libc.Uint32FromUint32(0x0800)) break } /* Tell libpng how we react to CRC errors in ancillary chunks */ switch ancil_action { case int32(PNG_CRC_NO_CHANGE): /* Leave setting as is */ case int32(PNG_CRC_WARN_USE): /* Warn/use data */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^(libc.Uint32FromUint32(0x0100) | libc.Uint32FromUint32(0x0200)) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0100) case int32(PNG_CRC_QUIET_USE): /* Quiet/use data */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^(libc.Uint32FromUint32(0x0100) | libc.Uint32FromUint32(0x0200)) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= libc.Uint32FromUint32(0x0100) | libc.Uint32FromUint32(0x0200) case int32(PNG_CRC_ERROR_QUIT): /* Error/quit */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^(libc.Uint32FromUint32(0x0100) | libc.Uint32FromUint32(0x0200)) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0200) case int32(PNG_CRC_WARN_DISCARD): /* Warn/discard data */ fallthrough case PNG_CRC_DEFAULT: fallthrough default: *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^(libc.Uint32FromUint32(0x0100) | libc.Uint32FromUint32(0x0200)) break } } // C documentation // // /* Is it OK to set a transformation now? Only if png_start_read_image or // * png_read_update_info have not been called. It is not necessary for the IHDR // * to have been read in all cases; the need_IHDR parameter allows for this // * check too. // */ func _png_rtran_ok(tls *libc.TLS, png_ptr Tpng_structrp, need_IHDR int32) (r int32) { if png_ptr != libc.UintptrFromInt32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0040) != uint32(0) { Xpng_app_error(tls, png_ptr, __ccgo_ts+15064) } else { if need_IHDR != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_app_error(tls, png_ptr, __ccgo_ts+15123) } else { /* Turn on failure to initialize correctly for all transforms. */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x4000) return int32(1) /* Ok */ } } } return 0 /* no png_error possible! */ } // C documentation // // /* Handle alpha and tRNS via a background color */ func Xpng_set_background_fixed(tls *libc.TLS, png_ptr Tpng_structrp, background_color Tpng_const_color_16p, background_gamma_code int32, need_expand int32, background_gamma Tpng_fixed_point) { if _png_rtran_ok(tls, png_ptr, 0) == 0 || background_color == libc.UintptrFromInt32(0) { return } if background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN { Xpng_warning(tls, png_ptr, __ccgo_ts+15167) return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= libc.Uint32FromUint32(0x0080) | libc.Uint32FromUint32(0x40000) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x800000) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^libc.Uint32FromUint32(0x2000) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground = *(*Tpng_color_16)(unsafe.Pointer(background_color)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma = background_gamma (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma_type = libc.Uint8FromInt32(background_gamma_code) if need_expand != 0 { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x0100) } else { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x0100) } } func Xpng_set_background(tls *libc.TLS, png_ptr Tpng_structrp, background_color Tpng_const_color_16p, background_gamma_code int32, need_expand int32, background_gamma float64) { Xpng_set_background_fixed(tls, png_ptr, background_color, background_gamma_code, need_expand, Xpng_fixed(tls, png_ptr, background_gamma, __ccgo_ts+15216)) } // C documentation // // /* Scale 16-bit depth files to 8-bit depth. If both of these are set then the // * one that pngrtran does first (scale) happens. This is necessary to allow the // * TRANSFORM and API behavior to be somewhat consistent, and it's simpler. // */ func Xpng_set_scale_16(tls *libc.TLS, png_ptr Tpng_structrp) { if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x4000000) } // C documentation // // /* Chop 16-bit depth files to 8-bit depth */ func Xpng_set_strip_16(tls *libc.TLS, png_ptr Tpng_structrp) { if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x0400) } func Xpng_set_strip_alpha(tls *libc.TLS, png_ptr Tpng_structrp) { if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x40000) } func _translate_gamma_flags(tls *libc.TLS, png_ptr Tpng_structrp, output_gamma Tpng_fixed_point, is_screen int32) (r Tpng_fixed_point) { /* Check for flag values. The main reason for having the old Mac value as a * flag is that it is pretty near impossible to work out what the correct * value is from Apple documentation - a working Mac system is needed to * discover the value! */ if output_gamma == -int32(1) || output_gamma == libc.Int32FromInt32(PNG_FP_1)/-libc.Int32FromInt32(1) { /* If there is no sRGB support this just sets the gamma to the standard * sRGB value. (This is a side effect of using this function!) */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x1000) if is_screen != 0 { output_gamma = int32(PNG_GAMMA_sRGB) } else { output_gamma = int32(PNG_GAMMA_sRGB_INVERSE) } } else { if output_gamma == -int32(2) || output_gamma == libc.Int32FromInt32(PNG_FP_1)/-libc.Int32FromInt32(2) { if is_screen != 0 { output_gamma = int32(PNG_GAMMA_MAC_OLD) } else { output_gamma = int32(PNG_GAMMA_MAC_INVERSE) } } } return output_gamma } func _convert_gamma_value(tls *libc.TLS, png_ptr Tpng_structrp, output_gamma float64) (r Tpng_fixed_point) { /* The following silently ignores cases where fixed point (times 100,000) * gamma values are passed to the floating point API. This is safe and it * means the fixed point constants work just fine with the floating point * API. The alternative would just lead to undetected errors and spurious * bug reports. Negative values fail inside the _fixed API unless they * correspond to the flag values. */ if output_gamma > libc.Float64FromInt32(0) && output_gamma < libc.Float64FromInt32(128) { output_gamma *= libc.Float64FromInt32(PNG_FP_1) } /* This preserves -1 and -2 exactly: */ output_gamma = libc.Xfloor(tls, output_gamma+float64(0.5)) if output_gamma > float64(libc.Int32FromInt32(0x7fffffff)) || output_gamma < float64(-libc.Int32FromInt32(0x7fffffff)) { Xpng_fixed_error(tls, png_ptr, __ccgo_ts+15235) } return int32(output_gamma) } func Xpng_set_alpha_mode_fixed(tls *libc.TLS, png_ptr Tpng_structrp, mode int32, output_gamma Tpng_fixed_point) { var compose int32 var file_gamma Tpng_fixed_point var p1 uintptr _, _, _ = compose, file_gamma, p1 compose = 0 if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } output_gamma = _translate_gamma_flags(tls, png_ptr, output_gamma, int32(1)) /* Validate the value to ensure it is in a reasonable range. The value * is expected to be 1 or greater, but this range test allows for some * viewing correction values. The intent is to weed out the API users * who might use the inverse of the gamma value accidentally! * * In libpng 1.6.0, we changed from 0.07..3 to 0.01..100, to accommodate * the optimal 16-bit gamma of 36 and its reciprocal. */ if output_gamma < int32(1000) || output_gamma > int32(10000000) { Xpng_error(tls, png_ptr, __ccgo_ts+15247) } /* The default file gamma is the inverse of the output gamma; the output * gamma may be changed below so get the file value first: */ file_gamma = Xpng_reciprocal(tls, output_gamma) /* There are really 8 possibilities here, composed of any combination * of: * * premultiply the color channels * do not encode non-opaque pixels * encode the alpha as well as the color channels * * The differences disappear if the input/output ('screen') gamma is 1.0, * because then the encoding is a no-op and there is only the choice of * premultiplying the color channels or not. * * png_set_alpha_mode and png_set_background interact because both use * png_compose to do the work. Calling both is only useful when * png_set_alpha_mode is used to set the default mode - PNG_ALPHA_PNG - along * with a default gamma value. Otherwise PNG_COMPOSE must not be set. */ switch mode { case PNG_ALPHA_PNG: /* default: png standard */ /* No compose, but it may be set by png_set_background! */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x800000) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^libc.Uint32FromUint32(0x2000) case int32(PNG_ALPHA_ASSOCIATED): /* color channels premultiplied */ compose = int32(1) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x800000) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^libc.Uint32FromUint32(0x2000) /* The output is linear: */ output_gamma = int32(PNG_FP_1) case int32(PNG_ALPHA_OPTIMIZED): /* associated, non-opaque pixels linear */ compose = int32(1) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x800000) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x2000) /* output_gamma records the encoding of opaque pixels! */ case int32(PNG_ALPHA_BROKEN): /* associated, non-linear, alpha encoded */ compose = int32(1) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x800000) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^libc.Uint32FromUint32(0x2000) default: Xpng_error(tls, png_ptr, __ccgo_ts+15282) } /* Only set the default gamma if the file gamma has not been set (this has * the side effect that the gamma in a second call to png_set_alpha_mode will * be ignored.) */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma == 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma = file_gamma p1 = png_ptr + 1040 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLORSPACE_HAVE_GAMMA7)) } /* But always set the output gamma: */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma = output_gamma /* Finally, if pre-multiplying, set the background fields to achieve the * desired result. */ if compose != 0 { /* And obtain alpha pre-multiplication by composing on black: */ libc.Xmemset(tls, png_ptr+684, 0, libc.Uint32FromInt64(10)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma /* just in case */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma_type = uint8(PNG_BACKGROUND_GAMMA_FILE) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x0100) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+15301) } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x0080) } } func Xpng_set_alpha_mode(tls *libc.TLS, png_ptr Tpng_structrp, mode int32, output_gamma float64) { Xpng_set_alpha_mode_fixed(tls, png_ptr, mode, _convert_gamma_value(tls, png_ptr, output_gamma)) } /* Dither file to 8-bit. Supply a palette, the current number * of elements in the palette, the maximum number of elements * allowed, and a histogram if possible. If the current number * of colors is greater than the maximum number, the palette will be * modified to fit in the maximum number. "full_quantize" indicates * whether we need a quantizing cube set up for RGB images, or if we * simply are reducing the number of colors in a paletted image. */ type Tpng_dsort = struct { Fnext uintptr Fleft Tpng_byte Fright Tpng_byte } /* Dither file to 8-bit. Supply a palette, the current number * of elements in the palette, the maximum number of elements * allowed, and a histogram if possible. If the current number * of colors is greater than the maximum number, the palette will be * modified to fit in the maximum number. "full_quantize" indicates * whether we need a quantizing cube set up for RGB images, or if we * simply are reducing the number of colors in a paletted image. */ type Tpng_dsort_struct = Tpng_dsort type Tpng_dsortp = uintptr type Tpng_dsortpp = uintptr func Xpng_set_quantize(tls *libc.TLS, png_ptr Tpng_structrp, palette Tpng_colorp, num_palette int32, maximum_colors int32, histogram Tpng_const_uint_16p, full_quantize int32) { var b, d, d1, d2, d_index, d_index1, db, dg, dm, dmax, done, dr, dt, g, i, i1, i2, i3, ib, ig, index_g, index_r, ir, j, j1, j2, j3, j4, k, k1, max_d, min_d, min_k, next_j, num_blue, num_green, num_new_palette, num_red, r, total_bits, v18, v20, v21, v23, v24 int32 var distance Tpng_bytep var hash Tpng_dsortpp var num_entries Tsize_t var p, p1, t1 Tpng_dsortp var t Tpng_byte var tmp_color Tpng_color _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, d, d1, d2, d_index, d_index1, db, dg, distance, dm, dmax, done, dr, dt, g, hash, i, i1, i2, i3, ib, ig, index_g, index_r, ir, j, j1, j2, j3, j4, k, k1, max_d, min_d, min_k, next_j, num_blue, num_entries, num_green, num_new_palette, num_red, p, p1, r, t, t1, tmp_color, total_bits, v18, v20, v21, v23, v24 if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x0040) if full_quantize == 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index = Xpng_malloc(tls, png_ptr, libc.Uint32FromInt32(num_palette)) i = 0 for { if !(i < num_palette) { break } *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index + uintptr(i))) = libc.Uint8FromInt32(i) goto _1 _1: ; i++ } } if num_palette > maximum_colors { if histogram != libc.UintptrFromInt32(0) { /* Initialize an array to sort colors */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort = Xpng_malloc(tls, png_ptr, libc.Uint32FromInt32(num_palette)) /* Initialize the quantize_sort array */ i1 = 0 for { if !(i1 < num_palette) { break } *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(i1))) = libc.Uint8FromInt32(i1) goto _2 _2: ; i1++ } /* Find the least used palette entries by starting a * bubble sort, and running it until we have sorted * out enough colors. Note that we don't care about * sorting all the colors, just finding which are * least used. */ i1 = num_palette - int32(1) for { if !(i1 >= maximum_colors) { break } done = int32(1) j = 0 for { if !(j < i1) { break } if libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(histogram + uintptr(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(j))))*2))) < libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(histogram + uintptr(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(j+int32(1)))))*2))) { t = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(j))) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(j))) = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(j+int32(1)))) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(j+int32(1)))) = t done = 0 } goto _4 _4: ; j++ } if done != 0 { break } goto _3 _3: ; i1-- } /* Swap the palette around, and set up a table, if necessary */ if full_quantize != 0 { j1 = num_palette /* Put all the useful colors within the max, but don't * move the others. */ i1 = 0 for { if !(i1 < maximum_colors) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(i1)))) >= maximum_colors { for cond := true; cond; cond = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(j1)))) >= maximum_colors { j1-- } *(*Tpng_color)(unsafe.Pointer(palette + uintptr(i1)*3)) = *(*Tpng_color)(unsafe.Pointer(palette + uintptr(j1)*3)) } goto _5 _5: ; i1++ } } else { j2 = num_palette /* Move all the used colors inside the max limit, and * develop a translation table. */ i1 = 0 for { if !(i1 < maximum_colors) { break } /* Only move the colors we need to */ if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(i1)))) >= maximum_colors { for cond := true; cond; cond = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort + uintptr(j2)))) >= maximum_colors { j2-- } tmp_color = *(*Tpng_color)(unsafe.Pointer(palette + uintptr(j2)*3)) *(*Tpng_color)(unsafe.Pointer(palette + uintptr(j2)*3)) = *(*Tpng_color)(unsafe.Pointer(palette + uintptr(i1)*3)) *(*Tpng_color)(unsafe.Pointer(palette + uintptr(i1)*3)) = tmp_color /* Indicate where the color went */ *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index + uintptr(j2))) = libc.Uint8FromInt32(i1) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index + uintptr(i1))) = libc.Uint8FromInt32(j2) } goto _6 _6: ; i1++ } /* Find closest color for those colors we are not using */ i1 = 0 for { if !(i1 < num_palette) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index + uintptr(i1)))) >= maximum_colors { /* Find the closest color to one we threw out */ d_index = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index + uintptr(i1)))) min_d = libc.Xabs(tls, libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(d_index)*3))).Fred)-libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette))).Fred)) + libc.Xabs(tls, libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(d_index)*3))).Fgreen)-libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette))).Fgreen)) + libc.Xabs(tls, libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(d_index)*3))).Fblue)-libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette))).Fblue)) k = int32(1) min_k = libc.Int32FromInt32(0) for { if !(k < maximum_colors) { break } d = libc.Xabs(tls, libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(d_index)*3))).Fred)-libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(k)*3))).Fred)) + libc.Xabs(tls, libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(d_index)*3))).Fgreen)-libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(k)*3))).Fgreen)) + libc.Xabs(tls, libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(d_index)*3))).Fblue)-libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(k)*3))).Fblue)) if d < min_d { min_d = d min_k = k } goto _8 _8: ; k++ } /* Point to closest color */ *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index + uintptr(i1))) = libc.Uint8FromInt32(min_k) } goto _7 _7: ; i1++ } } Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_sort = libc.UintptrFromInt32(0) } else { t1 = libc.UintptrFromInt32(0) /* Initialize palette index arrays */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette = Xpng_malloc(tls, png_ptr, libc.Uint32FromInt32(num_palette)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_to_index = Xpng_malloc(tls, png_ptr, libc.Uint32FromInt32(num_palette)) /* Initialize the sort array */ i2 = 0 for { if !(i2 < num_palette) { break } *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr(i2))) = libc.Uint8FromInt32(i2) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_to_index + uintptr(i2))) = libc.Uint8FromInt32(i2) goto _9 _9: ; i2++ } hash = Xpng_calloc(tls, png_ptr, libc.Uint32FromInt32(769)*libc.Uint32FromInt64(4)) num_new_palette = num_palette /* Initial wild guess at how far apart the farthest pixel * pair we will be eliminating will be. Larger * numbers mean more areas will be allocated, Smaller * numbers run the risk of not saving enough data, and * having to do this all over again. * * I have not done extensive checking on this number. */ max_d = int32(96) for num_new_palette > maximum_colors { i2 = 0 for { if !(i2 < num_new_palette-int32(1)) { break } j3 = i2 + int32(1) for { if !(j3 < num_new_palette) { break } d1 = libc.Xabs(tls, libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i2)*3))).Fred)-libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(j3)*3))).Fred)) + libc.Xabs(tls, libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i2)*3))).Fgreen)-libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(j3)*3))).Fgreen)) + libc.Xabs(tls, libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i2)*3))).Fblue)-libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(j3)*3))).Fblue)) if d1 <= max_d { t1 = Xpng_malloc_warn(tls, png_ptr, libc.Uint32FromInt64(8)) if t1 == libc.UintptrFromInt32(0) { break } (*Tpng_dsort)(unsafe.Pointer(t1)).Fnext = *(*uintptr)(unsafe.Pointer(hash + uintptr(d1)*4)) (*Tpng_dsort)(unsafe.Pointer(t1)).Fleft = libc.Uint8FromInt32(i2) (*Tpng_dsort)(unsafe.Pointer(t1)).Fright = libc.Uint8FromInt32(j3) *(*uintptr)(unsafe.Pointer(hash + uintptr(d1)*4)) = t1 } goto _11 _11: ; j3++ } if t1 == libc.UintptrFromInt32(0) { break } goto _10 _10: ; i2++ } if t1 != libc.UintptrFromInt32(0) { i2 = 0 for { if !(i2 <= max_d) { break } if *(*uintptr)(unsafe.Pointer(hash + uintptr(i2)*4)) != libc.UintptrFromInt32(0) { p = *(*uintptr)(unsafe.Pointer(hash + uintptr(i2)*4)) for { if !(p != 0) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr((*Tpng_dsort)(unsafe.Pointer(p)).Fleft)))) < num_new_palette && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr((*Tpng_dsort)(unsafe.Pointer(p)).Fright)))) < num_new_palette { if num_new_palette&int32(0x01) != 0 { j4 = libc.Int32FromUint8((*Tpng_dsort)(unsafe.Pointer(p)).Fleft) next_j = libc.Int32FromUint8((*Tpng_dsort)(unsafe.Pointer(p)).Fright) } else { j4 = libc.Int32FromUint8((*Tpng_dsort)(unsafe.Pointer(p)).Fright) next_j = libc.Int32FromUint8((*Tpng_dsort)(unsafe.Pointer(p)).Fleft) } num_new_palette-- *(*Tpng_color)(unsafe.Pointer(palette + uintptr(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr(j4))))*3)) = *(*Tpng_color)(unsafe.Pointer(palette + uintptr(num_new_palette)*3)) if full_quantize == 0 { k1 = 0 for { if !(k1 < num_palette) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index + uintptr(k1)))) == libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr(j4)))) { *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index + uintptr(k1))) = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr(next_j))) } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index + uintptr(k1)))) == num_new_palette { *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index + uintptr(k1))) = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr(j4))) } goto _14 _14: ; k1++ } } *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_to_index + uintptr(num_new_palette)))))) = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr(j4))) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_to_index + uintptr(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr(j4)))))) = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_to_index + uintptr(num_new_palette))) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette + uintptr(j4))) = libc.Uint8FromInt32(num_new_palette) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_to_index + uintptr(num_new_palette))) = libc.Uint8FromInt32(j4) } if num_new_palette <= maximum_colors { break } goto _13 _13: ; p = (*Tpng_dsort)(unsafe.Pointer(p)).Fnext } if num_new_palette <= maximum_colors { break } } goto _12 _12: ; i2++ } } i2 = 0 for { if !(i2 < int32(769)) { break } if *(*uintptr)(unsafe.Pointer(hash + uintptr(i2)*4)) != libc.UintptrFromInt32(0) { p1 = *(*uintptr)(unsafe.Pointer(hash + uintptr(i2)*4)) for p1 != 0 { t1 = (*Tpng_dsort)(unsafe.Pointer(p1)).Fnext Xpng_free(tls, png_ptr, p1) p1 = t1 } } *(*uintptr)(unsafe.Pointer(hash + uintptr(i2)*4)) = uintptr(0) goto _15 _15: ; i2++ } max_d += int32(96) } Xpng_free(tls, png_ptr, hash) Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_to_index) Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_to_index = libc.UintptrFromInt32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Findex_to_palette = libc.UintptrFromInt32(0) } num_palette = maximum_colors } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette == libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette = palette } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette = libc.Uint16FromInt32(num_palette) if full_quantize != 0 { total_bits = libc.Int32FromInt32(PNG_QUANTIZE_RED_BITS) + libc.Int32FromInt32(PNG_QUANTIZE_GREEN_BITS) + libc.Int32FromInt32(PNG_QUANTIZE_BLUE_BITS) num_red = libc.Int32FromInt32(1) << libc.Int32FromInt32(PNG_QUANTIZE_RED_BITS) num_green = libc.Int32FromInt32(1) << libc.Int32FromInt32(PNG_QUANTIZE_GREEN_BITS) num_blue = libc.Int32FromInt32(1) << libc.Int32FromInt32(PNG_QUANTIZE_BLUE_BITS) num_entries = libc.Uint32FromInt32(1) << total_bits (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_lookup = Xpng_calloc(tls, png_ptr, num_entries) distance = Xpng_malloc(tls, png_ptr, num_entries) libc.Xmemset(tls, distance, int32(0xff), num_entries) i3 = 0 for { if !(i3 < num_palette) { break } r = libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i3)*3))).Fred) >> (libc.Int32FromInt32(8) - libc.Int32FromInt32(PNG_QUANTIZE_RED_BITS)) g = libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i3)*3))).Fgreen) >> (libc.Int32FromInt32(8) - libc.Int32FromInt32(PNG_QUANTIZE_GREEN_BITS)) b = libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i3)*3))).Fblue) >> (libc.Int32FromInt32(8) - libc.Int32FromInt32(PNG_QUANTIZE_BLUE_BITS)) ir = 0 for { if !(ir < num_red) { break } if ir > r { v18 = ir - r } else { v18 = r - ir } /* int dr = abs(ir - r); */ dr = v18 index_r = ir << (libc.Int32FromInt32(PNG_QUANTIZE_BLUE_BITS) + libc.Int32FromInt32(PNG_QUANTIZE_GREEN_BITS)) ig = 0 for { if !(ig < num_green) { break } if ig > g { v20 = ig - g } else { v20 = g - ig } /* int dg = abs(ig - g); */ dg = v20 dt = dr + dg if dr > dg { v21 = dr } else { v21 = dg } dm = v21 index_g = index_r | ig< b { v23 = ib - b } else { v23 = b - ib } /* int db = abs(ib - b); */ db = v23 if dm > db { v24 = dm } else { v24 = db } dmax = v24 d2 = dmax + dt + db if d2 < libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(distance + uintptr(d_index1)))) { *(*Tpng_byte)(unsafe.Pointer(distance + uintptr(d_index1))) = libc.Uint8FromInt32(d2) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_lookup + uintptr(d_index1))) = libc.Uint8FromInt32(i3) } goto _22 _22: ; ib++ } goto _19 _19: ; ig++ } goto _17 _17: ; ir++ } goto _16 _16: ; i3++ } Xpng_free(tls, png_ptr, distance) } } func Xpng_set_gamma_fixed(tls *libc.TLS, png_ptr Tpng_structrp, scrn_gamma Tpng_fixed_point, file_gamma Tpng_fixed_point) { var p1 uintptr _ = p1 if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } /* New in libpng-1.5.4 - reserve particular negative values as flags. */ scrn_gamma = _translate_gamma_flags(tls, png_ptr, scrn_gamma, int32(1)) file_gamma = _translate_gamma_flags(tls, png_ptr, file_gamma, 0) /* Checking the gamma values for being >0 was added in 1.5.4 along with the * premultiplied alpha support; this actually hides an undocumented feature * of the previous implementation which allowed gamma processing to be * disabled in background handling. There is no evidence (so far) that this * was being used; however, png_set_background itself accepted and must still * accept '0' for the gamma value it takes, because it isn't always used. * * Since this is an API change (albeit a very minor one that removes an * undocumented API feature) the following checks were only enabled in * libpng-1.6.0. */ if file_gamma <= 0 { Xpng_error(tls, png_ptr, __ccgo_ts+15352) } if scrn_gamma <= 0 { Xpng_error(tls, png_ptr, __ccgo_ts+15388) } /* Set the gamma values unconditionally - this overrides the value in the PNG * file if a gAMA chunk was present. png_set_alpha_mode provides a * different, easier, way to default the file gamma. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma = file_gamma p1 = png_ptr + 1040 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLORSPACE_HAVE_GAMMA7)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma = scrn_gamma } func Xpng_set_gamma(tls *libc.TLS, png_ptr Tpng_structrp, scrn_gamma float64, file_gamma float64) { Xpng_set_gamma_fixed(tls, png_ptr, _convert_gamma_value(tls, png_ptr, scrn_gamma), _convert_gamma_value(tls, png_ptr, file_gamma)) } // C documentation // // /* Expand paletted images to RGB, expand grayscale images of // * less than 8-bit depth to 8-bit depth, and expand tRNS chunks // * to alpha channels. // */ func Xpng_set_expand(tls *libc.TLS, png_ptr Tpng_structrp) { if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= libc.Uint32FromUint32(0x1000) | libc.Uint32FromUint32(0x2000000) } /* GRR 19990627: the following three functions currently are identical * to png_set_expand(). However, it is entirely reasonable that someone * might wish to expand an indexed image to RGB but *not* expand a single, * fully transparent palette entry to a full alpha channel--perhaps instead * convert tRNS to the grayscale/RGB format (16-bit RGB value), or replace * the transparent color with a particular RGB value, or drop tRNS entirely. * IOW, a future version of the library may make the transformations flag * a bit more fine-grained, with separate bits for each of these three * functions. * * More to the point, these functions make it obvious what libpng will be * doing, whereas "expand" can (and does) mean any number of things. * * GRP 20060307: In libpng-1.2.9, png_set_gray_1_2_4_to_8() was modified * to expand only the sample depth but not to expand the tRNS to alpha * and its name was changed to png_set_expand_gray_1_2_4_to_8(). */ // C documentation // // /* Expand paletted images to RGB. */ func Xpng_set_palette_to_rgb(tls *libc.TLS, png_ptr Tpng_structrp) { if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= libc.Uint32FromUint32(0x1000) | libc.Uint32FromUint32(0x2000000) } // C documentation // // /* Expand grayscale images of less than 8-bit depth to 8 bits. */ func Xpng_set_expand_gray_1_2_4_to_8(tls *libc.TLS, png_ptr Tpng_structrp) { if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x1000) } // C documentation // // /* Expand tRNS chunks to alpha channels. */ func Xpng_set_tRNS_to_alpha(tls *libc.TLS, png_ptr Tpng_structrp) { if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= libc.Uint32FromUint32(0x1000) | libc.Uint32FromUint32(0x2000000) } // C documentation // // /* Expand to 16-bit channels, expand the tRNS chunk too (because otherwise // * it may not work correctly.) // */ func Xpng_set_expand_16(tls *libc.TLS, png_ptr Tpng_structrp) { if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= libc.Uint32FromUint32(0x0200) | libc.Uint32FromUint32(0x1000) | libc.Uint32FromUint32(0x2000000) } func Xpng_set_gray_to_rgb(tls *libc.TLS, png_ptr Tpng_structrp) { if _png_rtran_ok(tls, png_ptr, 0) == 0 { return } /* Because rgb must be 8 bits or more: */ Xpng_set_expand_gray_1_2_4_to_8(tls, png_ptr) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x4000) } func Xpng_set_rgb_to_gray_fixed(tls *libc.TLS, png_ptr Tpng_structrp, error_action int32, red Tpng_fixed_point, green Tpng_fixed_point) { var green_int, red_int Tpng_uint_16 _, _ = green_int, red_int /* Need the IHDR here because of the check on color_type below. */ /* TODO: fix this */ if _png_rtran_ok(tls, png_ptr, int32(1)) == 0 { return } switch error_action { case int32(PNG_ERROR_ACTION_NONE): *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x600000) case int32(PNG_ERROR_ACTION_WARN): *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x400000) case int32(PNG_ERROR_ACTION_ERROR): *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x200000) default: Xpng_error(tls, png_ptr, __ccgo_ts+15426) } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x1000) } if red >= 0 && green >= 0 && red+green <= int32(PNG_FP_1) { /* NOTE: this calculation does not round, but this behavior is retained * for consistency; the inaccuracy is very small. The code here always * overwrites the coefficients, regardless of whether they have been * defaulted or set already. */ red_int = uint16(libc.Uint32FromInt32(red) * libc.Uint32FromInt32(32768) / libc.Uint32FromInt32(100000)) green_int = uint16(libc.Uint32FromInt32(green) * libc.Uint32FromInt32(32768) / libc.Uint32FromInt32(100000)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_red_coeff = red_int (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_green_coeff = green_int (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_coefficients_set = uint8(1) } else { if red >= 0 && green >= 0 { Xpng_app_warning(tls, png_ptr, __ccgo_ts+15462) } /* Use the defaults, from the cHRM chunk if set, else the historical * values which are close to the sRGB/HDTV/ITU-Rec 709 values. See * png_do_rgb_to_gray for more discussion of the values. In this case * the coefficients are not marked as 'set' and are not overwritten if * something has already provided a default. */ if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_red_coeff) == 0 && libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_green_coeff) == 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_red_coeff = uint16(6968) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_green_coeff = uint16(23434) /* png_ptr->rgb_to_gray_blue_coeff = 2366; */ } } } /* Convert a RGB image to a grayscale of the same width. This allows us, * for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image. */ func Xpng_set_rgb_to_gray(tls *libc.TLS, png_ptr Tpng_structrp, error_action int32, red float64, green float64) { Xpng_set_rgb_to_gray_fixed(tls, png_ptr, error_action, Xpng_fixed(tls, png_ptr, red, __ccgo_ts+15509), Xpng_fixed(tls, png_ptr, green, __ccgo_ts+15537)) } func Xpng_set_read_user_transform_fn(tls *libc.TLS, png_ptr Tpng_structrp, read_user_transform_fn Tpng_user_transform_ptr) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x100000) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_user_transform_fn = read_user_transform_fn } // C documentation // // /* In the case of gamma transformations only do transformations on images where // * the [file] gamma and screen_gamma are not close reciprocals, otherwise it // * slows things down slightly, and also needlessly introduces small errors. // */ func _png_gamma_threshold(tls *libc.TLS, screen_gamma Tpng_fixed_point, file_gamma Tpng_fixed_point) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* gtest at bp+0 */ Tpng_fixed_point return libc.BoolInt32(!(Xpng_muldiv(tls, bp, screen_gamma, file_gamma, int32(PNG_FP_1)) != 0) || Xpng_gamma_significant(tls, *(*Tpng_fixed_point)(unsafe.Pointer(bp))) != 0) } /* Initialize everything needed for the read. This includes modifying * the palette. */ // C documentation // // /* For the moment 'png_init_palette_transformations' and // * 'png_init_rgb_transformations' only do some flag canceling optimizations. // * The intent is that these two routines should have palette or rgb operations // * extracted from 'png_init_read_transformations'. // */ func _png_init_palette_transformations(tls *libc.TLS, png_ptr Tpng_structrp) { var i, i1, input_has_alpha, input_has_transparency, istop int32 _, _, _, _, _ = i, i1, input_has_alpha, input_has_transparency, istop /* Called to handle the (input) palette case. In png_do_read_transformations * the first step is to expand the palette if requested, so this code must * take care to only make changes that are invariant with respect to the * palette expansion, or only do them if there is no expansion. * * STRIP_ALPHA has already been handled in the caller (by setting num_trans * to 0.) */ input_has_alpha = 0 input_has_transparency = 0 if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0 { /* Ignore if all the entries are opaque (unlikely!) */ i = 0 for { if !(i < libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans)) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i)))) == int32(255) { goto _1 } else { if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i)))) == 0 { input_has_transparency = int32(1) } else { input_has_transparency = int32(1) input_has_alpha = int32(1) break } } goto _1 _1: ; i++ } } /* If no alpha we can optimize. */ if input_has_alpha == 0 { /* Any alpha means background and associative alpha processing is * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA * and ENCODE_ALPHA are irrelevant. */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x800000) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^libc.Uint32FromUint32(0x2000) if input_has_transparency == 0 { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^(libc.Uint32FromUint32(0x0080) | libc.Uint32FromUint32(0x0100)) } } /* png_set_background handling - deals with the complexity of whether the * background color is in the file format or the screen format in the case * where an 'expand' will happen. */ /* The following code cannot be entered in the alpha pre-multiplication case * because PNG_BACKGROUND_EXPAND is cancelled below. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0100) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000) != uint32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred = uint16((*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Findex)*3))).Fred) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen = uint16((*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Findex)*3))).Fgreen) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue = uint16((*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Findex)*3))).Fblue) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x80000) != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x2000000) == uint32(0) { istop = libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) i1 = 0 for { if !(i1 < istop) { break } *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i1))) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i1))))) goto _2 _2: ; i1++ } } } } /* background expand and (therefore) no alpha association. */ } func _png_init_rgb_transformations(tls *libc.TLS, png_ptr Tpng_structrp) { var gray, input_has_alpha, input_has_transparency, trans_gray int32 var v1, v2, v3, v4 Tpng_uint_16 _, _, _, _, _, _, _, _ = gray, input_has_alpha, input_has_transparency, trans_gray, v1, v2, v3, v4 /* Added to libpng-1.5.4: check the color type to determine whether there * is any alpha or transparency in the image and simply cancel the * background and alpha mode stuff if there isn't. */ input_has_alpha = libc.BoolInt32(libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0) input_has_transparency = libc.BoolInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0) /* If no alpha we can optimize. */ if input_has_alpha == 0 { /* Any alpha means background and associative alpha processing is * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA * and ENCODE_ALPHA are irrelevant. */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x800000) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^libc.Uint32FromUint32(0x2000) if input_has_transparency == 0 { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^(libc.Uint32FromUint32(0x0080) | libc.Uint32FromUint32(0x0100)) } } /* png_set_background handling - deals with the complexity of whether the * background color is in the file format or the screen format in the case * where an 'expand' will happen. */ /* The following code cannot be entered in the alpha pre-multiplication case * because PNG_BACKGROUND_EXPAND is cancelled below. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0100) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000) != uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) == 0 { /* i.e., GRAY or GRAY_ALPHA */ /* Expand background and tRNS chunks */ gray = libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) trans_gray = libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgray) switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) { case int32(1): gray *= int32(0xff) trans_gray *= int32(0xff) case int32(2): gray *= int32(0x55) trans_gray *= int32(0x55) case int32(4): gray *= int32(0x11) trans_gray *= int32(0x11) default: fallthrough case int32(8): /* FALLTHROUGH */ /* (Already 8 bits) */ fallthrough case int32(16): /* Already a full 16 bits */ break } v2 = libc.Uint16FromInt32(gray) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue = v2 v1 = v2 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen = v1 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred = v1 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x2000000) == uint32(0) { v4 = libc.Uint16FromInt32(trans_gray) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fblue = v4 v3 = v4 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgreen = v3 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fred = v3 } } /* background expand and (therefore) no alpha association. */ } func Xpng_init_read_transformations(tls *libc.TLS, png_ptr Tpng_structrp) { var back, back1, back_1 Tpng_color var component, component1, component2, g_sig, gamma_correction, gs_sig, i, i1, i2, i3, istop, istop1, num_palette, num_palette1, shift int32 var g, g1, gs, gs1, v1 Tpng_fixed_point var palette, palette1, palette2 Tpng_colorp var temp, temp1, temp2, temp3, temp4, temp5, v4, v5, v6, v7 Tpng_uint_16 var v, w Tpng_byte var p2 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = back, back1, back_1, component, component1, component2, g, g1, g_sig, gamma_correction, gs, gs1, gs_sig, i, i1, i2, i3, istop, istop1, num_palette, num_palette1, palette, palette1, palette2, shift, temp, temp1, temp2, temp3, temp4, temp5, v, w, v1, v4, v5, v6, v7, p2 /* This internal function is called from png_read_start_row in pngrutil.c * and it is called before the 'rowbytes' calculation is done, so the code * in here can change or update the transformations flags. * * First do updates that do not depend on the details of the PNG image data * being processed. */ /* Prior to 1.5.4 these tests were performed from png_set_gamma, 1.5.4 adds * png_set_alpha_mode and this is another source for a default file gamma so * the test needs to be performed later - here. In addition prior to 1.5.4 * the tests were repeated for the PALETTE color type here - this is no * longer necessary (and doesn't seem to have been necessary before.) */ /* The following temporary indicates if overall gamma correction is * required. */ gamma_correction = 0 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma != 0 { /* has been set */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma != 0 { /* screen set too */ gamma_correction = _png_gamma_threshold(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) } else { /* Assume the output matches the input; a long time default behavior * of libpng, although the standard has nothing to say about this. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma = Xpng_reciprocal(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma) } } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma != 0 { /* The converse - assume the file matches the screen, note that this * perhaps undesirable default can (from 1.5.4) be changed by calling * png_set_alpha_mode (even if the alpha handling mode isn't required * or isn't changed from the default.) */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma = Xpng_reciprocal(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) } else { /* neither are set */ /* Just in case the following prevents any processing - file and screen * are both assumed to be linear and there is no way to introduce a * third gamma value other than png_set_background with 'UNIQUE', and, * prior to 1.5.4 */ v1 = libc.Int32FromInt32(PNG_FP_1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma = v1 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma = v1 } } /* We have a gamma value now. */ p2 = png_ptr + 1040 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p2)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PNG_COLORSPACE_HAVE_GAMMA7)) /* Now turn the gamma transformation on or off as appropriate. Notice * that PNG_GAMMA just refers to the file->screen correction. Alpha * composition may independently cause gamma correction because it needs * linear data (e.g. if the file has a gAMA chunk but the screen gamma * hasn't been specified.) In any case this flag may get turned off in * the code immediately below if the transform can be handled outside the * row loop. */ if gamma_correction != 0 { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x2000) } else { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x2000) } /* Certain transformations have the effect of preventing other * transformations that happen afterward in png_do_read_transformations; * resolve the interdependencies here. From the code of * png_do_read_transformations the order is: * * 1) PNG_EXPAND (including PNG_EXPAND_tRNS) * 2) PNG_STRIP_ALPHA (if no compose) * 3) PNG_RGB_TO_GRAY * 4) PNG_GRAY_TO_RGB iff !PNG_BACKGROUND_IS_GRAY * 5) PNG_COMPOSE * 6) PNG_GAMMA * 7) PNG_STRIP_ALPHA (if compose) * 8) PNG_ENCODE_ALPHA * 9) PNG_SCALE_16_TO_8 * 10) PNG_16_TO_8 * 11) PNG_QUANTIZE (converts to palette) * 12) PNG_EXPAND_16 * 13) PNG_GRAY_TO_RGB iff PNG_BACKGROUND_IS_GRAY * 14) PNG_INVERT_MONO * 15) PNG_INVERT_ALPHA * 16) PNG_SHIFT * 17) PNG_PACK * 18) PNG_BGR * 19) PNG_PACKSWAP * 20) PNG_FILLER (includes PNG_ADD_ALPHA) * 21) PNG_SWAP_ALPHA * 22) PNG_SWAP_BYTES * 23) PNG_USER_TRANSFORM [must be last] */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x40000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) == uint32(0) { /* Stripping the alpha channel happens immediately after the 'expand' * transformations, before all other transformation, so it cancels out * the alpha handling. It has the side effect negating the effect of * PNG_EXPAND_tRNS too: */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^(libc.Uint32FromUint32(0x0100) | libc.Uint32FromUint32(0x800000) | libc.Uint32FromUint32(0x2000000)) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^libc.Uint32FromUint32(0x2000) /* Kill the tRNS chunk itself too. Prior to 1.5.4 this did not happen * so transparency information would remain just so long as it wasn't * expanded. This produces unexpected API changes if the set of things * that do PNG_EXPAND_tRNS changes (perfectly possible given the * documentation - which says ask for what you want, accept what you * get.) This makes the behavior consistent from 1.5.4: */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans = uint16(0) } /* If the screen gamma is about 1.0 then the OPTIMIZE_ALPHA and ENCODE_ALPHA * settings will have no effect. */ if Xpng_gamma_significant(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) == 0 { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x800000) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^libc.Uint32FromUint32(0x2000) } /* Make sure the coefficients for the rgb to gray conversion are set * appropriately. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x600000) != uint32(0) { Xpng_colorspace_set_rgb_coefficients(tls, png_ptr) } /* Detect gray background and attempt to enable optimization for * gray --> RGB case. * * Note: if PNG_BACKGROUND_EXPAND is set and color_type is either RGB or * RGB_ALPHA (in which case need_expand is superfluous anyway), the * background color might actually be gray yet not be flagged as such. * This is not a problem for the current code, which uses * PNG_BACKGROUND_IS_GRAY only to decide when to do the * png_do_gray_to_rgb() transformation. * * TODO: this code needs to be revised to avoid the complexity and * interdependencies. The color type of the background should be recorded in * png_set_background, along with the bit depth, then the code has a record * of exactly what color space the background is currently in. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0100) != uint32(0) { /* PNG_BACKGROUND_EXPAND: the background is in the file color space, so if * the file was grayscale the background value is gray. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) == 0 { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(0x800) } } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) { /* PNG_COMPOSE: png_set_background was called with need_expand false, * so the color is in the color space of the output or png_set_alpha_mode * was called and the color is black. Ignore RGB_TO_GRAY because that * happens before GRAY_TO_RGB. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x4000) != uint32(0) { if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) && libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(0x800) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred } } } } /* For indexed PNG data (PNG_COLOR_TYPE_PALETTE) many of the transformations * can be performed directly on the palette, and some (such as rgb to gray) * can be optimized inside the palette. This is particularly true of the * composite (background and alpha) stuff, which can be pretty much all done * in the palette even if the result is expanded to RGB or gray afterward. * * NOTE: this is Not Yet Implemented, the code behaves as in 1.5.1 and * earlier and the palette stuff is actually handled on the first row. This * leads to the reported bug that the palette returned by png_get_PLTE is not * updated. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { _png_init_palette_transformations(tls, png_ptr) } else { _png_init_rgb_transformations(tls, png_ptr) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0200) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0100) == uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) != int32(16) { /* TODO: fix this. Because the expand_16 operation is after the compose * handling the background color must be 8, not 16, bits deep, but the * application will supply a 16-bit value so reduce it here. * * The PNG_BACKGROUND_EXPAND code above does not expand to 16 bits at * present, so that case is ok (until do_expand_16 is moved.) * * NOTE: this discards the low 16 bits of the user supplied background * color, but until expand_16 works properly there is no choice! */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred = uint16((uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred)*libc.Uint32FromInt32(255) + libc.Uint32FromInt32(32895)) >> libc.Int32FromInt32(16)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen = uint16((uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen)*libc.Uint32FromInt32(255) + libc.Uint32FromInt32(32895)) >> libc.Int32FromInt32(16)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue = uint16((uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue)*libc.Uint32FromInt32(255) + libc.Uint32FromInt32(32895)) >> libc.Int32FromInt32(16)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray = uint16((uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray)*libc.Uint32FromInt32(255) + libc.Uint32FromInt32(32895)) >> libc.Int32FromInt32(16)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&(libc.Uint32FromUint32(0x0400)|libc.Uint32FromUint32(0x4000000)) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0100) == uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) == int32(16) { /* On the other hand, if a 16-bit file is to be reduced to 8-bits per * component this will also happen after PNG_COMPOSE and so the background * color must be pre-expanded here. * * TODO: fix this too. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred = libc.Uint16FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) * libc.Int32FromInt32(257)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen = libc.Uint16FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) * libc.Int32FromInt32(257)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue = libc.Uint16FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) * libc.Int32FromInt32(257)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray = libc.Uint16FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) * libc.Int32FromInt32(257)) } /* NOTE: below 'PNG_READ_ALPHA_MODE_SUPPORTED' is presumed to also enable the * background support (see the comments in scripts/pnglibconf.dfa), this * allows pre-multiplication of the alpha channel to be implemented as * compositing on black. This is probably sub-optimal and has been done in * 1.5.4 betas simply to enable external critique and testing (i.e. to * implement the new API quickly, without lots of internal changes.) */ /* Includes ALPHA_MODE */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground /* This needs to change - in the palette image case a whole set of tables are * built when it would be quicker to just calculate the correct value for * each palette entry directly. Also, the test is too tricky - why check * PNG_RGB_TO_GRAY if PNG_GAMMA is not set? The answer seems to be that * PNG_GAMMA is cancelled even if the gamma is known? The test excludes the * PNG_COMPOSE case, so apparently if there is no *overall* gamma correction * the gamma tables will not be built even if composition is required on a * gamma encoded value. * * In 1.5.4 this is addressed below by an additional check on the individual * file gamma - if it is not 1.0 both RGB_TO_GRAY and COMPOSE need the * tables. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x2000) != uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x600000) != uint32(0) && (Xpng_gamma_significant(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma) != 0 || Xpng_gamma_significant(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) != 0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) && (Xpng_gamma_significant(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma) != 0 || Xpng_gamma_significant(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) != 0 || libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma_type) == int32(PNG_BACKGROUND_GAMMA_UNIQUE) && Xpng_gamma_significant(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma) != 0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x800000) != uint32(0) && Xpng_gamma_significant(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) != 0 { Xpng_build_gamma_table(tls, png_ptr, libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth)) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) { /* Issue a warning about this combination: because RGB_TO_GRAY is * optimized to do the gamma transform if present yet do_background has * to do the same thing if both options are set a * double-gamma-correction happens. This is true in all versions of * libpng to date. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x600000) != uint32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+15567) } if libc.BoolInt32(libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE)) != 0 { palette = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette num_palette = libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma_type) == int32(PNG_BACKGROUND_GAMMA_FILE) { back.Fred = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table + uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred))) back.Fgreen = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table + uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen))) back.Fblue = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table + uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue))) back_1.Fred = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 + uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred))) back_1.Fgreen = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 + uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen))) back_1.Fblue = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 + uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue))) } else { switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma_type) { case int32(PNG_BACKGROUND_GAMMA_SCREEN): g = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma gs = int32(PNG_FP_1) case int32(PNG_BACKGROUND_GAMMA_FILE): g = Xpng_reciprocal(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma) gs = Xpng_reciprocal2(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) case int32(PNG_BACKGROUND_GAMMA_UNIQUE): g = Xpng_reciprocal(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma) gs = Xpng_reciprocal2(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) default: g = int32(PNG_FP_1) /* back_1 */ gs = int32(PNG_FP_1) /* back */ break } if Xpng_gamma_significant(tls, gs) != 0 { back.Fred = Xpng_gamma_8bit_correct(tls, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred), gs) back.Fgreen = Xpng_gamma_8bit_correct(tls, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen), gs) back.Fblue = Xpng_gamma_8bit_correct(tls, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue), gs) } else { back.Fred = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) back.Fgreen = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) back.Fblue = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) } if Xpng_gamma_significant(tls, g) != 0 { back_1.Fred = Xpng_gamma_8bit_correct(tls, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred), g) back_1.Fgreen = Xpng_gamma_8bit_correct(tls, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen), g) back_1.Fblue = Xpng_gamma_8bit_correct(tls, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue), g) } else { back_1.Fred = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) back_1.Fgreen = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) back_1.Fblue = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) } } i = 0 for { if !(i < num_palette) { break } if i < libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i)))) != int32(0xff) { if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i)))) == 0 { *(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3)) = back } else { /* if (png_ptr->trans_alpha[i] != 0xff) */ v = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 + uintptr((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fred))) temp = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(v))*libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i))))) + libc.Int32FromUint16(uint16(back_1.Fred))*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i))))))) + libc.Int32FromInt32(128)) w = libc.Uint8FromInt32((libc.Int32FromUint16(temp) + libc.Int32FromUint16(temp)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fred = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_from_1 + uintptr(w))) v = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 + uintptr((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fgreen))) temp1 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(v))*libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i))))) + libc.Int32FromUint16(uint16(back_1.Fgreen))*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i))))))) + libc.Int32FromInt32(128)) w = libc.Uint8FromInt32((libc.Int32FromUint16(temp1) + libc.Int32FromUint16(temp1)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fgreen = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_from_1 + uintptr(w))) v = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 + uintptr((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fblue))) temp2 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(v))*libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i))))) + libc.Int32FromUint16(uint16(back_1.Fblue))*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i))))))) + libc.Int32FromInt32(128)) w = libc.Uint8FromInt32((libc.Int32FromUint16(temp2) + libc.Int32FromUint16(temp2)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fblue = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_from_1 + uintptr(w))) } } else { (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fred = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table + uintptr((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fred))) (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fgreen = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table + uintptr((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fgreen))) (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fblue = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table + uintptr((*(*Tpng_color)(unsafe.Pointer(palette + uintptr(i)*3))).Fblue))) } goto _3 _3: ; i++ } /* Prevent the transformations being done again. * * NOTE: this is highly dubious; it removes the transformations in * place. This seems inconsistent with the general treatment of the * transformations elsewhere. */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^(libc.Uint32FromUint32(0x0080) | libc.Uint32FromUint32(0x2000)) } else { /* color_type != PNG_COLOR_TYPE_PALETTE */ g1 = int32(PNG_FP_1) /* Correction to linear */ gs1 = int32(PNG_FP_1) /* Correction to screen */ switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma_type) { case int32(PNG_BACKGROUND_GAMMA_SCREEN): g1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma /* gs = PNG_FP_1; */ case int32(PNG_BACKGROUND_GAMMA_FILE): g1 = Xpng_reciprocal(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma) gs1 = Xpng_reciprocal2(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) case int32(PNG_BACKGROUND_GAMMA_UNIQUE): g1 = Xpng_reciprocal(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma) gs1 = Xpng_reciprocal2(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fscreen_gamma) default: Xpng_error(tls, png_ptr, __ccgo_ts+15620) } g_sig = Xpng_gamma_significant(tls, g1) gs_sig = Xpng_gamma_significant(tls, gs1) if g_sig != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fgray = Xpng_gamma_correct(tls, png_ptr, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray), g1) } if gs_sig != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray = Xpng_gamma_correct(tls, png_ptr, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray), gs1) } if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) != libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) || libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) != libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) || libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) != libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) { /* RGB or RGBA with color background */ if g_sig != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fred = Xpng_gamma_correct(tls, png_ptr, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred), g1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fgreen = Xpng_gamma_correct(tls, png_ptr, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen), g1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fblue = Xpng_gamma_correct(tls, png_ptr, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue), g1) } if gs_sig != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred = Xpng_gamma_correct(tls, png_ptr, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred), gs1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen = Xpng_gamma_correct(tls, png_ptr, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen), gs1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue = Xpng_gamma_correct(tls, png_ptr, uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue), gs1) } } else { /* GRAY, GRAY ALPHA, RGB, or RGBA with gray background */ v5 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fgray (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fblue = v5 v4 = v5 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fgreen = v4 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fred = v4 v7 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue = v7 v6 = v7 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen = v6 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred = v6 } /* The background is now in screen gamma: */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_gamma_type = uint8(PNG_BACKGROUND_GAMMA_SCREEN) } /* color_type != PNG_COLOR_TYPE_PALETTE */ } else { /* Transformation does not include PNG_BACKGROUND */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) && ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000) == uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x600000) == uint32(0)) { palette1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette num_palette1 = libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) /* NOTE: there are other transformations that should probably be in * here too. */ i1 = 0 for { if !(i1 < num_palette1) { break } (*(*Tpng_color)(unsafe.Pointer(palette1 + uintptr(i1)*3))).Fred = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table + uintptr((*(*Tpng_color)(unsafe.Pointer(palette1 + uintptr(i1)*3))).Fred))) (*(*Tpng_color)(unsafe.Pointer(palette1 + uintptr(i1)*3))).Fgreen = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table + uintptr((*(*Tpng_color)(unsafe.Pointer(palette1 + uintptr(i1)*3))).Fgreen))) (*(*Tpng_color)(unsafe.Pointer(palette1 + uintptr(i1)*3))).Fblue = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table + uintptr((*(*Tpng_color)(unsafe.Pointer(palette1 + uintptr(i1)*3))).Fblue))) goto _8 _8: ; i1++ } /* Done the gamma correction. */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x2000) } } /* color_type == PALETTE && !PNG_BACKGROUND transformation */ } else { /* No GAMMA transformation (see the hanging else 4 lines above) */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { istop = libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) palette2 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette back1.Fred = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) back1.Fgreen = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) back1.Fblue = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) i2 = 0 for { if !(i2 < istop) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i2)))) == 0 { *(*Tpng_color)(unsafe.Pointer(palette2 + uintptr(i2)*3)) = back1 } else { if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i2)))) != int32(0xff) { /* The png_composite() macro is defined in png.h */ temp3 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16((*(*Tpng_color)(unsafe.Pointer(palette2 + uintptr(i2)*3))).Fred))*libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i2))))) + libc.Int32FromUint16(uint16(back1.Fred))*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i2))))))) + libc.Int32FromInt32(128)) (*(*Tpng_color)(unsafe.Pointer(palette2 + uintptr(i2)*3))).Fred = libc.Uint8FromInt32((libc.Int32FromUint16(temp3) + libc.Int32FromUint16(temp3)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) temp4 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16((*(*Tpng_color)(unsafe.Pointer(palette2 + uintptr(i2)*3))).Fgreen))*libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i2))))) + libc.Int32FromUint16(uint16(back1.Fgreen))*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i2))))))) + libc.Int32FromInt32(128)) (*(*Tpng_color)(unsafe.Pointer(palette2 + uintptr(i2)*3))).Fgreen = libc.Uint8FromInt32((libc.Int32FromUint16(temp4) + libc.Int32FromUint16(temp4)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) temp5 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16((*(*Tpng_color)(unsafe.Pointer(palette2 + uintptr(i2)*3))).Fblue))*libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i2))))) + libc.Int32FromUint16(uint16(back1.Fblue))*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha + uintptr(i2))))))) + libc.Int32FromInt32(128)) (*(*Tpng_color)(unsafe.Pointer(palette2 + uintptr(i2)*3))).Fblue = libc.Uint8FromInt32((libc.Int32FromUint16(temp5) + libc.Int32FromUint16(temp5)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) } } goto _9 _9: ; i2++ } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x0080) } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0008) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000) == uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { istop1 = libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) shift = int32(8) - libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fred) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x0008) /* significant bits can be in the range 1 to 7 for a meaningful result, if * the number of significant bits is 0 then no shift is done (this is an * error condition which is silently ignored.) */ if shift > 0 && shift < int32(8) { i3 = 0 for { if !(i3 < istop1) { break } component = libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr(i3)*3))).Fred) component >>= shift (*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr(i3)*3))).Fred = libc.Uint8FromInt32(component) goto _10 _10: ; i3++ } } shift = int32(8) - libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fgreen) if shift > 0 && shift < int32(8) { i3 = 0 for { if !(i3 < istop1) { break } component1 = libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr(i3)*3))).Fgreen) component1 >>= shift (*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr(i3)*3))).Fgreen = libc.Uint8FromInt32(component1) goto _11 _11: ; i3++ } } shift = int32(8) - libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fblue) if shift > 0 && shift < int32(8) { i3 = 0 for { if !(i3 < istop1) { break } component2 = libc.Int32FromUint8((*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr(i3)*3))).Fblue) component2 >>= shift (*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr(i3)*3))).Fblue = libc.Uint8FromInt32(component2) goto _12 _12: ; i3++ } } } } // C documentation // // /* Modify the info structure to reflect the transformations. The // * info should be updated so a PNG file could be written with it, // * assuming the transformations result in valid PNG data. // */ func Xpng_read_transform_info(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp) { var v3 uint32 var p1, p2 uintptr _, _, _ = v3, p1, p2 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000) != uint32(0) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { /* This check must match what actually happens in * png_do_expand_palette; if it ever checks the tRNS chunk to see if * it is all opaque we must do the same (at present it does not.) */ if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0 { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type = libc.Uint8FromInt32(libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA)) } else { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type = libc.Uint8FromInt32(libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)) } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth = uint8(8) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_trans = uint16(0) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette == libc.UintptrFromInt32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+15650) } } else { if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) != 0 { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x2000000) != uint32(0) { p1 = info_ptr + 25 *(*Tpng_byte)(unsafe.Pointer(p1)) = Tpng_byte(int32(*(*Tpng_byte)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA)) } } if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) < int32(8) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth = uint8(8) } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_trans = uint16(0) } } /* The following is almost certainly wrong unless the background value is in * the screen space! */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbackground = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground } /* The following used to be conditional on PNG_GAMMA (prior to 1.5.4), * however it seems that the code in png_init_read_transformations, which has * been called before this from png_read_update_info->png_read_start_row * sometimes does the gamma transform and cancels the flag. * * TODO: this looks wrong; the info_ptr should end up with a gamma equal to * the screen_gamma value. The following probably results in weirdness if * the info_ptr is used by the app after the rows have been read. */ (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fgamma = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fgamma if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) == int32(16) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x4000000) != uint32(0) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth = uint8(8) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0400) != uint32(0) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth = uint8(8) } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x4000) != uint32(0) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) | libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x600000) != uint32(0) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) & ^libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0040) != uint32(0) { if (libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) || libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA)) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_lookup != uintptr(0) && libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) == int32(8) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type = libc.Uint8FromInt32(libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE)) } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0200) != uint32(0) && libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) == int32(8) && libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) != libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth = uint8(16) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0004) != uint32(0) && libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) < int32(8) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth = uint8(8) } if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels = uint8(1) } else { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels = uint8(3) } else { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels = uint8(1) } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x40000) != uint32(0) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) & ^libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA)) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_trans = uint16(0) } if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0 { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels++ } /* STRIP_ALPHA and FILLER allowed: MASK_ALPHA bit stripped above */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x8000) != uint32(0) && (libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) || libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == PNG_COLOR_TYPE_GRAY) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels++ /* If adding a true alpha channel not just filler */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000000) != uint32(0) { p2 = info_ptr + 25 *(*Tpng_byte)(unsafe.Pointer(p2)) = Tpng_byte(int32(*(*Tpng_byte)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA)) } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x100000) != uint32(0) { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_depth) != 0 { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_depth } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_channels) != 0 { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_channels } } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels) * libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth)) if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpixel_depth) >= int32(8) { v3 = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fwidth * (uint32((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v3 = ((*Tpng_info)(unsafe.Pointer(info_ptr)).Fwidth*uint32((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_info)(unsafe.Pointer(info_ptr)).Frowbytes = v3 /* Adding in 1.5.4: cache the above value in png_struct so that we can later * check in png_rowbytes that the user buffer won't get overwritten. Note * that the field is not always set - if png_read_update_info isn't called * the application has to either not do any transforms or get the calculation * right itself. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Finfo_rowbytes = (*Tpng_info)(unsafe.Pointer(info_ptr)).Frowbytes } // C documentation // // /* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel, // * without changing the actual values. Thus, if you had a row with // * a bit depth of 1, you would end up with bytes that only contained // * the numbers 0 or 1. If you would rather they contain 0 and 255, use // * png_do_shift() after this. // */ func _png_do_unpack(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var dp, dp1, dp2, sp, sp1, sp2 Tpng_bytep var i, row_width, shift, shift1, shift2 Tpng_uint_32 _, _, _, _, _, _, _, _, _, _, _ = dp, dp1, dp2, i, row_width, shift, shift1, shift2, sp, sp1, sp2 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) < int32(8) { row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth switch libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) { case int32(1): sp = row + uintptr((row_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(3)) dp = row + uintptr(row_width) - uintptr(1) shift = uint32(7) - (row_width+uint32(7))&uint32(0x07) i = uint32(0) for { if !(i < row_width) { break } *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) >> shift & libc.Int32FromInt32(0x01)) if shift == uint32(7) { shift = uint32(0) sp-- } else { shift++ } dp-- goto _1 _1: ; i++ } case int32(2): sp1 = row + uintptr((row_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(2)) dp1 = row + uintptr(row_width) - uintptr(1) shift1 = (libc.Uint32FromUint32(3) - (row_width+libc.Uint32FromUint32(3))&libc.Uint32FromInt32(0x03)) << libc.Int32FromInt32(1) i = uint32(0) for { if !(i < row_width) { break } *(*Tpng_byte)(unsafe.Pointer(dp1)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp1))) >> shift1 & libc.Int32FromInt32(0x03)) if shift1 == uint32(6) { shift1 = uint32(0) sp1-- } else { shift1 += uint32(2) } dp1-- goto _2 _2: ; i++ } case int32(4): sp2 = row + uintptr((row_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(1)) dp2 = row + uintptr(row_width) - uintptr(1) shift2 = (libc.Uint32FromUint32(1) - (row_width+libc.Uint32FromUint32(1))&libc.Uint32FromInt32(0x01)) << libc.Int32FromInt32(2) i = uint32(0) for { if !(i < row_width) { break } *(*Tpng_byte)(unsafe.Pointer(dp2)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp2))) >> shift2 & libc.Int32FromInt32(0x0f)) if shift2 == uint32(4) { shift2 = uint32(0) sp2-- } else { shift2 = uint32(4) } dp2-- goto _3 _3: ; i++ } default: break } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth = uint8(8) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromInt32(8) * libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels)) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) } } // C documentation // // /* Reverse the effects of png_do_shift. This routine merely shifts the // * pixels back to their significant bits values. Thus, if you have // * a row of bit depth 8, but only 5 are significant, this will shift // * the values back to 0 through 31. // */ func _png_do_unshift(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, sig_bits Tpng_const_color_8p) { var b, b1, b2, bit_depth, c, channel, channel1, channels, color_type, gray_shift, have_shift, mask, value, v1, v10, v12, v2, v3, v4, v5, v7 int32 var bp, bp1, bp2, bp3, bp_end, bp_end1, bp_end2, bp_end3, v11, v13, v14, v8, v9 Tpng_bytep var shift [4]int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, b1, b2, bit_depth, bp, bp1, bp2, bp3, bp_end, bp_end1, bp_end2, bp_end3, c, channel, channel1, channels, color_type, gray_shift, have_shift, mask, shift, value, v1, v10, v11, v12, v13, v14, v2, v3, v4, v5, v7, v8, v9 /* The palette case has already been handled in the _init routine. */ color_type = libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) if color_type != libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { channels = 0 bit_depth = libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) if color_type&int32(PNG_COLOR_MASK_COLOR) != 0 { v1 = channels channels++ shift[v1] = bit_depth - libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sig_bits)).Fred) v2 = channels channels++ shift[v2] = bit_depth - libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sig_bits)).Fgreen) v3 = channels channels++ shift[v3] = bit_depth - libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sig_bits)).Fblue) } else { v4 = channels channels++ shift[v4] = bit_depth - libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sig_bits)).Fgray) } if color_type&int32(PNG_COLOR_MASK_ALPHA) != 0 { v5 = channels channels++ shift[v5] = bit_depth - libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sig_bits)).Falpha) } v7 = libc.Int32FromInt32(0) have_shift = v7 c = v7 for { if !(c < channels) { break } /* A shift of more than the bit depth is an error condition but it * gets ignored here. */ if shift[c] <= 0 || shift[c] >= bit_depth { shift[c] = 0 } else { have_shift = int32(1) } goto _6 _6: ; c++ } if have_shift == 0 { return } switch bit_depth { default: /* Must be 1bpp gray: should not be here! */ /* NOTREACHED */ case int32(2): /* Must be 2bpp gray */ /* assert(channels == 1 && shift[0] == 1) */ bp = row bp_end = bp + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) for bp < bp_end { b = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(bp))) >> int32(1) & int32(0x55) v8 = bp bp++ *(*Tpng_byte)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(b) } case int32(4): /* Must be 4bpp gray */ /* assert(channels == 1) */ bp1 = row bp_end1 = bp1 + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) gray_shift = shift[0] mask = int32(0xf) >> gray_shift mask |= mask << int32(4) for bp1 < bp_end1 { b1 = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(bp1))) >> gray_shift & mask v9 = bp1 bp1++ *(*Tpng_byte)(unsafe.Pointer(v9)) = libc.Uint8FromInt32(b1) } case int32(8): /* Single byte components, G, GA, RGB, RGBA */ bp2 = row bp_end2 = bp2 + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) channel = 0 for bp2 < bp_end2 { b2 = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(bp2))) >> shift[channel] channel++ v10 = channel if v10 >= channels { channel = 0 } v11 = bp2 bp2++ *(*Tpng_byte)(unsafe.Pointer(v11)) = libc.Uint8FromInt32(b2) } case int32(16): /* Double byte components, G, GA, RGB, RGBA */ bp3 = row bp_end3 = bp3 + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) channel1 = 0 for bp3 < bp_end3 { value = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(bp3)))<>= shift[channel1] channel1++ v12 = channel1 if v12 >= channels { channel1 = 0 } v13 = bp3 bp3++ *(*Tpng_byte)(unsafe.Pointer(v13)) = libc.Uint8FromInt32(value >> libc.Int32FromInt32(8)) v14 = bp3 bp3++ *(*Tpng_byte)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(value) } break } } } // C documentation // // /* Scale rows of bit depth 16 down to 8 accurately */ func _png_do_scale_16_to_8(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var dp, ep, sp, v1, v2, v3 Tpng_bytep var tmp Tpng_int_32 _, _, _, _, _, _, _ = dp, ep, sp, tmp, v1, v2, v3 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { sp = row /* source */ dp = row /* destination */ ep = sp + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) /* end+1 */ for sp < ep { v1 = sp sp++ /* The input is an array of 16-bit components, these must be scaled to * 8 bits each. For a 16-bit value V the required value (from the PNG * specification) is: * * (V * 255) / 65535 * * This reduces to round(V / 257), or floor((V + 128.5)/257) * * Represent V as the two byte value vhi.vlo. Make a guess that the * result is the top byte of V, vhi, then the correction to this value * is: * * error = floor(((V-vhi.vhi) + 128.5) / 257) * = floor(((vlo-vhi) + 128.5) / 257) * * This can be approximated using integer arithmetic (and a signed * shift): * * error = (vlo-vhi+128) >> 8; * * The approximate differs from the exact answer only when (vlo-vhi) is * 128; it then gives a correction of +1 when the exact correction is * 0. This gives 128 errors. The exact answer (correct for all 16-bit * input values) is: * * error = (vlo-vhi+128)*65535 >> 24; * * An alternative arithmetic calculation which also gives no errors is: * * (V * 255 + 32895) >> 16 */ tmp = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v1))) /* must be signed! */ v2 = sp sp++ tmp += (libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v2))) - tmp + int32(128)) * int32(65535) >> int32(24) v3 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v3)) = libc.Uint8FromInt32(tmp) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth = uint8(8) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromInt32(8) * libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels)) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth * uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) } } func _png_do_chop(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var dp, ep, sp, v1 Tpng_bytep _, _, _, _ = dp, ep, sp, v1 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { sp = row /* source */ dp = row /* destination */ ep = sp + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) /* end+1 */ for sp < ep { v1 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v1)) = *(*Tpng_byte)(unsafe.Pointer(sp)) sp += uintptr(2) /* skip low byte */ } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth = uint8(8) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromInt32(8) * libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels)) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth * uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) } } func _png_do_read_swap_alpha(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var dp, dp1, dp2, dp3, sp, sp1, sp2, sp3, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v28, v29, v3, v30, v31, v33, v34, v35, v36, v37, v38, v39, v4, v40, v5, v6, v7, v8, v9 Tpng_bytep var i, i1, i2, i3, row_width Tpng_uint_32 var save, save2 Tpng_byte var save1, save3 [2]Tpng_byte _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, dp1, dp2, dp3, i, i1, i2, i3, row_width, save, save1, save2, save3, sp, sp1, sp2, sp3, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v28, v29, v3, v30, v31, v33, v34, v35, v36, v37, v38, v39, v4, v40, v5, v6, v7, v8, v9 row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { /* This converts from RGBA to ARGB */ if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { sp = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) dp = sp i = uint32(0) for { if !(i < row_width) { break } sp-- v2 = sp save = *(*Tpng_byte)(unsafe.Pointer(v2)) dp-- v3 = dp sp-- v4 = sp *(*Tpng_byte)(unsafe.Pointer(v3)) = *(*Tpng_byte)(unsafe.Pointer(v4)) dp-- v5 = dp sp-- v6 = sp *(*Tpng_byte)(unsafe.Pointer(v5)) = *(*Tpng_byte)(unsafe.Pointer(v6)) dp-- v7 = dp sp-- v8 = sp *(*Tpng_byte)(unsafe.Pointer(v7)) = *(*Tpng_byte)(unsafe.Pointer(v8)) dp-- v9 = dp *(*Tpng_byte)(unsafe.Pointer(v9)) = save goto _1 _1: ; i++ } } else { sp1 = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) dp1 = sp1 i1 = uint32(0) for { if !(i1 < row_width) { break } sp1-- v11 = sp1 save1[0] = *(*Tpng_byte)(unsafe.Pointer(v11)) sp1-- v12 = sp1 save1[int32(1)] = *(*Tpng_byte)(unsafe.Pointer(v12)) dp1-- v13 = dp1 sp1-- v14 = sp1 *(*Tpng_byte)(unsafe.Pointer(v13)) = *(*Tpng_byte)(unsafe.Pointer(v14)) dp1-- v15 = dp1 sp1-- v16 = sp1 *(*Tpng_byte)(unsafe.Pointer(v15)) = *(*Tpng_byte)(unsafe.Pointer(v16)) dp1-- v17 = dp1 sp1-- v18 = sp1 *(*Tpng_byte)(unsafe.Pointer(v17)) = *(*Tpng_byte)(unsafe.Pointer(v18)) dp1-- v19 = dp1 sp1-- v20 = sp1 *(*Tpng_byte)(unsafe.Pointer(v19)) = *(*Tpng_byte)(unsafe.Pointer(v20)) dp1-- v21 = dp1 sp1-- v22 = sp1 *(*Tpng_byte)(unsafe.Pointer(v21)) = *(*Tpng_byte)(unsafe.Pointer(v22)) dp1-- v23 = dp1 sp1-- v24 = sp1 *(*Tpng_byte)(unsafe.Pointer(v23)) = *(*Tpng_byte)(unsafe.Pointer(v24)) dp1-- v25 = dp1 *(*Tpng_byte)(unsafe.Pointer(v25)) = save1[0] dp1-- v26 = dp1 *(*Tpng_byte)(unsafe.Pointer(v26)) = save1[int32(1)] goto _10 _10: ; i1++ } } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA) { /* This converts from GA to AG */ if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { sp2 = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) dp2 = sp2 i2 = uint32(0) for { if !(i2 < row_width) { break } sp2-- v28 = sp2 save2 = *(*Tpng_byte)(unsafe.Pointer(v28)) dp2-- v29 = dp2 sp2-- v30 = sp2 *(*Tpng_byte)(unsafe.Pointer(v29)) = *(*Tpng_byte)(unsafe.Pointer(v30)) dp2-- v31 = dp2 *(*Tpng_byte)(unsafe.Pointer(v31)) = save2 goto _27 _27: ; i2++ } } else { sp3 = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) dp3 = sp3 i3 = uint32(0) for { if !(i3 < row_width) { break } sp3-- v33 = sp3 save3[0] = *(*Tpng_byte)(unsafe.Pointer(v33)) sp3-- v34 = sp3 save3[int32(1)] = *(*Tpng_byte)(unsafe.Pointer(v34)) dp3-- v35 = dp3 sp3-- v36 = sp3 *(*Tpng_byte)(unsafe.Pointer(v35)) = *(*Tpng_byte)(unsafe.Pointer(v36)) dp3-- v37 = dp3 sp3-- v38 = sp3 *(*Tpng_byte)(unsafe.Pointer(v37)) = *(*Tpng_byte)(unsafe.Pointer(v38)) dp3-- v39 = dp3 *(*Tpng_byte)(unsafe.Pointer(v39)) = save3[0] dp3-- v40 = dp3 *(*Tpng_byte)(unsafe.Pointer(v40)) = save3[int32(1)] goto _32 _32: ; i3++ } } } } } func _png_do_read_invert_alpha(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var dp, dp1, dp2, dp3, sp, sp1, sp2, sp3, v10, v11, v12, v13, v15, v16, v17, v18, v2, v3, v5, v6, v7, v8 Tpng_bytep var i, i1, i2, i3, row_width Tpng_uint_32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, dp1, dp2, dp3, i, i1, i2, i3, row_width, sp, sp1, sp2, sp3, v10, v11, v12, v13, v15, v16, v17, v18, v2, v3, v5, v6, v7, v8 row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { /* This inverts the alpha channel in RGBA */ sp = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) dp = sp i = uint32(0) for { if !(i < row_width) { break } dp-- v2 = dp sp-- v3 = sp *(*Tpng_byte)(unsafe.Pointer(v2)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v3)))) /* This does nothing: *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); We can replace it with: */ sp -= uintptr(3) dp = sp goto _1 _1: ; i++ } } else { sp1 = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) dp1 = sp1 i1 = uint32(0) for { if !(i1 < row_width) { break } dp1-- v5 = dp1 sp1-- v6 = sp1 *(*Tpng_byte)(unsafe.Pointer(v5)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v6)))) dp1-- v7 = dp1 sp1-- v8 = sp1 *(*Tpng_byte)(unsafe.Pointer(v7)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v8)))) /* This does nothing: *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); We can replace it with: */ sp1 -= uintptr(6) dp1 = sp1 goto _4 _4: ; i1++ } } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { /* This inverts the alpha channel in GA */ sp2 = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) dp2 = sp2 i2 = uint32(0) for { if !(i2 < row_width) { break } dp2-- v10 = dp2 sp2-- v11 = sp2 *(*Tpng_byte)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v11)))) dp2-- v12 = dp2 sp2-- v13 = sp2 *(*Tpng_byte)(unsafe.Pointer(v12)) = *(*Tpng_byte)(unsafe.Pointer(v13)) goto _9 _9: ; i2++ } } else { /* This inverts the alpha channel in GGAA */ sp3 = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) dp3 = sp3 i3 = uint32(0) for { if !(i3 < row_width) { break } dp3-- v15 = dp3 sp3-- v16 = sp3 *(*Tpng_byte)(unsafe.Pointer(v15)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v16)))) dp3-- v17 = dp3 sp3-- v18 = sp3 *(*Tpng_byte)(unsafe.Pointer(v17)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v18)))) /* *(--dp) = *(--sp); *(--dp) = *(--sp); */ sp3 -= uintptr(2) dp3 = sp3 goto _14 _14: ; i3++ } } } } } // C documentation // // /* Add filler channel if we have RGB color */ func _png_do_read_filler(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, filler Tpng_uint_32, flags Tpng_uint_32) { var dp, dp1, dp2, dp3, dp4, dp5, dp6, dp7, sp, sp1, sp2, sp3, sp4, sp5, sp6, sp7, v11, v12, v13, v14, v15, v16, v17, v18, v2, v20, v21, v22, v23, v24, v25, v27, v28, v29, v3, v30, v31, v32, v33, v34, v36, v37, v38, v39, v4, v40, v41, v42, v44, v45, v46, v47, v48, v49, v5, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v61, v62, v63, v64, v65, v66, v67, v68, v69, v7, v70, v71, v72, v73, v74, v8, v9 Tpng_bytep var hi_filler, lo_filler Tpng_byte var i, row_width Tpng_uint_32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, dp1, dp2, dp3, dp4, dp5, dp6, dp7, hi_filler, i, lo_filler, row_width, sp, sp1, sp2, sp3, sp4, sp5, sp6, sp7, v11, v12, v13, v14, v15, v16, v17, v18, v2, v20, v21, v22, v23, v24, v25, v27, v28, v29, v3, v30, v31, v32, v33, v34, v36, v37, v38, v39, v4, v40, v41, v42, v44, v45, v46, v47, v48, v49, v5, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v61, v62, v63, v64, v65, v66, v67, v68, v69, v7, v70, v71, v72, v73, v74, v8, v9 row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth hi_filler = uint8(filler >> libc.Int32FromInt32(8)) lo_filler = uint8(filler) if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == PNG_COLOR_TYPE_GRAY { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if flags&uint32(0x0080) != uint32(0) { /* This changes the data from G to GX */ sp = row + uintptr(row_width) dp = sp + uintptr(row_width) i = uint32(1) for { if !(i < row_width) { break } dp-- v2 = dp *(*Tpng_byte)(unsafe.Pointer(v2)) = lo_filler dp-- v3 = dp sp-- v4 = sp *(*Tpng_byte)(unsafe.Pointer(v3)) = *(*Tpng_byte)(unsafe.Pointer(v4)) goto _1 _1: ; i++ } dp-- v5 = dp *(*Tpng_byte)(unsafe.Pointer(v5)) = lo_filler (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(2) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(16) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32(2) } else { /* This changes the data from G to XG */ sp1 = row + uintptr(row_width) dp1 = sp1 + uintptr(row_width) i = uint32(0) for { if !(i < row_width) { break } dp1-- v7 = dp1 sp1-- v8 = sp1 *(*Tpng_byte)(unsafe.Pointer(v7)) = *(*Tpng_byte)(unsafe.Pointer(v8)) dp1-- v9 = dp1 *(*Tpng_byte)(unsafe.Pointer(v9)) = lo_filler goto _6 _6: ; i++ } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(2) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(16) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32(2) } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { if flags&uint32(0x0080) != uint32(0) { /* This changes the data from GG to GGXX */ sp2 = row + uintptr(row_width*uint32(2)) dp2 = sp2 + uintptr(row_width*uint32(2)) i = uint32(1) for { if !(i < row_width) { break } dp2-- v11 = dp2 *(*Tpng_byte)(unsafe.Pointer(v11)) = lo_filler dp2-- v12 = dp2 *(*Tpng_byte)(unsafe.Pointer(v12)) = hi_filler dp2-- v13 = dp2 sp2-- v14 = sp2 *(*Tpng_byte)(unsafe.Pointer(v13)) = *(*Tpng_byte)(unsafe.Pointer(v14)) dp2-- v15 = dp2 sp2-- v16 = sp2 *(*Tpng_byte)(unsafe.Pointer(v15)) = *(*Tpng_byte)(unsafe.Pointer(v16)) goto _10 _10: ; i++ } dp2-- v17 = dp2 *(*Tpng_byte)(unsafe.Pointer(v17)) = lo_filler dp2-- v18 = dp2 *(*Tpng_byte)(unsafe.Pointer(v18)) = hi_filler (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(2) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(32) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32(4) } else { /* This changes the data from GG to XXGG */ sp3 = row + uintptr(row_width*uint32(2)) dp3 = sp3 + uintptr(row_width*uint32(2)) i = uint32(0) for { if !(i < row_width) { break } dp3-- v20 = dp3 sp3-- v21 = sp3 *(*Tpng_byte)(unsafe.Pointer(v20)) = *(*Tpng_byte)(unsafe.Pointer(v21)) dp3-- v22 = dp3 sp3-- v23 = sp3 *(*Tpng_byte)(unsafe.Pointer(v22)) = *(*Tpng_byte)(unsafe.Pointer(v23)) dp3-- v24 = dp3 *(*Tpng_byte)(unsafe.Pointer(v24)) = lo_filler dp3-- v25 = dp3 *(*Tpng_byte)(unsafe.Pointer(v25)) = hi_filler goto _19 _19: ; i++ } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(2) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(32) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32(4) } } } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if flags&uint32(0x0080) != uint32(0) { /* This changes the data from RGB to RGBX */ sp4 = row + uintptr(row_width*uint32(3)) dp4 = sp4 + uintptr(row_width) i = uint32(1) for { if !(i < row_width) { break } dp4-- v27 = dp4 *(*Tpng_byte)(unsafe.Pointer(v27)) = lo_filler dp4-- v28 = dp4 sp4-- v29 = sp4 *(*Tpng_byte)(unsafe.Pointer(v28)) = *(*Tpng_byte)(unsafe.Pointer(v29)) dp4-- v30 = dp4 sp4-- v31 = sp4 *(*Tpng_byte)(unsafe.Pointer(v30)) = *(*Tpng_byte)(unsafe.Pointer(v31)) dp4-- v32 = dp4 sp4-- v33 = sp4 *(*Tpng_byte)(unsafe.Pointer(v32)) = *(*Tpng_byte)(unsafe.Pointer(v33)) goto _26 _26: ; i++ } dp4-- v34 = dp4 *(*Tpng_byte)(unsafe.Pointer(v34)) = lo_filler (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(4) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(32) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32(4) } else { /* This changes the data from RGB to XRGB */ sp5 = row + uintptr(row_width*uint32(3)) dp5 = sp5 + uintptr(row_width) i = uint32(0) for { if !(i < row_width) { break } dp5-- v36 = dp5 sp5-- v37 = sp5 *(*Tpng_byte)(unsafe.Pointer(v36)) = *(*Tpng_byte)(unsafe.Pointer(v37)) dp5-- v38 = dp5 sp5-- v39 = sp5 *(*Tpng_byte)(unsafe.Pointer(v38)) = *(*Tpng_byte)(unsafe.Pointer(v39)) dp5-- v40 = dp5 sp5-- v41 = sp5 *(*Tpng_byte)(unsafe.Pointer(v40)) = *(*Tpng_byte)(unsafe.Pointer(v41)) dp5-- v42 = dp5 *(*Tpng_byte)(unsafe.Pointer(v42)) = lo_filler goto _35 _35: ; i++ } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(4) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(32) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32(4) } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { if flags&uint32(0x0080) != uint32(0) { /* This changes the data from RRGGBB to RRGGBBXX */ sp6 = row + uintptr(row_width*uint32(6)) dp6 = sp6 + uintptr(row_width*uint32(2)) i = uint32(1) for { if !(i < row_width) { break } dp6-- v44 = dp6 *(*Tpng_byte)(unsafe.Pointer(v44)) = lo_filler dp6-- v45 = dp6 *(*Tpng_byte)(unsafe.Pointer(v45)) = hi_filler dp6-- v46 = dp6 sp6-- v47 = sp6 *(*Tpng_byte)(unsafe.Pointer(v46)) = *(*Tpng_byte)(unsafe.Pointer(v47)) dp6-- v48 = dp6 sp6-- v49 = sp6 *(*Tpng_byte)(unsafe.Pointer(v48)) = *(*Tpng_byte)(unsafe.Pointer(v49)) dp6-- v50 = dp6 sp6-- v51 = sp6 *(*Tpng_byte)(unsafe.Pointer(v50)) = *(*Tpng_byte)(unsafe.Pointer(v51)) dp6-- v52 = dp6 sp6-- v53 = sp6 *(*Tpng_byte)(unsafe.Pointer(v52)) = *(*Tpng_byte)(unsafe.Pointer(v53)) dp6-- v54 = dp6 sp6-- v55 = sp6 *(*Tpng_byte)(unsafe.Pointer(v54)) = *(*Tpng_byte)(unsafe.Pointer(v55)) dp6-- v56 = dp6 sp6-- v57 = sp6 *(*Tpng_byte)(unsafe.Pointer(v56)) = *(*Tpng_byte)(unsafe.Pointer(v57)) goto _43 _43: ; i++ } dp6-- v58 = dp6 *(*Tpng_byte)(unsafe.Pointer(v58)) = lo_filler dp6-- v59 = dp6 *(*Tpng_byte)(unsafe.Pointer(v59)) = hi_filler (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(4) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(64) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32(8) } else { /* This changes the data from RRGGBB to XXRRGGBB */ sp7 = row + uintptr(row_width*uint32(6)) dp7 = sp7 + uintptr(row_width*uint32(2)) i = uint32(0) for { if !(i < row_width) { break } dp7-- v61 = dp7 sp7-- v62 = sp7 *(*Tpng_byte)(unsafe.Pointer(v61)) = *(*Tpng_byte)(unsafe.Pointer(v62)) dp7-- v63 = dp7 sp7-- v64 = sp7 *(*Tpng_byte)(unsafe.Pointer(v63)) = *(*Tpng_byte)(unsafe.Pointer(v64)) dp7-- v65 = dp7 sp7-- v66 = sp7 *(*Tpng_byte)(unsafe.Pointer(v65)) = *(*Tpng_byte)(unsafe.Pointer(v66)) dp7-- v67 = dp7 sp7-- v68 = sp7 *(*Tpng_byte)(unsafe.Pointer(v67)) = *(*Tpng_byte)(unsafe.Pointer(v68)) dp7-- v69 = dp7 sp7-- v70 = sp7 *(*Tpng_byte)(unsafe.Pointer(v69)) = *(*Tpng_byte)(unsafe.Pointer(v70)) dp7-- v71 = dp7 sp7-- v72 = sp7 *(*Tpng_byte)(unsafe.Pointer(v71)) = *(*Tpng_byte)(unsafe.Pointer(v72)) dp7-- v73 = dp7 *(*Tpng_byte)(unsafe.Pointer(v73)) = lo_filler dp7-- v74 = dp7 *(*Tpng_byte)(unsafe.Pointer(v74)) = hi_filler goto _60 _60: ; i++ } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(4) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(64) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32(8) } } } } } /* COLOR_TYPE == RGB */ } // C documentation // // /* Expand grayscale files to RGB, with or without alpha */ func _png_do_gray_to_rgb(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var dp, dp1, dp2, dp3, sp, sp1, sp2, sp3, v10, v11, v12, v13, v14, v16, v17, v18, v19, v2, v20, v21, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v4, v5, v7, v8, v9 Tpng_bytep var i, row_width Tpng_uint_32 var v36 uint32 var p35 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, dp1, dp2, dp3, i, row_width, sp, sp1, sp2, sp3, v10, v11, v12, v13, v14, v16, v17, v18, v19, v2, v20, v21, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v36, v4, v5, v7, v8, v9, p35 row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) >= int32(8) && libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) == 0 { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == PNG_COLOR_TYPE_GRAY { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { /* This changes G to RGB */ sp = row + uintptr(row_width) - uintptr(1) dp = sp + uintptr(row_width*uint32(2)) i = uint32(0) for { if !(i < row_width) { break } v2 = dp dp-- *(*Tpng_byte)(unsafe.Pointer(v2)) = *(*Tpng_byte)(unsafe.Pointer(sp)) v3 = dp dp-- *(*Tpng_byte)(unsafe.Pointer(v3)) = *(*Tpng_byte)(unsafe.Pointer(sp)) v4 = dp dp-- v5 = sp sp-- *(*Tpng_byte)(unsafe.Pointer(v4)) = *(*Tpng_byte)(unsafe.Pointer(v5)) goto _1 _1: ; i++ } } else { /* This changes GG to RRGGBB */ sp1 = row + uintptr(row_width*uint32(2)) - uintptr(1) dp1 = sp1 + uintptr(row_width*uint32(4)) i = uint32(0) for { if !(i < row_width) { break } v7 = dp1 dp1-- *(*Tpng_byte)(unsafe.Pointer(v7)) = *(*Tpng_byte)(unsafe.Pointer(sp1)) v8 = dp1 dp1-- *(*Tpng_byte)(unsafe.Pointer(v8)) = *(*Tpng_byte)(unsafe.Pointer(sp1 - libc.UintptrFromInt32(1))) v9 = dp1 dp1-- *(*Tpng_byte)(unsafe.Pointer(v9)) = *(*Tpng_byte)(unsafe.Pointer(sp1)) v10 = dp1 dp1-- *(*Tpng_byte)(unsafe.Pointer(v10)) = *(*Tpng_byte)(unsafe.Pointer(sp1 - libc.UintptrFromInt32(1))) v11 = dp1 dp1-- v12 = sp1 sp1-- *(*Tpng_byte)(unsafe.Pointer(v11)) = *(*Tpng_byte)(unsafe.Pointer(v12)) v13 = dp1 dp1-- v14 = sp1 sp1-- *(*Tpng_byte)(unsafe.Pointer(v13)) = *(*Tpng_byte)(unsafe.Pointer(v14)) goto _6 _6: ; i++ } } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { /* This changes GA to RGBA */ sp2 = row + uintptr(row_width*uint32(2)) - uintptr(1) dp2 = sp2 + uintptr(row_width*uint32(2)) i = uint32(0) for { if !(i < row_width) { break } v16 = dp2 dp2-- v17 = sp2 sp2-- *(*Tpng_byte)(unsafe.Pointer(v16)) = *(*Tpng_byte)(unsafe.Pointer(v17)) v18 = dp2 dp2-- *(*Tpng_byte)(unsafe.Pointer(v18)) = *(*Tpng_byte)(unsafe.Pointer(sp2)) v19 = dp2 dp2-- *(*Tpng_byte)(unsafe.Pointer(v19)) = *(*Tpng_byte)(unsafe.Pointer(sp2)) v20 = dp2 dp2-- v21 = sp2 sp2-- *(*Tpng_byte)(unsafe.Pointer(v20)) = *(*Tpng_byte)(unsafe.Pointer(v21)) goto _15 _15: ; i++ } } else { /* This changes GGAA to RRGGBBAA */ sp3 = row + uintptr(row_width*uint32(4)) - uintptr(1) dp3 = sp3 + uintptr(row_width*uint32(4)) i = uint32(0) for { if !(i < row_width) { break } v23 = dp3 dp3-- v24 = sp3 sp3-- *(*Tpng_byte)(unsafe.Pointer(v23)) = *(*Tpng_byte)(unsafe.Pointer(v24)) v25 = dp3 dp3-- v26 = sp3 sp3-- *(*Tpng_byte)(unsafe.Pointer(v25)) = *(*Tpng_byte)(unsafe.Pointer(v26)) v27 = dp3 dp3-- *(*Tpng_byte)(unsafe.Pointer(v27)) = *(*Tpng_byte)(unsafe.Pointer(sp3)) v28 = dp3 dp3-- *(*Tpng_byte)(unsafe.Pointer(v28)) = *(*Tpng_byte)(unsafe.Pointer(sp3 - libc.UintptrFromInt32(1))) v29 = dp3 dp3-- *(*Tpng_byte)(unsafe.Pointer(v29)) = *(*Tpng_byte)(unsafe.Pointer(sp3)) v30 = dp3 dp3-- *(*Tpng_byte)(unsafe.Pointer(v30)) = *(*Tpng_byte)(unsafe.Pointer(sp3 - libc.UintptrFromInt32(1))) v31 = dp3 dp3-- v32 = sp3 sp3-- *(*Tpng_byte)(unsafe.Pointer(v31)) = *(*Tpng_byte)(unsafe.Pointer(v32)) v33 = dp3 dp3-- v34 = sp3 sp3-- *(*Tpng_byte)(unsafe.Pointer(v33)) = *(*Tpng_byte)(unsafe.Pointer(v34)) goto _22 _22: ; i++ } } } } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) + libc.Int32FromInt32(2)) p35 = row_info + 8 *(*Tpng_byte)(unsafe.Pointer(p35)) = Tpng_byte(int32(*(*Tpng_byte)(unsafe.Pointer(p35))) | libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) * libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth)) if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >= int32(8) { v36 = row_width * (uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v36 = (row_width*uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = v36 } } // C documentation // // /* Reduce RGB files to grayscale, with or without alpha // * using the equation given in Poynton's ColorFAQ of 1998-01-04 at // * (THIS LINK IS DEAD June 2008 but // * versions dated 1998 through November 2002 have been archived at // * https://web.archive.org/web/20000816232553/www.inforamp.net/ // * ~poynton/notes/colour_and_gamma/ColorFAQ.txt ) // * Charles Poynton poynton at poynton.com // * // * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B // * // * which can be expressed with integers as // * // * Y = (6969 * R + 23434 * G + 2365 * B)/32768 // * // * Poynton's current link (as of January 2003 through July 2011): // * // * has changed the numbers slightly: // * // * Y = 0.2126*R + 0.7152*G + 0.0722*B // * // * which can be expressed with integers as // * // * Y = (6966 * R + 23436 * G + 2366 * B)/32768 // * // * Historically, however, libpng uses numbers derived from the ITU-R Rec 709 // * end point chromaticities and the D65 white point. Depending on the // * precision used for the D65 white point this produces a variety of different // * numbers, however if the four decimal place value used in ITU-R Rec 709 is // * used (0.3127,0.3290) the Y calculation would be: // * // * Y = (6968 * R + 23435 * G + 2366 * B)/32768 // * // * While this is correct the rounding results in an overflow for white, because // * the sum of the rounded coefficients is 32769, not 32768. Consequently // * libpng uses, instead, the closest non-overflowing approximation: // * // * Y = (6968 * R + 23434 * G + 2366 * B)/32768 // * // * Starting with libpng-1.5.5, if the image being converted has a cHRM chunk // * (including an sRGB chunk) then the chromaticities are used to calculate the // * coefficients. See the chunk handling in pngrutil.c for more information. // * // * In all cases the calculation is to be done in a linear colorspace. If no // * gamma information is available to correct the encoding of the original RGB // * values this results in an implicit assumption that the original PNG RGB // * values were linear. // * // * Other integer coefficients can be used via png_set_rgb_to_gray(). Because // * the API takes just red and green coefficients the blue coefficient is // * calculated to make the sum 32768. This will result in different rounding // * to that used above. // */ func _png_do_rgb_to_gray(tls *libc.TLS, png_ptr Tpng_structrp, row_info Tpng_row_infop, row Tpng_bytep) (r int32) { var bc, gc, i, i1, i2, i3, rc, row_width Tpng_uint_32 var blue, blue1, green, green1, hi, hi1, lo, lo1, red, red1 Tpng_byte var blue2, blue3, blue_1, gray16, gray161, green2, green3, green_1, red2, red3, red_1, w Tpng_uint_16 var dp, dp1, dp2, dp3, sp, sp1, sp2, sp3, v10, v11, v12, v13, v14, v15, v16, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v5, v6, v7, v8 Tpng_bytep var have_alpha, rgb_error int32 var v43 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bc, blue, blue1, blue2, blue3, blue_1, dp, dp1, dp2, dp3, gc, gray16, gray161, green, green1, green2, green3, green_1, have_alpha, hi, hi1, i, i1, i2, i3, lo, lo1, rc, red, red1, red2, red3, red_1, rgb_error, row_width, sp, sp1, sp2, sp3, w, v10, v11, v12, v13, v14, v15, v16, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v5, v6, v7, v8 rgb_error = 0 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_PALETTE) == 0 && libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { rc = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_red_coeff) gc = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_green_coeff) bc = uint32(32768) - rc - gc row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth have_alpha = libc.BoolInt32(libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0) if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { /* Notice that gamma to/from 1 are not necessarily inverses (if * there is an overall gamma correction). Prior to 1.5.5 this code * checked the linearized values for equality; this doesn't match * the documentation, the original values must be checked. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_from_1 != libc.UintptrFromInt32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 != libc.UintptrFromInt32(0) { sp = row dp = row i = uint32(0) for { if !(i < row_width) { break } v2 = sp sp++ red = *(*Tpng_byte)(unsafe.Pointer(v2)) v3 = sp sp++ green = *(*Tpng_byte)(unsafe.Pointer(v3)) v4 = sp sp++ blue = *(*Tpng_byte)(unsafe.Pointer(v4)) if libc.Int32FromUint8(red) != libc.Int32FromUint8(green) || libc.Int32FromUint8(red) != libc.Int32FromUint8(blue) { red = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 + uintptr(red))) green = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 + uintptr(green))) blue = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 + uintptr(blue))) rgb_error |= int32(1) v5 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v5)) = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_from_1 + uintptr((rc*uint32(red)+gc*uint32(green)+bc*uint32(blue)+uint32(16384))>>int32(15)))) } else { /* If there is no overall correction the table will not be * set. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table != libc.UintptrFromInt32(0) { red = *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table + uintptr(red))) } v6 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v6)) = red } if have_alpha != 0 { v7 = dp dp++ v8 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v7)) = *(*Tpng_byte)(unsafe.Pointer(v8)) } goto _1 _1: ; i++ } } else { sp1 = row dp1 = row i1 = uint32(0) for { if !(i1 < row_width) { break } v10 = sp1 sp1++ red1 = *(*Tpng_byte)(unsafe.Pointer(v10)) v11 = sp1 sp1++ green1 = *(*Tpng_byte)(unsafe.Pointer(v11)) v12 = sp1 sp1++ blue1 = *(*Tpng_byte)(unsafe.Pointer(v12)) if libc.Int32FromUint8(red1) != libc.Int32FromUint8(green1) || libc.Int32FromUint8(red1) != libc.Int32FromUint8(blue1) { rgb_error |= int32(1) /* NOTE: this is the historical approach which simply * truncates the results. */ v13 = dp1 dp1++ *(*Tpng_byte)(unsafe.Pointer(v13)) = uint8((rc*uint32(red1) + gc*uint32(green1) + bc*uint32(blue1)) >> libc.Int32FromInt32(15)) } else { v14 = dp1 dp1++ *(*Tpng_byte)(unsafe.Pointer(v14)) = red1 } if have_alpha != 0 { v15 = dp1 dp1++ v16 = sp1 sp1++ *(*Tpng_byte)(unsafe.Pointer(v15)) = *(*Tpng_byte)(unsafe.Pointer(v16)) } goto _9 _9: ; i1++ } } } else { /* RGB bit_depth == 16 */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_to_1 != libc.UintptrFromInt32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_from_1 != libc.UintptrFromInt32(0) { sp2 = row dp2 = row i2 = uint32(0) for { if !(i2 < row_width) { break } v18 = sp2 sp2++ hi = *(*Tpng_byte)(unsafe.Pointer(v18)) v19 = sp2 sp2++ lo = *(*Tpng_byte)(unsafe.Pointer(v19)) red2 = libc.Uint16FromInt32(libc.Int32FromUint8(hi)<>(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift)*4)) + uintptr(libc.Int32FromUint16(red2)>>int32(8))*2)) } else { w = red2 } } else { red_1 = *(*Tpng_uint_16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_to_1 + uintptr(libc.Int32FromUint16(red2)&int32(0xff)>>(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift)*4)) + uintptr(libc.Int32FromUint16(red2)>>int32(8))*2)) green_1 = *(*Tpng_uint_16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_to_1 + uintptr(libc.Int32FromUint16(green2)&int32(0xff)>>(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift)*4)) + uintptr(libc.Int32FromUint16(green2)>>int32(8))*2)) blue_1 = *(*Tpng_uint_16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_to_1 + uintptr(libc.Int32FromUint16(blue2)&int32(0xff)>>(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift)*4)) + uintptr(libc.Int32FromUint16(blue2)>>int32(8))*2)) gray16 = uint16((rc*uint32(red_1) + gc*uint32(green_1) + bc*uint32(blue_1) + libc.Uint32FromInt32(16384)) >> libc.Int32FromInt32(15)) w = *(*Tpng_uint_16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_from_1 + uintptr(libc.Int32FromUint16(gray16)&int32(0xff)>>(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift)*4)) + uintptr(libc.Int32FromUint16(gray16)>>int32(8))*2)) rgb_error |= int32(1) } v24 = dp2 dp2++ *(*Tpng_byte)(unsafe.Pointer(v24)) = libc.Uint8FromInt32(libc.Int32FromUint16(w) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) v25 = dp2 dp2++ *(*Tpng_byte)(unsafe.Pointer(v25)) = libc.Uint8FromInt32(libc.Int32FromUint16(w) & libc.Int32FromInt32(0xff)) if have_alpha != 0 { v26 = dp2 dp2++ v27 = sp2 sp2++ *(*Tpng_byte)(unsafe.Pointer(v26)) = *(*Tpng_byte)(unsafe.Pointer(v27)) v28 = dp2 dp2++ v29 = sp2 sp2++ *(*Tpng_byte)(unsafe.Pointer(v28)) = *(*Tpng_byte)(unsafe.Pointer(v29)) } goto _17 _17: ; i2++ } } else { sp3 = row dp3 = row i3 = uint32(0) for { if !(i3 < row_width) { break } v31 = sp3 sp3++ hi1 = *(*Tpng_byte)(unsafe.Pointer(v31)) v32 = sp3 sp3++ lo1 = *(*Tpng_byte)(unsafe.Pointer(v32)) red3 = libc.Uint16FromInt32(libc.Int32FromUint8(hi1)<> libc.Int32FromInt32(15)) v37 = dp3 dp3++ *(*Tpng_byte)(unsafe.Pointer(v37)) = libc.Uint8FromInt32(libc.Int32FromUint16(gray161) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) v38 = dp3 dp3++ *(*Tpng_byte)(unsafe.Pointer(v38)) = libc.Uint8FromInt32(libc.Int32FromUint16(gray161) & libc.Int32FromInt32(0xff)) if have_alpha != 0 { v39 = dp3 dp3++ v40 = sp3 sp3++ *(*Tpng_byte)(unsafe.Pointer(v39)) = *(*Tpng_byte)(unsafe.Pointer(v40)) v41 = dp3 dp3++ v42 = sp3 sp3++ *(*Tpng_byte)(unsafe.Pointer(v41)) = *(*Tpng_byte)(unsafe.Pointer(v42)) } goto _30 _30: ; i3++ } } } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) - libc.Int32FromInt32(2)) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) & ^libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) * libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth)) if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >= int32(8) { v43 = row_width * (uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v43 = (row_width*uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = v43 } return rgb_error } // C documentation // // /* Replace any alpha or transparency with the supplied background color. // * "background" is already in the screen gamma, while "background_1" is // * at a gamma of 1.0. Paletted files have already been taken care of. // */ func _png_do_compose(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, png_ptr Tpng_structrp) { var a, a2, a3, a6, a7, b, b1, b2, g2, g3, g4, g5, g6, r, r1, r2, temp, temp1, temp4, temp5, temp6, temp7, temp8, temp9, v, v1, v10, v2, v4, v5, v6, v8, v9, w1, w3 Tpng_uint_16 var a1, a4, a5, v3, v7, w, w2 Tpng_byte var g, g1, p, p1, tmp, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6 uint32 var gamma_16, gamma_16_from_1, gamma_16_to_1 Tpng_const_uint_16pp var gamma_from_1, gamma_table, gamma_to_1 Tpng_const_bytep var gamma_shift, optimize, shift int32 var i, row_width, temp10, temp11, temp12, temp13, temp14, temp15, temp2, temp3 Tpng_uint_32 var sp Tpng_bytep _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, a1, a2, a3, a4, a5, a6, a7, b, b1, b2, g, g1, g2, g3, g4, g5, g6, gamma_16, gamma_16_from_1, gamma_16_to_1, gamma_from_1, gamma_shift, gamma_table, gamma_to_1, i, optimize, p, p1, r, r1, r2, row_width, shift, sp, temp, temp1, temp10, temp11, temp12, temp13, temp14, temp15, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9, tmp, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, v, v1, v10, v2, v3, v4, v5, v6, v7, v8, v9, w, w1, w2, w3 gamma_table = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table gamma_from_1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_from_1 gamma_to_1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_to_1 gamma_16 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_table gamma_16_from_1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_from_1 gamma_16_to_1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_to_1 gamma_shift = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift optimize = libc.BoolInt32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x2000) != uint32(0)) row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth switch libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) { case PNG_COLOR_TYPE_GRAY: switch libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) { case int32(1): sp = row shift = int32(7) i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))>>shift&libc.Int32FromInt32(0x01))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgray) { tmp = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & (int32(0x7f7f) >> (int32(7) - shift))) tmp |= libc.Uint32FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) << shift) *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8(tmp & libc.Uint32FromInt32(0xff)) } if shift == 0 { shift = int32(7) sp++ } else { shift-- } goto _1 _1: ; i++ } case int32(2): if gamma_table != libc.UintptrFromInt32(0) { sp = row shift = int32(6) i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))>>shift&libc.Int32FromInt32(0x03))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgray) { tmp1 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & (int32(0x3f3f) >> (int32(6) - shift))) tmp1 |= uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) << shift *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8(tmp1 & libc.Uint32FromInt32(0xff)) } else { p = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) >> shift & int32(0x03)) g = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(p|p<> int32(6) & int32(0x03)) tmp2 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & (int32(0x3f3f) >> (int32(6) - shift))) tmp2 |= g << shift *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8(tmp2 & libc.Uint32FromInt32(0xff)) } if shift == 0 { shift = int32(6) sp++ } else { shift -= int32(2) } goto _2 _2: ; i++ } } else { sp = row shift = int32(6) i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))>>shift&libc.Int32FromInt32(0x03))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgray) { tmp3 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & (int32(0x3f3f) >> (int32(6) - shift))) tmp3 |= uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) << shift *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8(tmp3 & libc.Uint32FromInt32(0xff)) } if shift == 0 { shift = int32(6) sp++ } else { shift -= int32(2) } goto _3 _3: ; i++ } } case int32(4): if gamma_table != libc.UintptrFromInt32(0) { sp = row shift = int32(4) i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))>>shift&libc.Int32FromInt32(0x0f))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgray) { tmp4 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & (int32(0x0f0f) >> (int32(4) - shift))) tmp4 |= libc.Uint32FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) << shift) *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8(tmp4 & libc.Uint32FromInt32(0xff)) } else { p1 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) >> shift & int32(0x0f)) g1 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(p1|p1<> int32(4) & int32(0x0f)) tmp5 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & (int32(0x0f0f) >> (int32(4) - shift))) tmp5 |= g1 << shift *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8(tmp5 & libc.Uint32FromInt32(0xff)) } if shift == 0 { shift = int32(4) sp++ } else { shift -= int32(4) } goto _4 _4: ; i++ } } else { sp = row shift = int32(4) i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))>>shift&libc.Int32FromInt32(0x0f))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgray) { tmp6 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & (int32(0x0f0f) >> (int32(4) - shift))) tmp6 |= libc.Uint32FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) << shift) *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8(tmp6 & libc.Uint32FromInt32(0xff)) } if shift == 0 { shift = int32(4) sp++ } else { shift -= int32(4) } goto _5 _5: ; i++ } } case int32(8): if gamma_table != libc.UintptrFromInt32(0) { sp = row i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgray) { *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) } else { *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) } goto _6 _6: ; i++ sp++ } } else { sp = row i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgray) { *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) } goto _7 _7: ; i++ sp++ } } case int32(16): if gamma_16 != libc.UintptrFromInt32(0) { sp = row i = uint32(0) for { if !(i < row_width) { break } v = libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))<> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) & libc.Int32FromInt32(0xff)) } else { v = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v) & libc.Int32FromInt32(0xff)) } goto _8 _8: ; i++ sp += uintptr(2) } } else { sp = row i = uint32(0) for { if !(i < row_width) { break } v1 = libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))<> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) & libc.Int32FromInt32(0xff)) } goto _9 _9: ; i++ sp += uintptr(2) } } default: break } case int32(PNG_COLOR_MASK_COLOR): if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if gamma_table != libc.UintptrFromInt32(0) { sp = row i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fred) && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1)))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgreen) && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2)))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fblue) { *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) } else { *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1)))))) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2)))))) } goto _10 _10: ; i++ sp += uintptr(3) } } else { sp = row i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fred) && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1)))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fgreen) && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2)))) == libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_color.Fblue) { *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) } goto _11 _11: ; i++ sp += uintptr(3) } } } else { /* if (row_info->bit_depth == 16) */ if gamma_16 != libc.UintptrFromInt32(0) { sp = row i = uint32(0) for { if !(i < row_width) { break } r = libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))<> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) & libc.Int32FromInt32(0xff)) } else { v2 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v2) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v2) & libc.Int32FromInt32(0xff)) v2 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))))*2)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = libc.Uint8FromInt32(libc.Int32FromUint16(v2) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))) = libc.Uint8FromInt32(libc.Int32FromUint16(v2) & libc.Int32FromInt32(0xff)) v2 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))))*2)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))) = libc.Uint8FromInt32(libc.Int32FromUint16(v2) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))) = libc.Uint8FromInt32(libc.Int32FromUint16(v2) & libc.Int32FromInt32(0xff)) } goto _12 _12: ; i++ sp += uintptr(6) } } else { sp = row i = uint32(0) for { if !(i < row_width) { break } r1 = libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))<> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) & libc.Int32FromInt32(0xff)) } goto _13 _13: ; i++ sp += uintptr(6) } } } case int32(PNG_COLOR_MASK_ALPHA): if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if gamma_to_1 != libc.UintptrFromInt32(0) && gamma_from_1 != libc.UintptrFromInt32(0) && gamma_table != libc.UintptrFromInt32(0) { sp = row i = uint32(0) for { if !(i < row_width) { break } a = uint16(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1)))) if libc.Int32FromUint16(a) == int32(0xff) { *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) } else { if libc.Int32FromUint16(a) == 0 { /* Background is already in screen gamma */ *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) } else { v3 = *(*Tpng_byte)(unsafe.Pointer(gamma_to_1 + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) temp = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(v3))*libc.Int32FromUint16(a) + libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fgray)*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(a))) + libc.Int32FromInt32(128)) w = libc.Uint8FromInt32((libc.Int32FromUint16(temp) + libc.Int32FromUint16(temp)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) if optimize == 0 { w = *(*Tpng_byte)(unsafe.Pointer(gamma_from_1 + uintptr(w))) } *(*Tpng_byte)(unsafe.Pointer(sp)) = w } } goto _14 _14: ; i++ sp += uintptr(2) } } else { sp = row i = uint32(0) for { if !(i < row_width) { break } a1 = *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) if libc.Int32FromUint8(a1) == 0 { *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) } else { if libc.Int32FromUint8(a1) < int32(0xff) { temp1 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer(sp))))*libc.Int32FromUint16(uint16(a1)) + libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray)*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(a1)))) + libc.Int32FromInt32(128)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32((libc.Int32FromUint16(temp1) + libc.Int32FromUint16(temp1)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) } } goto _15 _15: ; i++ sp += uintptr(2) } } } else { /* if (png_ptr->bit_depth == 16) */ if gamma_16 != libc.UintptrFromInt32(0) && gamma_16_from_1 != libc.UintptrFromInt32(0) && gamma_16_to_1 != libc.UintptrFromInt32(0) { sp = row i = uint32(0) for { if !(i < row_width) { break } a2 = libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))))<>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v4) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v4) & libc.Int32FromInt32(0xff)) } else { if libc.Int32FromUint16(a2) == 0 { /* Background is already in screen gamma */ *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) & libc.Int32FromInt32(0xff)) } else { g4 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_to_1 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) temp2 = uint32(g4)*uint32(a2) + uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fgray)*(libc.Uint32FromInt32(65535)-uint32(a2)) + libc.Uint32FromInt32(32768) v5 = uint16(libc.Uint32FromInt32(0xffff) & ((temp2 + temp2>>libc.Int32FromInt32(16)) >> libc.Int32FromInt32(16))) if optimize != 0 { w1 = v5 } else { w1 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_from_1 + uintptr(libc.Int32FromUint16(v5)&int32(0xff)>>gamma_shift)*4)) + uintptr(libc.Int32FromUint16(v5)>>int32(8))*2)) } *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(w1) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(w1) & libc.Int32FromInt32(0xff)) } } goto _16 _16: ; i++ sp += uintptr(4) } } else { sp = row i = uint32(0) for { if !(i < row_width) { break } a3 = libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))))<> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgray) & libc.Int32FromInt32(0xff)) } else { if libc.Int32FromUint16(a3) < int32(0xffff) { g5 = libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))<>libc.Int32FromInt32(16)) >> libc.Int32FromInt32(16))) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v6) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v6) & libc.Int32FromInt32(0xff)) } } goto _17 _17: ; i++ sp += uintptr(4) } } } case libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA): if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if gamma_to_1 != libc.UintptrFromInt32(0) && gamma_from_1 != libc.UintptrFromInt32(0) && gamma_table != libc.UintptrFromInt32(0) { sp = row i = uint32(0) for { if !(i < row_width) { break } a4 = *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))) if libc.Int32FromUint8(a4) == int32(0xff) { *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1)))))) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2)))))) } else { if libc.Int32FromUint8(a4) == 0 { /* Background is already in screen gamma */ *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) } else { v7 = *(*Tpng_byte)(unsafe.Pointer(gamma_to_1 + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) temp4 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(v7))*libc.Int32FromUint16(uint16(a4)) + libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fred)*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(a4)))) + libc.Int32FromInt32(128)) w2 = libc.Uint8FromInt32((libc.Int32FromUint16(temp4) + libc.Int32FromUint16(temp4)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) if optimize == 0 { w2 = *(*Tpng_byte)(unsafe.Pointer(gamma_from_1 + uintptr(w2))) } *(*Tpng_byte)(unsafe.Pointer(sp)) = w2 v7 = *(*Tpng_byte)(unsafe.Pointer(gamma_to_1 + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1)))))) temp5 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(v7))*libc.Int32FromUint16(uint16(a4)) + libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fgreen)*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(a4)))) + libc.Int32FromInt32(128)) w2 = libc.Uint8FromInt32((libc.Int32FromUint16(temp5) + libc.Int32FromUint16(temp5)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) if optimize == 0 { w2 = *(*Tpng_byte)(unsafe.Pointer(gamma_from_1 + uintptr(w2))) } *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = w2 v7 = *(*Tpng_byte)(unsafe.Pointer(gamma_to_1 + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2)))))) temp6 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(v7))*libc.Int32FromUint16(uint16(a4)) + libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fblue)*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(a4)))) + libc.Int32FromInt32(128)) w2 = libc.Uint8FromInt32((libc.Int32FromUint16(temp6) + libc.Int32FromUint16(temp6)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) if optimize == 0 { w2 = *(*Tpng_byte)(unsafe.Pointer(gamma_from_1 + uintptr(w2))) } *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = w2 } } goto _18 _18: ; i++ sp += uintptr(4) } } else { sp = row i = uint32(0) for { if !(i < row_width) { break } a5 = *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))) if libc.Int32FromUint8(a5) == 0 { *(*Tpng_byte)(unsafe.Pointer(sp)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) } else { if libc.Int32FromUint8(a5) < int32(0xff) { temp7 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer(sp))))*libc.Int32FromUint16(uint16(a5)) + libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred)*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(a5)))) + libc.Int32FromInt32(128)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32((libc.Int32FromUint16(temp7) + libc.Int32FromUint16(temp7)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) temp8 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1)))))*libc.Int32FromUint16(uint16(a5)) + libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen)*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(a5)))) + libc.Int32FromInt32(128)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32((libc.Int32FromUint16(temp8) + libc.Int32FromUint16(temp8)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) temp9 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2)))))*libc.Int32FromUint16(uint16(a5)) + libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue)*libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint16(uint16(a5)))) + libc.Int32FromInt32(128)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = libc.Uint8FromInt32((libc.Int32FromUint16(temp9) + libc.Int32FromUint16(temp9)>>libc.Int32FromInt32(8)) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) } } goto _19 _19: ; i++ sp += uintptr(4) } } } else { /* if (row_info->bit_depth == 16) */ if gamma_16 != libc.UintptrFromInt32(0) && gamma_16_from_1 != libc.UintptrFromInt32(0) && gamma_16_to_1 != libc.UintptrFromInt32(0) { sp = row i = uint32(0) for { if !(i < row_width) { break } a6 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(6)))))<>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v8) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v8) & libc.Int32FromInt32(0xff)) v8 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))))*2)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = libc.Uint8FromInt32(libc.Int32FromUint16(v8) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))) = libc.Uint8FromInt32(libc.Int32FromUint16(v8) & libc.Int32FromInt32(0xff)) v8 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))))*2)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))) = libc.Uint8FromInt32(libc.Int32FromUint16(v8) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))) = libc.Uint8FromInt32(libc.Int32FromUint16(v8) & libc.Int32FromInt32(0xff)) } else { if libc.Int32FromUint16(a6) == 0 { /* Background is already in screen gamma */ *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) & libc.Int32FromInt32(0xff)) } else { v9 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_to_1 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) temp10 = uint32(v9)*uint32(a6) + uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fred)*(libc.Uint32FromInt32(65535)-uint32(a6)) + libc.Uint32FromInt32(32768) w3 = uint16(libc.Uint32FromInt32(0xffff) & ((temp10 + temp10>>libc.Int32FromInt32(16)) >> libc.Int32FromInt32(16))) if optimize == 0 { w3 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_from_1 + uintptr(libc.Int32FromUint16(w3)&libc.Int32FromInt32(0xff)>>gamma_shift)*4)) + uintptr(libc.Int32FromUint16(w3)>>int32(8))*2)) } *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(w3) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(w3) & libc.Int32FromInt32(0xff)) v9 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_to_1 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))))*2)) temp11 = uint32(v9)*uint32(a6) + uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fgreen)*(libc.Uint32FromInt32(65535)-uint32(a6)) + libc.Uint32FromInt32(32768) w3 = uint16(libc.Uint32FromInt32(0xffff) & ((temp11 + temp11>>libc.Int32FromInt32(16)) >> libc.Int32FromInt32(16))) if optimize == 0 { w3 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_from_1 + uintptr(libc.Int32FromUint16(w3)&libc.Int32FromInt32(0xff)>>gamma_shift)*4)) + uintptr(libc.Int32FromUint16(w3)>>int32(8))*2)) } *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = libc.Uint8FromInt32(libc.Int32FromUint16(w3) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))) = libc.Uint8FromInt32(libc.Int32FromUint16(w3) & libc.Int32FromInt32(0xff)) v9 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_to_1 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))))*2)) temp12 = uint32(v9)*uint32(a6) + uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground_1.Fblue)*(libc.Uint32FromInt32(65535)-uint32(a6)) + libc.Uint32FromInt32(32768) w3 = uint16(libc.Uint32FromInt32(0xffff) & ((temp12 + temp12>>libc.Int32FromInt32(16)) >> libc.Int32FromInt32(16))) if optimize == 0 { w3 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_from_1 + uintptr(libc.Int32FromUint16(w3)&libc.Int32FromInt32(0xff)>>gamma_shift)*4)) + uintptr(libc.Int32FromUint16(w3)>>int32(8))*2)) } *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))) = libc.Uint8FromInt32(libc.Int32FromUint16(w3) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))) = libc.Uint8FromInt32(libc.Int32FromUint16(w3) & libc.Int32FromInt32(0xff)) } } goto _20 _20: ; i++ sp += uintptr(8) } } else { sp = row i = uint32(0) for { if !(i < row_width) { break } a7 = libc.Uint16FromInt32(libc.Int32FromUint16(uint16(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(6)))))<> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fred) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue) & libc.Int32FromInt32(0xff)) } else { if libc.Int32FromUint16(a7) < int32(0xffff) { r2 = libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))<>libc.Int32FromInt32(16)) >> libc.Int32FromInt32(16))) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v10) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v10) & libc.Int32FromInt32(0xff)) temp14 = uint32(g6)*uint32(a7) + uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fgreen)*(libc.Uint32FromInt32(65535)-uint32(a7)) + libc.Uint32FromInt32(32768) v10 = uint16(libc.Uint32FromInt32(0xffff) & ((temp14 + temp14>>libc.Int32FromInt32(16)) >> libc.Int32FromInt32(16))) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(2))) = libc.Uint8FromInt32(libc.Int32FromUint16(v10) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(3))) = libc.Uint8FromInt32(libc.Int32FromUint16(v10) & libc.Int32FromInt32(0xff)) temp15 = uint32(b2)*uint32(a7) + uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbackground.Fblue)*(libc.Uint32FromInt32(65535)-uint32(a7)) + libc.Uint32FromInt32(32768) v10 = uint16(libc.Uint32FromInt32(0xffff) & ((temp15 + temp15>>libc.Int32FromInt32(16)) >> libc.Int32FromInt32(16))) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(4))) = libc.Uint8FromInt32(libc.Int32FromUint16(v10) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(5))) = libc.Uint8FromInt32(libc.Int32FromUint16(v10) & libc.Int32FromInt32(0xff)) } } goto _21 _21: ; i++ sp += uintptr(8) } } } default: break } } // C documentation // // /* Gamma correct the image, avoiding the alpha channel. Make sure // * you do this after you deal with the transparency issue on grayscale // * or RGB images. If your bit depth is 8, use gamma_table, if it // * is 16, use gamma_16_table and gamma_shift. Build these with // * build_gamma_table(). // */ func _png_do_gamma(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, png_ptr Tpng_structrp) { var a, b, c, d, gamma_shift, lsb, msb int32 var gamma_16_table Tpng_const_uint_16pp var gamma_table Tpng_const_bytep var i, row_width Tpng_uint_32 var sp Tpng_bytep var v, v1, v2, v3 Tpng_uint_16 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, b, c, d, gamma_16_table, gamma_shift, gamma_table, i, lsb, msb, row_width, sp, v, v1, v2, v3 gamma_table = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_table gamma_16_table = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_table gamma_shift = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) <= int32(8) && gamma_table != libc.UintptrFromInt32(0) || libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) && gamma_16_table != libc.UintptrFromInt32(0) { switch libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) { case int32(PNG_COLOR_MASK_COLOR): if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { sp = row i = uint32(0) for { if !(i < row_width) { break } *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) sp++ *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) sp++ *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) sp++ goto _1 _1: ; i++ } } else { /* if (row_info->bit_depth == 16) */ sp = row i = uint32(0) for { if !(i < row_width) { break } v = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_table + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v) & libc.Int32FromInt32(0xff)) sp += uintptr(2) v = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_table + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v) & libc.Int32FromInt32(0xff)) sp += uintptr(2) v = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_table + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v) & libc.Int32FromInt32(0xff)) sp += uintptr(2) goto _2 _2: ; i++ } } case libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA): if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { sp = row i = uint32(0) for { if !(i < row_width) { break } *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) sp++ *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) sp++ *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) sp++ sp++ goto _3 _3: ; i++ } } else { /* if (row_info->bit_depth == 16) */ sp = row i = uint32(0) for { if !(i < row_width) { break } v1 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_table + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v1) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v1) & libc.Int32FromInt32(0xff)) sp += uintptr(2) v1 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_table + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v1) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v1) & libc.Int32FromInt32(0xff)) sp += uintptr(2) v1 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_table + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v1) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v1) & libc.Int32FromInt32(0xff)) sp += uintptr(4) goto _4 _4: ; i++ } } case int32(PNG_COLOR_MASK_ALPHA): if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { sp = row i = uint32(0) for { if !(i < row_width) { break } *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) sp += uintptr(2) goto _5 _5: ; i++ } } else { /* if (row_info->bit_depth == 16) */ sp = row i = uint32(0) for { if !(i < row_width) { break } v2 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_table + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v2) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v2) & libc.Int32FromInt32(0xff)) sp += uintptr(4) goto _6 _6: ; i++ } } case PNG_COLOR_TYPE_GRAY: if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(2) { sp = row i = uint32(0) for { if !(i < row_width) { break } a = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & int32(0xc0) b = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & int32(0x30) c = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & int32(0x0c) d = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & int32(0x03) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(a|a>>int32(2)|a>>int32(4)|a>>int32(6)))))&libc.Int32FromInt32(0xc0) | libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(b<>int32(2)|b>>int32(4)))))>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0x30) | libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(c<>int32(2)))))>>libc.Int32FromInt32(4)&libc.Int32FromInt32(0x0c) | libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(d<>libc.Int32FromInt32(6)) sp++ goto _7 _7: ; i += uint32(4) } } if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(4) { sp = row i = uint32(0) for { if !(i < row_width) { break } msb = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & int32(0xf0) lsb = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) & int32(0x0f) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(msb|msb>>int32(4)))))&libc.Int32FromInt32(0xf0) | libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(lsb<>libc.Int32FromInt32(4)) sp++ goto _8 _8: ; i += uint32(2) } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { sp = row i = uint32(0) for { if !(i < row_width) { break } *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(gamma_table + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) sp++ goto _9 _9: ; i++ } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { sp = row i = uint32(0) for { if !(i < row_width) { break } v3 = *(*Tpng_uint_16)(unsafe.Pointer(*(*Tpng_uint_16p)(unsafe.Pointer(gamma_16_table + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*2)) *(*Tpng_byte)(unsafe.Pointer(sp)) = libc.Uint8FromInt32(libc.Int32FromUint16(v3) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(sp + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v3) & libc.Int32FromInt32(0xff)) sp += uintptr(2) goto _10 _10: ; i++ } } } } default: break } } } // C documentation // // /* Encode the alpha channel to the output gamma (the input channel is always // * linear.) Called only with color types that have an alpha channel. Needs the // * from_1 tables. // */ func _png_do_encode_alpha(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, png_ptr Tpng_structrp) { var gamma_shift, step, step1, v1, v3 int32 var row_width Tpng_uint_32 var table Tpng_bytep var table1 Tpng_uint_16pp var v Tpng_uint_16 _, _, _, _, _, _, _, _, _ = gamma_shift, row_width, step, step1, table, table1, v, v1, v3 row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0 { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { table = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_from_1 if table != libc.UintptrFromInt32(0) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { v1 = int32(4) } else { v1 = int32(2) } step = v1 /* The alpha channel is the last component: */ row += uintptr(step - int32(1)) for { if !(row_width > uint32(0)) { break } *(*Tpng_byte)(unsafe.Pointer(row)) = *(*Tpng_byte)(unsafe.Pointer(table + uintptr(*(*Tpng_byte)(unsafe.Pointer(row))))) goto _2 _2: ; row_width-- row += uintptr(step) } return } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { table1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_16_from_1 gamma_shift = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fgamma_shift if table1 != libc.UintptrFromInt32(0) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { v3 = int32(8) } else { v3 = int32(4) } step1 = v3 /* The alpha channel is the last component: */ row += uintptr(step1 - int32(2)) for { if !(row_width > uint32(0)) { break } v = *(*Tpng_uint_16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(table1 + uintptr(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(row + libc.UintptrFromInt32(1))))>>gamma_shift)*4)) + uintptr(*(*Tpng_byte)(unsafe.Pointer(row)))*2)) *(*Tpng_byte)(unsafe.Pointer(row)) = libc.Uint8FromInt32(libc.Int32FromUint16(v) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(row + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(libc.Int32FromUint16(v) & libc.Int32FromInt32(0xff)) goto _4 _4: ; row_width-- row += uintptr(step1) } return } } } } /* Only get to here if called with a weird row_info; no harm has been done, * so just issue a warning. */ Xpng_warning(tls, png_ptr, __ccgo_ts+15683) } // C documentation // // /* Expands a palette row to an RGB or RGBA row depending // * upon whether you supply trans and num_trans. // */ func _png_do_expand_palette(tls *libc.TLS, png_ptr Tpng_structrp, row_info Tpng_row_infop, row Tpng_bytep, palette Tpng_const_colorp, trans_alpha Tpng_const_bytep, num_trans int32) { var dp, sp, v11, v12, v13, v5, v6, v7, v8, v9 Tpng_bytep var i, row_width Tpng_uint_32 var shift, value int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, i, row_width, shift, sp, value, v11, v12, v13, v5, v6, v7, v8, v9 row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) < int32(8) { switch libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) { case int32(1): sp = row + uintptr((row_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(3)) dp = row + uintptr(row_width) - uintptr(1) shift = int32(7) - libc.Int32FromUint32((row_width+libc.Uint32FromInt32(7))&libc.Uint32FromInt32(0x07)) i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))>>shift&int32(0x01) != 0 { *(*Tpng_byte)(unsafe.Pointer(dp)) = uint8(1) } else { *(*Tpng_byte)(unsafe.Pointer(dp)) = uint8(0) } if shift == int32(7) { shift = 0 sp-- } else { shift++ } dp-- goto _1 _1: ; i++ } case int32(2): sp = row + uintptr((row_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(2)) dp = row + uintptr(row_width) - uintptr(1) shift = libc.Int32FromUint32((libc.Uint32FromInt32(3) - (row_width+libc.Uint32FromInt32(3))&libc.Uint32FromInt32(0x03)) << libc.Int32FromInt32(1)) i = uint32(0) for { if !(i < row_width) { break } value = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) >> shift & int32(0x03) *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32(value) if shift == int32(6) { shift = 0 sp-- } else { shift += int32(2) } dp-- goto _2 _2: ; i++ } case int32(4): sp = row + uintptr((row_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(1)) dp = row + uintptr(row_width) - uintptr(1) shift = libc.Int32FromUint32(row_width & libc.Uint32FromInt32(0x01) << libc.Int32FromInt32(2)) i = uint32(0) for { if !(i < row_width) { break } value = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) >> shift & int32(0x0f) *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32(value) if shift == int32(4) { shift = 0 sp-- } else { shift += int32(4) } dp-- goto _3 _3: ; i++ } default: break } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth = uint8(8) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(8) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width } if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if num_trans > 0 { sp = row + uintptr(row_width) - uintptr(1) dp = row + uintptr(row_width<= num_trans { v5 = dp dp-- *(*Tpng_byte)(unsafe.Pointer(v5)) = uint8(0xff) } else { v6 = dp dp-- *(*Tpng_byte)(unsafe.Pointer(v6)) = *(*Tpng_byte)(unsafe.Pointer(trans_alpha + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) } v7 = dp dp-- *(*Tpng_byte)(unsafe.Pointer(v7)) = (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*3))).Fblue v8 = dp dp-- *(*Tpng_byte)(unsafe.Pointer(v8)) = (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*3))).Fgreen v9 = dp dp-- *(*Tpng_byte)(unsafe.Pointer(v9)) = (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*3))).Fred sp-- goto _4 _4: ; i++ } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth = uint8(8) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(32) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32(4) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type = uint8(6) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(4) } else { sp = row + uintptr(row_width) - uintptr(1) dp = row + uintptr(row_width*libc.Uint32FromInt32(3)) - uintptr(1) i = uint32(0) _ = png_ptr for { if !(i < row_width) { break } v11 = dp dp-- *(*Tpng_byte)(unsafe.Pointer(v11)) = (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*3))).Fblue v12 = dp dp-- *(*Tpng_byte)(unsafe.Pointer(v12)) = (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*3))).Fgreen v13 = dp dp-- *(*Tpng_byte)(unsafe.Pointer(v13)) = (*(*Tpng_color)(unsafe.Pointer(palette + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp)))*3))).Fred sp-- goto _10 _10: ; i++ } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth = uint8(8) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(24) (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = row_width * uint32(3) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type = uint8(2) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(3) } } } } // C documentation // // /* If the bit depth < 8, it is expanded to 8. Also, if the already // * expanded transparency value is supplied, an alpha channel is built. // */ func _png_do_expand(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, trans_color Tpng_const_color_16p) { var blue, blue_high, blue_low, green, green_high, green_low, red, red_high, red_low Tpng_byte var dp, sp, v11, v12, v13, v14, v15, v16, v17, v18, v21, v22, v23, v24, v25, v26, v27, v28, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v6, v7, v8, v9 Tpng_bytep var gray, gray_high, gray_low, v19, v46 uint32 var i, row_width Tpng_uint_32 var shift, value, v1 int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = blue, blue_high, blue_low, dp, gray, gray_high, gray_low, green, green_high, green_low, i, red, red_high, red_low, row_width, shift, sp, value, v1, v11, v12, v13, v14, v15, v16, v17, v18, v19, v21, v22, v23, v24, v25, v26, v27, v28, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v6, v7, v8, v9 row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == PNG_COLOR_TYPE_GRAY { if trans_color != libc.UintptrFromInt32(0) { v1 = libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fgray) } else { v1 = 0 } gray = libc.Uint32FromInt32(v1) if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) < int32(8) { switch libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) { case int32(1): gray = gray & uint32(0x01) * uint32(0xff) sp = row + uintptr((row_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(3)) dp = row + uintptr(row_width) - uintptr(1) shift = int32(7) - libc.Int32FromUint32((row_width+libc.Uint32FromInt32(7))&libc.Uint32FromInt32(0x07)) i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp)))>>shift&int32(0x01) != 0 { *(*Tpng_byte)(unsafe.Pointer(dp)) = uint8(0xff) } else { *(*Tpng_byte)(unsafe.Pointer(dp)) = uint8(0) } if shift == int32(7) { shift = 0 sp-- } else { shift++ } dp-- goto _2 _2: ; i++ } case int32(2): gray = gray & uint32(0x03) * uint32(0x55) sp = row + uintptr((row_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(2)) dp = row + uintptr(row_width) - uintptr(1) shift = libc.Int32FromUint32((libc.Uint32FromInt32(3) - (row_width+libc.Uint32FromInt32(3))&libc.Uint32FromInt32(0x03)) << libc.Int32FromInt32(1)) i = uint32(0) for { if !(i < row_width) { break } value = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) >> shift & int32(0x03) *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32(value | value<>libc.Int32FromInt32(1)) dp = row + uintptr(row_width) - uintptr(1) shift = libc.Int32FromUint32((libc.Uint32FromInt32(1) - (row_width+libc.Uint32FromInt32(1))&libc.Uint32FromInt32(0x01)) << libc.Int32FromInt32(2)) i = uint32(0) for { if !(i < row_width) { break } value = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) >> shift & int32(0x0f) *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32(value | value<> int32(8) & uint32(0xff) gray_low = gray & uint32(0xff) sp = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) - uintptr(1) dp = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes<= int32(8) { v19 = row_width * (uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v19 = (row_width*uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = v19 } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) && trans_color != libc.UintptrFromInt32(0) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { red = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fred) & libc.Int32FromInt32(0xff)) green = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fgreen) & libc.Int32FromInt32(0xff)) blue = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fblue) & libc.Int32FromInt32(0xff)) sp = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) - uintptr(1) dp = row + uintptr(row_width<> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) green_high = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fgreen) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) blue_high = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fblue) >> libc.Int32FromInt32(8) & libc.Int32FromInt32(0xff)) red_low = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fred) & libc.Int32FromInt32(0xff)) green_low = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fgreen) & libc.Int32FromInt32(0xff)) blue_low = libc.Uint8FromInt32(libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fblue) & libc.Int32FromInt32(0xff)) sp = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) - uintptr(1) dp = row + uintptr(row_width<= int32(8) { v46 = row_width * (uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v46 = (row_width*uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = v46 } } } // C documentation // // /* If the bit depth is 8 and the color type is not a palette type expand the // * whole row to 16 bits. Has no effect otherwise. // */ func _png_do_expand_16(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var dp, sp, v2 uintptr var v1 Tpng_byte _, _, _, _ = dp, sp, v1, v2 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) && libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) != libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { /* The row have a sequence of bytes containing [0..255] and we need * to turn it into another row containing [0..65535], to do this we * calculate: * * (input / 255) * 65535 * * Which happens to be exactly input * 257 and this can be achieved * simply by byte replication in place (copying backwards). */ sp = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) /* source, last byte + 1 */ dp = sp + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) /* destination, end + 1 */ for dp > sp { sp-- v2 = sp v1 = *(*Tpng_byte)(unsafe.Pointer(v2)) *(*Tpng_byte)(unsafe.Pointer(dp + uintptr(-libc.Int32FromInt32(1)))) = v1 *(*Tpng_byte)(unsafe.Pointer(dp + uintptr(-libc.Int32FromInt32(2)))) = v1 dp -= uintptr(2) } *(*Tsize_t)(unsafe.Pointer(row_info + 4)) *= uint32(2) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth = uint8(16) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) * libc.Int32FromInt32(16)) } } func _png_do_quantize(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, palette_lookup Tpng_const_bytep, quantize_lookup Tpng_const_bytep) { var b, b1, g, g1, p, p1, r, r1 int32 var dp, sp, v10, v11, v2, v3, v4, v5, v8, v9 Tpng_bytep var i, row_width Tpng_uint_32 var v12, v6 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, b1, dp, g, g1, i, p, p1, r, r1, row_width, sp, v10, v11, v12, v2, v3, v4, v5, v6, v8, v9 row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) && palette_lookup != 0 { sp = row dp = row i = uint32(0) for { if !(i < row_width) { break } v2 = sp sp++ r = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v2))) v3 = sp sp++ g = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v3))) v4 = sp sp++ b = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v4))) /* This looks real messy, but the compiler will reduce * it down to a reasonable formula. For example, with * 5 bits per color, we get: * p = (((r >> 3) & 0x1f) << 10) | * (((g >> 3) & 0x1f) << 5) | * ((b >> 3) & 0x1f); */ p = r>>(libc.Int32FromInt32(8)-libc.Int32FromInt32(PNG_QUANTIZE_RED_BITS))&(libc.Int32FromInt32(1)<>(libc.Int32FromInt32(8)-libc.Int32FromInt32(PNG_QUANTIZE_GREEN_BITS))&(libc.Int32FromInt32(1)<>(libc.Int32FromInt32(8)-libc.Int32FromInt32(PNG_QUANTIZE_BLUE_BITS))&(libc.Int32FromInt32(1)<= int32(8) { v6 = row_width * (uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v6 = (row_width*uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = v6 } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) && palette_lookup != libc.UintptrFromInt32(0) { sp = row dp = row i = uint32(0) for { if !(i < row_width) { break } v8 = sp sp++ r1 = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v8))) v9 = sp sp++ g1 = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v9))) v10 = sp sp++ b1 = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v10))) sp++ p1 = r1>>(libc.Int32FromInt32(8)-libc.Int32FromInt32(PNG_QUANTIZE_RED_BITS))&(libc.Int32FromInt32(1)<>(libc.Int32FromInt32(8)-libc.Int32FromInt32(PNG_QUANTIZE_GREEN_BITS))&(libc.Int32FromInt32(1)<>(libc.Int32FromInt32(8)-libc.Int32FromInt32(PNG_QUANTIZE_BLUE_BITS))&(libc.Int32FromInt32(1)<= int32(8) { v12 = row_width * (uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v12 = (row_width*uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = v12 } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) && quantize_lookup != 0 { sp = row i = uint32(0) for { if !(i < row_width) { break } *(*Tpng_byte)(unsafe.Pointer(sp)) = *(*Tpng_byte)(unsafe.Pointer(quantize_lookup + uintptr(*(*Tpng_byte)(unsafe.Pointer(sp))))) goto _13 _13: ; i++ sp++ } } } } } } // C documentation // // /* Transform the row. The order of transformations is significant, // * and is very touchy. If you add a transformation, take care to // * decide how it fits in with the other transformations here. // */ func Xpng_do_read_transformations(tls *libc.TLS, png_ptr Tpng_structrp, row_info Tpng_row_infop) { var rgb_error int32 var v1 uint32 _, _ = rgb_error, v1 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf == libc.UintptrFromInt32(0) { /* Prior to 1.5.4 this output row/pass where the NULL pointer is, but this * error is incredibly rare and incredibly easy to debug without this * information. */ Xpng_error(tls, png_ptr, __ccgo_ts+15720) } /* The following is debugging; prior to 1.5.4 the code was never compiled in; * in 1.5.4 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro * PNG_WARN_UNINITIALIZED_ROW removed. In 1.6 the new flag is set only for * all transformations, however in practice the ROW_INIT always gets done on * demand, if necessary. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x4000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0040) == uint32(0) { /* Application has failed to call either png_read_start_image() or * png_read_update_info() after setting transforms that expand pixels. * This check added to libpng-1.2.19 (but not enabled until 1.5.4). */ Xpng_error(tls, png_ptr, __ccgo_ts+15736) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000) != uint32(0) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { _png_do_expand_palette(tls, png_ptr, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha, libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans)) } else { if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x2000000) != uint32(0) { _png_do_expand(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), png_ptr+764) } else { _png_do_expand(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), libc.UintptrFromInt32(0)) } } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x40000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) == uint32(0) && (libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) || libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA)) { Xpng_do_strip_channel(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), 0) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x600000) != uint32(0) { rgb_error = _png_do_rgb_to_gray(tls, png_ptr, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) if rgb_error != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frgb_to_gray_status = uint8(1) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x600000) == uint32(0x400000) { Xpng_warning(tls, png_ptr, __ccgo_ts+15754) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x600000) == uint32(0x200000) { Xpng_error(tls, png_ptr, __ccgo_ts+15754) } } } /* From Andreas Dilger e-mail to png-implement, 26 March 1998: * * In most cases, the "simple transparency" should be done prior to doing * gray-to-RGB, or you will have to test 3x as many bytes to check if a * pixel is transparent. You would also need to make sure that the * transparency information is upgraded to RGB. * * To summarize, the current flow is: * - Gray + simple transparency -> compare 1 or 2 gray bytes and composite * with background "in place" if transparent, * convert to RGB if necessary * - Gray + alpha -> composite with gray background and remove alpha bytes, * convert to RGB if necessary * * To support RGB backgrounds for gray images we need: * - Gray + simple transparency -> convert to RGB + simple transparency, * compare 3 or 6 bytes and composite with * background "in place" if transparent * (3x compare/pixel compared to doing * composite with gray bkgrnd) * - Gray + alpha -> convert to RGB + alpha, composite with background and * remove alpha bytes (3x float * operations/pixel compared with composite * on gray background) * * Greg's change will do this. The reason it wasn't done before is for * performance, as this increases the per-pixel operations. If we would check * in advance if the background was gray or RGB, and position the gray-to-RGB * transform appropriately, then it would save a lot of work/time. */ /* If gray -> RGB, do so now only if background is non-gray; else do later * for performance reasons */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x4000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x800) == uint32(0) { _png_do_gray_to_rgb(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) { _png_do_compose(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), png_ptr) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x2000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x600000) == uint32(0) && !((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) && (libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) != 0 || libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0)) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) != libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { _png_do_gamma(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), png_ptr) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x40000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0080) != uint32(0) && (libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) || libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA)) { Xpng_do_strip_channel(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), 0) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x800000) != uint32(0) && libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0 { _png_do_encode_alpha(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), png_ptr) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x4000000) != uint32(0) { _png_do_scale_16_to_8(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } /* There is no harm in doing both of these because only one has any effect, * by putting the 'scale' option first if the app asks for scale (either by * calling the API or in a TRANSFORM flag) this is what happens. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0400) != uint32(0) { _png_do_chop(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0040) != uint32(0) { _png_do_quantize(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette_lookup, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fquantize_index) if (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes == uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+15793) } } /* Do the expansion now, after all the arithmetic has been done. Notice * that previous transformations can handle the PNG_EXPAND_16 flag if this * is efficient (particularly true in the case of gamma correction, where * better accuracy results faster!) */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0200) != uint32(0) { _png_do_expand_16(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } /* NOTE: moved here in 1.5.4 (from much later in this list.) */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x4000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x800) != uint32(0) { _png_do_gray_to_rgb(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0020) != uint32(0) { Xpng_do_invert(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x80000) != uint32(0) { _png_do_read_invert_alpha(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0008) != uint32(0) { _png_do_unshift(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), png_ptr+753) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0004) != uint32(0) { _png_do_unpack(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } /* Added at libpng-1.5.10 */ if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max >= 0 { Xpng_do_check_palette_indexes(tls, png_ptr, row_info) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0001) != uint32(0) { Xpng_do_bgr(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x10000) != uint32(0) { Xpng_do_packswap(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x8000) != uint32(0) { _png_do_read_filler(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ffiller), (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x20000) != uint32(0) { _png_do_read_swap_alpha(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0010) != uint32(0) { Xpng_do_swap(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x100000) != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_user_transform_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_row_infop, Tpng_bytep))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_user_transform_fn})))(tls, png_ptr, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } /* start of pixel data for row */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_depth) != 0 { (*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_depth } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_channels) != 0 { (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_channels } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) * libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels)) if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >= int32(8) { v1 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth * (uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v1 = ((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth*uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = v1 } } const PNG_16_TO_84 = 0x0400 const PNG_ADD_ALPHA4 = 0x1000000 const PNG_AFTER_IDAT3 = 8 const PNG_BACKGROUND_EXPAND2 = 0x0100 const PNG_BACKGROUND_IS_GRAY2 = 0x800 const PNG_BGR4 = 0x0001 const PNG_COLORSPACE_FROM_cHRM1 = 16 const PNG_COLORSPACE_HAVE_GAMMA8 = 0x0001 const PNG_COLORSPACE_HAVE_INTENT3 = 4 const PNG_COLORSPACE_INVALID5 = 32768 const PNG_COMPOSE6 = 0x0080 const PNG_ENCODE_ALPHA2 = 0x800000 const PNG_EXPAND_tRNS2 = 0x2000000 const PNG_FLAG_ASSUME_sRGB2 = 0x1000 const PNG_FLAG_BENIGN_ERRORS_WARN5 = 1048576 const PNG_FLAG_DETECT_UNINITIALIZED2 = 0x4000 const PNG_FLAG_FILLER_AFTER4 = 0x0080 const PNG_FLAG_OPTIMIZE_ALPHA2 = 0x2000 const PNG_FLAG_ZSTREAM_ENDED3 = 8 const PNG_FLAG_ZSTREAM_INITIALIZED1 = 2 const PNG_FREE_EXIF3 = 32768 const PNG_FREE_ICCP3 = 16 const PNG_GAMMA2 = 0x2000 const PNG_HAVE_IDAT3 = 4 const PNG_HAVE_IEND3 = 16 const PNG_HAVE_PLTE3 = 2 const PNG_HAVE_PNG_SIGNATURE3 = 4096 const PNG_INFO_bKGD3 = 32 const PNG_INFO_eXIf5 = 65536 const PNG_INFO_hIST5 = 64 const PNG_INFO_iCCP5 = 4096 const PNG_INFO_oFFs3 = 256 const PNG_INFO_pCAL5 = 1024 const PNG_INFO_pHYs3 = 128 const PNG_INFO_sBIT5 = 2 const PNG_INFO_sCAL5 = 16384 const PNG_INFO_tIME3 = 512 const PNG_INFO_tRNS5 = 16 const PNG_INTERLACE3 = 2 const PNG_INVERT_ALPHA2 = 0x80000 const PNG_INVERT_MONO2 = 0x0020 const PNG_IO_CHUNK_CRC1 = 128 const PNG_IO_CHUNK_DATA1 = 64 const PNG_IO_CHUNK_HDR1 = 32 const PNG_IO_READING1 = 1 const PNG_IO_SIGNATURE1 = 16 const PNG_QUANTIZE2 = 0x0040 const PNG_RGB_TO_GRAY6 = 0x600000 const PNG_RGB_TO_GRAY_ERR2 = 0x200000 const PNG_RGB_TO_GRAY_WARN2 = 0x400000 const PNG_SCALE_16_TO_84 = 0x4000000 const PNG_SHIFT2 = 0x0008 const PNG_STRIP_ALPHA2 = 0x40000 const PNG_SWAP_ALPHA4 = 0x20000 const PNG_SWAP_BYTES2 = 0x0010 /* Maintainer: Put new private prototypes here ^ */ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. * * png_debug[1-2]?(level, message ,arg{0-2}) * Expands to a statement (either a simple expression or a compound * do..while(0) statement) that outputs a message with parameter * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG * is undefined, 0 or 1 every png_debug expands to a simple expression * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added * to the message. * arg: 0 to 2 arguments for printf(3) style substitution in message. */ /* These settings control the formatting of messages in png.c and pngerror.c */ /* Moved to pngdebug.h at 1.5.0 */ func Xpng_get_uint_31(tls *libc.TLS, png_ptr Tpng_const_structrp, buf Tpng_const_bytep) (r Tpng_uint_32) { var uval Tpng_uint_32 _ = uval uval = uint32(*(*Tpng_byte)(unsafe.Pointer(buf)))< libc.Uint32FromInt32(0x7fffffff) { Xpng_error(tls, png_ptr, __ccgo_ts+15829) } return uval } /* The following is a variation on the above for use with the fixed * point values used for gAMA and cHRM. Instead of png_error it * issues a warning and returns (-1) - an invalid value because both * gAMA and cHRM use *unsigned* integers for fixed point values. */ func _png_get_fixed_point(tls *libc.TLS, png_ptr Tpng_structrp, buf Tpng_const_bytep) (r Tpng_fixed_point) { var uval Tpng_uint_32 _ = uval uval = uint32(*(*Tpng_byte)(unsafe.Pointer(buf)))<= int32(8) { return } num_checked = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bytes) num_to_check = uint32(8) - num_checked (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_state = libc.Uint32FromInt32(libc.Int32FromInt32(PNG_IO_READING1) | libc.Int32FromInt32(PNG_IO_SIGNATURE1)) /* The signature must be serialized in a single I/O call. */ Xpng_read_data(tls, png_ptr, info_ptr+32+uintptr(num_checked), num_to_check) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bytes = uint8(8) if Xpng_sig_cmp(tls, info_ptr+32, num_checked, num_to_check) != 0 { if num_checked < uint32(4) && Xpng_sig_cmp(tls, info_ptr+32, num_checked, num_to_check-uint32(4)) != 0 { Xpng_error(tls, png_ptr, __ccgo_ts+12227) } else { Xpng_error(tls, png_ptr, __ccgo_ts+12242) } } if num_checked < uint32(3) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(0x1000) } } // C documentation // // /* Read the chunk header (length + type name). // * Put the type name into png_ptr->chunk_name, and return the length. // */ func Xpng_read_chunk_header(tls *libc.TLS, png_ptr Tpng_structrp) (r Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var length Tpng_uint_32 var _ /* buf at bp+0 */ [8]Tpng_byte _ = length (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_state = libc.Uint32FromInt32(libc.Int32FromInt32(PNG_IO_READING1) | libc.Int32FromInt32(PNG_IO_CHUNK_HDR1)) /* Read the length and the chunk name. * This must be performed in a single I/O call. */ Xpng_read_data(tls, png_ptr, bp, uint32(8)) length = Xpng_get_uint_31(tls, png_ptr, bp) /* Put the chunk name into png_ptr->chunk_name. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name = libc.Uint32FromInt32(libc.Int32FromInt32(0xff)&libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(bp + libc.UintptrFromInt32(4)))))< uint32(0) { len1 = libc.Uint32FromInt64(1024) if len1 > skip { len1 = skip } skip -= len1 Xpng_crc_read(tls, png_ptr, bp, len1) } if Xpng_crc_error(tls, png_ptr) != 0 { if uint32(1)&((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name>>libc.Int32FromInt32(29)) != uint32(0) { v1 = libc.BoolInt32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0200) == uint32(0)) } else { v1 = libc.BoolInt32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0400) != uint32(0)) } if v1 != 0 { Xpng_chunk_warning(tls, png_ptr, __ccgo_ts+15900) } else { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+15900) } return int32(1) } return 0 } // C documentation // // /* Compare the CRC stored in the PNG file with that calculated by libpng from // * the data it has read thus far. // */ func Xpng_crc_error(tls *libc.TLS, png_ptr Tpng_structrp) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var crc Tpng_uint_32 var need_crc int32 var _ /* crc_bytes at bp+0 */ [4]Tpng_byte _, _ = crc, need_crc need_crc = int32(1) if uint32(1)&((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name>>libc.Int32FromInt32(29)) != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&(libc.Uint32FromUint32(0x0100)|libc.Uint32FromUint32(0x0200)) == libc.Uint32FromUint32(0x0100)|libc.Uint32FromUint32(0x0200) { need_crc = 0 } } else { /* critical */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0800) != uint32(0) { need_crc = 0 } } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_state = libc.Uint32FromInt32(libc.Int32FromInt32(PNG_IO_READING1) | libc.Int32FromInt32(PNG_IO_CHUNK_CRC1)) /* The chunk CRC must be serialized in a single I/O call. */ Xpng_read_data(tls, png_ptr, bp, uint32(4)) if need_crc != 0 { crc = uint32(*(*Tpng_byte)(unsafe.Pointer(bp)))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer_size { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer = libc.UintptrFromInt32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer_size = uint32(0) Xpng_free(tls, png_ptr, buffer) buffer = libc.UintptrFromInt32(0) } if buffer == libc.UintptrFromInt32(0) { buffer = Xpng_malloc_base(tls, png_ptr, new_size) if buffer != libc.UintptrFromInt32(0) { libc.Xmemset(tls, buffer, 0, new_size) /* just in case */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer = buffer (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer_size = new_size } else { if warn < int32(2) { /* else silent */ if warn != 0 { Xpng_chunk_warning(tls, png_ptr, __ccgo_ts+15910) } else { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+15910) } } } } return buffer } // C documentation // // /* png_inflate_claim: claim the zstream for some nefarious purpose that involves // * decompression. Returns Z_OK on success, else a zlib error code. It checks // * the owner but, in final release builds, just issues a warning if some other // * chunk apparently owns the stream. Prior to release it does a png_error. // */ func _png_inflate_claim(tls *libc.TLS, png_ptr Tpng_structrp, owner Tpng_uint_32) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var ret, window_bits int32 var _ /* msg at bp+0 */ [64]uint8 _, _ = ret, window_bits if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner != uint32(0) { *(*uint8)(unsafe.Pointer(bp)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner >> libc.Int32FromInt32(24) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + 1)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + 2)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + 3)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner & libc.Uint32FromInt32(0xff)) /* So the message that results is " using zstream"; this is an * internal error, but is very useful for debugging. i18n requirements * are minimal. */ Xpng_safecat(tls, bp, libc.Uint32FromInt64(64), uint32(4), __ccgo_ts+15944) Xpng_chunk_warning(tls, png_ptr, bp) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner = uint32(0) } /* Implementation note: unlike 'png_deflate_claim' this internal function * does not take the size of the data as an argument. Some efficiency could * be gained by using this when it is known *if* the zlib stream itself does * not record the number; however, this is an illusion: the original writer * of the PNG may have selected a lower window size, and we really must * follow that because, for systems with with limited capabilities, we * would otherwise reject the application's attempts to use a smaller window * size (zlib doesn't have an interface to say "this or lower"!). * * inflateReset2 was added to zlib 1.2.4; before this the window could not be * reset, therefore it is necessary to always allocate the maximum window * size with earlier zlibs just in case later compressed chunks need it. */ /* zlib return code */ window_bits = 0 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Foptions>>libc.Int32FromInt32(PNG_MAXIMUM_INFLATE_WINDOW)&uint32(3) == uint32(PNG_OPTION_ON) { window_bits = int32(15) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream_start = uint8(0) /* fixed window size */ } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream_start = uint8(1) } /* Set this for safety, just in case the previous owner left pointers to * memory allocations. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_in = libc.UintptrFromInt32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = uint32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = libc.UintptrFromInt32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = uint32(0) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0002) != uint32(0) { ret = (*(*func(*libc.TLS, Tz_streamp, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflateReset2Ptr})))(tls, png_ptr+460, window_bits) } else { ret = (*(*func(*libc.TLS, Tz_streamp, int32, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflateInit2_Ptr})))(tls, png_ptr+460, window_bits, __ccgo_ts+15959, libc.Int32FromInt64(56)) if ret == Z_OK { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0002) } } if ret == Z_OK { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner = owner } else { Xpng_zstream_error(tls, png_ptr, ret) } return ret return r } // C documentation // // /* Handle the start of the inflate stream if we called inflateInit2(strm,0); // * in this case some zlib versions skip validation of the CINFO field and, in // * certain circumstances, libpng may end up displaying an invalid image, in // * contrast to implementations that call zlib in the normal way (e.g. libpng // * 1.5). // */ func Xpng_zlib_inflate(tls *libc.TLS, png_ptr Tpng_structrp, flush int32) (r int32) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream_start != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in > uint32(0) { if libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_in)))>>int32(4) > int32(7) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 15965 return -int32(3) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream_start = uint8(0) } return (*(*func(*libc.TLS, Tz_streamp, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflatePtr})))(tls, png_ptr+460, flush) } // C documentation // // /* png_inflate now returns zlib error codes including Z_OK and Z_STREAM_END to // * allow the caller to do multiple calls if required. If the 'finish' flag is // * set Z_FINISH will be passed to the final inflate() call and Z_STREAM_END must // * be returned or there has been a problem, otherwise Z_SYNC_FLUSH is used and // * Z_OK or Z_STREAM_END will be returned on success. // * // * The input and output sizes are updated to the actual amounts of data consumed // * or written, not the amount available (as in a z_stream). The data pointers // * are not changed, so the next input is (data+input_size) and the next // * available output is (output+output_size). // */ func _png_inflate(tls *libc.TLS, png_ptr Tpng_structrp, owner Tpng_uint_32, finish int32, input Tpng_const_bytep, input_size_ptr Tpng_uint_32p, output Tpng_bytep, output_size_ptr uintptr) (r int32) { bp := tls.Alloc(1024) defer tls.Free(1024) var avail TuInt var avail_in Tpng_uint_32 var avail_out Tpng_alloc_size_t var ret, v1, v2 int32 var _ /* local_buffer at bp+0 */ [1024]TByte _, _, _, _, _, _ = avail, avail_in, avail_out, ret, v1, v2 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner == owner { /* Else not claimed */ avail_out = *(*Tpng_alloc_size_t)(unsafe.Pointer(output_size_ptr)) avail_in = *(*Tpng_uint_32)(unsafe.Pointer(input_size_ptr)) /* zlib can't necessarily handle more than 65535 bytes at once (i.e. it * can't even necessarily handle 65536 bytes) because the type uInt is * "16 bits or more". Consequently it is necessary to chunk the input to * zlib. This code uses ZLIB_IO_MAX, from pngpriv.h, as the maximum (the * maximum value that can be stored in a uInt.) It is possible to set * ZLIB_IO_MAX to a lower value in pngpriv.h and this may sometimes have * a performance advantage, because it reduces the amount of data accessed * at each step and that may give the OS more time to page it in. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_in = input /* avail_in and avail_out are set below from 'size' */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = uint32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = uint32(0) /* Read directly into the output if it is available (this is set to * a local buffer below if output is NULL). */ if output != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = output } for cond := true; cond; cond = ret == Z_OK { /* zlib INPUT BUFFER */ /* The setting of 'avail_in' used to be outside the loop; by setting it * inside it is possible to chunk the input to zlib and simply rely on * zlib to advance the 'next_in' pointer. This allows arbitrary * amounts of data to be passed through zlib at the unavoidable cost of * requiring a window save (memcpy of up to 32768 output bytes) * every ZLIB_IO_MAX input bytes. */ avail_in += (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in /* not consumed last time */ avail = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if avail_in < avail { avail = avail_in } /* safe: < than ZLIB_IO_MAX */ avail_in -= avail (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = avail /* zlib OUTPUT BUFFER */ avail_out += (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out /* not written last time */ avail = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) /* maximum zlib can process */ if output == libc.UintptrFromInt32(0) { /* Reset the output buffer each time round if output is NULL and * make available the full buffer, up to 'remaining_space' */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = bp if libc.Uint32FromInt64(1024) < avail { avail = libc.Uint32FromInt64(1024) } } if avail_out < avail { avail = avail_out } /* safe: < ZLIB_IO_MAX */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = avail avail_out -= avail /* zlib inflate call */ /* In fact 'avail_out' may be 0 at this point, that happens at the end * of the read when the final LZ end code was not passed at the end of * the previous chunk of input data. Tell zlib if we have reached the * end of the output buffer. */ if avail_out > uint32(0) { v1 = Z_NO_FLUSH } else { if finish != 0 { v2 = int32(Z_FINISH) } else { v2 = int32(Z_SYNC_FLUSH) } v1 = v2 } ret = Xpng_zlib_inflate(tls, png_ptr, v1) } /* For safety kill the local buffer pointer now */ if output == libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = libc.UintptrFromInt32(0) } /* Claw back the 'size' and 'remaining_space' byte counts. */ avail_in += (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in avail_out += (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out /* Update the input and output sizes; the updated values are the amount * consumed or written, effectively the inverse of what zlib uses. */ if avail_out > uint32(0) { *(*Tpng_alloc_size_t)(unsafe.Pointer(output_size_ptr)) -= avail_out } if avail_in > uint32(0) { *(*Tpng_uint_32)(unsafe.Pointer(input_size_ptr)) -= avail_in } /* Ensure png_ptr->zstream.msg is set (even in the success case!) */ Xpng_zstream_error(tls, png_ptr, ret) return ret } else { /* This is a bad internal error. The recovery assigns to the zstream msg * pointer, which is not owned by the caller, but this is safe; it's only * used on errors! */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 15994 return -int32(2) } return r } // C documentation // // /* // * Decompress trailing data in a chunk. The assumption is that read_buffer // * points at an allocated area holding the contents of a chunk with a // * trailing compressed part. What we get back is an allocated area // * holding the original prefix part and an uncompressed version of the // * trailing part (the malloc area passed in is freed). // */ func _png_decompress_chunk(tls *libc.TLS, png_ptr Tpng_structrp, chunklength Tpng_uint_32, prefix_size Tpng_uint_32, newlength uintptr, terminate int32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var buffer_size, limit, new_size Tpng_alloc_size_t var old_ptr, text Tpng_bytep var ret int32 var _ /* lzsize at bp+0 */ Tpng_uint_32 _, _, _, _, _, _ = buffer_size, limit, new_size, old_ptr, ret, text /* TODO: implement different limits for different types of chunk. * * The caller supplies *newlength set to the maximum length of the * uncompressed data, but this routine allocates space for the prefix and * maybe a '\0' terminator too. We have to assume that 'prefix_size' is * limited only by the maximum chunk size. */ limit = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max > uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max < limit { limit = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max } if limit >= prefix_size+libc.BoolUint32(terminate != libc.Int32FromInt32(0)) { limit -= prefix_size + libc.BoolUint32(terminate != libc.Int32FromInt32(0)) if limit < *(*Tpng_alloc_size_t)(unsafe.Pointer(newlength)) { *(*Tpng_alloc_size_t)(unsafe.Pointer(newlength)) = limit } /* Now try to claim the stream. */ ret = _png_inflate_claim(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name) if ret == Z_OK { *(*Tpng_uint_32)(unsafe.Pointer(bp)) = chunklength - prefix_size ret = _png_inflate(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name, int32(1), (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer+uintptr(prefix_size), bp, libc.UintptrFromInt32(0), newlength) if ret == int32(Z_STREAM_END) { /* Use 'inflateReset' here, not 'inflateReset2' because this * preserves the previously decided window size (otherwise it would * be necessary to store the previous window size.) In practice * this doesn't matter anyway, because png_inflate will call inflate * with Z_FINISH in almost all cases, so the window will not be * maintained. */ if (*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflateResetPtr})))(tls, png_ptr+460) == Z_OK { /* Because of the limit checks above we know that the new, * expanded, size will fit in a size_t (let alone an * png_alloc_size_t). Use png_malloc_base here to avoid an * extra OOM message. */ new_size = *(*Tpng_alloc_size_t)(unsafe.Pointer(newlength)) buffer_size = prefix_size + new_size + libc.BoolUint32(terminate != libc.Int32FromInt32(0)) text = Xpng_malloc_base(tls, png_ptr, buffer_size) if text != libc.UintptrFromInt32(0) { libc.Xmemset(tls, text, 0, buffer_size) ret = _png_inflate(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name, int32(1), (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer+uintptr(prefix_size), bp, text+uintptr(prefix_size), newlength) if ret == int32(Z_STREAM_END) { if new_size == *(*Tpng_alloc_size_t)(unsafe.Pointer(newlength)) { if terminate != 0 { *(*Tpng_byte)(unsafe.Pointer(text + uintptr(prefix_size+*(*Tpng_alloc_size_t)(unsafe.Pointer(newlength))))) = uint8(0) } if prefix_size > uint32(0) { libc.Xmemcpy(tls, text, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer, prefix_size) } old_ptr = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer = text (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer_size = buffer_size text = old_ptr /* freed below */ } else { /* The size changed on the second read, there can be no * guarantee that anything is correct at this point. * The 'msg' pointer has been set to "unexpected end of * LZ stream", which is fine, but return an error code * that the caller won't accept. */ ret = -int32(7) } } else { if ret == Z_OK { ret = -int32(7) } } /* for safety */ /* Free the text pointer (this is the old read_buffer on * success) */ Xpng_free(tls, png_ptr, text) /* This really is very benign, but it's still an error because * the extra space may otherwise be used as a Trojan Horse. */ if ret == int32(Z_STREAM_END) && chunklength-prefix_size != *(*Tpng_uint_32)(unsafe.Pointer(bp)) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16012) } } else { /* Out of memory allocating the buffer */ ret = -int32(4) Xpng_zstream_error(tls, png_ptr, -int32(4)) } } else { /* inflateReset failed, store the error message */ Xpng_zstream_error(tls, png_ptr, ret) ret = -int32(7) } } else { if ret == Z_OK { ret = -int32(7) } } /* Release the claimed stream */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner = uint32(0) } else { /* the claim failed */ if ret == int32(Z_STREAM_END) { /* impossible! */ ret = -int32(7) } } return ret } else { /* Application/configuration limits exceeded */ Xpng_zstream_error(tls, png_ptr, -int32(4)) return -int32(4) } return r } // C documentation // // /* Perform a partial read and decompress, producing 'avail_out' bytes and // * reading from the current chunk as required. // */ func _png_inflate_read(tls *libc.TLS, png_ptr Tpng_structrp, read_buffer Tpng_bytep, read_size TuInt, chunk_bytes Tpng_uint_32p, next_out Tpng_bytep, out_size uintptr, finish int32) (r int32) { var avail TuInt var ret, v1, v2 int32 _, _, _, _ = avail, ret, v1, v2 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner == (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name { /* next_in and avail_in must have been initialized by the caller. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = next_out (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = uint32(0) /* set in the loop */ for cond := true; cond; cond = ret == Z_OK && (*(*Tpng_alloc_size_t)(unsafe.Pointer(out_size)) > uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out > uint32(0)) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in == uint32(0) { if read_size > *(*Tpng_uint_32)(unsafe.Pointer(chunk_bytes)) { read_size = *(*Tpng_uint_32)(unsafe.Pointer(chunk_bytes)) } *(*Tpng_uint_32)(unsafe.Pointer(chunk_bytes)) -= read_size if read_size > uint32(0) { Xpng_crc_read(tls, png_ptr, read_buffer, read_size) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_in = read_buffer (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = read_size } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out == uint32(0) { avail = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if avail > *(*Tpng_alloc_size_t)(unsafe.Pointer(out_size)) { avail = *(*Tpng_alloc_size_t)(unsafe.Pointer(out_size)) } *(*Tpng_alloc_size_t)(unsafe.Pointer(out_size)) -= avail (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = avail } /* Use Z_SYNC_FLUSH when there is no more chunk data to ensure that all * the available output is produced; this allows reading of truncated * streams. */ if *(*Tpng_uint_32)(unsafe.Pointer(chunk_bytes)) > uint32(0) { v1 = Z_NO_FLUSH } else { if finish != 0 { v2 = int32(Z_FINISH) } else { v2 = int32(Z_SYNC_FLUSH) } v1 = v2 } ret = Xpng_zlib_inflate(tls, png_ptr, v1) } *(*Tpng_alloc_size_t)(unsafe.Pointer(out_size)) += (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = uint32(0) /* Should not be required, but is safe */ /* Ensure the error message pointer is always set: */ Xpng_zstream_error(tls, png_ptr, ret) return ret } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 15994 return -int32(2) } return r } /* Read and check the IDHR chunk */ func Xpng_handle_IHDR(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var bit_depth, color_type, compression_type, filter_type, interlace_type int32 var height, width Tpng_uint_32 var v1 uint32 var _ /* buf at bp+0 */ [13]Tpng_byte _, _, _, _, _, _, _, _ = bit_depth, color_type, compression_type, filter_type, height, interlace_type, width, v1 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) != uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16034) } /* Check the length */ if length != uint32(13) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16047) } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(PNG_HAVE_IHDR3) Xpng_crc_read(tls, png_ptr, bp, uint32(13)) Xpng_crc_finish(tls, png_ptr, uint32(0)) width = Xpng_get_uint_31(tls, png_ptr, bp) height = Xpng_get_uint_31(tls, png_ptr, bp+uintptr(4)) bit_depth = libc.Int32FromUint8((*(*[13]Tpng_byte)(unsafe.Pointer(bp)))[int32(8)]) color_type = libc.Int32FromUint8((*(*[13]Tpng_byte)(unsafe.Pointer(bp)))[int32(9)]) compression_type = libc.Int32FromUint8((*(*[13]Tpng_byte)(unsafe.Pointer(bp)))[int32(10)]) filter_type = libc.Int32FromUint8((*(*[13]Tpng_byte)(unsafe.Pointer(bp)))[int32(11)]) interlace_type = libc.Int32FromUint8((*(*[13]Tpng_byte)(unsafe.Pointer(bp)))[int32(12)]) /* Set internal variables */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth = width (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight = height (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth = libc.Uint8FromInt32(bit_depth) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced = libc.Uint8FromInt32(interlace_type) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type = libc.Uint8FromInt32(color_type) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ffilter_type = libc.Uint8FromInt32(filter_type) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcompression_type = libc.Uint8FromInt32(compression_type) /* Find number of channels */ switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) { default: /* invalid, png_set_IHDR calls png_error */ fallthrough case PNG_COLOR_TYPE_GRAY: fallthrough case libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels = uint8(1) case int32(PNG_COLOR_MASK_COLOR): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels = uint8(3) case int32(PNG_COLOR_MASK_ALPHA): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels = uint8(2) case libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels = uint8(4) break } /* Set up other useful info */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) * libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels)) if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) >= int32(8) { v1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth * (uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v1 = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth*uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frowbytes = v1 Xpng_set_IHDR(tls, png_ptr, info_ptr, width, height, bit_depth, color_type, interlace_type, compression_type, filter_type) } // C documentation // // /* Read and check the palette */ func Xpng_handle_PLTE(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(784) defer tls.Free(784) var i, max_palette_length, num int32 var pal_ptr Tpng_colorp var _ /* buf at bp+768 */ [3]Tpng_byte var _ /* palette at bp+0 */ [256]Tpng_color _, _, _, _ = i, max_palette_length, num, pal_ptr if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_PLTE3) != uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+10482) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) != uint32(0) { /* This is benign because the non-benign error happened before, when an * IDAT was encountered in a color-mapped image with no PLTE. */ Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16034) return } } } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(PNG_HAVE_PLTE3) if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) == 0 { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16068) return } if length > libc.Uint32FromInt32(libc.Int32FromInt32(3)*libc.Int32FromInt32(PNG_MAX_PALETTE_LENGTH)) || length%uint32(3) != 0 { Xpng_crc_finish(tls, png_ptr, length) if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) != libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) } else { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16047) } return } /* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */ num = libc.Int32FromUint32(length) / int32(3) /* If the palette has 256 or fewer entries but is too large for the bit * depth, we don't issue an error, to preserve the behavior of previous * libpng versions. We silently truncate the unused extra palette entries * here. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { max_palette_length = int32(1) << (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth } else { max_palette_length = int32(PNG_MAX_PALETTE_LENGTH) } if num > max_palette_length { num = max_palette_length } i = 0 pal_ptr = bp for { if !(i < num) { break } Xpng_crc_read(tls, png_ptr, bp+768, uint32(3)) (*Tpng_color)(unsafe.Pointer(pal_ptr)).Fred = (*(*[3]Tpng_byte)(unsafe.Pointer(bp + 768)))[0] (*Tpng_color)(unsafe.Pointer(pal_ptr)).Fgreen = (*(*[3]Tpng_byte)(unsafe.Pointer(bp + 768)))[int32(1)] (*Tpng_color)(unsafe.Pointer(pal_ptr)).Fblue = (*(*[3]Tpng_byte)(unsafe.Pointer(bp + 768)))[int32(2)] goto _1 _1: ; i++ pal_ptr += 3 } /* If we actually need the PLTE chunk (ie for a paletted image), we do * whatever the normal CRC configuration tells us. However, if we * have an RGB image, the PLTE can be considered ancillary, so * we will act as though it is. */ Xpng_crc_finish(tls, png_ptr, length-libc.Uint32FromInt32(num)*libc.Uint32FromInt32(3)) /* TODO: png_set_PLTE has the side effect of setting png_ptr->palette to its * own copy of the palette. This has the side effect that when png_start_row * is called (this happens after any call to png_read_update_info) the * info_ptr palette gets changed. This is extremely unexpected and * confusing. * * Fix this by not sharing the palette in this way. */ Xpng_set_PLTE(tls, png_ptr, info_ptr, bp, num) /* The three chunks, bKGD, hIST and tRNS *must* appear after PLTE and before * IDAT. Prior to 1.6.0 this was not checked; instead the code merely * checked the apparent validity of a tRNS chunk inserted before PLTE on a * palette PNG. 1.6.0 attempts to rigorously follow the standard and * therefore does a benign error if the erroneous condition is detected *and* * cancels the tRNS if the benign error returns. The alternative is to * amend the standard since it would be rather hypocritical of the standards * maintainers to ignore it. */ if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) > 0 || info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0010) != uint32(0) { /* Cancel this because otherwise it would be used if the transforms * require it. Don't cancel the 'valid' flag because this would prevent * detection of duplicate chunks. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans = uint16(0) if info_ptr != libc.UintptrFromInt32(0) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_trans = uint16(0) } Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16093) } if info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0040) != uint32(0) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16112) } if info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0020) != uint32(0) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16131) } } func Xpng_handle_IEND(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16034) } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= libc.Uint32FromInt32(PNG_AFTER_IDAT3) | libc.Uint32FromUint32(0x10) Xpng_crc_finish(tls, png_ptr, length) if length != uint32(0) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) } _ = info_ptr } func Xpng_handle_gAMA(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var igamma Tpng_fixed_point var _ /* buf at bp+0 */ [4]Tpng_byte _ = igamma if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&(libc.Uint32FromUint32(0x04)|libc.Uint32FromInt32(PNG_HAVE_PLTE3)) != uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16034) return } } if length != uint32(4) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) return } Xpng_crc_read(tls, png_ptr, bp, uint32(4)) if Xpng_crc_finish(tls, png_ptr, uint32(0)) != 0 { return } igamma = _png_get_fixed_point(tls, libc.UintptrFromInt32(0), bp) Xpng_colorspace_set_gamma(tls, png_ptr, png_ptr+1040, igamma) Xpng_colorspace_sync(tls, png_ptr, info_ptr) } func Xpng_handle_sBIT(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var i, truelen uint32 var sample_depth, v1, v2, v3 Tpng_byte var _ /* buf at bp+0 */ [4]Tpng_byte _, _, _, _, _, _ = i, sample_depth, truelen, v1, v2, v3 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&(libc.Uint32FromUint32(0x04)|libc.Uint32FromInt32(PNG_HAVE_PLTE3)) != uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16034) return } } if info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0002) != uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+10482) return } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { truelen = uint32(3) sample_depth = uint8(8) } else { truelen = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels) sample_depth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth } if length != truelen || length > uint32(4) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) Xpng_crc_finish(tls, png_ptr, length) return } v3 = sample_depth (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[int32(3)] = v3 v2 = v3 (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[int32(2)] = v2 v1 = v2 (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[int32(1)] = v1 (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[0] = v1 Xpng_crc_read(tls, png_ptr, bp, truelen) if Xpng_crc_finish(tls, png_ptr, uint32(0)) != 0 { return } i = uint32(0) for { if !(i < truelen) { break } if libc.Int32FromUint8((*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[i]) == 0 || libc.Int32FromUint8((*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[i]) > libc.Int32FromUint8(sample_depth) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) return } goto _4 _4: ; i++ } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fred = (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[0] (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fgreen = (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[int32(1)] (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fblue = (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[int32(2)] (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Falpha = (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[int32(3)] } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fgray = (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[0] (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fred = (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[0] (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fgreen = (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[0] (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Fblue = (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[0] (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bit.Falpha = (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[int32(1)] } Xpng_set_sBIT(tls, png_ptr, info_ptr, png_ptr+748) } func Xpng_handle_cHRM(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(64) defer tls.Free(64) var p1, p2 uintptr var _ /* buf at bp+0 */ [32]Tpng_byte var _ /* xy at bp+32 */ Tpng_xy _, _ = p1, p2 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&(libc.Uint32FromUint32(0x04)|libc.Uint32FromInt32(PNG_HAVE_PLTE3)) != uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16034) return } } if length != uint32(32) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) return } Xpng_crc_read(tls, png_ptr, bp, uint32(32)) if Xpng_crc_finish(tls, png_ptr, uint32(0)) != 0 { return } (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fwhitex = _png_get_fixed_point(tls, libc.UintptrFromInt32(0), bp) (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fwhitey = _png_get_fixed_point(tls, libc.UintptrFromInt32(0), bp+uintptr(4)) (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fredx = _png_get_fixed_point(tls, libc.UintptrFromInt32(0), bp+uintptr(8)) (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fredy = _png_get_fixed_point(tls, libc.UintptrFromInt32(0), bp+uintptr(12)) (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fgreenx = _png_get_fixed_point(tls, libc.UintptrFromInt32(0), bp+uintptr(16)) (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fgreeny = _png_get_fixed_point(tls, libc.UintptrFromInt32(0), bp+uintptr(20)) (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fbluex = _png_get_fixed_point(tls, libc.UintptrFromInt32(0), bp+uintptr(24)) (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fbluey = _png_get_fixed_point(tls, libc.UintptrFromInt32(0), bp+uintptr(28)) if (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fwhitex == -int32(1) || (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fwhitey == -int32(1) || (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fredx == -int32(1) || (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fredy == -int32(1) || (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fgreenx == -int32(1) || (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fgreeny == -int32(1) || (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fbluex == -int32(1) || (*(*Tpng_xy)(unsafe.Pointer(bp + 32))).Fbluey == -int32(1) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16150) return } /* If a colorspace error has already been output skip this chunk */ if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_INVALID5) != 0 { return } if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_FROM_cHRM1) != 0 { p1 = png_ptr + 1040 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID5)) Xpng_colorspace_sync(tls, png_ptr, info_ptr) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+10482) return } p2 = png_ptr + 1040 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p2)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PNG_COLORSPACE_FROM_cHRM1)) Xpng_colorspace_set_chromaticities(tls, png_ptr, png_ptr+1040, bp+32, int32(1)) Xpng_colorspace_sync(tls, png_ptr, info_ptr) } func Xpng_handle_sRGB(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var p1 uintptr var _ /* intent at bp+0 */ Tpng_byte _ = p1 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&(libc.Uint32FromUint32(0x04)|libc.Uint32FromInt32(PNG_HAVE_PLTE3)) != uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16034) return } } if length != uint32(1) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) return } Xpng_crc_read(tls, png_ptr, bp, uint32(1)) if Xpng_crc_finish(tls, png_ptr, uint32(0)) != 0 { return } /* If a colorspace error has already been output skip this chunk */ if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_INVALID5) != 0 { return } /* Only one sRGB or iCCP chunk is allowed, use the HAVE_INTENT flag to detect * this. */ if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_INTENT3) != 0 { p1 = png_ptr + 1040 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID5)) Xpng_colorspace_sync(tls, png_ptr, info_ptr) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16165) return } Xpng_colorspace_set_sRGB(tls, png_ptr, png_ptr+1040, libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(bp)))) Xpng_colorspace_sync(tls, png_ptr, info_ptr) } func Xpng_handle_iCCP(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, _length Tpng_uint_32) { bp := tls.Alloc(1248) defer tls.Free(1248) *(*Tpng_uint_32)(unsafe.Pointer(bp)) = _length /* Note: this does not properly handle profiles that are > 64K under DOS */ var errmsg Tpng_const_charp var finished int32 var keyword_length, read_length TuInt var profile Tpng_bytep var profile_length, tag_count Tpng_uint_32 var p1, p2 uintptr var _ /* keyword at bp+4 */ [81]uint8 var _ /* local_buffer at bp+217 */ [1024]TByte var _ /* profile_header at bp+85 */ [132]TByte var _ /* size at bp+1244 */ Tpng_alloc_size_t _, _, _, _, _, _, _, _, _ = errmsg, finished, keyword_length, profile, profile_length, read_length, tag_count, p1, p2 errmsg = libc.UintptrFromInt32(0) /* error message output, or no error */ finished = 0 /* crc checked */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&(libc.Uint32FromUint32(0x04)|libc.Uint32FromInt32(PNG_HAVE_PLTE3)) != uint32(0) { Xpng_crc_finish(tls, png_ptr, *(*Tpng_uint_32)(unsafe.Pointer(bp))) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16034) return } } /* Consistent with all the above colorspace handling an obviously *invalid* * chunk is just ignored, so does not invalidate the color space. An * alternative is to set the 'invalid' flags at the start of this routine * and only clear them in they were not set before and all the tests pass. */ /* The keyword must be at least one character and there is a * terminator (0) byte and the compression method byte, and the * 'zlib' datastream is at least 11 bytes. */ if *(*Tpng_uint_32)(unsafe.Pointer(bp)) < uint32(14) { Xpng_crc_finish(tls, png_ptr, *(*Tpng_uint_32)(unsafe.Pointer(bp))) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+10751) return } /* If a colorspace error has already been output skip this chunk */ if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_INVALID5) != 0 { Xpng_crc_finish(tls, png_ptr, *(*Tpng_uint_32)(unsafe.Pointer(bp))) return } /* Only one sRGB or iCCP chunk is allowed, use the HAVE_INTENT flag to detect * this. */ if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_HAVE_INTENT3) == 0 { /* Find the keyword; the keyword plus separator and compression method * bytes can be at most 81 characters long. */ read_length = uint32(81) /* maximum */ if read_length > *(*Tpng_uint_32)(unsafe.Pointer(bp)) { read_length = *(*Tpng_uint_32)(unsafe.Pointer(bp)) } Xpng_crc_read(tls, png_ptr, bp+4, read_length) *(*Tpng_uint_32)(unsafe.Pointer(bp)) -= read_length /* The minimum 'zlib' stream is assumed to be just the 2 byte header, * 5 bytes minimum 'deflate' stream, and the 4 byte checksum. */ if *(*Tpng_uint_32)(unsafe.Pointer(bp)) < uint32(11) { Xpng_crc_finish(tls, png_ptr, *(*Tpng_uint_32)(unsafe.Pointer(bp))) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+10751) return } keyword_length = uint32(0) for keyword_length < uint32(80) && keyword_length < read_length && libc.Int32FromUint8((*(*[81]uint8)(unsafe.Pointer(bp + 4)))[keyword_length]) != 0 { keyword_length++ } /* TODO: make the keyword checking common */ if keyword_length >= uint32(1) && keyword_length <= uint32(79) { /* We only understand '0' compression - deflate - so if we get a * different value we can't safely decode the chunk. */ if keyword_length+uint32(1) < read_length && libc.Int32FromUint8((*(*[81]uint8)(unsafe.Pointer(bp + 4)))[keyword_length+uint32(1)]) == PNG_COMPRESSION_TYPE_BASE { read_length -= keyword_length + uint32(2) if _png_inflate_claim(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(105))< uint32(0) && !((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&libc.Uint32FromUint32(0x100000) != 0) { errmsg = __ccgo_ts + 16012 } else { if *(*Tpng_alloc_size_t)(unsafe.Pointer(bp + 1244)) == uint32(0) { if *(*Tpng_uint_32)(unsafe.Pointer(bp)) > uint32(0) { /* This can be handled completely, so * keep going. */ Xpng_chunk_warning(tls, png_ptr, __ccgo_ts+16012) } Xpng_crc_finish(tls, png_ptr, *(*Tpng_uint_32)(unsafe.Pointer(bp))) finished = int32(1) /* Check for a match against sRGB */ Xpng_icc_set_sRGB(tls, png_ptr, png_ptr+1040, profile, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fadler) /* Steal the profile for info_ptr. */ if info_ptr != libc.UintptrFromInt32(0) { Xpng_free_data(tls, png_ptr, info_ptr, uint32(0x0010), 0) (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_name = Xpng_malloc_base(tls, png_ptr, keyword_length+uint32(1)) if (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_name != libc.UintptrFromInt32(0) { libc.Xmemcpy(tls, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_name, bp+4, keyword_length+uint32(1)) (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_proflen = profile_length (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_profile = profile (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer = libc.UintptrFromInt32(0) /*steal*/ *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x0010) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x1000) } else { p1 = png_ptr + 1040 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID5)) errmsg = __ccgo_ts + 16183 } } /* else the profile remains in the read * buffer which gets reused for subsequent * chunks. */ if info_ptr != libc.UintptrFromInt32(0) { Xpng_colorspace_sync(tls, png_ptr, info_ptr) } if errmsg == libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner = uint32(0) return } } } if errmsg == libc.UintptrFromInt32(0) { errmsg = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg } } /* else png_icc_check_tag_table output an error */ } else { /* profile truncated */ errmsg = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg } } else { errmsg = __ccgo_ts + 16183 } } /* else png_icc_check_header output an error */ } /* else png_icc_check_length output an error */ } else { /* profile truncated */ errmsg = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg } /* Release the stream */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner = uint32(0) } else { /* png_inflate_claim failed */ errmsg = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg } } else { errmsg = __ccgo_ts + 16197 } /* or missing */ } else { errmsg = __ccgo_ts + 16220 } } else { errmsg = __ccgo_ts + 16165 } /* Failure: the reason is in 'errmsg' */ if finished == 0 { Xpng_crc_finish(tls, png_ptr, *(*Tpng_uint_32)(unsafe.Pointer(bp))) } p2 = png_ptr + 1040 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p2)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p2))) | libc.Int32FromInt32(PNG_COLORSPACE_INVALID5)) Xpng_colorspace_sync(tls, png_ptr, info_ptr) if errmsg != libc.UintptrFromInt32(0) { /* else already output */ Xpng_chunk_benign_error(tls, png_ptr, errmsg) } } func Xpng_handle_sPLT(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) /* Note: this does not properly handle chunks that are > 64K under DOS */ var buffer, entry_start, v10, v4, v7, v8, v9 Tpng_bytep var data_length, dl, skip, v1 Tpng_uint_32 var entry_size, i, v5 int32 var max_dl Tsize_t var pp Tpng_sPLT_entryp var v2 uintptr var _ /* new_palette at bp+0 */ Tpng_sPLT_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = buffer, data_length, dl, entry_size, entry_start, i, max_dl, pp, skip, v1, v10, v2, v4, v5, v7, v8, v9 skip = uint32(0) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max == uint32(1) { Xpng_crc_finish(tls, png_ptr, length) return } v2 = png_ptr + 972 *(*Tpng_uint_32)(unsafe.Pointer(v2))-- v1 = *(*Tpng_uint_32)(unsafe.Pointer(v2)) if v1 == uint32(1) { Xpng_warning(tls, png_ptr, __ccgo_ts+16232) Xpng_crc_finish(tls, png_ptr, length) return } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) != uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16034) return } } buffer = _png_read_buffer(tls, png_ptr, length+uint32(1), int32(2)) if buffer == libc.UintptrFromInt32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16183) return } /* WARNING: this may break if size_t is less than 32 bits; it is assumed * that the PNG_MAX_MALLOC_64K test is enabled in this case, but this is a * potential breakage point if the types in pngconf.h aren't exactly right. */ Xpng_crc_read(tls, png_ptr, buffer, length) if Xpng_crc_finish(tls, png_ptr, skip) != 0 { return } *(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(length))) = uint8(0) entry_start = buffer for { if !(*(*Tpng_byte)(unsafe.Pointer(entry_start)) != 0) { break } /* Empty loop to find end of name */ goto _3 _3: ; entry_start++ } entry_start++ /* A sample depth should follow the separator, and we should be on it */ if length < uint32(2) || entry_start > buffer+uintptr(length-libc.Uint32FromUint32(2)) { Xpng_warning(tls, png_ptr, __ccgo_ts+16265) return } v4 = entry_start entry_start++ (*(*Tpng_sPLT_t)(unsafe.Pointer(bp))).Fdepth = *(*Tpng_byte)(unsafe.Pointer(v4)) if libc.Int32FromUint8((*(*Tpng_sPLT_t)(unsafe.Pointer(bp))).Fdepth) == int32(8) { v5 = int32(6) } else { v5 = int32(10) } entry_size = v5 /* This must fit in a png_uint_32 because it is derived from the original * chunk data length. */ data_length = length - libc.Uint32FromInt32(int32(entry_start)-int32(buffer)) /* Integrity-check the data length */ if data_length%libc.Uint32FromInt32(entry_size) != uint32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+16286) return } dl = data_length / libc.Uint32FromInt32(entry_size) max_dl = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) / libc.Uint32FromInt64(10) if dl > max_dl { Xpng_warning(tls, png_ptr, __ccgo_ts+16312) return } (*(*Tpng_sPLT_t)(unsafe.Pointer(bp))).Fnentries = libc.Int32FromUint32(data_length / libc.Uint32FromInt32(entry_size)) (*(*Tpng_sPLT_t)(unsafe.Pointer(bp))).Fentries = Xpng_malloc_warn(tls, png_ptr, libc.Uint32FromInt32((*(*Tpng_sPLT_t)(unsafe.Pointer(bp))).Fnentries)*libc.Uint32FromInt64(10)) if (*(*Tpng_sPLT_t)(unsafe.Pointer(bp))).Fentries == libc.UintptrFromInt32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+16332) return } i = 0 for { if !(i < (*(*Tpng_sPLT_t)(unsafe.Pointer(bp))).Fnentries) { break } pp = (*(*Tpng_sPLT_t)(unsafe.Pointer(bp))).Fentries + uintptr(i)*10 if libc.Int32FromUint8((*(*Tpng_sPLT_t)(unsafe.Pointer(bp))).Fdepth) == int32(8) { v7 = entry_start entry_start++ (*Tpng_sPLT_entry)(unsafe.Pointer(pp)).Fred = uint16(*(*Tpng_byte)(unsafe.Pointer(v7))) v8 = entry_start entry_start++ (*Tpng_sPLT_entry)(unsafe.Pointer(pp)).Fgreen = uint16(*(*Tpng_byte)(unsafe.Pointer(v8))) v9 = entry_start entry_start++ (*Tpng_sPLT_entry)(unsafe.Pointer(pp)).Fblue = uint16(*(*Tpng_byte)(unsafe.Pointer(v9))) v10 = entry_start entry_start++ (*Tpng_sPLT_entry)(unsafe.Pointer(pp)).Falpha = uint16(*(*Tpng_byte)(unsafe.Pointer(v10))) } else { (*Tpng_sPLT_entry)(unsafe.Pointer(pp)).Fred = uint16(uint32(*(*Tpng_byte)(unsafe.Pointer(entry_start)))< uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) || length > libc.Uint32FromInt32(PNG_MAX_PALETTE_LENGTH) || length == uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) return } Xpng_crc_read(tls, png_ptr, bp, length) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans = uint16(length) } else { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16368) return } } } if Xpng_crc_finish(tls, png_ptr, uint32(0)) != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans = uint16(0) return } /* TODO: this is a horrible side effect in the palette case because the * png_struct ends up with a pointer to the tRNS buffer owned by the * png_info. Fix this. */ Xpng_set_tRNS(tls, png_ptr, info_ptr, bp, libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans), png_ptr+764) } func Xpng_handle_bKGD(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var truelen uint32 var v1, v2, v3, v4, v5 Tpng_uint_16 var _ /* background at bp+6 */ Tpng_color_16 var _ /* buf at bp+0 */ [6]Tpng_byte _, _, _, _, _, _ = truelen, v1, v2, v3, v4, v5 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) != uint32(0) || libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_PLTE3) == uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16034) return } else { if info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0020) != uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+10482) return } } } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { truelen = uint32(1) } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { truelen = uint32(6) } else { truelen = uint32(2) } } if length != truelen { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) return } Xpng_crc_read(tls, png_ptr, bp, truelen) if Xpng_crc_finish(tls, png_ptr, uint32(0)) != 0 { return } /* We convert the index value into RGB components so that we can allow * arbitrary RGB values for background when we have transparency, and * so it is easy to determine the RGB values of the background color * from the info_ptr struct. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { (*(*Tpng_color_16)(unsafe.Pointer(bp + 6))).Findex = (*(*[6]Tpng_byte)(unsafe.Pointer(bp)))[0] if info_ptr != libc.UintptrFromInt32(0) && libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_palette) != 0 { if libc.Int32FromUint8((*(*[6]Tpng_byte)(unsafe.Pointer(bp)))[0]) >= libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_palette) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16395) return } (*(*Tpng_color_16)(unsafe.Pointer(bp + 6))).Fred = uint16((*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr((*(*[6]Tpng_byte)(unsafe.Pointer(bp)))[0])*3))).Fred) (*(*Tpng_color_16)(unsafe.Pointer(bp + 6))).Fgreen = uint16((*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr((*(*[6]Tpng_byte)(unsafe.Pointer(bp)))[0])*3))).Fgreen) (*(*Tpng_color_16)(unsafe.Pointer(bp + 6))).Fblue = uint16((*(*Tpng_color)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette + uintptr((*(*[6]Tpng_byte)(unsafe.Pointer(bp)))[0])*3))).Fblue) } else { v2 = libc.Uint16FromInt32(0) (*(*Tpng_color_16)(unsafe.Pointer(bp + 6))).Fblue = v2 v1 = v2 (*(*Tpng_color_16)(unsafe.Pointer(bp + 6))).Fgreen = v1 (*(*Tpng_color_16)(unsafe.Pointer(bp + 6))).Fred = v1 } (*(*Tpng_color_16)(unsafe.Pointer(bp + 6))).Fgray = uint16(0) } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) == 0 { /* GRAY */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) <= int32(8) { if libc.Int32FromUint8((*(*[6]Tpng_byte)(unsafe.Pointer(bp)))[0]) != 0 || uint32((*(*[6]Tpng_byte)(unsafe.Pointer(bp)))[int32(1)]) >= libc.Uint32FromInt32(libc.Int32FromInt32(1)<<(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16409) return } } (*(*Tpng_color_16)(unsafe.Pointer(bp + 6))).Findex = uint8(0) v5 = uint16(uint32(*(*Tpng_byte)(unsafe.Pointer(bp)))< libc.Uint32FromInt32(PNG_MAX_PALETTE_LENGTH) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) return } i = uint32(0) for { if !(i < num) { break } Xpng_crc_read(tls, png_ptr, bp+512, uint32(2)) (*(*[256]Tpng_uint_16)(unsafe.Pointer(bp)))[i] = uint16(uint32(*(*Tpng_byte)(unsafe.Pointer(bp + 512)))<= int32(PNG_EQUATION_LAST) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16497) } } buf = units for { if !(*(*Tpng_byte)(unsafe.Pointer(buf)) != 0) { break } /* Empty loop to move past the units string. */ goto _4 _4: ; buf++ } params = Xpng_malloc_warn(tls, png_ptr, uint32(nparams)*libc.Uint32FromInt64(4)) if params == libc.UintptrFromInt32(0) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16183) return } /* Get pointers to the start of each parameter string. */ i = 0 for { if !(i < libc.Int32FromUint8(nparams)) { break } buf++ /* Skip the null string terminator from previous parameter. */ *(*uintptr)(unsafe.Pointer(params + uintptr(i)*4)) = buf for { if !(buf <= endptr && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buf))) != 0) { break } /* Empty loop to move past each parameter string */ goto _6 _6: ; buf++ } /* Make sure we haven't run out of data yet */ if buf > endptr { Xpng_free(tls, png_ptr, params) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16524) return } goto _5 _5: ; i++ } Xpng_set_pCAL(tls, png_ptr, info_ptr, buffer, X0, X1, libc.Int32FromUint8(type1), libc.Int32FromUint8(nparams), units, params) Xpng_free(tls, png_ptr, params) } // C documentation // // /* Read the sCAL chunk */ func Xpng_handle_sCAL(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var buffer Tpng_bytep var heighti, v1 Tsize_t var v2 bool var _ /* i at bp+0 */ Tsize_t var _ /* state at bp+4 */ int32 _, _, _, _ = buffer, heighti, v1, v2 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } else { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) != uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16034) return } else { if info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x4000) != uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+10482) return } else { if length < uint32(4) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) return } } } } buffer = _png_read_buffer(tls, png_ptr, length+uint32(1), int32(2)) if buffer == libc.UintptrFromInt32(0) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16183) Xpng_crc_finish(tls, png_ptr, length) return } Xpng_crc_read(tls, png_ptr, buffer, length) *(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(length))) = uint8(0) /* Null terminate the last string */ if Xpng_crc_finish(tls, png_ptr, uint32(0)) != 0 { return } /* Validate the unit. */ if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer))) != int32(1) && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer))) != int32(2) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16537) return } /* Validate the ASCII numbers, need two ASCII numbers separated by * a '\0' and they need to fit exactly in the chunk data. */ *(*Tsize_t)(unsafe.Pointer(bp)) = uint32(1) *(*int32)(unsafe.Pointer(bp + 4)) = 0 if v2 = Xpng_check_fp_number(tls, buffer, length, bp+4, bp) == 0 || *(*Tsize_t)(unsafe.Pointer(bp)) >= length; !v2 { v1 = *(*Tsize_t)(unsafe.Pointer(bp)) *(*Tsize_t)(unsafe.Pointer(bp))++ } if v2 || libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(v1)))) != 0 { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16550) } else { if libc.BoolInt32(*(*int32)(unsafe.Pointer(bp + 4))&(libc.Int32FromInt32(PNG_FP_SAW_DIGIT)|libc.Int32FromInt32(PNG_FP_NEGATIVE)|libc.Int32FromInt32(PNG_FP_NONZERO)) == libc.Int32FromInt32(PNG_FP_SAW_DIGIT)|libc.Int32FromInt32(PNG_FP_NONZERO)) == 0 { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16567) } else { heighti = *(*Tsize_t)(unsafe.Pointer(bp)) *(*int32)(unsafe.Pointer(bp + 4)) = 0 if Xpng_check_fp_number(tls, buffer, length, bp+4, bp) == 0 || *(*Tsize_t)(unsafe.Pointer(bp)) != length { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16586) } else { if libc.BoolInt32(*(*int32)(unsafe.Pointer(bp + 4))&(libc.Int32FromInt32(PNG_FP_SAW_DIGIT)|libc.Int32FromInt32(PNG_FP_NEGATIVE)|libc.Int32FromInt32(PNG_FP_NONZERO)) == libc.Int32FromInt32(PNG_FP_SAW_DIGIT)|libc.Int32FromInt32(PNG_FP_NONZERO)) == 0 { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16604) } else { /* This is the (only) success case. */ Xpng_set_sCAL_s(tls, png_ptr, info_ptr, libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer))), buffer+uintptr(1), buffer+uintptr(heighti)) } } } } } func Xpng_handle_tIME(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [7]Tpng_byte var _ /* mod_time at bp+8 */ Tpng_time if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } else { if info_ptr != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0200) != uint32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+10482) return } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) != uint32(0) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(PNG_AFTER_IDAT3) } if length != uint32(7) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16047) return } Xpng_crc_read(tls, png_ptr, bp, uint32(7)) if Xpng_crc_finish(tls, png_ptr, uint32(0)) != 0 { return } (*(*Tpng_time)(unsafe.Pointer(bp + 8))).Fsecond = (*(*[7]Tpng_byte)(unsafe.Pointer(bp)))[int32(6)] (*(*Tpng_time)(unsafe.Pointer(bp + 8))).Fminute = (*(*[7]Tpng_byte)(unsafe.Pointer(bp)))[int32(5)] (*(*Tpng_time)(unsafe.Pointer(bp + 8))).Fhour = (*(*[7]Tpng_byte)(unsafe.Pointer(bp)))[int32(4)] (*(*Tpng_time)(unsafe.Pointer(bp + 8))).Fday = (*(*[7]Tpng_byte)(unsafe.Pointer(bp)))[int32(3)] (*(*Tpng_time)(unsafe.Pointer(bp + 8))).Fmonth = (*(*[7]Tpng_byte)(unsafe.Pointer(bp)))[int32(2)] (*(*Tpng_time)(unsafe.Pointer(bp + 8))).Fyear = uint16(uint32(*(*Tpng_byte)(unsafe.Pointer(bp)))< 64K under DOS */ func Xpng_handle_tEXt(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(32) defer tls.Free(32) var buffer Tpng_bytep var key, text Tpng_charp var skip, v1 Tpng_uint_32 var v2 uintptr var _ /* text_info at bp+0 */ Tpng_text _, _, _, _, _, _ = buffer, key, skip, text, v1, v2 skip = uint32(0) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max == uint32(1) { Xpng_crc_finish(tls, png_ptr, length) return } v2 = png_ptr + 972 *(*Tpng_uint_32)(unsafe.Pointer(v2))-- v1 = *(*Tpng_uint_32)(unsafe.Pointer(v2)) if v1 == uint32(1) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16624) return } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) != uint32(0) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(PNG_AFTER_IDAT3) } buffer = _png_read_buffer(tls, png_ptr, length+uint32(1), int32(1)) if buffer == libc.UintptrFromInt32(0) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16183) return } Xpng_crc_read(tls, png_ptr, buffer, length) if Xpng_crc_finish(tls, png_ptr, skip) != 0 { return } key = buffer *(*uint8)(unsafe.Pointer(key + uintptr(length))) = uint8(0) text = key for { if !(*(*uint8)(unsafe.Pointer(text)) != 0) { break } /* Empty loop to find end of key */ goto _3 _3: ; text++ } if text != key+uintptr(length) { text++ } (*(*Tpng_text)(unsafe.Pointer(bp))).Fcompression = -int32(1) (*(*Tpng_text)(unsafe.Pointer(bp))).Fkey = key (*(*Tpng_text)(unsafe.Pointer(bp))).Flang = libc.UintptrFromInt32(0) (*(*Tpng_text)(unsafe.Pointer(bp))).Flang_key = libc.UintptrFromInt32(0) (*(*Tpng_text)(unsafe.Pointer(bp))).Fitxt_length = uint32(0) (*(*Tpng_text)(unsafe.Pointer(bp))).Ftext = text (*(*Tpng_text)(unsafe.Pointer(bp))).Ftext_length = libc.Xstrlen(tls, text) if Xpng_set_text_2(tls, png_ptr, info_ptr, bp, int32(1)) != 0 { Xpng_warning(tls, png_ptr, __ccgo_ts+16648) } } // C documentation // // /* Note: this does not correctly handle chunks that are > 64K under DOS */ func Xpng_handle_zTXt(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(32) defer tls.Free(32) var buffer Tpng_bytep var errmsg Tpng_const_charp var keyword_length, v1 Tpng_uint_32 var v2 uintptr var _ /* text at bp+4 */ Tpng_text var _ /* uncompressed_length at bp+0 */ Tpng_alloc_size_t _, _, _, _, _ = buffer, errmsg, keyword_length, v1, v2 errmsg = libc.UintptrFromInt32(0) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max == uint32(1) { Xpng_crc_finish(tls, png_ptr, length) return } v2 = png_ptr + 972 *(*Tpng_uint_32)(unsafe.Pointer(v2))-- v1 = *(*Tpng_uint_32)(unsafe.Pointer(v2)) if v1 == uint32(1) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16624) return } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) != uint32(0) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(PNG_AFTER_IDAT3) } /* Note, "length" is sufficient here; we won't be adding * a null terminator later. */ buffer = _png_read_buffer(tls, png_ptr, length, int32(2)) if buffer == libc.UintptrFromInt32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16183) return } Xpng_crc_read(tls, png_ptr, buffer, length) if Xpng_crc_finish(tls, png_ptr, uint32(0)) != 0 { return } /* TODO: also check that the keyword contents match the spec! */ keyword_length = uint32(0) for { if !(keyword_length < length && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(keyword_length)))) != 0) { break } /* Empty loop to find end of name */ goto _3 _3: ; keyword_length++ } if keyword_length > uint32(79) || keyword_length < uint32(1) { errmsg = __ccgo_ts + 16220 } else { if keyword_length+uint32(3) > length { errmsg = __ccgo_ts + 10324 } else { if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(keyword_length+uint32(1))))) != PNG_COMPRESSION_TYPE_BASE { errmsg = __ccgo_ts + 16690 } else { *(*Tpng_alloc_size_t)(unsafe.Pointer(bp)) = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) /* TODO: at present png_decompress_chunk imposes a single application * level memory limit, this should be split to different values for iCCP * and text chunks. */ if _png_decompress_chunk(tls, png_ptr, length, keyword_length+uint32(2), bp, int32(1)) == int32(Z_STREAM_END) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer == libc.UintptrFromInt32(0) { errmsg = __ccgo_ts + 16715 } else { /* It worked; png_ptr->read_buffer now looks like a tEXt chunk * except for the extra compression type byte and the fact that * it isn't necessarily '\0' terminated. */ buffer = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer *(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(*(*Tpng_alloc_size_t)(unsafe.Pointer(bp))+(keyword_length+uint32(2))))) = uint8(0) (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Fcompression = PNG_TEXT_COMPRESSION_zTXt (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Fkey = buffer (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Ftext = buffer + uintptr(keyword_length) + libc.UintptrFromInt32(2) (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Ftext_length = *(*Tpng_alloc_size_t)(unsafe.Pointer(bp)) (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Fitxt_length = uint32(0) (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Flang = libc.UintptrFromInt32(0) (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Flang_key = libc.UintptrFromInt32(0) if Xpng_set_text_2(tls, png_ptr, info_ptr, bp+4, int32(1)) != 0 { errmsg = __ccgo_ts + 10304 } } } else { errmsg = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg } } } } if errmsg != libc.UintptrFromInt32(0) { Xpng_chunk_benign_error(tls, png_ptr, errmsg) } } // C documentation // // /* Note: this does not correctly handle chunks that are > 64K under DOS */ func Xpng_handle_iTXt(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32) { bp := tls.Alloc(32) defer tls.Free(32) var buffer Tpng_bytep var compressed int32 var errmsg Tpng_const_charp var language_offset, prefix_length, translated_keyword_offset, v1, v5 Tpng_uint_32 var v2 uintptr var _ /* text at bp+4 */ Tpng_text var _ /* uncompressed_length at bp+0 */ Tpng_alloc_size_t _, _, _, _, _, _, _, _, _ = buffer, compressed, errmsg, language_offset, prefix_length, translated_keyword_offset, v1, v2, v5 errmsg = libc.UintptrFromInt32(0) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max == uint32(1) { Xpng_crc_finish(tls, png_ptr, length) return } v2 = png_ptr + 972 *(*Tpng_uint_32)(unsafe.Pointer(v2))-- v1 = *(*Tpng_uint_32)(unsafe.Pointer(v2)) if v1 == uint32(1) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16624) return } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(PNG_HAVE_IHDR3) == uint32(0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16055) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) != uint32(0) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(PNG_AFTER_IDAT3) } buffer = _png_read_buffer(tls, png_ptr, length+uint32(1), int32(1)) if buffer == libc.UintptrFromInt32(0) { Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16183) return } Xpng_crc_read(tls, png_ptr, buffer, length) if Xpng_crc_finish(tls, png_ptr, uint32(0)) != 0 { return } /* First the keyword. */ prefix_length = uint32(0) for { if !(prefix_length < length && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(prefix_length)))) != 0) { break } /* Empty loop */ goto _3 _3: ; prefix_length++ } /* Perform a basic check on the keyword length here. */ if prefix_length > uint32(79) || prefix_length < uint32(1) { errmsg = __ccgo_ts + 16220 } else { if prefix_length+uint32(5) > length { errmsg = __ccgo_ts + 10324 } else { if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(prefix_length+uint32(1))))) == 0 || libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(prefix_length+uint32(1))))) == int32(1) && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(prefix_length+uint32(2))))) == PNG_COMPRESSION_TYPE_BASE { compressed = libc.BoolInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(prefix_length+uint32(1))))) != 0) *(*Tpng_alloc_size_t)(unsafe.Pointer(bp)) = uint32(0) /* Now the language tag */ prefix_length += uint32(3) language_offset = prefix_length for { if !(prefix_length < length && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(prefix_length)))) != 0) { break } /* Empty loop */ goto _4 _4: ; prefix_length++ } /* WARNING: the length may be invalid here, this is checked below. */ prefix_length++ v5 = prefix_length translated_keyword_offset = v5 for { if !(prefix_length < length && libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(prefix_length)))) != 0) { break } /* Empty loop */ goto _6 _6: ; prefix_length++ } /* prefix_length should now be at the trailing '\0' of the translated * keyword, but it may already be over the end. None of this arithmetic * can overflow because chunks are at most 2^31 bytes long, but on 16-bit * systems the available allocation may overflow. */ prefix_length++ if compressed == 0 && prefix_length <= length { *(*Tpng_alloc_size_t)(unsafe.Pointer(bp)) = length - prefix_length } else { if compressed != 0 && prefix_length < length { *(*Tpng_alloc_size_t)(unsafe.Pointer(bp)) = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) /* TODO: at present png_decompress_chunk imposes a single application * level memory limit, this should be split to different values for * iCCP and text chunks. */ if _png_decompress_chunk(tls, png_ptr, length, prefix_length, bp, int32(1)) == int32(Z_STREAM_END) { buffer = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer } else { errmsg = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg } } else { errmsg = __ccgo_ts + 10324 } } if errmsg == libc.UintptrFromInt32(0) { *(*Tpng_byte)(unsafe.Pointer(buffer + uintptr(*(*Tpng_alloc_size_t)(unsafe.Pointer(bp))+prefix_length))) = uint8(0) if compressed == 0 { (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Fcompression = int32(PNG_ITXT_COMPRESSION_NONE) } else { (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Fcompression = int32(PNG_ITXT_COMPRESSION_zTXt) } (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Fkey = buffer (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Flang = buffer + uintptr(language_offset) (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Flang_key = buffer + uintptr(translated_keyword_offset) (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Ftext = buffer + uintptr(prefix_length) (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Ftext_length = uint32(0) (*(*Tpng_text)(unsafe.Pointer(bp + 4))).Fitxt_length = *(*Tpng_alloc_size_t)(unsafe.Pointer(bp)) if Xpng_set_text_2(tls, png_ptr, info_ptr, bp+4, int32(1)) != 0 { errmsg = __ccgo_ts + 10304 } } } else { errmsg = __ccgo_ts + 16747 } } } if errmsg != libc.UintptrFromInt32(0) { Xpng_chunk_benign_error(tls, png_ptr, errmsg) } } // C documentation // // /* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */ func _png_cache_unknown_chunk(tls *libc.TLS, png_ptr Tpng_structrp, length Tpng_uint_32) (r int32) { var limit Tpng_alloc_size_t _ = limit limit = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fdata != libc.UintptrFromInt32(0) { Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fdata) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fdata = libc.UintptrFromInt32(0) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max > uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max < limit { limit = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max } if length <= limit { *(*uint8)(unsafe.Pointer(png_ptr + 980)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name >> libc.Int32FromInt32(24) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(png_ptr + 980 + 1)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(png_ptr + 980 + 2)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(png_ptr + 980 + 3)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(png_ptr + 980 + 4)) = libc.Uint8FromInt32(0) /* The following is safe because of the PNG_SIZE_MAX init above */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fsize = length /* 'mode' is a flag array, only the bottom four bits matter here */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Flocation = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode) if length == uint32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fdata = libc.UintptrFromInt32(0) } else { /* Do a 'warn' here - it is handled below. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fdata = Xpng_malloc_warn(tls, png_ptr, length) } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fdata == libc.UintptrFromInt32(0) && length > uint32(0) { /* This is benign because we clean up correctly */ Xpng_crc_finish(tls, png_ptr, length) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16768) return 0 } else { if length > uint32(0) { Xpng_crc_read(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fdata, length) } Xpng_crc_finish(tls, png_ptr, uint32(0)) return int32(1) } return r } // C documentation // // /* Handle an unknown, or known but disabled, chunk */ func Xpng_handle_unknown(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, length Tpng_uint_32, keep int32) { var handled, ret int32 _, _ = handled, ret handled = 0 /* the chunk was handled */ /* NOTE: this code is based on the code in libpng-1.4.12 except for fixing * the bug which meant that setting a non-default behavior for a specific * chunk would be ignored (the default was always used unless a user * callback was installed). * * 'keep' is the value from the png_chunk_unknown_handling, the setting for * this specific chunk_name, if PNG_HANDLE_AS_UNKNOWN_SUPPORTED, if not it * will always be PNG_HANDLE_CHUNK_AS_DEFAULT and it needs to be set here. * This is just an optimization to avoid multiple calls to the lookup * function. */ /* One of the following methods will read the chunk or skip it (at least one * of these is always defined because this is the only way to switch on * PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) */ /* The user callback takes precedence over the chunk keep value, but the * keep value is still required to validate a save of a critical chunk. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_user_chunk_fn != libc.UintptrFromInt32(0) { if _png_cache_unknown_chunk(tls, png_ptr, length) != 0 { /* Callback to user unknown chunk handler */ ret = (*(*func(*libc.TLS, Tpng_structp, Tpng_unknown_chunkp) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_user_chunk_fn})))(tls, png_ptr, png_ptr+980) /* ret is: * negative: An error occurred; png_chunk_error will be called. * zero: The chunk was not handled, the chunk will be discarded * unless png_set_keep_unknown_chunks has been used to set * a 'keep' behavior for this particular chunk, in which * case that will be used. A critical chunk will cause an * error at this point unless it is to be saved. * positive: The chunk was handled, libpng will ignore/discard it. */ if ret < 0 { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16804) } else { if ret == 0 { /* If the keep value is 'default' or 'never' override it, but * still error out on critical chunks unless the keep value is * 'always' While this is weird it is the behavior in 1.4.12. * A possible improvement would be to obey the value set for the * chunk, but this would be an API change that would probably * damage some applications. * * The png_app_warning below catches the case that matters, where * the application has not set specific save or ignore for this * chunk or global save or ignore. */ if keep < int32(PNG_HANDLE_CHUNK_IF_SAFE) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_default < int32(PNG_HANDLE_CHUNK_IF_SAFE) { Xpng_chunk_warning(tls, png_ptr, __ccgo_ts+16824) Xpng_app_warning(tls, png_ptr, __ccgo_ts+16846) /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */ } keep = int32(PNG_HANDLE_CHUNK_IF_SAFE) } } else { /* chunk was handled */ handled = int32(1) /* Critical chunks can be safely discarded at this point. */ keep = int32(PNG_HANDLE_CHUNK_NEVER) } } } else { keep = int32(PNG_HANDLE_CHUNK_NEVER) } /* insufficient memory */ } else { /* Use the SAVE_UNKNOWN_CHUNKS code or skip the chunk */ /* keep is currently just the per-chunk setting, if there was no * setting change it to the global default now (not that this may * still be AS_DEFAULT) then obtain the cache of the chunk if required, * if not simply skip the chunk. */ if keep == PNG_HANDLE_CHUNK_AS_DEFAULT { keep = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_default } if keep == int32(PNG_HANDLE_CHUNK_ALWAYS) || keep == int32(PNG_HANDLE_CHUNK_IF_SAFE) && uint32(1)&((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name>>libc.Int32FromInt32(29)) != 0 { if _png_cache_unknown_chunk(tls, png_ptr, length) == 0 { keep = int32(PNG_HANDLE_CHUNK_NEVER) } } else { Xpng_crc_finish(tls, png_ptr, length) } } /* Now store the chunk in the chunk list if appropriate, and if the limits * permit it. */ if keep == int32(PNG_HANDLE_CHUNK_ALWAYS) || keep == int32(PNG_HANDLE_CHUNK_IF_SAFE) && uint32(1)&((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name>>libc.Int32FromInt32(29)) != 0 { switch (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max { case uint32(2): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max = uint32(1) Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+16624) /* FALLTHROUGH */ fallthrough case uint32(1): /* NOTE: prior to 1.6.0 this case resulted in an unknown critical * chunk being skipped, now there will be a hard error below. */ default: /* not at limit */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max-- /* FALLTHROUGH */ fallthrough case uint32(0): /* no limit */ /* Here when the limit isn't reached or when limits are compiled * out; store the chunk. */ Xpng_set_unknown_chunks(tls, png_ptr, info_ptr, png_ptr+980, int32(1)) handled = int32(1) break } } /* Regardless of the error handling below the cached data (if any) can be * freed now. Notice that the data is not freed if there is a png_error, but * it will be freed by destroy_read_struct. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fdata != libc.UintptrFromInt32(0) { Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fdata) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_chunk.Fdata = libc.UintptrFromInt32(0) /* Check for unhandled critical chunks */ if handled == 0 && !(libc.Uint32FromInt32(1)&((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name>>libc.Int32FromInt32(29)) != 0) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16922) } } /* This function is called to verify that a chunk name is valid. * This function can't have the "critical chunk check" incorporated * into it, since in the future we will need to be able to call user * functions to handle unknown critical chunks after we check that * the chunk name itself is valid. */ /* Bit hacking: the test for an invalid byte in the 4 byte chunk name is: * * ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) */ func Xpng_check_chunk_name(tls *libc.TLS, png_ptr Tpng_const_structrp, chunk_name Tpng_uint_32) { var c, i int32 var cn Tpng_uint_32 _, _, _ = c, cn, i cn = chunk_name i = int32(1) for { if !(i <= int32(4)) { break } c = libc.Int32FromUint32(cn & uint32(0xff)) if c < int32(65) || c > int32(122) || c > int32(90) && c < int32(97) { Xpng_chunk_error(tls, png_ptr, __ccgo_ts+16947) } cn >>= uint32(8) goto _1 _1: ; i++ } } func Xpng_check_chunk_length(tls *libc.TLS, png_ptr Tpng_const_structrp, length Tpng_uint_32) { var idat_limit, limit Tpng_alloc_size_t var row_factor Tsize_t var v1, v2 int32 var v3, v4, v5 uint32 _, _, _, _, _, _, _, _ = idat_limit, limit, row_factor, v1, v2, v3, v4, v5 limit = libc.Uint32FromInt32(0x7fffffff) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max > uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max < limit { limit = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name == libc.Uint32FromInt32(libc.Int32FromInt32(73))< int32(8) { v1 = int32(2) } else { v1 = int32(1) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced != 0 { v2 = int32(6) } else { v2 = 0 } row_factor = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth*uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels)*libc.Uint32FromInt32(v1) + uint32(1) + libc.Uint32FromInt32(v2) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/row_factor { idat_limit = libc.Uint32FromInt32(0x7fffffff) } else { idat_limit = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight * row_factor } if row_factor > uint32(32566) { v3 = uint32(32566) } else { v3 = row_factor } row_factor = v3 idat_limit += uint32(6) + uint32(5)*(idat_limit/row_factor+uint32(1)) /* zlib+deflate overhead */ if idat_limit < libc.Uint32FromInt32(0x7fffffff) { v4 = idat_limit } else { v4 = libc.Uint32FromInt32(0x7fffffff) } idat_limit = v4 if limit < idat_limit { v5 = idat_limit } else { v5 = limit } limit = v5 } if length > limit { Xpng_benign_error(tls, png_ptr, __ccgo_ts+16966) } } // C documentation // // /* Combines the row recently read in with the existing pixels in the row. This // * routine takes care of alpha and transparency if requested. This routine also // * handles the two methods of progressive display of interlaced images, // * depending on the 'display' value; if 'display' is true then the whole row // * (dp) is filled from the start by replicating the available pixels. If // * 'display' is false only those pixels present in the pass are filled in. // */ func Xpng_combine_row(tls *libc.TLS, png_ptr Tpng_const_structrp, dp Tpng_bytep, display int32) { var bytes_to_copy, bytes_to_jump, end_mask, offset, pass, pixel_depth, v1, v3, v37, v4, v9 uint32 var c, c1, skip, skip1 Tsize_t var dp16, v30 Tpng_uint_16p var dp32, v24 Tpng_uint_32p var end_byte Tpng_byte var end_ptr, v28, v34 Tpng_bytep var m, mask, pixels_per_byte Tpng_uint_32 var row_width, v26, v32 Tpng_alloc_size_t var sp, v29, v35 Tpng_const_bytep var sp16, v31 Tpng_const_uint_16p var sp32, v25 Tpng_const_uint_32p var v10, v11, v12, v13, v5, v6, v7, v8 int32 var v2 bool _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bytes_to_copy, bytes_to_jump, c, c1, dp16, dp32, end_byte, end_mask, end_ptr, m, mask, offset, pass, pixel_depth, pixels_per_byte, row_width, skip, skip1, sp, sp16, sp32, v1, v10, v11, v12, v13, v2, v24, v25, v26, v28, v29, v3, v30, v31, v32, v34, v35, v37, v4, v5, v6, v7, v8, v9 pixel_depth = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformed_pixel_depth) sp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) row_width = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth pass = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) end_ptr = uintptr(0) end_byte = uint8(0) /* Added in 1.5.6: it should not be possible to enter this routine until at * least one row has been read from the PNG data and transformed. */ if pixel_depth == uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+16990) } /* Added in 1.5.4: the pixel depth should match the information returned by * any call to png_read_update_info at this point. Do not continue if we got * this wrong. */ if v2 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Finfo_rowbytes != uint32(0); v2 { if pixel_depth >= uint32(8) { v1 = row_width * (pixel_depth >> libc.Int32FromInt32(3)) } else { v1 = (row_width*pixel_depth + uint32(7)) >> int32(3) } } if v2 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Finfo_rowbytes != v1 { Xpng_error(tls, png_ptr, __ccgo_ts+17015) } /* Don't expect this to ever happen: */ if row_width == uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+17051) } /* Preserve the last byte in cases where only part of it will be overwritten, * the multiply below may overflow, we don't care because ANSI-C guarantees * we get the low bits. */ end_mask = pixel_depth * row_width & uint32(7) if end_mask != uint32(0) { /* end_ptr == NULL is a flag to say do nothing */ if pixel_depth >= uint32(8) { v3 = row_width * (pixel_depth >> libc.Int32FromInt32(3)) } else { v3 = (row_width*pixel_depth + uint32(7)) >> int32(3) } end_ptr = dp + uintptr(v3) - uintptr(1) end_byte = *(*Tpng_byte)(unsafe.Pointer(end_ptr)) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x10000) != uint32(0) { /* little-endian byte */ end_mask = libc.Uint32FromInt32(libc.Int32FromInt32(0xff) << end_mask) } else { /* big-endian byte */ end_mask = libc.Uint32FromInt32(int32(0xff) >> end_mask) } /* end_mask is now the bits to *keep* from the destination row */ } /* For non-interlaced images this reduces to a memcpy(). A memcpy() * will also happen if interlacing isn't supported or if the application * does not call png_set_interlace_handling(). In the latter cases the * caller just gets a sequence of the unexpanded rows from each interlace * pass. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) != uint32(0) && pass < uint32(6) && (display == 0 || display == int32(1) && pass&uint32(1) != uint32(0)) { /* Narrow images may have no bits in a pass; the caller should handle * this, but this test is cheap: */ if row_width <= uint32(1)&pass<<(uint32(3)-(pass+uint32(1))>>int32(1))&uint32(7) { return } if pixel_depth < uint32(8) { /* Use the appropriate mask to copy the required bits. In some cases * the byte mask will be 0 or 0xff; optimize these cases. row_width is * the number of pixels, but the code copies bytes, so it is necessary * to special case the end. */ pixels_per_byte = uint32(8) / pixel_depth if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x10000) != uint32(0) { if display != 0 { if pixel_depth == uint32(1) { v5 = 0 } else { if pixel_depth == uint32(2) { v6 = int32(1) } else { v6 = int32(2) } v5 = v6 } v4 = *(*Tpng_uint_32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_display_mask)) + uintptr(v5)*12 + uintptr(pass>>int32(1))*4)) } else { if pixel_depth == uint32(1) { v7 = 0 } else { if pixel_depth == uint32(2) { v8 = int32(1) } else { v8 = int32(2) } v7 = v8 } v4 = *(*Tpng_uint_32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_row_mask)) + uintptr(v7)*24 + uintptr(pass)*4)) } mask = v4 } else { if display != 0 { if pixel_depth == uint32(1) { v10 = 0 } else { if pixel_depth == uint32(2) { v11 = int32(1) } else { v11 = int32(2) } v10 = v11 } v9 = *(*Tpng_uint_32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_display_mask)) + 1*36 + uintptr(v10)*12 + uintptr(pass>>int32(1))*4)) } else { if pixel_depth == uint32(1) { v12 = 0 } else { if pixel_depth == uint32(2) { v13 = int32(1) } else { v13 = int32(2) } v12 = v13 } v9 = *(*Tpng_uint_32)(unsafe.Pointer(uintptr(unsafe.Pointer(&_row_mask)) + 1*72 + uintptr(v12)*24 + uintptr(pass)*4)) } mask = v9 } for { /* It doesn't matter in the following if png_uint_32 has more than * 32 bits because the high bits always match those in m<<24; it is, * however, essential to use OR here, not +, because of this. */ m = mask mask = m>>libc.Int32FromInt32(8) | m<= 8 */ /* Validate the depth - it must be a multiple of 8 */ if pixel_depth&uint32(7) != 0 { Xpng_error(tls, png_ptr, __ccgo_ts+17076) } pixel_depth >>= uint32(3) /* now in bytes */ row_width *= pixel_depth /* Regardless of pass number the Adam 7 interlace always results in a * fixed number of pixels to copy then to skip. There may be a * different number of pixels to skip at the start though. */ offset = uint32(1) & pass << (uint32(3) - (pass+uint32(1))>>int32(1)) & uint32(7) * pixel_depth row_width -= offset dp += uintptr(offset) sp += uintptr(offset) /* Work out the bytes to copy. */ if display != 0 { /* When doing the 'block' algorithm the pixel in the pass gets * replicated to adjacent pixels. This is why the even (0,2,4,6) * passes are skipped above - the entire expanded row is copied. */ bytes_to_copy = libc.Uint32FromInt32(libc.Int32FromInt32(1)<<((libc.Uint32FromInt32(6)-pass)>>libc.Int32FromInt32(1))) * pixel_depth /* But don't allow this number to exceed the actual row width. */ if bytes_to_copy > row_width { bytes_to_copy = row_width } } else { /* normal row; Adam7 only ever gives us one pixel to copy. */ bytes_to_copy = pixel_depth } /* In Adam7 there is a constant offset between where the pixels go. */ bytes_to_jump = libc.Uint32FromInt32(libc.Int32FromInt32(1)<<((libc.Uint32FromInt32(7)-pass)>>libc.Int32FromInt32(1))) * pixel_depth /* And simply copy these bytes. Some optimization is possible here, * depending on the value of 'bytes_to_copy'. Special case the low * byte counts, which we know to be frequent. * * Notice that these cases all 'return' rather than 'break' - this * avoids an unnecessary test on whether to restore the last byte * below. */ switch bytes_to_copy { case uint32(1): goto _15 case uint32(2): goto _16 case uint32(3): goto _17 default: goto _18 } goto _19 _15: ; _22: ; *(*Tpng_byte)(unsafe.Pointer(dp)) = *(*Tpng_byte)(unsafe.Pointer(sp)) if row_width <= bytes_to_jump { return } dp += uintptr(bytes_to_jump) sp += uintptr(bytes_to_jump) row_width -= bytes_to_jump goto _21 _21: ; goto _22 goto _20 _20: ; _16: ; /* There is a possibility of a partial copy at the end here; this * slows the code down somewhat. */ for cond := true; cond; cond = row_width > uint32(1) { *(*Tpng_byte)(unsafe.Pointer(dp)) = *(*Tpng_byte)(unsafe.Pointer(sp)) *(*Tpng_byte)(unsafe.Pointer(dp + 1)) = *(*Tpng_byte)(unsafe.Pointer(sp + 1)) if row_width <= bytes_to_jump { return } sp += uintptr(bytes_to_jump) dp += uintptr(bytes_to_jump) row_width -= bytes_to_jump } /* And there can only be one byte left at this point: */ *(*Tpng_byte)(unsafe.Pointer(dp)) = *(*Tpng_byte)(unsafe.Pointer(sp)) return _17: ; /* This can only be the RGB case, so each copy is exactly one * pixel and it is not necessary to check for a partial copy. */ for { *(*Tpng_byte)(unsafe.Pointer(dp)) = *(*Tpng_byte)(unsafe.Pointer(sp)) *(*Tpng_byte)(unsafe.Pointer(dp + 1)) = *(*Tpng_byte)(unsafe.Pointer(sp + 1)) *(*Tpng_byte)(unsafe.Pointer(dp + 2)) = *(*Tpng_byte)(unsafe.Pointer(sp + 2)) if row_width <= bytes_to_jump { return } sp += uintptr(bytes_to_jump) dp += uintptr(bytes_to_jump) row_width -= bytes_to_jump goto _23 _23: } _18: ; /* Check for double byte alignment and, if possible, use a * 16-bit copy. Don't attempt this for narrow images - ones that * are less than an interlace panel wide. Don't attempt it for * wide bytes_to_copy either - use the memcpy there. */ if bytes_to_copy < uint32(16) && libc.Int32FromUint16(uint16(uint32(dp)))&libc.Int32FromUint16(uint16(libc.Uint32FromInt64(2)-libc.Uint32FromInt32(1))) == 0 && libc.Int32FromUint16(uint16(uint32(sp)))&libc.Int32FromUint16(uint16(libc.Uint32FromInt64(2)-libc.Uint32FromInt32(1))) == 0 && bytes_to_copy%libc.Uint32FromInt64(2) == uint32(0) && bytes_to_jump%libc.Uint32FromInt64(2) == uint32(0) { /* Everything is aligned for png_uint_16 copies, but try for * png_uint_32 first. */ if uint32(dp)&(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1)) == uint32(0) && uint32(sp)&(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1)) == uint32(0) && bytes_to_copy%libc.Uint32FromInt64(4) == uint32(0) && bytes_to_jump%libc.Uint32FromInt64(4) == uint32(0) { dp32 = dp sp32 = sp skip = (bytes_to_jump - bytes_to_copy) / libc.Uint32FromInt64(4) for cond := true; cond; cond = bytes_to_copy <= row_width { c = bytes_to_copy for cond := true; cond; cond = c > uint32(0) { v24 = dp32 dp32 += 4 v25 = sp32 sp32 += 4 *(*Tpng_uint_32)(unsafe.Pointer(v24)) = *(*Tpng_uint_32)(unsafe.Pointer(v25)) c -= libc.Uint32FromInt64(4) } if row_width <= bytes_to_jump { return } dp32 += uintptr(skip) * 4 sp32 += uintptr(skip) * 4 row_width -= bytes_to_jump } /* Get to here when the row_width truncates the final copy. * There will be 1-3 bytes left to copy, so don't try the * 16-bit loop below. */ dp = dp32 sp = sp32 for { v28 = dp dp++ v29 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v28)) = *(*Tpng_byte)(unsafe.Pointer(v29)) goto _27 _27: ; row_width-- v26 = row_width if !(v26 > uint32(0)) { break } } return } else { dp16 = dp sp16 = sp skip1 = (bytes_to_jump - bytes_to_copy) / libc.Uint32FromInt64(2) for cond := true; cond; cond = bytes_to_copy <= row_width { c1 = bytes_to_copy for cond := true; cond; cond = c1 > uint32(0) { v30 = dp16 dp16 += 2 v31 = sp16 sp16 += 2 *(*Tpng_uint_16)(unsafe.Pointer(v30)) = *(*Tpng_uint_16)(unsafe.Pointer(v31)) c1 -= libc.Uint32FromInt64(2) } if row_width <= bytes_to_jump { return } dp16 += uintptr(skip1) * 2 sp16 += uintptr(skip1) * 2 row_width -= bytes_to_jump } /* End of row - 1 byte left, bytes_to_copy > row_width: */ dp = dp16 sp = sp16 for { v34 = dp dp++ v35 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v34)) = *(*Tpng_byte)(unsafe.Pointer(v35)) goto _33 _33: ; row_width-- v32 = row_width if !(v32 > uint32(0)) { break } } return } } /* The true default - use a memcpy: */ for { libc.Xmemcpy(tls, dp, sp, bytes_to_copy) if row_width <= bytes_to_jump { return } sp += uintptr(bytes_to_jump) dp += uintptr(bytes_to_jump) row_width -= bytes_to_jump if bytes_to_copy > row_width { bytes_to_copy = row_width } goto _36 _36: } _19: /* NOT REACHED*/ } /* pixel_depth >= 8 */ /* Here if pixel_depth < 8 to check 'end_ptr' below. */ } else { /* If here then the switch above wasn't used so just memcpy the whole row * from the temporary row buffer (notice that this overwrites the end of the * destination row if it is a partial byte.) */ if pixel_depth >= uint32(8) { v37 = row_width * (pixel_depth >> libc.Int32FromInt32(3)) } else { v37 = (row_width*pixel_depth + uint32(7)) >> int32(3) } libc.Xmemcpy(tls, dp, sp, v37) } /* Restore the overwritten bits from the last byte if necessary. */ if end_ptr != libc.UintptrFromInt32(0) { *(*Tpng_byte)(unsafe.Pointer(end_ptr)) = uint8(uint32(end_byte)&end_mask | uint32(*(*Tpng_byte)(unsafe.Pointer(end_ptr))) & ^end_mask) } } /* For pixel depths up to 4 bpp the 8-pixel mask can be expanded to fit * into 32 bits, then a single loop over the bytes using the four byte * values in the 32-bit mask can be used. For the 'display' option the * expanded mask may also not require any masking within a byte. To * make this work the PACKSWAP option must be taken into account - it * simply requires the pixels to be reversed in each byte. * * The 'regular' case requires a mask for each of the first 6 passes, * the 'display' case does a copy for the even passes in the range * 0..6. This has already been handled in the test above. * * The masks are arranged as four bytes with the first byte to use in * the lowest bits (little-endian) regardless of the order (PACKSWAP or * not) of the pixels in each byte. * * NOTE: the whole of this logic depends on the caller of this function * only calling it on rows appropriate to the pass. This function only * understands the 'x' logic; the 'y' logic is handled by the caller. * * The following defines allow generation of compile time constant bit * masks for each pixel depth and each possibility of swapped or not * swapped bytes. Pass 'p' is in the range 0..6; 'x', a pixel index, * is in the range 0..7; and the result is 1 if the pixel is to be * copied in the pass, 0 if not. 'S' is for the sparkle method, 'B' * for the block method. * * With some compilers a compile time expression of the general form: * * (shift >= 32) ? (a >> (shift-32)) : (b >> shift) * * Produces warnings with values of 'shift' in the range 33 to 63 * because the right hand side of the ?: expression is evaluated by * the compiler even though it isn't used. Microsoft Visual C (various * versions) and the Intel C compiler are known to do this. To avoid * this the following macros are used in 1.5.6. This is a temporary * solution to avoid destabilizing the code during the release process. */ /* Return a mask for pass 'p' pixel 'x' at depth 'd'. The mask is * little endian - the first pixel is at bit 0 - however the extra * parameter 's' can be set to cause the mask position to be swapped * within each byte, to match the PNG format. This is done by XOR of * the shift with 7, 6 or 4 for bit depths 1, 2 and 4. */ /* Hence generate the appropriate 'block' or 'sparkle' pixel copy mask. */ /* Combine 8 of these to get the full mask. For the 1-bpp and 2-bpp * cases the result needs replicating, for the 4-bpp case the above * generates a full 32 bits. */ /* Utility macros to construct all the masks for a depth/swap * combination. The 's' parameter says whether the format is PNG * (big endian bytes) or not. Only the three odd-numbered passes are * required for the display/block algorithm. */ /* Hence the pre-compiled masks indexed by PACKSWAP (or not), depth and * then pass: */ var _row_mask = [2][3][6]Tpng_uint_32{ 0: { 0: { 0: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 2: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 3: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 4: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 5: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), }, 1: { 0: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 2: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 3: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 4: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 5: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), }, 2: { 0: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 2: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 3: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 4: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 5: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), }, }, 1: { 0: { 0: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 2: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 3: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 4: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 5: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), }, 1: { 0: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 2: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 3: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 4: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 5: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), }, 2: { 0: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 2: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 3: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 4: ((libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(0)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0)) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 5: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), }, }, } /* display_mask has only three entries for the odd passes, so index by * pass>>1. */ var _display_mask = [2][3][3]Tpng_uint_32{ 0: { 0: { 0: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 2: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(1)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), }, 1: { 0: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 2: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(2)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), }, 2: { 0: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 2: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(4)^libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), }, }, 1: { 0: { 0: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), 2: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(1)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(1)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(1)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x01010101)), }, 1: { 0: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), 2: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(2)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(2)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(2)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(0x00010001)), }, 2: { 0: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(4)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 1: (libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(2)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(6)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), 2: (libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(1)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(3)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(5)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f)) + libc.Uint32FromInt32(0) + (libc.Uint32FromUint32(1)<<(libc.Int32FromInt32(4)&libc.Int32FromInt32(0x1f))-libc.Uint32FromInt32(1))<<((libc.Int32FromInt32(7)*libc.Int32FromInt32(4)^(libc.Int32FromInt32(8)-libc.Int32FromInt32(4)))&libc.Int32FromInt32(0x1f))) * libc.Uint32FromInt32(libc.Int32FromInt32(1)), }, }, } func Xpng_do_read_interlace(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, pass int32, transformations Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var dp, dp1, dp2, dp3, sp, sp1, sp2, sp3 Tpng_bytep var dshift, dshift1, dshift2, s_end, s_end1, s_end2, s_start, s_start1, s_start2, sshift, sshift1, sshift2, tmp, tmp1, tmp2, v9 uint32 var final_width, i, i1, i2, i3 Tpng_uint_32 var j, j1, j2, j3, jstop, jstop1, jstop2, jstop3, s_inc, s_inc1, s_inc2 int32 var pixel_bytes Tsize_t var v, v1, v2 Tpng_byte var _ /* v at bp+0 */ [8]Tpng_byte _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, dp1, dp2, dp3, dshift, dshift1, dshift2, final_width, i, i1, i2, i3, j, j1, j2, j3, jstop, jstop1, jstop2, jstop3, pixel_bytes, s_end, s_end1, s_end2, s_inc, s_inc1, s_inc2, s_start, s_start1, s_start2, sp, sp1, sp2, sp3, sshift, sshift1, sshift2, tmp, tmp1, tmp2, v, v1, v2, v9 if row != libc.UintptrFromInt32(0) && row_info != libc.UintptrFromInt32(0) { final_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth * _png_pass_inc1[pass] switch libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) { case int32(1): sp = row + uintptr(((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(3)) dp = row + uintptr((final_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(3)) jstop = libc.Int32FromUint32(_png_pass_inc1[pass]) if transformations&uint32(0x10000) != uint32(0) { sshift = ((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth + uint32(7)) & uint32(0x07) dshift = (final_width + uint32(7)) & uint32(0x07) s_start = uint32(7) s_end = uint32(0) s_inc = -int32(1) } else { sshift = uint32(7) - ((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth+uint32(7))&uint32(0x07) dshift = uint32(7) - (final_width+uint32(7))&uint32(0x07) s_start = uint32(0) s_end = uint32(7) s_inc = int32(1) } i = uint32(0) for { if !(i < (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth) { break } v = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) >> sshift & libc.Int32FromInt32(0x01)) j = 0 for { if !(j < jstop) { break } tmp = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(dp))) & (int32(0x7f7f) >> (uint32(7) - dshift))) tmp |= libc.Uint32FromInt32(libc.Int32FromUint8(v) << dshift) *(*Tpng_byte)(unsafe.Pointer(dp)) = uint8(tmp & libc.Uint32FromInt32(0xff)) if dshift == s_end { dshift = s_start dp-- } else { dshift = libc.Uint32FromInt32(libc.Int32FromUint32(dshift) + s_inc) } goto _2 _2: ; j++ } if sshift == s_end { sshift = s_start sp-- } else { sshift = libc.Uint32FromInt32(libc.Int32FromUint32(sshift) + s_inc) } goto _1 _1: ; i++ } case int32(2): sp1 = row + uintptr(((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(2)) dp1 = row + uintptr((final_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(2)) jstop1 = libc.Int32FromUint32(_png_pass_inc1[pass]) if transformations&uint32(0x10000) != uint32(0) { sshift1 = ((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth + uint32(3)) & uint32(0x03) << int32(1) dshift1 = (final_width + uint32(3)) & uint32(0x03) << int32(1) s_start1 = uint32(6) s_end1 = uint32(0) s_inc1 = -int32(2) } else { sshift1 = (uint32(3) - ((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth+uint32(3))&uint32(0x03)) << int32(1) dshift1 = (uint32(3) - (final_width+uint32(3))&uint32(0x03)) << int32(1) s_start1 = uint32(0) s_end1 = uint32(6) s_inc1 = int32(2) } i1 = uint32(0) for { if !(i1 < (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth) { break } v1 = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp1))) >> sshift1 & libc.Int32FromInt32(0x03)) j1 = 0 for { if !(j1 < jstop1) { break } tmp1 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(dp1))) & (int32(0x3f3f) >> (uint32(6) - dshift1))) tmp1 |= libc.Uint32FromInt32(libc.Int32FromUint8(v1) << dshift1) *(*Tpng_byte)(unsafe.Pointer(dp1)) = uint8(tmp1 & libc.Uint32FromInt32(0xff)) if dshift1 == s_end1 { dshift1 = s_start1 dp1-- } else { dshift1 = libc.Uint32FromInt32(libc.Int32FromUint32(dshift1) + s_inc1) } goto _4 _4: ; j1++ } if sshift1 == s_end1 { sshift1 = s_start1 sp1-- } else { sshift1 = libc.Uint32FromInt32(libc.Int32FromUint32(sshift1) + s_inc1) } goto _3 _3: ; i1++ } case int32(4): sp2 = row + uintptr(((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(1)) dp2 = row + uintptr((final_width-libc.Uint32FromInt32(1))>>libc.Int32FromInt32(1)) jstop2 = libc.Int32FromUint32(_png_pass_inc1[pass]) if transformations&uint32(0x10000) != uint32(0) { sshift2 = ((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth + uint32(1)) & uint32(0x01) << int32(2) dshift2 = (final_width + uint32(1)) & uint32(0x01) << int32(2) s_start2 = uint32(4) s_end2 = uint32(0) s_inc2 = -int32(4) } else { sshift2 = (uint32(1) - ((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth+uint32(1))&uint32(0x01)) << int32(2) dshift2 = (uint32(1) - (final_width+uint32(1))&uint32(0x01)) << int32(2) s_start2 = uint32(0) s_end2 = uint32(4) s_inc2 = int32(4) } i2 = uint32(0) for { if !(i2 < (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth) { break } v2 = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp2))) >> sshift2 & libc.Int32FromInt32(0x0f)) j2 = 0 for { if !(j2 < jstop2) { break } tmp2 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(dp2))) & (int32(0xf0f) >> (uint32(4) - dshift2))) tmp2 |= libc.Uint32FromInt32(libc.Int32FromUint8(v2) << dshift2) *(*Tpng_byte)(unsafe.Pointer(dp2)) = uint8(tmp2 & libc.Uint32FromInt32(0xff)) if dshift2 == s_end2 { dshift2 = s_start2 dp2-- } else { dshift2 = libc.Uint32FromInt32(libc.Int32FromUint32(dshift2) + s_inc2) } goto _6 _6: ; j2++ } if sshift2 == s_end2 { sshift2 = s_start2 sp2-- } else { sshift2 = libc.Uint32FromInt32(libc.Int32FromUint32(sshift2) + s_inc2) } goto _5 _5: ; i2++ } default: pixel_bytes = libc.Uint32FromInt32(libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) sp3 = row + uintptr(((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth-libc.Uint32FromInt32(1))*pixel_bytes) dp3 = row + uintptr((final_width-libc.Uint32FromInt32(1))*pixel_bytes) jstop3 = libc.Int32FromUint32(_png_pass_inc1[pass]) i3 = uint32(0) for { if !(i3 < (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth) { break } libc.Xmemcpy(tls, bp, sp3, pixel_bytes) j3 = 0 for { if !(j3 < jstop3) { break } libc.Xmemcpy(tls, dp3, bp, pixel_bytes) dp3 -= uintptr(pixel_bytes) goto _8 _8: ; j3++ } sp3 -= uintptr(pixel_bytes) goto _7 _7: ; i3++ } break } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth = final_width if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >= int32(8) { v9 = final_width * (uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v9 = (final_width*uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = v9 } } /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Offset to next interlace block */ var _png_pass_inc1 = [7]uint32{ 0: uint32(8), 1: uint32(8), 2: uint32(4), 3: uint32(4), 4: uint32(2), 5: uint32(2), 6: uint32(1), } func _png_read_filter_row_sub(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, prev_row Tpng_const_bytep) { var bpp uint32 var i, istop Tsize_t var rp Tpng_bytep _, _, _, _ = bpp, i, istop, rp istop = (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes bpp = libc.Uint32FromInt32((libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + int32(7)) >> int32(3)) rp = row + uintptr(bpp) _ = prev_row i = bpp for { if !(i < istop) { break } *(*Tpng_byte)(unsafe.Pointer(rp)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) + libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp - uintptr(bpp))))) & libc.Int32FromInt32(0xff)) rp++ goto _1 _1: ; i++ } } func _png_read_filter_row_up(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, prev_row Tpng_const_bytep) { var i, istop Tsize_t var pp, v2 Tpng_const_bytep var rp Tpng_bytep _, _, _, _, _ = i, istop, pp, rp, v2 istop = (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes rp = row pp = prev_row i = uint32(0) for { if !(i < istop) { break } v2 = pp pp++ *(*Tpng_byte)(unsafe.Pointer(rp)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) + libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v2)))) & libc.Int32FromInt32(0xff)) rp++ goto _1 _1: ; i++ } } func _png_read_filter_row_avg(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, prev_row Tpng_const_bytep) { var bpp uint32 var i, istop Tsize_t var pp, v2, v4 Tpng_const_bytep var rp Tpng_bytep _, _, _, _, _, _, _ = bpp, i, istop, pp, rp, v2, v4 rp = row pp = prev_row bpp = libc.Uint32FromInt32((libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + int32(7)) >> int32(3)) istop = (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes - bpp i = uint32(0) for { if !(i < bpp) { break } v2 = pp pp++ *(*Tpng_byte)(unsafe.Pointer(rp)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) + libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v2)))/libc.Int32FromInt32(2)) & libc.Int32FromInt32(0xff)) rp++ goto _1 _1: ; i++ } i = uint32(0) for { if !(i < istop) { break } v4 = pp pp++ *(*Tpng_byte)(unsafe.Pointer(rp)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) + (libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v4)))+libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp - uintptr(bpp)))))/libc.Int32FromInt32(2)) & libc.Int32FromInt32(0xff)) rp++ goto _3 _3: ; i++ } } func _png_read_filter_row_paeth_1byte_pixel(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, prev_row Tpng_const_bytep) { var a, b, c, p, pa, pb, pc, v4, v5, v6 int32 var rp_end, v2, v7 Tpng_bytep var v1, v3 Tpng_const_bytep _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, b, c, p, pa, pb, pc, rp_end, v1, v2, v3, v4, v5, v6, v7 rp_end = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) /* First pixel/byte */ v1 = prev_row prev_row++ c = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v1))) a = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(row))) + c v2 = row row++ *(*Tpng_byte)(unsafe.Pointer(v2)) = libc.Uint8FromInt32(a) /* Remainder */ for row < rp_end { a &= int32(0xff) /* From previous iteration or start */ v3 = prev_row prev_row++ b = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v3))) p = b - c pc = a - c if p < 0 { v4 = -p } else { v4 = p } pa = v4 if pc < 0 { v5 = -pc } else { v5 = pc } pb = v5 if p+pc < 0 { v6 = -(p + pc) } else { v6 = p + pc } pc = v6 /* Find the best predictor, the least of pa, pb, pc favoring the earlier * ones in the case of a tie. */ if pb < pa { pa = pb a = b } if pc < pa { a = c } /* Calculate the current pixel in a, and move the previous row pixel to c * for the next time round the loop */ c = b a += libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(row))) v7 = row row++ *(*Tpng_byte)(unsafe.Pointer(v7)) = libc.Uint8FromInt32(a) } } func _png_read_filter_row_paeth_multibyte_pixel(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, prev_row Tpng_const_bytep) { var a, a1, b, c, p, pa, pb, pc, v4, v5, v6 int32 var bpp uint32 var rp_end, v2, v7 Tpng_bytep var v1, v3 Tpng_const_bytep _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, a1, b, bpp, c, p, pa, pb, pc, rp_end, v1, v2, v3, v4, v5, v6, v7 bpp = libc.Uint32FromInt32((libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + int32(7)) >> int32(3)) rp_end = row + uintptr(bpp) /* Process the first pixel in the row completely (this is the same as 'up' * because there is only one candidate predictor for the first row). */ for row < rp_end { v1 = prev_row prev_row++ a = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(row))) + libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v1))) v2 = row row++ *(*Tpng_byte)(unsafe.Pointer(v2)) = libc.Uint8FromInt32(a) } /* Remainder */ rp_end = rp_end + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes-bpp) for row < rp_end { c = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(prev_row - uintptr(bpp)))) a1 = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(row - uintptr(bpp)))) v3 = prev_row prev_row++ b = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v3))) p = b - c pc = a1 - c if p < 0 { v4 = -p } else { v4 = p } pa = v4 if pc < 0 { v5 = -pc } else { v5 = pc } pb = v5 if p+pc < 0 { v6 = -(p + pc) } else { v6 = p + pc } pc = v6 if pb < pa { pa = pb a1 = b } if pc < pa { a1 = c } a1 += libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(row))) v7 = row row++ *(*Tpng_byte)(unsafe.Pointer(v7)) = libc.Uint8FromInt32(a1) } } func _png_init_filter_functions(tls *libc.TLS, pp Tpng_structrp) { /* This function is called once for every PNG image (except for PNG images * that only use PNG_FILTER_VALUE_NONE for all rows) to set the * implementations required to reverse the filtering of PNG rows. Reversing * the filter is the first transformation performed on the row data. It is * performed in place, therefore an implementation can be selected based on * the image pixel format. If the implementation depends on image width then * take care to ensure that it works correctly if the image is interlaced - * interlacing causes the actual row width to vary. */ var bpp uint32 _ = bpp bpp = libc.Uint32FromInt32((libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(pp)).Fpixel_depth) + int32(7)) >> int32(3)) *(*uintptr)(unsafe.Pointer(pp + 1024 + uintptr(libc.Int32FromInt32(PNG_FILTER_VALUE_SUB)-libc.Int32FromInt32(1))*4)) = __ccgo_fp(_png_read_filter_row_sub) *(*uintptr)(unsafe.Pointer(pp + 1024 + uintptr(libc.Int32FromInt32(PNG_FILTER_VALUE_UP)-libc.Int32FromInt32(1))*4)) = __ccgo_fp(_png_read_filter_row_up) *(*uintptr)(unsafe.Pointer(pp + 1024 + uintptr(libc.Int32FromInt32(PNG_FILTER_VALUE_AVG)-libc.Int32FromInt32(1))*4)) = __ccgo_fp(_png_read_filter_row_avg) if bpp == uint32(1) { *(*uintptr)(unsafe.Pointer(pp + 1024 + uintptr(libc.Int32FromInt32(PNG_FILTER_VALUE_PAETH)-libc.Int32FromInt32(1))*4)) = __ccgo_fp(_png_read_filter_row_paeth_1byte_pixel) } else { *(*uintptr)(unsafe.Pointer(pp + 1024 + uintptr(libc.Int32FromInt32(PNG_FILTER_VALUE_PAETH)-libc.Int32FromInt32(1))*4)) = __ccgo_fp(_png_read_filter_row_paeth_multibyte_pixel) } } func Xpng_read_filter_row(tls *libc.TLS, pp Tpng_structrp, row_info Tpng_row_infop, row Tpng_bytep, prev_row Tpng_const_bytep, filter int32) { /* OPTIMIZATION: DO NOT MODIFY THIS FUNCTION, instead #define * PNG_FILTER_OPTIMIZATIONS to a function that overrides the generic * implementations. See png_init_filter_functions above. */ if filter > PNG_FILTER_VALUE_NONE && filter < int32(PNG_FILTER_VALUE_LAST) { if *(*uintptr)(unsafe.Pointer(pp + 1024)) == libc.UintptrFromInt32(0) { _png_init_filter_functions(tls, pp) } (*(*func(*libc.TLS, Tpng_row_infop, Tpng_bytep, Tpng_const_bytep))(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(pp + 1024 + uintptr(filter-int32(1))*4))})))(tls, row_info, row, prev_row) } } func Xpng_read_IDAT_data(tls *libc.TLS, png_ptr Tpng_structrp, output Tpng_bytep, avail_out Tpng_alloc_size_t) { bp := tls.Alloc(1024) defer tls.Free(1024) var avail_in, out TuInt var buffer Tpng_bytep var ret int32 var _ /* tmpbuf at bp+0 */ [1024]Tpng_byte _, _, _, _ = avail_in, buffer, out, ret /* Loop reading IDATs and decompressing the result into output[avail_out] */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = output (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = uint32(0) /* safety: set below */ if output == libc.UintptrFromInt32(0) { avail_out = uint32(0) } for cond := true; cond; cond = avail_out > uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in == uint32(0) { for (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fidat_size == uint32(0) { Xpng_crc_finish(tls, png_ptr, uint32(0)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fidat_size = Xpng_read_chunk_header(tls, png_ptr) /* This is an error even in the 'check' case because the code just * consumed a non-IDAT header. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name != libc.Uint32FromInt32(libc.Int32FromInt32(73))< (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fidat_size { avail_in = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fidat_size } /* A PNG with a gradually increasing IDAT size will defeat this attempt * to minimize memory usage by causing lots of re-allocs, but * realistically doing IDAT_read_size re-allocs is not likely to be a * big problem. */ buffer = _png_read_buffer(tls, png_ptr, avail_in, 0) Xpng_crc_read(tls, png_ptr, buffer, avail_in) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 636)) -= avail_in (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_in = buffer (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = avail_in } /* And set up the output side. */ if output != libc.UintptrFromInt32(0) { /* standard read */ out = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if out > avail_out { out = avail_out } avail_out -= out (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = out } else { /* after last row, checking for end */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = bp (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = libc.Uint32FromInt64(1024) } /* Use NO_FLUSH; this gives zlib the maximum opportunity to optimize the * process. If the LZ stream is truncated the sequential reader will * terminally damage the stream, above, by reading the chunk header of the * following chunk (it then exits with png_error). * * TODO: deal more elegantly with truncated IDAT lists. */ ret = Xpng_zlib_inflate(tls, png_ptr, Z_NO_FLUSH) /* Take the unconsumed output back. */ if output != libc.UintptrFromInt32(0) { avail_out += (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out } else { /* avail_out counts the extra bytes */ avail_out += libc.Uint32FromInt64(1024) - (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = uint32(0) if ret == int32(Z_STREAM_END) { /* Do this for safety; we won't read any more into this row. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = libc.UintptrFromInt32(0) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(PNG_AFTER_IDAT3) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0008) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in > uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fidat_size > uint32(0) { Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+17133) } break } if ret != Z_OK { Xpng_zstream_error(tls, png_ptr, ret) if output != libc.UintptrFromInt32(0) { Xpng_chunk_error(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg) } else { /* checking */ Xpng_chunk_benign_error(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg) return } } } if avail_out > uint32(0) { /* The stream ended before the image; this is the same as too few IDATs so * should be handled the same way. */ if output != libc.UintptrFromInt32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+17111) } else { /* the deflate stream contained extra data */ Xpng_chunk_benign_error(tls, png_ptr, __ccgo_ts+17155) } } } func Xpng_read_finish_IDAT(tls *libc.TLS, png_ptr Tpng_structrp) { /* We don't need any more data and the stream should have ended, however the * LZ end code may actually not have been processed. In this case we must * read it otherwise stray unread IDAT data or, more likely, an IDAT chunk * may still remain to be consumed. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0008) == uint32(0) { /* The NULL causes png_read_IDAT_data to swallow any remaining bytes in * the compressed stream, but the stream may be damaged too, so even after * this call we may need to terminate the zstream ownership. */ Xpng_read_IDAT_data(tls, png_ptr, libc.UintptrFromInt32(0), uint32(0)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = libc.UintptrFromInt32(0) /* safety */ /* Now clear everything out for safety; the following may not have been * done. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0008) == uint32(0) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(PNG_AFTER_IDAT3) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0008) } } /* If the zstream has not been released do it now *and* terminate the reading * of the final IDAT chunk. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner == libc.Uint32FromInt32(libc.Int32FromInt32(73))<= int32(7) { break } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth + uint32(_png_pass_inc2[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) - uint32(1) - uint32(_png_pass_start1[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass])) / uint32(_png_pass_inc2[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) == uint32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight + uint32(_png_pass_yinc1[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) - uint32(1) - uint32(_png_pass_ystart1[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass])) / uint32(_png_pass_yinc1[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) } else { /* if (png_ptr->transformations & PNG_INTERLACE) */ break } /* libpng deinterlacing sees every row */ } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) < int32(7) { return } } /* Here after at the end of the last row of the last pass. */ Xpng_read_finish_IDAT(tls, png_ptr) } /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ var _png_pass_start1 = [7]Tpng_byte{ 1: uint8(4), 3: uint8(2), 5: uint8(1), } /* Offset to next interlace block */ var _png_pass_inc2 = [7]Tpng_byte{ 0: uint8(8), 1: uint8(8), 2: uint8(4), 3: uint8(4), 4: uint8(2), 5: uint8(2), 6: uint8(1), } /* Start of interlace block in the y direction */ var _png_pass_ystart1 = [7]Tpng_byte{ 2: uint8(4), 4: uint8(2), 6: uint8(1), } /* Offset to next interlace block in the y direction */ var _png_pass_yinc1 = [7]Tpng_byte{ 0: uint8(8), 1: uint8(8), 2: uint8(8), 3: uint8(4), 4: uint8(4), 5: uint8(2), 6: uint8(2), } func Xpng_read_start_row(tls *libc.TLS, png_ptr Tpng_structrp) { var buffer, temp Tpng_bytep var extra, row_bytes Tsize_t var max_pixel_depth, user_pixel_depth, v1 uint32 _, _, _, _, _, _, _ = buffer, extra, max_pixel_depth, row_bytes, temp, user_pixel_depth, v1 Xpng_init_read_transformations(tls, png_ptr) if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) == uint32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight + uint32(_png_pass_yinc2[0]) - uint32(1) - uint32(_png_pass_ystart2[0])) / uint32(_png_pass_yinc2[0]) } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth + uint32(_png_pass_inc3[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) - uint32(1) - uint32(_png_pass_start2[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass])) / uint32(_png_pass_inc3[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fiwidth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth } max_pixel_depth = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) /* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of * calculations to calculate the final pixel depth, then * png_do_read_transforms actually does the transforms. This means that the * code which effectively calculates this value is actually repeated in three * separate places. They must all match. Innocent changes to the order of * transformations can and will break libpng in a way that causes memory * overwrites. * * TODO: fix this. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0004) != uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) < int32(8) { max_pixel_depth = uint32(8) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000) != uint32(0) { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) != 0 { max_pixel_depth = uint32(32) } else { max_pixel_depth = uint32(24) } } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == PNG_COLOR_TYPE_GRAY { if max_pixel_depth < uint32(8) { max_pixel_depth = uint32(8) } if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) != 0 { max_pixel_depth *= uint32(2) } } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) { if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) != 0 { max_pixel_depth *= uint32(4) max_pixel_depth /= uint32(3) } } } } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0200) != uint32(0) { /* In fact it is an error if it isn't supported, but checking is * the safe way. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000) != uint32(0) { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth) < int32(16) { max_pixel_depth *= uint32(2) } } else { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) &= ^libc.Uint32FromUint32(0x0200) } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x8000) != uint32(0) { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == PNG_COLOR_TYPE_GRAY { if max_pixel_depth <= uint32(8) { max_pixel_depth = uint32(16) } else { max_pixel_depth = uint32(32) } } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) || libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { if max_pixel_depth <= uint32(32) { max_pixel_depth = uint32(32) } else { max_pixel_depth = uint32(64) } } } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x4000) != uint32(0) { if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_trans) != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x1000) != uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x8000) != uint32(0) || libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA) { if max_pixel_depth <= uint32(16) { max_pixel_depth = uint32(32) } else { max_pixel_depth = uint32(64) } } else { if max_pixel_depth <= uint32(8) { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { max_pixel_depth = uint32(32) } else { max_pixel_depth = uint32(24) } } else { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { max_pixel_depth = uint32(64) } else { max_pixel_depth = uint32(48) } } } } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x100000) != uint32(0) { user_pixel_depth = libc.Uint32FromInt32(libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_depth) * libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_channels)) if user_pixel_depth > max_pixel_depth { max_pixel_depth = user_pixel_depth } } /* This value is stored in png_struct and double checked in the row read * code. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmaximum_pixel_depth = uint8(max_pixel_depth) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformed_pixel_depth = uint8(0) /* calculated on demand */ /* Align the width on the next larger 8 pixels. Mainly used * for interlacing */ row_bytes = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth + libc.Uint32FromInt32(7)) & ^libc.Uint32FromInt32(7) /* Calculate the maximum bytes needed, adding a byte and a pixel * for safety's sake */ if max_pixel_depth >= uint32(8) { v1 = row_bytes * (max_pixel_depth >> libc.Int32FromInt32(3)) } else { v1 = (row_bytes*max_pixel_depth + uint32(7)) >> int32(3) } row_bytes = v1 + uint32(1) + (max_pixel_depth+uint32(7))>>uint32(3) if row_bytes+uint32(48) > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fold_big_row_buf_size { Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbig_row_buf) Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbig_prev_row) if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbig_row_buf = Xpng_calloc(tls, png_ptr, row_bytes+uint32(48)) } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbig_row_buf = Xpng_malloc(tls, png_ptr, row_bytes+uint32(48)) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbig_prev_row = Xpng_malloc(tls, png_ptr, row_bytes+uint32(48)) /* Use 16-byte aligned memory for row_buf with at least 16 bytes * of padding before and after row_buf; treat prev_row similarly. * NOTE: the alignment is to the start of the pixels, one beyond the start * of the buffer, because of the filter byte. Prior to libpng 1.5.6 this * was incorrect; the filter byte was aligned, which had the exact * opposite effect of that intended. */ temp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbig_row_buf + uintptr(32) extra = uint32(temp) & uint32(0x0f) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf = temp - uintptr(extra) - uintptr(1) temp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbig_prev_row + uintptr(32) extra = uint32(temp) & uint32(0x0f) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row = temp - uintptr(extra) - uintptr(1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fold_big_row_buf_size = row_bytes + uint32(48) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frowbytes > libc.Uint32FromInt32(-libc.Int32FromInt32(1))-libc.Uint32FromInt32(1) { Xpng_error(tls, png_ptr, __ccgo_ts+17175) } libc.Xmemset(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row, 0, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frowbytes+uint32(1)) /* The sequential reader needs a buffer for IDAT, but the progressive reader * does not, so free the read buffer now regardless; the sequential reader * reallocates it on demand. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer != libc.UintptrFromInt32(0) { buffer = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer_size = uint32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_buffer = libc.UintptrFromInt32(0) Xpng_free(tls, png_ptr, buffer) } /* Finally claim the zstream for the inflate of the IDAT data, use the bits * value from the stream (note that this will result in a fatal error if the * IDAT stream has a bogus deflate header window_bits value, but this should * not be happening any longer!) */ if _png_inflate_claim(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(73))< int32(PNG_MAX_PALETTE_LENGTH) { Xpng_warning(tls, png_ptr, __ccgo_ts+17454) return } Xpng_free_data(tls, png_ptr, info_ptr, uint32(0x0008), 0) /* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in * version 1.2.1 */ (*Tpng_info)(unsafe.Pointer(info_ptr)).Fhist = Xpng_malloc_warn(tls, png_ptr, libc.Uint32FromInt32(PNG_MAX_PALETTE_LENGTH)*libc.Uint32FromInt64(2)) if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fhist == libc.UintptrFromInt32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+17500) return } i = 0 for { if !(i < libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_palette)) { break } *(*Tpng_uint_16)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fhist + uintptr(i)*2)) = *(*Tpng_uint_16)(unsafe.Pointer(hist + uintptr(i)*2)) goto _1 _1: ; i++ } *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x0008) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0040) } func Xpng_set_IHDR(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, width Tpng_uint_32, height Tpng_uint_32, bit_depth int32, color_type int32, interlace_type int32, compression_type int32, filter_type int32) { var v1 uint32 _ = v1 if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fwidth = width (*Tpng_info)(unsafe.Pointer(info_ptr)).Fheight = height (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth = libc.Uint8FromInt32(bit_depth) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type = libc.Uint8FromInt32(color_type) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcompression_type = libc.Uint8FromInt32(compression_type) (*Tpng_info)(unsafe.Pointer(info_ptr)).Ffilter_type = libc.Uint8FromInt32(filter_type) (*Tpng_info)(unsafe.Pointer(info_ptr)).Finterlace_type = libc.Uint8FromInt32(interlace_type) Xpng_check_IHDR(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fwidth, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fheight, libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth), libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type), libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Finterlace_type), libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcompression_type), libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Ffilter_type)) if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels = uint8(1) } else { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels = uint8(3) } else { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels = uint8(1) } } if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0 { (*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels++ } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fchannels) * libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth)) if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpixel_depth) >= int32(8) { v1 = width * (uint32((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v1 = (width*uint32((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_info)(unsafe.Pointer(info_ptr)).Frowbytes = v1 } func Xpng_set_oFFs(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, offset_x Tpng_int_32, offset_y Tpng_int_32, unit_type int32) { if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_offset = offset_x (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_offset = offset_y (*Tpng_info)(unsafe.Pointer(info_ptr)).Foffset_unit_type = libc.Uint8FromInt32(unit_type) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0100) } func Xpng_set_pCAL(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, purpose Tpng_const_charp, X0 Tpng_int_32, X1 Tpng_int_32, type1 int32, nparams int32, units Tpng_const_charp, params Tpng_charpp) { var i int32 var length Tsize_t _, _ = i, length if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) || purpose == libc.UintptrFromInt32(0) || units == libc.UintptrFromInt32(0) || nparams > 0 && params == libc.UintptrFromInt32(0) { return } length = libc.Xstrlen(tls, purpose) + uint32(1) /* TODO: validate format of calibration name and unit name */ /* Check that the type matches the specification. */ if type1 < 0 || type1 > int32(3) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+17540, int32(PNG_CHUNK_WRITE_ERROR)) return } if nparams < 0 || nparams > int32(255) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+17567, int32(PNG_CHUNK_WRITE_ERROR)) return } /* Validate params[nparams] */ i = 0 for { if !(i < nparams) { break } if *(*uintptr)(unsafe.Pointer(params + uintptr(i)*4)) == libc.UintptrFromInt32(0) || !(Xpng_check_fp_string(tls, *(*uintptr)(unsafe.Pointer(params + uintptr(i)*4)), libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(params + uintptr(i)*4)))) != 0) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+17596, int32(PNG_CHUNK_WRITE_ERROR)) return } goto _1 _1: ; i++ } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_purpose = Xpng_malloc_warn(tls, png_ptr, length) if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_purpose == libc.UintptrFromInt32(0) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+17630, int32(PNG_CHUNK_WRITE_ERROR)) return } libc.Xmemcpy(tls, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_purpose, purpose, length) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x0080) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_X0 = X0 (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_X1 = X1 (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_type = libc.Uint8FromInt32(type1) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_nparams = libc.Uint8FromInt32(nparams) length = libc.Xstrlen(tls, units) + uint32(1) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_units = Xpng_malloc_warn(tls, png_ptr, length) if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_units == libc.UintptrFromInt32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+17667) return } libc.Xmemcpy(tls, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_units, units, length) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params = Xpng_malloc_warn(tls, png_ptr, (libc.Uint32FromInt32(nparams)+libc.Uint32FromInt32(1))*libc.Uint32FromInt64(4)) if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params == libc.UintptrFromInt32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+17702) return } libc.Xmemset(tls, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params, 0, (libc.Uint32FromInt32(nparams)+uint32(1))*libc.Uint32FromInt64(4)) i = 0 for { if !(i < nparams) { break } length = libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(params + uintptr(i)*4))) + uint32(1) *(*uintptr)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params + uintptr(i)*4)) = Xpng_malloc_warn(tls, png_ptr, length) if *(*uintptr)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params + uintptr(i)*4)) == libc.UintptrFromInt32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+17738) return } libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer(params + uintptr(i)*4)), length) goto _2 _2: ; i++ } *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0400) } func Xpng_set_sCAL_s(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, unit int32, swidth Tpng_const_charp, sheight Tpng_const_charp) { var lengthh, lengthw, v1, v3 Tsize_t var v2, v4 bool _, _, _, _, _, _ = lengthh, lengthw, v1, v2, v3, v4 lengthw = uint32(0) lengthh = uint32(0) if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } /* Double check the unit (should never get here with an invalid * unit unless this is an API call.) */ if unit != int32(1) && unit != int32(2) { Xpng_error(tls, png_ptr, __ccgo_ts+17777) } if v2 = swidth == libc.UintptrFromInt32(0); !v2 { v1 = libc.Xstrlen(tls, swidth) lengthw = v1 } if v2 || v1 == uint32(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(swidth))) == int32(45) || !(Xpng_check_fp_string(tls, swidth, lengthw) != 0) { Xpng_error(tls, png_ptr, __ccgo_ts+17795) } if v4 = sheight == libc.UintptrFromInt32(0); !v4 { v3 = libc.Xstrlen(tls, sheight) lengthh = v3 } if v4 || v3 == uint32(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(sheight))) == int32(45) || !(Xpng_check_fp_string(tls, sheight, lengthh) != 0) { Xpng_error(tls, png_ptr, __ccgo_ts+17814) } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_unit = libc.Uint8FromInt32(unit) lengthw++ (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_width = Xpng_malloc_warn(tls, png_ptr, lengthw) if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_width == libc.UintptrFromInt32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+17834) return } libc.Xmemcpy(tls, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_width, swidth, lengthw) lengthh++ (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_height = Xpng_malloc_warn(tls, png_ptr, lengthh) if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_height == libc.UintptrFromInt32(0) { Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_width) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_width = libc.UintptrFromInt32(0) Xpng_warning(tls, png_ptr, __ccgo_ts+17834) return } libc.Xmemcpy(tls, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_height, sheight, lengthh) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x0100) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x4000) } func Xpng_set_sCAL(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, unit int32, width float64, height float64) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* sheight at bp+18 */ [18]uint8 var _ /* swidth at bp+0 */ [18]uint8 /* Check the arguments. */ if width <= libc.Float64FromInt32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+17881) } else { if height <= libc.Float64FromInt32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+17908) } else { Xpng_ascii_from_fp(tls, png_ptr, bp, libc.Uint32FromInt64(18), width, uint32(PNG_sCAL_PRECISION)) Xpng_ascii_from_fp(tls, png_ptr, bp+18, libc.Uint32FromInt64(18), height, uint32(PNG_sCAL_PRECISION)) Xpng_set_sCAL_s(tls, png_ptr, info_ptr, unit, bp, bp+18) } } } func Xpng_set_sCAL_fixed(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, unit int32, width Tpng_fixed_point, height Tpng_fixed_point) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* sheight at bp+18 */ [18]uint8 var _ /* swidth at bp+0 */ [18]uint8 /* Check the arguments. */ if width <= 0 { Xpng_warning(tls, png_ptr, __ccgo_ts+17881) } else { if height <= 0 { Xpng_warning(tls, png_ptr, __ccgo_ts+17908) } else { Xpng_ascii_from_fixed(tls, png_ptr, bp, libc.Uint32FromInt64(18), width) Xpng_ascii_from_fixed(tls, png_ptr, bp+18, libc.Uint32FromInt64(18), height) Xpng_set_sCAL_s(tls, png_ptr, info_ptr, unit, bp, bp+18) } } } func Xpng_set_pHYs(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, res_x Tpng_uint_32, res_y Tpng_uint_32, unit_type int32) { if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit = res_x (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_pixels_per_unit = res_y (*Tpng_info)(unsafe.Pointer(info_ptr)).Fphys_unit_type = libc.Uint8FromInt32(unit_type) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0080) } func Xpng_set_PLTE(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, palette Tpng_const_colorp, num_palette int32) { var max_palette_length Tpng_uint_32 var v1 int32 var v2 Tpng_uint_16 _, _, _ = max_palette_length, v1, v2 if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { v1 = int32(1) << (*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth } else { v1 = int32(PNG_MAX_PALETTE_LENGTH) } max_palette_length = libc.Uint32FromInt32(v1) if num_palette < 0 || num_palette > libc.Int32FromUint32(max_palette_length) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { Xpng_error(tls, png_ptr, __ccgo_ts+17936) } else { Xpng_warning(tls, png_ptr, __ccgo_ts+17936) return } } if num_palette > 0 && palette == libc.UintptrFromInt32(0) || num_palette == 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted&uint32(PNG_FLAG_MNG_EMPTY_PLTE1) == uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+17959) } /* It may not actually be necessary to set png_ptr->palette here; * we do it for backward compatibility with the way the png_handle_tRNS * function used to do the allocation. * * 1.6.0: the above statement appears to be incorrect; something has to set * the palette inside png_struct on read. */ Xpng_free_data(tls, png_ptr, info_ptr, uint32(0x1000), 0) /* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead * of num_palette entries, in case of an invalid PNG file or incorrect * call to png_set_PLTE() with too-large sample values. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette = Xpng_calloc(tls, png_ptr, libc.Uint32FromInt32(PNG_MAX_PALETTE_LENGTH)*libc.Uint32FromInt64(3)) if num_palette > 0 { libc.Xmemcpy(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette, palette, libc.Uint32FromInt32(num_palette)*libc.Uint32FromInt64(3)) } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpalette = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpalette v2 = libc.Uint16FromInt32(num_palette) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette = v2 (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_palette = v2 *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x1000) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0008) } func Xpng_set_sBIT(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, sig_bit Tpng_const_color_8p) { if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) || sig_bit == libc.UintptrFromInt32(0) { return } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsig_bit = *(*Tpng_color_8)(unsafe.Pointer(sig_bit)) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0002) } func Xpng_set_sRGB(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, srgb_intent int32) { if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } Xpng_colorspace_set_sRGB(tls, png_ptr, info_ptr+40, srgb_intent) Xpng_colorspace_sync_info(tls, png_ptr, info_ptr) } func Xpng_set_sRGB_gAMA_and_cHRM(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, srgb_intent int32) { var p1 uintptr _ = p1 if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } if Xpng_colorspace_set_sRGB(tls, png_ptr, info_ptr+40, srgb_intent) != 0 { /* This causes the gAMA and cHRM to be written too */ p1 = info_ptr + 40 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | (libc.Int32FromInt32(PNG_COLORSPACE_FROM_gAMA3) | libc.Int32FromInt32(PNG_COLORSPACE_FROM_cHRM1))) } Xpng_colorspace_sync_info(tls, png_ptr, info_ptr) } func Xpng_set_iCCP(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, name Tpng_const_charp, compression_type int32, profile Tpng_const_bytep, proflen Tpng_uint_32) { var length Tsize_t var new_iccp_name Tpng_charp var new_iccp_profile Tpng_bytep var result int32 var p1 uintptr _, _, _, _, _ = length, new_iccp_name, new_iccp_profile, result, p1 if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) || name == libc.UintptrFromInt32(0) || profile == libc.UintptrFromInt32(0) { return } if compression_type != PNG_COMPRESSION_TYPE_BASE { Xpng_app_error(tls, png_ptr, __ccgo_ts+17975) } /* Set the colorspace first because this validates the profile; do not * override previously set app cHRM or gAMA here (because likely as not the * application knows better than libpng what the correct values are.) Pass * the info_ptr color_type field to png_colorspace_set_ICC because in the * write case it has not yet been stored in png_ptr. */ result = Xpng_colorspace_set_ICC(tls, png_ptr, info_ptr+40, name, proflen, profile, libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type)) Xpng_colorspace_sync_info(tls, png_ptr, info_ptr) /* Don't do any of the copying if the profile was bad, or inconsistent. */ if result == 0 { return } /* But do write the gAMA and cHRM chunks from the profile. */ p1 = info_ptr + 40 + 74 *(*Tpng_uint_16)(unsafe.Pointer(p1)) = Tpng_uint_16(int32(*(*Tpng_uint_16)(unsafe.Pointer(p1))) | (libc.Int32FromInt32(PNG_COLORSPACE_FROM_gAMA3) | libc.Int32FromInt32(PNG_COLORSPACE_FROM_cHRM1))) length = libc.Xstrlen(tls, name) + uint32(1) new_iccp_name = Xpng_malloc_warn(tls, png_ptr, length) if new_iccp_name == libc.UintptrFromInt32(0) { Xpng_benign_error(tls, png_ptr, __ccgo_ts+18007) return } libc.Xmemcpy(tls, new_iccp_name, name, length) new_iccp_profile = Xpng_malloc_warn(tls, png_ptr, proflen) if new_iccp_profile == libc.UintptrFromInt32(0) { Xpng_free(tls, png_ptr, new_iccp_name) Xpng_benign_error(tls, png_ptr, __ccgo_ts+18049) return } libc.Xmemcpy(tls, new_iccp_profile, profile, proflen) Xpng_free_data(tls, png_ptr, info_ptr, uint32(0x0010), 0) (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_proflen = proflen (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_name = new_iccp_name (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_profile = new_iccp_profile *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x0010) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x1000) } func Xpng_set_text(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, text_ptr Tpng_const_textp, num_text int32) { var ret int32 _ = ret ret = Xpng_set_text_2(tls, png_ptr, info_ptr, text_ptr, num_text) if ret != 0 { Xpng_error(tls, png_ptr, __ccgo_ts+18093) } } func Xpng_set_text_2(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, text_ptr Tpng_const_textp, num_text int32) (r int32) { var i, max_text, old_num_text int32 var key_len, lang_key_len, lang_len, text_length Tsize_t var new_text, textp Tpng_textp _, _, _, _, _, _, _, _, _ = i, key_len, lang_key_len, lang_len, max_text, new_text, old_num_text, text_length, textp if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) || num_text <= 0 || text_ptr == libc.UintptrFromInt32(0) { return 0 } /* Make sure we have enough space in the "text" array in info_struct * to hold all of the incoming text_ptr objects. This compare can't overflow * because max_text >= num_text (anyway, subtract of two positive integers * can't overflow in any case.) */ if num_text > (*Tpng_info)(unsafe.Pointer(info_ptr)).Fmax_text-(*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_text { old_num_text = (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_text new_text = libc.UintptrFromInt32(0) /* Calculate an appropriate max_text, checking for overflow. */ max_text = old_num_text if num_text <= int32(INT_MAX3)-max_text { max_text += num_text /* Round up to a multiple of 8 */ if max_text < libc.Int32FromInt32(INT_MAX3)-libc.Int32FromInt32(8) { max_text = (max_text + int32(8)) & ^libc.Int32FromInt32(0x7) } else { max_text = int32(INT_MAX3) } /* Now allocate a new array and copy the old members in; this does all * the overflow checks. */ new_text = Xpng_realloc_array(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext, old_num_text, max_text-old_num_text, uint32(28)) } if new_text == libc.UintptrFromInt32(0) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+18127, int32(PNG_CHUNK_WRITE_ERROR)) return int32(1) } Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext) (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext = new_text *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x4000) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fmax_text = max_text /* num_text is adjusted below as the entries are copied in */ } i = 0 for { if !(i < num_text) { break } textp = (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr((*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_text)*28 if (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Fkey == libc.UintptrFromInt32(0) { goto _1 } if (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Fcompression < -int32(1) || (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Fcompression >= int32(PNG_TEXT_COMPRESSION_LAST) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+18148, int32(PNG_CHUNK_WRITE_ERROR)) goto _1 } key_len = libc.Xstrlen(tls, (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Fkey) if (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Fcompression <= 0 { lang_len = uint32(0) lang_key_len = uint32(0) } else { /* Set iTXt data */ if (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Flang != libc.UintptrFromInt32(0) { lang_len = libc.Xstrlen(tls, (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Flang) } else { lang_len = uint32(0) } if (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Flang_key != libc.UintptrFromInt32(0) { lang_key_len = libc.Xstrlen(tls, (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Flang_key) } else { lang_key_len = uint32(0) } } if (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Ftext == libc.UintptrFromInt32(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Ftext))) == int32('\000') { text_length = uint32(0) if (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Fcompression > 0 { (*Tpng_text)(unsafe.Pointer(textp)).Fcompression = int32(PNG_ITXT_COMPRESSION_NONE) } else { (*Tpng_text)(unsafe.Pointer(textp)).Fcompression = -int32(1) } } else { text_length = libc.Xstrlen(tls, (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Ftext) (*Tpng_text)(unsafe.Pointer(textp)).Fcompression = (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Fcompression } (*Tpng_text)(unsafe.Pointer(textp)).Fkey = Xpng_malloc_base(tls, png_ptr, key_len+text_length+lang_len+lang_key_len+uint32(4)) if (*Tpng_text)(unsafe.Pointer(textp)).Fkey == libc.UintptrFromInt32(0) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+18186, int32(PNG_CHUNK_WRITE_ERROR)) return int32(1) } libc.Xmemcpy(tls, (*Tpng_text)(unsafe.Pointer(textp)).Fkey, (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Fkey, key_len) *(*uint8)(unsafe.Pointer((*Tpng_text)(unsafe.Pointer(textp)).Fkey + uintptr(key_len))) = uint8('\000') if (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Fcompression > 0 { (*Tpng_text)(unsafe.Pointer(textp)).Flang = (*Tpng_text)(unsafe.Pointer(textp)).Fkey + uintptr(key_len) + uintptr(1) libc.Xmemcpy(tls, (*Tpng_text)(unsafe.Pointer(textp)).Flang, (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Flang, lang_len) *(*uint8)(unsafe.Pointer((*Tpng_text)(unsafe.Pointer(textp)).Flang + uintptr(lang_len))) = uint8('\000') (*Tpng_text)(unsafe.Pointer(textp)).Flang_key = (*Tpng_text)(unsafe.Pointer(textp)).Flang + uintptr(lang_len) + uintptr(1) libc.Xmemcpy(tls, (*Tpng_text)(unsafe.Pointer(textp)).Flang_key, (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Flang_key, lang_key_len) *(*uint8)(unsafe.Pointer((*Tpng_text)(unsafe.Pointer(textp)).Flang_key + uintptr(lang_key_len))) = uint8('\000') (*Tpng_text)(unsafe.Pointer(textp)).Ftext = (*Tpng_text)(unsafe.Pointer(textp)).Flang_key + uintptr(lang_key_len) + uintptr(1) } else { (*Tpng_text)(unsafe.Pointer(textp)).Flang = libc.UintptrFromInt32(0) (*Tpng_text)(unsafe.Pointer(textp)).Flang_key = libc.UintptrFromInt32(0) (*Tpng_text)(unsafe.Pointer(textp)).Ftext = (*Tpng_text)(unsafe.Pointer(textp)).Fkey + uintptr(key_len) + uintptr(1) } if text_length != uint32(0) { libc.Xmemcpy(tls, (*Tpng_text)(unsafe.Pointer(textp)).Ftext, (*(*Tpng_text)(unsafe.Pointer(text_ptr + uintptr(i)*28))).Ftext, text_length) } *(*uint8)(unsafe.Pointer((*Tpng_text)(unsafe.Pointer(textp)).Ftext + uintptr(text_length))) = uint8('\000') if (*Tpng_text)(unsafe.Pointer(textp)).Fcompression > 0 { (*Tpng_text)(unsafe.Pointer(textp)).Ftext_length = uint32(0) (*Tpng_text)(unsafe.Pointer(textp)).Fitxt_length = text_length } else { (*Tpng_text)(unsafe.Pointer(textp)).Ftext_length = text_length (*Tpng_text)(unsafe.Pointer(textp)).Fitxt_length = uint32(0) } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_text++ goto _1 _1: ; i++ } return 0 } func Xpng_set_tIME(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, mod_time Tpng_const_timep) { if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) || mod_time == libc.UintptrFromInt32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x200) != uint32(0) { return } if libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fmonth) == 0 || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fmonth) > int32(12) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fday) == 0 || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fday) > int32(31) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fhour) > int32(23) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fminute) > int32(59) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fsecond) > int32(60) { Xpng_warning(tls, png_ptr, __ccgo_ts+9899) return } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fmod_time = *(*Tpng_time)(unsafe.Pointer(mod_time)) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0200) } func Xpng_set_tRNS(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, trans_alpha Tpng_const_bytep, num_trans int32, trans_color Tpng_const_color_16p) { var sample_max int32 _ = sample_max if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } if trans_alpha != libc.UintptrFromInt32(0) { /* It may not actually be necessary to set png_ptr->trans_alpha here; * we do it for backward compatibility with the way the png_handle_tRNS * function used to do the allocation. * * 1.6.0: The above statement is incorrect; png_handle_tRNS effectively * relies on png_set_tRNS storing the information in png_struct * (otherwise it won't be there for the code in pngrtran.c). */ Xpng_free_data(tls, png_ptr, info_ptr, uint32(0x2000), 0) if num_trans > 0 && num_trans <= int32(PNG_MAX_PALETTE_LENGTH) { /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */ (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftrans_alpha = Xpng_malloc(tls, png_ptr, uint32(PNG_MAX_PALETTE_LENGTH)) libc.Xmemcpy(tls, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftrans_alpha, trans_alpha, libc.Uint32FromInt32(num_trans)) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x2000) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0010) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftrans_alpha = (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftrans_alpha } if trans_color != libc.UintptrFromInt32(0) { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth) < int32(16) { sample_max = int32(1)<<(*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth - int32(1) if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == PNG_COLOR_TYPE_GRAY && libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fgray) > sample_max || libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) && (libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fred) > sample_max || libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fgreen) > sample_max || libc.Int32FromUint16((*Tpng_color_16)(unsafe.Pointer(trans_color)).Fblue) > sample_max) { Xpng_warning(tls, png_ptr, __ccgo_ts+18212) } } (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftrans_color = *(*Tpng_color_16)(unsafe.Pointer(trans_color)) if num_trans == 0 { num_trans = int32(1) } } (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_trans = libc.Uint16FromInt32(num_trans) if num_trans != 0 { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x2000) *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x0010) } } func Xpng_set_sPLT(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, entries Tpng_const_sPLT_tp, nentries int32) { /* * entries - array of png_sPLT_t structures * to be added to the list of palettes * in the info structure. * * nentries - number of palette structures to be * added. */ var length Tsize_t var np Tpng_sPLT_tp var v1 int32 _, _, _ = length, np, v1 if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) || nentries <= 0 || entries == libc.UintptrFromInt32(0) { return } /* Use the internal realloc function, which checks for all the possible * overflows. Notice that the parameters are (int) and (size_t) */ np = Xpng_realloc_array(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes_num, nentries, uint32(16)) if np == libc.UintptrFromInt32(0) { /* Out of memory or too many chunks */ Xpng_chunk_report(tls, png_ptr, __ccgo_ts+18262, int32(PNG_CHUNK_WRITE_ERROR)) return } Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes = np *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x0020) np += uintptr((*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes_num) * 16 for { /* Skip invalid input entries */ if (*Tpng_sPLT_t)(unsafe.Pointer(entries)).Fname == libc.UintptrFromInt32(0) || (*Tpng_sPLT_t)(unsafe.Pointer(entries)).Fentries == libc.UintptrFromInt32(0) { /* png_handle_sPLT doesn't do this, so this is an app error */ Xpng_app_error(tls, png_ptr, __ccgo_ts+18283) /* Just skip the invalid entry */ goto _2 } (*Tpng_sPLT_t)(unsafe.Pointer(np)).Fdepth = (*Tpng_sPLT_t)(unsafe.Pointer(entries)).Fdepth /* In the event of out-of-memory just return - there's no point keeping * on trying to add sPLT chunks. */ length = libc.Xstrlen(tls, (*Tpng_sPLT_t)(unsafe.Pointer(entries)).Fname) + uint32(1) (*Tpng_sPLT_t)(unsafe.Pointer(np)).Fname = Xpng_malloc_base(tls, png_ptr, length) if (*Tpng_sPLT_t)(unsafe.Pointer(np)).Fname == libc.UintptrFromInt32(0) { break } libc.Xmemcpy(tls, (*Tpng_sPLT_t)(unsafe.Pointer(np)).Fname, (*Tpng_sPLT_t)(unsafe.Pointer(entries)).Fname, length) /* IMPORTANT: we have memory now that won't get freed if something else * goes wrong; this code must free it. png_malloc_array produces no * warnings; use a png_chunk_report (below) if there is an error. */ (*Tpng_sPLT_t)(unsafe.Pointer(np)).Fentries = Xpng_malloc_array(tls, png_ptr, (*Tpng_sPLT_t)(unsafe.Pointer(entries)).Fnentries, uint32(10)) if (*Tpng_sPLT_t)(unsafe.Pointer(np)).Fentries == libc.UintptrFromInt32(0) { Xpng_free(tls, png_ptr, (*Tpng_sPLT_t)(unsafe.Pointer(np)).Fname) (*Tpng_sPLT_t)(unsafe.Pointer(np)).Fname = libc.UintptrFromInt32(0) break } (*Tpng_sPLT_t)(unsafe.Pointer(np)).Fnentries = (*Tpng_sPLT_t)(unsafe.Pointer(entries)).Fnentries /* This multiply can't overflow because png_malloc_array has already * checked it when doing the allocation. */ libc.Xmemcpy(tls, (*Tpng_sPLT_t)(unsafe.Pointer(np)).Fentries, (*Tpng_sPLT_t)(unsafe.Pointer(entries)).Fentries, libc.Uint32FromInt32((*Tpng_sPLT_t)(unsafe.Pointer(entries)).Fnentries)*uint32(10)) /* Note that 'continue' skips the advance of the out pointer and out * count, so an invalid entry is not added. */ *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x2000) (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes_num++ np += 16 entries += 16 goto _2 _2: ; nentries-- v1 = nentries if !(v1 != 0) { break } } if nentries > 0 { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+18310, int32(PNG_CHUNK_WRITE_ERROR)) } } func _check_location(tls *libc.TLS, png_ptr Tpng_const_structrp, location int32) (r Tpng_byte) { location &= libc.Int32FromInt32(PNG_HAVE_IHDR3) | libc.Int32FromInt32(PNG_HAVE_PLTE3) | libc.Int32FromInt32(PNG_AFTER_IDAT3) /* New in 1.6.0; copy the location and check it. This is an API * change; previously the app had to use the * png_set_unknown_chunk_location API below for each chunk. */ if location == 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x8000) == uint32(0) { /* Write struct, so unknown chunks come from the app */ Xpng_app_warning(tls, png_ptr, __ccgo_ts+18329) /* Use the old behavior */ location = libc.Int32FromUint8(uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode & libc.Uint32FromInt32(libc.Int32FromInt32(PNG_HAVE_IHDR3)|libc.Int32FromInt32(PNG_HAVE_PLTE3)|libc.Int32FromInt32(PNG_AFTER_IDAT3)))) } /* This need not be an internal error - if the app calls * png_set_unknown_chunks on a read pointer it must get the location right. */ if location == 0 { Xpng_error(tls, png_ptr, __ccgo_ts+18381) } /* Now reduce the location to the top-most set bit by removing each least * significant bit in turn. */ for location != location&-location { location &= ^(location & -location) } /* The cast is safe because 'location' is a bit mask and only the low four * bits are significant. */ return libc.Uint8FromInt32(location) } func Xpng_set_unknown_chunks(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, unknowns Tpng_const_unknown_chunkp, num_unknowns int32) { var np Tpng_unknown_chunkp _ = np if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) || num_unknowns <= 0 || unknowns == libc.UintptrFromInt32(0) { return } /* Check for the failure cases where support has been disabled at compile * time. This code is hardly ever compiled - it's here because * STORE_UNKNOWN_CHUNKS is set by both read and write code (compiling in this * code) but may be meaningless if the read or write handling of unknown * chunks is not compiled in. */ /* Prior to 1.6.0 this code used png_malloc_warn; however, this meant that * unknown critical chunks could be lost with just a warning resulting in * undefined behavior. Now png_chunk_report is used to provide behavior * appropriate to read or write. */ np = Xpng_realloc_array(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks, (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks_num, num_unknowns, uint32(20)) if np == libc.UintptrFromInt32(0) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+18424, int32(PNG_CHUNK_WRITE_ERROR)) return } Xpng_free(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks) (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks = np /* safe because it is initialized */ *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 244)) |= uint32(0x0200) np += uintptr((*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks_num) * 20 /* Increment unknown_chunks_num each time round the loop to protect the * just-allocated chunk data. */ for { if !(num_unknowns > 0) { break } libc.Xmemcpy(tls, np, unknowns, libc.Uint32FromInt64(5)) *(*Tpng_byte)(unsafe.Pointer(np + uintptr(libc.Uint32FromInt64(5)-libc.Uint32FromInt32(1)))) = uint8('\000') (*Tpng_unknown_chunk)(unsafe.Pointer(np)).Flocation = _check_location(tls, png_ptr, libc.Int32FromUint8((*Tpng_unknown_chunk)(unsafe.Pointer(unknowns)).Flocation)) if (*Tpng_unknown_chunk)(unsafe.Pointer(unknowns)).Fsize == uint32(0) { (*Tpng_unknown_chunk)(unsafe.Pointer(np)).Fdata = libc.UintptrFromInt32(0) (*Tpng_unknown_chunk)(unsafe.Pointer(np)).Fsize = uint32(0) } else { (*Tpng_unknown_chunk)(unsafe.Pointer(np)).Fdata = Xpng_malloc_base(tls, png_ptr, (*Tpng_unknown_chunk)(unsafe.Pointer(unknowns)).Fsize) if (*Tpng_unknown_chunk)(unsafe.Pointer(np)).Fdata == libc.UintptrFromInt32(0) { Xpng_chunk_report(tls, png_ptr, __ccgo_ts+18448, int32(PNG_CHUNK_WRITE_ERROR)) /* But just skip storing the unknown chunk */ goto _1 } libc.Xmemcpy(tls, (*Tpng_unknown_chunk)(unsafe.Pointer(np)).Fdata, (*Tpng_unknown_chunk)(unsafe.Pointer(unknowns)).Fdata, (*Tpng_unknown_chunk)(unsafe.Pointer(unknowns)).Fsize) (*Tpng_unknown_chunk)(unsafe.Pointer(np)).Fsize = (*Tpng_unknown_chunk)(unsafe.Pointer(unknowns)).Fsize } /* These increments are skipped on out-of-memory for the data - the * unknown chunk entry gets overwritten if the png_chunk_report returns. * This is correct in the read case (the chunk is just dropped.) */ np += 20 (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks_num++ goto _1 _1: ; num_unknowns-- unknowns += 20 } } func Xpng_set_unknown_chunk_location(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, chunk int32, location int32) { /* This API is pretty pointless in 1.6.0 because the location can be set * before the call to png_set_unknown_chunks. * * TODO: add a png_app_warning in 1.7 */ if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) && chunk >= 0 && chunk < (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks_num { if location&(libc.Int32FromInt32(PNG_HAVE_IHDR3)|libc.Int32FromInt32(PNG_HAVE_PLTE3)|libc.Int32FromInt32(PNG_AFTER_IDAT3)) == 0 { Xpng_app_error(tls, png_ptr, __ccgo_ts+18477) /* Fake out the pre 1.6.0 behavior: */ if libc.Uint32FromInt32(location)&uint32(0x04) != uint32(0) { /* undocumented! */ location = int32(PNG_AFTER_IDAT3) } else { location = int32(PNG_HAVE_IHDR3) } /* also undocumented */ } (*(*Tpng_unknown_chunk)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks + uintptr(chunk)*20))).Flocation = _check_location(tls, png_ptr, location) } } func Xpng_permit_mng_features(tls *libc.TLS, png_ptr Tpng_structrp, mng_features Tpng_uint_32) (r Tpng_uint_32) { if png_ptr == libc.UintptrFromInt32(0) { return uint32(0) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted = mng_features & uint32(PNG_ALL_MNG_FEATURES1) return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted } func _add_one_chunk(tls *libc.TLS, list Tpng_bytep, count uint32, add Tpng_const_bytep, keep int32) (r uint32) { var i uint32 _ = i /* Utility function: update the 'keep' state of a chunk if it is already in * the list, otherwise add it to the list. */ i = uint32(0) for { if !(i < count) { break } if libc.Xmemcmp(tls, list, add, uint32(4)) == 0 { *(*Tpng_byte)(unsafe.Pointer(list + 4)) = libc.Uint8FromInt32(keep) return count } goto _1 _1: ; i++ list += uintptr(5) } if keep != PNG_HANDLE_CHUNK_AS_DEFAULT { count++ libc.Xmemcpy(tls, list, add, uint32(4)) *(*Tpng_byte)(unsafe.Pointer(list + 4)) = libc.Uint8FromInt32(keep) } return count } func Xpng_set_keep_unknown_chunks(tls *libc.TLS, png_ptr Tpng_structrp, keep int32, chunk_list Tpng_const_bytep, num_chunks_in int32) { var i, num_chunks, old_num_chunks uint32 var inlist Tpng_const_bytep var new_list, outlist, v3 Tpng_bytep _, _, _, _, _, _, _ = i, inlist, new_list, num_chunks, old_num_chunks, outlist, v3 if png_ptr == libc.UintptrFromInt32(0) { return } if keep < 0 || keep >= int32(PNG_HANDLE_CHUNK_LAST) { Xpng_app_error(tls, png_ptr, __ccgo_ts+18508) return } if num_chunks_in <= 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_default = keep /* '0' means just set the flags, so stop here */ if num_chunks_in == 0 { return } } if num_chunks_in < 0 { chunk_list = uintptr(unsafe.Pointer(&_chunks_to_ignore)) num_chunks = libc.Uint32FromInt64(90) / libc.Uint32FromUint32(5) } else { /* num_chunks_in > 0 */ if chunk_list == libc.UintptrFromInt32(0) { /* Prior to 1.6.0 this was silently ignored, now it is an app_error * which can be switched off. */ Xpng_app_error(tls, png_ptr, __ccgo_ts+18550) return } num_chunks = libc.Uint32FromInt32(num_chunks_in) } old_num_chunks = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_chunk_list if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list == libc.UintptrFromInt32(0) { old_num_chunks = uint32(0) } /* Since num_chunks is always restricted to UINT_MAX/5 this can't overflow. */ if num_chunks+old_num_chunks > libc.Uint32FromUint32(0xffffffff)/libc.Uint32FromInt32(5) { Xpng_app_error(tls, png_ptr, __ccgo_ts+18593) return } /* If these chunks are being reset to the default then no more memory is * required because add_one_chunk above doesn't extend the list if the 'keep' * parameter is the default. */ if keep != 0 { new_list = Xpng_malloc(tls, png_ptr, uint32(5)*(num_chunks+old_num_chunks)) if old_num_chunks > uint32(0) { libc.Xmemcpy(tls, new_list, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list, uint32(5)*old_num_chunks) } } else { if old_num_chunks > uint32(0) { new_list = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list } else { new_list = libc.UintptrFromInt32(0) } } /* Add the new chunks together with each one's handling code. If the chunk * already exists the code is updated, otherwise the chunk is added to the * end. (In libpng 1.6.0 order no longer matters because this code enforces * the earlier convention that the last setting is the one that is used.) */ if new_list != libc.UintptrFromInt32(0) { i = uint32(0) for { if !(i < num_chunks) { break } old_num_chunks = _add_one_chunk(tls, new_list, old_num_chunks, chunk_list+uintptr(uint32(5)*i), keep) goto _1 _1: ; i++ } /* Now remove any spurious 'default' entries. */ num_chunks = uint32(0) i = uint32(0) v3 = new_list outlist = v3 inlist = v3 for { if !(i < old_num_chunks) { break } if *(*Tpng_byte)(unsafe.Pointer(inlist + 4)) != 0 { if outlist != inlist { libc.Xmemcpy(tls, outlist, inlist, uint32(5)) } outlist += uintptr(5) num_chunks++ } goto _2 _2: ; i++ inlist += uintptr(5) } /* This means the application has removed all the specialized handling. */ if num_chunks == uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list != new_list { Xpng_free(tls, png_ptr, new_list) } new_list = libc.UintptrFromInt32(0) } } else { num_chunks = uint32(0) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_chunk_list = num_chunks if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list != new_list { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list != libc.UintptrFromInt32(0) { Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list = new_list } } /* Ignore all unknown chunks and all chunks recognized by * libpng except for IHDR, PLTE, tRNS, IDAT, and IEND */ var _chunks_to_ignore = [90]Tpng_byte{ 0: uint8(98), 1: uint8(75), 2: uint8(71), 3: uint8(68), 5: uint8(99), 6: uint8(72), 7: uint8(82), 8: uint8(77), 10: uint8(101), 11: uint8(88), 12: uint8(73), 13: uint8(102), 15: uint8(103), 16: uint8(65), 17: uint8(77), 18: uint8(65), 20: uint8(104), 21: uint8(73), 22: uint8(83), 23: uint8(84), 25: uint8(105), 26: uint8(67), 27: uint8(67), 28: uint8(80), 30: uint8(105), 31: uint8(84), 32: uint8(88), 33: uint8(116), 35: uint8(111), 36: uint8(70), 37: uint8(70), 38: uint8(115), 40: uint8(112), 41: uint8(67), 42: uint8(65), 43: uint8(76), 45: uint8(112), 46: uint8(72), 47: uint8(89), 48: uint8(115), 50: uint8(115), 51: uint8(66), 52: uint8(73), 53: uint8(84), 55: uint8(115), 56: uint8(67), 57: uint8(65), 58: uint8(76), 60: uint8(115), 61: uint8(80), 62: uint8(76), 63: uint8(84), 65: uint8(115), 66: uint8(84), 67: uint8(69), 68: uint8(82), 70: uint8(115), 71: uint8(82), 72: uint8(71), 73: uint8(66), 75: uint8(116), 76: uint8(69), 77: uint8(88), 78: uint8(116), 80: uint8(116), 81: uint8(73), 82: uint8(77), 83: uint8(69), 85: uint8(122), 86: uint8(84), 87: uint8(88), 88: uint8(116), } func Xpng_set_read_user_chunk_fn(tls *libc.TLS, png_ptr Tpng_structrp, user_chunk_ptr Tpng_voidp, read_user_chunk_fn Tpng_user_chunk_ptr) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_user_chunk_fn = read_user_chunk_fn (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_ptr = user_chunk_ptr } func Xpng_set_rows(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, row_pointers Tpng_bytepp) { if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers != libc.UintptrFromInt32(0) && (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers != row_pointers { Xpng_free_data(tls, png_ptr, info_ptr, uint32(0x0040), 0) } (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers = row_pointers if row_pointers != libc.UintptrFromInt32(0) { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) |= uint32(0x8000) } } func Xpng_set_compression_buffer_size(tls *libc.TLS, png_ptr Tpng_structrp, size Tsize_t) { if png_ptr == libc.UintptrFromInt32(0) { return } if size == uint32(0) || size > libc.Uint32FromInt32(0x7fffffff) { Xpng_error(tls, png_ptr, __ccgo_ts+18638) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x8000) != uint32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).FIDAT_read_size = size /* checked above */ return } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x8000) == uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner != uint32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+18670) return } /* Some compilers complain that this is always false. However, it * can be true when integer overflow happens. */ if size > libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { Xpng_warning(tls, png_ptr, __ccgo_ts+18733) size = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) /* must fit */ } if size < uint32(6) { /* Deflate will potentially go into an infinite loop on a SYNC_FLUSH * if this is permitted. */ Xpng_warning(tls, png_ptr, __ccgo_ts+18783) return } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_size != size { Xpng_free_buffer_list(tls, png_ptr, png_ptr+516) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_size = size } } } func Xpng_set_invalid(tls *libc.TLS, png_ptr Tpng_const_structrp, info_ptr Tpng_inforp, mask int32) { if png_ptr != libc.UintptrFromInt32(0) && info_ptr != libc.UintptrFromInt32(0) { *(*Tpng_uint_32)(unsafe.Pointer(info_ptr + 8)) &= libc.Uint32FromInt32(^mask) } } // C documentation // // /* This function was added to libpng 1.2.6 */ func Xpng_set_user_limits(tls *libc.TLS, png_ptr Tpng_structrp, user_width_max Tpng_uint_32, user_height_max Tpng_uint_32) { /* Images with dimensions larger than these limits will be * rejected by png_set_IHDR(). To accept any PNG datastream * regardless of dimensions, set both limits to 0x7fffffff. */ if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_width_max = user_width_max (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_height_max = user_height_max } // C documentation // // /* This function was added to libpng 1.4.0 */ func Xpng_set_chunk_cache_max(tls *libc.TLS, png_ptr Tpng_structrp, user_chunk_cache_max Tpng_uint_32) { if png_ptr != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_cache_max = user_chunk_cache_max } } // C documentation // // /* This function was added to libpng 1.4.1 */ func Xpng_set_chunk_malloc_max(tls *libc.TLS, png_ptr Tpng_structrp, user_chunk_malloc_max Tpng_alloc_size_t) { if png_ptr != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_chunk_malloc_max = user_chunk_malloc_max } } func Xpng_set_benign_errors(tls *libc.TLS, png_ptr Tpng_structrp, allowed int32) { /* If allowed is 1, png_benign_error() is treated as a warning. * * If allowed is 0, png_benign_error() is treated as an error (which * is the default behavior if png_set_benign_errors() is not called). */ if allowed != 0 { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= libc.Uint32FromUint32(0x100000) | libc.Uint32FromUint32(0x200000) | libc.Uint32FromUint32(0x400000) } else { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^(libc.Uint32FromUint32(0x100000) | libc.Uint32FromUint32(0x200000) | libc.Uint32FromUint32(0x400000)) } } // C documentation // // /* Whether to report invalid palette index; added at libng-1.5.10. // * It is possible for an indexed (color-type==3) PNG file to contain // * pixels with invalid (out-of-range) indexes if the PLTE chunk has // * fewer entries than the image's bit-depth would allow. We recover // * from this gracefully by filling any incomplete palette with zeros // * (opaque black). By default, when this occurs libpng will issue // * a benign error. This API can be used to override that behavior. // */ func Xpng_set_check_for_invalid_index(tls *libc.TLS, png_ptr Tpng_structrp, allowed int32) { if allowed > 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max = 0 } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max = -int32(1) } } // C documentation // // /* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification, // * and if invalid, correct the keyword rather than discarding the entire // * chunk. The PNG 1.0 specification requires keywords 1-79 characters in // * length, forbids leading or trailing whitespace, multiple internal spaces, // * and the non-break space (0x80) from ISO 8859-1. Returns keyword length. // * // * The 'new_key' buffer must be 80 characters in size (for the keyword plus a // * trailing '\0'). If this routine returns 0 then there was no keyword, or a // * valid one could not be generated, and the caller must png_error. // */ func Xpng_check_keyword(tls *libc.TLS, png_ptr Tpng_structrp, key Tpng_const_charp, new_key Tpng_bytep) (r Tpng_uint_32) { bp := tls.Alloc(256) defer tls.Free(256) var bad_character, space int32 var ch Tpng_byte var key_len Tpng_uint_32 var orig_key, v1 Tpng_const_charp var v2, v3 Tpng_bytep var _ /* p at bp+0 */ Tpng_warning_parameters _, _, _, _, _, _, _, _ = bad_character, ch, key_len, orig_key, space, v1, v2, v3 orig_key = key key_len = uint32(0) bad_character = 0 space = int32(1) if key == libc.UintptrFromInt32(0) { *(*Tpng_byte)(unsafe.Pointer(new_key)) = uint8(0) return uint32(0) } for *(*uint8)(unsafe.Pointer(key)) != 0 && key_len < uint32(79) { v1 = key key++ ch = *(*uint8)(unsafe.Pointer(v1)) if libc.Int32FromUint8(ch) > int32(32) && libc.Int32FromUint8(ch) <= int32(126) || libc.Int32FromUint8(ch) >= int32(161) { v2 = new_key new_key++ *(*Tpng_byte)(unsafe.Pointer(v2)) = ch key_len++ space = 0 } else { if space == 0 { /* A space or an invalid character when one wasn't seen immediately * before; output just a space. */ v3 = new_key new_key++ *(*Tpng_byte)(unsafe.Pointer(v3)) = uint8(32) key_len++ space = int32(1) /* If the character was not a space then it is invalid. */ if libc.Int32FromUint8(ch) != int32(32) { bad_character = libc.Int32FromUint8(ch) } } else { if bad_character == 0 { bad_character = libc.Int32FromUint8(ch) } } } /* just skip it, record the first error */ } if key_len > uint32(0) && space != 0 { /* trailing space */ key_len-- new_key-- if bad_character == 0 { bad_character = int32(32) } } /* Terminate the keyword */ *(*Tpng_byte)(unsafe.Pointer(new_key)) = uint8(0) if key_len == uint32(0) { return uint32(0) } /* Try to only output one warning per keyword: */ if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(key))) != 0 { /* keyword too long */ Xpng_warning(tls, png_ptr, __ccgo_ts+18833) } else { if bad_character != 0 { Xpng_warning_parameter(tls, bp, int32(1), orig_key) Xpng_warning_parameter_signed(tls, bp, int32(2), int32(PNG_NUMBER_FORMAT_02x), bad_character) Xpng_formatted_warning(tls, png_ptr, bp, __ccgo_ts+18851) } } return key_len } const INT_MAX4 = 0x7fffffff const PNGTCL_MAJOR_VERSION = 1 const PNGTCL_MINOR_VERSION = 6 const PNGTCL_PATCH_LEVEL = "1.6.44" const PNGTCL_RELEASE_LEVEL = "TCL_RELEASE" const PNGTCL_RELEASE_SERIAL = 44 const PNGTCL_VERSION = "1.6.44" const PNG_AFTER_IDAT4 = 0x08 const PNG_ALL_MNG_FEATURES2 = 0x05 const PNG_FLAG_MNG_EMPTY_PLTE2 = 0x01 const PNG_FREE_EXIF4 = 0x8000 const PNG_FREE_HIST4 = 0x0008 const PNG_FREE_ICCP4 = 0x0010 const PNG_FREE_PCAL4 = 0x0080 const PNG_FREE_PLTE6 = 0x1000 const PNG_FREE_ROWS6 = 0x0040 const PNG_FREE_SCAL4 = 0x0100 const PNG_FREE_SPLT4 = 0x0020 const PNG_FREE_TEXT4 = 0x4000 const PNG_FREE_TRNS6 = 0x2000 const PNG_FREE_UNKN4 = 0x0200 const PNG_HAVE_IHDR4 = 0x01 const PNG_HAVE_PLTE4 = 0x02 const PNG_INFO_IDAT6 = 0x8000 const PNG_INFO_PLTE6 = 0x0008 const PNG_INFO_bKGD4 = 0x0020 const PNG_INFO_eXIf6 = 0x10000 const PNG_INFO_hIST6 = 0x0040 const PNG_INFO_iCCP6 = 0x1000 const PNG_INFO_oFFs4 = 0x0100 const PNG_INFO_pCAL6 = 0x0400 const PNG_INFO_pHYs4 = 0x0080 const PNG_INFO_sBIT6 = 0x0002 const PNG_INFO_sCAL6 = 0x4000 const PNG_INFO_sPLT4 = 0x2000 const PNG_INFO_tIME4 = 0x0200 const PNG_INFO_tRNS6 = 0x0010 const UINT_MAX2 = 0xffffffff const ZLIBTCL_MAJOR_VERSION = 1 const ZLIBTCL_MINOR_VERSION = 3 const ZLIBTCL_RELEASE_LEVEL = "TCL_RELEASE" const ZLIBTCL_RELEASE_SERIAL = 1 type TPngtclStubs = struct { Fmagic int32 Fhooks uintptr Fpng_access_version_numberPtr uintptr Fpng_set_sig_bytesPtr uintptr Fpng_sig_cmpPtr uintptr Freserved3 uintptr Fpng_create_read_structPtr uintptr Fpng_create_write_structPtr uintptr Fpng_get_compression_buffer_sizePtr uintptr Fpng_set_compression_buffer_sizePtr uintptr Freserved8 uintptr Fpng_create_read_struct_2Ptr uintptr Fpng_create_write_struct_2Ptr uintptr Fpng_write_chunkPtr uintptr Fpng_write_chunk_startPtr uintptr Fpng_write_chunk_dataPtr uintptr Fpng_write_chunk_endPtr uintptr Fpng_create_info_structPtr uintptr Freserved16 uintptr Fpng_write_info_before_PLTEPtr uintptr Fpng_write_infoPtr uintptr Fpng_read_infoPtr uintptr Freserved20 uintptr Fpng_convert_from_struct_tmPtr uintptr Fpng_convert_from_time_tPtr uintptr Fpng_set_expandPtr uintptr Freserved24 uintptr Fpng_set_palette_to_rgbPtr uintptr Fpng_set_tRNS_to_alphaPtr uintptr Fpng_set_bgrPtr uintptr Fpng_set_gray_to_rgbPtr uintptr Fpng_set_rgb_to_grayPtr uintptr Fpng_set_rgb_to_gray_fixedPtr uintptr Fpng_get_rgb_to_gray_statusPtr uintptr Fpng_build_grayscale_palettePtr uintptr Fpng_set_strip_alphaPtr uintptr Fpng_set_swap_alphaPtr uintptr Fpng_set_invert_alphaPtr uintptr Fpng_set_fillerPtr uintptr Fpng_set_swapPtr uintptr Fpng_set_packingPtr uintptr Fpng_set_packswapPtr uintptr Fpng_set_shiftPtr uintptr Fpng_set_interlace_handlingPtr uintptr Fpng_set_invert_monoPtr uintptr Fpng_set_backgroundPtr uintptr Fpng_set_strip_16Ptr uintptr Fpng_set_quantizePtr uintptr Fpng_set_gammaPtr uintptr Fpng_permit_empty_pltePtr uintptr Fpng_set_flushPtr uintptr Fpng_write_flushPtr uintptr Fpng_start_read_imagePtr uintptr Fpng_read_update_infoPtr uintptr Fpng_read_rowsPtr uintptr Fpng_read_rowPtr uintptr Fpng_read_imagePtr uintptr Fpng_write_rowPtr uintptr Fpng_write_rowsPtr uintptr Fpng_write_imagePtr uintptr Fpng_write_endPtr uintptr Fpng_read_endPtr uintptr Fpng_destroy_info_structPtr uintptr Fpng_destroy_read_structPtr uintptr Freserved62 uintptr Fpng_destroy_write_structPtr uintptr Freserved64 uintptr Freserved65 uintptr Fpng_set_crc_actionPtr uintptr Fpng_set_filterPtr uintptr Fpng_set_filter_heuristicsPtr uintptr Fpng_set_compression_levelPtr uintptr Fpng_set_compression_mem_levelPtr uintptr Fpng_set_compression_strategyPtr uintptr Fpng_set_compression_window_bitsPtr uintptr Fpng_set_compression_methodPtr uintptr Fpng_init_ioPtr uintptr Fpng_set_error_fnPtr uintptr Fpng_get_error_ptrPtr uintptr Fpng_set_write_fnPtr uintptr Fpng_set_read_fnPtr uintptr Fpng_get_io_ptrPtr uintptr Fpng_set_read_status_fnPtr uintptr Fpng_set_write_status_fnPtr uintptr Fpng_set_mem_fnPtr uintptr Fpng_get_mem_ptrPtr uintptr Fpng_set_read_user_transform_fnPtr uintptr Fpng_set_write_user_transform_fnPtr uintptr Fpng_set_user_transform_infoPtr uintptr Fpng_get_user_transform_ptrPtr uintptr Fpng_set_read_user_chunk_fnPtr uintptr Fpng_get_user_chunk_ptrPtr uintptr Fpng_set_progressive_read_fnPtr uintptr Fpng_get_progressive_ptrPtr uintptr Fpng_process_dataPtr uintptr Fpng_progressive_combine_rowPtr uintptr Fpng_mallocPtr uintptr Fpng_freePtr uintptr Fpng_free_dataPtr uintptr Freserved97 uintptr Freserved98 uintptr Freserved99 uintptr Freserved100 uintptr Freserved101 uintptr Fpng_far_to_nearPtr uintptr Fpng_errorPtr uintptr Fpng_chunk_errorPtr uintptr Fpng_warningPtr uintptr Fpng_chunk_warningPtr uintptr Fpng_get_validPtr uintptr Fpng_get_rowbytesPtr uintptr Fpng_get_rowsPtr uintptr Fpng_set_rowsPtr uintptr Fpng_get_channelsPtr uintptr Fpng_get_image_widthPtr uintptr Fpng_get_image_heightPtr uintptr Fpng_get_bit_depthPtr uintptr Fpng_get_color_typePtr uintptr Fpng_get_filter_typePtr uintptr Fpng_get_interlace_typePtr uintptr Fpng_get_compression_typePtr uintptr Fpng_get_pixels_per_meterPtr uintptr Fpng_get_x_pixels_per_meterPtr uintptr Fpng_get_y_pixels_per_meterPtr uintptr Fpng_get_pixel_aspect_ratioPtr uintptr Fpng_get_x_offset_pixelsPtr uintptr Fpng_get_y_offset_pixelsPtr uintptr Fpng_get_x_offset_micronsPtr uintptr Fpng_get_y_offset_micronsPtr uintptr Fpng_get_signaturePtr uintptr Fpng_get_bKGDPtr uintptr Fpng_set_bKGDPtr uintptr Fpng_get_cHRMPtr uintptr Fpng_get_cHRM_fixedPtr uintptr Fpng_set_cHRMPtr uintptr Fpng_set_cHRM_fixedPtr uintptr Fpng_get_gAMAPtr uintptr Fpng_get_gAMA_fixedPtr uintptr Fpng_set_gAMAPtr uintptr Fpng_set_gAMA_fixedPtr uintptr Fpng_get_hISTPtr uintptr Fpng_set_hISTPtr uintptr Fpng_get_IHDRPtr uintptr Fpng_set_IHDRPtr uintptr Fpng_get_oFFsPtr uintptr Fpng_set_oFFsPtr uintptr Fpng_get_pCALPtr uintptr Fpng_set_pCALPtr uintptr Fpng_get_pHYsPtr uintptr Fpng_set_pHYsPtr uintptr Fpng_get_PLTEPtr uintptr Fpng_set_PLTEPtr uintptr Fpng_get_sBITPtr uintptr Fpng_set_sBITPtr uintptr Fpng_get_sRGBPtr uintptr Fpng_set_sRGBPtr uintptr Fpng_set_sRGB_gAMA_and_cHRMPtr uintptr Fpng_get_iCCPPtr uintptr Fpng_set_iCCPPtr uintptr Fpng_get_sPLTPtr uintptr Fpng_set_sPLTPtr uintptr Fpng_get_textPtr uintptr Fpng_set_textPtr uintptr Fpng_get_tIMEPtr uintptr Fpng_set_tIMEPtr uintptr Fpng_get_tRNSPtr uintptr Fpng_set_tRNSPtr uintptr Fpng_get_sCALPtr uintptr Fpng_get_sCAL_sPtr uintptr Fpng_set_sCALPtr uintptr Fpng_set_sCAL_sPtr uintptr Fpng_set_keep_unknown_chunksPtr uintptr Fpng_set_unknown_chunksPtr uintptr Fpng_set_unknown_chunk_locationPtr uintptr Fpng_get_unknown_chunksPtr uintptr Fpng_set_invalidPtr uintptr Fpng_read_pngPtr uintptr Fpng_write_pngPtr uintptr Fpng_sig_bytesPtr uintptr Fpng_get_copyrightPtr uintptr Fpng_get_header_verPtr uintptr Fpng_get_header_versionPtr uintptr Fpng_get_libpng_verPtr uintptr Freserved181 uintptr Freserved182 uintptr Freserved183 uintptr Fpng_read_initPtr uintptr Fpng_read_init_2Ptr uintptr Freserved186 uintptr Freserved187 uintptr Fpng_create_structPtr uintptr Fpng_destroy_structPtr uintptr Fpng_create_struct_2Ptr uintptr Fpng_destroy_struct_2Ptr uintptr Fpng_info_destroyPtr uintptr Freserved193 uintptr Freserved194 uintptr Fpng_reset_crcPtr uintptr Fpng_write_dataPtr uintptr Fpng_read_dataPtr uintptr Fpng_crc_readPtr uintptr Fpng_decompress_chunkPtr uintptr Fpng_crc_finishPtr uintptr Fpng_crc_errorPtr uintptr Fpng_calculate_crcPtr uintptr Fpng_flushPtr uintptr Fpng_save_uint_32Ptr uintptr Fpng_save_int_32Ptr uintptr Fpng_save_uint_16Ptr uintptr Fpng_write_sigPtr uintptr Fpng_write_IHDRPtr uintptr Fpng_write_PLTEPtr uintptr Fpng_write_IDATPtr uintptr Fpng_write_IENDPtr uintptr Fpng_write_gAMAPtr uintptr Fpng_write_gAMA_fixedPtr uintptr Fpng_write_sBITPtr uintptr Fpng_write_cHRMPtr uintptr Fpng_write_cHRM_fixedPtr uintptr Fpng_write_sRGBPtr uintptr Fpng_write_iCCPPtr uintptr Fpng_write_sPLTPtr uintptr Fpng_write_tRNSPtr uintptr Fpng_write_bKGDPtr uintptr Fpng_write_hISTPtr uintptr Fpng_check_keywordPtr uintptr Fpng_write_tEXtPtr uintptr Fpng_write_zTXtPtr uintptr Fpng_write_iTXtPtr uintptr Fpng_write_oFFsPtr uintptr Fpng_write_pCALPtr uintptr Fpng_write_pHYsPtr uintptr Fpng_write_tIMEPtr uintptr Fpng_write_sCALPtr uintptr Fpng_write_sCAL_sPtr uintptr Fpng_write_finish_rowPtr uintptr Fpng_write_start_rowPtr uintptr Fpng_build_gamma_tablePtr uintptr Fpng_combine_rowPtr uintptr Fpng_do_read_interlacePtr uintptr Fpng_do_write_interlacePtr uintptr Fpng_read_filter_rowPtr uintptr Fpng_write_find_filterPtr uintptr Fpng_write_filtered_rowPtr uintptr Fpng_read_finish_rowPtr uintptr Fpng_read_start_rowPtr uintptr Fpng_read_transform_infoPtr uintptr Fpng_do_read_fillerPtr uintptr Fpng_do_read_swap_alphaPtr uintptr Fpng_do_write_swap_alphaPtr uintptr Fpng_do_read_invert_alphaPtr uintptr Fpng_do_write_invert_alphaPtr uintptr Fpng_do_strip_fillerPtr uintptr Fpng_do_swapPtr uintptr Fpng_do_packswapPtr uintptr Fpng_do_rgb_to_grayPtr uintptr Fpng_do_gray_to_rgbPtr uintptr Fpng_do_unpackPtr uintptr Fpng_do_unshiftPtr uintptr Fpng_do_invertPtr uintptr Fpng_do_chopPtr uintptr Fpng_do_ditherPtr uintptr Fpng_correct_palettePtr uintptr Fpng_do_bgrPtr uintptr Fpng_do_packPtr uintptr Fpng_do_shiftPtr uintptr Fpng_do_backgroundPtr uintptr Fpng_do_gammaPtr uintptr Fpng_do_expand_palettePtr uintptr Fpng_do_expandPtr uintptr Fpng_handle_IHDRPtr uintptr Fpng_handle_PLTEPtr uintptr Fpng_handle_IENDPtr uintptr Fpng_handle_bKGDPtr uintptr Fpng_handle_cHRMPtr uintptr Fpng_handle_gAMAPtr uintptr Fpng_handle_hISTPtr uintptr Fpng_handle_iCCPPtr uintptr Fpng_handle_iTXtPtr uintptr Fpng_handle_oFFsPtr uintptr Fpng_handle_pCALPtr uintptr Fpng_handle_pHYsPtr uintptr Fpng_handle_sBITPtr uintptr Fpng_handle_sCALPtr uintptr Fpng_handle_sPLTPtr uintptr Fpng_handle_sRGBPtr uintptr Fpng_handle_tEXtPtr uintptr Fpng_handle_tIMEPtr uintptr Fpng_handle_tRNSPtr uintptr Fpng_handle_zTXtPtr uintptr Fpng_handle_as_unknownPtr uintptr Fpng_handle_unknownPtr uintptr Fpng_check_chunk_namePtr uintptr Fpng_do_read_transformationsPtr uintptr Fpng_do_write_transformationsPtr uintptr Fpng_init_read_transformationsPtr uintptr Fpng_push_read_chunkPtr uintptr Fpng_push_read_sigPtr uintptr Fpng_push_check_crcPtr uintptr Fpng_push_crc_skipPtr uintptr Fpng_push_crc_finishPtr uintptr Fpng_push_fill_bufferPtr uintptr Fpng_push_save_bufferPtr uintptr Fpng_push_restore_bufferPtr uintptr Fpng_push_read_IDATPtr uintptr Fpng_process_IDAT_dataPtr uintptr Fpng_push_process_rowPtr uintptr Fpng_push_handle_unknownPtr uintptr Fpng_push_have_infoPtr uintptr Fpng_push_have_endPtr uintptr Fpng_push_have_rowPtr uintptr Fpng_push_read_endPtr uintptr Fpng_process_some_dataPtr uintptr Fpng_read_push_finish_rowPtr uintptr Fpng_push_handle_tEXtPtr uintptr Fpng_push_read_tEXtPtr uintptr Fpng_push_handle_zTXtPtr uintptr Fpng_push_read_zTXtPtr uintptr Fpng_push_handle_iTXtPtr uintptr Fpng_push_read_iTXtPtr uintptr Freserved318 uintptr Fpng_set_add_alphaPtr uintptr Fpng_set_scale_16Ptr uintptr } /* *---------------------------------------------------------------------------- * * Pngtcl_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, * loads xml package. * *---------------------------------------------------------------------------- */ func XPngtcl_Init(tls *libc.TLS, interp uintptr) (r int32) { /* Interpreter to initialise. */ if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<= int32(8) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_channels = uint8(2) break } else { /* There simply isn't any code in libpng to strip out bits * from bytes when the components are less than a byte in * size! */ Xpng_app_error(tls, png_ptr, __ccgo_ts+18893) return } fallthrough default: Xpng_app_error(tls, png_ptr, __ccgo_ts+18949) return } } /* Here on success - libpng supports the operation, set the transformation * and the flag to say where the filler channel is. */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x8000) if filler_loc == int32(PNG_FILLER_AFTER) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0080) } else { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^libc.Uint32FromUint32(0x0080) } } // C documentation // // /* Added to libpng-1.2.7 */ func Xpng_set_add_alpha(tls *libc.TLS, png_ptr Tpng_structrp, filler Tpng_uint_32, filler_loc int32) { if png_ptr == libc.UintptrFromInt32(0) { return } Xpng_set_filler(tls, png_ptr, filler, filler_loc) /* The above may fail to do anything. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x8000) != uint32(0) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x1000000) } } func Xpng_set_swap_alpha(tls *libc.TLS, png_ptr Tpng_structrp) { if png_ptr == libc.UintptrFromInt32(0) { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x20000) } func Xpng_set_invert_alpha(tls *libc.TLS, png_ptr Tpng_structrp) { if png_ptr == libc.UintptrFromInt32(0) { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x80000) } func Xpng_set_invert_mono(tls *libc.TLS, png_ptr Tpng_structrp) { if png_ptr == libc.UintptrFromInt32(0) { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x0020) } // C documentation // // /* Invert monochrome grayscale data */ func Xpng_do_invert(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var i, i1, i2, istop, istop1, istop2 Tsize_t var rp, rp1, rp2 Tpng_bytep _, _, _, _, _, _, _, _, _ = i, i1, i2, istop, istop1, istop2, rp, rp1, rp2 /* This test removed from libpng version 1.0.13 and 1.2.0: * if (row_info->bit_depth == 1 && */ if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == PNG_COLOR_TYPE_GRAY { rp = row istop = (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes i = uint32(0) for { if !(i < istop) { break } *(*Tpng_byte)(unsafe.Pointer(rp)) = libc.Uint8FromInt32(^libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp)))) rp++ goto _1 _1: ; i++ } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA) && libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { rp1 = row istop1 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes i1 = uint32(0) for { if !(i1 < istop1) { break } *(*Tpng_byte)(unsafe.Pointer(rp1)) = libc.Uint8FromInt32(^libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp1)))) rp1 += uintptr(2) goto _2 _2: ; i1 += uint32(2) } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA) && libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { rp2 = row istop2 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes i2 = uint32(0) for { if !(i2 < istop2) { break } *(*Tpng_byte)(unsafe.Pointer(rp2)) = libc.Uint8FromInt32(^libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp2)))) *(*Tpng_byte)(unsafe.Pointer(rp2 + libc.UintptrFromInt32(1))) = libc.Uint8FromInt32(^libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp2 + libc.UintptrFromInt32(1))))) rp2 += uintptr(4) goto _3 _3: ; i2 += uint32(4) } } } } } // C documentation // // /* Swaps byte order on 16-bit depth images */ func Xpng_do_swap(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var i, istop Tpng_uint_32 var rp Tpng_bytep var t Tpng_byte _, _, _, _ = i, istop, rp, t if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { rp = row istop = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth * uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) i = uint32(0) for { if !(i < istop) { break } t = *(*Tpng_byte)(unsafe.Pointer(rp)) *(*Tpng_byte)(unsafe.Pointer(rp)) = *(*Tpng_byte)(unsafe.Pointer(rp + libc.UintptrFromInt32(1))) *(*Tpng_byte)(unsafe.Pointer(rp + libc.UintptrFromInt32(1))) = t goto _1 _1: ; i++ rp += uintptr(2) } } } var _onebppswaptable = [256]Tpng_byte{ 1: uint8(0x80), 2: uint8(0x40), 3: uint8(0xC0), 4: uint8(0x20), 5: uint8(0xA0), 6: uint8(0x60), 7: uint8(0xE0), 8: uint8(0x10), 9: uint8(0x90), 10: uint8(0x50), 11: uint8(0xD0), 12: uint8(0x30), 13: uint8(0xB0), 14: uint8(0x70), 15: uint8(0xF0), 16: uint8(0x08), 17: uint8(0x88), 18: uint8(0x48), 19: uint8(0xC8), 20: uint8(0x28), 21: uint8(0xA8), 22: uint8(0x68), 23: uint8(0xE8), 24: uint8(0x18), 25: uint8(0x98), 26: uint8(0x58), 27: uint8(0xD8), 28: uint8(0x38), 29: uint8(0xB8), 30: uint8(0x78), 31: uint8(0xF8), 32: uint8(0x04), 33: uint8(0x84), 34: uint8(0x44), 35: uint8(0xC4), 36: uint8(0x24), 37: uint8(0xA4), 38: uint8(0x64), 39: uint8(0xE4), 40: uint8(0x14), 41: uint8(0x94), 42: uint8(0x54), 43: uint8(0xD4), 44: uint8(0x34), 45: uint8(0xB4), 46: uint8(0x74), 47: uint8(0xF4), 48: uint8(0x0C), 49: uint8(0x8C), 50: uint8(0x4C), 51: uint8(0xCC), 52: uint8(0x2C), 53: uint8(0xAC), 54: uint8(0x6C), 55: uint8(0xEC), 56: uint8(0x1C), 57: uint8(0x9C), 58: uint8(0x5C), 59: uint8(0xDC), 60: uint8(0x3C), 61: uint8(0xBC), 62: uint8(0x7C), 63: uint8(0xFC), 64: uint8(0x02), 65: uint8(0x82), 66: uint8(0x42), 67: uint8(0xC2), 68: uint8(0x22), 69: uint8(0xA2), 70: uint8(0x62), 71: uint8(0xE2), 72: uint8(0x12), 73: uint8(0x92), 74: uint8(0x52), 75: uint8(0xD2), 76: uint8(0x32), 77: uint8(0xB2), 78: uint8(0x72), 79: uint8(0xF2), 80: uint8(0x0A), 81: uint8(0x8A), 82: uint8(0x4A), 83: uint8(0xCA), 84: uint8(0x2A), 85: uint8(0xAA), 86: uint8(0x6A), 87: uint8(0xEA), 88: uint8(0x1A), 89: uint8(0x9A), 90: uint8(0x5A), 91: uint8(0xDA), 92: uint8(0x3A), 93: uint8(0xBA), 94: uint8(0x7A), 95: uint8(0xFA), 96: uint8(0x06), 97: uint8(0x86), 98: uint8(0x46), 99: uint8(0xC6), 100: uint8(0x26), 101: uint8(0xA6), 102: uint8(0x66), 103: uint8(0xE6), 104: uint8(0x16), 105: uint8(0x96), 106: uint8(0x56), 107: uint8(0xD6), 108: uint8(0x36), 109: uint8(0xB6), 110: uint8(0x76), 111: uint8(0xF6), 112: uint8(0x0E), 113: uint8(0x8E), 114: uint8(0x4E), 115: uint8(0xCE), 116: uint8(0x2E), 117: uint8(0xAE), 118: uint8(0x6E), 119: uint8(0xEE), 120: uint8(0x1E), 121: uint8(0x9E), 122: uint8(0x5E), 123: uint8(0xDE), 124: uint8(0x3E), 125: uint8(0xBE), 126: uint8(0x7E), 127: uint8(0xFE), 128: uint8(0x01), 129: uint8(0x81), 130: uint8(0x41), 131: uint8(0xC1), 132: uint8(0x21), 133: uint8(0xA1), 134: uint8(0x61), 135: uint8(0xE1), 136: uint8(0x11), 137: uint8(0x91), 138: uint8(0x51), 139: uint8(0xD1), 140: uint8(0x31), 141: uint8(0xB1), 142: uint8(0x71), 143: uint8(0xF1), 144: uint8(0x09), 145: uint8(0x89), 146: uint8(0x49), 147: uint8(0xC9), 148: uint8(0x29), 149: uint8(0xA9), 150: uint8(0x69), 151: uint8(0xE9), 152: uint8(0x19), 153: uint8(0x99), 154: uint8(0x59), 155: uint8(0xD9), 156: uint8(0x39), 157: uint8(0xB9), 158: uint8(0x79), 159: uint8(0xF9), 160: uint8(0x05), 161: uint8(0x85), 162: uint8(0x45), 163: uint8(0xC5), 164: uint8(0x25), 165: uint8(0xA5), 166: uint8(0x65), 167: uint8(0xE5), 168: uint8(0x15), 169: uint8(0x95), 170: uint8(0x55), 171: uint8(0xD5), 172: uint8(0x35), 173: uint8(0xB5), 174: uint8(0x75), 175: uint8(0xF5), 176: uint8(0x0D), 177: uint8(0x8D), 178: uint8(0x4D), 179: uint8(0xCD), 180: uint8(0x2D), 181: uint8(0xAD), 182: uint8(0x6D), 183: uint8(0xED), 184: uint8(0x1D), 185: uint8(0x9D), 186: uint8(0x5D), 187: uint8(0xDD), 188: uint8(0x3D), 189: uint8(0xBD), 190: uint8(0x7D), 191: uint8(0xFD), 192: uint8(0x03), 193: uint8(0x83), 194: uint8(0x43), 195: uint8(0xC3), 196: uint8(0x23), 197: uint8(0xA3), 198: uint8(0x63), 199: uint8(0xE3), 200: uint8(0x13), 201: uint8(0x93), 202: uint8(0x53), 203: uint8(0xD3), 204: uint8(0x33), 205: uint8(0xB3), 206: uint8(0x73), 207: uint8(0xF3), 208: uint8(0x0B), 209: uint8(0x8B), 210: uint8(0x4B), 211: uint8(0xCB), 212: uint8(0x2B), 213: uint8(0xAB), 214: uint8(0x6B), 215: uint8(0xEB), 216: uint8(0x1B), 217: uint8(0x9B), 218: uint8(0x5B), 219: uint8(0xDB), 220: uint8(0x3B), 221: uint8(0xBB), 222: uint8(0x7B), 223: uint8(0xFB), 224: uint8(0x07), 225: uint8(0x87), 226: uint8(0x47), 227: uint8(0xC7), 228: uint8(0x27), 229: uint8(0xA7), 230: uint8(0x67), 231: uint8(0xE7), 232: uint8(0x17), 233: uint8(0x97), 234: uint8(0x57), 235: uint8(0xD7), 236: uint8(0x37), 237: uint8(0xB7), 238: uint8(0x77), 239: uint8(0xF7), 240: uint8(0x0F), 241: uint8(0x8F), 242: uint8(0x4F), 243: uint8(0xCF), 244: uint8(0x2F), 245: uint8(0xAF), 246: uint8(0x6F), 247: uint8(0xEF), 248: uint8(0x1F), 249: uint8(0x9F), 250: uint8(0x5F), 251: uint8(0xDF), 252: uint8(0x3F), 253: uint8(0xBF), 254: uint8(0x7F), 255: uint8(0xFF), } var _twobppswaptable = [256]Tpng_byte{ 1: uint8(0x40), 2: uint8(0x80), 3: uint8(0xC0), 4: uint8(0x10), 5: uint8(0x50), 6: uint8(0x90), 7: uint8(0xD0), 8: uint8(0x20), 9: uint8(0x60), 10: uint8(0xA0), 11: uint8(0xE0), 12: uint8(0x30), 13: uint8(0x70), 14: uint8(0xB0), 15: uint8(0xF0), 16: uint8(0x04), 17: uint8(0x44), 18: uint8(0x84), 19: uint8(0xC4), 20: uint8(0x14), 21: uint8(0x54), 22: uint8(0x94), 23: uint8(0xD4), 24: uint8(0x24), 25: uint8(0x64), 26: uint8(0xA4), 27: uint8(0xE4), 28: uint8(0x34), 29: uint8(0x74), 30: uint8(0xB4), 31: uint8(0xF4), 32: uint8(0x08), 33: uint8(0x48), 34: uint8(0x88), 35: uint8(0xC8), 36: uint8(0x18), 37: uint8(0x58), 38: uint8(0x98), 39: uint8(0xD8), 40: uint8(0x28), 41: uint8(0x68), 42: uint8(0xA8), 43: uint8(0xE8), 44: uint8(0x38), 45: uint8(0x78), 46: uint8(0xB8), 47: uint8(0xF8), 48: uint8(0x0C), 49: uint8(0x4C), 50: uint8(0x8C), 51: uint8(0xCC), 52: uint8(0x1C), 53: uint8(0x5C), 54: uint8(0x9C), 55: uint8(0xDC), 56: uint8(0x2C), 57: uint8(0x6C), 58: uint8(0xAC), 59: uint8(0xEC), 60: uint8(0x3C), 61: uint8(0x7C), 62: uint8(0xBC), 63: uint8(0xFC), 64: uint8(0x01), 65: uint8(0x41), 66: uint8(0x81), 67: uint8(0xC1), 68: uint8(0x11), 69: uint8(0x51), 70: uint8(0x91), 71: uint8(0xD1), 72: uint8(0x21), 73: uint8(0x61), 74: uint8(0xA1), 75: uint8(0xE1), 76: uint8(0x31), 77: uint8(0x71), 78: uint8(0xB1), 79: uint8(0xF1), 80: uint8(0x05), 81: uint8(0x45), 82: uint8(0x85), 83: uint8(0xC5), 84: uint8(0x15), 85: uint8(0x55), 86: uint8(0x95), 87: uint8(0xD5), 88: uint8(0x25), 89: uint8(0x65), 90: uint8(0xA5), 91: uint8(0xE5), 92: uint8(0x35), 93: uint8(0x75), 94: uint8(0xB5), 95: uint8(0xF5), 96: uint8(0x09), 97: uint8(0x49), 98: uint8(0x89), 99: uint8(0xC9), 100: uint8(0x19), 101: uint8(0x59), 102: uint8(0x99), 103: uint8(0xD9), 104: uint8(0x29), 105: uint8(0x69), 106: uint8(0xA9), 107: uint8(0xE9), 108: uint8(0x39), 109: uint8(0x79), 110: uint8(0xB9), 111: uint8(0xF9), 112: uint8(0x0D), 113: uint8(0x4D), 114: uint8(0x8D), 115: uint8(0xCD), 116: uint8(0x1D), 117: uint8(0x5D), 118: uint8(0x9D), 119: uint8(0xDD), 120: uint8(0x2D), 121: uint8(0x6D), 122: uint8(0xAD), 123: uint8(0xED), 124: uint8(0x3D), 125: uint8(0x7D), 126: uint8(0xBD), 127: uint8(0xFD), 128: uint8(0x02), 129: uint8(0x42), 130: uint8(0x82), 131: uint8(0xC2), 132: uint8(0x12), 133: uint8(0x52), 134: uint8(0x92), 135: uint8(0xD2), 136: uint8(0x22), 137: uint8(0x62), 138: uint8(0xA2), 139: uint8(0xE2), 140: uint8(0x32), 141: uint8(0x72), 142: uint8(0xB2), 143: uint8(0xF2), 144: uint8(0x06), 145: uint8(0x46), 146: uint8(0x86), 147: uint8(0xC6), 148: uint8(0x16), 149: uint8(0x56), 150: uint8(0x96), 151: uint8(0xD6), 152: uint8(0x26), 153: uint8(0x66), 154: uint8(0xA6), 155: uint8(0xE6), 156: uint8(0x36), 157: uint8(0x76), 158: uint8(0xB6), 159: uint8(0xF6), 160: uint8(0x0A), 161: uint8(0x4A), 162: uint8(0x8A), 163: uint8(0xCA), 164: uint8(0x1A), 165: uint8(0x5A), 166: uint8(0x9A), 167: uint8(0xDA), 168: uint8(0x2A), 169: uint8(0x6A), 170: uint8(0xAA), 171: uint8(0xEA), 172: uint8(0x3A), 173: uint8(0x7A), 174: uint8(0xBA), 175: uint8(0xFA), 176: uint8(0x0E), 177: uint8(0x4E), 178: uint8(0x8E), 179: uint8(0xCE), 180: uint8(0x1E), 181: uint8(0x5E), 182: uint8(0x9E), 183: uint8(0xDE), 184: uint8(0x2E), 185: uint8(0x6E), 186: uint8(0xAE), 187: uint8(0xEE), 188: uint8(0x3E), 189: uint8(0x7E), 190: uint8(0xBE), 191: uint8(0xFE), 192: uint8(0x03), 193: uint8(0x43), 194: uint8(0x83), 195: uint8(0xC3), 196: uint8(0x13), 197: uint8(0x53), 198: uint8(0x93), 199: uint8(0xD3), 200: uint8(0x23), 201: uint8(0x63), 202: uint8(0xA3), 203: uint8(0xE3), 204: uint8(0x33), 205: uint8(0x73), 206: uint8(0xB3), 207: uint8(0xF3), 208: uint8(0x07), 209: uint8(0x47), 210: uint8(0x87), 211: uint8(0xC7), 212: uint8(0x17), 213: uint8(0x57), 214: uint8(0x97), 215: uint8(0xD7), 216: uint8(0x27), 217: uint8(0x67), 218: uint8(0xA7), 219: uint8(0xE7), 220: uint8(0x37), 221: uint8(0x77), 222: uint8(0xB7), 223: uint8(0xF7), 224: uint8(0x0B), 225: uint8(0x4B), 226: uint8(0x8B), 227: uint8(0xCB), 228: uint8(0x1B), 229: uint8(0x5B), 230: uint8(0x9B), 231: uint8(0xDB), 232: uint8(0x2B), 233: uint8(0x6B), 234: uint8(0xAB), 235: uint8(0xEB), 236: uint8(0x3B), 237: uint8(0x7B), 238: uint8(0xBB), 239: uint8(0xFB), 240: uint8(0x0F), 241: uint8(0x4F), 242: uint8(0x8F), 243: uint8(0xCF), 244: uint8(0x1F), 245: uint8(0x5F), 246: uint8(0x9F), 247: uint8(0xDF), 248: uint8(0x2F), 249: uint8(0x6F), 250: uint8(0xAF), 251: uint8(0xEF), 252: uint8(0x3F), 253: uint8(0x7F), 254: uint8(0xBF), 255: uint8(0xFF), } var _fourbppswaptable = [256]Tpng_byte{ 1: uint8(0x10), 2: uint8(0x20), 3: uint8(0x30), 4: uint8(0x40), 5: uint8(0x50), 6: uint8(0x60), 7: uint8(0x70), 8: uint8(0x80), 9: uint8(0x90), 10: uint8(0xA0), 11: uint8(0xB0), 12: uint8(0xC0), 13: uint8(0xD0), 14: uint8(0xE0), 15: uint8(0xF0), 16: uint8(0x01), 17: uint8(0x11), 18: uint8(0x21), 19: uint8(0x31), 20: uint8(0x41), 21: uint8(0x51), 22: uint8(0x61), 23: uint8(0x71), 24: uint8(0x81), 25: uint8(0x91), 26: uint8(0xA1), 27: uint8(0xB1), 28: uint8(0xC1), 29: uint8(0xD1), 30: uint8(0xE1), 31: uint8(0xF1), 32: uint8(0x02), 33: uint8(0x12), 34: uint8(0x22), 35: uint8(0x32), 36: uint8(0x42), 37: uint8(0x52), 38: uint8(0x62), 39: uint8(0x72), 40: uint8(0x82), 41: uint8(0x92), 42: uint8(0xA2), 43: uint8(0xB2), 44: uint8(0xC2), 45: uint8(0xD2), 46: uint8(0xE2), 47: uint8(0xF2), 48: uint8(0x03), 49: uint8(0x13), 50: uint8(0x23), 51: uint8(0x33), 52: uint8(0x43), 53: uint8(0x53), 54: uint8(0x63), 55: uint8(0x73), 56: uint8(0x83), 57: uint8(0x93), 58: uint8(0xA3), 59: uint8(0xB3), 60: uint8(0xC3), 61: uint8(0xD3), 62: uint8(0xE3), 63: uint8(0xF3), 64: uint8(0x04), 65: uint8(0x14), 66: uint8(0x24), 67: uint8(0x34), 68: uint8(0x44), 69: uint8(0x54), 70: uint8(0x64), 71: uint8(0x74), 72: uint8(0x84), 73: uint8(0x94), 74: uint8(0xA4), 75: uint8(0xB4), 76: uint8(0xC4), 77: uint8(0xD4), 78: uint8(0xE4), 79: uint8(0xF4), 80: uint8(0x05), 81: uint8(0x15), 82: uint8(0x25), 83: uint8(0x35), 84: uint8(0x45), 85: uint8(0x55), 86: uint8(0x65), 87: uint8(0x75), 88: uint8(0x85), 89: uint8(0x95), 90: uint8(0xA5), 91: uint8(0xB5), 92: uint8(0xC5), 93: uint8(0xD5), 94: uint8(0xE5), 95: uint8(0xF5), 96: uint8(0x06), 97: uint8(0x16), 98: uint8(0x26), 99: uint8(0x36), 100: uint8(0x46), 101: uint8(0x56), 102: uint8(0x66), 103: uint8(0x76), 104: uint8(0x86), 105: uint8(0x96), 106: uint8(0xA6), 107: uint8(0xB6), 108: uint8(0xC6), 109: uint8(0xD6), 110: uint8(0xE6), 111: uint8(0xF6), 112: uint8(0x07), 113: uint8(0x17), 114: uint8(0x27), 115: uint8(0x37), 116: uint8(0x47), 117: uint8(0x57), 118: uint8(0x67), 119: uint8(0x77), 120: uint8(0x87), 121: uint8(0x97), 122: uint8(0xA7), 123: uint8(0xB7), 124: uint8(0xC7), 125: uint8(0xD7), 126: uint8(0xE7), 127: uint8(0xF7), 128: uint8(0x08), 129: uint8(0x18), 130: uint8(0x28), 131: uint8(0x38), 132: uint8(0x48), 133: uint8(0x58), 134: uint8(0x68), 135: uint8(0x78), 136: uint8(0x88), 137: uint8(0x98), 138: uint8(0xA8), 139: uint8(0xB8), 140: uint8(0xC8), 141: uint8(0xD8), 142: uint8(0xE8), 143: uint8(0xF8), 144: uint8(0x09), 145: uint8(0x19), 146: uint8(0x29), 147: uint8(0x39), 148: uint8(0x49), 149: uint8(0x59), 150: uint8(0x69), 151: uint8(0x79), 152: uint8(0x89), 153: uint8(0x99), 154: uint8(0xA9), 155: uint8(0xB9), 156: uint8(0xC9), 157: uint8(0xD9), 158: uint8(0xE9), 159: uint8(0xF9), 160: uint8(0x0A), 161: uint8(0x1A), 162: uint8(0x2A), 163: uint8(0x3A), 164: uint8(0x4A), 165: uint8(0x5A), 166: uint8(0x6A), 167: uint8(0x7A), 168: uint8(0x8A), 169: uint8(0x9A), 170: uint8(0xAA), 171: uint8(0xBA), 172: uint8(0xCA), 173: uint8(0xDA), 174: uint8(0xEA), 175: uint8(0xFA), 176: uint8(0x0B), 177: uint8(0x1B), 178: uint8(0x2B), 179: uint8(0x3B), 180: uint8(0x4B), 181: uint8(0x5B), 182: uint8(0x6B), 183: uint8(0x7B), 184: uint8(0x8B), 185: uint8(0x9B), 186: uint8(0xAB), 187: uint8(0xBB), 188: uint8(0xCB), 189: uint8(0xDB), 190: uint8(0xEB), 191: uint8(0xFB), 192: uint8(0x0C), 193: uint8(0x1C), 194: uint8(0x2C), 195: uint8(0x3C), 196: uint8(0x4C), 197: uint8(0x5C), 198: uint8(0x6C), 199: uint8(0x7C), 200: uint8(0x8C), 201: uint8(0x9C), 202: uint8(0xAC), 203: uint8(0xBC), 204: uint8(0xCC), 205: uint8(0xDC), 206: uint8(0xEC), 207: uint8(0xFC), 208: uint8(0x0D), 209: uint8(0x1D), 210: uint8(0x2D), 211: uint8(0x3D), 212: uint8(0x4D), 213: uint8(0x5D), 214: uint8(0x6D), 215: uint8(0x7D), 216: uint8(0x8D), 217: uint8(0x9D), 218: uint8(0xAD), 219: uint8(0xBD), 220: uint8(0xCD), 221: uint8(0xDD), 222: uint8(0xED), 223: uint8(0xFD), 224: uint8(0x0E), 225: uint8(0x1E), 226: uint8(0x2E), 227: uint8(0x3E), 228: uint8(0x4E), 229: uint8(0x5E), 230: uint8(0x6E), 231: uint8(0x7E), 232: uint8(0x8E), 233: uint8(0x9E), 234: uint8(0xAE), 235: uint8(0xBE), 236: uint8(0xCE), 237: uint8(0xDE), 238: uint8(0xEE), 239: uint8(0xFE), 240: uint8(0x0F), 241: uint8(0x1F), 242: uint8(0x2F), 243: uint8(0x3F), 244: uint8(0x4F), 245: uint8(0x5F), 246: uint8(0x6F), 247: uint8(0x7F), 248: uint8(0x8F), 249: uint8(0x9F), 250: uint8(0xAF), 251: uint8(0xBF), 252: uint8(0xCF), 253: uint8(0xDF), 254: uint8(0xEF), 255: uint8(0xFF), } // C documentation // // /* Swaps pixel packing order within bytes */ func Xpng_do_packswap(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var end, table Tpng_const_bytep var rp Tpng_bytep _, _, _ = end, rp, table if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) < int32(8) { end = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(1) { table = uintptr(unsafe.Pointer(&_onebppswaptable)) } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(2) { table = uintptr(unsafe.Pointer(&_twobppswaptable)) } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(4) { table = uintptr(unsafe.Pointer(&_fourbppswaptable)) } else { return } } } rp = row for { if !(rp < end) { break } *(*Tpng_byte)(unsafe.Pointer(rp)) = *(*Tpng_byte)(unsafe.Pointer(table + uintptr(*(*Tpng_byte)(unsafe.Pointer(rp))))) goto _1 _1: ; rp++ } } } // C documentation // // /* Remove a channel - this used to be 'png_do_strip_filler' but it used a // * somewhat weird combination of flags to determine what to do. All the calls // * to png_do_strip_filler are changed in 1.5.2 to call this instead with the // * correct arguments. // * // * The routine isn't general - the channel must be the channel at the start or // * end (not in the middle) of each pixel. // */ func Xpng_do_strip_channel(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, at_start int32) { var dp, ep, sp, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v3, v4, v5, v6, v7, v8, v9 Tpng_bytep _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, ep, sp, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v3, v4, v5, v6, v7, v8, v9 sp = row /* source pointer */ dp = row /* destination pointer */ ep = row + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) /* One beyond end of row */ /* At the start sp will point to the first byte to copy and dp to where * it is copied to. ep always points just beyond the end of the row, so * the loop simply copies (channels-1) channels until sp reaches ep. * * at_start: 0 -- convert AG, XG, ARGB, XRGB, AAGG, XXGG, etc. * nonzero -- convert GA, GX, RGBA, RGBX, GGAA, RRGGBBXX, etc. */ /* GA, GX, XG cases */ if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) == int32(2) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if at_start != 0 { /* Skip initial filler */ sp++ } else { /* Skip initial channel and, for sp, the filler */ sp += uintptr(2) dp++ } /* For a 1 pixel wide image there is nothing to do */ for sp < ep { v1 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v1)) = *(*Tpng_byte)(unsafe.Pointer(sp)) sp += uintptr(2) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(8) } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { if at_start != 0 { /* Skip initial filler */ sp += uintptr(2) } else { /* Skip initial channel and, for sp, the filler */ sp += uintptr(4) dp += uintptr(2) } for sp < ep { v2 = dp dp++ v3 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v2)) = *(*Tpng_byte)(unsafe.Pointer(v3)) v4 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v4)) = *(*Tpng_byte)(unsafe.Pointer(sp)) sp += uintptr(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(16) } else { return } } /* bad bit depth */ (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(1) /* Finally fix the color type if it records an alpha channel */ if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA) { (*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type = uint8(PNG_COLOR_TYPE_GRAY) } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) == int32(4) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if at_start != 0 { /* Skip initial filler */ sp++ } else { /* Skip initial channels and, for sp, the filler */ sp += uintptr(4) dp += uintptr(3) } /* Note that the loop adds 3 to dp and 4 to sp each time. */ for sp < ep { v5 = dp dp++ v6 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v5)) = *(*Tpng_byte)(unsafe.Pointer(v6)) v7 = dp dp++ v8 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v7)) = *(*Tpng_byte)(unsafe.Pointer(v8)) v9 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v9)) = *(*Tpng_byte)(unsafe.Pointer(sp)) sp += uintptr(2) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(24) } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { if at_start != 0 { /* Skip initial filler */ sp += uintptr(2) } else { /* Skip initial channels and, for sp, the filler */ sp += uintptr(8) dp += uintptr(6) } for sp < ep { /* Copy 6 bytes, skip 2 */ v10 = dp dp++ v11 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v10)) = *(*Tpng_byte)(unsafe.Pointer(v11)) v12 = dp dp++ v13 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v12)) = *(*Tpng_byte)(unsafe.Pointer(v13)) v14 = dp dp++ v15 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v14)) = *(*Tpng_byte)(unsafe.Pointer(v15)) v16 = dp dp++ v17 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v16)) = *(*Tpng_byte)(unsafe.Pointer(v17)) v18 = dp dp++ v19 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v18)) = *(*Tpng_byte)(unsafe.Pointer(v19)) v20 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v20)) = *(*Tpng_byte)(unsafe.Pointer(sp)) sp += uintptr(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(48) } else { return } } /* bad bit depth */ (*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels = uint8(3) /* Finally fix the color type if it records an alpha channel */ if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { (*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type = libc.Uint8FromInt32(libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)) } } else { return } } /* The filler channel has gone already */ /* Fix the rowbytes value. */ (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = libc.Uint32FromInt32(int32(dp) - int32(row)) } // C documentation // // /* Swaps red and blue bytes within a pixel */ func Xpng_do_bgr(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var i, i1, i2, i3, row_width Tpng_uint_32 var rp, rp1, rp2, rp3 Tpng_bytep var save, save1, save2, save3 Tpng_byte _, _, _, _, _, _, _, _, _, _, _, _, _ = i, i1, i2, i3, row_width, rp, rp1, rp2, rp3, save, save1, save2, save3 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) { i = uint32(0) rp = row for { if !(i < row_width) { break } save = *(*Tpng_byte)(unsafe.Pointer(rp)) *(*Tpng_byte)(unsafe.Pointer(rp)) = *(*Tpng_byte)(unsafe.Pointer(rp + libc.UintptrFromInt32(2))) *(*Tpng_byte)(unsafe.Pointer(rp + libc.UintptrFromInt32(2))) = save goto _1 _1: ; i++ rp += uintptr(3) } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { i1 = uint32(0) rp1 = row for { if !(i1 < row_width) { break } save1 = *(*Tpng_byte)(unsafe.Pointer(rp1)) *(*Tpng_byte)(unsafe.Pointer(rp1)) = *(*Tpng_byte)(unsafe.Pointer(rp1 + libc.UintptrFromInt32(2))) *(*Tpng_byte)(unsafe.Pointer(rp1 + libc.UintptrFromInt32(2))) = save1 goto _2 _2: ; i1++ rp1 += uintptr(4) } } } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) { i2 = uint32(0) rp2 = row for { if !(i2 < row_width) { break } save2 = *(*Tpng_byte)(unsafe.Pointer(rp2)) *(*Tpng_byte)(unsafe.Pointer(rp2)) = *(*Tpng_byte)(unsafe.Pointer(rp2 + libc.UintptrFromInt32(4))) *(*Tpng_byte)(unsafe.Pointer(rp2 + libc.UintptrFromInt32(4))) = save2 save2 = *(*Tpng_byte)(unsafe.Pointer(rp2 + libc.UintptrFromInt32(1))) *(*Tpng_byte)(unsafe.Pointer(rp2 + libc.UintptrFromInt32(1))) = *(*Tpng_byte)(unsafe.Pointer(rp2 + libc.UintptrFromInt32(5))) *(*Tpng_byte)(unsafe.Pointer(rp2 + libc.UintptrFromInt32(5))) = save2 goto _3 _3: ; i2++ rp2 += uintptr(6) } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { i3 = uint32(0) rp3 = row for { if !(i3 < row_width) { break } save3 = *(*Tpng_byte)(unsafe.Pointer(rp3)) *(*Tpng_byte)(unsafe.Pointer(rp3)) = *(*Tpng_byte)(unsafe.Pointer(rp3 + libc.UintptrFromInt32(4))) *(*Tpng_byte)(unsafe.Pointer(rp3 + libc.UintptrFromInt32(4))) = save3 save3 = *(*Tpng_byte)(unsafe.Pointer(rp3 + libc.UintptrFromInt32(1))) *(*Tpng_byte)(unsafe.Pointer(rp3 + libc.UintptrFromInt32(1))) = *(*Tpng_byte)(unsafe.Pointer(rp3 + libc.UintptrFromInt32(5))) *(*Tpng_byte)(unsafe.Pointer(rp3 + libc.UintptrFromInt32(5))) = save3 goto _4 _4: ; i3++ rp3 += uintptr(8) } } } } } } } // C documentation // // /* Added at libpng-1.5.10 */ func Xpng_do_check_palette_indexes(tls *libc.TLS, png_ptr Tpng_structrp, row_info Tpng_row_infop) { var i, i1, padding int32 var rp Tpng_bytep _, _, _, _ = i, i1, padding, rp if libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) < int32(1)<<(*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth && libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) > 0 { /* num_palette can be 0 in MNG files */ /* Calculations moved outside switch in an attempt to stop different * compiler warnings. 'padding' is in *bits* within the last byte, it is * an 'int' because pixel_depth becomes an 'int' in the expression below, * and this calculation is used because it avoids warnings that other * forms produced on either GCC or MSVC. */ padding = libc.Int32FromUint32((libc.Uint32FromInt32(8) - uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth)*((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth%libc.Uint32FromInt32(8))%libc.Uint32FromInt32(8)) % libc.Uint32FromInt32(8)) rp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr((*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes) switch libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) { case int32(1): /* in this case, all bytes must be 0 so we don't need * to unpack the pixels except for the rightmost one. */ for { if !(rp > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp)))>>padding != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max = int32(1) } padding = 0 goto _1 _1: ; rp-- } case int32(2): for { if !(rp > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf) { break } i = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) >> padding & int32(0x03) if i > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max = i } i = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) >> padding >> int32(2) & int32(0x03) if i > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max = i } i = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) >> padding >> int32(4) & int32(0x03) if i > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max = i } i = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) >> padding >> int32(6) & int32(0x03) if i > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max = i } padding = 0 goto _2 _2: ; rp-- } case int32(4): for { if !(rp > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf) { break } i1 = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) >> padding & int32(0x0f) if i1 > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max = i1 } i1 = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) >> padding >> int32(4) & int32(0x0f) if i1 > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max = i1 } padding = 0 goto _3 _3: ; rp-- } case int32(8): for { if !(rp > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) > (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) } goto _4 _4: ; rp-- } default: break } } } func Xpng_set_user_transform_info(tls *libc.TLS, png_ptr Tpng_structrp, user_transform_ptr Tpng_voidp, user_transform_depth int32, user_transform_channels int32) { if png_ptr == libc.UintptrFromInt32(0) { return } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x8000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0040) != uint32(0) { Xpng_app_error(tls, png_ptr, __ccgo_ts+18990) return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_ptr = user_transform_ptr (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_depth = libc.Uint8FromInt32(user_transform_depth) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_channels = libc.Uint8FromInt32(user_transform_channels) } // C documentation // // /* This function returns a pointer to the user_transform_ptr associated with // * the user transform functions. The application should free any memory // * associated with this pointer before png_write_destroy and png_read_destroy // * are called. // */ func Xpng_get_user_transform_ptr(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_voidp) { if png_ptr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fuser_transform_ptr } func Xpng_get_current_row_number(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_uint_32) { /* See the comments in png.h - this is the sub-image row when reading an * interlaced image. */ if png_ptr != libc.UintptrFromInt32(0) { return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number } return libc.Uint32FromInt32(-libc.Int32FromInt32(1)) /* help the app not to fail silently */ } func Xpng_get_current_pass_number(tls *libc.TLS, png_ptr Tpng_const_structrp) (r Tpng_byte) { if png_ptr != libc.UintptrFromInt32(0) { return (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass } return uint8(8) /* invalid */ } const PNG_ADD_ALPHA6 = 0x1000000 const PNG_BGR6 = 0x0001 const PNG_FILLER4 = 0x8000 const PNG_FLAG_FILLER_AFTER6 = 0x0080 const PNG_FLAG_ROW_INIT6 = 0x0040 const PNG_INTERLACE6 = 0x0002 const PNG_INVERT_ALPHA4 = 0x80000 const PNG_INVERT_MONO4 = 0x0020 const PNG_IS_READ_STRUCT8 = 0x8000 const PNG_PACK4 = 0x0004 const PNG_PACKSWAP4 = 0x10000 const PNG_SHIFT4 = 0x0008 const PNG_SWAP_ALPHA6 = 0x20000 const PNG_SWAP_BYTES4 = 0x0010 /* Maintainer: Put new private prototypes here ^ */ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. * * png_debug[1-2]?(level, message ,arg{0-2}) * Expands to a statement (either a simple expression or a compound * do..while(0) statement) that outputs a message with parameter * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG * is undefined, 0 or 1 every png_debug expands to a simple expression * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added * to the message. * arg: 0 to 2 arguments for printf(3) style substitution in message. */ /* These settings control the formatting of messages in png.c and pngerror.c */ /* Moved to pngdebug.h at 1.5.0 */ /* Write the data to whatever output you are using. The default routine * writes to a file pointer. Note that this routine sometimes gets called * with very small lengths, so you should implement some kind of simple * buffering if you are using unbuffered writes. This should never be asked * to write more than 64K on a 16-bit machine. */ func Xpng_write_data(tls *libc.TLS, png_ptr Tpng_structrp, data Tpng_const_bytep, length Tsize_t) { /* NOTE: write_data_fn must not change the buffer! */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_data_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_bytep, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_data_fn})))(tls, png_ptr, data, length) } else { Xpng_error(tls, png_ptr, __ccgo_ts+19053) } } // C documentation // // /* This is the function that does the actual writing of data. If you are // * not writing to a standard C stream, you should create a replacement // * write_data function and use it at run time with png_set_write_fn(), rather // * than changing the library. // */ func Xpng_default_write_data(tls *libc.TLS, png_ptr Tpng_structp, data Tpng_bytep, length Tsize_t) { var check Tsize_t _ = check if png_ptr == libc.UintptrFromInt32(0) { return } check = libc.Xfwrite(tls, data, uint32(1), length, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_ptr) if check != length { Xpng_error(tls, png_ptr, __ccgo_ts+19081) } } // C documentation // // /* This function is called to output any data pending writing (normally // * to disk). After png_flush is called, there should be no data pending // * writing in any buffers. // */ func Xpng_flush(tls *libc.TLS, png_ptr Tpng_structrp) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Foutput_flush_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Foutput_flush_fn})))(tls, png_ptr) } } func Xpng_default_flush(tls *libc.TLS, png_ptr Tpng_structp) { var io_ptr Tpng_FILE_p _ = io_ptr if png_ptr == libc.UintptrFromInt32(0) { return } io_ptr = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_ptr libc.Xfflush(tls, io_ptr) } // C documentation // // /* This function allows the application to supply new output functions for // * libpng if standard C streams aren't being used. // * // * This function takes as its arguments: // * png_ptr - pointer to a png output data structure // * io_ptr - pointer to user supplied structure containing info about // * the output functions. May be NULL. // * write_data_fn - pointer to a new output function that takes as its // * arguments a pointer to a png_struct, a pointer to // * data to be written, and a 32-bit unsigned int that is // * the number of bytes to be written. The new write // * function should call png_error(png_ptr, "Error msg") // * to exit and output any fatal error messages. May be // * NULL, in which case libpng's default function will // * be used. // * flush_data_fn - pointer to a new flush function that takes as its // * arguments a pointer to a png_struct. After a call to // * the flush function, there should be no data in any buffers // * or pending transmission. If the output method doesn't do // * any buffering of output, a function prototype must still be // * supplied although it doesn't have to do anything. If // * PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile // * time, output_flush_fn will be ignored, although it must be // * supplied for compatibility. May be NULL, in which case // * libpng's default function will be used, if // * PNG_WRITE_FLUSH_SUPPORTED is defined. This is not // * a good idea if io_ptr does not point to a standard // * *FILE structure. // */ func Xpng_set_write_fn(tls *libc.TLS, png_ptr Tpng_structrp, io_ptr Tpng_voidp, write_data_fn Tpng_rw_ptr, output_flush_fn Tpng_flush_ptr) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_ptr = io_ptr if write_data_fn != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_data_fn = write_data_fn } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_data_fn = __ccgo_fp(Xpng_default_write_data) } if output_flush_fn != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Foutput_flush_fn = output_flush_fn } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Foutput_flush_fn = __ccgo_fp(Xpng_default_flush) } /* It is an error to read while writing a png file */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_data_fn != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fread_data_fn = libc.UintptrFromInt32(0) Xpng_warning(tls, png_ptr, __ccgo_ts+14955) } } const PNG_AFTER_IDAT5 = 8 const PNG_COLORSPACE_FROM_cHRM3 = 16 const PNG_COLORSPACE_FROM_gAMA5 = 8 const PNG_COLORSPACE_INVALID7 = 32768 const PNG_FILTER_AVG1 = 64 const PNG_FILTER_NONE1 = 8 const PNG_FILTER_PAETH1 = 128 const PNG_FILTER_SUB1 = 16 const PNG_FILTER_UP1 = 32 const PNG_FLAG_APP_WARNINGS_WARN7 = 2097152 const PNG_FLAG_MNG_FILTER_645 = 4 const PNG_FLAG_ZLIB_CUSTOM_STRATEGY1 = 1 const PNG_FLAG_ZSTREAM_INITIALIZED3 = 2 const PNG_FORMAT_FLAG_AFIRST3 = 32 const PNG_FORMAT_FLAG_ALPHA3 = 1 const PNG_FORMAT_FLAG_BGR3 = 16 const PNG_FORMAT_FLAG_COLOR3 = 2 const PNG_FORMAT_FLAG_COLORMAP3 = 8 const PNG_FORMAT_FLAG_LINEAR3 = 4 const PNG_HAVE_IDAT5 = 4 const PNG_HAVE_IHDR5 = 1 const PNG_HAVE_PLTE5 = 2 const PNG_HAVE_PNG_SIGNATURE5 = 4096 const PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB3 = 1 const PNG_IMAGE_FLAG_FAST1 = 2 const PNG_INFO_IDAT7 = 32768 const PNG_INFO_PLTE7 = 8 const PNG_INFO_bKGD5 = 32 const PNG_INFO_cHRM5 = 4 const PNG_INFO_eXIf7 = 65536 const PNG_INFO_gAMA5 = 1 const PNG_INFO_hIST7 = 64 const PNG_INFO_iCCP7 = 4096 const PNG_INFO_oFFs5 = 256 const PNG_INFO_pCAL7 = 1024 const PNG_INFO_pHYs5 = 128 const PNG_INFO_sBIT7 = 2 const PNG_INFO_sCAL7 = 16384 const PNG_INFO_sPLT5 = 8192 const PNG_INFO_sRGB5 = 2048 const PNG_INFO_tIME5 = 512 const PNG_INFO_tRNS7 = 16 const PNG_INTERLACE7 = 2 const PNG_INVERT_ALPHA5 = 524288 const PNG_NO_FILTERS1 = 0 const PNG_TRANSFORM_BGR3 = 128 const PNG_TRANSFORM_INVERT_ALPHA3 = 1024 const PNG_TRANSFORM_INVERT_MONO3 = 32 const PNG_TRANSFORM_PACKING3 = 4 const PNG_TRANSFORM_PACKSWAP3 = 8 const PNG_TRANSFORM_SHIFT3 = 64 const PNG_TRANSFORM_STRIP_FILLER1 = 2048 const PNG_TRANSFORM_STRIP_FILLER_AFTER1 = 4096 const PNG_TRANSFORM_SWAP_ALPHA3 = 256 const PNG_TRANSFORM_SWAP_ENDIAN3 = 512 const PNG_USER_TRANSFORM3 = 1048576 const PNG_WROTE_INFO_BEFORE_PLTE1 = 1024 const PNG_WROTE_eXIf3 = 16384 const PNG_WROTE_tIME3 = 512 // C documentation // // /* Write out all the unknown chunks for the current given location */ func _write_unknown_chunks(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_const_inforp, where uint32) { var keep int32 var up Tpng_const_unknown_chunkp _, _ = keep, up if (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks_num != 0 { up = (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks for { if !(up < (*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks+uintptr((*Tpng_info)(unsafe.Pointer(info_ptr)).Funknown_chunks_num)*20) { break } if uint32((*Tpng_unknown_chunk)(unsafe.Pointer(up)).Flocation)&where != uint32(0) { /* If per-chunk unknown chunk handling is enabled use it, otherwise * just write the chunks the application has set. */ keep = Xpng_handle_as_unknown(tls, png_ptr, up) /* NOTE: this code is radically different from the read side in the * matter of handling an ancillary unknown chunk. In the read side * the default behavior is to discard it, in the code below the default * behavior is to write it. Critical chunks are, however, only * written if explicitly listed or if the default is set to write all * unknown chunks. * * The default handling is also slightly weird - it is not possible to * stop the writing of all unsafe-to-copy chunks! * * TODO: REVIEW: this would seem to be a bug. */ if keep != int32(PNG_HANDLE_CHUNK_NEVER) && (libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(up + 3)))&int32(0x20) != 0 || keep == int32(PNG_HANDLE_CHUNK_ALWAYS) || keep == PNG_HANDLE_CHUNK_AS_DEFAULT && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Funknown_default == int32(PNG_HANDLE_CHUNK_ALWAYS)) { /* TODO: review, what is wrong with a zero length unknown chunk? */ if (*Tpng_unknown_chunk)(unsafe.Pointer(up)).Fsize == uint32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+19093) } Xpng_write_chunk(tls, png_ptr, up, (*Tpng_unknown_chunk)(unsafe.Pointer(up)).Fdata, (*Tpng_unknown_chunk)(unsafe.Pointer(up)).Fsize) } } goto _1 _1: ; up += 20 } } } // C documentation // // /* Writes all the PNG information. This is the suggested way to use the // * library. If you have a new chunk to add, make a function to write it, // * and put it in the correct location here. If you want the chunk written // * after the image data, put it in png_write_end(). I strongly encourage // * you to supply a PNG_INFO_ flag, and check info_ptr->valid before // * writing the chunk, as that will keep the code from breaking if you want // * to just write a plain PNG file. If you have long comments, I suggest // * writing them in png_write_end(), and compressing them. // */ func Xpng_write_info_before_PLTE(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_const_inforp) { if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x400) == uint32(0) { /* Write PNG signature */ Xpng_write_sig(tls, png_ptr) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x1000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted != uint32(0) { Xpng_warning(tls, png_ptr, __ccgo_ts+11937) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted = uint32(0) } /* Write IHDR information. */ Xpng_write_IHDR(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fwidth, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fheight, libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fbit_depth), libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type), libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcompression_type), libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Ffilter_type), libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Finterlace_type)) /* The rest of these check to see if the valid field has the appropriate * flag set, and if it does, writes the chunk. * * 1.6.0: COLORSPACE support controls the writing of these chunks too, and * the chunks will be written if the WRITE routine is there and * information * is available in the COLORSPACE. (See * png_colorspace_sync_info in png.c for where the valid flags get set.) * * Under certain circumstances the colorspace can be invalidated without * syncing the info_struct 'valid' flags; this happens if libpng detects * an error and calls png_error while the color space is being set, yet * the application continues writing the PNG. So check the 'invalid' * flag here too. */ if libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_INVALID7) == 0 && libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_FROM_gAMA5) != 0 && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0001) != uint32(0) { Xpng_write_gAMA_fixed(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fgamma) } /* Write only one of sRGB or an ICC profile. If a profile was supplied * and it matches one of the known sRGB ones issue a warning. */ if libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_INVALID7) == 0 && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x1000) != uint32(0) { if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0800) != uint32(0) { Xpng_app_warning(tls, png_ptr, __ccgo_ts+19127) } Xpng_write_iCCP(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_name, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ficcp_profile) } else { if libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_INVALID7) == 0 && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0800) != uint32(0) { Xpng_write_sRGB(tls, png_ptr, libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Frendering_intent)) } } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0002) != uint32(0) { Xpng_write_sBIT(tls, png_ptr, info_ptr+148, libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type)) } if libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_INVALID7) == 0 && libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolorspace.Fflags)&int32(PNG_COLORSPACE_FROM_cHRM3) != 0 && (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0004) != uint32(0) { Xpng_write_cHRM_fixed(tls, png_ptr, info_ptr+40+4) } _write_unknown_chunks(tls, png_ptr, info_ptr, uint32(PNG_HAVE_IHDR5)) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(0x400) } } func Xpng_write_info(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_const_inforp) { var i, j, jend int32 _, _, _ = i, j, jend if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } Xpng_write_info_before_PLTE(tls, png_ptr, info_ptr) if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0008) != uint32(0) { Xpng_write_PLTE(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpalette, uint32((*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_palette)) } else { if libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { Xpng_error(tls, png_ptr, __ccgo_ts+19173) } } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0010) != uint32(0) { /* Invert the alpha channel (in tRNS) */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x80000) != uint32(0) && libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { jend = libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_trans) if jend > int32(PNG_MAX_PALETTE_LENGTH) { jend = int32(PNG_MAX_PALETTE_LENGTH) } j = 0 for { if !(j < jend) { break } *(*Tpng_byte)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftrans_alpha + uintptr(j))) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftrans_alpha + uintptr(j))))) goto _1 _1: ; j++ } } Xpng_write_tRNS(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Ftrans_alpha, info_ptr+160, libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_trans), libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type)) } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0020) != uint32(0) { Xpng_write_bKGD(tls, png_ptr, info_ptr+170, libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fcolor_type)) } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x10000) != uint32(0) { Xpng_write_eXIf(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fexif, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_exif) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(0x4000) } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0040) != uint32(0) { Xpng_write_hIST(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fhist, libc.Int32FromUint16((*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_palette)) } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0100) != uint32(0) { Xpng_write_oFFs(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_offset, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_offset, libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Foffset_unit_type)) } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0400) != uint32(0) { Xpng_write_pCAL(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_purpose, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_X0, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_X1, libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_type), libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_nparams), (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_units, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fpcal_params) } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x4000) != uint32(0) { Xpng_write_sCAL_s(tls, png_ptr, libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_unit), (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_width, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fscal_s_height) } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0080) != uint32(0) { Xpng_write_pHYs(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fx_pixels_per_unit, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fy_pixels_per_unit, libc.Int32FromUint8((*Tpng_info)(unsafe.Pointer(info_ptr)).Fphys_unit_type)) } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0200) != uint32(0) { Xpng_write_tIME(tls, png_ptr, info_ptr+140) *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(0x200) } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x2000) != uint32(0) { i = 0 for { if !(i < (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes_num) { break } Xpng_write_sPLT(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fsplt_palettes+uintptr(i)*16) goto _2 _2: ; i++ } } /* Check to see if we need to write text chunks */ i = 0 for { if !(i < (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_text) { break } /* An internationalized chunk? */ if (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression > 0 { /* Write international chunk */ Xpng_write_iTXt(tls, png_ptr, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fkey, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Flang, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Flang_key, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Ftext) /* Mark this chunk as written */ if (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression == -int32(1) { (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression = -int32(3) } else { (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression = -int32(2) } } else { if (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression == PNG_TEXT_COMPRESSION_zTXt { /* Write compressed chunk */ Xpng_write_zTXt(tls, png_ptr, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fkey, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Ftext, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression) /* Mark this chunk as written */ (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression = -int32(2) } else { if (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression == -int32(1) { /* Write uncompressed chunk */ Xpng_write_tEXt(tls, png_ptr, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fkey, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Ftext, uint32(0)) /* Mark this chunk as written */ (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression = -int32(3) } } } goto _3 _3: ; i++ } _write_unknown_chunks(tls, png_ptr, info_ptr, uint32(PNG_HAVE_PLTE5)) } // C documentation // // /* Writes the end of the PNG file. If you don't want to write comments or // * time information, you can pass NULL for info. If you already wrote these // * in png_write_info(), do not write them again here. If you have long // * comments, I suggest writing them here, and compressing them. // */ func Xpng_write_end(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp) { var i int32 _ = i if png_ptr == libc.UintptrFromInt32(0) { return } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) == uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+19216) } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max >= libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) { Xpng_benign_error(tls, png_ptr, __ccgo_ts+19243) } /* See if user wants us to write information chunks */ if info_ptr != libc.UintptrFromInt32(0) { /* local index variable */ /* Check to see if user has supplied a time chunk */ if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0200) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x200) == uint32(0) { Xpng_write_tIME(tls, png_ptr, info_ptr+140) } /* Loop through comment chunks */ i = 0 for { if !(i < (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_text) { break } /* An internationalized chunk? */ if (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression > 0 { /* Write international chunk */ Xpng_write_iTXt(tls, png_ptr, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fkey, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Flang, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Flang_key, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Ftext) /* Mark this chunk as written */ if (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression == -int32(1) { (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression = -int32(3) } else { (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression = -int32(2) } } else { if (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression >= PNG_TEXT_COMPRESSION_zTXt { /* Write compressed chunk */ Xpng_write_zTXt(tls, png_ptr, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fkey, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Ftext, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression) /* Mark this chunk as written */ (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression = -int32(2) } else { if (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression == -int32(1) { /* Write uncompressed chunk */ Xpng_write_tEXt(tls, png_ptr, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fkey, (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Ftext, uint32(0)) /* Mark this chunk as written */ (*(*Tpng_text)(unsafe.Pointer((*Tpng_info)(unsafe.Pointer(info_ptr)).Ftext + uintptr(i)*28))).Fcompression = -int32(3) } } } goto _1 _1: ; i++ } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x10000) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x4000) == uint32(0) { Xpng_write_eXIf(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fexif, (*Tpng_info)(unsafe.Pointer(info_ptr)).Fnum_exif) } _write_unknown_chunks(tls, png_ptr, info_ptr, uint32(PNG_AFTER_IDAT5)) } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(PNG_AFTER_IDAT5) /* Write end of PNG file */ Xpng_write_IEND(tls, png_ptr) /* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03, * and restored again in libpng-1.2.30, may cause some applications that * do not set png_ptr->output_flush_fn to crash. If your application * experiences a problem, please try building libpng with * PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED defined, and report the event to * png-mng-implement at lists.sf.net . */ } func Xpng_convert_from_struct_tm(tls *libc.TLS, ptime Tpng_timep, ttime uintptr) { (*Tpng_time)(unsafe.Pointer(ptime)).Fyear = libc.Uint16FromInt32(libc.Int32FromInt32(1900) + (*Ttm)(unsafe.Pointer(ttime)).Ftm_year) (*Tpng_time)(unsafe.Pointer(ptime)).Fmonth = libc.Uint8FromInt32((*Ttm)(unsafe.Pointer(ttime)).Ftm_mon + libc.Int32FromInt32(1)) (*Tpng_time)(unsafe.Pointer(ptime)).Fday = libc.Uint8FromInt32((*Ttm)(unsafe.Pointer(ttime)).Ftm_mday) (*Tpng_time)(unsafe.Pointer(ptime)).Fhour = libc.Uint8FromInt32((*Ttm)(unsafe.Pointer(ttime)).Ftm_hour) (*Tpng_time)(unsafe.Pointer(ptime)).Fminute = libc.Uint8FromInt32((*Ttm)(unsafe.Pointer(ttime)).Ftm_min) (*Tpng_time)(unsafe.Pointer(ptime)).Fsecond = libc.Uint8FromInt32((*Ttm)(unsafe.Pointer(ttime)).Ftm_sec) } func Xpng_convert_from_time_t(tls *libc.TLS, ptime Tpng_timep, _ttime Ttime_t) { bp := tls.Alloc(16) defer tls.Free(16) *(*Ttime_t)(unsafe.Pointer(bp)) = _ttime var tbuf uintptr _ = tbuf tbuf = libc.Xgmtime(tls, bp) if tbuf == libc.UintptrFromInt32(0) { /* TODO: add a safe function which takes a png_ptr argument and raises * a png_error if the ttime argument is invalid and the call to gmtime * fails as a consequence. */ libc.Xmemset(tls, ptime, 0, uint32(8)) return } Xpng_convert_from_struct_tm(tls, ptime, tbuf) } // C documentation // // /* Initialize png_ptr structure, and allocate any memory needed */ func Xpng_create_write_struct(tls *libc.TLS, user_png_ver Tpng_const_charp, error_ptr Tpng_voidp, error_fn Tpng_error_ptr, warn_fn Tpng_error_ptr) (r Tpng_structp) { return Xpng_create_write_struct_2(tls, user_png_ver, error_ptr, error_fn, warn_fn, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0)) } // C documentation // // /* Alternate initialize png_ptr structure, and allocate any memory needed */ func Xpng_create_write_struct_2(tls *libc.TLS, user_png_ver Tpng_const_charp, error_ptr Tpng_voidp, error_fn Tpng_error_ptr, warn_fn Tpng_error_ptr, mem_ptr Tpng_voidp, malloc_fn Tpng_malloc_ptr, free_fn Tpng_free_ptr) (r Tpng_structp) { var png_ptr Tpng_structrp _ = png_ptr png_ptr = Xpng_create_png_struct(tls, user_png_ver, error_ptr, error_fn, warn_fn, mem_ptr, malloc_fn, free_fn) if png_ptr != libc.UintptrFromInt32(0) { /* Set the zlib control values to defaults; they can be overridden by the * application after the struct has been created. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_size = uint32(PNG_ZBUF_SIZE) /* The 'zlib_strategy' setting is irrelevant because png_default_claim in * pngwutil.c defaults it according to whether or not filters will be * used, and ignores this setting. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_strategy = int32(PNG_Z_DEFAULT_STRATEGY) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_level = -int32(1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_mem_level = int32(8) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_window_bits = int32(15) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_method = int32(8) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_text_level = -int32(1) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_text_mem_level = int32(8) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_text_window_bits = int32(15) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_text_method = int32(8) /* This is a highly dubious configuration option; by default it is off, * but it may be appropriate for private builds that are testing * extensions not conformant to the current specification, or of * applications that must not fail to write at all costs! */ /* App warnings are warnings in release (or release candidate) builds but * are errors during development. */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x200000) /* TODO: delay this, it can be done in png_init_io() (if the app doesn't * do it itself) avoiding setting the default function if it is not * required. */ Xpng_set_write_fn(tls, png_ptr, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0)) } return png_ptr } // C documentation // // /* Write a few rows of image data. If the image is interlaced, // * either you will have to write the 7 sub images, or, if you // * have called png_set_interlace_handling(), you will have to // * "write" the image seven times. // */ func Xpng_write_rows(tls *libc.TLS, png_ptr Tpng_structrp, row Tpng_bytepp, num_rows Tpng_uint_32) { var i Tpng_uint_32 var rp Tpng_bytepp _, _ = i, rp /* row pointer */ if png_ptr == libc.UintptrFromInt32(0) { return } /* Loop through the rows */ i = uint32(0) rp = row for { if !(i < num_rows) { break } Xpng_write_row(tls, png_ptr, *(*uintptr)(unsafe.Pointer(rp))) goto _1 _1: ; i++ rp += 4 } } // C documentation // // /* Write the image. You only need to call this function once, even // * if you are writing an interlaced image. // */ func Xpng_write_image(tls *libc.TLS, png_ptr Tpng_structrp, image Tpng_bytepp) { var i Tpng_uint_32 var num_pass, pass int32 var rp Tpng_bytepp _, _, _, _ = i, num_pass, pass, rp /* points to current row */ if png_ptr == libc.UintptrFromInt32(0) { return } /* Initialize interlace handling. If image is not interlaced, * this will set pass to 1 */ num_pass = Xpng_set_interlace_handling(tls, png_ptr) /* Loop through passes */ pass = 0 for { if !(pass < num_pass) { break } /* Loop through image */ i = uint32(0) rp = image for { if !(i < (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight) { break } Xpng_write_row(tls, png_ptr, *(*uintptr)(unsafe.Pointer(rp))) goto _2 _2: ; i++ rp += 4 } goto _1 _1: ; pass++ } } // C documentation // // /* Performs intrapixel differencing */ func _png_do_write_intrapixel(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var blue, i, i1, red, row_width, s0, s1, s2 Tpng_uint_32 var bytes_per_pixel int32 var rp, rp1 Tpng_bytep _, _, _, _, _, _, _, _, _, _, _ = blue, bytes_per_pixel, i, i1, red, row_width, rp, rp1, s0, s1, s2 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) { bytes_per_pixel = int32(3) } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { bytes_per_pixel = int32(4) } else { return } } i = uint32(0) rp = row for { if !(i < row_width) { break } *(*Tpng_byte)(unsafe.Pointer(rp)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp + libc.UintptrFromInt32(1))))) *(*Tpng_byte)(unsafe.Pointer(rp + libc.UintptrFromInt32(2))) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp + libc.UintptrFromInt32(2)))) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp + libc.UintptrFromInt32(1))))) goto _1 _1: ; i++ rp += uintptr(bytes_per_pixel) } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(16) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_COLOR) { bytes_per_pixel = int32(6) } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { bytes_per_pixel = int32(8) } else { return } } i1 = uint32(0) rp1 = row for { if !(i1 < row_width) { break } s0 = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp1)))<> libc.Int32FromInt32(8)) *(*Tpng_byte)(unsafe.Pointer(rp1 + libc.UintptrFromInt32(1))) = uint8(red) *(*Tpng_byte)(unsafe.Pointer(rp1 + libc.UintptrFromInt32(4))) = uint8(blue >> libc.Int32FromInt32(8)) *(*Tpng_byte)(unsafe.Pointer(rp1 + libc.UintptrFromInt32(5))) = uint8(blue) goto _2 _2: ; i1++ rp1 += uintptr(bytes_per_pixel) } } } } } // C documentation // // /* Called by user to write a row of image data */ func Xpng_write_row(tls *libc.TLS, png_ptr Tpng_structrp, row Tpng_const_bytep) { bp := tls.Alloc(16) defer tls.Free(16) var v1 uint32 var _ /* row_info at bp+0 */ Tpng_row_info _ = v1 if png_ptr == libc.UintptrFromInt32(0) { return } /* Initialize transformations and other stuff if first time */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number == uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) == 0 { /* Make sure we wrote the header info */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x400) == uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+19285) } /* Check for transforms that have been set but were defined out */ Xpng_write_start_row(tls, png_ptr) } /* If interlaced and not interested in row, return */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) != uint32(0) { switch libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) { case 0: if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(0x07) != uint32(0) { Xpng_write_finish_row(tls, png_ptr) return } case int32(1): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(0x07) != uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth < uint32(5) { Xpng_write_finish_row(tls, png_ptr) return } case int32(2): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(0x07) != uint32(4) { Xpng_write_finish_row(tls, png_ptr) return } case int32(3): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(0x03) != uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth < uint32(3) { Xpng_write_finish_row(tls, png_ptr) return } case int32(4): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(0x03) != uint32(2) { Xpng_write_finish_row(tls, png_ptr) return } case int32(5): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(0x01) != uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth < uint32(2) { Xpng_write_finish_row(tls, png_ptr) return } case int32(6): if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number&uint32(0x01) == uint32(0) { Xpng_write_finish_row(tls, png_ptr) return } default: /* error: ignore it */ break } } /* Set up row info for transformations */ (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fcolor_type = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fwidth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_width (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fchannels = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_channels (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fbit_depth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_bit_depth (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth = libc.Uint8FromInt32(libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fbit_depth) * libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fchannels)) if libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) >= int32(8) { v1 = (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fwidth * (uint32((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v1 = ((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fwidth*uint32((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) + uint32(7)) >> int32(3) } (*(*Tpng_row_info)(unsafe.Pointer(bp))).Frowbytes = v1 /* Copy user's row into buffer, leaving room for filter byte. */ libc.Xmemcpy(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), row, (*(*Tpng_row_info)(unsafe.Pointer(bp))).Frowbytes) /* Handle interlacing */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced != 0 && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) < int32(6) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) != uint32(0) { Xpng_do_write_interlace(tls, bp, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass)) /* This should always get caught above, but still ... */ if (*(*Tpng_row_info)(unsafe.Pointer(bp))).Fwidth == uint32(0) { Xpng_write_finish_row(tls, png_ptr) return } } /* Handle other transformations */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations != uint32(0) { Xpng_do_write_transformations(tls, png_ptr, bp) } /* At this point the row_info pixel depth must match the 'transformed' depth, * which is also the output depth. */ if libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) != libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) || libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fpixel_depth) != libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformed_pixel_depth) { Xpng_error(tls, png_ptr, __ccgo_ts+19338) } /* Write filter_method 64 (intrapixel differencing) only if * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and * 2. Libpng did not write a PNG signature (this filter_method is only * used in PNG datastreams that are embedded in MNG datastreams) and * 3. The application called png_permit_mng_features with a mask that * included PNG_FLAG_MNG_FILTER_64 and * 4. The filter_method is 64 and * 5. The color_type is RGB or RGBA */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted&uint32(PNG_FLAG_MNG_FILTER_645) != uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ffilter_type) == int32(PNG_INTRAPIXEL_DIFFERENCING) { /* Intrapixel differencing */ _png_do_write_intrapixel(tls, bp, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } /* Added at libpng-1.5.10 */ /* Check for out-of-range palette index */ if libc.Int32FromUint8((*(*Tpng_row_info)(unsafe.Pointer(bp))).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette_max >= 0 { Xpng_do_check_palette_indexes(tls, png_ptr, bp) } /* Find a filter if necessary, filter the row and write it out. */ Xpng_write_find_filter(tls, png_ptr, bp) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_row_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_uint_32, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_row_fn})))(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number, libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass)) } } // C documentation // // /* Set the automatic flush interval or 0 to turn flushing off */ func Xpng_set_flush(tls *libc.TLS, png_ptr Tpng_structrp, nrows int32) { var v1 uint32 _ = v1 if png_ptr == libc.UintptrFromInt32(0) { return } if nrows < 0 { v1 = uint32(0) } else { v1 = libc.Uint32FromInt32(nrows) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflush_dist = v1 } // C documentation // // /* Flush the current output buffers now */ func Xpng_write_flush(tls *libc.TLS, png_ptr Tpng_structrp) { if png_ptr == libc.UintptrFromInt32(0) { return } /* We have already written out all of the data */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number >= (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows { return } Xpng_compress_IDAT(tls, png_ptr, libc.UintptrFromInt32(0), uint32(0), int32(Z_SYNC_FLUSH)) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflush_rows = uint32(0) Xpng_flush(tls, png_ptr) } // C documentation // // /* Free any memory used in png_ptr struct without freeing the struct itself. */ func _png_write_destroy(tls *libc.TLS, png_ptr Tpng_structrp) { /* Free any memory zlib uses */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0002) != uint32(0) { (*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflateEndPtr})))(tls, png_ptr+460) } /* Free our memory. png_free checks NULL for us. */ Xpng_free_buffer_list(tls, png_ptr, png_ptr+516) Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf = libc.UintptrFromInt32(0) Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row) Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row) Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row = libc.UintptrFromInt32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row = libc.UintptrFromInt32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row = libc.UintptrFromInt32(0) Xpng_free(tls, png_ptr, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_list = libc.UintptrFromInt32(0) /* The error handling and memory handling information is left intact at this * point: the jmp_buf may still have to be freed. See png_destroy_png_struct * for how this happens. */ } // C documentation // // /* Free all memory used by the write. // * In libpng 1.6.0 this API changed quietly to no longer accept a NULL value for // * *png_ptr_ptr. Prior to 1.6.0 it would accept such a value and it would free // * the passed in info_structs but it would quietly fail to free any of the data // * inside them. In 1.6.0 it quietly does nothing (it has to be quiet because it // * has no png_ptr.) // */ func Xpng_destroy_write_struct(tls *libc.TLS, png_ptr_ptr Tpng_structpp, info_ptr_ptr Tpng_infopp) { var png_ptr Tpng_structrp _ = png_ptr if png_ptr_ptr != libc.UintptrFromInt32(0) { png_ptr = *(*uintptr)(unsafe.Pointer(png_ptr_ptr)) if png_ptr != libc.UintptrFromInt32(0) { /* added in libpng 1.6.0 */ Xpng_destroy_info_struct(tls, png_ptr, info_ptr_ptr) *(*uintptr)(unsafe.Pointer(png_ptr_ptr)) = libc.UintptrFromInt32(0) _png_write_destroy(tls, png_ptr) Xpng_destroy_png_struct(tls, png_ptr) } } } // C documentation // // /* Allow the application to select one or more row filters to use. */ func Xpng_set_filter(tls *libc.TLS, png_ptr Tpng_structrp, method int32, filters int32) { var buf_size Tpng_alloc_size_t var num_filters int32 var v1 uint32 _, _, _ = buf_size, num_filters, v1 if png_ptr == libc.UintptrFromInt32(0) { return } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted&uint32(PNG_FLAG_MNG_FILTER_645) != uint32(0) && method == int32(PNG_INTRAPIXEL_DIFFERENCING) { method = PNG_FILTER_TYPE_BASE } if method == PNG_FILTER_TYPE_BASE { switch filters & (libc.Int32FromInt32(PNG_FILTER_NONE1) | libc.Int32FromInt32(PNG_FILTER_SUB1) | libc.Int32FromInt32(PNG_FILTER_UP1) | libc.Int32FromInt32(PNG_FILTER_AVG1) | libc.Int32FromInt32(PNG_FILTER_PAETH1) | libc.Int32FromInt32(0x07)) { case int32(5): fallthrough case int32(6): fallthrough case int32(7): Xpng_app_error(tls, png_ptr, __ccgo_ts+19375) /* FALLTHROUGH */ fallthrough case PNG_FILTER_VALUE_NONE: (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fdo_filter = uint8(PNG_FILTER_NONE1) case int32(PNG_FILTER_VALUE_SUB): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fdo_filter = uint8(PNG_FILTER_SUB1) case int32(PNG_FILTER_VALUE_UP): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fdo_filter = uint8(PNG_FILTER_UP1) case int32(PNG_FILTER_VALUE_AVG): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fdo_filter = uint8(PNG_FILTER_AVG1) case int32(PNG_FILTER_VALUE_PAETH): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fdo_filter = uint8(PNG_FILTER_PAETH1) default: (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fdo_filter = libc.Uint8FromInt32(filters) break } /* If we have allocated the row_buf, this means we have already started * with the image and we should have allocated all of the filter buffers * that have been selected. If prev_row isn't already allocated, then * it is too late to start using the filters that need it, since we * will be missing the data in the previous row. If an application * wants to start and stop using particular filters during compression, * it should start out with all of the filters, and then remove them * or add them back after the start of compression. * * NOTE: this is a nasty constraint on the code, because it means that the * prev_row buffer must be maintained even if there are currently no * 'prev_row' requiring filters active. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf != libc.UintptrFromInt32(0) { /* Repeat the checks in png_write_start_row; 1 pixel high or wide * images cannot benefit from certain filters. If this isn't done here * the check below will fire on 1 pixel high images. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight == uint32(1) { filters &= ^(libc.Int32FromInt32(PNG_FILTER_UP1) | libc.Int32FromInt32(PNG_FILTER_AVG1) | libc.Int32FromInt32(PNG_FILTER_PAETH1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth == uint32(1) { filters &= ^(libc.Int32FromInt32(PNG_FILTER_SUB1) | libc.Int32FromInt32(PNG_FILTER_AVG1) | libc.Int32FromInt32(PNG_FILTER_PAETH1)) } if filters&(libc.Int32FromInt32(PNG_FILTER_UP1)|libc.Int32FromInt32(PNG_FILTER_AVG1)|libc.Int32FromInt32(PNG_FILTER_PAETH1)) != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row == libc.UintptrFromInt32(0) { /* This is the error case, however it is benign - the previous row * is not available so the filter can't be used. Just warn here. */ Xpng_app_warning(tls, png_ptr, __ccgo_ts+19407) filters &= ^(libc.Int32FromInt32(PNG_FILTER_UP1) | libc.Int32FromInt32(PNG_FILTER_AVG1) | libc.Int32FromInt32(PNG_FILTER_PAETH1)) } num_filters = 0 if filters&int32(PNG_FILTER_SUB1) != 0 { num_filters++ } if filters&int32(PNG_FILTER_UP1) != 0 { num_filters++ } if filters&int32(PNG_FILTER_AVG1) != 0 { num_filters++ } if filters&int32(PNG_FILTER_PAETH1) != 0 { num_filters++ } /* Allocate needed row buffers if they have not already been * allocated. */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_channels)*libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_bit_depth) >= int32(8) { v1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth * (libc.Uint32FromInt32(libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_channels)*libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_bit_depth)) >> libc.Int32FromInt32(3)) } else { v1 = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth*libc.Uint32FromInt32(libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_channels)*libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_bit_depth)) + uint32(7)) >> int32(3) } buf_size = v1 + uint32(1) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row == libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row = Xpng_malloc(tls, png_ptr, buf_size) } if num_filters > int32(1) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row == libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row = Xpng_malloc(tls, png_ptr, buf_size) } } } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fdo_filter = libc.Uint8FromInt32(filters) } else { Xpng_error(tls, png_ptr, __ccgo_ts+19464) } } // C documentation // // /* Provide floating and fixed point APIs */ func Xpng_set_filter_heuristics(tls *libc.TLS, png_ptr Tpng_structrp, heuristic_method int32, num_weights int32, filter_weights Tpng_const_doublep, filter_costs Tpng_const_doublep) { _ = png_ptr _ = heuristic_method _ = num_weights _ = filter_weights _ = filter_costs } func Xpng_set_filter_heuristics_fixed(tls *libc.TLS, png_ptr Tpng_structrp, heuristic_method int32, num_weights int32, filter_weights Tpng_const_fixed_point_p, filter_costs Tpng_const_fixed_point_p) { _ = png_ptr _ = heuristic_method _ = num_weights _ = filter_weights _ = filter_costs } func Xpng_set_compression_level(tls *libc.TLS, png_ptr Tpng_structrp, level int32) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_level = level } func Xpng_set_compression_mem_level(tls *libc.TLS, png_ptr Tpng_structrp, mem_level int32) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_mem_level = mem_level } func Xpng_set_compression_strategy(tls *libc.TLS, png_ptr Tpng_structrp, strategy int32) { if png_ptr == libc.UintptrFromInt32(0) { return } /* The flag setting here prevents the libpng dynamic selection of strategy. */ *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0001) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_strategy = strategy } // C documentation // // /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a // * smaller value of window_bits if it can do so safely. // */ func Xpng_set_compression_window_bits(tls *libc.TLS, png_ptr Tpng_structrp, window_bits int32) { if png_ptr == libc.UintptrFromInt32(0) { return } /* Prior to 1.6.0 this would warn but then set the window_bits value. This * meant that negative window bits values could be selected that would cause * libpng to write a non-standard PNG file with raw deflate or gzip * compressed IDAT or ancillary chunks. Such files can be read and there is * no warning on read, so this seems like a very bad idea. */ if window_bits > int32(15) { Xpng_warning(tls, png_ptr, __ccgo_ts+19493) window_bits = int32(15) } else { if window_bits < int32(8) { Xpng_warning(tls, png_ptr, __ccgo_ts+19542) window_bits = int32(8) } } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_window_bits = window_bits } func Xpng_set_compression_method(tls *libc.TLS, png_ptr Tpng_structrp, method int32) { if png_ptr == libc.UintptrFromInt32(0) { return } /* This would produce an invalid PNG file if it worked, but it doesn't and * deflate will fault it, so it is harmless to just warn here. */ if method != int32(8) { Xpng_warning(tls, png_ptr, __ccgo_ts+19591) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_method = method } // C documentation // // /* The following were added to libpng-1.5.4 */ func Xpng_set_text_compression_level(tls *libc.TLS, png_ptr Tpng_structrp, level int32) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_text_level = level } func Xpng_set_text_compression_mem_level(tls *libc.TLS, png_ptr Tpng_structrp, mem_level int32) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_text_mem_level = mem_level } func Xpng_set_text_compression_strategy(tls *libc.TLS, png_ptr Tpng_structrp, strategy int32) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_text_strategy = strategy } // C documentation // // /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a // * smaller value of window_bits if it can do so safely. // */ func Xpng_set_text_compression_window_bits(tls *libc.TLS, png_ptr Tpng_structrp, window_bits int32) { if png_ptr == libc.UintptrFromInt32(0) { return } if window_bits > int32(15) { Xpng_warning(tls, png_ptr, __ccgo_ts+19493) window_bits = int32(15) } else { if window_bits < int32(8) { Xpng_warning(tls, png_ptr, __ccgo_ts+19542) window_bits = int32(8) } } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_text_window_bits = window_bits } func Xpng_set_text_compression_method(tls *libc.TLS, png_ptr Tpng_structrp, method int32) { if png_ptr == libc.UintptrFromInt32(0) { return } if method != int32(8) { Xpng_warning(tls, png_ptr, __ccgo_ts+19591) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_text_method = method } /* end of API added to libpng-1.5.4 */ func Xpng_set_write_status_fn(tls *libc.TLS, png_ptr Tpng_structrp, write_row_fn Tpng_write_status_ptr) { if png_ptr == libc.UintptrFromInt32(0) { return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_row_fn = write_row_fn } func Xpng_set_write_user_transform_fn(tls *libc.TLS, png_ptr Tpng_structrp, write_user_transform_fn Tpng_user_transform_ptr) { if png_ptr == libc.UintptrFromInt32(0) { return } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 452)) |= uint32(0x100000) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_user_transform_fn = write_user_transform_fn } func Xpng_write_png(tls *libc.TLS, png_ptr Tpng_structrp, info_ptr Tpng_inforp, transforms int32, params Tvoidp) { if png_ptr == libc.UintptrFromInt32(0) || info_ptr == libc.UintptrFromInt32(0) { return } if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x8000) == uint32(0) { Xpng_app_error(tls, png_ptr, __ccgo_ts+19637) return } /* Write the file header information. */ Xpng_write_info(tls, png_ptr, info_ptr) /* ------ these transformations don't touch the info structure ------- */ /* Invert monochrome pixels */ if transforms&int32(PNG_TRANSFORM_INVERT_MONO3) != 0 { Xpng_set_invert_mono(tls, png_ptr) } /* Shift the pixels up to a legal bit depth and fill in * as appropriate to correctly scale the image. */ if transforms&int32(PNG_TRANSFORM_SHIFT3) != 0 { if (*Tpng_info)(unsafe.Pointer(info_ptr)).Fvalid&uint32(0x0002) != uint32(0) { Xpng_set_shift(tls, png_ptr, info_ptr+148) } } /* Pack pixels into bytes */ if transforms&int32(PNG_TRANSFORM_PACKING3) != 0 { Xpng_set_packing(tls, png_ptr) } /* Swap location of alpha bytes from ARGB to RGBA */ if transforms&int32(PNG_TRANSFORM_SWAP_ALPHA3) != 0 { Xpng_set_swap_alpha(tls, png_ptr) } /* Remove a filler (X) from XRGB/RGBX/AG/GA into to convert it into * RGB, note that the code expects the input color type to be G or RGB; no * alpha channel. */ if transforms&(libc.Int32FromInt32(PNG_TRANSFORM_STRIP_FILLER_AFTER1)|libc.Int32FromInt32(PNG_TRANSFORM_STRIP_FILLER1)) != 0 { if transforms&int32(PNG_TRANSFORM_STRIP_FILLER_AFTER1) != 0 { if transforms&int32(PNG_TRANSFORM_STRIP_FILLER1) != 0 { Xpng_app_error(tls, png_ptr, __ccgo_ts+19674) } /* Continue if ignored - this is the pre-1.6.10 behavior */ Xpng_set_filler(tls, png_ptr, uint32(0), int32(PNG_FILLER_AFTER)) } else { if transforms&int32(PNG_TRANSFORM_STRIP_FILLER1) != 0 { Xpng_set_filler(tls, png_ptr, uint32(0), PNG_FILLER_BEFORE) } } } /* Flip BGR pixels to RGB */ if transforms&int32(PNG_TRANSFORM_BGR3) != 0 { Xpng_set_bgr(tls, png_ptr) } /* Swap bytes of 16-bit files to most significant byte first */ if transforms&int32(PNG_TRANSFORM_SWAP_ENDIAN3) != 0 { Xpng_set_swap(tls, png_ptr) } /* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */ if transforms&int32(PNG_TRANSFORM_PACKSWAP3) != 0 { Xpng_set_packswap(tls, png_ptr) } /* Invert the alpha channel from opacity to transparency */ if transforms&int32(PNG_TRANSFORM_INVERT_ALPHA3) != 0 { Xpng_set_invert_alpha(tls, png_ptr) } /* ----------------------- end of transformations ------------------- */ /* Write the bits */ Xpng_write_image(tls, png_ptr, (*Tpng_info)(unsafe.Pointer(info_ptr)).Frow_pointers) /* It is REQUIRED to call this to finish writing the rest of the file */ Xpng_write_end(tls, png_ptr, info_ptr) _ = params } // C documentation // // /* Initialize the write structure - general purpose utility. */ func _png_image_write_init(tls *libc.TLS, image Tpng_imagep) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var control Tpng_controlp var _ /* info_ptr at bp+4 */ Tpng_infop var _ /* png_ptr at bp+0 */ Tpng_structp _ = control *(*Tpng_structp)(unsafe.Pointer(bp)) = Xpng_create_write_struct(tls, __ccgo_ts+9793, image, __ccgo_fp(Xpng_safe_error), __ccgo_fp(Xpng_safe_warning)) if *(*Tpng_structp)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) { *(*Tpng_infop)(unsafe.Pointer(bp + 4)) = Xpng_create_info_struct(tls, *(*Tpng_structp)(unsafe.Pointer(bp))) if *(*Tpng_infop)(unsafe.Pointer(bp + 4)) != libc.UintptrFromInt32(0) { control = Xpng_malloc_warn(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), libc.Uint32FromInt64(24)) if control != libc.UintptrFromInt32(0) { libc.Xmemset(tls, control, 0, libc.Uint32FromInt64(24)) (*Tpng_control1)(unsafe.Pointer(control)).Fpng_ptr = *(*Tpng_structp)(unsafe.Pointer(bp)) (*Tpng_control1)(unsafe.Pointer(control)).Finfo_ptr = *(*Tpng_infop)(unsafe.Pointer(bp + 4)) libc.SetBitFieldPtr8Uint32(control+20, libc.Uint32FromInt32(1), 0, 0x1) (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque = control return int32(1) } /* Error clean up */ Xpng_destroy_info_struct(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), bp+4) } Xpng_destroy_write_struct(tls, bp, libc.UintptrFromInt32(0)) } return Xpng_image_error(tls, image, __ccgo_ts+19729) } // C documentation // // /* Arguments to png_image_write_main: */ type Tpng_image_write_control = struct { Fimage Tpng_imagep Fbuffer Tpng_const_voidp Frow_stride Tpng_int_32 Fcolormap Tpng_const_voidp Fconvert_to_8bit int32 Ffirst_row Tpng_const_voidp Frow_bytes Tptrdiff_t Flocal_row Tpng_voidp Fmemory Tpng_bytep Fmemory_bytes Tpng_alloc_size_t Foutput_bytes Tpng_alloc_size_t } // C documentation // // /* Write png_uint_16 input to a 16-bit PNG; the png_ptr has already been set to // * do any necessary byte swapping. The component order is defined by the // * png_image format value. // */ func _png_write_image_16bit(tls *libc.TLS, argument Tpng_voidp) (r int32) { var aindex, c, v1, v3 int32 var alpha, component Tpng_uint_16 var calc, reciprocal, y Tpng_uint_32 var channels uint32 var display uintptr var image Tpng_imagep var in_ptr, input_row, v5 Tpng_const_uint_16p var out_ptr, output_row, row_end, v6 Tpng_uint_16p var png_ptr Tpng_structrp _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aindex, alpha, c, calc, channels, component, display, image, in_ptr, input_row, out_ptr, output_row, png_ptr, reciprocal, row_end, y, v1, v3, v5, v6 display = argument image = (*Tpng_image_write_control)(unsafe.Pointer(display)).Fimage png_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr input_row = (*Tpng_image_write_control)(unsafe.Pointer(display)).Ffirst_row output_row = (*Tpng_image_write_control)(unsafe.Pointer(display)).Flocal_row if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x02) != uint32(0) { v1 = int32(3) } else { v1 = int32(1) } channels = libc.Uint32FromInt32(v1) aindex = 0 y = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x01) != uint32(0) { if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x20) != uint32(0) { aindex = -int32(1) input_row += 2 /* To point to the first component */ output_row += 2 } else { aindex = libc.Int32FromUint32(channels) } } else { Xpng_error(tls, png_ptr, __ccgo_ts+19761) } /* Work out the output row end and count over this, note that the increment * above to 'row' means that row_end can actually be beyond the end of the * row; this is correct. */ row_end = output_row + uintptr((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth*(channels+uint32(1)))*2 for { if !(y > uint32(0)) { break } in_ptr = input_row out_ptr = output_row for out_ptr < row_end { alpha = *(*Tpng_uint_16)(unsafe.Pointer(in_ptr + uintptr(aindex)*2)) reciprocal = uint32(0) *(*Tpng_uint_16)(unsafe.Pointer(out_ptr + uintptr(aindex)*2)) = alpha /* Calculate a reciprocal. The correct calculation is simply * component/alpha*65535 << 15. (I.e. 15 bits of precision); this * allows correct rounding by adding .5 before the shift. 'reciprocal' * is only initialized when required. */ if libc.Int32FromUint16(alpha) > 0 && libc.Int32FromUint16(alpha) < int32(65535) { reciprocal = libc.Uint32FromInt32((libc.Int32FromInt32(0xffff)<>int32(1)) / libc.Int32FromUint16(alpha)) } c = libc.Int32FromUint32(channels) for { /* always at least one channel */ v5 = in_ptr in_ptr += 2 component = *(*Tpng_uint_16)(unsafe.Pointer(v5)) /* The following gives 65535 for an alpha of 0, which is fine, * otherwise if 0/0 is represented as some other value there is more * likely to be a discontinuity which will probably damage * compression when moving from a fully transparent area to a * nearly transparent one. (The assumption here is that opaque * areas tend not to be 0 intensity.) */ if libc.Int32FromUint16(component) >= libc.Int32FromUint16(alpha) { component = uint16(65535) } else { if libc.Int32FromUint16(component) > 0 && libc.Int32FromUint16(alpha) < int32(65535) { calc = uint32(component) * reciprocal calc += uint32(16384) /* round to nearest */ component = uint16(calc >> libc.Int32FromInt32(15)) } } v6 = out_ptr out_ptr += 2 *(*Tpng_uint_16)(unsafe.Pointer(v6)) = component goto _4 _4: ; c-- v3 = c if !(v3 > 0) { break } } /* Skip to next component (skip the intervening alpha channel) */ in_ptr += 2 out_ptr += 2 } Xpng_write_row(tls, png_ptr, (*Tpng_image_write_control)(unsafe.Pointer(display)).Flocal_row) input_row += uintptr(uint32(libc.Uint16FromInt32((*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_bytes))/libc.Uint32FromInt64(2)) * 2 goto _2 _2: ; y-- } return int32(1) } /* Given 16-bit input (1 to 4 channels) write 8-bit output. If an alpha channel * is present it must be removed from the components, the components are then * written in sRGB encoding. No components are added or removed. * * Calculate an alpha reciprocal to reverse pre-multiplication. As above the * calculation can be done to 15 bits of accuracy; however, the output needs to * be scaled in the range 0..255*65535, so include that scaling here. */ func _png_unpremultiply(tls *libc.TLS, component Tpng_uint_32, alpha Tpng_uint_32, reciprocal Tpng_uint_32) (r Tpng_byte) { /* The following gives 1.0 for an alpha of 0, which is fine, otherwise if 0/0 * is represented as some other value there is more likely to be a * discontinuity which will probably damage compression when moving from a * fully transparent area to a nearly transparent one. (The assumption here * is that opaque areas tend not to be 0 intensity.) * * There is a rounding problem here; if alpha is less than 128 it will end up * as 0 when scaled to 8 bits. To avoid introducing spurious colors into the * output change for this too. */ if component >= alpha || alpha < uint32(128) { return uint8(255) } else { if component > uint32(0) { /* The test is that alpha/257 (rounded) is less than 255, the first value * that becomes 255 is 65407. * NOTE: this must agree with the PNG_DIV257 macro (which must, therefore, * be exact!) [Could also test reciprocal != 0] */ if alpha < uint32(65407) { component *= reciprocal component += uint32(64) /* round to nearest */ component >>= uint32(7) } else { component *= uint32(255) } /* Convert the component to sRGB. */ return uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[component>>int32(15)]) + component&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[component>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8))) } else { return uint8(0) } } return r } func _png_write_image_8bit(tls *libc.TLS, argument Tpng_voidp) (r int32) { var aindex, c, v1, v3 int32 var alpha Tpng_uint_16 var alphabyte Tpng_byte var channels uint32 var component, reciprocal, y Tpng_uint_32 var display uintptr var image Tpng_imagep var in_ptr, in_ptr1, input_row, v6, v8 Tpng_const_uint_16p var out_ptr, out_ptr1, output_row, row_end, row_end1, v5, v9 Tpng_bytep var png_ptr Tpng_structrp _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aindex, alpha, alphabyte, c, channels, component, display, image, in_ptr, in_ptr1, input_row, out_ptr, out_ptr1, output_row, png_ptr, reciprocal, row_end, row_end1, y, v1, v3, v5, v6, v8, v9 display = argument image = (*Tpng_image_write_control)(unsafe.Pointer(display)).Fimage png_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr input_row = (*Tpng_image_write_control)(unsafe.Pointer(display)).Ffirst_row output_row = (*Tpng_image_write_control)(unsafe.Pointer(display)).Flocal_row y = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x02) != uint32(0) { v1 = int32(3) } else { v1 = int32(1) } channels = libc.Uint32FromInt32(v1) if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x01) != uint32(0) { if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x20) != uint32(0) { aindex = -int32(1) input_row += 2 /* To point to the first component */ output_row++ } else { aindex = libc.Int32FromUint32(channels) } /* Use row_end in place of a loop counter: */ row_end = output_row + uintptr((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth*(channels+uint32(1))) for { if !(y > uint32(0)) { break } in_ptr = input_row out_ptr = output_row for out_ptr < row_end { alpha = *(*Tpng_uint_16)(unsafe.Pointer(in_ptr + uintptr(aindex)*2)) alphabyte = uint8((uint32(alpha)*libc.Uint32FromInt32(255) + libc.Uint32FromInt32(32895)) >> libc.Int32FromInt32(16)) reciprocal = uint32(0) /* Scale and write the alpha channel. */ *(*Tpng_byte)(unsafe.Pointer(out_ptr + uintptr(aindex))) = alphabyte if libc.Int32FromUint8(alphabyte) > 0 && libc.Int32FromUint8(alphabyte) < int32(255) { reciprocal = libc.Uint32FromInt32((libc.Int32FromInt32(0xffff)*libc.Int32FromInt32(0xff)<>libc.Int32FromInt32(1)) / libc.Int32FromUint16(alpha)) } c = libc.Int32FromUint32(channels) for { /* always at least one channel */ v5 = out_ptr out_ptr++ v6 = in_ptr in_ptr += 2 *(*Tpng_byte)(unsafe.Pointer(v5)) = _png_unpremultiply(tls, uint32(*(*Tpng_uint_16)(unsafe.Pointer(v6))), uint32(alpha), reciprocal) goto _4 _4: ; c-- v3 = c if !(v3 > 0) { break } } /* Skip to next component (skip the intervening alpha channel) */ in_ptr += 2 out_ptr++ } /* while out_ptr < row_end */ Xpng_write_row(tls, png_ptr, (*Tpng_image_write_control)(unsafe.Pointer(display)).Flocal_row) input_row += uintptr(uint32(libc.Uint16FromInt32((*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_bytes))/libc.Uint32FromInt64(2)) * 2 goto _2 _2: ; y-- } /* while y */ } else { /* No alpha channel, so the row_end really is the end of the row and it * is sufficient to loop over the components one by one. */ row_end1 = output_row + uintptr((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth*channels) for { if !(y > uint32(0)) { break } in_ptr1 = input_row out_ptr1 = output_row for out_ptr1 < row_end1 { v8 = in_ptr1 in_ptr1 += 2 component = uint32(*(*Tpng_uint_16)(unsafe.Pointer(v8))) component *= uint32(255) v9 = out_ptr1 out_ptr1++ *(*Tpng_byte)(unsafe.Pointer(v9)) = uint8(libc.Uint32FromInt32(0xff) & ((uint32(Xpng_sRGB_base[component>>int32(15)]) + component&libc.Uint32FromInt32(0x7fff)*uint32(Xpng_sRGB_delta[component>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8))) } Xpng_write_row(tls, png_ptr, output_row) input_row += uintptr(uint32(libc.Uint16FromInt32((*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_bytes))/libc.Uint32FromInt64(2)) * 2 goto _7 _7: ; y-- } } return int32(1) } func _png_image_set_PLTE(tls *libc.TLS, display uintptr) { bp := tls.Alloc(1024) defer tls.Free(1024) var afirst, bgr, entries, i, num_trans, v1, v10, v2, v4 int32 var alpha Tpng_uint_16 var alphabyte, v11, v12, v5, v6, v8, v9 Tpng_byte var channels, v7 uint32 var cmap uintptr var entry Tpng_const_uint_16p var entry1 Tpng_const_bytep var format, reciprocal Tpng_uint_32 var image Tpng_imagep var _ /* palette at bp+0 */ [256]Tpng_color var _ /* tRNS at bp+768 */ [256]Tpng_byte _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = afirst, alpha, alphabyte, bgr, channels, cmap, entries, entry, entry1, format, i, image, num_trans, reciprocal, v1, v10, v11, v12, v2, v4, v5, v6, v7, v8, v9 image = (*Tpng_image_write_control)(unsafe.Pointer(display)).Fimage cmap = (*Tpng_image_write_control)(unsafe.Pointer(display)).Fcolormap if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries > uint32(256) { v1 = int32(256) } else { v1 = libc.Int32FromUint32((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries) } entries = v1 /* NOTE: the caller must check for cmap != NULL and entries != 0 */ format = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat channels = format&(libc.Uint32FromUint32(0x02)|libc.Uint32FromUint32(0x01)) + uint32(1) afirst = libc.BoolInt32(format&uint32(0x20) != uint32(0) && format&uint32(0x01) != uint32(0)) if format&uint32(0x10) != uint32(0) { v2 = int32(2) } else { v2 = 0 } bgr = v2 libc.Xmemset(tls, bp+768, int32(255), libc.Uint32FromInt64(256)) libc.Xmemset(tls, bp, 0, libc.Uint32FromInt64(768)) v4 = libc.Int32FromInt32(0) num_trans = v4 i = v4 for { if !(i < entries) { break } /* This gets automatically converted to sRGB with reversal of the * pre-multiplication if the color-map has an alpha channel. */ if format&uint32(0x04) != uint32(0) { entry = cmap entry += uintptr(libc.Uint32FromInt32(i)*channels) * 2 if channels&uint32(1) != uint32(0) { /* no alpha */ if channels >= uint32(3) { /* RGB */ (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fblue = libc.Uint8FromInt32(libc.Int32FromInt32(0xff) & ((libc.Int32FromUint16(Xpng_sRGB_base[int32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(libc.Int32FromInt32(2)^bgr)*2)))>>int32(15)]) + libc.Int32FromInt32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(libc.Int32FromInt32(2)^bgr)*2)))&libc.Int32FromInt32(0x7fff)*libc.Int32FromUint8(Xpng_sRGB_delta[int32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(libc.Int32FromInt32(2)^bgr)*2)))>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8))) (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fgreen = libc.Uint8FromInt32(libc.Int32FromInt32(0xff) & ((libc.Int32FromUint16(Xpng_sRGB_base[int32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry + 1*2)))>>int32(15)]) + libc.Int32FromInt32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry + 1*2)))&libc.Int32FromInt32(0x7fff)*libc.Int32FromUint8(Xpng_sRGB_delta[int32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry + 1*2)))>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8))) (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fred = libc.Uint8FromInt32(libc.Int32FromInt32(0xff) & ((libc.Int32FromUint16(Xpng_sRGB_base[int32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(bgr)*2)))>>int32(15)]) + libc.Int32FromInt32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(bgr)*2)))&libc.Int32FromInt32(0x7fff)*libc.Int32FromUint8(Xpng_sRGB_delta[int32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(bgr)*2)))>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8))) } else { /* Gray */ v6 = libc.Uint8FromInt32(libc.Int32FromInt32(0xff) & ((libc.Int32FromUint16(Xpng_sRGB_base[int32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry)))>>int32(15)]) + libc.Int32FromInt32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry)))&libc.Int32FromInt32(0x7fff)*libc.Int32FromUint8(Xpng_sRGB_delta[int32(255)*libc.Int32FromUint16(*(*Tpng_uint_16)(unsafe.Pointer(entry)))>>int32(15)])>>libc.Int32FromInt32(12)) >> libc.Int32FromInt32(8))) (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fgreen = v6 v5 = v6 (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fred = v5 (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fblue = v5 } } else { /* alpha */ if afirst != 0 { v7 = uint32(0) } else { v7 = channels - uint32(1) } alpha = *(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(v7)*2)) alphabyte = uint8((uint32(alpha)*libc.Uint32FromInt32(255) + libc.Uint32FromInt32(32895)) >> libc.Int32FromInt32(16)) reciprocal = uint32(0) /* Calculate a reciprocal, as in the png_write_image_8bit code above * this is designed to produce a value scaled to 255*65535 when * divided by 128 (i.e. asr 7). */ if libc.Int32FromUint8(alphabyte) > 0 && libc.Int32FromUint8(alphabyte) < int32(255) { reciprocal = libc.Uint32FromInt32((libc.Int32FromInt32(0xffff)*libc.Int32FromInt32(0xff)<>int32(1)) / libc.Int32FromUint16(alpha)) } (*(*[256]Tpng_byte)(unsafe.Pointer(bp + 768)))[i] = alphabyte if libc.Int32FromUint8(alphabyte) < int32(255) { num_trans = i + int32(1) } if channels >= uint32(3) { /* RGB */ (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fblue = _png_unpremultiply(tls, uint32(*(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(afirst+(int32(2)^bgr))*2))), uint32(alpha), reciprocal) (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fgreen = _png_unpremultiply(tls, uint32(*(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(afirst+int32(1))*2))), uint32(alpha), reciprocal) (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fred = _png_unpremultiply(tls, uint32(*(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(afirst+bgr)*2))), uint32(alpha), reciprocal) } else { /* gray */ v9 = _png_unpremultiply(tls, uint32(*(*Tpng_uint_16)(unsafe.Pointer(entry + uintptr(afirst)*2))), uint32(alpha), reciprocal) (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fgreen = v9 v8 = v9 (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fred = v8 (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fblue = v8 } } } else { /* Color-map has sRGB values */ entry1 = cmap entry1 += uintptr(libc.Uint32FromInt32(i) * channels) switch channels { case uint32(4): if afirst != 0 { v10 = 0 } else { v10 = int32(3) } (*(*[256]Tpng_byte)(unsafe.Pointer(bp + 768)))[i] = *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(v10))) if libc.Int32FromUint8((*(*[256]Tpng_byte)(unsafe.Pointer(bp + 768)))[i]) < int32(255) { num_trans = i + int32(1) } /* FALLTHROUGH */ fallthrough case uint32(3): (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fblue = *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(afirst+(int32(2)^bgr)))) (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fgreen = *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(afirst+int32(1)))) (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fred = *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(afirst+bgr))) case uint32(2): (*(*[256]Tpng_byte)(unsafe.Pointer(bp + 768)))[i] = *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(int32(1)^afirst))) if libc.Int32FromUint8((*(*[256]Tpng_byte)(unsafe.Pointer(bp + 768)))[i]) < int32(255) { num_trans = i + int32(1) } /* FALLTHROUGH */ fallthrough case uint32(1): v12 = *(*Tpng_byte)(unsafe.Pointer(entry1 + uintptr(afirst))) (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fgreen = v12 v11 = v12 (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fred = v11 (*(*[256]Tpng_color)(unsafe.Pointer(bp)))[i].Fblue = v11 default: break } } goto _3 _3: ; i++ } Xpng_set_PLTE(tls, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Finfo_ptr, bp, entries) if num_trans > 0 { Xpng_set_tRNS(tls, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Finfo_ptr, bp+768, num_trans, libc.UintptrFromInt32(0)) } (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries = libc.Uint32FromInt32(entries) } func _png_image_write_main(tls *libc.TLS, argument Tpng_voidp) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var alpha, colormap, linear, result, write_16bit, v2, v3, v4, v5, v6, v7 int32 var channels, v1 uint32 var check, entries, format, png_row_stride, y Tpng_uint_32 var display uintptr var image Tpng_imagep var info_ptr Tpng_inforp var png_ptr Tpng_structrp var row, row2 Tpng_const_bytep var row1 Tpng_bytep var row_bytes, row_bytes1 Tptrdiff_t var _ /* le at bp+0 */ Tpng_uint_16 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alpha, channels, check, colormap, display, entries, format, image, info_ptr, linear, png_ptr, png_row_stride, result, row, row1, row2, row_bytes, row_bytes1, write_16bit, y, v1, v2, v3, v4, v5, v6, v7 display = argument image = (*Tpng_image_write_control)(unsafe.Pointer(display)).Fimage png_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr info_ptr = (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Finfo_ptr format = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat /* The following four ints are actually booleans */ colormap = libc.Int32FromUint32(format & libc.Uint32FromUint32(0x08)) linear = libc.BoolInt32(!(colormap != 0) && format&uint32(0x04) != 0) /* input */ alpha = libc.BoolInt32(!(colormap != 0) && format&uint32(0x01) != 0) write_16bit = libc.BoolInt32(linear != 0 && (*Tpng_image_write_control)(unsafe.Pointer(display)).Fconvert_to_8bit == 0) /* Make sure we error out on any bad situation */ Xpng_set_benign_errors(tls, png_ptr, 0) /* Default the 'row_stride' parameter if required, also check the row stride * and total image size to ensure that they are within the system limits. */ if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&uint32(0x08) != 0 { v1 = uint32(1) } else { v1 = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fformat&(libc.Uint32FromUint32(0x02)|libc.Uint32FromUint32(0x01)) + uint32(1) } channels = v1 if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth <= uint32(0x7fffffff)/channels { /* no overflow */ png_row_stride = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth * channels if (*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_stride == 0 { (*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_stride = libc.Int32FromUint32(png_row_stride) } if (*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_stride < 0 { check = libc.Uint32FromInt32(-(*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_stride) } else { check = libc.Uint32FromInt32((*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_stride) } if check >= png_row_stride { /* Now check for overflow of the image buffer calculation; this * limits the whole image size to 32 bits for API compatibility with * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro. */ if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight > uint32(0xffffffff)/png_row_stride { Xpng_error(tls, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr, __ccgo_ts+19798) } } else { Xpng_error(tls, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr, __ccgo_ts+19821) } } else { Xpng_error(tls, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr, __ccgo_ts+19851) } /* Set the required transforms then write the rows in the correct order. */ if format&uint32(0x08) != uint32(0) { if (*Tpng_image_write_control)(unsafe.Pointer(display)).Fcolormap != libc.UintptrFromInt32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries > uint32(0) { entries = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries if entries > uint32(16) { v2 = int32(8) } else { if entries > uint32(4) { v3 = int32(4) } else { if entries > uint32(2) { v4 = int32(2) } else { v4 = int32(1) } v3 = v4 } v2 = v3 } Xpng_set_IHDR(tls, png_ptr, info_ptr, (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth, (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight, v2, libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE), PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE) _png_image_set_PLTE(tls, display) } else { Xpng_error(tls, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr, __ccgo_ts+19878) } } else { if write_16bit != 0 { v5 = int32(16) } else { v5 = int32(8) } if format&uint32(0x02) != 0 { v6 = int32(PNG_COLOR_MASK_COLOR) } else { v6 = 0 } if format&uint32(0x01) != 0 { v7 = int32(PNG_COLOR_MASK_ALPHA) } else { v7 = 0 } Xpng_set_IHDR(tls, png_ptr, info_ptr, (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fwidth, (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight, v5, v6+v7, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE) } /* Counter-intuitively the data transformations must be called *after* * png_write_info, not before as in the read code, but the 'set' functions * must still be called before. Just set the color space information, never * write an interlaced image. */ if write_16bit != 0 { /* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */ Xpng_set_gAMA_fixed(tls, png_ptr, info_ptr, int32(PNG_FP_1)) if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fflags&uint32(PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB3) == uint32(0) { Xpng_set_cHRM_fixed(tls, png_ptr, info_ptr, int32(31270), int32(32900), int32(64000), int32(33000), int32(30000), int32(60000), int32(15000), int32(6000)) } } else { if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fflags&uint32(PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB3) == uint32(0) { Xpng_set_sRGB(tls, png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL) } else { Xpng_set_gAMA_fixed(tls, png_ptr, info_ptr, int32(PNG_GAMMA_sRGB_INVERSE)) } } /* Write the file header. */ Xpng_write_info(tls, png_ptr, info_ptr) /* Now set up the data transformations (*after* the header is written), * remove the handled transformations from the 'format' flags for checking. * * First check for a little endian system if writing 16-bit files. */ if write_16bit != 0 { *(*Tpng_uint_16)(unsafe.Pointer(bp)) = uint16(0x0001) if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(bp))) != 0 { Xpng_set_swap(tls, png_ptr) } } if format&uint32(0x10) != uint32(0) { if colormap == 0 && format&uint32(0x02) != uint32(0) { Xpng_set_bgr(tls, png_ptr) } format &= ^libc.Uint32FromUint32(0x10) } if format&uint32(0x20) != uint32(0) { if colormap == 0 && format&uint32(0x01) != uint32(0) { Xpng_set_swap_alpha(tls, png_ptr) } format &= ^libc.Uint32FromUint32(0x20) } /* If there are 16 or fewer color-map entries we wrote a lower bit depth * above, but the application data is still byte packed. */ if colormap != 0 && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fcolormap_entries <= uint32(16) { Xpng_set_packing(tls, png_ptr) } /* That should have handled all (both) the transforms. */ if format & ^(libc.Uint32FromUint32(0x02)|libc.Uint32FromUint32(0x04)|libc.Uint32FromUint32(0x01)|libc.Uint32FromUint32(0x08)) != uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+19914) } row = (*Tpng_image_write_control)(unsafe.Pointer(display)).Fbuffer row_bytes = (*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_stride if linear != 0 { row_bytes = Tptrdiff_t(uint32(row_bytes) * libc.Uint32FromInt64(2)) } if row_bytes < 0 { row += uintptr(((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight - uint32(1)) * libc.Uint32FromInt32(-row_bytes)) } (*Tpng_image_write_control)(unsafe.Pointer(display)).Ffirst_row = row (*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_bytes = row_bytes /* Apply 'fast' options if the flag is set. */ if (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fflags&uint32(PNG_IMAGE_FLAG_FAST1) != uint32(0) { Xpng_set_filter(tls, png_ptr, PNG_FILTER_TYPE_BASE, PNG_NO_FILTERS1) /* NOTE: determined by experiment using pngstest, this reflects some * balance between the time to write the image once and the time to read * it about 50 times. The speed-up in pngstest was about 10-20% of the * total (user) time on a heavily loaded system. */ Xpng_set_compression_level(tls, png_ptr, int32(3)) } /* Check for the cases that currently require a pre-transform on the row * before it is written. This only applies when the input is 16-bit and * either there is an alpha channel or it is converted to 8-bit. */ if linear != 0 && alpha != 0 || colormap == 0 && (*Tpng_image_write_control)(unsafe.Pointer(display)).Fconvert_to_8bit != 0 { row1 = Xpng_malloc(tls, png_ptr, Xpng_get_rowbytes(tls, png_ptr, info_ptr)) (*Tpng_image_write_control)(unsafe.Pointer(display)).Flocal_row = row1 if write_16bit != 0 { result = Xpng_safe_execute(tls, image, __ccgo_fp(_png_write_image_16bit), display) } else { result = Xpng_safe_execute(tls, image, __ccgo_fp(_png_write_image_8bit), display) } (*Tpng_image_write_control)(unsafe.Pointer(display)).Flocal_row = libc.UintptrFromInt32(0) Xpng_free(tls, png_ptr, row1) /* Skip the 'write_end' on error: */ if result == 0 { return 0 } } else { row2 = (*Tpng_image_write_control)(unsafe.Pointer(display)).Ffirst_row row_bytes1 = (*Tpng_image_write_control)(unsafe.Pointer(display)).Frow_bytes y = (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fheight for { if !(y > uint32(0)) { break } Xpng_write_row(tls, png_ptr, row2) row2 += uintptr(row_bytes1) goto _8 _8: ; y-- } } Xpng_write_end(tls, png_ptr, info_ptr) return int32(1) } func _image_memory_write(tls *libc.TLS, png_ptr Tpng_structp, data Tpng_bytep, size Tsize_t) { var display uintptr var ob Tpng_alloc_size_t _, _ = display, ob display = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_ptr ob = (*Tpng_image_write_control)(unsafe.Pointer(display)).Foutput_bytes /* Check for overflow; this should never happen: */ if size <= libc.Uint32FromInt32(-libc.Int32FromInt32(1))-ob { /* I don't think libpng ever does this, but just in case: */ if size > uint32(0) { if (*Tpng_image_write_control)(unsafe.Pointer(display)).Fmemory_bytes >= ob+size { /* writing */ libc.Xmemcpy(tls, (*Tpng_image_write_control)(unsafe.Pointer(display)).Fmemory+uintptr(ob), data, size) } /* Always update the size: */ (*Tpng_image_write_control)(unsafe.Pointer(display)).Foutput_bytes = ob + size } } else { Xpng_error(tls, png_ptr, __ccgo_ts+19958) } } func _image_memory_flush(tls *libc.TLS, png_ptr Tpng_structp) { _ = png_ptr } func _png_image_write_memory(tls *libc.TLS, argument Tpng_voidp) (r int32) { var display uintptr _ = display display = argument /* The rest of the memory-specific init and write_main in an error protected * environment. This case needs to use callbacks for the write operations * since libpng has no built in support for writing to memory. */ Xpng_set_write_fn(tls, (*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer((*Tpng_image_write_control)(unsafe.Pointer(display)).Fimage)).Fopaque)).Fpng_ptr, display, __ccgo_fp(_image_memory_write), __ccgo_fp(_image_memory_flush)) return _png_image_write_main(tls, display) } func Xpng_image_write_to_memory(tls *libc.TLS, image Tpng_imagep, memory uintptr, memory_bytes uintptr, convert_to_8bit int32, buffer uintptr, row_stride Tpng_int_32, colormap uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* display at bp+0 */ Tpng_image_write_control _ = result /* Write the image to the given buffer, or count the bytes if it is NULL */ if image != libc.UintptrFromInt32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fversion == uint32(PNG_IMAGE_VERSION) { if memory_bytes != libc.UintptrFromInt32(0) && buffer != libc.UintptrFromInt32(0) { /* This is to give the caller an easier error detection in the NULL * case and guard against uninitialized variable problems: */ if memory == libc.UintptrFromInt32(0) { *(*Tpng_alloc_size_t)(unsafe.Pointer(memory_bytes)) = uint32(0) } if _png_image_write_init(tls, image) != 0 { libc.Xmemset(tls, bp, 0, libc.Uint32FromInt64(44)) (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Fimage = image (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Fbuffer = buffer (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Frow_stride = row_stride (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Fcolormap = colormap (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Fconvert_to_8bit = convert_to_8bit (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Fmemory = memory (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Fmemory_bytes = *(*Tpng_alloc_size_t)(unsafe.Pointer(memory_bytes)) (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Foutput_bytes = uint32(0) result = Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_write_memory), bp) Xpng_image_free(tls, image) /* write_memory returns true even if we ran out of buffer. */ if result != 0 { /* On out-of-buffer this function returns '0' but still updates * memory_bytes: */ if memory != libc.UintptrFromInt32(0) && (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Foutput_bytes > *(*Tpng_alloc_size_t)(unsafe.Pointer(memory_bytes)) { result = 0 } *(*Tpng_alloc_size_t)(unsafe.Pointer(memory_bytes)) = (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Foutput_bytes } return result } else { return 0 } } else { return Xpng_image_error(tls, image, __ccgo_ts+19997) } } else { if image != libc.UintptrFromInt32(0) { return Xpng_image_error(tls, image, __ccgo_ts+20041) } else { return 0 } } return r } func Xpng_image_write_to_stdio(tls *libc.TLS, image Tpng_imagep, file uintptr, convert_to_8bit int32, buffer uintptr, row_stride Tpng_int_32, colormap uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* display at bp+0 */ Tpng_image_write_control _ = result /* Write the image to the given (FILE*). */ if image != libc.UintptrFromInt32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fversion == uint32(PNG_IMAGE_VERSION) { if file != libc.UintptrFromInt32(0) && buffer != libc.UintptrFromInt32(0) { if _png_image_write_init(tls, image) != 0 { /* This is slightly evil, but png_init_io doesn't do anything other * than this and we haven't changed the standard IO functions so * this saves a 'safe' function. */ (*Tpng_struct)(unsafe.Pointer((*Tpng_control1)(unsafe.Pointer((*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fopaque)).Fpng_ptr)).Fio_ptr = file libc.Xmemset(tls, bp, 0, libc.Uint32FromInt64(44)) (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Fimage = image (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Fbuffer = buffer (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Frow_stride = row_stride (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Fcolormap = colormap (*(*Tpng_image_write_control)(unsafe.Pointer(bp))).Fconvert_to_8bit = convert_to_8bit result = Xpng_safe_execute(tls, image, __ccgo_fp(_png_image_write_main), bp) Xpng_image_free(tls, image) return result } else { return 0 } } else { return Xpng_image_error(tls, image, __ccgo_ts+20096) } } else { if image != libc.UintptrFromInt32(0) { return Xpng_image_error(tls, image, __ccgo_ts+20139) } else { return 0 } } return r } func Xpng_image_write_to_file(tls *libc.TLS, image Tpng_imagep, file_name uintptr, convert_to_8bit int32, buffer uintptr, row_stride Tpng_int_32, colormap uintptr) (r int32) { var error1 int32 var fp uintptr _, _ = error1, fp /* Write the image to the named file. */ if image != libc.UintptrFromInt32(0) && (*struct { Fopaque Tpng_controlp Fversion Tpng_uint_32 Fwidth Tpng_uint_32 Fheight Tpng_uint_32 Fformat Tpng_uint_32 Fflags Tpng_uint_32 Fcolormap_entries Tpng_uint_32 Fwarning_or_error Tpng_uint_32 Fmessage [64]uint8 })(unsafe.Pointer(image)).Fversion == uint32(PNG_IMAGE_VERSION) { if file_name != libc.UintptrFromInt32(0) && buffer != libc.UintptrFromInt32(0) { fp = libc.Xfopen(tls, file_name, __ccgo_ts+20193) if fp != libc.UintptrFromInt32(0) { if Xpng_image_write_to_stdio(tls, image, fp, convert_to_8bit, buffer, row_stride, colormap) != 0 { /* from fflush/fclose */ /* Make sure the file is flushed correctly. */ if libc.Xfflush(tls, fp) == 0 && libc.Xferror(tls, fp) == 0 { if libc.Xfclose(tls, fp) == 0 { return int32(1) } error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) /* from fclose */ } else { error1 = *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) /* from fflush or ferror */ libc.Xfclose(tls, fp) } libc.Xremove(tls, file_name) /* The image has already been cleaned up; this is just used to * set the error (because the original write succeeded). */ return Xpng_image_error(tls, image, libc.Xstrerror(tls, error1)) } else { /* Clean up: just the opened file. */ libc.Xfclose(tls, fp) libc.Xremove(tls, file_name) return 0 } } else { return Xpng_image_error(tls, image, libc.Xstrerror(tls, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))))) } } else { return Xpng_image_error(tls, image, __ccgo_ts+20196) } } else { if image != libc.UintptrFromInt32(0) { return Xpng_image_error(tls, image, __ccgo_ts+20238) } else { return 0 } } return r } const PNG_AFTER_IDAT6 = 0x08 const PNG_BGR7 = 1 const PNG_COLORSPACE_FROM_cHRM4 = 0x0010 const PNG_COLORSPACE_FROM_gAMA6 = 0x0008 const PNG_COLORSPACE_INVALID8 = 0x8000 const PNG_FILLER5 = 32768 const PNG_FILTER_AVG2 = 0x40 const PNG_FILTER_NONE2 = 0x08 const PNG_FILTER_PAETH2 = 0x80 const PNG_FILTER_SUB2 = 0x10 const PNG_FILTER_UP2 = 0x20 const PNG_FLAG_APP_WARNINGS_WARN8 = 0x200000 const PNG_FLAG_FILLER_AFTER7 = 128 const PNG_FLAG_MNG_FILTER_646 = 0x04 const PNG_FLAG_ZLIB_CUSTOM_STRATEGY2 = 0x0001 const PNG_FLAG_ZSTREAM_INITIALIZED4 = 0x0002 const PNG_FORMAT_FLAG_AFIRST4 = 0x20 const PNG_FORMAT_FLAG_ALPHA4 = 0x01 const PNG_FORMAT_FLAG_BGR4 = 0x10 const PNG_FORMAT_FLAG_COLOR4 = 0x02 const PNG_FORMAT_FLAG_COLORMAP4 = 0x08 const PNG_FORMAT_FLAG_LINEAR4 = 0x04 const PNG_HAVE_IDAT6 = 0x04 const PNG_HAVE_IHDR6 = 0x01 const PNG_HAVE_PLTE6 = 0x02 const PNG_HAVE_PNG_SIGNATURE6 = 0x1000 const PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB4 = 0x01 const PNG_IMAGE_FLAG_FAST2 = 0x02 const PNG_INFO_IDAT8 = 0x8000 const PNG_INFO_PLTE8 = 0x0008 const PNG_INFO_bKGD6 = 0x0020 const PNG_INFO_cHRM6 = 0x0004 const PNG_INFO_eXIf8 = 0x10000 const PNG_INFO_gAMA6 = 0x0001 const PNG_INFO_hIST8 = 0x0040 const PNG_INFO_iCCP8 = 0x1000 const PNG_INFO_oFFs6 = 0x0100 const PNG_INFO_pCAL8 = 0x0400 const PNG_INFO_pHYs6 = 0x0080 const PNG_INFO_sBIT8 = 0x0002 const PNG_INFO_sCAL8 = 0x4000 const PNG_INFO_sPLT6 = 0x2000 const PNG_INFO_sRGB6 = 0x0800 const PNG_INFO_tIME6 = 0x0200 const PNG_INFO_tRNS8 = 0x0010 const PNG_INTERLACE8 = 0x0002 const PNG_INVERT_MONO5 = 32 const PNG_NO_FILTERS2 = 0x00 const PNG_PACK5 = 4 const PNG_PACKSWAP5 = 65536 const PNG_SHIFT5 = 8 const PNG_SWAP_ALPHA7 = 131072 const PNG_SWAP_BYTES5 = 16 const PNG_TRANSFORM_BGR4 = 0x0080 const PNG_TRANSFORM_INVERT_ALPHA4 = 0x0400 const PNG_TRANSFORM_INVERT_MONO4 = 0x0020 const PNG_TRANSFORM_PACKING4 = 0x0004 const PNG_TRANSFORM_PACKSWAP4 = 0x0008 const PNG_TRANSFORM_SHIFT4 = 0x0040 const PNG_TRANSFORM_STRIP_FILLER2 = 0x0800 const PNG_TRANSFORM_STRIP_FILLER_AFTER2 = 0x1000 const PNG_TRANSFORM_SWAP_ALPHA4 = 0x0100 const PNG_TRANSFORM_SWAP_ENDIAN4 = 0x0200 const PNG_WROTE_INFO_BEFORE_PLTE2 = 0x400 const PNG_WROTE_eXIf4 = 0x4000 const PNG_WROTE_tIME4 = 0x200 /* Maintainer: Put new private prototypes here ^ */ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. * * png_debug[1-2]?(level, message ,arg{0-2}) * Expands to a statement (either a simple expression or a compound * do..while(0) statement) that outputs a message with parameter * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG * is undefined, 0 or 1 every png_debug expands to a simple expression * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added * to the message. * arg: 0 to 2 arguments for printf(3) style substitution in message. */ /* These settings control the formatting of messages in png.c and pngerror.c */ /* Moved to pngdebug.h at 1.5.0 */ // C documentation // // /* Pack pixels into bytes. Pass the true bit depth in bit_depth. The // * row_info bit depth should be 8 (one pixel per byte). The channels // * should be 1 (this only happens on grayscale and paletted images). // */ func _png_do_pack(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, bit_depth Tpng_uint_32) { var dp, dp1, dp2, sp, sp1, sp2 Tpng_bytep var i, i1, i2, row_width, row_width1, row_width2 Tpng_uint_32 var mask, v, v1, v2 int32 var shift, shift1, v4 uint32 var value, value1 Tpng_byte _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, dp1, dp2, i, i1, i2, mask, row_width, row_width1, row_width2, shift, shift1, sp, sp1, sp2, v, v1, v2, value, value1, v4 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) && libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels) == int32(1) { switch libc.Int32FromUint32(bit_depth) { case int32(1): row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth sp = row dp = row mask = int32(0x80) v = 0 i = uint32(0) for { if !(i < row_width) { break } if libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) != 0 { v |= mask } sp++ if mask > int32(1) { mask >>= int32(1) } else { mask = int32(0x80) *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32(v) dp++ v = 0 } goto _1 _1: ; i++ } if mask != int32(0x80) { *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32(v) } case int32(2): row_width1 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth sp1 = row dp1 = row shift = uint32(6) v1 = 0 i1 = uint32(0) for { if !(i1 < row_width1) { break } value = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp1))) & libc.Int32FromInt32(0x03)) v1 |= libc.Int32FromUint8(value) << shift if shift == uint32(0) { shift = uint32(6) *(*Tpng_byte)(unsafe.Pointer(dp1)) = libc.Uint8FromInt32(v1) dp1++ v1 = 0 } else { shift -= uint32(2) } sp1++ goto _2 _2: ; i1++ } if shift != uint32(6) { *(*Tpng_byte)(unsafe.Pointer(dp1)) = libc.Uint8FromInt32(v1) } case int32(4): row_width2 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth sp2 = row dp2 = row shift1 = uint32(4) v2 = 0 i2 = uint32(0) for { if !(i2 < row_width2) { break } value1 = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp2))) & libc.Int32FromInt32(0x0f)) v2 |= libc.Int32FromUint8(value1) << shift1 if shift1 == uint32(0) { shift1 = uint32(4) *(*Tpng_byte)(unsafe.Pointer(dp2)) = libc.Uint8FromInt32(v2) dp2++ v2 = 0 } else { shift1 -= uint32(4) } sp2++ goto _3 _3: ; i2++ } if shift1 != uint32(4) { *(*Tpng_byte)(unsafe.Pointer(dp2)) = libc.Uint8FromInt32(v2) } default: break } (*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth = uint8(bit_depth) (*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth = uint8(bit_depth * uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fchannels)) if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >= int32(8) { v4 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth * (uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v4 = ((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth*uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = v4 } } // C documentation // // /* Shift pixel values to take advantage of whole range. Pass the // * true number of bits in bit_depth. The row should be packed // * according to row_info->bit_depth. Thus, if you had a row of // * bit depth 4, but the pixels only had values from 0 to 7, you // * would pass 3 as bit_depth, and this routine would translate the // * data to 0 to 15. // */ func _png_do_shift(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, bit_depth Tpng_const_color_8p) { var bp, bp1, bp2, v7, v8 Tpng_bytep var c, c1, channels, mask, out, out1, v, v1, v2, value uint32 var i, row_bytes Tsize_t var i1, i2, istop, istop1 Tpng_uint_32 var j, j1, j2 int32 var shift_dec, shift_start [4]int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bp, bp1, bp2, c, c1, channels, i, i1, i2, istop, istop1, j, j1, j2, mask, out, out1, row_bytes, shift_dec, shift_start, v, v1, v2, value, v7, v8 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) != libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { channels = uint32(0) if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) != 0 { shift_start[channels] = libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) - libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Fred) shift_dec[channels] = libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Fred) channels++ shift_start[channels] = libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) - libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Fgreen) shift_dec[channels] = libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Fgreen) channels++ shift_start[channels] = libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) - libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Fblue) shift_dec[channels] = libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Fblue) channels++ } else { shift_start[channels] = libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) - libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Fgray) shift_dec[channels] = libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Fgray) channels++ } if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type)&int32(PNG_COLOR_MASK_ALPHA) != 0 { shift_start[channels] = libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) - libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Falpha) shift_dec[channels] = libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Falpha) channels++ } /* With low row depths, could only be grayscale, so one channel */ if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) < int32(8) { bp = row row_bytes = (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes if libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Fgray) == int32(1) && libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(2) { mask = uint32(0x55) } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(4) && libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(bit_depth)).Fgray) == int32(3) { mask = uint32(0x11) } else { mask = uint32(0xff) } } i = uint32(0) for { if !(i < row_bytes) { break } v = uint32(*(*Tpng_byte)(unsafe.Pointer(bp))) out = uint32(0) j = shift_start[0] for { if !(j > -shift_dec[0]) { break } if j > 0 { out |= v << j } else { out |= v >> -j & mask } goto _2 _2: ; j -= shift_dec[0] } *(*Tpng_byte)(unsafe.Pointer(bp)) = uint8(out & libc.Uint32FromInt32(0xff)) goto _1 _1: ; i++ bp++ } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { bp1 = row istop = channels * (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth i1 = uint32(0) for { if !(i1 < istop) { break } c = i1 % channels v1 = uint32(*(*Tpng_byte)(unsafe.Pointer(bp1))) out1 = uint32(0) j1 = shift_start[c] for { if !(j1 > -shift_dec[c]) { break } if j1 > 0 { out1 |= v1 << j1 } else { out1 |= v1 >> -j1 } goto _4 _4: ; j1 -= shift_dec[c] } *(*Tpng_byte)(unsafe.Pointer(bp1)) = uint8(out1 & libc.Uint32FromInt32(0xff)) goto _3 _3: ; i1++ bp1++ } } else { istop1 = channels * (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth bp2 = row i2 = libc.Uint32FromInt32(0) for { if !(i2 < istop1) { break } c1 = i2 % channels v2 = uint32(uint16(uint32(*(*Tpng_byte)(unsafe.Pointer(bp2)))< -shift_dec[c1]) { break } if j2 > 0 { value |= v2 << j2 } else { value |= v2 >> -j2 } goto _6 _6: ; j2 -= shift_dec[c1] } v7 = bp2 bp2++ *(*Tpng_byte)(unsafe.Pointer(v7)) = uint8(value >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) v8 = bp2 bp2++ *(*Tpng_byte)(unsafe.Pointer(v8)) = uint8(value & libc.Uint32FromInt32(0xff)) goto _5 _5: ; i2++ } } } } } func _png_do_write_swap_alpha(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var dp, dp1, dp2, dp3, sp, sp1, sp2, sp3, v10, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v3, v30, v31, v32, v33, v34, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v5, v6, v7, v8, v9 Tpng_bytep var i, i1, i2, i3, row_width, row_width1, row_width2, row_width3 Tpng_uint_32 var save, save2 Tpng_byte var save1, save3 [2]Tpng_byte _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, dp1, dp2, dp3, i, i1, i2, i3, row_width, row_width1, row_width2, row_width3, save, save1, save2, save3, sp, sp1, sp2, sp3, v10, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v3, v30, v31, v32, v33, v34, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v5, v6, v7, v8, v9 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth i = uint32(0) v2 = row dp = v2 sp = v2 for { if !(i < row_width) { break } v3 = sp sp++ save = *(*Tpng_byte)(unsafe.Pointer(v3)) v4 = dp dp++ v5 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v4)) = *(*Tpng_byte)(unsafe.Pointer(v5)) v6 = dp dp++ v7 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v6)) = *(*Tpng_byte)(unsafe.Pointer(v7)) v8 = dp dp++ v9 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(v8)) = *(*Tpng_byte)(unsafe.Pointer(v9)) v10 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v10)) = save goto _1 _1: ; i++ } } else { row_width1 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth i1 = uint32(0) v12 = row dp1 = v12 sp1 = v12 for { if !(i1 < row_width1) { break } v13 = sp1 sp1++ save1[0] = *(*Tpng_byte)(unsafe.Pointer(v13)) v14 = sp1 sp1++ save1[int32(1)] = *(*Tpng_byte)(unsafe.Pointer(v14)) v15 = dp1 dp1++ v16 = sp1 sp1++ *(*Tpng_byte)(unsafe.Pointer(v15)) = *(*Tpng_byte)(unsafe.Pointer(v16)) v17 = dp1 dp1++ v18 = sp1 sp1++ *(*Tpng_byte)(unsafe.Pointer(v17)) = *(*Tpng_byte)(unsafe.Pointer(v18)) v19 = dp1 dp1++ v20 = sp1 sp1++ *(*Tpng_byte)(unsafe.Pointer(v19)) = *(*Tpng_byte)(unsafe.Pointer(v20)) v21 = dp1 dp1++ v22 = sp1 sp1++ *(*Tpng_byte)(unsafe.Pointer(v21)) = *(*Tpng_byte)(unsafe.Pointer(v22)) v23 = dp1 dp1++ v24 = sp1 sp1++ *(*Tpng_byte)(unsafe.Pointer(v23)) = *(*Tpng_byte)(unsafe.Pointer(v24)) v25 = dp1 dp1++ v26 = sp1 sp1++ *(*Tpng_byte)(unsafe.Pointer(v25)) = *(*Tpng_byte)(unsafe.Pointer(v26)) v27 = dp1 dp1++ *(*Tpng_byte)(unsafe.Pointer(v27)) = save1[0] v28 = dp1 dp1++ *(*Tpng_byte)(unsafe.Pointer(v28)) = save1[int32(1)] goto _11 _11: ; i1++ } } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { row_width2 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth i2 = uint32(0) v30 = row dp2 = v30 sp2 = v30 for { if !(i2 < row_width2) { break } v31 = sp2 sp2++ save2 = *(*Tpng_byte)(unsafe.Pointer(v31)) v32 = dp2 dp2++ v33 = sp2 sp2++ *(*Tpng_byte)(unsafe.Pointer(v32)) = *(*Tpng_byte)(unsafe.Pointer(v33)) v34 = dp2 dp2++ *(*Tpng_byte)(unsafe.Pointer(v34)) = save2 goto _29 _29: ; i2++ } } else { row_width3 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth i3 = uint32(0) v36 = row dp3 = v36 sp3 = v36 for { if !(i3 < row_width3) { break } v37 = sp3 sp3++ save3[0] = *(*Tpng_byte)(unsafe.Pointer(v37)) v38 = sp3 sp3++ save3[int32(1)] = *(*Tpng_byte)(unsafe.Pointer(v38)) v39 = dp3 dp3++ v40 = sp3 sp3++ *(*Tpng_byte)(unsafe.Pointer(v39)) = *(*Tpng_byte)(unsafe.Pointer(v40)) v41 = dp3 dp3++ v42 = sp3 sp3++ *(*Tpng_byte)(unsafe.Pointer(v41)) = *(*Tpng_byte)(unsafe.Pointer(v42)) v43 = dp3 dp3++ *(*Tpng_byte)(unsafe.Pointer(v43)) = save3[0] v44 = dp3 dp3++ *(*Tpng_byte)(unsafe.Pointer(v44)) = save3[int32(1)] goto _35 _35: ; i3++ } } } } } func _png_do_write_invert_alpha(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep) { var dp, dp1, dp2, dp3, sp, sp1, sp2, sp3, v10, v11, v12, v13, v14, v16, v17, v18, v19, v2, v3, v5, v6, v7, v8 Tpng_bytep var i, i1, i2, i3, row_width, row_width1, row_width2, row_width3 Tpng_uint_32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, dp1, dp2, dp3, i, i1, i2, i3, row_width, row_width1, row_width2, row_width3, sp, sp1, sp2, sp3, v10, v11, v12, v13, v14, v16, v17, v18, v19, v2, v3, v5, v6, v7, v8 if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth i = uint32(0) v2 = row dp = v2 sp = v2 for { if !(i < row_width) { break } /* Does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); */ sp += uintptr(3) dp = sp v3 = sp sp++ *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v3)))) goto _1 _1: ; i++ } } else { row_width1 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth i1 = uint32(0) v5 = row dp1 = v5 sp1 = v5 for { if !(i1 < row_width1) { break } /* Does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); */ sp1 += uintptr(6) dp1 = sp1 v6 = dp1 dp1++ v7 = sp1 sp1++ *(*Tpng_byte)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v7)))) v8 = sp1 sp1++ *(*Tpng_byte)(unsafe.Pointer(dp1)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v8)))) goto _4 _4: ; i1++ } } } else { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fcolor_type) == int32(PNG_COLOR_MASK_ALPHA) { if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fbit_depth) == int32(8) { row_width2 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth i2 = uint32(0) v10 = row dp2 = v10 sp2 = v10 for { if !(i2 < row_width2) { break } v11 = dp2 dp2++ v12 = sp2 sp2++ *(*Tpng_byte)(unsafe.Pointer(v11)) = *(*Tpng_byte)(unsafe.Pointer(v12)) v13 = dp2 dp2++ v14 = sp2 sp2++ *(*Tpng_byte)(unsafe.Pointer(v13)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v14)))) goto _9 _9: ; i2++ } } else { row_width3 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth i3 = uint32(0) v16 = row dp3 = v16 sp3 = v16 for { if !(i3 < row_width3) { break } /* Does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); */ sp3 += uintptr(2) dp3 = sp3 v17 = dp3 dp3++ v18 = sp3 sp3++ *(*Tpng_byte)(unsafe.Pointer(v17)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v18)))) v19 = sp3 sp3++ *(*Tpng_byte)(unsafe.Pointer(dp3)) = libc.Uint8FromInt32(libc.Int32FromInt32(255) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v19)))) goto _15 _15: ; i3++ } } } } } // C documentation // // /* Transform the data according to the user's wishes. The order of // * transformations is significant. // */ func Xpng_do_write_transformations(tls *libc.TLS, png_ptr Tpng_structrp, row_info Tpng_row_infop) { if png_ptr == libc.UintptrFromInt32(0) { return } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x100000) != uint32(0) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_user_transform_fn != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structp, Tpng_row_infop, Tpng_bytep))(unsafe.Pointer(&struct{ uintptr }{(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwrite_user_transform_fn})))(tls, png_ptr, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } } /* start of pixel data for row */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x8000) != uint32(0) { Xpng_do_strip_channel(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), libc.BoolInt32(!((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&libc.Uint32FromUint32(0x0080) != 0))) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x10000) != uint32(0) { Xpng_do_packswap(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0004) != uint32(0) { _png_do_pack(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0010) != uint32(0) { Xpng_do_swap(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0008) != uint32(0) { _png_do_shift(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1), png_ptr+753) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x20000) != uint32(0) { _png_do_write_swap_alpha(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x80000) != uint32(0) { _png_do_write_invert_alpha(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0001) != uint32(0) { Xpng_do_bgr(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0020) != uint32(0) { Xpng_do_invert(tls, row_info, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf+uintptr(1)) } } const PNG_AFTER_IDAT7 = 8 const PNG_BGR8 = 0x0001 const PNG_FILLER6 = 0x8000 const PNG_FILTER_AVG3 = 64 const PNG_FILTER_NONE3 = 8 const PNG_FILTER_PAETH3 = 128 const PNG_FILTER_SUB3 = 16 const PNG_FILTER_UP3 = 32 const PNG_FLAG_FILLER_AFTER8 = 0x0080 const PNG_FLAG_MNG_EMPTY_PLTE3 = 1 const PNG_FLAG_MNG_FILTER_647 = 4 const PNG_FLAG_ZLIB_CUSTOM_STRATEGY3 = 1 const PNG_FLAG_ZSTREAM_INITIALIZED5 = 2 const PNG_HAVE_IDAT7 = 4 const PNG_HAVE_IEND5 = 16 const PNG_HAVE_IHDR7 = 1 const PNG_HAVE_PLTE7 = 2 const PNG_HAVE_PNG_SIGNATURE7 = 4096 const PNG_INTERLACE9 = 2 const PNG_INVERT_ALPHA6 = 0x80000 const PNG_INVERT_MONO6 = 0x0020 const PNG_IO_CHUNK_CRC3 = 128 const PNG_IO_CHUNK_DATA3 = 64 const PNG_IO_CHUNK_HDR3 = 32 const PNG_IO_SIGNATURE3 = 16 const PNG_IO_WRITING1 = 2 const PNG_NO_FILTERS3 = 0 const PNG_PACK6 = 0x0004 const PNG_PACKSWAP6 = 0x10000 const PNG_SHIFT6 = 0x0008 const PNG_SWAP_ALPHA8 = 0x20000 const PNG_SWAP_BYTES6 = 0x0010 const PNG_USER_TRANSFORM4 = 0x100000 /* Maintainer: Put new private prototypes here ^ */ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. * * png_debug[1-2]?(level, message ,arg{0-2}) * Expands to a statement (either a simple expression or a compound * do..while(0) statement) that outputs a message with parameter * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG * is undefined, 0 or 1 every png_debug expands to a simple expression * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added * to the message. * arg: 0 to 2 arguments for printf(3) style substitution in message. */ /* These settings control the formatting of messages in png.c and pngerror.c */ /* Moved to pngdebug.h at 1.5.0 */ // C documentation // // /* Place a 32-bit number into a buffer in PNG byte order. We work // * with unsigned numbers for convenience, although one supported // * ancillary chunk uses signed (two's complement) numbers. // */ func Xpng_save_uint_32(tls *libc.TLS, buf Tpng_bytep, i Tpng_uint_32) { *(*Tpng_byte)(unsafe.Pointer(buf)) = uint8(i >> libc.Int32FromInt32(24) & libc.Uint32FromUint32(0xff)) *(*Tpng_byte)(unsafe.Pointer(buf + 1)) = uint8(i >> libc.Int32FromInt32(16) & libc.Uint32FromUint32(0xff)) *(*Tpng_byte)(unsafe.Pointer(buf + 2)) = uint8(i >> libc.Int32FromInt32(8) & libc.Uint32FromUint32(0xff)) *(*Tpng_byte)(unsafe.Pointer(buf + 3)) = uint8(i & libc.Uint32FromUint32(0xff)) } // C documentation // // /* Place a 16-bit number into a buffer in PNG byte order. // * The parameter is declared unsigned int, not png_uint_16, // * just to avoid potential problems on pre-ANSI C compilers. // */ func Xpng_save_uint_16(tls *libc.TLS, buf Tpng_bytep, i uint32) { *(*Tpng_byte)(unsafe.Pointer(buf)) = uint8(i >> libc.Int32FromInt32(8) & libc.Uint32FromUint32(0xff)) *(*Tpng_byte)(unsafe.Pointer(buf + 1)) = uint8(i & libc.Uint32FromUint32(0xff)) } // C documentation // // /* Simple function to write the signature. If we have already written // * the magic bytes of the signature, or more likely, the PNG stream is // * being embedded into another stream and doesn't need its own signature, // * we should call png_set_sig_bytes() to tell libpng how many of the // * bytes have already been written. // */ func Xpng_write_sig(tls *libc.TLS, png_ptr Tpng_structrp) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* png_signature at bp+0 */ [8]Tpng_byte *(*[8]Tpng_byte)(unsafe.Pointer(bp)) = [8]Tpng_byte{ 0: uint8(137), 1: uint8(80), 2: uint8(78), 3: uint8(71), 4: uint8(13), 5: uint8(10), 6: uint8(26), 7: uint8(10), } /* Inform the I/O callback that the signature is being written */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_state = libc.Uint32FromInt32(libc.Int32FromInt32(PNG_IO_WRITING1) | libc.Int32FromInt32(PNG_IO_SIGNATURE3)) /* Write the rest of the 8 byte signature */ Xpng_write_data(tls, png_ptr, bp+uintptr((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bytes), libc.Uint32FromInt32(libc.Int32FromInt32(8)-libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bytes))) if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fsig_bytes) < int32(3) { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 444)) |= uint32(0x1000) } } // C documentation // // /* Write the start of a PNG chunk. The type is the chunk type. // * The total_length is the sum of the lengths of all the data you will be // * passing in png_write_chunk_data(). // */ func _png_write_chunk_header(tls *libc.TLS, png_ptr Tpng_structrp, chunk_name Tpng_uint_32, length Tpng_uint_32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [8]Tpng_byte if png_ptr == libc.UintptrFromInt32(0) { return } /* Inform the I/O callback that the chunk header is being written. * PNG_IO_CHUNK_HDR requires a single I/O call. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_state = libc.Uint32FromInt32(libc.Int32FromInt32(PNG_IO_WRITING1) | libc.Int32FromInt32(PNG_IO_CHUNK_HDR3)) /* Write the length and the chunk name */ Xpng_save_uint_32(tls, bp, length) Xpng_save_uint_32(tls, bp+uintptr(4), chunk_name) Xpng_write_data(tls, png_ptr, bp, uint32(8)) /* Put the chunk name into png_ptr->chunk_name */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchunk_name = chunk_name /* Reset the crc and run it over the chunk name */ Xpng_reset_crc(tls, png_ptr) Xpng_calculate_crc(tls, png_ptr, bp+uintptr(4), uint32(4)) /* Inform the I/O callback that chunk data will (possibly) be written. * PNG_IO_CHUNK_DATA does NOT require a specific number of I/O calls. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_state = libc.Uint32FromInt32(libc.Int32FromInt32(PNG_IO_WRITING1) | libc.Int32FromInt32(PNG_IO_CHUNK_DATA3)) } func Xpng_write_chunk_start(tls *libc.TLS, png_ptr Tpng_structrp, chunk_string Tpng_const_bytep, length Tpng_uint_32) { _png_write_chunk_header(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(0xff)&libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(chunk_string))))< uint32(0) { Xpng_write_data(tls, png_ptr, data, length) /* Update the CRC after writing the data, * in case the user I/O routine alters it. */ Xpng_calculate_crc(tls, png_ptr, data, length) } } // C documentation // // /* Finish a chunk started with png_write_chunk_header(). */ func Xpng_write_chunk_end(tls *libc.TLS, png_ptr Tpng_structrp) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [4]Tpng_byte if png_ptr == libc.UintptrFromInt32(0) { return } /* Inform the I/O callback that the chunk CRC is being written. * PNG_IO_CHUNK_CRC requires a single I/O function call. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fio_state = libc.Uint32FromInt32(libc.Int32FromInt32(PNG_IO_WRITING1) | libc.Int32FromInt32(PNG_IO_CHUNK_CRC3)) /* Write the crc in a single operation */ Xpng_save_uint_32(tls, bp, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcrc) Xpng_write_data(tls, png_ptr, bp, uint32(4)) } // C documentation // // /* Write a PNG chunk all at once. The type is an array of ASCII characters // * representing the chunk name. The array must be at least 4 bytes in // * length, and does not need to be null terminated. To be safe, pass the // * pre-defined chunk names here, and if you need a new one, define it // * where the others are defined. The length is the length of the data. // * All the data must be present. If that is not possible, use the // * png_write_chunk_start(), png_write_chunk_data(), and png_write_chunk_end() // * functions instead. // */ func _png_write_complete_chunk(tls *libc.TLS, png_ptr Tpng_structrp, chunk_name Tpng_uint_32, data Tpng_const_bytep, length Tsize_t) { if png_ptr == libc.UintptrFromInt32(0) { return } /* On 64-bit architectures 'length' may not fit in a png_uint_32. */ if length > libc.Uint32FromInt32(0x7fffffff) { Xpng_error(tls, png_ptr, __ccgo_ts+20291) } _png_write_chunk_header(tls, png_ptr, chunk_name, length) Xpng_write_chunk_data(tls, png_ptr, data, length) Xpng_write_chunk_end(tls, png_ptr) } // C documentation // // /* This is the API that calls the internal function above. */ func Xpng_write_chunk(tls *libc.TLS, png_ptr Tpng_structrp, chunk_string Tpng_const_bytep, data Tpng_const_bytep, length Tsize_t) { _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(0xff)&libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(chunk_string))))< int32(1) { v2 = (int32(7) - pass) >> int32(1) } else { v2 = int32(3) } if pass > int32(1) { v3 = (int32(7) - pass) >> int32(1) } else { v3 = int32(3) } pw = (w + libc.Uint32FromInt32(libc.Int32FromInt32(1)<>libc.Int32FromInt32(1))&libc.Int32FromInt32(7))) >> v3 if pw > uint32(0) { if pd >= uint32(8) { v4 = pw * (pd >> libc.Int32FromInt32(3)) } else { v4 = (pw*pd + uint32(7)) >> int32(3) } if pass > int32(2) { v5 = (int32(8) - pass) >> int32(1) } else { v5 = int32(3) } if pass > int32(2) { v6 = (int32(8) - pass) >> int32(1) } else { v6 = int32(3) } cb_base += (v4 + uint32(1)) * ((h + libc.Uint32FromInt32(libc.Int32FromInt32(1)<>libc.Int32FromInt32(1)) & libc.Int32FromInt32(7))) >> v6) } goto _1 _1: ; pass++ } return cb_base } else { return ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frowbytes + uint32(1)) * h } } else { return uint32(0xffffffff) } return r } // C documentation // // /* This is the code to hack the first two bytes of the deflate stream (the // * deflate header) to correct the windowBits value to match the actual data // * size. Note that the second argument is the *uncompressed* size but the // * first argument is the *compressed* data (and it must be deflate // * compressed.) // */ func _optimize_cmf(tls *libc.TLS, data Tpng_bytep, data_size Tpng_alloc_size_t) { var half_z_window_size, tmp, z_cinfo, z_cmf uint32 _, _, _, _ = half_z_window_size, tmp, z_cinfo, z_cmf /* Optimize the CMF field in the zlib stream. The resultant zlib stream is * still compliant to the stream specification. */ if data_size <= uint32(16384) { /* else windowBits must be 15 */ z_cmf = uint32(*(*Tpng_byte)(unsafe.Pointer(data))) /* zlib compression method and flags */ if z_cmf&uint32(0x0f) == uint32(8) && z_cmf&uint32(0xf0) <= uint32(0x70) { z_cinfo = z_cmf >> int32(4) half_z_window_size = uint32(1) << (z_cinfo + uint32(7)) if data_size <= half_z_window_size { /* else no change */ for cond := true; cond; cond = z_cinfo > uint32(0) && data_size <= half_z_window_size { half_z_window_size >>= uint32(1) z_cinfo-- } z_cmf = z_cmf&uint32(0x0f) | z_cinfo<> libc.Int32FromInt32(24) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + 1)) = uint8(owner >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + 2)) = uint8(owner >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + 3)) = uint8(owner & libc.Uint32FromInt32(0xff)) (*(*[64]uint8)(unsafe.Pointer(bp)))[int32(4)] = uint8(':') (*(*[64]uint8)(unsafe.Pointer(bp)))[int32(5)] = uint8(' ') *(*uint8)(unsafe.Pointer(bp + libc.UintptrFromInt32(6))) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner >> libc.Int32FromInt32(24) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + libc.UintptrFromInt32(6) + 1)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + libc.UintptrFromInt32(6) + 2)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) *(*uint8)(unsafe.Pointer(bp + libc.UintptrFromInt32(6) + 3)) = uint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner & libc.Uint32FromInt32(0xff)) /* So the message that results is " using zstream"; this is an * internal error, but is very useful for debugging. i18n requirements * are minimal. */ Xpng_safecat(tls, bp, libc.Uint32FromInt64(64), uint32(10), __ccgo_ts+15944) Xpng_warning(tls, png_ptr, bp) /* Attempt sane error recovery */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner == libc.Uint32FromInt32(libc.Int32FromInt32(73))<>= uint32(1) windowBits-- } } /* Check against the previous initialized values, if any. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0002) != uint32(0) && ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_set_level != level || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_set_method != method || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_set_window_bits != windowBits || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_set_mem_level != memLevel || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzlib_set_strategy != strategy) { if (*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflateEndPtr})))(tls, png_ptr+460) != Z_OK { Xpng_warning(tls, png_ptr, __ccgo_ts+20333) } *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) &= ^libc.Uint32FromUint32(0x0002) } /* For safety clear out the input and output pointers (currently zlib * doesn't use them on Init, but it might in the future). */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_in = libc.UintptrFromInt32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = uint32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = libc.UintptrFromInt32(0) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = uint32(0) /* Now initialize if required, setting the new parameters, otherwise just * do a simple reset to the previous parameters. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflags&uint32(0x0002) != uint32(0) { ret = (*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflateResetPtr})))(tls, png_ptr+460) } else { ret = (*(*func(*libc.TLS, Tz_streamp, int32, int32, int32, int32, int32, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflateInit2_Ptr})))(tls, png_ptr+460, level, method, windowBits, memLevel, strategy, __ccgo_ts+15959, libc.Int32FromInt64(56)) if ret == Z_OK { *(*Tpng_uint_32)(unsafe.Pointer(png_ptr + 448)) |= uint32(0x0002) } } /* The return code is from either deflateReset or deflateInit2; they have * pretty much the same set of error codes. */ if ret == Z_OK { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner = owner } else { Xpng_zstream_error(tls, png_ptr, ret) } return ret return r } // C documentation // // /* Clean up (or trim) a linked list of compression buffers. */ func Xpng_free_buffer_list(tls *libc.TLS, png_ptr Tpng_structrp, listp uintptr) { var list, next Tpng_compression_bufferp _, _ = list, next list = *(*Tpng_compression_bufferp)(unsafe.Pointer(listp)) if list != libc.UintptrFromInt32(0) { *(*Tpng_compression_bufferp)(unsafe.Pointer(listp)) = libc.UintptrFromInt32(0) for cond := true; cond; cond = list != libc.UintptrFromInt32(0) { next = (*Tpng_compression_buffer1)(unsafe.Pointer(list)).Fnext Xpng_free(tls, png_ptr, list) list = next } } } // C documentation // // /* This pair of functions encapsulates the operation of (a) compressing a // * text string, and (b) issuing it later as a series of chunk data writes. // * The compression_state structure is shared context for these functions // * set up by the caller to allow access to the relevant local variables. // * // * compression_buffer (new in 1.6.0) is just a linked list of zbuffer_size // * temporary buffers. From 1.6.0 it is retained in png_struct so that it will // * be correctly freed in the event of a write error (previous implementations // * just leaked memory.) // */ type Tcompression_state = struct { Finput Tpng_const_bytep Finput_len Tpng_alloc_size_t Foutput_len Tpng_uint_32 Foutput [1024]Tpng_byte } func _png_text_compress_init(tls *libc.TLS, comp uintptr, input Tpng_const_bytep, input_len Tpng_alloc_size_t) { (*Tcompression_state)(unsafe.Pointer(comp)).Finput = input (*Tcompression_state)(unsafe.Pointer(comp)).Finput_len = input_len (*Tcompression_state)(unsafe.Pointer(comp)).Foutput_len = uint32(0) } // C documentation // // /* Compress the data in the compression state input */ func _png_text_compress(tls *libc.TLS, png_ptr Tpng_structrp, chunk_name Tpng_uint_32, comp uintptr, prefix_len Tpng_uint_32) (r int32) { var avail_in TuInt var end, next uintptr var input_len Tpng_alloc_size_t var output_len Tpng_uint_32 var ret, v1 int32 _, _, _, _, _, _, _ = avail_in, end, input_len, next, output_len, ret, v1 /* To find the length of the output it is necessary to first compress the * input. The result is buffered rather than using the two-pass algorithm * that is used on the inflate side; deflate is assumed to be slower and a * PNG writer is assumed to have more memory available than a PNG reader. * * IMPLEMENTATION NOTE: the zlib API deflateBound() can be used to find an * upper limit on the output size, but it is always bigger than the input * size so it is likely to be more efficient to use this linked-list * approach. */ ret = _png_deflate_claim(tls, png_ptr, chunk_name, (*Tcompression_state)(unsafe.Pointer(comp)).Finput_len) if ret != Z_OK { return ret } /* Set up the compression buffers, we need a loop here to avoid overflowing a * uInt. Use ZLIB_IO_MAX to limit the input. The output is always limited * by the output buffer size, so there is no need to check that. Since this * is ANSI-C we know that an 'int', hence a uInt, is always at least 16 bits * in size. */ end = png_ptr + 516 input_len = (*Tcompression_state)(unsafe.Pointer(comp)).Finput_len /* zlib updates these for us: */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_in = (*Tcompression_state)(unsafe.Pointer(comp)).Finput (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = uint32(0) /* Set below */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = comp + 12 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = libc.Uint32FromInt64(1024) output_len = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out for cond := true; cond; cond = ret == Z_OK { avail_in = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if avail_in > input_len { avail_in = input_len } input_len -= avail_in (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = avail_in if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out == uint32(0) { /* Chunk data is limited to 2^31 bytes in length, so the prefix * length must be counted here. */ if output_len+prefix_len > libc.Uint32FromInt32(0x7fffffff) { ret = -int32(4) break } /* Need a new (malloc'ed) buffer, but there may be one present * already. */ next = *(*Tpng_compression_bufferp)(unsafe.Pointer(end)) if next == libc.UintptrFromInt32(0) { next = Xpng_malloc_base(tls, png_ptr, uint32(libc.UintptrFromInt32(0)+4)+(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_size) if next == libc.UintptrFromInt32(0) { ret = -int32(4) break } /* Link in this buffer (so that it will be freed later) */ (*Tpng_compression_buffer)(unsafe.Pointer(next)).Fnext = libc.UintptrFromInt32(0) *(*Tpng_compression_bufferp)(unsafe.Pointer(end)) = next } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = next + 4 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_size output_len += (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out /* Move 'end' to the next buffer pointer. */ end = next } /* Compress the data */ if input_len > uint32(0) { v1 = Z_NO_FLUSH } else { v1 = int32(Z_FINISH) } ret = (*(*func(*libc.TLS, Tz_streamp, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflatePtr})))(tls, png_ptr+460, v1) /* Claw back input data that was not consumed (because avail_in is * reset above every time round the loop). */ input_len += (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = uint32(0) /* safety */ } /* There may be some space left in the last output buffer. This needs to * be subtracted from output_len. */ output_len -= (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = uint32(0) /* safety */ (*Tcompression_state)(unsafe.Pointer(comp)).Foutput_len = output_len /* Now double check the output length, put in a custom message if it is * too long. Otherwise ensure the z_stream::msg pointer is set to * something. */ if output_len+prefix_len >= libc.Uint32FromInt32(0x7fffffff) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fmsg = __ccgo_ts + 20361 ret = -int32(4) } else { Xpng_zstream_error(tls, png_ptr, ret) } /* Reset zlib for another zTXt/iTXt or image data */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner = uint32(0) /* The only success case is Z_STREAM_END, input_len must be 0; if not this * is an internal error. */ if ret == int32(Z_STREAM_END) && input_len == uint32(0) { /* Fix up the deflate header, if required */ _optimize_cmf(tls, comp+12, (*Tcompression_state)(unsafe.Pointer(comp)).Finput_len) /* But Z_OK is returned, not Z_STREAM_END; this allows the claim * function above to return Z_STREAM_END on an error (though it never * does in the current versions of zlib.) */ return Z_OK } else { return ret } return r } // C documentation // // /* Ship the compressed text out via chunk writes */ func _png_write_compressed_data_out(tls *libc.TLS, png_ptr Tpng_structrp, comp uintptr) { var avail, output_len Tpng_uint_32 var next uintptr var output Tpng_const_bytep _, _, _, _ = avail, next, output, output_len output_len = (*Tcompression_state)(unsafe.Pointer(comp)).Foutput_len output = comp + 12 avail = libc.Uint32FromInt64(1024) next = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_list for { if avail > output_len { avail = output_len } Xpng_write_chunk_data(tls, png_ptr, output, avail) output_len -= avail if output_len == uint32(0) || next == libc.UintptrFromInt32(0) { break } avail = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_size output = next + 4 next = (*Tpng_compression_buffer)(unsafe.Pointer(next)).Fnext goto _1 _1: } /* This is an internal error; 'next' must have been NULL! */ if output_len > uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+20386) } } // C documentation // // /* Write the IHDR chunk, and update the png_struct with the necessary // * information. Note that the rest of this code depends upon this // * information being correct. // */ func Xpng_write_IHDR(tls *libc.TLS, png_ptr Tpng_structrp, width Tpng_uint_32, height Tpng_uint_32, bit_depth int32, color_type int32, compression_type int32, filter_type int32, interlace_type int32) { bp := tls.Alloc(16) defer tls.Free(16) var is_invalid_depth int32 var v1 uint32 var _ /* buf at bp+0 */ [13]Tpng_byte _, _ = is_invalid_depth, v1 /* Check that we have valid input data from the application info */ switch color_type { case PNG_COLOR_TYPE_GRAY: switch bit_depth { case int32(1): fallthrough case int32(2): fallthrough case int32(4): fallthrough case int32(8): fallthrough case int32(16): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels = uint8(1) default: Xpng_error(tls, png_ptr, __ccgo_ts+20434) } case int32(PNG_COLOR_MASK_COLOR): is_invalid_depth = libc.BoolInt32(bit_depth != int32(8)) is_invalid_depth = libc.BoolInt32(is_invalid_depth != 0 && bit_depth != int32(16)) if is_invalid_depth != 0 { Xpng_error(tls, png_ptr, __ccgo_ts+20472) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels = uint8(3) case libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE): switch bit_depth { case int32(1): fallthrough case int32(2): fallthrough case int32(4): fallthrough case int32(8): (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels = uint8(1) default: Xpng_error(tls, png_ptr, __ccgo_ts+20504) } case int32(PNG_COLOR_MASK_ALPHA): is_invalid_depth = libc.BoolInt32(bit_depth != int32(8)) is_invalid_depth = libc.BoolInt32(is_invalid_depth != 0 && bit_depth != int32(16)) if is_invalid_depth != 0 { Xpng_error(tls, png_ptr, __ccgo_ts+20541) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels = uint8(2) case libc.Int32FromInt32(PNG_COLOR_MASK_COLOR) | libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA): is_invalid_depth = libc.BoolInt32(bit_depth != int32(8)) is_invalid_depth = libc.BoolInt32(is_invalid_depth != 0 && bit_depth != int32(16)) if is_invalid_depth != 0 { Xpng_error(tls, png_ptr, __ccgo_ts+20585) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels = uint8(4) default: Xpng_error(tls, png_ptr, __ccgo_ts+20618) } if compression_type != PNG_COMPRESSION_TYPE_BASE { Xpng_warning(tls, png_ptr, __ccgo_ts+20653) compression_type = PNG_COMPRESSION_TYPE_BASE } /* Write filter_method 64 (intrapixel differencing) only if * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and * 2. Libpng did not write a PNG signature (this filter_method is only * used in PNG datastreams that are embedded in MNG datastreams) and * 3. The application called png_permit_mng_features with a mask that * included PNG_FLAG_MNG_FILTER_64 and * 4. The filter_method is 64 and * 5. The color_type is RGB or RGBA */ if !((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmng_features_permitted&uint32(PNG_FLAG_MNG_FILTER_647) != uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x1000) == uint32(0) && (color_type == int32(PNG_COLOR_MASK_COLOR) || color_type == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_ALPHA)) && filter_type == int32(PNG_INTRAPIXEL_DIFFERENCING)) && filter_type != PNG_FILTER_TYPE_BASE { Xpng_warning(tls, png_ptr, __ccgo_ts+20688) filter_type = PNG_FILTER_TYPE_BASE } if interlace_type != PNG_INTERLACE_NONE && interlace_type != int32(PNG_INTERLACE_ADAM7) { Xpng_warning(tls, png_ptr, __ccgo_ts+20718) interlace_type = int32(PNG_INTERLACE_ADAM7) } /* Save the relevant information */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth = libc.Uint8FromInt32(bit_depth) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type = libc.Uint8FromInt32(color_type) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced = libc.Uint8FromInt32(interlace_type) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ffilter_type = libc.Uint8FromInt32(filter_type) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcompression_type = libc.Uint8FromInt32(compression_type) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth = width (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight = height (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth = libc.Uint8FromInt32(bit_depth * libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels)) if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) >= int32(8) { v1 = width * (uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v1 = (width*uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frowbytes = v1 /* Set the usr info, so any transformations can modify it */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_width = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_bit_depth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_channels = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fchannels /* Pack the header information into the buffer */ Xpng_save_uint_32(tls, bp, width) Xpng_save_uint_32(tls, bp+uintptr(4), height) (*(*[13]Tpng_byte)(unsafe.Pointer(bp)))[int32(8)] = libc.Uint8FromInt32(bit_depth) (*(*[13]Tpng_byte)(unsafe.Pointer(bp)))[int32(9)] = libc.Uint8FromInt32(color_type) (*(*[13]Tpng_byte)(unsafe.Pointer(bp)))[int32(10)] = libc.Uint8FromInt32(compression_type) (*(*[13]Tpng_byte)(unsafe.Pointer(bp)))[int32(11)] = libc.Uint8FromInt32(filter_type) (*(*[13]Tpng_byte)(unsafe.Pointer(bp)))[int32(12)] = libc.Uint8FromInt32(interlace_type) /* Write the chunk */ _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(73))< max_palette_length { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type) == libc.Int32FromInt32(PNG_COLOR_MASK_COLOR)|libc.Int32FromInt32(PNG_COLOR_MASK_PALETTE) { Xpng_error(tls, png_ptr, __ccgo_ts+20751) } else { Xpng_warning(tls, png_ptr, __ccgo_ts+20751) return } } if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcolor_type)&int32(PNG_COLOR_MASK_COLOR) == 0 { Xpng_warning(tls, png_ptr, __ccgo_ts+20787) return } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette = uint16(num_pal) _png_write_chunk_header(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(80))<zstream by // * checking and (at the end) clearing png_ptr->zowner; it does some sanity // * checks on the 'mode' flags while doing this. // */ func Xpng_compress_IDAT(tls *libc.TLS, png_ptr Tpng_structrp, input Tpng_const_bytep, input_len Tpng_alloc_size_t, flush int32) { var avail, size, size1 TuInt var data, data1 Tpng_bytep var ret, v2 int32 _, _, _, _, _, _, _ = avail, data, data1, ret, size, size1, v2 if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzowner != libc.Uint32FromInt32(libc.Int32FromInt32(73))<zstream, so it must be * initialized here after the claim. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_out = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_list + 4 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_size } /* Now loop reading and writing until all the input is consumed or an error * terminates the operation. The _out values are maintained across calls to * this function, but the input must be reset each time. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Fnext_in = input (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = uint32(0) /* set below */ for { /* INPUT: from the row data */ avail = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if avail > input_len { avail = input_len } /* safe because of the check */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = avail input_len -= avail if input_len > uint32(0) { v2 = Z_NO_FLUSH } else { v2 = flush } ret = (*(*func(*libc.TLS, Tz_streamp, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflatePtr})))(tls, png_ptr+460, v2) /* Include as-yet unconsumed input */ input_len += (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_in = uint32(0) /* OUTPUT: write complete IDAT chunks when avail_out drops to zero. Note * that these two zstream fields are preserved across the calls, therefore * there is no need to set these up on entry to the loop. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzstream.Favail_out == uint32(0) { data = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_list + 4 size = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fzbuffer_size /* Write an IDAT containing the data then reset the buffer. The * first IDAT may need deflate header optimization. */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmode&uint32(0x04) == uint32(0) && libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fcompression_type) == PNG_COMPRESSION_TYPE_BASE { _optimize_cmf(tls, data, _png_image_size(tls, png_ptr)) } if size > uint32(0) { _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(73))< uint32(0) { _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(73))<= int32(PNG_sRGB_INTENT_LAST) { Xpng_warning(tls, png_ptr, __ccgo_ts+20878) } (*(*[1]Tpng_byte)(unsafe.Pointer(bp)))[0] = libc.Uint8FromInt32(srgb_intent) _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(115))< uint32(3) && profile_len&uint32(0x03) != 0 { Xpng_error(tls, png_ptr, __ccgo_ts+20966) } embedded_profile_len = uint32(*(*Tpng_byte)(unsafe.Pointer(profile)))< libc.Int32FromUint8(maxbits) || libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sbit)).Fgreen) == 0 || libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sbit)).Fgreen) > libc.Int32FromUint8(maxbits) || libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sbit)).Fblue) == 0 || libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sbit)).Fblue) > libc.Int32FromUint8(maxbits) { Xpng_warning(tls, png_ptr, __ccgo_ts+21097) return } (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[0] = (*Tpng_color_8)(unsafe.Pointer(sbit)).Fred (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[int32(1)] = (*Tpng_color_8)(unsafe.Pointer(sbit)).Fgreen (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[int32(2)] = (*Tpng_color_8)(unsafe.Pointer(sbit)).Fblue size = uint32(3) } else { if libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sbit)).Fgray) == 0 || libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sbit)).Fgray) > libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_bit_depth) { Xpng_warning(tls, png_ptr, __ccgo_ts+21097) return } (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[0] = (*Tpng_color_8)(unsafe.Pointer(sbit)).Fgray size = uint32(1) } if color_type&int32(PNG_COLOR_MASK_ALPHA) != 0 { if libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sbit)).Falpha) == 0 || libc.Int32FromUint8((*Tpng_color_8)(unsafe.Pointer(sbit)).Falpha) > libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_bit_depth) { Xpng_warning(tls, png_ptr, __ccgo_ts+21097) return } v2 = size size++ (*(*[4]Tpng_byte)(unsafe.Pointer(bp)))[v2] = (*Tpng_color_8)(unsafe.Pointer(sbit)).Falpha } _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(115))< libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) { Xpng_app_warning(tls, png_ptr, __ccgo_ts+21126) return } /* Write the chunk out as it is */ _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(116))<= int32(1)<<(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth { Xpng_app_warning(tls, png_ptr, __ccgo_ts+21173) return } Xpng_save_uint_16(tls, bp, uint32((*Tpng_color_16)(unsafe.Pointer(tran)).Fgray)) _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(116))<= libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) { Xpng_warning(tls, png_ptr, __ccgo_ts+21340) return } (*(*[6]Tpng_byte)(unsafe.Pointer(bp)))[0] = (*Tpng_color_16)(unsafe.Pointer(back)).Findex _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(98))<= int32(1)<<(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fbit_depth { Xpng_warning(tls, png_ptr, __ccgo_ts+21437) return } Xpng_save_uint_16(tls, bp, uint32((*Tpng_color_16)(unsafe.Pointer(back)).Fgray)) _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(98))< libc.Int32FromUint16((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_palette) { Xpng_warning(tls, png_ptr, __ccgo_ts+21501) return } _png_write_chunk_header(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(104))< libc.Uint32FromInt32(0x7fffffff)-(key_len+uint32(1)) { Xpng_error(tls, png_ptr, __ccgo_ts+21569) } /* Make sure we include the 0 after the key */ _png_write_chunk_header(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(116))< libc.Uint32FromInt32(0x7fffffff)-prefix_len { prefix_len = libc.Uint32FromInt32(0x7fffffff) } else { prefix_len = prefix_len + lang_len } if lang_key_len > libc.Uint32FromInt32(0x7fffffff)-prefix_len { prefix_len = libc.Uint32FromInt32(0x7fffffff) } else { prefix_len = prefix_len + lang_key_len } _png_text_compress_init(tls, bp+84, text, libc.Xstrlen(tls, text)) if compression != 0 { if _png_text_compress(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(105))< libc.Uint32FromInt32(0x7fffffff)-prefix_len { Xpng_error(tls, png_ptr, __ccgo_ts+21690) } /* So the string will fit in a chunk: */ (*(*Tcompression_state)(unsafe.Pointer(bp + 84))).Foutput_len = (*(*Tcompression_state)(unsafe.Pointer(bp + 84))).Finput_len } _png_write_chunk_header(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(105))<= int32(PNG_OFFSET_LAST) { Xpng_warning(tls, png_ptr, __ccgo_ts+21723) } Xpng_save_int_32(tls, bp, x_offset) Xpng_save_int_32(tls, bp+uintptr(4), y_offset) (*(*[9]Tpng_byte)(unsafe.Pointer(bp)))[int32(8)] = libc.Uint8FromInt32(unit_type) _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(111))<= int32(PNG_EQUATION_LAST) { Xpng_error(tls, png_ptr, __ccgo_ts+21761) } purpose_len = Xpng_check_keyword(tls, png_ptr, purpose, bp+10) if purpose_len == uint32(0) { Xpng_error(tls, png_ptr, __ccgo_ts+21803) } purpose_len++ /* terminator */ if nparams == 0 { v1 = 0 } else { v1 = int32(1) } units_len = libc.Xstrlen(tls, units) + libc.Uint32FromInt32(v1) total_len = purpose_len + units_len + uint32(10) params_len = Xpng_malloc(tls, png_ptr, libc.Uint32FromInt32(nparams)*libc.Uint32FromInt64(4)) /* Find the length of each parameter, making sure we don't count the * null terminator for the last parameter. */ i = 0 for { if !(i < nparams) { break } if i == nparams-int32(1) { v3 = 0 } else { v3 = int32(1) } *(*Tsize_t)(unsafe.Pointer(params_len + uintptr(i)*4)) = libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(params + uintptr(i)*4))) + libc.Uint32FromInt32(v3) total_len += *(*Tsize_t)(unsafe.Pointer(params_len + uintptr(i)*4)) goto _2 _2: ; i++ } _png_write_chunk_header(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(112))< uint32(64) { Xpng_warning(tls, png_ptr, __ccgo_ts+21825) return } (*(*[64]Tpng_byte)(unsafe.Pointer(bp)))[0] = libc.Uint8FromInt32(unit) libc.Xmemcpy(tls, bp+uintptr(1), width, wlen+uint32(1)) /* Append the '\0' here */ libc.Xmemcpy(tls, bp+uintptr(wlen)+uintptr(2), height, hlen) /* Do NOT append the '\0' here */ _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(115))<= int32(PNG_RESOLUTION_LAST) { Xpng_warning(tls, png_ptr, __ccgo_ts+21861) } Xpng_save_uint_32(tls, bp, x_pixels_per_unit) Xpng_save_uint_32(tls, bp+uintptr(4), y_pixels_per_unit) (*(*[9]Tpng_byte)(unsafe.Pointer(bp)))[int32(8)] = libc.Uint8FromInt32(unit_type) _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(112))< int32(12) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fmonth) < int32(1) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fday) > int32(31) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fday) < int32(1) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fhour) > int32(23) || libc.Int32FromUint8((*Tpng_time)(unsafe.Pointer(mod_time)).Fsecond) > int32(60) { Xpng_warning(tls, png_ptr, __ccgo_ts+21899) return } Xpng_save_uint_16(tls, bp, uint32((*Tpng_time)(unsafe.Pointer(mod_time)).Fyear)) (*(*[7]Tpng_byte)(unsafe.Pointer(bp)))[int32(2)] = (*Tpng_time)(unsafe.Pointer(mod_time)).Fmonth (*(*[7]Tpng_byte)(unsafe.Pointer(bp)))[int32(3)] = (*Tpng_time)(unsafe.Pointer(mod_time)).Fday (*(*[7]Tpng_byte)(unsafe.Pointer(bp)))[int32(4)] = (*Tpng_time)(unsafe.Pointer(mod_time)).Fhour (*(*[7]Tpng_byte)(unsafe.Pointer(bp)))[int32(5)] = (*Tpng_time)(unsafe.Pointer(mod_time)).Fminute (*(*[7]Tpng_byte)(unsafe.Pointer(bp)))[int32(6)] = (*Tpng_time)(unsafe.Pointer(mod_time)).Fsecond _png_write_complete_chunk(tls, png_ptr, libc.Uint32FromInt32(libc.Int32FromInt32(116))<= int32(8) { v1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth * (libc.Uint32FromInt32(usr_pixel_depth) >> libc.Int32FromInt32(3)) } else { v1 = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth*libc.Uint32FromInt32(usr_pixel_depth) + uint32(7)) >> int32(3) } buf_size = v1 + uint32(1) /* 1.5.6: added to allow checking in the row write code. */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformed_pixel_depth = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpixel_depth (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fmaximum_pixel_depth = libc.Uint8FromInt32(usr_pixel_depth) /* Set up row buffer */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf = Xpng_malloc(tls, png_ptr, buf_size) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf)) = uint8(PNG_FILTER_VALUE_NONE) filters = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fdo_filter if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight == uint32(1) { filters = Tpng_byte(int32(filters) & (libc.Int32FromInt32(0xff) & ^(libc.Int32FromInt32(PNG_FILTER_UP3) | libc.Int32FromInt32(PNG_FILTER_AVG3) | libc.Int32FromInt32(PNG_FILTER_PAETH3)))) } if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth == uint32(1) { filters = Tpng_byte(int32(filters) & (libc.Int32FromInt32(0xff) & ^(libc.Int32FromInt32(PNG_FILTER_SUB3) | libc.Int32FromInt32(PNG_FILTER_AVG3) | libc.Int32FromInt32(PNG_FILTER_PAETH3)))) } if libc.Int32FromUint8(filters) == 0 { filters = uint8(PNG_FILTER_NONE3) } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fdo_filter = filters if libc.Int32FromUint8(filters)&(libc.Int32FromInt32(PNG_FILTER_SUB3)|libc.Int32FromInt32(PNG_FILTER_UP3)|libc.Int32FromInt32(PNG_FILTER_AVG3)|libc.Int32FromInt32(PNG_FILTER_PAETH3)) != 0 && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row == libc.UintptrFromInt32(0) { num_filters = 0 (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row = Xpng_malloc(tls, png_ptr, buf_size) if libc.Int32FromUint8(filters)&int32(PNG_FILTER_SUB3) != 0 { num_filters++ } if libc.Int32FromUint8(filters)&int32(PNG_FILTER_UP3) != 0 { num_filters++ } if libc.Int32FromUint8(filters)&int32(PNG_FILTER_AVG3) != 0 { num_filters++ } if libc.Int32FromUint8(filters)&int32(PNG_FILTER_PAETH3) != 0 { num_filters++ } if num_filters > int32(1) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row = Xpng_malloc(tls, png_ptr, buf_size) } } /* We only need to keep the previous row if we are using one of the following * filters. */ if libc.Int32FromUint8(filters)&(libc.Int32FromInt32(PNG_FILTER_AVG3)|libc.Int32FromInt32(PNG_FILTER_UP3)|libc.Int32FromInt32(PNG_FILTER_PAETH3)) != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row = Xpng_calloc(tls, png_ptr, buf_size) } /* If interlaced, we need to set up width and height of pass */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) == uint32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight + uint32(_png_pass_yinc3[0]) - uint32(1) - uint32(_png_pass_ystart3[0])) / uint32(_png_pass_yinc3[0]) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_width = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth + uint32(_png_pass_inc4[0]) - uint32(1) - uint32(_png_pass_start3[0])) / uint32(_png_pass_inc4[0]) } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_width = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth } } else { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_width = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth } } /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ var _png_pass_start3 = [7]Tpng_byte{ 1: uint8(4), 3: uint8(2), 5: uint8(1), } /* Offset to next interlace block */ var _png_pass_inc4 = [7]Tpng_byte{ 0: uint8(8), 1: uint8(8), 2: uint8(4), 3: uint8(4), 4: uint8(2), 5: uint8(2), 6: uint8(1), } /* Start of interlace block in the y direction */ var _png_pass_ystart3 = [7]Tpng_byte{ 2: uint8(4), 4: uint8(2), 6: uint8(1), } /* Offset to next interlace block in the y direction */ var _png_pass_yinc3 = [7]Tpng_byte{ 0: uint8(8), 1: uint8(8), 2: uint8(8), 3: uint8(4), 4: uint8(4), 5: uint8(2), 6: uint8(2), } // C documentation // // /* Internal use only. Called when finished processing a row of data. */ func Xpng_write_finish_row(tls *libc.TLS, png_ptr Tpng_structrp) { var v1 uint32 _ = v1 /* Next row */ (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number++ /* See if we are done */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number < (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows { return } /* If interlaced, go to next pass */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Finterlaced) != 0 { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_number = uint32(0) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) != uint32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass++ } else { /* Loop until we find a non-zero width or height pass */ for cond := true; cond; cond = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_width == uint32(0) || (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows == uint32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass++ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) >= int32(7) { break } (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_width = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth + uint32(_png_pass_inc5[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) - uint32(1) - uint32(_png_pass_start4[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass])) / uint32(_png_pass_inc5[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fnum_rows = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fheight + uint32(_png_pass_yinc4[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) - uint32(1) - uint32(_png_pass_ystart4[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass])) / uint32(_png_pass_yinc4[(*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass]) if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftransformations&uint32(0x0002) != uint32(0) { break } } } /* Reset the row above the image for the next pass */ if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fpass) < int32(7) { if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row != libc.UintptrFromInt32(0) { if libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_channels)*libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_bit_depth) >= int32(8) { v1 = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth * (libc.Uint32FromInt32(libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_channels)*libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_bit_depth)) >> libc.Int32FromInt32(3)) } else { v1 = ((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fwidth*libc.Uint32FromInt32(libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_channels)*libc.Int32FromUint8((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fusr_bit_depth)) + uint32(7)) >> int32(3) } libc.Xmemset(tls, (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row, 0, v1+uint32(1)) } return } } /* If we get here, we've just written the last row, so we need to flush the compressor */ Xpng_compress_IDAT(tls, png_ptr, libc.UintptrFromInt32(0), uint32(0), int32(Z_FINISH)) } /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ var _png_pass_start4 = [7]Tpng_byte{ 1: uint8(4), 3: uint8(2), 5: uint8(1), } /* Offset to next interlace block */ var _png_pass_inc5 = [7]Tpng_byte{ 0: uint8(8), 1: uint8(8), 2: uint8(4), 3: uint8(4), 4: uint8(2), 5: uint8(2), 6: uint8(1), } /* Start of interlace block in the y direction */ var _png_pass_ystart4 = [7]Tpng_byte{ 2: uint8(4), 4: uint8(2), 6: uint8(1), } /* Offset to next interlace block in the y direction */ var _png_pass_yinc4 = [7]Tpng_byte{ 0: uint8(8), 1: uint8(8), 2: uint8(8), 3: uint8(4), 4: uint8(4), 5: uint8(2), 6: uint8(2), } // C documentation // // /* Pick out the correct pixels for the interlace pass. // * The basic idea here is to go through the row with a source // * pointer and a destination pointer (sp and dp), and copy the // * correct pixels for the pass. As the row gets compacted, // * sp will always be >= dp, so we should never overwrite anything. // * See the default: case for the easiest code to understand. // */ func Xpng_do_write_interlace(tls *libc.TLS, row_info Tpng_row_infop, row Tpng_bytep, pass int32) { var d, d1, d2, value, value1, value2 int32 var dp, dp1, dp2, dp3, sp, sp1, sp2, sp3, v2, v4, v6 Tpng_bytep var i, i1, i2, i3, row_width, row_width1, row_width2, row_width3 Tpng_uint_32 var pixel_bytes Tsize_t var shift, shift1, shift2, v8 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = d, d1, d2, dp, dp1, dp2, dp3, i, i1, i2, i3, pixel_bytes, row_width, row_width1, row_width2, row_width3, shift, shift1, shift2, sp, sp1, sp2, sp3, value, value1, value2, v2, v4, v6, v8 /* We don't have to do anything on the last pass (6) */ if pass < int32(6) { /* Each pixel depth is handled separately */ switch libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) { case int32(1): row_width = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth dp = row d = 0 shift = uint32(7) i = uint32(_png_pass_start5[pass]) for { if !(i < row_width) { break } sp = row + uintptr(i>>libc.Int32FromInt32(3)) value = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp))) >> (libc.Int32FromInt32(7) - libc.Int32FromUint32(i&libc.Uint32FromInt32(0x07))) & int32(0x01) d |= value << shift if shift == uint32(0) { shift = uint32(7) v2 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v2)) = libc.Uint8FromInt32(d) d = 0 } else { shift-- } goto _1 _1: ; i += uint32(_png_pass_inc6[pass]) } if shift != uint32(7) { *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32(d) } case int32(2): row_width1 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth dp1 = row shift1 = uint32(6) d1 = 0 i1 = uint32(_png_pass_start5[pass]) for { if !(i1 < row_width1) { break } sp1 = row + uintptr(i1>>libc.Int32FromInt32(2)) value1 = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp1))) >> ((int32(3) - libc.Int32FromUint32(i1&libc.Uint32FromInt32(0x03))) << int32(1)) & int32(0x03) d1 |= value1 << shift1 if shift1 == uint32(0) { shift1 = uint32(6) v4 = dp1 dp1++ *(*Tpng_byte)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(d1) d1 = 0 } else { shift1 -= uint32(2) } goto _3 _3: ; i1 += uint32(_png_pass_inc6[pass]) } if shift1 != uint32(6) { *(*Tpng_byte)(unsafe.Pointer(dp1)) = libc.Uint8FromInt32(d1) } case int32(4): row_width2 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth dp2 = row shift2 = uint32(4) d2 = 0 i2 = uint32(_png_pass_start5[pass]) for { if !(i2 < row_width2) { break } sp2 = row + uintptr(i2>>libc.Int32FromInt32(1)) value2 = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(sp2))) >> ((int32(1) - libc.Int32FromUint32(i2&libc.Uint32FromInt32(0x01))) << int32(2)) & int32(0x0f) d2 |= value2 << shift2 if shift2 == uint32(0) { shift2 = uint32(4) v6 = dp2 dp2++ *(*Tpng_byte)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(d2) d2 = 0 } else { shift2 -= uint32(4) } goto _5 _5: ; i2 += uint32(_png_pass_inc6[pass]) } if shift2 != uint32(4) { *(*Tpng_byte)(unsafe.Pointer(dp2)) = libc.Uint8FromInt32(d2) } default: row_width3 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth /* Start at the beginning */ dp3 = row /* Find out how many bytes each pixel takes up */ pixel_bytes = libc.Uint32FromInt32(libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) /* Loop through the row, only looking at the pixels that matter */ i3 = uint32(_png_pass_start5[pass]) for { if !(i3 < row_width3) { break } /* Find out where the original pixel is */ sp3 = row + uintptr(i3*pixel_bytes) /* Move the pixel */ if dp3 != sp3 { libc.Xmemcpy(tls, dp3, sp3, pixel_bytes) } /* Next pixel */ dp3 += uintptr(pixel_bytes) goto _7 _7: ; i3 += uint32(_png_pass_inc6[pass]) } break } /* Set new row width */ (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth = ((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth + uint32(_png_pass_inc6[pass]) - uint32(1) - uint32(_png_pass_start5[pass])) / uint32(_png_pass_inc6[pass]) if libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >= int32(8) { v8 = (*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth * (uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) >> libc.Int32FromInt32(3)) } else { v8 = ((*Tpng_row_info)(unsafe.Pointer(row_info)).Fwidth*uint32((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + uint32(7)) >> int32(3) } (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes = v8 } } /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ var _png_pass_start5 = [7]Tpng_byte{ 1: uint8(4), 3: uint8(2), 5: uint8(1), } /* Offset to next interlace block */ var _png_pass_inc6 = [7]Tpng_byte{ 0: uint8(8), 1: uint8(8), 2: uint8(4), 3: uint8(4), 4: uint8(2), 5: uint8(2), 6: uint8(1), } func _png_setup_sub_row(tls *libc.TLS, png_ptr Tpng_structrp, bpp Tpng_uint_32, row_bytes Tsize_t, lmins Tsize_t) (r Tsize_t) { var dp, lp, rp Tpng_bytep var i, sum Tsize_t var v, v3, v6 uint32 var v2, v5 Tpng_byte _, _, _, _, _, _, _, _, _, _ = dp, i, lp, rp, sum, v, v2, v3, v5, v6 sum = uint32(0) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row)) = uint8(PNG_FILTER_VALUE_SUB) i = uint32(0) rp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) dp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row + libc.UintptrFromInt32(1) for { if !(i < bpp) { break } v2 = *(*Tpng_byte)(unsafe.Pointer(rp)) *(*Tpng_byte)(unsafe.Pointer(dp)) = v2 v = uint32(v2) if v < uint32(128) { v3 = v } else { v3 = uint32(256) - v } sum += v3 goto _1 _1: ; i++ rp++ dp++ } lp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) for { if !(i < row_bytes) { break } v5 = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(lp)))) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(dp)) = v5 v = uint32(v5) if v < uint32(128) { v6 = v } else { v6 = uint32(256) - v } sum += v6 if sum > lmins { /* We are already worse, don't continue. */ break } goto _4 _4: ; i++ rp++ lp++ dp++ } return sum } func _png_setup_sub_row_only(tls *libc.TLS, png_ptr Tpng_structrp, bpp Tpng_uint_32, row_bytes Tsize_t) { var dp, lp, rp Tpng_bytep var i Tsize_t _, _, _, _ = dp, i, lp, rp *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row)) = uint8(PNG_FILTER_VALUE_SUB) i = uint32(0) rp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) dp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row + libc.UintptrFromInt32(1) for { if !(i < bpp) { break } *(*Tpng_byte)(unsafe.Pointer(dp)) = *(*Tpng_byte)(unsafe.Pointer(rp)) goto _1 _1: ; i++ rp++ dp++ } lp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) for { if !(i < row_bytes) { break } *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(lp)))) & libc.Int32FromInt32(0xff)) goto _2 _2: ; i++ rp++ lp++ dp++ } } func _png_setup_up_row(tls *libc.TLS, png_ptr Tpng_structrp, row_bytes Tsize_t, lmins Tsize_t) (r Tsize_t) { var dp, pp, rp Tpng_bytep var i, sum Tsize_t var v, v3 uint32 var v2 Tpng_byte _, _, _, _, _, _, _, _ = dp, i, pp, rp, sum, v, v2, v3 sum = uint32(0) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row)) = uint8(PNG_FILTER_VALUE_UP) i = uint32(0) rp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) dp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row + uintptr(1) pp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row + libc.UintptrFromInt32(1) for { if !(i < row_bytes) { break } v2 = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(pp)))) & libc.Int32FromInt32(0xff)) *(*Tpng_byte)(unsafe.Pointer(dp)) = v2 v = uint32(v2) if v < uint32(128) { v3 = v } else { v3 = uint32(256) - v } sum += v3 if sum > lmins { /* We are already worse, don't continue. */ break } goto _1 _1: ; i++ rp++ pp++ dp++ } return sum } func _png_setup_up_row_only(tls *libc.TLS, png_ptr Tpng_structrp, row_bytes Tsize_t) { var dp, pp, rp Tpng_bytep var i Tsize_t _, _, _, _ = dp, i, pp, rp *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row)) = uint8(PNG_FILTER_VALUE_UP) i = uint32(0) rp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) dp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row + uintptr(1) pp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row + libc.UintptrFromInt32(1) for { if !(i < row_bytes) { break } *(*Tpng_byte)(unsafe.Pointer(dp)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(rp))) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(pp)))) & libc.Int32FromInt32(0xff)) goto _1 _1: ; i++ rp++ pp++ dp++ } } func _png_setup_avg_row(tls *libc.TLS, png_ptr Tpng_structrp, bpp Tpng_uint_32, row_bytes Tsize_t, lmins Tsize_t) (r Tsize_t) { var dp, lp, pp, rp, v10, v11, v12, v3, v4, v5, v9 Tpng_bytep var i Tpng_uint_32 var sum Tsize_t var v, v13, v6 uint32 var v2, v8 Tpng_byte _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dp, i, lp, pp, rp, sum, v, v10, v11, v12, v13, v2, v3, v4, v5, v6, v8, v9 sum = uint32(0) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row)) = uint8(PNG_FILTER_VALUE_AVG) i = uint32(0) rp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) dp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row + uintptr(1) pp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row + libc.UintptrFromInt32(1) for { if !(i < bpp) { break } v3 = rp rp++ v4 = pp pp++ v2 = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v3))) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v4)))/libc.Int32FromInt32(2)) & libc.Int32FromInt32(0xff)) v5 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v5)) = v2 v = uint32(v2) if v < uint32(128) { v6 = v } else { v6 = uint32(256) - v } sum += v6 goto _1 _1: ; i++ } lp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) for { if !(i < row_bytes) { break } v9 = rp rp++ v10 = pp pp++ v11 = lp lp++ v8 = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v9))) - (libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v10)))+libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v11))))/libc.Int32FromInt32(2)) & libc.Int32FromInt32(0xff)) v12 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v12)) = v8 v = uint32(v8) if v < uint32(128) { v13 = v } else { v13 = uint32(256) - v } sum += v13 if sum > lmins { /* We are already worse, don't continue. */ break } goto _7 _7: ; i++ } return sum } func _png_setup_avg_row_only(tls *libc.TLS, png_ptr Tpng_structrp, bpp Tpng_uint_32, row_bytes Tsize_t) { var dp, lp, pp, rp, v2, v3, v4, v6, v7, v8, v9 Tpng_bytep var i Tpng_uint_32 _, _, _, _, _, _, _, _, _, _, _, _ = dp, i, lp, pp, rp, v2, v3, v4, v6, v7, v8, v9 *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row)) = uint8(PNG_FILTER_VALUE_AVG) i = uint32(0) rp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) dp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row + uintptr(1) pp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row + libc.UintptrFromInt32(1) for { if !(i < bpp) { break } v2 = dp dp++ v3 = rp rp++ v4 = pp pp++ *(*Tpng_byte)(unsafe.Pointer(v2)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v3))) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v4)))/libc.Int32FromInt32(2)) & libc.Int32FromInt32(0xff)) goto _1 _1: ; i++ } lp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) for { if !(i < row_bytes) { break } v6 = dp dp++ v7 = rp rp++ v8 = pp pp++ v9 = lp lp++ *(*Tpng_byte)(unsafe.Pointer(v6)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v7))) - (libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v8)))+libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v9))))/libc.Int32FromInt32(2)) & libc.Int32FromInt32(0xff)) goto _5 _5: ; i++ } } func _png_setup_paeth_row(tls *libc.TLS, png_ptr Tpng_structrp, bpp Tpng_uint_32, row_bytes Tsize_t, lmins Tsize_t) (r Tsize_t) { var a, b, c, p, pa, pb, pc, v11, v12, v13, v14, v15 int32 var cp, dp, lp, pp, rp, v10, v17, v18, v3, v4, v5, v8, v9 Tpng_bytep var i, sum Tsize_t var v, v19, v6 uint32 var v16, v2 Tpng_byte _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, b, c, cp, dp, i, lp, p, pa, pb, pc, pp, rp, sum, v, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v3, v4, v5, v6, v8, v9 sum = uint32(0) *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row)) = uint8(PNG_FILTER_VALUE_PAETH) i = uint32(0) rp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) dp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row + uintptr(1) pp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row + libc.UintptrFromInt32(1) for { if !(i < bpp) { break } v3 = rp rp++ v4 = pp pp++ v2 = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v3))) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v4)))) & libc.Int32FromInt32(0xff)) v5 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v5)) = v2 v = uint32(v2) if v < uint32(128) { v6 = v } else { v6 = uint32(256) - v } sum += v6 goto _1 _1: ; i++ } lp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) cp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row + libc.UintptrFromInt32(1) for { if !(i < row_bytes) { break } v8 = pp pp++ b = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v8))) v9 = cp cp++ c = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v9))) v10 = lp lp++ a = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v10))) p = b - c pc = a - c if p < 0 { v11 = -p } else { v11 = p } pa = v11 if pc < 0 { v12 = -pc } else { v12 = pc } pb = v12 if p+pc < 0 { v13 = -(p + pc) } else { v13 = p + pc } pc = v13 if pa <= pb && pa <= pc { v14 = a } else { if pb <= pc { v15 = b } else { v15 = c } v14 = v15 } p = v14 v17 = rp rp++ v16 = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v17))) - p) & libc.Int32FromInt32(0xff)) v18 = dp dp++ *(*Tpng_byte)(unsafe.Pointer(v18)) = v16 v = uint32(v16) if v < uint32(128) { v19 = v } else { v19 = uint32(256) - v } sum += v19 if sum > lmins { /* We are already worse, don't continue. */ break } goto _7 _7: ; i++ } return sum } func _png_setup_paeth_row_only(tls *libc.TLS, png_ptr Tpng_structrp, bpp Tpng_uint_32, row_bytes Tsize_t) { var a, b, c, p, pa, pb, pc, v10, v11, v12, v13, v9 int32 var cp, dp, lp, pp, rp, v14, v15, v2, v3, v4, v6, v7, v8 Tpng_bytep var i Tsize_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a, b, c, cp, dp, i, lp, p, pa, pb, pc, pp, rp, v10, v11, v12, v13, v14, v15, v2, v3, v4, v6, v7, v8, v9 *(*Tpng_byte)(unsafe.Pointer((*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row)) = uint8(PNG_FILTER_VALUE_PAETH) i = uint32(0) rp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) dp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row + uintptr(1) pp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row + libc.UintptrFromInt32(1) for { if !(i < bpp) { break } v2 = dp dp++ v3 = rp rp++ v4 = pp pp++ *(*Tpng_byte)(unsafe.Pointer(v2)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v3))) - libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v4)))) & libc.Int32FromInt32(0xff)) goto _1 _1: ; i++ } lp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf + uintptr(1) cp = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row + libc.UintptrFromInt32(1) for { if !(i < row_bytes) { break } v6 = pp pp++ b = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v6))) v7 = cp cp++ c = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v7))) v8 = lp lp++ a = libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v8))) p = b - c pc = a - c if p < 0 { v9 = -p } else { v9 = p } pa = v9 if pc < 0 { v10 = -pc } else { v10 = pc } pb = v10 if p+pc < 0 { v11 = -(p + pc) } else { v11 = p + pc } pc = v11 if pa <= pb && pa <= pc { v12 = a } else { if pb <= pc { v13 = b } else { v13 = c } v12 = v13 } p = v12 v14 = dp dp++ v15 = rp rp++ *(*Tpng_byte)(unsafe.Pointer(v14)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tpng_byte)(unsafe.Pointer(v15))) - p) & libc.Int32FromInt32(0xff)) goto _5 _5: ; i++ } } func Xpng_write_find_filter(tls *libc.TLS, png_ptr Tpng_structrp, row_info Tpng_row_infop) { var best_row, row_buf, rp Tpng_bytep var bpp Tpng_uint_32 var filter_to_do, v, v2 uint32 var i, lmins, lmins1, lmins2, lmins3, mins, row_bytes, sum, sum1, sum2, sum3, sum4 Tsize_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = best_row, bpp, filter_to_do, i, lmins, lmins1, lmins2, lmins3, mins, row_buf, row_bytes, rp, sum, sum1, sum2, sum3, sum4, v, v2 filter_to_do = uint32((*Tpng_struct)(unsafe.Pointer(png_ptr)).Fdo_filter) row_bytes = (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes /* Find out how many bytes offset each pixel is */ bpp = libc.Uint32FromInt32((libc.Int32FromUint8((*Tpng_row_info)(unsafe.Pointer(row_info)).Fpixel_depth) + int32(7)) >> int32(3)) row_buf = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf mins = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) - libc.Uint32FromInt32(256) /* The prediction method we use is to find which method provides the * smallest value when summing the absolute values of the distances * from zero, using anything >= 128 as negative numbers. This is known * as the "minimum sum of absolute differences" heuristic. Other * heuristics are the "weighted minimum sum of absolute differences" * (experimental and can in theory improve compression), and the "zlib * predictive" method (not implemented yet), which does test compressions * of lines using different filter methods, and then chooses the * (series of) filter(s) that give minimum compressed data size (VERY * computationally expensive). * * GRR 980525: consider also * * (1) minimum sum of absolute differences from running average (i.e., * keep running sum of non-absolute differences & count of bytes) * [track dispersion, too? restart average if dispersion too large?] * * (1b) minimum sum of absolute differences from sliding average, probably * with window size <= deflate window (usually 32K) * * (2) minimum sum of squared differences from zero or running average * (i.e., ~ root-mean-square approach) */ /* We don't need to test the 'no filter' case if this is the only filter * that has been chosen, as it doesn't actually do anything to the data. */ best_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf if libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt32(128) <= row_bytes { /* Overflow can occur in the calculation, just select the lowest set * filter. */ filter_to_do &= 0 - filter_to_do } else { if filter_to_do&uint32(PNG_FILTER_NONE3) != uint32(0) && filter_to_do != uint32(PNG_FILTER_NONE3) { sum = uint32(0) i = uint32(0) rp = row_buf + libc.UintptrFromInt32(1) for { if !(i < row_bytes) { break } v = uint32(*(*Tpng_byte)(unsafe.Pointer(rp))) if v < uint32(128) { v2 = v } else { v2 = uint32(256) - v } sum += v2 goto _1 _1: ; i++ rp++ } mins = sum } } /* Sub filter */ if filter_to_do == uint32(PNG_FILTER_SUB3) { /* It's the only filter so no testing is needed */ _png_setup_sub_row_only(tls, png_ptr, bpp, row_bytes) best_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row } else { if filter_to_do&uint32(PNG_FILTER_SUB3) != uint32(0) { lmins = mins sum1 = _png_setup_sub_row(tls, png_ptr, bpp, row_bytes, lmins) if sum1 < mins { mins = sum1 best_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row = best_row } } } } /* Up filter */ if filter_to_do == uint32(PNG_FILTER_UP3) { _png_setup_up_row_only(tls, png_ptr, row_bytes) best_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row } else { if filter_to_do&uint32(PNG_FILTER_UP3) != uint32(0) { lmins1 = mins sum2 = _png_setup_up_row(tls, png_ptr, row_bytes, lmins1) if sum2 < mins { mins = sum2 best_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row = best_row } } } } /* Avg filter */ if filter_to_do == uint32(PNG_FILTER_AVG3) { _png_setup_avg_row_only(tls, png_ptr, bpp, row_bytes) best_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row } else { if filter_to_do&uint32(PNG_FILTER_AVG3) != uint32(0) { lmins2 = mins sum3 = _png_setup_avg_row(tls, png_ptr, bpp, row_bytes, lmins2) if sum3 < mins { mins = sum3 best_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row = best_row } } } } /* Paeth filter */ if filter_to_do == uint32(PNG_FILTER_PAETH3) { _png_setup_paeth_row_only(tls, png_ptr, bpp, row_bytes) best_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row } else { if filter_to_do&uint32(PNG_FILTER_PAETH3) != uint32(0) { lmins3 = mins sum4 = _png_setup_paeth_row(tls, png_ptr, bpp, row_bytes, lmins3) if sum4 < mins { best_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row != libc.UintptrFromInt32(0) { (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftry_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row (*Tpng_struct)(unsafe.Pointer(png_ptr)).Ftst_row = best_row } } } } /* Do the actual writing of the filtered row data from the chosen filter. */ _png_write_filtered_row(tls, png_ptr, best_row, (*Tpng_row_info)(unsafe.Pointer(row_info)).Frowbytes+uint32(1)) } // C documentation // // /* Do the actual writing of a previously filtered row. */ func _png_write_filtered_row(tls *libc.TLS, png_ptr Tpng_structrp, filtered_row Tpng_bytep, full_row_length Tsize_t) { var tptr Tpng_bytep _ = tptr Xpng_compress_IDAT(tls, png_ptr, filtered_row, full_row_length, Z_NO_FLUSH) /* Swap the current and previous rows */ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row != libc.UintptrFromInt32(0) { tptr = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fprev_row = (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf (*Tpng_struct)(unsafe.Pointer(png_ptr)).Frow_buf = tptr } /* Finish row - updates counters and flushes zlib if last row */ Xpng_write_finish_row(tls, png_ptr) (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflush_rows++ if (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflush_dist > uint32(0) && (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflush_rows >= (*Tpng_struct)(unsafe.Pointer(png_ptr)).Fflush_dist { Xpng_write_flush(tls, png_ptr) } } const AT_EACCESS = 0x200 const AT_EMPTY_PATH = 0x1000 const AT_NO_AUTOMOUNT = 0x800 const AT_RECURSIVE = 0x8000 const AT_REMOVEDIR = 0x200 const AT_STATX_DONT_SYNC = 0x4000 const AT_STATX_FORCE_SYNC = 0x2000 const AT_STATX_SYNC_AS_STAT = 0x0000 const AT_STATX_SYNC_TYPE = 0x6000 const AT_SYMLINK_FOLLOW = 0x400 const AT_SYMLINK_NOFOLLOW = 0x100 const CCITT_SUPPORT = 1 const CHECK_JPEG_YCBCR_SUBSAMPLING = 1 const CIELABTORGB_TABLE_RANGE = 1500 const CLEANFAXDATA_CLEAN = 0 const CLEANFAXDATA_REGENERATED = 1 const CLEANFAXDATA_UNCLEAN = 2 const COLORRESPONSEUNIT_100000S = 5 const COLORRESPONSEUNIT_10000S = 4 const COLORRESPONSEUNIT_1000S = 3 const COLORRESPONSEUNIT_100S = 2 const COLORRESPONSEUNIT_10S = 1 const COMPRESSION_ADOBE_DEFLATE = 8 const COMPRESSION_CCITTFAX3 = 3 const COMPRESSION_CCITTFAX4 = 4 const COMPRESSION_CCITTRLE = 2 const COMPRESSION_CCITTRLEW = 32771 const COMPRESSION_CCITT_T4 = 3 const COMPRESSION_CCITT_T6 = 4 const COMPRESSION_DCS = 32947 const COMPRESSION_DEFLATE = 32946 const COMPRESSION_IT8BL = 32898 const COMPRESSION_IT8CTPAD = 32895 const COMPRESSION_IT8LW = 32896 const COMPRESSION_IT8MP = 32897 const COMPRESSION_JBIG = 34661 const COMPRESSION_JP2000 = 34712 const COMPRESSION_JPEG = 7 const COMPRESSION_JXL = 50002 const COMPRESSION_LERC = 34887 const COMPRESSION_LZMA = 34925 const COMPRESSION_LZW = 5 const COMPRESSION_NEXT = 32766 const COMPRESSION_NONE = 1 const COMPRESSION_OJPEG = 6 const COMPRESSION_PACKBITS = 32773 const COMPRESSION_PIXARFILM = 32908 const COMPRESSION_PIXARLOG = 32909 const COMPRESSION_SGILOG = 34676 const COMPRESSION_SGILOG24 = 34677 const COMPRESSION_T43 = 10 const COMPRESSION_T85 = 9 const COMPRESSION_THUNDERSCAN = 32809 const COMPRESSION_WEBP = 50001 const COMPRESSION_ZSTD = 50000 const CXX_SUPPORT = 1 const D50_X0 = 96.425 const D50_Y0 = 100 const D50_Z0 = 82.468 const D65_X0 = 95.0470 const D65_Y0 = 100.0 const D65_Z0 = 108.8827 const DCSIMAGERFILTER_CFA = 2 const DCSIMAGERFILTER_IR = 0 const DCSIMAGERFILTER_MONO = 1 const DCSIMAGERFILTER_OTHER = 3 const DCSIMAGERMODEL_M3 = 0 const DCSIMAGERMODEL_M5 = 1 const DCSIMAGERMODEL_M6 = 2 const DCSINTERPMODE_NORMAL = 0x0 const DCSINTERPMODE_PREVIEW = 0x1 const DEFAULT_EXTRASAMPLE_AS_ALPHA = 1 const DEFLATE_SUBCODEC_LIBDEFLATE = 1 const DEFLATE_SUBCODEC_ZLIB = 0 const DN_ACCESS = 0x00000001 const DN_ATTRIB = 0x00000020 const DN_CREATE = 0x00000004 const DN_DELETE = 0x00000008 const DN_MODIFY = 0x00000002 const DN_MULTISHOT = 0x80000000 const DN_RENAME = 0x00000010 const EXIFTAG_ACCELERATION = 37892 const EXIFTAG_APERTUREVALUE = 37378 const EXIFTAG_BODYSERIALNUMBER = 42033 const EXIFTAG_BRIGHTNESSVALUE = 37379 const EXIFTAG_CAMERAELEVATIONANGLE = 37893 const EXIFTAG_CAMERAOWNERNAME = 42032 const EXIFTAG_CFAPATTERN = 41730 const EXIFTAG_COLORSPACE = 40961 const EXIFTAG_COMPONENTSCONFIGURATION = 37121 const EXIFTAG_COMPOSITEIMAGE = 42080 const EXIFTAG_COMPRESSEDBITSPERPIXEL = 37122 const EXIFTAG_CONTRAST = 41992 const EXIFTAG_CUSTOMRENDERED = 41985 const EXIFTAG_DATETIMEDIGITIZED = 36868 const EXIFTAG_DATETIMEORIGINAL = 36867 const EXIFTAG_DEVICESETTINGDESCRIPTION = 41995 const EXIFTAG_DIGITALZOOMRATIO = 41988 const EXIFTAG_EXIFVERSION = 36864 const EXIFTAG_EXPOSUREBIASVALUE = 37380 const EXIFTAG_EXPOSUREINDEX = 41493 const EXIFTAG_EXPOSUREMODE = 41986 const EXIFTAG_EXPOSUREPROGRAM = 34850 const EXIFTAG_EXPOSURETIME = 33434 const EXIFTAG_FILESOURCE = 41728 const EXIFTAG_FLASH = 37385 const EXIFTAG_FLASHENERGY = 41483 const EXIFTAG_FLASHPIXVERSION = 40960 const EXIFTAG_FNUMBER = 33437 const EXIFTAG_FOCALLENGTH = 37386 const EXIFTAG_FOCALLENGTHIN35MMFILM = 41989 const EXIFTAG_FOCALPLANERESOLUTIONUNIT = 41488 const EXIFTAG_FOCALPLANEXRESOLUTION = 41486 const EXIFTAG_FOCALPLANEYRESOLUTION = 41487 const EXIFTAG_GAINCONTROL = 41991 const EXIFTAG_GAMMA = 42240 const EXIFTAG_HUMIDITY = 37889 const EXIFTAG_IMAGEUNIQUEID = 42016 const EXIFTAG_ISOSPEED = 34867 const EXIFTAG_ISOSPEEDLATITUDEYYY = 34868 const EXIFTAG_ISOSPEEDLATITUDEZZZ = 34869 const EXIFTAG_ISOSPEEDRATINGS = 34855 const EXIFTAG_LENSMAKE = 42035 const EXIFTAG_LENSMODEL = 42036 const EXIFTAG_LENSSERIALNUMBER = 42037 const EXIFTAG_LENSSPECIFICATION = 42034 const EXIFTAG_LIGHTSOURCE = 37384 const EXIFTAG_MAKERNOTE = 37500 const EXIFTAG_MAXAPERTUREVALUE = 37381 const EXIFTAG_METERINGMODE = 37383 const EXIFTAG_OECF = 34856 const EXIFTAG_OFFSETTIME = 36880 const EXIFTAG_OFFSETTIMEDIGITIZED = 36882 const EXIFTAG_OFFSETTIMEORIGINAL = 36881 const EXIFTAG_PHOTOGRAPHICSENSITIVITY = 34855 const EXIFTAG_PIXELXDIMENSION = 40962 const EXIFTAG_PIXELYDIMENSION = 40963 const EXIFTAG_PRESSURE = 37890 const EXIFTAG_RECOMMENDEDEXPOSUREINDEX = 34866 const EXIFTAG_RELATEDSOUNDFILE = 40964 const EXIFTAG_SATURATION = 41993 const EXIFTAG_SCENECAPTURETYPE = 41990 const EXIFTAG_SCENETYPE = 41729 const EXIFTAG_SENSINGMETHOD = 41495 const EXIFTAG_SENSITIVITYTYPE = 34864 const EXIFTAG_SHARPNESS = 41994 const EXIFTAG_SHUTTERSPEEDVALUE = 37377 const EXIFTAG_SOURCEEXPOSURETIMESOFCOMPOSITEIMAGE = 42082 const EXIFTAG_SOURCEIMAGENUMBEROFCOMPOSITEIMAGE = 42081 const EXIFTAG_SPATIALFREQUENCYRESPONSE = 41484 const EXIFTAG_SPECTRALSENSITIVITY = 34852 const EXIFTAG_STANDARDOUTPUTSENSITIVITY = 34865 const EXIFTAG_SUBJECTAREA = 37396 const EXIFTAG_SUBJECTDISTANCE = 37382 const EXIFTAG_SUBJECTDISTANCERANGE = 41996 const EXIFTAG_SUBJECTLOCATION = 41492 const EXIFTAG_SUBSECTIME = 37520 const EXIFTAG_SUBSECTIMEDIGITIZED = 37522 const EXIFTAG_SUBSECTIMEORIGINAL = 37521 const EXIFTAG_TEMPERATURE = 37888 const EXIFTAG_USERCOMMENT = 37510 const EXIFTAG_WATERDEPTH = 37891 const EXIFTAG_WHITEBALANCE = 41987 const EXTRASAMPLE_ASSOCALPHA = 1 const EXTRASAMPLE_UNASSALPHA = 2 const EXTRASAMPLE_UNSPECIFIED = 0 const FALLOC_FL_KEEP_SIZE = 1 const FALLOC_FL_PUNCH_HOLE = 2 const FAPPEND = "O_APPEND" const FASYNC = "O_ASYNC" const FAXMODE_BYTEALIGN = 0x0004 const FAXMODE_CLASSF = "FAXMODE_NORTC" const FAXMODE_CLASSIC = 0x0000 const FAXMODE_NOEOL = 0x0002 const FAXMODE_NORTC = 0x0001 const FAXMODE_WORDALIGN = 0x0008 const FAXPROFILE_C = 4 const FAXPROFILE_F = 2 const FAXPROFILE_J = 3 const FAXPROFILE_L = 5 const FAXPROFILE_M = 6 const FAXPROFILE_S = 1 const FD_CLOEXEC = 1 const FFSYNC = "O_SYNC" const FIELDSET_ITEMS = 4 const FIELD_BITSPERSAMPLE = 6 const FIELD_CODEC = 66 const FIELD_COLORMAP = 26 const FIELD_COMPRESSION = 7 const FIELD_CUSTOM = 65 const FIELD_EXTRASAMPLES = 31 const FIELD_FILLORDER = 10 const FIELD_HALFTONEHINTS = 37 const FIELD_IGNORE = 0 const FIELD_IMAGEDEPTH = 35 const FIELD_IMAGEDIMENSIONS = 1 const FIELD_INKNAMES = 46 const FIELD_MAXSAMPLEVALUE = 19 const FIELD_MINSAMPLEVALUE = 18 const FIELD_NUMBEROFINKS = 50 const FIELD_ORIENTATION = 15 const FIELD_PAGENUMBER = 23 const FIELD_PHOTOMETRIC = 8 const FIELD_PLANARCONFIG = 20 const FIELD_POSITION = 4 const FIELD_PSEUDO = 0 const FIELD_REFBLACKWHITE = 41 const FIELD_RESOLUTION = 3 const FIELD_RESOLUTIONUNIT = 22 const FIELD_ROWSPERSTRIP = 17 const FIELD_SAMPLEFORMAT = 32 const FIELD_SAMPLESPERPIXEL = 16 const FIELD_SMAXSAMPLEVALUE = 34 const FIELD_SMINSAMPLEVALUE = 33 const FIELD_STRIPBYTECOUNTS = 24 const FIELD_STRIPOFFSETS = 25 const FIELD_SUBFILETYPE = 5 const FIELD_SUBIFD = 49 const FIELD_THRESHHOLDING = 9 const FIELD_TILEDEPTH = 36 const FIELD_TILEDIMENSIONS = 2 const FIELD_TRANSFERFUNCTION = 44 const FIELD_YCBCRPOSITIONING = 40 const FIELD_YCBCRSUBSAMPLING = 39 const FILETYPE_MASK = 0x4 const FILETYPE_PAGE = 0x2 const FILETYPE_REDUCEDIMAGE = 0x1 const FILLORDER_LSB2MSB = 2 const FILLORDER_MSB2LSB = 1 const FLT_MAX1 = 3.4028234663852886e+38 const FNDELAY = "O_NDELAY" const FNONBLOCK = "O_NONBLOCK" const F_ADD_SEALS = 1033 const F_CANCELLK = 1029 const F_DUPFD = 0 const F_DUPFD_CLOEXEC = 1030 const F_GETFD = 1 const F_GETFL = 3 const F_GETLEASE = 1025 const F_GETLK = 12 const F_GETOWN = 9 const F_GETOWNER_UIDS = 17 const F_GETOWN_EX = 16 const F_GETPIPE_SZ = 1032 const F_GETSIG = 11 const F_GET_FILE_RW_HINT = 1037 const F_GET_RW_HINT = 1035 const F_GET_SEALS = 1034 const F_NOTIFY = 1026 const F_OFD_GETLK = 36 const F_OFD_SETLK = 37 const F_OFD_SETLKW = 38 const F_OWNER_GID = 2 const F_OWNER_PGRP = 2 const F_OWNER_PID = 1 const F_OWNER_TID = 0 const F_RDLCK = 0 const F_SEAL_FUTURE_WRITE = 0x0010 const F_SEAL_GROW = 0x0004 const F_SEAL_SEAL = 0x0001 const F_SEAL_SHRINK = 0x0002 const F_SEAL_WRITE = 0x0008 const F_SETFD = 2 const F_SETFL = 4 const F_SETLEASE = 1024 const F_SETLK = 13 const F_SETLKW = 14 const F_SETOWN = 8 const F_SETOWN_EX = 15 const F_SETPIPE_SZ = 1031 const F_SETSIG = 10 const F_SET_FILE_RW_HINT = 1038 const F_SET_RW_HINT = 1036 const F_UNLCK = 2 const F_WRLCK = 1 const GPSTAG_ALTITUDE = 6 const GPSTAG_ALTITUDEREF = 5 const GPSTAG_AREAINFORMATION = 28 const GPSTAG_DATESTAMP = 29 const GPSTAG_DESTBEARING = 24 const GPSTAG_DESTBEARINGREF = 23 const GPSTAG_DESTDISTANCE = 26 const GPSTAG_DESTDISTANCEREF = 25 const GPSTAG_DESTLATITUDE = 20 const GPSTAG_DESTLATITUDEREF = 19 const GPSTAG_DESTLONGITUDE = 22 const GPSTAG_DESTLONGITUDEREF = 21 const GPSTAG_DIFFERENTIAL = 30 const GPSTAG_DOP = 11 const GPSTAG_GPSHPOSITIONINGERROR = 31 const GPSTAG_IMGDIRECTION = 17 const GPSTAG_IMGDIRECTIONREF = 16 const GPSTAG_LATITUDE = 2 const GPSTAG_LATITUDEREF = 1 const GPSTAG_LONGITUDE = 4 const GPSTAG_LONGITUDEREF = 3 const GPSTAG_MAPDATUM = 18 const GPSTAG_MEASUREMODE = 10 const GPSTAG_PROCESSINGMETHOD = 27 const GPSTAG_SATELLITES = 8 const GPSTAG_SPEED = 13 const GPSTAG_SPEEDREF = 12 const GPSTAG_STATUS = 9 const GPSTAG_TIMESTAMP = 7 const GPSTAG_TRACK = 15 const GPSTAG_TRACKREF = 14 const GPSTAG_VERSIONID = 0 const GRAYRESPONSEUNIT_100000S = 5 const GRAYRESPONSEUNIT_10000S = 4 const GRAYRESPONSEUNIT_1000S = 3 const GRAYRESPONSEUNIT_100S = 2 const GRAYRESPONSEUNIT_10S = 1 const GROUP3OPT_2DENCODING = 0x1 const GROUP3OPT_FILLBITS = 0x4 const GROUP3OPT_UNCOMPRESSED = 0x2 const GROUP4OPT_UNCOMPRESSED = 0x2 const HAVE_ASSERT_H = 1 const HAVE_DECL_OPTARG = 1 const HAVE_FCNTL_H = 1 const HAVE_FSEEKO = 1 const HAVE_GETOPT = 1 const HAVE_GL_GLUT_H = 1 const HAVE_GL_GLU_H = 1 const HAVE_GL_GL_H = 1 const HAVE_IEEEFP = 1 const HAVE_MMAP = 1 const HOST_BIGENDIAN = 0 const HOST_FILLORDER = "FILLORDER_LSB2MSB" const INKSET_CMYK = 1 const INKSET_MULTIINK = 2 const INT16_MAX = 0x7fff const INT32_MAX = 0x7fffffff const INT64_MAX = 0x7fffffffffffffff const INT8_MAX = 0x7f const INTMAX_MAX = "INT64_MAX" const INTMAX_MIN = "INT64_MIN" const INTPTR_MAX = "INT32_MAX" const INTPTR_MIN = "INT32_MIN" const INT_FAST16_MAX = "INT32_MAX" const INT_FAST16_MIN = "INT32_MIN" const INT_FAST32_MAX = "INT32_MAX" const INT_FAST32_MIN = "INT32_MIN" const INT_FAST64_MAX = "INT64_MAX" const INT_FAST64_MIN = "INT64_MIN" const INT_FAST8_MAX = "INT8_MAX" const INT_FAST8_MIN = "INT8_MIN" const INT_LEAST16_MAX = "INT16_MAX" const INT_LEAST16_MIN = "INT16_MIN" const INT_LEAST32_MAX = "INT32_MAX" const INT_LEAST32_MIN = "INT32_MIN" const INT_LEAST64_MAX = "INT64_MAX" const INT_LEAST64_MIN = "INT64_MIN" const INT_LEAST8_MAX = "INT8_MAX" const INT_LEAST8_MIN = "INT8_MIN" const JPEGCOLORMODE_RAW = 0x0000 const JPEGCOLORMODE_RGB = 0x0001 const JPEGPROC_BASELINE = 1 const JPEGPROC_LOSSLESS = 14 const JPEGTABLESMODE_HUFF = 0x0002 const JPEGTABLESMODE_QUANT = 0x0001 const LERC_ADD_COMPRESSION_DEFLATE = 1 const LERC_ADD_COMPRESSION_NONE = 0 const LERC_ADD_COMPRESSION_ZSTD = 2 const LERC_VERSION_2_4 = 4 const LOGLUV_PUBLIC = 1 const LOGLUV_SUPPORT = 1 const LZW_SUPPORT = 1 const MAX_HANDLE_SZ = 128 const MDI_BIGENDIAN = 0x4550 const MDI_LITTLEENDIAN = 0x5045 const MDI_SUPPORT = 1 const NEXT_SUPPORT = 1 const OFILETYPE_IMAGE = 1 const OFILETYPE_PAGE = 3 const OFILETYPE_REDUCEDIMAGE = 2 const ORIENTATION_BOTLEFT = 4 const ORIENTATION_BOTRIGHT = 3 const ORIENTATION_LEFTBOT = 8 const ORIENTATION_LEFTTOP = 5 const ORIENTATION_RIGHTBOT = 7 const ORIENTATION_RIGHTTOP = 6 const ORIENTATION_TOPLEFT = 1 const ORIENTATION_TOPRIGHT = 2 const O_APPEND = 02000 const O_ASYNC = 020000 const O_CLOEXEC = 02000000 const O_CREAT = 0100 const O_DIRECT = 0200000 const O_DIRECTORY = 040000 const O_DSYNC = 010000 const O_EXCL = 0200 const O_EXEC = "O_PATH" const O_LARGEFILE = 0400000 const O_NDELAY = "O_NONBLOCK" const O_NOATIME = 01000000 const O_NOCTTY = 0400 const O_NOFOLLOW = 0100000 const O_NONBLOCK = 04000 const O_PATH = 010000000 const O_RDONLY = 00 const O_RDWR = 02 const O_RSYNC = 04010000 const O_SEARCH = "O_PATH" const O_SYNC = 04010000 const O_TMPFILE = 020040000 const O_TRUNC = 01000 const O_TTY_INIT = 0 const O_WRONLY = 01 const PACKAGE = "tiff" const PACKAGE_STRING9 = "tifftcl 4.7.0" const PACKAGE_VERSION3 = "4.7.0" const PACKBITS_SUPPORT = 1 const PERSAMPLE_MERGED = 0 const PERSAMPLE_MULTI = 1 const PHOTOMETRIC_CFA = 32803 const PHOTOMETRIC_CIELAB = 8 const PHOTOMETRIC_ICCLAB = 9 const PHOTOMETRIC_ITULAB = 10 const PHOTOMETRIC_LOGL = 32844 const PHOTOMETRIC_LOGLUV = 32845 const PHOTOMETRIC_MASK = 4 const PHOTOMETRIC_MINISBLACK = 1 const PHOTOMETRIC_MINISWHITE = 0 const PHOTOMETRIC_PALETTE = 3 const PHOTOMETRIC_RGB = 2 const PHOTOMETRIC_SEPARATED = 5 const PHOTOMETRIC_YCBCR = 6 const PIXARLOGDATAFMT_11BITLOG = 2 const PIXARLOGDATAFMT_12BITPICIO = 3 const PIXARLOGDATAFMT_16BIT = 4 const PIXARLOGDATAFMT_8BIT = 0 const PIXARLOGDATAFMT_8BITABGR = 1 const PIXARLOGDATAFMT_FLOAT = 5 const PLANARCONFIG_CONTIG = 1 const PLANARCONFIG_SEPARATE = 2 const POSIX_FADV_DONTNEED = 4 const POSIX_FADV_NOREUSE = 5 const POSIX_FADV_NORMAL = 0 const POSIX_FADV_RANDOM = 1 const POSIX_FADV_SEQUENTIAL = 2 const POSIX_FADV_WILLNEED = 3 const PREDICTOR_FLOATINGPOINT = 3 const PREDICTOR_HORIZONTAL = 2 const PREDICTOR_NONE = 1 const PRIX16 = "X" const PRIX32 = "X" const PRIX8 = "X" const PRIXFAST16 = "X" const PRIXFAST32 = "X" const PRIXFAST8 = "X" const PRIXLEAST16 = "X" const PRIXLEAST32 = "X" const PRIXLEAST8 = "X" const PRId16 = "d" const PRId32 = "d" const PRId8 = "d" const PRIdFAST16 = "d" const PRIdFAST32 = "d" const PRIdFAST8 = "d" const PRIdLEAST16 = "d" const PRIdLEAST32 = "d" const PRIdLEAST8 = "d" const PRIi16 = "i" const PRIi32 = "i" const PRIi8 = "i" const PRIiFAST16 = "i" const PRIiFAST32 = "i" const PRIiFAST8 = "i" const PRIiLEAST16 = "i" const PRIiLEAST32 = "i" const PRIiLEAST8 = "i" const PRIo16 = "o" const PRIo32 = "o" const PRIo8 = "o" const PRIoFAST16 = "o" const PRIoFAST32 = "o" const PRIoFAST8 = "o" const PRIoLEAST16 = "o" const PRIoLEAST32 = "o" const PRIoLEAST8 = "o" const PRIu16 = "u" const PRIu32 = "u" const PRIu8 = "u" const PRIuFAST16 = "u" const PRIuFAST32 = "u" const PRIuFAST8 = "u" const PRIuLEAST16 = "u" const PRIuLEAST32 = "u" const PRIuLEAST8 = "u" const PRIx16 = "x" const PRIx32 = "x" const PRIx8 = "x" const PRIxFAST16 = "x" const PRIxFAST32 = "x" const PRIxFAST8 = "x" const PRIxLEAST16 = "x" const PRIxLEAST32 = "x" const PRIxLEAST8 = "x" const PROFILETYPE_G3_FAX = 1 const PROFILETYPE_UNSPECIFIED = 0 const PTRDIFF_MAX = "INT32_MAX" const PTRDIFF_MIN = "INT32_MIN" const RESUNIT_CENTIMETER = 3 const RESUNIT_INCH = 2 const RESUNIT_NONE = 1 const RWF_WRITE_LIFE_NOT_SET = 0 const RWH_WRITE_LIFE_EXTREME = 5 const RWH_WRITE_LIFE_LONG = 4 const RWH_WRITE_LIFE_MEDIUM = 3 const RWH_WRITE_LIFE_NONE = 1 const RWH_WRITE_LIFE_SHORT = 2 const SAMPLEFORMAT_COMPLEXIEEEFP = 6 const SAMPLEFORMAT_COMPLEXINT = 5 const SAMPLEFORMAT_IEEEFP = 3 const SAMPLEFORMAT_INT = 2 const SAMPLEFORMAT_UINT = 1 const SAMPLEFORMAT_VOID = 4 const SCNd16 = "hd" const SCNd32 = "d" const SCNd8 = "hhd" const SCNdFAST16 = "d" const SCNdFAST32 = "d" const SCNdFAST8 = "hhd" const SCNdLEAST16 = "hd" const SCNdLEAST32 = "d" const SCNdLEAST8 = "hhd" const SCNi16 = "hi" const SCNi32 = "i" const SCNi8 = "hhi" const SCNiFAST16 = "i" const SCNiFAST32 = "i" const SCNiFAST8 = "hhi" const SCNiLEAST16 = "hi" const SCNiLEAST32 = "i" const SCNiLEAST8 = "hhi" const SCNo16 = "ho" const SCNo32 = "o" const SCNo8 = "hho" const SCNoFAST16 = "o" const SCNoFAST32 = "o" const SCNoFAST8 = "hho" const SCNoLEAST16 = "ho" const SCNoLEAST32 = "o" const SCNoLEAST8 = "hho" const SCNu16 = "hu" const SCNu32 = "u" const SCNu8 = "hhu" const SCNuFAST16 = "u" const SCNuFAST32 = "u" const SCNuFAST8 = "hhu" const SCNuLEAST16 = "hu" const SCNuLEAST32 = "u" const SCNuLEAST8 = "hhu" const SCNx16 = "hx" const SCNx32 = "x" const SCNx8 = "hhx" const SCNxFAST16 = "x" const SCNxFAST32 = "x" const SCNxFAST8 = "hhx" const SCNxLEAST16 = "hx" const SCNxLEAST32 = "x" const SCNxLEAST8 = "hhx" const SGILOGDATAFMT_16BIT = 1 const SGILOGDATAFMT_8BIT = 3 const SGILOGDATAFMT_FLOAT = 0 const SGILOGDATAFMT_RAW = 2 const SGILOGENCODE_NODITHER = 0 const SGILOGENCODE_RANDITHER = 1 const SIG_ATOMIC_MAX = "INT32_MAX" const SIG_ATOMIC_MIN = "INT32_MIN" const SIZEOF_SIZE_T = 4 const SIZE_MAX = "UINT32_MAX" const SPLICE_F_GIFT = 8 const SPLICE_F_MORE = 4 const SPLICE_F_MOVE = 1 const SPLICE_F_NONBLOCK = 2 const STRIPCHOP_DEFAULT = "TIFF_STRIPCHOP" const STRIP_SIZE_DEFAULT = 8192 const SUBIFD_SUPPORT = 1 const SYNC_FILE_RANGE_WAIT_AFTER = 4 const SYNC_FILE_RANGE_WAIT_BEFORE = 1 const SYNC_FILE_RANGE_WRITE = 2 const S_IRGRP = 0040 const S_IROTH = 0004 const S_IRUSR = 0400 const S_IRWXG = 0070 const S_IRWXO = 0007 const S_IRWXU = 0700 const S_ISGID = 02000 const S_ISUID = 04000 const S_ISVTX = 01000 const S_IWGRP = 0020 const S_IWOTH = 0002 const S_IWUSR = 0200 const S_IXGRP = 0010 const S_IXOTH = 0001 const S_IXUSR = 0100 const THRESHHOLD_BILEVEL = 1 const THRESHHOLD_ERRORDIFFUSE = 3 const THRESHHOLD_HALFTONE = 2 const THUNDER_SUPPORT = 1 const TIFFLIB_MAJOR_VERSION = 4 const TIFFLIB_MICRO_VERSION = 0 const TIFFLIB_MINOR_VERSION = 7 const TIFFLIB_VERSION = 20240911 const TIFFLIB_VERSION_STR = "LIBTIFF, Version 4.7.0\\nCopyright (c) 1988-1996 Sam Leffler\\nCopyright (c) 1991-1996 Silicon Graphics, Inc." const TIFFLIB_VERSION_STR_MAJ_MIN_MIC = "4.7.0" const TIFFPRINT_COLORMAP = 0x4 const TIFFPRINT_CURVES = 0x2 const TIFFPRINT_JPEGACTABLES = 0x200 const TIFFPRINT_JPEGDCTABLES = 0x200 const TIFFPRINT_JPEGQTABLES = 0x100 const TIFFPRINT_NONE = 0x0 const TIFFPRINT_STRIPS = 0x1 const TIFFTAG_ACTIVEAREA = 50829 const TIFFTAG_ALIAS_LAYER_METADATA = 50784 const TIFFTAG_ANALOGBALANCE = 50727 const TIFFTAG_ANTIALIASSTRENGTH = 50738 const TIFFTAG_ARTIST = 315 const TIFFTAG_ASSHOTICCPROFILE = 50831 const TIFFTAG_ASSHOTNEUTRAL = 50728 const TIFFTAG_ASSHOTPREPROFILEMATRIX = 50832 const TIFFTAG_ASSHOTPROFILENAME = 50934 const TIFFTAG_ASSHOTWHITEXY = 50729 const TIFFTAG_BADFAXLINES = 326 const TIFFTAG_BASELINEEXPOSURE = 50730 const TIFFTAG_BASELINEEXPOSUREOFFSET = 51109 const TIFFTAG_BASELINENOISE = 50731 const TIFFTAG_BASELINESHARPNESS = 50732 const TIFFTAG_BATTERYLEVEL = 33423 const TIFFTAG_BAYERGREENSPLIT = 50733 const TIFFTAG_BESTQUALITYSCALE = 50780 const TIFFTAG_BITSPERSAMPLE = 258 const TIFFTAG_BLACKLEVEL = 50714 const TIFFTAG_BLACKLEVELDELTAH = 50715 const TIFFTAG_BLACKLEVELDELTAV = 50716 const TIFFTAG_BLACKLEVELREPEATDIM = 50713 const TIFFTAG_CALIBRATIONILLUMINANT1 = 50778 const TIFFTAG_CALIBRATIONILLUMINANT2 = 50779 const TIFFTAG_CALIBRATIONILLUMINANT3 = 52529 const TIFFTAG_CAMERACALIBRATION1 = 50723 const TIFFTAG_CAMERACALIBRATION2 = 50724 const TIFFTAG_CAMERACALIBRATION3 = 52530 const TIFFTAG_CAMERACALIBRATIONSIGNATURE = 50931 const TIFFTAG_CAMERASERIALNUMBER = 50735 const TIFFTAG_CELLLENGTH = 265 const TIFFTAG_CELLWIDTH = 264 const TIFFTAG_CFALAYOUT = 50711 const TIFFTAG_CFAPATTERN = 33422 const TIFFTAG_CFAPLANECOLOR = 50710 const TIFFTAG_CFAREPEATPATTERNDIM = 33421 const TIFFTAG_CHROMABLURRADIUS = 50737 const TIFFTAG_CLEANFAXDATA = 327 const TIFFTAG_CLIPPATH = 343 const TIFFTAG_CODINGMETHODS = 403 const TIFFTAG_COLORIMETRICREFERENCE = 50879 const TIFFTAG_COLORMAP = 320 const TIFFTAG_COLORMATRIX1 = 50721 const TIFFTAG_COLORMATRIX2 = 50722 const TIFFTAG_COLORMATRIX3 = 52531 const TIFFTAG_COLORRESPONSEUNIT = 300 const TIFFTAG_COMPRESSION = 259 const TIFFTAG_CONSECUTIVEBADFAXLINES = 328 const TIFFTAG_COPYRIGHT = 33432 const TIFFTAG_CURRENTICCPROFILE = 50833 const TIFFTAG_CURRENTPREPROFILEMATRIX = 50834 const TIFFTAG_DATATYPE = 32996 const TIFFTAG_DATETIME = 306 const TIFFTAG_DCSBALANCEARRAY = 65552 const TIFFTAG_DCSCALIBRATIONFD = 65556 const TIFFTAG_DCSCLIPRECTANGLE = 65559 const TIFFTAG_DCSCORRECTMATRIX = 65553 const TIFFTAG_DCSGAMMA = 65554 const TIFFTAG_DCSHUESHIFTVALUES = 65535 const TIFFTAG_DCSIMAGERTYPE = 65550 const TIFFTAG_DCSINTERPMODE = 65551 const TIFFTAG_DCSTOESHOULDERPTS = 65555 const TIFFTAG_DECODE = 433 const TIFFTAG_DEFAULTBLACKRENDER = 51110 const TIFFTAG_DEFAULTCROPORIGIN = 50719 const TIFFTAG_DEFAULTCROPSIZE = 50720 const TIFFTAG_DEFAULTSCALE = 50718 const TIFFTAG_DEFAULTUSERCROP = 51125 const TIFFTAG_DEFLATE_SUBCODEC = 65570 const TIFFTAG_DEPTHFAR = 51179 const TIFFTAG_DEPTHFORMAT = 51177 const TIFFTAG_DEPTHMEASURETYPE = 51181 const TIFFTAG_DEPTHNEAR = 51178 const TIFFTAG_DEPTHUNITS = 51180 const TIFFTAG_DNGBACKWARDVERSION = 50707 const TIFFTAG_DNGPRIVATEDATA = 50740 const TIFFTAG_DNGVERSION = 50706 const TIFFTAG_DOCUMENTNAME = 269 const TIFFTAG_DOTRANGE = 336 const TIFFTAG_ENHANCEPARAMS = 51182 const TIFFTAG_EP_APERTUREVALUE = 37378 const TIFFTAG_EP_BATTERYLEVEL = 33423 const TIFFTAG_EP_BRIGHTNESSVALUE = 37379 const TIFFTAG_EP_CFAPATTERN = 33422 const TIFFTAG_EP_CFAREPEATPATTERNDIM = 33421 const TIFFTAG_EP_COMPRESSEDBITSPERPIXEL = 37122 const TIFFTAG_EP_DATETIMEORIGINAL = 36867 const TIFFTAG_EP_EXPOSUREBIASVALUE = 37380 const TIFFTAG_EP_EXPOSUREINDEX = 37397 const TIFFTAG_EP_EXPOSUREPROGRAM = 34850 const TIFFTAG_EP_EXPOSURETIME = 33434 const TIFFTAG_EP_FLASH = 37385 const TIFFTAG_EP_FLASHENERGY = 37387 const TIFFTAG_EP_FNUMBER = 33437 const TIFFTAG_EP_FOCALLENGTH = 37386 const TIFFTAG_EP_FOCALPLANERESOLUTIONUNIT = 37392 const TIFFTAG_EP_FOCALPLANEXRESOLUTION = 37390 const TIFFTAG_EP_FOCALPLANEYRESOLUTION = 37391 const TIFFTAG_EP_IMAGEHISTORY = 37395 const TIFFTAG_EP_IMAGENUMBER = 37393 const TIFFTAG_EP_INTERLACE = 34857 const TIFFTAG_EP_IPTC_NAA = 33723 const TIFFTAG_EP_ISOSPEEDRATINGS = 34855 const TIFFTAG_EP_LIGHTSOURCE = 37384 const TIFFTAG_EP_MAXAPERTUREVALUE = 37381 const TIFFTAG_EP_METERINGMODE = 37383 const TIFFTAG_EP_NOISE = 37389 const TIFFTAG_EP_OECF = 34856 const TIFFTAG_EP_SECURITYCLASSIFICATION = 37394 const TIFFTAG_EP_SELFTIMERMODE = 34859 const TIFFTAG_EP_SENSINGMETHOD = 37399 const TIFFTAG_EP_SHUTTERSPEEDVALUE = 37377 const TIFFTAG_EP_SPATIALFREQUENCYRESPONSE = 37388 const TIFFTAG_EP_SPECTRALSENSITIVITY = 34852 const TIFFTAG_EP_STANDARDID = 37398 const TIFFTAG_EP_SUBJECTDISTANCE = 37382 const TIFFTAG_EP_SUBJECTLOCATION = 37396 const TIFFTAG_EP_TIMEZONEOFFSET = 34858 const TIFFTAG_EXIFIFD = 34665 const TIFFTAG_EXTRACAMERAPROFILES = 50933 const TIFFTAG_EXTRASAMPLES = 338 const TIFFTAG_FAXDCS = 34911 const TIFFTAG_FAXFILLFUNC = 65540 const TIFFTAG_FAXMODE = 65536 const TIFFTAG_FAXPROFILE = 402 const TIFFTAG_FAXRECVPARAMS = 34908 const TIFFTAG_FAXRECVTIME = 34910 const TIFFTAG_FAXSUBADDRESS = 34909 const TIFFTAG_FEDEX_EDR = 34929 const TIFFTAG_FILLORDER = 266 const TIFFTAG_FORWARDMATRIX1 = 50964 const TIFFTAG_FORWARDMATRIX2 = 50965 const TIFFTAG_FORWARDMATRIX3 = 52532 const TIFFTAG_FRAMECOUNT = 34232 const TIFFTAG_FREEBYTECOUNTS = 289 const TIFFTAG_FREEOFFSETS = 288 const TIFFTAG_GDAL_METADATA = 42112 const TIFFTAG_GDAL_NODATA = 42113 const TIFFTAG_GEO_METADATA = 50909 const TIFFTAG_GLOBALPARAMETERSIFD = 400 const TIFFTAG_GPSIFD = 34853 const TIFFTAG_GRAYRESPONSECURVE = 291 const TIFFTAG_GRAYRESPONSEUNIT = 290 const TIFFTAG_GROUP3OPTIONS = 292 const TIFFTAG_GROUP4OPTIONS = 293 const TIFFTAG_HALFTONEHINTS = 321 const TIFFTAG_HOSTCOMPUTER = 316 const TIFFTAG_ICCPROFILE = 34675 const TIFFTAG_ILLUMINANTDATA1 = 52533 const TIFFTAG_ILLUMINANTDATA2 = 52534 const TIFFTAG_ILLUMINANTDATA3 = 53535 const TIFFTAG_IMAGEBASECOLOR = 434 const TIFFTAG_IMAGEDEPTH = 32997 const TIFFTAG_IMAGEDESCRIPTION = 270 const TIFFTAG_IMAGELAYER = 34732 const TIFFTAG_IMAGELENGTH = 257 const TIFFTAG_IMAGESOURCEDATA = 37724 const TIFFTAG_IMAGEWIDTH = 256 const TIFFTAG_INDEXED = 346 const TIFFTAG_INGR_FLAG_REGISTERS = 33919 const TIFFTAG_INGR_PACKET_DATA_TAG = 33918 const TIFFTAG_INKNAMES = 333 const TIFFTAG_INKSET = 332 const TIFFTAG_INTEROPERABILITYIFD = 40965 const TIFFTAG_IRASB_TRANSORMATION_MATRIX = 33920 const TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH = 34021 const TIFFTAG_IT8BITSPERRUNLENGTH = 34020 const TIFFTAG_IT8BKGCOLORINDICATOR = 34024 const TIFFTAG_IT8BKGCOLORVALUE = 34026 const TIFFTAG_IT8CMYKEQUIVALENT = 34032 const TIFFTAG_IT8COLORCHARACTERIZATION = 34029 const TIFFTAG_IT8COLORSEQUENCE = 34017 const TIFFTAG_IT8COLORTABLE = 34022 const TIFFTAG_IT8HCUSAGE = 34030 const TIFFTAG_IT8HEADER = 34018 const TIFFTAG_IT8IMAGECOLORINDICATOR = 34023 const TIFFTAG_IT8IMAGECOLORVALUE = 34025 const TIFFTAG_IT8PIXELINTENSITYRANGE = 34027 const TIFFTAG_IT8RASTERPADDING = 34019 const TIFFTAG_IT8SITE = 34016 const TIFFTAG_IT8TRANSPARENCYINDICATOR = 34028 const TIFFTAG_IT8TRAPINDICATOR = 34031 const TIFFTAG_JBIGOPTIONS = 34750 const TIFFTAG_JPEGACTABLES = 521 const TIFFTAG_JPEGCOLORMODE = 65538 const TIFFTAG_JPEGDCTABLES = 520 const TIFFTAG_JPEGIFBYTECOUNT = 514 const TIFFTAG_JPEGIFOFFSET = 513 const TIFFTAG_JPEGLOSSLESSPREDICTORS = 517 const TIFFTAG_JPEGPOINTTRANSFORM = 518 const TIFFTAG_JPEGPROC = 512 const TIFFTAG_JPEGQTABLES = 519 const TIFFTAG_JPEGQUALITY = 65537 const TIFFTAG_JPEGRESTARTINTERVAL = 515 const TIFFTAG_JPEGTABLES = 347 const TIFFTAG_JPEGTABLESMODE = 65539 const TIFFTAG_LENSINFO = 50736 const TIFFTAG_LERC_ADD_COMPRESSION = 65566 const TIFFTAG_LERC_MAXZERROR = 65567 const TIFFTAG_LERC_PARAMETERS = 50674 const TIFFTAG_LERC_VERSION = 65565 const TIFFTAG_LINEARIZATIONTABLE = 50712 const TIFFTAG_LINEARRESPONSELIMIT = 50734 const TIFFTAG_LOCALIZEDCAMERAMODEL = 50709 const TIFFTAG_LZMAPRESET = 65562 const TIFFTAG_MAKE = 271 const TIFFTAG_MAKERNOTESAFETY = 50741 const TIFFTAG_MASKEDAREAS = 50830 const TIFFTAG_MASKSUBAREA = 52536 const TIFFTAG_MATTEING = 32995 const TIFFTAG_MAXSAMPLEVALUE = 281 const TIFFTAG_MD_COLORTABLE = 33447 const TIFFTAG_MD_FILETAG = 33445 const TIFFTAG_MD_FILEUNITS = 33452 const TIFFTAG_MD_LABNAME = 33448 const TIFFTAG_MD_PREPDATE = 33450 const TIFFTAG_MD_PREPTIME = 33451 const TIFFTAG_MD_SAMPLEINFO = 33449 const TIFFTAG_MD_SCALEPIXEL = 33446 const TIFFTAG_MINSAMPLEVALUE = 280 const TIFFTAG_MODEL = 272 const TIFFTAG_MODELTIEPOINTTAG = 33922 const TIFFTAG_MODELTRANSFORMATIONTAG = 34264 const TIFFTAG_MODENUMBER = 405 const TIFFTAG_NEWRAWIMAGEDIGEST = 51111 const TIFFTAG_NOISEPROFILE = 51041 const TIFFTAG_NOISEREDUCTIONAPPLIED = 50935 const TIFFTAG_NUMBEROFINKS = 334 const TIFFTAG_OCE_APPLICATION_SELECTOR = 50216 const TIFFTAG_OCE_IDENTIFICATION_NUMBER = 50217 const TIFFTAG_OCE_IMAGELOGIC_CHARACTERISTICS = 50218 const TIFFTAG_OCE_SCANJOB_DESCRIPTION = 50215 const TIFFTAG_OPCODELIST1 = 51008 const TIFFTAG_OPCODELIST2 = 51009 const TIFFTAG_OPCODELIST3 = 51022 const TIFFTAG_OPIIMAGEID = 32781 const TIFFTAG_OPIPROXY = 351 const TIFFTAG_ORIENTATION = 274 const TIFFTAG_ORIGINALBESTQUALITYFINALSIZE = 51090 const TIFFTAG_ORIGINALDEFAULTCROPSIZE = 51091 const TIFFTAG_ORIGINALDEFAULTFINALSIZE = 51089 const TIFFTAG_ORIGINALRAWFILEDATA = 50828 const TIFFTAG_ORIGINALRAWFILEDIGEST = 50973 const TIFFTAG_ORIGINALRAWFILENAME = 50827 const TIFFTAG_OSUBFILETYPE = 255 const TIFFTAG_PAGENAME = 285 const TIFFTAG_PAGENUMBER = 297 const TIFFTAG_PERSAMPLE = 65563 const TIFFTAG_PHOTOMETRIC = 262 const TIFFTAG_PHOTOSHOP = 34377 const TIFFTAG_PIXARLOGDATAFMT = 65549 const TIFFTAG_PIXARLOGQUALITY = 65558 const TIFFTAG_PIXAR_FOVCOT = 33304 const TIFFTAG_PIXAR_IMAGEFULLLENGTH = 33301 const TIFFTAG_PIXAR_IMAGEFULLWIDTH = 33300 const TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA = 33306 const TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN = 33305 const TIFFTAG_PIXAR_TEXTUREFORMAT = 33302 const TIFFTAG_PIXAR_WRAPMODES = 33303 const TIFFTAG_PLANARCONFIG = 284 const TIFFTAG_PREDICTOR = 317 const TIFFTAG_PREVIEWAPPLICATIONNAME = 50966 const TIFFTAG_PREVIEWAPPLICATIONVERSION = 50967 const TIFFTAG_PREVIEWCOLORSPACE = 50970 const TIFFTAG_PREVIEWDATETIME = 50971 const TIFFTAG_PREVIEWSETTINGSDIGEST = 50969 const TIFFTAG_PREVIEWSETTINGSNAME = 50968 const TIFFTAG_PRIMARYCHROMATICITIES = 319 const TIFFTAG_PROFILECALIBRATIONSIGNATURE = 50932 const TIFFTAG_PROFILECOPYRIGHT = 50942 const TIFFTAG_PROFILEEMBEDPOLICY = 50941 const TIFFTAG_PROFILEGAINTABLEMAP = 52525 const TIFFTAG_PROFILEHUESATMAPDATA1 = 50938 const TIFFTAG_PROFILEHUESATMAPDATA2 = 50939 const TIFFTAG_PROFILEHUESATMAPDATA3 = 52537 const TIFFTAG_PROFILEHUESATMAPDIMS = 50937 const TIFFTAG_PROFILEHUESATMAPENCODING = 51107 const TIFFTAG_PROFILELOOKTABLEDATA = 50982 const TIFFTAG_PROFILELOOKTABLEDIMS = 50981 const TIFFTAG_PROFILELOOKTABLEENCODING = 51108 const TIFFTAG_PROFILENAME = 50936 const TIFFTAG_PROFILETONECURVE = 50940 const TIFFTAG_PROFILETYPE = 401 const TIFFTAG_RAWDATAUNIQUEID = 50781 const TIFFTAG_RAWIMAGEDIGEST = 50972 const TIFFTAG_RAWTOPREVIEWGAIN = 51112 const TIFFTAG_REDUCTIONMATRIX1 = 50725 const TIFFTAG_REDUCTIONMATRIX2 = 50726 const TIFFTAG_REDUCTIONMATRIX3 = 52538 const TIFFTAG_REFERENCEBLACKWHITE = 532 const TIFFTAG_REFPTS = 32953 const TIFFTAG_REGIONAFFINE = 32956 const TIFFTAG_REGIONTACKPOINT = 32954 const TIFFTAG_REGIONWARPCORNERS = 32955 const TIFFTAG_RESOLUTIONUNIT = 296 const TIFFTAG_RGBTABLES = 52543 const TIFFTAG_RICHTIFFIPTC = 33723 const TIFFTAG_ROWINTERLEAVEFACTOR = 50975 const TIFFTAG_ROWSPERSTRIP = 278 const TIFFTAG_RPCCOEFFICIENT = 50844 const TIFFTAG_SAMPLEFORMAT = 339 const TIFFTAG_SAMPLESPERPIXEL = 277 const TIFFTAG_SEMANTICINSTANCEID = 52528 const TIFFTAG_SEMANTICNAME = 52526 const TIFFTAG_SGILOGDATAFMT = 65560 const TIFFTAG_SGILOGENCODE = 65561 const TIFFTAG_SHADOWSCALE = 50739 const TIFFTAG_SMAXSAMPLEVALUE = 341 const TIFFTAG_SMINSAMPLEVALUE = 340 const TIFFTAG_SOFTWARE = 305 const TIFFTAG_STONITS = 37439 const TIFFTAG_STRIPBYTECOUNTS = 279 const TIFFTAG_STRIPOFFSETS = 273 const TIFFTAG_STRIPROWCOUNTS = 559 const TIFFTAG_SUBFILETYPE = 254 const TIFFTAG_SUBIFD = 330 const TIFFTAG_SUBTILEBLOCKSIZE = 50974 const TIFFTAG_T4OPTIONS = 292 const TIFFTAG_T6OPTIONS = 293 const TIFFTAG_T82OPTIONS = 435 const TIFFTAG_TARGETPRINTER = 337 const TIFFTAG_THRESHHOLDING = 263 const TIFFTAG_TIFFANNOTATIONDATA = 32932 const TIFFTAG_TIFF_RSID = 50908 const TIFFTAG_TILEBYTECOUNTS = 325 const TIFFTAG_TILEDEPTH = 32998 const TIFFTAG_TILELENGTH = 323 const TIFFTAG_TILEOFFSETS = 324 const TIFFTAG_TILEWIDTH = 322 const TIFFTAG_TRANSFERFUNCTION = 301 const TIFFTAG_UNIQUECAMERAMODEL = 50708 const TIFFTAG_VERSIONYEAR = 404 const TIFFTAG_WEBP_LEVEL = 65568 const TIFFTAG_WEBP_LOSSLESS = 65569 const TIFFTAG_WEBP_LOSSLESS_EXACT = 65571 const TIFFTAG_WHITELEVEL = 50717 const TIFFTAG_WHITEPOINT = 318 const TIFFTAG_WRITERSERIALNUMBER = 33405 const TIFFTAG_XCLIPPATHUNITS = 344 const TIFFTAG_XMLPACKET = 700 const TIFFTAG_XPOSITION = 286 const TIFFTAG_XRESOLUTION = 282 const TIFFTAG_YCBCRCOEFFICIENTS = 529 const TIFFTAG_YCBCRPOSITIONING = 531 const TIFFTAG_YCBCRSUBSAMPLING = 530 const TIFFTAG_YCLIPPATHUNITS = 345 const TIFFTAG_YPOSITION = 287 const TIFFTAG_YRESOLUTION = 283 const TIFFTAG_ZIPQUALITY = 65557 const TIFFTAG_ZSTD_LEVEL = 65564 const TIFFTCLAPI = "MODULE_SCOPE" const TIFF_ANY = "TIFF_NOTYPE" const TIFF_BEENWRITING = 0x00040 const TIFF_BIGENDIAN = 0x4d4d const TIFF_BIGTIFF = 0x80000 const TIFF_BUF4WRITE = 0x100000 const TIFF_BUFFERMMAP = 0x800000 const TIFF_BUFFERSETUP = 0x00010 const TIFF_CHOPPEDUPARRAYS = 0x4000000 const TIFF_CODERSETUP = 0x00020 const TIFF_DEFERSTRILELOAD = 0x1000000 const TIFF_DIRTYDIRECT = 0x00008 const TIFF_DIRTYHEADER = 0x00004 const TIFF_DIRTYSTRIP = 0x200000 const TIFF_FILLORDER = 0x00003 const TIFF_HEADERONLY = 0x10000 const TIFF_INCUSTOMIFD = 0x40000 const TIFF_INSUBIFD = 0x02000 const TIFF_ISTILED = 0x00400 const TIFF_LAZYSTRILELOAD = 0x2000000 const TIFF_LITTLEENDIAN = 0x4949 const TIFF_MAPPED = 0x00800 const TIFF_MAX_DIR_COUNT = 1048576 const TIFF_MYBUFFER = 0x00200 const TIFF_NOBITREV = 0x00100 const TIFF_NON_EXISTENT_DIR_NUMBER = "UINT_MAX" const TIFF_NOREADRAW = 0x20000 const TIFF_PERSAMPLE = 0x400000 const TIFF_POSTENCODE = 0x01000 const TIFF_SIZE_FORMAT = "zu" const TIFF_SSIZE_FORMAT = "PRId32" const TIFF_SSIZE_T = "int32_t" const TIFF_STRIPCHOP = 0x08000 const TIFF_SWAB = 0x00080 const TIFF_UPSAMPLED = 0x04000 const TIFF_VERSION_BIG = 43 const TIFF_VERSION_CLASSIC = 42 const UINT16_MAX = 0xffff const UINT32_MAX = 4294967295 const UINT64_MAX = 18446744073709551615 const UINT8_MAX = 0xff const UINTMAX_MAX = "UINT64_MAX" const UINTPTR_MAX = "UINT32_MAX" const UINT_FAST16_MAX = "UINT32_MAX" const UINT_FAST32_MAX = "UINT32_MAX" const UINT_FAST64_MAX = "UINT64_MAX" const UINT_FAST8_MAX = "UINT8_MAX" const UINT_LEAST16_MAX = "UINT16_MAX" const UINT_LEAST32_MAX = "UINT32_MAX" const UINT_LEAST64_MAX = "UINT64_MAX" const UINT_LEAST8_MAX = "UINT8_MAX" const UVSCALE = 410. const U_NEU = 0.210526316 const V_NEU = 0.473684211 const WINT_MAX = "UINT32_MAX" const WINT_MIN = 0 const YCBCRPOSITION_CENTERED = 1 const YCBCRPOSITION_COSITED = 2 const _DARWIN_USE_64_BIT_INODE = 1 const _TIFF_off_t = "off_t" const __PRI64 = "ll" const __PRIPTR = "" const __bool_true_false_are_defined = 1 const bool1 = "_Bool" const false1 = 0 const loff_t = "off_t" const static_assert = "_Static_assert" const true1 = 1 type Tuintptr_t = uint32 type Tintmax_t = int64 type Tuint8_t = uint8 type Tuintmax_t = uint64 type Tint_fast8_t = int8 type Tint_fast64_t = int64 type Tint_least8_t = int8 type Tint_least16_t = int16 type Tint_least32_t = int32 type Tint_least64_t = int64 type Tuint_fast8_t = uint8 type Tuint_fast64_t = uint64 type Tuint_least8_t = uint8 type Tuint_least16_t = uint16 type Tuint_least32_t = uint32 type Tuint_least64_t = uint64 type Tint_fast16_t = int32 type Tint_fast32_t = int32 type Tuint_fast16_t = uint32 type Tuint_fast32_t = uint32 type Timaxdiv_t = struct { F__ccgo_align [0]uint32 Fquot Tintmax_t Frem Tintmax_t } type Tint8 = int8 type Tuint8 = uint8 type Tint16 = int16 type Tuint16 = uint16 type Tint32 = int32 type Tuint32 = uint32 type Tint64 = int64 type Tuint64 = uint64 type Tuint16_vap = int32 type TTIFFHeaderCommon = struct { Ftiff_magic Tuint16_t Ftiff_version Tuint16_t } type TTIFFHeaderClassic = struct { Ftiff_magic Tuint16_t Ftiff_version Tuint16_t Ftiff_diroff Tuint32_t } type TTIFFHeaderBig = struct { F__ccgo_align [0]uint32 Ftiff_magic Tuint16_t Ftiff_version Tuint16_t Ftiff_offsetsize Tuint16_t Ftiff_unused Tuint16_t Ftiff_diroff Tuint64_t } type TTIFFDataType = int32 const TIFF_NOTYPE = 0 const TIFF_BYTE = 1 const TIFF_ASCII = 2 const TIFF_SHORT = 3 const TIFF_LONG = 4 const TIFF_RATIONAL = 5 const TIFF_SBYTE = 6 const TIFF_UNDEFINED = 7 const TIFF_SSHORT = 8 const TIFF_SLONG = 9 const TIFF_SRATIONAL = 10 const TIFF_FLOAT = 11 const TIFF_DOUBLE = 12 const TIFF_IFD = 13 const TIFF_LONG8 = 16 const TIFF_SLONG8 = 17 const TIFF_IFD8 = 18 type TTIFF = struct { F__ccgo_align [0]uint32 Ftif_name uintptr Ftif_fd int32 Ftif_mode int32 Ftif_flags Tuint32_t Ftif_diroff Tuint64_t Ftif_nextdiroff Tuint64_t Ftif_lastdiroff Tuint64_t Ftif_map_dir_offset_to_number uintptr Ftif_map_dir_number_to_offset uintptr Ftif_setdirectory_force_absolute int32 F__ccgo_align10 [4]byte Ftif_dir TTIFFDirectory Ftif_customdir TTIFFDirectory Ftif_header TTIFFHeaderUnion Ftif_header_size Tuint16_t Ftif_row Tuint32_t Ftif_curdir Ttdir_t Ftif_curdircount Ttdir_t Ftif_curstrip Tuint32_t F__ccgo_align18 [4]byte Ftif_curoff Tuint64_t Ftif_lastvalidoff Tuint64_t Ftif_dataoff Tuint64_t Ftif_nsubifd Tuint16_t F__ccgo_align22 [6]byte Ftif_subifdoff Tuint64_t Ftif_col Tuint32_t Ftif_curtile Tuint32_t Ftif_tilesize Ttmsize_t Ftif_decodestatus int32 Ftif_fixuptags TTIFFBoolMethod Ftif_setupdecode TTIFFBoolMethod Ftif_predecode TTIFFPreMethod Ftif_setupencode TTIFFBoolMethod Ftif_encodestatus int32 Ftif_preencode TTIFFPreMethod Ftif_postencode TTIFFBoolMethod Ftif_decoderow TTIFFCodeMethod Ftif_encoderow TTIFFCodeMethod Ftif_decodestrip TTIFFCodeMethod Ftif_encodestrip TTIFFCodeMethod Ftif_decodetile TTIFFCodeMethod Ftif_encodetile TTIFFCodeMethod Ftif_close TTIFFVoidMethod Ftif_seek TTIFFSeekMethod Ftif_cleanup TTIFFVoidMethod Ftif_defstripsize TTIFFStripMethod Ftif_deftilesize TTIFFTileMethod Ftif_data uintptr Ftif_scanlinesize Ttmsize_t Ftif_scanlineskew Ttmsize_t Ftif_rawdata uintptr Ftif_rawdatasize Ttmsize_t Ftif_rawdataoff Ttmsize_t Ftif_rawdataloaded Ttmsize_t Ftif_rawcp uintptr Ftif_rawcc Ttmsize_t Ftif_base uintptr Ftif_size Ttmsize_t Ftif_mapproc TTIFFMapFileProc Ftif_unmapproc TTIFFUnmapFileProc Ftif_clientdata Tthandle_t Ftif_readproc TTIFFReadWriteProc Ftif_writeproc TTIFFReadWriteProc Ftif_seekproc TTIFFSeekProc Ftif_closeproc TTIFFCloseProc Ftif_sizeproc TTIFFSizeProc Ftif_postdecode TTIFFPostMethod Ftif_fields uintptr Ftif_nfields Tsize_t Ftif_foundfield uintptr Ftif_tagmethods TTIFFTagMethods Ftif_clientinfo uintptr Ftif_fieldscompat uintptr Ftif_nfieldscompat Tsize_t Ftif_errorhandler TTIFFErrorHandlerExtR Ftif_errorhandler_user_data uintptr Ftif_warnhandler TTIFFErrorHandlerExtR Ftif_warnhandler_user_data uintptr Ftif_max_single_mem_alloc Ttmsize_t Ftif_max_cumulated_mem_alloc Ttmsize_t Ftif_cur_cumulated_mem_alloc Ttmsize_t } type Ttiff = TTIFF type Ttmsize_t = int32 type Ttoff_t = uint64 type Tttag_t = uint32 type Ttdir_t = uint32 type Ttsample_t = uint16 type Ttstrile_t = uint32 type Ttstrip_t = uint32 type Tttile_t = uint32 type Ttsize_t = int32 type Ttdata_t = uintptr type Tthandle_t = uintptr type TTIFFRGBValue = uint8 type TTIFFDisplay = struct { Fd_mat [3][3]float32 Fd_YCR float32 Fd_YCG float32 Fd_YCB float32 Fd_Vrwr Tuint32_t Fd_Vrwg Tuint32_t Fd_Vrwb Tuint32_t Fd_Y0R float32 Fd_Y0G float32 Fd_Y0B float32 Fd_gammaR float32 Fd_gammaG float32 Fd_gammaB float32 } type TTIFFYCbCrToRGB = struct { Fclamptab uintptr FCr_r_tab uintptr FCb_b_tab uintptr FCr_g_tab uintptr FCb_g_tab uintptr FY_tab uintptr } type TTIFFCIELabToRGB = struct { Frange1 int32 Frstep float32 Fgstep float32 Fbstep float32 FX0 float32 FY0 float32 FZ0 float32 Fdisplay TTIFFDisplay FYr2r [1501]float32 FYg2g [1501]float32 FYb2b [1501]float32 } type TTIFFRGBAImage = struct { Ftif uintptr Fstoponerr int32 FisContig int32 Falpha int32 Fwidth Tuint32_t Fheight Tuint32_t Fbitspersample Tuint16_t Fsamplesperpixel Tuint16_t Forientation Tuint16_t Freq_orientation Tuint16_t Fphotometric Tuint16_t Fredcmap uintptr Fgreencmap uintptr Fbluecmap uintptr Fget uintptr Fput struct { Fcontig [0]TtileContigRoutine Fseparate [0]TtileSeparateRoutine Fany1 uintptr } FMap uintptr FBWmap uintptr FPALmap uintptr Fycbcr uintptr Fcielab uintptr FUaToAa uintptr FBitdepth16To8 uintptr Frow_offset int32 Fcol_offset int32 } type T_TIFFRGBAImage = TTIFFRGBAImage type TtileContigRoutine = uintptr type TtileSeparateRoutine = uintptr type TTIFFInitMethod = uintptr type TTIFFCodec = struct { Fname uintptr Fscheme Tuint16_t Finit1 TTIFFInitMethod } type TTIFFRational_t = struct { FuNum Tuint32_t FuDenom Tuint32_t } type TTIFFErrorHandler = uintptr type TTIFFErrorHandlerExt = uintptr type TTIFFErrorHandlerExtR = uintptr type TTIFFReadWriteProc = uintptr type TTIFFSeekProc = uintptr type TTIFFCloseProc = uintptr type TTIFFSizeProc = uintptr type TTIFFMapFileProc = uintptr type TTIFFUnmapFileProc = uintptr type TTIFFExtendProc = uintptr type TTIFFField = struct { Ffield_tag Tuint32_t Ffield_readcount int16 Ffield_writecount int16 Ffield_type TTIFFDataType Ffield_anonymous Tuint32_t Fset_field_type TTIFFSetGetFieldType Fget_field_type TTIFFSetGetFieldType Ffield_bit uint16 Ffield_oktochange uint8 Ffield_passcount uint8 Ffield_name uintptr Ffield_subfields uintptr } type T_TIFFField = TTIFFField const TIFF_SETGET_UNDEFINED = 0 const TIFF_SETGET_ASCII = 1 const TIFF_SETGET_UINT8 = 2 const TIFF_SETGET_SINT8 = 3 const TIFF_SETGET_UINT16 = 4 const TIFF_SETGET_SINT16 = 5 const TIFF_SETGET_UINT32 = 6 const TIFF_SETGET_SINT32 = 7 const TIFF_SETGET_UINT64 = 8 const TIFF_SETGET_SINT64 = 9 const TIFF_SETGET_FLOAT = 10 const TIFF_SETGET_DOUBLE = 11 const TIFF_SETGET_IFD8 = 12 const TIFF_SETGET_INT = 13 const TIFF_SETGET_UINT16_PAIR = 14 const TIFF_SETGET_C0_ASCII = 15 const TIFF_SETGET_C0_UINT8 = 16 const TIFF_SETGET_C0_SINT8 = 17 const TIFF_SETGET_C0_UINT16 = 18 const TIFF_SETGET_C0_SINT16 = 19 const TIFF_SETGET_C0_UINT32 = 20 const TIFF_SETGET_C0_SINT32 = 21 const TIFF_SETGET_C0_UINT64 = 22 const TIFF_SETGET_C0_SINT64 = 23 const TIFF_SETGET_C0_FLOAT = 24 const TIFF_SETGET_C0_DOUBLE = 25 const TIFF_SETGET_C0_IFD8 = 26 const TIFF_SETGET_C16_ASCII = 27 const TIFF_SETGET_C16_UINT8 = 28 const TIFF_SETGET_C16_SINT8 = 29 const TIFF_SETGET_C16_UINT16 = 30 const TIFF_SETGET_C16_SINT16 = 31 const TIFF_SETGET_C16_UINT32 = 32 const TIFF_SETGET_C16_SINT32 = 33 const TIFF_SETGET_C16_UINT64 = 34 const TIFF_SETGET_C16_SINT64 = 35 const TIFF_SETGET_C16_FLOAT = 36 const TIFF_SETGET_C16_DOUBLE = 37 const TIFF_SETGET_C16_IFD8 = 38 const TIFF_SETGET_C32_ASCII = 39 const TIFF_SETGET_C32_UINT8 = 40 const TIFF_SETGET_C32_SINT8 = 41 const TIFF_SETGET_C32_UINT16 = 42 const TIFF_SETGET_C32_SINT16 = 43 const TIFF_SETGET_C32_UINT32 = 44 const TIFF_SETGET_C32_SINT32 = 45 const TIFF_SETGET_C32_UINT64 = 46 const TIFF_SETGET_C32_SINT64 = 47 const TIFF_SETGET_C32_FLOAT = 48 const TIFF_SETGET_C32_DOUBLE = 49 const TIFF_SETGET_C32_IFD8 = 50 const TIFF_SETGET_OTHER = 51 type TTIFFFieldArray = struct { Ftype1 TTIFFFieldArrayType Fallocated_size Tuint32_t Fcount Tuint32_t Ffields uintptr } type T_TIFFFieldArray = TTIFFFieldArray const tfiatImage = 0 const tfiatExif = 1 const tfiatGps = 2 const tfiatOther = 3 type TTIFFVSetMethod = uintptr type TTIFFVGetMethod = uintptr type TTIFFPrintMethod = uintptr type TTIFFTagMethods = struct { Fvsetfield TTIFFVSetMethod Fvgetfield TTIFFVGetMethod Fprintdir TTIFFPrintMethod } type TTIFFOpenOptions = struct { Ferrorhandler TTIFFErrorHandlerExtR Ferrorhandler_user_data uintptr Fwarnhandler TTIFFErrorHandlerExtR Fwarnhandler_user_data uintptr Fmax_single_mem_alloc Ttmsize_t Fmax_cumulated_mem_alloc Ttmsize_t } type TTIFFFieldInfo = struct { Ffield_tag Tttag_t Ffield_readcount int16 Ffield_writecount int16 Ffield_type TTIFFDataType Ffield_bit uint16 Ffield_oktochange uint8 Ffield_passcount uint8 Ffield_name uintptr } type Tiovec = struct { Fiov_base uintptr Fiov_len Tsize_t } type Tflock = struct { F__ccgo_align [0]uint32 Fl_type int16 Fl_whence int16 F__ccgo_align2 [4]byte Fl_start Toff_t Fl_len Toff_t Fl_pid Tpid_t F__ccgo_pad5 [4]byte } type Tfile_handle = struct { Fhandle_bytes uint32 Fhandle_type int32 } type Tf_owner_ex = struct { Ftype1 int32 Fpid Tpid_t } type TTIFFHashSetHashFunc = uintptr type TTIFFHashSetEqualFunc = uintptr type TTIFFHashSetFreeEltFunc = uintptr type TTIFFTagValue = struct { Finfo uintptr Fcount int32 Fvalue uintptr } type TTIFFDirEntry = struct { F__ccgo_align [0]uint32 Ftdir_tag Tuint16_t Ftdir_type Tuint16_t F__ccgo_align2 [4]byte Ftdir_count Tuint64_t Ftdir_offset struct { F__ccgo_align [0]uint32 Ftoff_long [0]Tuint32_t Ftoff_long8 [0]Tuint64_t Ftoff_short Tuint16_t F__ccgo_pad3 [6]byte } Ftdir_ignore Tuint8_t F__ccgo_pad5 [7]byte } type TTIFFEntryOffsetAndLength = struct { F__ccgo_align [0]uint32 Foffset Tuint64_t Flength Tuint64_t } type TTIFFDirectory = struct { F__ccgo_align [0]uint32 Ftd_fieldsset [4]Tuint32_t Ftd_imagewidth Tuint32_t Ftd_imagelength Tuint32_t Ftd_imagedepth Tuint32_t Ftd_tilewidth Tuint32_t Ftd_tilelength Tuint32_t Ftd_tiledepth Tuint32_t Ftd_subfiletype Tuint32_t Ftd_bitspersample Tuint16_t Ftd_sampleformat Tuint16_t Ftd_compression Tuint16_t Ftd_photometric Tuint16_t Ftd_threshholding Tuint16_t Ftd_fillorder Tuint16_t Ftd_orientation Tuint16_t Ftd_samplesperpixel Tuint16_t Ftd_rowsperstrip Tuint32_t Ftd_minsamplevalue Tuint16_t Ftd_maxsamplevalue Tuint16_t Ftd_sminsamplevalue uintptr Ftd_smaxsamplevalue uintptr Ftd_xresolution float32 Ftd_yresolution float32 Ftd_resolutionunit Tuint16_t Ftd_planarconfig Tuint16_t Ftd_xposition float32 Ftd_yposition float32 Ftd_pagenumber [2]Tuint16_t Ftd_colormap [3]uintptr Ftd_halftonehints [2]Tuint16_t Ftd_extrasamples Tuint16_t Ftd_sampleinfo uintptr Ftd_stripsperimage Tuint32_t Ftd_nstrips Tuint32_t Ftd_stripoffset_p uintptr Ftd_stripbytecount_p uintptr Ftd_stripoffsetbyteallocsize Tuint32_t Ftd_stripoffset_entry TTIFFDirEntry Ftd_stripbytecount_entry TTIFFDirEntry Ftd_nsubifd Tuint16_t Ftd_subifd uintptr Ftd_ycbcrsubsampling [2]Tuint16_t Ftd_ycbcrpositioning Tuint16_t Ftd_transferfunction [3]uintptr Ftd_refblackwhite uintptr Ftd_inknameslen int32 Ftd_inknames uintptr Ftd_numberofinks Tuint16_t Ftd_customValueCount int32 Ftd_customValues uintptr Ftd_deferstrilearraywriting uint8 Ftd_iswrittentofile uint8 F__ccgo_align52 [2]byte Ftd_dirdatasize_write Tuint64_t Ftd_dirdatasize_read Tuint64_t Ftd_dirdatasize_Noffsets Tuint32_t Ftd_dirdatasize_offsets uintptr } type TTIFFSetGetFieldType = int32 type TTIFFFieldArrayType = int32 type TTIFFClientInfoLink = struct { Fnext uintptr Fdata uintptr Fname uintptr } type Tclient_info = TTIFFClientInfoLink type Ttidataval_t = uint8 type Ttidata_t = uintptr type TTIFFVoidMethod = uintptr type TTIFFBoolMethod = uintptr type TTIFFPreMethod = uintptr type TTIFFCodeMethod = uintptr type TTIFFSeekMethod = uintptr type TTIFFPostMethod = uintptr type TTIFFStripMethod = uintptr type TTIFFTileMethod = uintptr type TTIFFOffsetAndDirNumber1 = struct { F__ccgo_align [0]uint32 Foffset Tuint64_t FdirNumber Ttdir_t F__ccgo_pad2 [4]byte } type TTIFFOffsetAndDirNumber = struct { F__ccgo_align [0]uint32 Foffset Tuint64_t FdirNumber Ttdir_t F__ccgo_pad2 [4]byte } type TTIFFHeaderUnion = struct { F__ccgo_align [0]uint32 Fclassic [0]TTIFFHeaderClassic Fbig [0]TTIFFHeaderBig Fcommon TTIFFHeaderCommon F__ccgo_pad3 [12]byte } type TTIFFOpenOptions1 = struct { Ferrorhandler TTIFFErrorHandlerExtR Ferrorhandler_user_data uintptr Fwarnhandler TTIFFErrorHandlerExtR Fwarnhandler_user_data uintptr Fmax_single_mem_alloc Ttmsize_t Fmax_cumulated_mem_alloc Ttmsize_t } type TTIFFIOSize_t = uint32 type TTIFFEncodeDecodeMethod = uintptr type TTIFFPredictorState = struct { Fpredictor int32 Fstride Ttmsize_t Frowsize Ttmsize_t Fencoderow TTIFFCodeMethod Fencodestrip TTIFFCodeMethod Fencodetile TTIFFCodeMethod Fencodepfunc TTIFFEncodeDecodeMethod Fdecoderow TTIFFCodeMethod Fdecodestrip TTIFFCodeMethod Fdecodetile TTIFFCodeMethod Fdecodepfunc TTIFFEncodeDecodeMethod Fvgetparent TTIFFVGetMethod Fvsetparent TTIFFVSetMethod Fprintdir TTIFFPrintMethod Fsetupdecode TTIFFBoolMethod Fsetupencode TTIFFBoolMethod } func X_TIFFMultiply32(tls *libc.TLS, tif uintptr, first Tuint32_t, second Tuint32_t, where uintptr) (r Tuint32_t) { bp := tls.Alloc(16) defer tls.Free(16) if second != 0 && first > uint32(0xffffffff)/second { XTIFFErrorExtR(tls, tif, where, __ccgo_ts+21937, libc.VaList(bp+8, where)) return uint32(0) } return first * second } func X_TIFFMultiply64(tls *libc.TLS, tif uintptr, first Tuint64_t, second Tuint64_t, where uintptr) (r Tuint64_t) { bp := tls.Alloc(16) defer tls.Free(16) if second != 0 && first > uint64(0xffffffffffffffff)/second { XTIFFErrorExtR(tls, tif, where, __ccgo_ts+21937, libc.VaList(bp+8, where)) return uint64(0) } return first * second } func X_TIFFMultiplySSize(tls *libc.TLS, tif uintptr, first Ttmsize_t, second Ttmsize_t, where uintptr) (r Ttmsize_t) { bp := tls.Alloc(16) defer tls.Free(16) if first <= 0 || second <= 0 { if tif != libc.UintptrFromInt32(0) && where != libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, where, __ccgo_ts+21960, libc.VaList(bp+8, where)) } return 0 } if first > libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))/second { if tif != libc.UintptrFromInt32(0) && where != libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, where, __ccgo_ts+21937, libc.VaList(bp+8, where)) } return 0 } return first * second } func X_TIFFCastUInt64ToSSize(tls *libc.TLS, tif uintptr, val Tuint64_t, module uintptr) (r Ttmsize_t) { if val > libc.Uint64FromInt32(libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))) { if tif != libc.UintptrFromInt32(0) && module != libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+22007, 0) } return 0 } return libc.Int32FromUint64(val) } func X_TIFFCheckRealloc(tls *libc.TLS, tif uintptr, buffer uintptr, nmemb Ttmsize_t, elem_size Ttmsize_t, what uintptr) (r uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var count Ttmsize_t var cp uintptr _, _ = count, cp cp = libc.UintptrFromInt32(0) count = X_TIFFMultiplySSize(tls, tif, nmemb, elem_size, libc.UintptrFromInt32(0)) /* * Check for integer overflow. */ if count != 0 { cp = X_TIFFreallocExt(tls, tif, buffer, count) } if cp == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+22024, libc.VaList(bp+8, what, nmemb, elem_size)) } return cp } func X_TIFFCheckMalloc(tls *libc.TLS, tif uintptr, nmemb Ttmsize_t, elem_size Ttmsize_t, what uintptr) (r uintptr) { return X_TIFFCheckRealloc(tls, tif, libc.UintptrFromInt32(0), nmemb, elem_size, what) } func _TIFFDefaultTransferFunction(tls *libc.TLS, tif uintptr, td uintptr) (r int32) { var i, n, nbytes Ttmsize_t var t float64 var tf, v1, v2, v4, v5 uintptr _, _, _, _, _, _, _, _, _ = i, n, nbytes, t, tf, v1, v2, v4, v5 tf = td + 224 v2 = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(tf + 2*4)) = v2 v1 = v2 *(*uintptr)(unsafe.Pointer(tf + 1*4)) = v1 *(*uintptr)(unsafe.Pointer(tf)) = v1 if uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) >= libc.Uint32FromInt64(4)*libc.Uint32FromInt32(8)-libc.Uint32FromInt32(2) { return 0 } n = libc.Int32FromInt32(1) << (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample nbytes = libc.Int32FromUint32(libc.Uint32FromInt32(n) * uint32(2)) *(*uintptr)(unsafe.Pointer(tf)) = X_TIFFmallocExt(tls, tif, nbytes) if *(*uintptr)(unsafe.Pointer(tf)) == libc.UintptrFromInt32(0) { return 0 } *(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(tf)))) = uint16(0) i = int32(1) for { if !(i < n) { break } t = float64(i) / (float64(n) - float64(1)) *(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(tf)) + uintptr(i)*2)) = uint16(libc.Xfloor(tls, float64(65535)*libc.Xpow(tls, t, float64(2.2))+float64(0.5))) goto _3 _3: ; i++ } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)-libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples) > int32(1) { *(*uintptr)(unsafe.Pointer(tf + 1*4)) = X_TIFFmallocExt(tls, tif, nbytes) if *(*uintptr)(unsafe.Pointer(tf + 1*4)) == libc.UintptrFromInt32(0) { goto bad } X_TIFFmemcpy(tls, *(*uintptr)(unsafe.Pointer(tf + 1*4)), *(*uintptr)(unsafe.Pointer(tf)), nbytes) *(*uintptr)(unsafe.Pointer(tf + 2*4)) = X_TIFFmallocExt(tls, tif, nbytes) if *(*uintptr)(unsafe.Pointer(tf + 2*4)) == libc.UintptrFromInt32(0) { goto bad } X_TIFFmemcpy(tls, *(*uintptr)(unsafe.Pointer(tf + 2*4)), *(*uintptr)(unsafe.Pointer(tf)), nbytes) } return int32(1) goto bad bad: ; if *(*uintptr)(unsafe.Pointer(tf)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(tf))) } if *(*uintptr)(unsafe.Pointer(tf + 1*4)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(tf + 1*4))) } if *(*uintptr)(unsafe.Pointer(tf + 2*4)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(tf + 2*4))) } v5 = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(tf + 2*4)) = v5 v4 = v5 *(*uintptr)(unsafe.Pointer(tf + 1*4)) = v4 *(*uintptr)(unsafe.Pointer(tf)) = v4 return 0 } func _TIFFDefaultRefBlackWhite(tls *libc.TLS, tif uintptr, td uintptr) (r int32) { var i int32 var v1, v2, v3 float32 _, _, _, _ = i, v1, v2, v3 (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(libc.Uint32FromInt32(6)*libc.Uint32FromInt64(4))) if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite == libc.UintptrFromInt32(0) { return 0 } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == int32(PHOTOMETRIC_YCBCR) { /* * YCbCr (Class Y) images must have the ReferenceBlackWhite * tag set. Fix the broken images, which lacks that tag. */ *(*float32)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite)) = libc.Float32FromFloat32(0) v2 = libc.Float32FromFloat32(255) *(*float32)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite + 5*4)) = v2 v1 = v2 *(*float32)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite + 3*4)) = v1 *(*float32)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite + 1*4)) = v1 v3 = libc.Float32FromFloat32(128) *(*float32)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite + 4*4)) = v3 *(*float32)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite + 2*4)) = v3 } else { /* * Assume RGB (Class R) */ i = 0 for { if !(i < int32(3)) { break } *(*float32)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite + uintptr(int32(2)*i+0)*4)) = libc.Float32FromInt32(0) *(*float32)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite + uintptr(int32(2)*i+int32(1))*4)) = float32(libc.Int32FromInt32(1)<<(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample - libc.Int32FromInt32(1)) goto _4 _4: ; i++ } } return int32(1) } // C documentation // // /* // * Like TIFFGetField, but return any default // * value if the tag is not present in the directory. // * // * NB: We use the value in the directory, rather than // * explicit values so that defaults exist only one // * place in the library -- in TIFFDefaultDirectory. // */ func XTIFFVGetFieldDefaulted(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { var maxsamplevalue Tuint16_t var sp, td uintptr _, _, _ = maxsamplevalue, sp, td td = tif + 56 if XTIFFVGetField(tls, tif, tag, ap) != 0 { return int32(1) } switch tag { case uint32(TIFFTAG_SUBFILETYPE): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subfiletype return int32(1) case uint32(TIFFTAG_BITSPERSAMPLE): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample return int32(1) case uint32(TIFFTAG_THRESHHOLDING): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_threshholding return int32(1) case uint32(TIFFTAG_FILLORDER): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder return int32(1) case uint32(TIFFTAG_ORIENTATION): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_orientation return int32(1) case uint32(TIFFTAG_SAMPLESPERPIXEL): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel return int32(1) case uint32(TIFFTAG_ROWSPERSTRIP): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip return int32(1) case uint32(TIFFTAG_MINSAMPLEVALUE): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_minsamplevalue return int32(1) case uint32(TIFFTAG_MAXSAMPLEVALUE): /* td_bitspersample=1 is always set in TIFFDefaultDirectory(). * Therefore, td_maxsamplevalue has to be re-calculated in * TIFFGetFieldDefaulted(). */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) > 0 { /* This shift operation into a uint16_t limits the value to * 65535 even if td_bitspersamle is > 16 */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) <= int32(16) { maxsamplevalue = libc.Uint16FromInt32(int32(1)<<(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample - int32(1)) /* 2**(BitsPerSample) - 1 */ } else { maxsamplevalue = uint16(65535) } } else { maxsamplevalue = uint16(0) } *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = maxsamplevalue return int32(1) case uint32(TIFFTAG_PLANARCONFIG): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig return int32(1) case uint32(TIFFTAG_RESOLUTIONUNIT): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_resolutionunit return int32(1) case uint32(TIFFTAG_PREDICTOR): sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data if sp == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+22088, 0) *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = uint16(0) return 0 } *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = libc.Uint16FromInt32((*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor) return int32(1) case uint32(TIFFTAG_DOTRANGE): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = uint16(0) *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = libc.Uint16FromInt32(int32(1)<<(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample - int32(1)) return int32(1) case uint32(TIFFTAG_INKSET): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = uint16(INKSET_CMYK) return int32(1) case uint32(TIFFTAG_NUMBEROFINKS): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = uint16(4) return int32(1) case uint32(TIFFTAG_EXTRASAMPLES): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo return int32(1) case uint32(TIFFTAG_MATTEING): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = libc.BoolUint16(libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples) == int32(1) && libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo))) == int32(EXTRASAMPLE_ASSOCALPHA)) return int32(1) case uint32(TIFFTAG_TILEDEPTH): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tiledepth return int32(1) case uint32(TIFFTAG_DATATYPE): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = libc.Uint16FromInt32(libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat) - int32(1)) return int32(1) case uint32(TIFFTAG_SAMPLEFORMAT): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat return int32(1) case uint32(TIFFTAG_IMAGEDEPTH): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth return int32(1) case uint32(TIFFTAG_YCBCRCOEFFICIENTS): *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = uintptr(unsafe.Pointer(&_ycbcrcoeffs)) return int32(1) case uint32(TIFFTAG_YCBCRSUBSAMPLING): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer(td + 216)) *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)) return int32(1) case uint32(TIFFTAG_YCBCRPOSITIONING): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_ycbcrpositioning return int32(1) case uint32(TIFFTAG_WHITEPOINT): _whitepoint[0] = libc.Float32FromFloat32(96.425) / (libc.Float32FromFloat32(96.425) + libc.Float32FromFloat32(100) + libc.Float32FromFloat32(82.468)) _whitepoint[int32(1)] = libc.Float32FromFloat32(100) / (libc.Float32FromFloat32(96.425) + libc.Float32FromFloat32(100) + libc.Float32FromFloat32(82.468)) *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = uintptr(unsafe.Pointer(&_whitepoint)) return int32(1) case uint32(TIFFTAG_TRANSFERFUNCTION): if !(*(*uintptr)(unsafe.Pointer(td + 224)) != 0) && !(_TIFFDefaultTransferFunction(tls, tif, td) != 0) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+22143, 0) return 0 } *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*uintptr)(unsafe.Pointer(td + 224)) if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)-libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples) > int32(1) { *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*uintptr)(unsafe.Pointer(td + 224 + 1*4)) *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*uintptr)(unsafe.Pointer(td + 224 + 2*4)) } return int32(1) case uint32(TIFFTAG_REFERENCEBLACKWHITE): if !((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite != 0) && !(_TIFFDefaultRefBlackWhite(tls, tif, td) != 0) { return 0 } *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite return int32(1) } return 0 } /* defaults are from CCIR Recommendation 601-1 */ var _ycbcrcoeffs = [3]float32{ 0: libc.Float32FromFloat32(0.299), 1: libc.Float32FromFloat32(0.587), 2: libc.Float32FromFloat32(0.114), } /* TIFF 6.0 specification tells that it is no default value for the WhitePoint, but AdobePhotoshop TIFF Technical Note tells that it should be CIE D50. */ var _whitepoint [2]float32 // C documentation // // /* // * Like TIFFGetField, but return any default // * value if the tag is not present in the directory. // */ func XTIFFGetFieldDefaulted(tls *libc.TLS, tif uintptr, tag Tuint32_t, va uintptr) (r int32) { var ap Tva_list var ok int32 _, _ = ap, ok ap = va ok = XTIFFVGetFieldDefaulted(tls, tif, tag, ap) _ = ap return ok } func X_TIFFClampDoubleToFloat(tls *libc.TLS, val float64) (r float32) { if val > libc.Float64FromFloat32(3.4028234663852886e+38) { return libc.Float32FromFloat32(3.4028234663852886e+38) } if val < float64(-libc.Float32FromFloat32(3.4028234663852886e+38)) { return -libc.Float32FromFloat32(3.4028234663852886e+38) } return float32(val) } func X_TIFFClampDoubleToUInt32(tls *libc.TLS, val float64) (r Tuint32_t) { if val < libc.Float64FromInt32(0) { return uint32(0) } if val > libc.Float64FromUint32(0xFFFFFFFF) || val != val { return uint32(0xFFFFFFFF) } return uint32(val) } func X_TIFFSeekOK(tls *libc.TLS, tif uintptr, off Ttoff_t) (r int32) { /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */ /* See http://bugzilla.maptools.org/show_bug.cgi?id=2726 */ return libc.BoolInt32(off <= ^libc.Uint64FromInt32(0)/libc.Uint64FromInt32(2) && (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, off, 0) == off) } const D50_X01 = 96.4250 const D50_Y01 = 100.0 const D50_Z01 = 82.4680 const O_RDONLY1 = 0 const TIFF_MAPPED1 = 2048 const TIFF_MYBUFFER1 = 512 const UINT32_MAX1 = "0xffffffffu" const UINT64_MAX1 = "0xffffffffffffffffu" /************************************************************************/ /* TIFFCleanup() */ /************************************************************************/ /** * Auxiliary function to free the TIFF structure. Given structure will be * completely freed, so you should save opened file handle and pointer * to the close procedure in external variables before calling * _TIFFCleanup(), if you will need these ones to close the file. * * @param tif A TIFF pointer. */ func XTIFFCleanup(tls *libc.TLS, tif uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var fld, psLink uintptr var i, i1 Tuint32_t _, _, _, _ = fld, i, i1, psLink /* * Flush buffered data and directory (if dirty). */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode != O_RDONLY1 { XTIFFFlush(tls, tif) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup})))(tls, tif) XTIFFFreeDirectory(tls, tif) X_TIFFCleanupIFDOffsetAndNumberMaps(tls, tif) /* * Clean up client info links. */ for (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientinfo != 0 { psLink = (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientinfo (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientinfo = (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fnext X_TIFFfreeExt(tls, tif, (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fname) X_TIFFfreeExt(tls, tif, psLink) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00200) != 0 { X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, Ttoff_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_unmapproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base, libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_size)) } /* * Clean up custom fields. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields > uint32(0) { i = uint32(0) for { if !(i < (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields) { break } fld = *(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(i)*4)) if (*TTIFFField)(unsafe.Pointer(fld)).Ffield_name != libc.UintptrFromInt32(0) { if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fld)).Ffield_bit) == int32(FIELD_CUSTOM) && XTIFFFieldIsAnonymous(tls, fld) != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFField)(unsafe.Pointer(fld)).Ffield_name) X_TIFFfreeExt(tls, tif, fld) } } goto _1 _1: ; i++ } X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfieldscompat > uint32(0) { i1 = uint32(0) for { if !(i1 < (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfieldscompat) { break } if (*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(i1)*16))).Fallocated_size != 0 { X_TIFFfreeExt(tls, tif, (*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(i1)*16))).Ffields) } goto _2 _2: ; i1++ } X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_cur_cumulated_mem_alloc != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+22179, __ccgo_ts+22191, libc.VaList(bp+8, libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_cur_cumulated_mem_alloc))) } X_TIFFfreeExt(tls, libc.UintptrFromInt32(0), tif) } /************************************************************************/ /* _TIFFCleanupIFDOffsetAndNumberMaps() */ /************************************************************************/ func X_TIFFCleanupIFDOffsetAndNumberMaps(tls *libc.TLS, tif uintptr) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number != 0 { XTIFFHashSetDestroy(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number) (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number = libc.UintptrFromInt32(0) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset != 0 { XTIFFHashSetDestroy(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset) (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset = libc.UintptrFromInt32(0) } } /************************************************************************/ /* TIFFClose() */ /************************************************************************/ /** * Close a previously opened TIFF file. * * TIFFClose closes a file that was previously opened with TIFFOpen(). * Any buffered data are flushed to the file, including the contents of * the current directory (if modified); and all resources are reclaimed. * * @param tif A TIFF pointer. */ func XTIFFClose(tls *libc.TLS, tif uintptr) { var closeproc TTIFFCloseProc var fd Tthandle_t _, _ = closeproc, fd if tif != libc.UintptrFromInt32(0) { closeproc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_closeproc fd = (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata XTIFFCleanup(tls, tif) (*(*func(*libc.TLS, Tthandle_t) int32)(unsafe.Pointer(&struct{ uintptr }{closeproc})))(tls, fd) } } const O_RDONLY2 = 00 const TIFFInitJBIG = "NotConfigured" const TIFFInitJPEG = "NotConfigured" const TIFFInitLERC = "NotConfigured" const TIFFInitLZMA = "NotConfigured" const TIFFInitOJPEG = "NotConfigured" const TIFFInitPixarLog = "NotConfigured" const TIFFInitWebP = "NotConfigured" const TIFFInitZIP = "NotConfigured" const TIFFInitZSTD = "NotConfigured" const TIFF_MAPPED2 = 0x00800 const TIFF_MYBUFFER2 = 0x00200 func init() { p := unsafe.Pointer(&X_TIFFBuiltinCODECS) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(XTIFFInitDumpMode) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(XTIFFInitLZW) *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(XTIFFInitPackBits) *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(XTIFFInitThunderScan) *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(XTIFFInitNeXT) *(*uintptr)(unsafe.Add(p, 68)) = __ccgo_fp(_NotConfigured) *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_NotConfigured) *(*uintptr)(unsafe.Add(p, 92)) = __ccgo_fp(XTIFFInitCCITTRLE) *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(XTIFFInitCCITTRLEW) *(*uintptr)(unsafe.Add(p, 116)) = __ccgo_fp(XTIFFInitCCITTFax3) *(*uintptr)(unsafe.Add(p, 128)) = __ccgo_fp(XTIFFInitCCITTFax4) *(*uintptr)(unsafe.Add(p, 140)) = __ccgo_fp(_NotConfigured) *(*uintptr)(unsafe.Add(p, 152)) = __ccgo_fp(_NotConfigured) *(*uintptr)(unsafe.Add(p, 164)) = __ccgo_fp(_NotConfigured) *(*uintptr)(unsafe.Add(p, 176)) = __ccgo_fp(_NotConfigured) *(*uintptr)(unsafe.Add(p, 188)) = __ccgo_fp(XTIFFInitSGILog) *(*uintptr)(unsafe.Add(p, 200)) = __ccgo_fp(XTIFFInitSGILog) *(*uintptr)(unsafe.Add(p, 212)) = __ccgo_fp(_NotConfigured) *(*uintptr)(unsafe.Add(p, 224)) = __ccgo_fp(_NotConfigured) *(*uintptr)(unsafe.Add(p, 236)) = __ccgo_fp(_NotConfigured) *(*uintptr)(unsafe.Add(p, 248)) = __ccgo_fp(_NotConfigured) } func __notConfigured(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var c, v1 uintptr var _ /* compression_code at bp+0 */ [20]uint8 _, _ = c, v1 c = XTIFFFindCODEC(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) libc.X__builtin_snprintf(tls, bp, uint32(20), __ccgo_ts+22429, libc.VaList(bp+32, libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression))) if c != 0 { v1 = (*TTIFFCodec)(unsafe.Pointer(c)).Fname } else { v1 = bp } XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+22432, libc.VaList(bp+32, v1)) return 0 } func _NotConfigured(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { _ = scheme (*TTIFF)(unsafe.Pointer(tif)).Ftif_fixuptags = __ccgo_fp(__notConfigured) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestatus = FALSE (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode = __ccgo_fp(__notConfigured) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestatus = FALSE (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode = __ccgo_fp(__notConfigured) return int32(1) } /************************************************************************/ /* TIFFIsCODECConfigured() */ /************************************************************************/ /** * Check whether we have working codec for the specific coding scheme. * * @return returns 1 if the codec is configured and working. Otherwise * 0 will be returned. */ func XTIFFIsCODECConfigured(tls *libc.TLS, scheme Tuint16_t) (r int32) { var codec uintptr _ = codec codec = XTIFFFindCODEC(tls, scheme) if codec == libc.UintptrFromInt32(0) { return 0 } if (*TTIFFCodec)(unsafe.Pointer(codec)).Finit1 == libc.UintptrFromInt32(0) { return 0 } if (*TTIFFCodec)(unsafe.Pointer(codec)).Finit1 != __ccgo_fp(_NotConfigured) { return int32(1) } return 0 } // C documentation // // /* // * Convert color value from the CIE L*a*b* 1976 space to CIE XYZ. // */ func XTIFFCIELabToXYZ(tls *libc.TLS, cielab uintptr, l Tuint32_t, a Tint32_t, b Tint32_t, X uintptr, Y uintptr, Z uintptr) { XTIFFCIELab16ToXYZ(tls, cielab, l*uint32(257), a*int32(256), b*int32(256), X, Y, Z) } // C documentation // // /* // * For CIELab encoded in 16 bits, L is an unsigned integer range [0,65535]. // * The a* and b* components are signed integers range [-32768,32767]. The 16 // * bit chrominance values are encoded as 256 times the 1976 CIE a* and b* // * values // */ func XTIFFCIELab16ToXYZ(tls *libc.TLS, cielab uintptr, l Tuint32_t, a Tint32_t, b Tint32_t, X uintptr, Y uintptr, Z uintptr) { var L, cby, tmp float32 _, _, _ = L, cby, tmp L = float32(l) * libc.Float32FromFloat32(100) / libc.Float32FromFloat32(65535) if L < libc.Float32FromFloat32(8.856) { *(*float32)(unsafe.Pointer(Y)) = L * (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).FY0 / libc.Float32FromFloat32(903.292) cby = libc.Float32FromFloat32(7.787)*(*(*float32)(unsafe.Pointer(Y))/(*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).FY0) + libc.Float32FromFloat32(16)/libc.Float32FromFloat32(116) } else { cby = (L + libc.Float32FromFloat32(16)) / libc.Float32FromFloat32(116) *(*float32)(unsafe.Pointer(Y)) = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).FY0 * cby * cby * cby } tmp = float32(a)/libc.Float32FromFloat32(256)/libc.Float32FromFloat32(500) + cby if tmp < libc.Float32FromFloat32(0.2069) { *(*float32)(unsafe.Pointer(X)) = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).FX0 * (tmp - libc.Float32FromFloat32(0.13793)) / libc.Float32FromFloat32(7.787) } else { *(*float32)(unsafe.Pointer(X)) = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).FX0 * tmp * tmp * tmp } tmp = cby - float32(b)/libc.Float32FromFloat32(256)/libc.Float32FromFloat32(200) if tmp < libc.Float32FromFloat32(0.2069) { *(*float32)(unsafe.Pointer(Z)) = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).FZ0 * (tmp - libc.Float32FromFloat32(0.13793)) / libc.Float32FromFloat32(7.787) } else { *(*float32)(unsafe.Pointer(Z)) = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).FZ0 * tmp * tmp * tmp } } // C documentation // // /* // * Convert color value from the XYZ space to RGB. // */ func XTIFFXYZToRGB(tls *libc.TLS, cielab uintptr, X float32, Y float32, Z float32, r uintptr, g uintptr, b uintptr) { var Yb, Yg, Yr, v1, v2, v3, v4, v5, v6 float32 var i Tsize_t var matrix uintptr var v10, v12, v8 float64 var v11, v13, v14, v15, v7, v9 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Yb, Yg, Yr, i, matrix, v1, v10, v11, v12, v13, v14, v15, v2, v3, v4, v5, v6, v7, v8, v9 matrix = cielab + 28 /* Multiply through the matrix to get luminosity values. */ Yr = *(*float32)(unsafe.Pointer(matrix))*X + *(*float32)(unsafe.Pointer(matrix + 1*4))*Y + *(*float32)(unsafe.Pointer(matrix + 2*4))*Z Yg = *(*float32)(unsafe.Pointer(matrix + 3*4))*X + *(*float32)(unsafe.Pointer(matrix + 4*4))*Y + *(*float32)(unsafe.Pointer(matrix + 5*4))*Z Yb = *(*float32)(unsafe.Pointer(matrix + 6*4))*X + *(*float32)(unsafe.Pointer(matrix + 7*4))*Y + *(*float32)(unsafe.Pointer(matrix + 8*4))*Z /* Clip input */ if Yr > (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0R { v1 = Yr } else { v1 = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0R } Yr = v1 if Yg > (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0G { v2 = Yg } else { v2 = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0G } Yg = v2 if Yb > (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0B { v3 = Yb } else { v3 = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0B } Yb = v3 /* Avoid overflow in case of wrong input values */ if Yr < (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_YCR { v4 = Yr } else { v4 = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_YCR } Yr = v4 if Yg < (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_YCG { v5 = Yg } else { v5 = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_YCG } Yg = v5 if Yb < (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_YCB { v6 = Yb } else { v6 = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_YCB } Yb = v6 /* Turn luminosity to colour value. */ i = uint32((Yr - (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0R) / (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frstep) if libc.Uint32FromInt32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1) < i { v7 = libc.Uint32FromInt32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1) } else { v7 = i } i = v7 if *(*float32)(unsafe.Pointer(cielab + 112 + uintptr(i)*4)) > libc.Float32FromInt32(0) { v8 = float64(*(*float32)(unsafe.Pointer(cielab + 112 + uintptr(i)*4))) + float64(0.5) } else { v8 = float64(*(*float32)(unsafe.Pointer(cielab + 112 + uintptr(i)*4))) - float64(0.5) } *(*Tuint32_t)(unsafe.Pointer(r)) = uint32(v8) i = uint32((Yg - (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0G) / (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fgstep) if libc.Uint32FromInt32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1) < i { v9 = libc.Uint32FromInt32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1) } else { v9 = i } i = v9 if *(*float32)(unsafe.Pointer(cielab + 6116 + uintptr(i)*4)) > libc.Float32FromInt32(0) { v10 = float64(*(*float32)(unsafe.Pointer(cielab + 6116 + uintptr(i)*4))) + float64(0.5) } else { v10 = float64(*(*float32)(unsafe.Pointer(cielab + 6116 + uintptr(i)*4))) - float64(0.5) } *(*Tuint32_t)(unsafe.Pointer(g)) = uint32(v10) i = uint32((Yb - (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0B) / (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fbstep) if libc.Uint32FromInt32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1) < i { v11 = libc.Uint32FromInt32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1) } else { v11 = i } i = v11 if *(*float32)(unsafe.Pointer(cielab + 12120 + uintptr(i)*4)) > libc.Float32FromInt32(0) { v12 = float64(*(*float32)(unsafe.Pointer(cielab + 12120 + uintptr(i)*4))) + float64(0.5) } else { v12 = float64(*(*float32)(unsafe.Pointer(cielab + 12120 + uintptr(i)*4))) - float64(0.5) } *(*Tuint32_t)(unsafe.Pointer(b)) = uint32(v12) /* Clip output. */ if *(*Tuint32_t)(unsafe.Pointer(r)) < (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Vrwr { v13 = *(*Tuint32_t)(unsafe.Pointer(r)) } else { v13 = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Vrwr } *(*Tuint32_t)(unsafe.Pointer(r)) = v13 if *(*Tuint32_t)(unsafe.Pointer(g)) < (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Vrwg { v14 = *(*Tuint32_t)(unsafe.Pointer(g)) } else { v14 = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Vrwg } *(*Tuint32_t)(unsafe.Pointer(g)) = v14 if *(*Tuint32_t)(unsafe.Pointer(b)) < (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Vrwb { v15 = *(*Tuint32_t)(unsafe.Pointer(b)) } else { v15 = (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Vrwb } *(*Tuint32_t)(unsafe.Pointer(b)) = v15 } // C documentation // // /* // * Allocate conversion state structures and make look_up tables for // * the Yr,Yb,Yg <=> r,g,b conversions. // */ func XTIFFCIELabToRGBInit(tls *libc.TLS, cielab uintptr, display uintptr, refWhite uintptr) (r int32) { var dfGamma float64 var i Tsize_t _, _ = dfGamma, i (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1 = int32(CIELABTORGB_TABLE_RANGE) X_TIFFmemcpy(tls, cielab+28, display, int32(84)) /* Red */ dfGamma = float64(1) / float64((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_gammaR) (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frstep = ((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_YCR - (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0R) / float32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1) i = uint32(0) for { if !(i <= libc.Uint32FromInt32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1)) { break } *(*float32)(unsafe.Pointer(cielab + 112 + uintptr(i)*4)) = float32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Vrwr) * float32(libc.Xpow(tls, float64(i)/float64((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1), dfGamma)) goto _1 _1: ; i++ } /* Green */ dfGamma = float64(1) / float64((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_gammaG) (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fgstep = ((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_YCR - (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0R) / float32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1) i = uint32(0) for { if !(i <= libc.Uint32FromInt32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1)) { break } *(*float32)(unsafe.Pointer(cielab + 6116 + uintptr(i)*4)) = float32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Vrwg) * float32(libc.Xpow(tls, float64(i)/float64((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1), dfGamma)) goto _2 _2: ; i++ } /* Blue */ dfGamma = float64(1) / float64((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_gammaB) (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fbstep = ((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_YCR - (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Y0R) / float32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1) i = uint32(0) for { if !(i <= libc.Uint32FromInt32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1)) { break } *(*float32)(unsafe.Pointer(cielab + 12120 + uintptr(i)*4)) = float32((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Fdisplay.Fd_Vrwb) * float32(libc.Xpow(tls, float64(i)/float64((*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).Frange1), dfGamma)) goto _3 _3: ; i++ } /* Init reference white point */ (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).FX0 = *(*float32)(unsafe.Pointer(refWhite)) (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).FY0 = *(*float32)(unsafe.Pointer(refWhite + 1*4)) (*TTIFFCIELabToRGB)(unsafe.Pointer(cielab)).FZ0 = *(*float32)(unsafe.Pointer(refWhite + 2*4)) return 0 } /* * Convert color value from the YCbCr space to RGB. * The colorspace conversion algorithm comes from the IJG v5a code; * see below for more information on how it works. */ /* !((f)>=(min)) written that way to deal with NaN */ func XTIFFYCbCrtoRGB(tls *libc.TLS, ycbcr uintptr, Y Tuint32_t, Cb Tint32_t, Cr Tint32_t, r uintptr, g uintptr, b uintptr) { var i Tint32_t var v1 uint32 var v10, v11, v2, v3, v4, v5, v6, v7, v8, v9 int32 _, _, _, _, _, _, _, _, _, _, _, _ = i, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9 /* XXX: Only 8-bit YCbCr input supported for now */ if Y > libc.Uint32FromInt32(libc.Int32FromInt32(255)) { v1 = libc.Uint32FromInt32(libc.Int32FromInt32(255)) } else { v1 = Y } Y = v1 if !(Cb >= libc.Int32FromInt32(0)) { v2 = 0 } else { if Cb > int32(255) { v3 = int32(255) } else { v3 = Cb } v2 = v3 } Cb = v2 if !(Cr >= libc.Int32FromInt32(0)) { v4 = 0 } else { if Cr > int32(255) { v5 = int32(255) } else { v5 = Cr } v4 = v5 } Cr = v4 i = *(*Tint32_t)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FY_tab + uintptr(Y)*4)) + *(*int32)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCr_r_tab + uintptr(Cr)*4)) if !(i >= libc.Int32FromInt32(0)) { v6 = 0 } else { if i > int32(255) { v7 = int32(255) } else { v7 = i } v6 = v7 } *(*Tuint32_t)(unsafe.Pointer(r)) = libc.Uint32FromInt32(v6) i = *(*Tint32_t)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FY_tab + uintptr(Y)*4)) + (*(*Tint32_t)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCb_g_tab + uintptr(Cb)*4))+*(*Tint32_t)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCr_g_tab + uintptr(Cr)*4)))>>libc.Int32FromInt32(16) if !(i >= libc.Int32FromInt32(0)) { v8 = 0 } else { if i > int32(255) { v9 = int32(255) } else { v9 = i } v8 = v9 } *(*Tuint32_t)(unsafe.Pointer(g)) = libc.Uint32FromInt32(v8) i = *(*Tint32_t)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FY_tab + uintptr(Y)*4)) + *(*int32)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCb_b_tab + uintptr(Cb)*4)) if !(i >= libc.Int32FromInt32(0)) { v10 = 0 } else { if i > int32(255) { v11 = int32(255) } else { v11 = i } v10 = v11 } *(*Tuint32_t)(unsafe.Pointer(b)) = libc.Uint32FromInt32(v10) } // C documentation // // /* Clamp function for sanitization purposes. Normally clamping should not */ // /* occur for well behaved chroma and refBlackWhite coefficients */ func _CLAMPw(tls *libc.TLS, v float32, vmin float32, vmax float32) (r float32) { if v < vmin { /* printf("%f clamped to %f\n", v, vmin); */ return vmin } if v > vmax { /* printf("%f clamped to %f\n", v, vmax); */ return vmax } return v } // C documentation // // /* // * Initialize the YCbCr->RGB conversion tables. The conversion // * is done according to the 6.0 spec: // * // * R = Y + Cr*(2 - 2*LumaRed) // * B = Y + Cb*(2 - 2*LumaBlue) // * G = Y // * - LumaBlue*Cb*(2-2*LumaBlue)/LumaGreen // * - LumaRed*Cr*(2-2*LumaRed)/LumaGreen // * // * To avoid floating point arithmetic the fractional constants that // * come out of the equations are represented as fixed point values // * in the range 0...2^16. We also eliminate multiplications by // * pre-calculating possible values indexed by Cb and Cr (this code // * assumes conversion is being done for 8-bit samples). // */ func XTIFFYCbCrToRGBInit(tls *libc.TLS, ycbcr uintptr, luma uintptr, refBlackWhite uintptr) (r int32) { var Cb, Cr, D1, D2, D3, D4 Tint32_t var clamptab uintptr var f1, f2, f3, f4, v11, v12, v13, v2, v3, v4, v5, v6, v7, v8, v9 float32 var i, x int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Cb, Cr, D1, D2, D3, D4, clamptab, f1, f2, f3, f4, i, x, v11, v12, v13, v2, v3, v4, v5, v6, v7, v8, v9 clamptab = ycbcr + uintptr((libc.Uint32FromInt64(24)+(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1)))/libc.Uint32FromInt64(4)*libc.Uint32FromInt64(4)) X_TIFFmemset(tls, clamptab, 0, int32(256)) /* v < 0 => 0 */ clamptab += uintptr(256) (*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).Fclamptab = clamptab i = 0 for { if !(i < int32(256)) { break } *(*TTIFFRGBValue)(unsafe.Pointer(clamptab + uintptr(i))) = libc.Uint8FromInt32(i) goto _1 _1: ; i++ } X_TIFFmemset(tls, clamptab+uintptr(256), int32(255), libc.Int32FromInt32(2)*libc.Int32FromInt32(256)) /* v > 255 => 255 */ (*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCr_r_tab = clamptab + uintptr(libc.Int32FromInt32(3)*libc.Int32FromInt32(256)) (*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCb_b_tab = (*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCr_r_tab + uintptr(256)*4 (*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCr_g_tab = (*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCb_b_tab + libc.UintptrFromInt32(256)*4 (*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCb_g_tab = (*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCr_g_tab + uintptr(256)*4 (*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FY_tab = (*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCb_g_tab + uintptr(256)*4 f1 = libc.Float32FromInt32(2) - libc.Float32FromInt32(2)**(*float32)(unsafe.Pointer(luma)) if !(f1 >= libc.Float32FromFloat32(0)) { v2 = libc.Float32FromFloat32(0) } else { if f1 > libc.Float32FromFloat32(2) { v3 = libc.Float32FromFloat32(2) } else { v3 = f1 } v2 = v3 } D1 = int32(float64(v2*float32(libc.Int32FromInt32(1)<= libc.Float32FromFloat32(0)) { v4 = libc.Float32FromFloat32(0) } else { if f2 > libc.Float32FromFloat32(2) { v5 = libc.Float32FromFloat32(2) } else { v5 = f2 } v4 = v5 } D2 = -int32(float64(v4*float32(libc.Int32FromInt32(1)<= libc.Float32FromFloat32(0)) { v6 = libc.Float32FromFloat32(0) } else { if f3 > libc.Float32FromFloat32(2) { v7 = libc.Float32FromFloat32(2) } else { v7 = f3 } v6 = v7 } D3 = int32(float64(v6*float32(libc.Int32FromInt32(1)<= libc.Float32FromFloat32(0)) { v8 = libc.Float32FromFloat32(0) } else { if f4 > libc.Float32FromFloat32(2) { v9 = libc.Float32FromFloat32(2) } else { v9 = f4 } v8 = v9 } D4 = -int32(float64(v8*float32(libc.Int32FromInt32(1)<> libc.Int32FromInt32(16) *(*int32)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCb_b_tab + uintptr(i)*4)) = (D3*Cb + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(16)-libc.Int32FromInt32(1))) >> libc.Int32FromInt32(16) *(*Tint32_t)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCr_g_tab + uintptr(i)*4)) = D2 * Cr *(*Tint32_t)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FCb_g_tab + uintptr(i)*4)) = D4*Cb + libc.Int32FromInt32(1)<<(libc.Int32FromInt32(16)-libc.Int32FromInt32(1)) if *(*float32)(unsafe.Pointer(refBlackWhite + 1*4))-*(*float32)(unsafe.Pointer(refBlackWhite)) != libc.Float32FromInt32(0) { v13 = *(*float32)(unsafe.Pointer(refBlackWhite + 1*4)) - *(*float32)(unsafe.Pointer(refBlackWhite)) } else { v13 = libc.Float32FromInt32(1) } *(*Tint32_t)(unsafe.Pointer((*TTIFFYCbCrToRGB)(unsafe.Pointer(ycbcr)).FY_tab + uintptr(i)*4)) = int32(_CLAMPw(tls, float32(x+libc.Int32FromInt32(128)-int32(*(*float32)(unsafe.Pointer(refBlackWhite))))*float32(libc.Int32FromInt32(255))/v13, -libc.Float32FromFloat32(128)*libc.Float32FromInt32(32), libc.Float32FromFloat32(128)*libc.Float32FromInt32(32))) goto _10 _10: ; i++ x++ } return 0 } const TIFF_NOBITREV1 = 256 const TIFF_NOREADRAW1 = 131072 func _TIFFNoEncode(tls *libc.TLS, tif uintptr, method uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var c uintptr _ = c c = XTIFFFindCODEC(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) if c != 0 { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+22473, libc.VaList(bp+8, (*TTIFFCodec)(unsafe.Pointer(c)).Fname, method)) } else { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+22507, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression), method)) } return -int32(1) } func X_TIFFNoRowEncode(tls *libc.TLS, tif uintptr, pp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { _ = pp _ = cc _ = s return _TIFFNoEncode(tls, tif, __ccgo_ts+22560) } func X_TIFFNoStripEncode(tls *libc.TLS, tif uintptr, pp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { _ = pp _ = cc _ = s return _TIFFNoEncode(tls, tif, __ccgo_ts+22569) } func X_TIFFNoTileEncode(tls *libc.TLS, tif uintptr, pp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { _ = pp _ = cc _ = s return _TIFFNoEncode(tls, tif, __ccgo_ts+22575) } func _TIFFNoDecode(tls *libc.TLS, tif uintptr, method uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var c uintptr _ = c c = XTIFFFindCODEC(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) if c != 0 { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+22580, libc.VaList(bp+8, (*TTIFFCodec)(unsafe.Pointer(c)).Fname, method)) } else { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+22614, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression), method)) } return 0 } func __TIFFNoFixupTags(tls *libc.TLS, tif uintptr) (r int32) { _ = tif return int32(1) } func X_TIFFNoRowDecode(tls *libc.TLS, tif uintptr, pp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { _ = pp _ = cc _ = s return _TIFFNoDecode(tls, tif, __ccgo_ts+22560) } func X_TIFFNoStripDecode(tls *libc.TLS, tif uintptr, pp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { _ = pp _ = cc _ = s return _TIFFNoDecode(tls, tif, __ccgo_ts+22569) } func X_TIFFNoTileDecode(tls *libc.TLS, tif uintptr, pp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { _ = pp _ = cc _ = s return _TIFFNoDecode(tls, tif, __ccgo_ts+22575) } func X_TIFFNoSeek(tls *libc.TLS, tif uintptr, off Tuint32_t) (r int32) { _ = off XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+22667, 0) return 0 } func X_TIFFNoPreCode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { _ = tif _ = s return int32(1) } func __TIFFtrue(tls *libc.TLS, tif uintptr) (r int32) { _ = tif return int32(1) } func __TIFFvoid(tls *libc.TLS, tif uintptr) { _ = tif } func X_TIFFSetDefaultCompressionState(tls *libc.TLS, tif uintptr) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_fixuptags = __ccgo_fp(__TIFFNoFixupTags) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestatus = int32(TRUE) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode = __ccgo_fp(__TIFFtrue) (*TTIFF)(unsafe.Pointer(tif)).Ftif_predecode = __ccgo_fp(X_TIFFNoPreCode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(X_TIFFNoRowDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(X_TIFFNoStripDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(X_TIFFNoTileDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestatus = int32(TRUE) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode = __ccgo_fp(__TIFFtrue) (*TTIFF)(unsafe.Pointer(tif)).Ftif_preencode = __ccgo_fp(X_TIFFNoPreCode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode = __ccgo_fp(__TIFFtrue) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(X_TIFFNoRowEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(X_TIFFNoStripEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(X_TIFFNoTileEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_close = __ccgo_fp(__TIFFvoid) (*TTIFF)(unsafe.Pointer(tif)).Ftif_seek = __ccgo_fp(X_TIFFNoSeek) (*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup = __ccgo_fp(__TIFFvoid) (*TTIFF)(unsafe.Pointer(tif)).Ftif_defstripsize = __ccgo_fp(X_TIFFDefaultStripSize) (*TTIFF)(unsafe.Pointer(tif)).Ftif_deftilesize = __ccgo_fp(X_TIFFDefaultTileSize) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^(libc.Uint32FromUint32(0x00100) | libc.Uint32FromUint32(0x20000)) } func XTIFFSetCompressionScheme(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { var c uintptr var v1 int32 _, _ = c, v1 c = XTIFFFindCODEC(tls, libc.Uint16FromInt32(scheme)) X_TIFFSetDefaultCompressionState(tls, tif) /* * Don't treat an unknown compression scheme as an error. * This permits applications to open files with data that * the library does not have builtin support for, but which * may still be meaningful. */ if c != 0 { v1 = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFCodec)(unsafe.Pointer(c)).Finit1})))(tls, tif, scheme) } else { v1 = int32(1) } return v1 } // C documentation // // /* // * Other compression schemes may be registered. Registered // * schemes can also override the builtin versions provided // * by this library. // */ type Tcodec_t = struct { Fnext uintptr Finfo uintptr } // C documentation // // /* // * Other compression schemes may be registered. Registered // * schemes can also override the builtin versions provided // * by this library. // */ type T_codec = Tcodec_t var _registeredCODECS = libc.UintptrFromInt32(0) func XTIFFFindCODEC(tls *libc.TLS, scheme Tuint16_t) (r uintptr) { var c, cd uintptr _, _ = c, cd cd = _registeredCODECS for { if !(cd != 0) { break } if libc.Int32FromUint16((*TTIFFCodec)(unsafe.Pointer((*Tcodec_t)(unsafe.Pointer(cd)).Finfo)).Fscheme) == libc.Int32FromUint16(scheme) { return (*Tcodec_t)(unsafe.Pointer(cd)).Finfo } goto _1 _1: ; cd = (*Tcodec_t)(unsafe.Pointer(cd)).Fnext } c = uintptr(unsafe.Pointer(&X_TIFFBuiltinCODECS)) for { if !((*TTIFFCodec)(unsafe.Pointer(c)).Fname != 0) { break } if libc.Int32FromUint16((*TTIFFCodec)(unsafe.Pointer(c)).Fscheme) == libc.Int32FromUint16(scheme) { return c } goto _2 _2: ; c += 12 } return libc.UintptrFromInt32(0) } func XTIFFRegisterCODEC(tls *libc.TLS, scheme Tuint16_t, name uintptr, init1 TTIFFInitMethod) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var cd uintptr _ = cd cd = X_TIFFmallocExt(tls, libc.UintptrFromInt32(0), libc.Int32FromUint32(libc.Uint32FromInt64(8)+libc.Uint32FromInt64(12)+libc.Xstrlen(tls, name)+libc.Uint32FromInt32(1))) if cd != libc.UintptrFromInt32(0) { (*Tcodec_t)(unsafe.Pointer(cd)).Finfo = cd + libc.UintptrFromInt64(8) (*TTIFFCodec)(unsafe.Pointer((*Tcodec_t)(unsafe.Pointer(cd)).Finfo)).Fname = (*Tcodec_t)(unsafe.Pointer(cd)).Finfo + libc.UintptrFromInt64(12) libc.Xstrcpy(tls, (*TTIFFCodec)(unsafe.Pointer((*Tcodec_t)(unsafe.Pointer(cd)).Finfo)).Fname, name) (*TTIFFCodec)(unsafe.Pointer((*Tcodec_t)(unsafe.Pointer(cd)).Finfo)).Fscheme = scheme (*TTIFFCodec)(unsafe.Pointer((*Tcodec_t)(unsafe.Pointer(cd)).Finfo)).Finit1 = init1 (*Tcodec_t)(unsafe.Pointer(cd)).Fnext = _registeredCODECS _registeredCODECS = cd } else { XTIFFErrorExt(tls, uintptr(0), __ccgo_ts+22720, __ccgo_ts+22738, libc.VaList(bp+8, name)) return libc.UintptrFromInt32(0) } return (*Tcodec_t)(unsafe.Pointer(cd)).Finfo } func XTIFFUnRegisterCODEC(tls *libc.TLS, c uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var cd, pcd, v2 uintptr _, _, _ = cd, pcd, v2 pcd = uintptr(unsafe.Pointer(&_registeredCODECS)) for { v2 = *(*uintptr)(unsafe.Pointer(pcd)) cd = v2 if !(v2 != libc.UintptrFromInt32(0)) { break } if (*Tcodec_t)(unsafe.Pointer(cd)).Finfo == c { *(*uintptr)(unsafe.Pointer(pcd)) = (*Tcodec_t)(unsafe.Pointer(cd)).Fnext X_TIFFfreeExt(tls, libc.UintptrFromInt32(0), cd) return } goto _1 _1: ; pcd = cd } XTIFFErrorExt(tls, uintptr(0), __ccgo_ts+22781, __ccgo_ts+22801, libc.VaList(bp+8, (*TTIFFCodec)(unsafe.Pointer(c)).Fname)) } /************************************************************************/ /* TIFFGetConfisuredCODECs() */ /************************************************************************/ /** * Get list of configured codecs, both built-in and registered by user. * Caller is responsible to free this structure. * * @return returns array of TIFFCodec records (the last record should be NULL) * or NULL if function failed. */ func XTIFFGetConfiguredCODECs(tls *libc.TLS) (r uintptr) { var c, cd, codecs, new_codecs uintptr var i int32 _, _, _, _, _ = c, cd, codecs, i, new_codecs i = int32(1) codecs = libc.UintptrFromInt32(0) cd = _registeredCODECS for { if !(cd != 0) { break } new_codecs = X_TIFFreallocExt(tls, libc.UintptrFromInt32(0), codecs, libc.Int32FromUint32(libc.Uint32FromInt32(i)*uint32(12))) if !(new_codecs != 0) { X_TIFFfreeExt(tls, libc.UintptrFromInt32(0), codecs) return libc.UintptrFromInt32(0) } codecs = new_codecs X_TIFFmemcpy(tls, codecs+uintptr(i)*12-uintptr(1)*12, (*Tcodec_t)(unsafe.Pointer(cd)).Finfo, int32(12)) i++ goto _1 _1: ; cd = (*Tcodec_t)(unsafe.Pointer(cd)).Fnext } c = uintptr(unsafe.Pointer(&X_TIFFBuiltinCODECS)) for { if !((*TTIFFCodec)(unsafe.Pointer(c)).Fname != 0) { break } if XTIFFIsCODECConfigured(tls, (*TTIFFCodec)(unsafe.Pointer(c)).Fscheme) != 0 { new_codecs = X_TIFFreallocExt(tls, libc.UintptrFromInt32(0), codecs, libc.Int32FromUint32(libc.Uint32FromInt32(i)*uint32(12))) if !(new_codecs != 0) { X_TIFFfreeExt(tls, libc.UintptrFromInt32(0), codecs) return libc.UintptrFromInt32(0) } codecs = new_codecs X_TIFFmemcpy(tls, codecs+uintptr(i)*12-uintptr(1)*12, c, int32(12)) i++ } goto _2 _2: ; c += 12 } new_codecs = X_TIFFreallocExt(tls, libc.UintptrFromInt32(0), codecs, libc.Int32FromUint32(libc.Uint32FromInt32(i)*uint32(12))) if !(new_codecs != 0) { X_TIFFfreeExt(tls, libc.UintptrFromInt32(0), codecs) return libc.UintptrFromInt32(0) } codecs = new_codecs X_TIFFmemset(tls, codecs+uintptr(i)*12-uintptr(1)*12, 0, int32(12)) return codecs } const TIFF_ANY1 = 0 const TIFF_NOBITREV2 = 0x00100 const TIFF_NOREADRAW2 = 0x20000 /*--: Rational2Double: -- * The Rational2Double upgraded libtiff functionality allows the definition and * achievement of true double-precision accuracy for TIFF tags of RATIONAL type * and field_bit=FIELD_CUSTOM using the set_field_type = TIFF_SETGET_DOUBLE. * Unfortunately, that changes the old implemented interface for TIFFGetField(). * In order to keep the old TIFFGetField() interface behavior those tags have to * be redefined with set_field_type = TIFF_SETGET_FLOAT! * * Rational custom arrays are already defined as _Cxx_FLOAT, thus can stay. * */ // C documentation // // /* clang-format off */ // /* for better readability of tag comments */ var _tiffFields = [153]TTIFFField{ 0: { Ffield_tag: uint32(TIFFTAG_SUBFILETYPE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_SUBFILETYPE), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 22853, }, 1: { Ffield_tag: uint32(TIFFTAG_OSUBFILETYPE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 22865, }, 2: { Ffield_tag: uint32(TIFFTAG_IMAGEWIDTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_IMAGEDIMENSIONS), Ffield_name: __ccgo_ts + 22880, }, 3: { Ffield_tag: uint32(TIFFTAG_IMAGELENGTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_IMAGEDIMENSIONS), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 22891, }, 4: { Ffield_tag: uint32(TIFFTAG_BITSPERSAMPLE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_BITSPERSAMPLE), Ffield_name: __ccgo_ts + 22903, }, 5: { Ffield_tag: uint32(TIFFTAG_COMPRESSION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_COMPRESSION), Ffield_name: __ccgo_ts + 22917, }, 6: { Ffield_tag: uint32(TIFFTAG_PHOTOMETRIC), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_PHOTOMETRIC), Ffield_name: __ccgo_ts + 22929, }, 7: { Ffield_tag: uint32(TIFFTAG_THRESHHOLDING), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_THRESHHOLDING), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 22955, }, 8: { Ffield_tag: uint32(TIFFTAG_CELLWIDTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 22969, }, 9: { Ffield_tag: uint32(TIFFTAG_CELLLENGTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 22979, }, 10: { Ffield_tag: uint32(TIFFTAG_FILLORDER), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_FILLORDER), Ffield_name: __ccgo_ts + 22990, }, 11: { Ffield_tag: uint32(TIFFTAG_DOCUMENTNAME), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23000, }, 12: { Ffield_tag: uint32(TIFFTAG_IMAGEDESCRIPTION), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23013, }, 13: { Ffield_tag: uint32(TIFFTAG_MAKE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23030, }, 14: { Ffield_tag: uint32(TIFFTAG_MODEL), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23035, }, 15: { Ffield_tag: uint32(TIFFTAG_STRIPOFFSETS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_LONG8), Ffield_bit: uint16(FIELD_STRIPOFFSETS), Ffield_name: __ccgo_ts + 23041, }, 16: { Ffield_tag: uint32(TIFFTAG_ORIENTATION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_ORIENTATION), Ffield_name: __ccgo_ts + 23054, }, 17: { Ffield_tag: uint32(TIFFTAG_SAMPLESPERPIXEL), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_SAMPLESPERPIXEL), Ffield_name: __ccgo_ts + 23066, }, 18: { Ffield_tag: uint32(TIFFTAG_ROWSPERSTRIP), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_ROWSPERSTRIP), Ffield_name: __ccgo_ts + 23082, }, 19: { Ffield_tag: uint32(TIFFTAG_STRIPBYTECOUNTS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_LONG8), Ffield_bit: uint16(FIELD_STRIPBYTECOUNTS), Ffield_name: __ccgo_ts + 23095, }, 20: { Ffield_tag: uint32(TIFFTAG_MINSAMPLEVALUE), Ffield_readcount: int16(-int32(2)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_MINSAMPLEVALUE), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23111, }, 21: { Ffield_tag: uint32(TIFFTAG_MAXSAMPLEVALUE), Ffield_readcount: int16(-int32(2)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_MAXSAMPLEVALUE), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23126, }, 22: { Ffield_tag: uint32(TIFFTAG_XRESOLUTION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_RESOLUTION), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23141, }, 23: { Ffield_tag: uint32(TIFFTAG_YRESOLUTION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_RESOLUTION), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23153, }, 24: { Ffield_tag: uint32(TIFFTAG_PLANARCONFIG), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_PLANARCONFIG), Ffield_name: __ccgo_ts + 23165, }, 25: { Ffield_tag: uint32(TIFFTAG_PAGENAME), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23185, }, 26: { Ffield_tag: uint32(TIFFTAG_XPOSITION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_POSITION), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23194, }, 27: { Ffield_tag: uint32(TIFFTAG_YPOSITION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_POSITION), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23204, }, 28: { Ffield_tag: uint32(TIFFTAG_FREEOFFSETS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_LONG8), Ffield_name: __ccgo_ts + 23214, }, 29: { Ffield_tag: uint32(TIFFTAG_FREEBYTECOUNTS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_LONG8), Ffield_name: __ccgo_ts + 23226, }, 30: { Ffield_tag: uint32(TIFFTAG_GRAYRESPONSEUNIT), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23241, }, 31: { Ffield_tag: uint32(TIFFTAG_GRAYRESPONSECURVE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23258, }, 32: { Ffield_tag: uint32(TIFFTAG_RESOLUTIONUNIT), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_RESOLUTIONUNIT), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23276, }, 33: { Ffield_tag: uint32(TIFFTAG_PAGENUMBER), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16_PAIR), Ffield_bit: uint16(FIELD_PAGENUMBER), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23291, }, 34: { Ffield_tag: uint32(TIFFTAG_COLORRESPONSEUNIT), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23302, }, 35: { Ffield_tag: uint32(TIFFTAG_TRANSFERFUNCTION), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_OTHER), Ffield_bit: uint16(FIELD_TRANSFERFUNCTION), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23320, }, 36: { Ffield_tag: uint32(TIFFTAG_SOFTWARE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23337, }, 37: { Ffield_tag: uint32(TIFFTAG_DATETIME), Ffield_readcount: int16(20), Ffield_writecount: int16(20), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23346, }, 38: { Ffield_tag: uint32(TIFFTAG_ARTIST), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23355, }, 39: { Ffield_tag: uint32(TIFFTAG_HOSTCOMPUTER), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23362, }, 40: { Ffield_tag: uint32(TIFFTAG_WHITEPOINT), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23375, }, 41: { Ffield_tag: uint32(TIFFTAG_PRIMARYCHROMATICITIES), Ffield_readcount: int16(6), Ffield_writecount: int16(6), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23386, }, 42: { Ffield_tag: uint32(TIFFTAG_COLORMAP), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_OTHER), Ffield_bit: uint16(FIELD_COLORMAP), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23408, }, 43: { Ffield_tag: uint32(TIFFTAG_HALFTONEHINTS), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16_PAIR), Ffield_bit: uint16(FIELD_HALFTONEHINTS), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23417, }, 44: { Ffield_tag: uint32(TIFFTAG_TILEWIDTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_TILEDIMENSIONS), Ffield_name: __ccgo_ts + 23431, }, 45: { Ffield_tag: uint32(TIFFTAG_TILELENGTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_TILEDIMENSIONS), Ffield_name: __ccgo_ts + 23441, }, 46: { Ffield_tag: uint32(TIFFTAG_TILEOFFSETS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG8), Ffield_bit: uint16(FIELD_STRIPOFFSETS), Ffield_name: __ccgo_ts + 23452, }, 47: { Ffield_tag: uint32(TIFFTAG_TILEBYTECOUNTS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG8), Ffield_bit: uint16(FIELD_STRIPBYTECOUNTS), Ffield_name: __ccgo_ts + 23464, }, 48: { Ffield_tag: uint32(TIFFTAG_SUBIFD), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_IFD8), Fset_field_type: int32(TIFF_SETGET_C16_IFD8), Ffield_bit: uint16(FIELD_SUBIFD), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 23479, }, 49: { Ffield_tag: uint32(TIFFTAG_INKSET), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_name: __ccgo_ts + 23486, }, 50: { Ffield_tag: uint32(TIFFTAG_INKNAMES), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_C16_ASCII), Ffield_bit: uint16(FIELD_INKNAMES), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 23493, }, 51: { Ffield_tag: uint32(TIFFTAG_NUMBEROFINKS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_NUMBEROFINKS), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23502, }, 52: { Ffield_tag: uint32(TIFFTAG_DOTRANGE), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16_PAIR), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_name: __ccgo_ts + 23515, }, 53: { Ffield_tag: uint32(TIFFTAG_TARGETPRINTER), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23524, }, 54: { Ffield_tag: uint32(TIFFTAG_EXTRASAMPLES), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_C16_UINT16), Ffield_bit: uint16(FIELD_EXTRASAMPLES), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 23538, }, 55: { Ffield_tag: uint32(TIFFTAG_SAMPLEFORMAT), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_SAMPLEFORMAT), Ffield_name: __ccgo_ts + 23551, }, 56: { Ffield_tag: uint32(TIFFTAG_SMINSAMPLEVALUE), Ffield_readcount: int16(-int32(2)), Ffield_writecount: int16(-int32(1)), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_SMINSAMPLEVALUE), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23564, }, 57: { Ffield_tag: uint32(TIFFTAG_SMAXSAMPLEVALUE), Ffield_readcount: int16(-int32(2)), Ffield_writecount: int16(-int32(1)), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_SMAXSAMPLEVALUE), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23580, }, 58: { Ffield_tag: uint32(TIFFTAG_CLIPPATH), Ffield_readcount: int16(-int32(3)), Ffield_writecount: int16(-int32(3)), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C32_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 23596, }, 59: { Ffield_tag: uint32(TIFFTAG_XCLIPPATHUNITS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_name: __ccgo_ts + 23605, }, 60: { Ffield_tag: uint32(TIFFTAG_YCLIPPATHUNITS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_name: __ccgo_ts + 23620, }, 61: { Ffield_tag: uint32(TIFFTAG_YCBCRCOEFFICIENTS), Ffield_readcount: int16(3), Ffield_writecount: int16(3), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_name: __ccgo_ts + 23635, }, 62: { Ffield_tag: uint32(TIFFTAG_YCBCRSUBSAMPLING), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16_PAIR), Ffield_bit: uint16(FIELD_YCBCRSUBSAMPLING), Ffield_name: __ccgo_ts + 23653, }, 63: { Ffield_tag: uint32(TIFFTAG_YCBCRPOSITIONING), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_YCBCRPOSITIONING), Ffield_name: __ccgo_ts + 23670, }, 64: { Ffield_tag: uint32(TIFFTAG_REFERENCEBLACKWHITE), Ffield_readcount: int16(6), Ffield_writecount: int16(6), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_REFBLACKWHITE), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23687, }, 65: { Ffield_tag: uint32(TIFFTAG_XMLPACKET), Ffield_readcount: int16(-int32(3)), Ffield_writecount: int16(-int32(3)), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C32_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 23707, }, 66: { Ffield_tag: uint32(TIFFTAG_MATTEING), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_EXTRASAMPLES), Ffield_name: __ccgo_ts + 23717, }, 67: { Ffield_tag: uint32(TIFFTAG_DATATYPE), Ffield_readcount: int16(-int32(2)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_SAMPLEFORMAT), Ffield_name: __ccgo_ts + 23726, }, 68: { Ffield_tag: uint32(TIFFTAG_IMAGEDEPTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_IMAGEDEPTH), Ffield_name: __ccgo_ts + 23735, }, 69: { Ffield_tag: uint32(TIFFTAG_TILEDEPTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_TILEDEPTH), Ffield_name: __ccgo_ts + 23746, }, 70: { Ffield_tag: uint32(TIFFTAG_PIXAR_IMAGEFULLWIDTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23756, }, 71: { Ffield_tag: uint32(TIFFTAG_PIXAR_IMAGEFULLLENGTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23771, }, 72: { Ffield_tag: uint32(TIFFTAG_PIXAR_TEXTUREFORMAT), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23787, }, 73: { Ffield_tag: uint32(TIFFTAG_PIXAR_WRAPMODES), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23801, }, 74: { Ffield_tag: uint32(TIFFTAG_PIXAR_FOVCOT), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_FLOAT), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23818, }, 75: { Ffield_tag: uint32(TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN), Ffield_readcount: int16(16), Ffield_writecount: int16(16), Ffield_type: int32(TIFF_FLOAT), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23839, }, 76: { Ffield_tag: uint32(TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA), Ffield_readcount: int16(16), Ffield_writecount: int16(16), Ffield_type: int32(TIFF_FLOAT), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23859, }, 77: { Ffield_tag: uint32(TIFFTAG_COPYRIGHT), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23879, }, 78: { Ffield_tag: uint32(TIFFTAG_RICHTIFFIPTC), Ffield_readcount: int16(-int32(3)), Ffield_writecount: int16(-int32(3)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C32_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 23889, }, 79: { Ffield_tag: uint32(TIFFTAG_PHOTOSHOP), Ffield_readcount: int16(-int32(3)), Ffield_writecount: int16(-int32(3)), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C32_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 23902, }, 80: { Ffield_tag: uint32(TIFFTAG_EXIFIFD), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_IFD8), Fset_field_type: int32(TIFF_SETGET_IFD8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23912, Ffield_subfields: uintptr(unsafe.Pointer(&_exifFieldArray)), }, 81: { Ffield_tag: uint32(TIFFTAG_ICCPROFILE), Ffield_readcount: int16(-int32(3)), Ffield_writecount: int16(-int32(3)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C32_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 23926, }, 82: { Ffield_tag: uint32(TIFFTAG_GPSIFD), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_IFD8), Fset_field_type: int32(TIFF_SETGET_IFD8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 23938, Ffield_subfields: uintptr(unsafe.Pointer(&_gpsFieldArray)), }, 83: { Ffield_tag: uint32(TIFFTAG_FAXRECVPARAMS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Fget_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(TRUE), Ffield_name: __ccgo_ts + 23951, }, 84: { Ffield_tag: uint32(TIFFTAG_FAXSUBADDRESS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Fget_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(TRUE), Ffield_name: __ccgo_ts + 23965, }, 85: { Ffield_tag: uint32(TIFFTAG_FAXRECVTIME), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Fget_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(TRUE), Ffield_name: __ccgo_ts + 23979, }, 86: { Ffield_tag: uint32(TIFFTAG_FAXDCS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Fget_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(TRUE), Ffield_name: __ccgo_ts + 23991, }, 87: { Ffield_tag: uint32(TIFFTAG_STONITS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_DOUBLE), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_name: __ccgo_ts + 23998, }, 88: { Ffield_tag: uint32(TIFFTAG_IMAGESOURCEDATA), Ffield_readcount: int16(-int32(3)), Ffield_writecount: int16(-int32(3)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C32_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24006, }, 89: { Ffield_tag: uint32(TIFFTAG_INTEROPERABILITYIFD), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_IFD8), Fset_field_type: int32(TIFF_SETGET_IFD8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_name: __ccgo_ts + 24042, }, 90: { Ffield_tag: uint32(TIFFTAG_DNGVERSION), Ffield_readcount: int16(4), Ffield_writecount: int16(4), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C0_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24068, }, 91: { Ffield_tag: uint32(TIFFTAG_DNGBACKWARDVERSION), Ffield_readcount: int16(4), Ffield_writecount: int16(4), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C0_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24079, }, 92: { Ffield_tag: uint32(TIFFTAG_UNIQUECAMERAMODEL), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24098, }, 93: { Ffield_tag: uint32(TIFFTAG_LOCALIZEDCAMERAMODEL), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24116, }, 94: { Ffield_tag: uint32(TIFFTAG_CFAPLANECOLOR), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24137, }, 95: { Ffield_tag: uint32(TIFFTAG_CFALAYOUT), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24151, }, 96: { Ffield_tag: uint32(TIFFTAG_LINEARIZATIONTABLE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_C16_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24161, }, 97: { Ffield_tag: uint32(TIFFTAG_BLACKLEVELREPEATDIM), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_C0_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24180, }, 98: { Ffield_tag: uint32(TIFFTAG_BLACKLEVEL), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24200, }, 99: { Ffield_tag: uint32(TIFFTAG_BLACKLEVELDELTAH), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24211, }, 100: { Ffield_tag: uint32(TIFFTAG_BLACKLEVELDELTAV), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24228, }, 101: { Ffield_tag: uint32(TIFFTAG_WHITELEVEL), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_C16_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24245, }, 102: { Ffield_tag: uint32(TIFFTAG_DEFAULTSCALE), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24256, }, 103: { Ffield_tag: uint32(TIFFTAG_BESTQUALITYSCALE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24269, }, 104: { Ffield_tag: uint32(TIFFTAG_DEFAULTCROPORIGIN), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24286, }, 105: { Ffield_tag: uint32(TIFFTAG_DEFAULTCROPSIZE), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24304, }, 106: { Ffield_tag: uint32(TIFFTAG_COLORMATRIX1), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24320, }, 107: { Ffield_tag: uint32(TIFFTAG_COLORMATRIX2), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24333, }, 108: { Ffield_tag: uint32(TIFFTAG_CAMERACALIBRATION1), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24346, }, 109: { Ffield_tag: uint32(TIFFTAG_CAMERACALIBRATION2), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24365, }, 110: { Ffield_tag: uint32(TIFFTAG_REDUCTIONMATRIX1), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24384, }, 111: { Ffield_tag: uint32(TIFFTAG_REDUCTIONMATRIX2), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24401, }, 112: { Ffield_tag: uint32(TIFFTAG_ANALOGBALANCE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24418, }, 113: { Ffield_tag: uint32(TIFFTAG_ASSHOTNEUTRAL), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24432, }, 114: { Ffield_tag: uint32(TIFFTAG_ASSHOTWHITEXY), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24446, }, 115: { Ffield_tag: uint32(TIFFTAG_BASELINEEXPOSURE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24460, }, 116: { Ffield_tag: uint32(TIFFTAG_BASELINENOISE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24477, }, 117: { Ffield_tag: uint32(TIFFTAG_BASELINESHARPNESS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24491, }, 118: { Ffield_tag: uint32(TIFFTAG_BAYERGREENSPLIT), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24509, }, 119: { Ffield_tag: uint32(TIFFTAG_LINEARRESPONSELIMIT), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24525, }, 120: { Ffield_tag: uint32(TIFFTAG_CAMERASERIALNUMBER), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24545, }, 121: { Ffield_tag: uint32(TIFFTAG_LENSINFO), Ffield_readcount: int16(4), Ffield_writecount: int16(4), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24564, }, 122: { Ffield_tag: uint32(TIFFTAG_CHROMABLURRADIUS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24573, }, 123: { Ffield_tag: uint32(TIFFTAG_ANTIALIASSTRENGTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24590, }, 124: { Ffield_tag: uint32(TIFFTAG_SHADOWSCALE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24608, }, 125: { Ffield_tag: uint32(TIFFTAG_DNGPRIVATEDATA), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24620, }, 126: { Ffield_tag: uint32(TIFFTAG_MAKERNOTESAFETY), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24635, }, 127: { Ffield_tag: uint32(TIFFTAG_CALIBRATIONILLUMINANT1), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24651, }, 128: { Ffield_tag: uint32(TIFFTAG_CALIBRATIONILLUMINANT2), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24674, }, 129: { Ffield_tag: uint32(TIFFTAG_RAWDATAUNIQUEID), Ffield_readcount: int16(16), Ffield_writecount: int16(16), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C0_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24697, }, 130: { Ffield_tag: uint32(TIFFTAG_ORIGINALRAWFILENAME), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24713, }, 131: { Ffield_tag: uint32(TIFFTAG_ORIGINALRAWFILEDATA), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24733, }, 132: { Ffield_tag: uint32(TIFFTAG_ACTIVEAREA), Ffield_readcount: int16(4), Ffield_writecount: int16(4), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_C0_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24753, }, 133: { Ffield_tag: uint32(TIFFTAG_MASKEDAREAS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_C16_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24764, }, 134: { Ffield_tag: uint32(TIFFTAG_ASSHOTICCPROFILE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24776, }, 135: { Ffield_tag: uint32(TIFFTAG_ASSHOTPREPROFILEMATRIX), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24793, }, 136: { Ffield_tag: uint32(TIFFTAG_CURRENTICCPROFILE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24816, }, 137: { Ffield_tag: uint32(TIFFTAG_CURRENTPREPROFILEMATRIX), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24834, }, 138: { Ffield_tag: uint32(TIFFTAG_PERSAMPLE), Ffield_type: int32(TIFF_SHORT), Ffield_oktochange: uint8(TRUE), Ffield_name: __ccgo_ts + 24858, }, 139: { Ffield_tag: uint32(TIFFTAG_EP_CFAREPEATPATTERNDIM), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_C0_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24868, }, 140: { Ffield_tag: uint32(TIFFTAG_EP_CFAPATTERN), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24891, }, 141: { Ffield_tag: uint32(TIFFTAG_INDEXED), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24905, }, 142: { Ffield_tag: uint32(TIFFTAG_GLOBALPARAMETERSIFD), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_IFD8), Fset_field_type: int32(TIFF_SETGET_IFD8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24913, }, 143: { Ffield_tag: uint32(TIFFTAG_PROFILETYPE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24933, }, 144: { Ffield_tag: uint32(TIFFTAG_FAXPROFILE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24945, }, 145: { Ffield_tag: uint32(TIFFTAG_CODINGMETHODS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24956, }, 146: { Ffield_tag: uint32(TIFFTAG_VERSIONYEAR), Ffield_readcount: int16(4), Ffield_writecount: int16(4), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C0_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24970, }, 147: { Ffield_tag: uint32(TIFFTAG_MODENUMBER), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 24982, }, 148: { Ffield_tag: uint32(TIFFTAG_DECODE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_C16_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 24993, }, 149: { Ffield_tag: uint32(TIFFTAG_IMAGEBASECOLOR), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_C16_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 25000, }, 150: { Ffield_tag: uint32(TIFFTAG_T82OPTIONS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25015, }, 151: { Ffield_tag: uint32(TIFFTAG_STRIPROWCOUNTS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_C16_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 25026, }, 152: { Ffield_tag: uint32(TIFFTAG_IMAGELAYER), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_C0_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25041, }, } // C documentation // // /* // * EXIF tags (Version 2.31, July 2016 plus version 2.32 May 2019) // */ var _exifFields = [81]TTIFFField{ 0: { Ffield_tag: uint32(EXIFTAG_EXPOSURETIME), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25052, }, 1: { Ffield_tag: uint32(EXIFTAG_FNUMBER), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25065, }, 2: { Ffield_tag: uint32(EXIFTAG_EXPOSUREPROGRAM), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25073, }, 3: { Ffield_tag: uint32(EXIFTAG_SPECTRALSENSITIVITY), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25089, }, 4: { Ffield_tag: uint32(EXIFTAG_ISOSPEEDRATINGS), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_C16_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 25109, }, 5: { Ffield_tag: uint32(EXIFTAG_OECF), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 25125, }, 6: { Ffield_tag: uint32(EXIFTAG_SENSITIVITYTYPE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25154, }, 7: { Ffield_tag: uint32(EXIFTAG_STANDARDOUTPUTSENSITIVITY), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25170, }, 8: { Ffield_tag: uint32(EXIFTAG_RECOMMENDEDEXPOSUREINDEX), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25196, }, 9: { Ffield_tag: uint32(EXIFTAG_ISOSPEED), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25221, }, 10: { Ffield_tag: uint32(EXIFTAG_ISOSPEEDLATITUDEYYY), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25230, }, 11: { Ffield_tag: uint32(EXIFTAG_ISOSPEEDLATITUDEZZZ), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25250, }, 12: { Ffield_tag: uint32(EXIFTAG_EXIFVERSION), Ffield_readcount: int16(4), Ffield_writecount: int16(4), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C0_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25270, }, 13: { Ffield_tag: uint32(EXIFTAG_DATETIMEORIGINAL), Ffield_readcount: int16(20), Ffield_writecount: int16(20), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25282, }, 14: { Ffield_tag: uint32(EXIFTAG_DATETIMEDIGITIZED), Ffield_readcount: int16(20), Ffield_writecount: int16(20), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25299, }, 15: { Ffield_tag: uint32(EXIFTAG_OFFSETTIME), Ffield_readcount: int16(7), Ffield_writecount: int16(7), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25317, }, 16: { Ffield_tag: uint32(EXIFTAG_OFFSETTIMEORIGINAL), Ffield_readcount: int16(7), Ffield_writecount: int16(7), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25328, }, 17: { Ffield_tag: uint32(EXIFTAG_OFFSETTIMEDIGITIZED), Ffield_readcount: int16(7), Ffield_writecount: int16(7), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25347, }, 18: { Ffield_tag: uint32(EXIFTAG_COMPONENTSCONFIGURATION), Ffield_readcount: int16(4), Ffield_writecount: int16(4), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C0_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25367, }, 19: { Ffield_tag: uint32(EXIFTAG_COMPRESSEDBITSPERPIXEL), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25391, }, 20: { Ffield_tag: uint32(EXIFTAG_SHUTTERSPEEDVALUE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25414, }, 21: { Ffield_tag: uint32(EXIFTAG_APERTUREVALUE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25432, }, 22: { Ffield_tag: uint32(EXIFTAG_BRIGHTNESSVALUE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25446, }, 23: { Ffield_tag: uint32(EXIFTAG_EXPOSUREBIASVALUE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25462, }, 24: { Ffield_tag: uint32(EXIFTAG_MAXAPERTUREVALUE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25480, }, 25: { Ffield_tag: uint32(EXIFTAG_SUBJECTDISTANCE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25497, }, 26: { Ffield_tag: uint32(EXIFTAG_METERINGMODE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25513, }, 27: { Ffield_tag: uint32(EXIFTAG_LIGHTSOURCE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25526, }, 28: { Ffield_tag: uint32(EXIFTAG_FLASH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25538, }, 29: { Ffield_tag: uint32(EXIFTAG_FOCALLENGTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25544, }, 30: { Ffield_tag: uint32(EXIFTAG_SUBJECTAREA), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_C16_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 25556, }, 31: { Ffield_tag: uint32(EXIFTAG_MAKERNOTE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 25568, }, 32: { Ffield_tag: uint32(EXIFTAG_USERCOMMENT), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 25578, }, 33: { Ffield_tag: uint32(EXIFTAG_SUBSECTIME), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25590, }, 34: { Ffield_tag: uint32(EXIFTAG_SUBSECTIMEORIGINAL), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25601, }, 35: { Ffield_tag: uint32(EXIFTAG_SUBSECTIMEDIGITIZED), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25620, }, 36: { Ffield_tag: uint32(EXIFTAG_TEMPERATURE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25640, }, 37: { Ffield_tag: uint32(EXIFTAG_HUMIDITY), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25652, }, 38: { Ffield_tag: uint32(EXIFTAG_PRESSURE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25661, }, 39: { Ffield_tag: uint32(EXIFTAG_WATERDEPTH), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25670, }, 40: { Ffield_tag: uint32(EXIFTAG_ACCELERATION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25681, }, 41: { Ffield_tag: uint32(EXIFTAG_CAMERAELEVATIONANGLE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SRATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25694, }, 42: { Ffield_tag: uint32(EXIFTAG_FLASHPIXVERSION), Ffield_readcount: int16(4), Ffield_writecount: int16(4), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C0_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25715, }, 43: { Ffield_tag: uint32(EXIFTAG_COLORSPACE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25731, }, 44: { Ffield_tag: uint32(EXIFTAG_PIXELXDIMENSION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25742, }, 45: { Ffield_tag: uint32(EXIFTAG_PIXELYDIMENSION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25758, }, 46: { Ffield_tag: uint32(EXIFTAG_RELATEDSOUNDFILE), Ffield_readcount: int16(13), Ffield_writecount: int16(13), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25774, }, 47: { Ffield_tag: uint32(EXIFTAG_FLASHENERGY), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25791, }, 48: { Ffield_tag: uint32(EXIFTAG_SPATIALFREQUENCYRESPONSE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 25803, }, 49: { Ffield_tag: uint32(EXIFTAG_FOCALPLANEXRESOLUTION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25828, }, 50: { Ffield_tag: uint32(EXIFTAG_FOCALPLANEYRESOLUTION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25850, }, 51: { Ffield_tag: uint32(EXIFTAG_FOCALPLANERESOLUTIONUNIT), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25872, }, 52: { Ffield_tag: uint32(EXIFTAG_SUBJECTLOCATION), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_C0_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25897, }, 53: { Ffield_tag: uint32(EXIFTAG_EXPOSUREINDEX), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25913, }, 54: { Ffield_tag: uint32(EXIFTAG_SENSINGMETHOD), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25927, }, 55: { Ffield_tag: uint32(EXIFTAG_FILESOURCE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25941, }, 56: { Ffield_tag: uint32(EXIFTAG_SCENETYPE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25952, }, 57: { Ffield_tag: uint32(EXIFTAG_CFAPATTERN), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 25962, }, 58: { Ffield_tag: uint32(EXIFTAG_CUSTOMRENDERED), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25973, }, 59: { Ffield_tag: uint32(EXIFTAG_EXPOSUREMODE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 25988, }, 60: { Ffield_tag: uint32(EXIFTAG_WHITEBALANCE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26001, }, 61: { Ffield_tag: uint32(EXIFTAG_DIGITALZOOMRATIO), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26014, }, 62: { Ffield_tag: uint32(EXIFTAG_FOCALLENGTHIN35MMFILM), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26031, }, 63: { Ffield_tag: uint32(EXIFTAG_SCENECAPTURETYPE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26053, }, 64: { Ffield_tag: uint32(EXIFTAG_GAINCONTROL), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26070, }, 65: { Ffield_tag: uint32(EXIFTAG_CONTRAST), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26082, }, 66: { Ffield_tag: uint32(EXIFTAG_SATURATION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26091, }, 67: { Ffield_tag: uint32(EXIFTAG_SHARPNESS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26102, }, 68: { Ffield_tag: uint32(EXIFTAG_DEVICESETTINGDESCRIPTION), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 26112, }, 69: { Ffield_tag: uint32(EXIFTAG_SUBJECTDISTANCERANGE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26137, }, 70: { Ffield_tag: uint32(EXIFTAG_IMAGEUNIQUEID), Ffield_readcount: int16(33), Ffield_writecount: int16(33), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26158, }, 71: { Ffield_tag: uint32(EXIFTAG_CAMERAOWNERNAME), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26172, }, 72: { Ffield_tag: uint32(EXIFTAG_BODYSERIALNUMBER), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26188, }, 73: { Ffield_tag: uint32(EXIFTAG_LENSSPECIFICATION), Ffield_readcount: int16(4), Ffield_writecount: int16(4), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26205, }, 74: { Ffield_tag: uint32(EXIFTAG_LENSMAKE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26223, }, 75: { Ffield_tag: uint32(EXIFTAG_LENSMODEL), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26232, }, 76: { Ffield_tag: uint32(EXIFTAG_LENSSERIALNUMBER), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26242, }, 77: { Ffield_tag: uint32(EXIFTAG_GAMMA), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_FLOAT), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26259, }, 78: { Ffield_tag: uint32(EXIFTAG_COMPOSITEIMAGE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26265, }, 79: { Ffield_tag: uint32(EXIFTAG_SOURCEIMAGENUMBEROFCOMPOSITEIMAGE), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_C0_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26280, }, 80: { Ffield_tag: uint32(EXIFTAG_SOURCEEXPOSURETIMESOFCOMPOSITEIMAGE), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 26314, }, } /* * EXIF-GPS tags (Version 2.31, July 2016; nothing changed for version 2.32 May * 2019) */ var _gpsFields = [32]TTIFFField{ 0: { Ffield_readcount: int16(4), Ffield_writecount: int16(4), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_C0_UINT8), Fget_field_type: int32(TIFF_SETGET_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26350, }, 1: { Ffield_tag: uint32(GPSTAG_LATITUDEREF), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26360, }, 2: { Ffield_tag: uint32(GPSTAG_LATITUDE), Ffield_readcount: int16(3), Ffield_writecount: int16(3), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26372, }, 3: { Ffield_tag: uint32(GPSTAG_LONGITUDEREF), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26381, }, 4: { Ffield_tag: uint32(GPSTAG_LONGITUDE), Ffield_readcount: int16(3), Ffield_writecount: int16(3), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26394, }, 5: { Ffield_tag: uint32(GPSTAG_ALTITUDEREF), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_BYTE), Fset_field_type: int32(TIFF_SETGET_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26404, }, 6: { Ffield_tag: uint32(GPSTAG_ALTITUDE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26416, }, 7: { Ffield_tag: uint32(GPSTAG_TIMESTAMP), Ffield_readcount: int16(3), Ffield_writecount: int16(3), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26425, }, 8: { Ffield_tag: uint32(GPSTAG_SATELLITES), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26435, }, 9: { Ffield_tag: uint32(GPSTAG_STATUS), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26446, }, 10: { Ffield_tag: uint32(GPSTAG_MEASUREMODE), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26453, }, 11: { Ffield_tag: uint32(GPSTAG_DOP), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26465, }, 12: { Ffield_tag: uint32(GPSTAG_SPEEDREF), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26469, }, 13: { Ffield_tag: uint32(GPSTAG_SPEED), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26478, }, 14: { Ffield_tag: uint32(GPSTAG_TRACKREF), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26484, }, 15: { Ffield_tag: uint32(GPSTAG_TRACK), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26493, }, 16: { Ffield_tag: uint32(GPSTAG_IMGDIRECTIONREF), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26499, }, 17: { Ffield_tag: uint32(GPSTAG_IMGDIRECTION), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26515, }, 18: { Ffield_tag: uint32(GPSTAG_MAPDATUM), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26528, }, 19: { Ffield_tag: uint32(GPSTAG_DESTLATITUDEREF), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26537, }, 20: { Ffield_tag: uint32(GPSTAG_DESTLATITUDE), Ffield_readcount: int16(3), Ffield_writecount: int16(3), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26553, }, 21: { Ffield_tag: uint32(GPSTAG_DESTLONGITUDEREF), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26566, }, 22: { Ffield_tag: uint32(GPSTAG_DESTLONGITUDE), Ffield_readcount: int16(3), Ffield_writecount: int16(3), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_C0_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26583, }, 23: { Ffield_tag: uint32(GPSTAG_DESTBEARINGREF), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26597, }, 24: { Ffield_tag: uint32(GPSTAG_DESTBEARING), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26612, }, 25: { Ffield_tag: uint32(GPSTAG_DESTDISTANCEREF), Ffield_readcount: int16(2), Ffield_writecount: int16(2), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26624, }, 26: { Ffield_tag: uint32(GPSTAG_DESTDISTANCE), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26640, }, 27: { Ffield_tag: uint32(GPSTAG_PROCESSINGMETHOD), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 26653, }, 28: { Ffield_tag: uint32(GPSTAG_AREAINFORMATION), Ffield_readcount: int16(-int32(1)), Ffield_writecount: int16(-int32(1)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C16_UINT8), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_passcount: uint8(1), Ffield_name: __ccgo_ts + 26670, }, 29: { Ffield_tag: uint32(GPSTAG_DATESTAMP), Ffield_readcount: int16(11), Ffield_writecount: int16(11), Ffield_type: int32(TIFF_ASCII), Fset_field_type: int32(TIFF_SETGET_ASCII), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26686, }, 30: { Ffield_tag: uint32(GPSTAG_DIFFERENTIAL), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26696, }, 31: { Ffield_tag: uint32(GPSTAG_GPSHPOSITIONINGERROR), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_RATIONAL), Fset_field_type: int32(TIFF_SETGET_DOUBLE), Ffield_bit: uint16(FIELD_CUSTOM), Ffield_oktochange: uint8(1), Ffield_name: __ccgo_ts + 26709, }, } /* clang-format on */ /* was off for better readability of tag comments */ var _tiffFieldArray = TTIFFFieldArray{ Fcount: libc.Uint32FromInt64(5508) / libc.Uint32FromInt64(36), Ffields: uintptr(unsafe.Pointer(&_tiffFields)), } var _exifFieldArray = TTIFFFieldArray{ Ftype1: int32(tfiatExif), Fcount: libc.Uint32FromInt64(2916) / libc.Uint32FromInt64(36), Ffields: uintptr(unsafe.Pointer(&_exifFields)), } var _gpsFieldArray = TTIFFFieldArray{ Ftype1: int32(tfiatGps), Fcount: libc.Uint32FromInt64(1152) / libc.Uint32FromInt64(36), Ffields: uintptr(unsafe.Pointer(&_gpsFields)), } /* * We have our own local lfind() equivalent to avoid subtle differences * in types passed to lfind() on different systems. */ func _td_lfind(tls *libc.TLS, key uintptr, base uintptr, nmemb uintptr, size Tsize_t, compar uintptr) (r uintptr) { var element, end uintptr _, _ = element, end end = base + uintptr(*(*Tsize_t)(unsafe.Pointer(nmemb))*size) element = base for { if !(element < end) { break } if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{compar})))(tls, key, element) != 0) { /* key found */ return element } goto _1 _1: ; element += uintptr(size) } return libc.UintptrFromInt32(0) } func X_TIFFGetFields(tls *libc.TLS) (r uintptr) { return uintptr(unsafe.Pointer(&_tiffFieldArray)) } func X_TIFFGetExifFields(tls *libc.TLS) (r uintptr) { return uintptr(unsafe.Pointer(&_exifFieldArray)) } func X_TIFFGetGpsFields(tls *libc.TLS) (r uintptr) { return uintptr(unsafe.Pointer(&_gpsFieldArray)) } func X_TIFFSetupFields(tls *libc.TLS, tif uintptr, fieldarray uintptr) { var fld uintptr var i Tuint32_t _, _ = fld, i if (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields > uint32(0) { i = uint32(0) for { if !(i < (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields) { break } fld = *(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(i)*4)) if (*TTIFFField)(unsafe.Pointer(fld)).Ffield_name != libc.UintptrFromInt32(0) { if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fld)).Ffield_bit) == int32(FIELD_CUSTOM) && XTIFFFieldIsAnonymous(tls, fld) != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFField)(unsafe.Pointer(fld)).Ffield_name) /* caution: tif_fields[i] must not be the beginning of a * fields-array. Otherwise the following tags are also freed * with the first free(). */ X_TIFFfreeExt(tls, tif, fld) } } goto _1 _1: ; i++ } X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields) (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields = uint32(0) } if !(X_TIFFMergeFields(tls, tif, (*TTIFFFieldArray)(unsafe.Pointer(fieldarray)).Ffields, (*TTIFFFieldArray)(unsafe.Pointer(fieldarray)).Fcount) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+26736, __ccgo_ts+26753, 0) } } func _tagCompare(tls *libc.TLS, a uintptr, b uintptr) (r int32) { var ta, tb uintptr var v1 int32 _, _, _ = ta, tb, v1 ta = *(*uintptr)(unsafe.Pointer(a)) tb = *(*uintptr)(unsafe.Pointer(b)) /* NB: be careful of return values for 16-bit platforms */ if (*TTIFFField)(unsafe.Pointer(ta)).Ffield_tag != (*TTIFFField)(unsafe.Pointer(tb)).Ffield_tag { return libc.Int32FromUint32((*TTIFFField)(unsafe.Pointer(ta)).Ffield_tag) - libc.Int32FromUint32((*TTIFFField)(unsafe.Pointer(tb)).Ffield_tag) } else { if (*TTIFFField)(unsafe.Pointer(ta)).Ffield_type == int32(TIFF_NOTYPE) { v1 = 0 } else { v1 = (*TTIFFField)(unsafe.Pointer(tb)).Ffield_type - (*TTIFFField)(unsafe.Pointer(ta)).Ffield_type } return v1 } return r } func _tagNameCompare(tls *libc.TLS, a uintptr, b uintptr) (r int32) { var ret, v1 int32 var ta, tb uintptr _, _, _, _ = ret, ta, tb, v1 ta = *(*uintptr)(unsafe.Pointer(a)) tb = *(*uintptr)(unsafe.Pointer(b)) ret = libc.Xstrcmp(tls, (*TTIFFField)(unsafe.Pointer(ta)).Ffield_name, (*TTIFFField)(unsafe.Pointer(tb)).Ffield_name) if ret != 0 { return ret } else { if (*TTIFFField)(unsafe.Pointer(ta)).Ffield_type == int32(TIFF_NOTYPE) { v1 = 0 } else { v1 = (*TTIFFField)(unsafe.Pointer(tb)).Ffield_type - (*TTIFFField)(unsafe.Pointer(ta)).Ffield_type } return v1 } return r } func X_TIFFMergeFields(tls *libc.TLS, tif uintptr, info uintptr, n Tuint32_t) (r int32) { var fip uintptr var i Tuint32_t _, _ = fip, i (*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield = libc.UintptrFromInt32(0) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields > uint32(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields = X_TIFFCheckRealloc(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields, libc.Int32FromUint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields+n), int32(4), uintptr(unsafe.Pointer(&_reason))) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint32(n), int32(4), uintptr(unsafe.Pointer(&_reason))) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module)), __ccgo_ts+26782, 0) return 0 } /* tp = tif->tif_fields + tif->tif_nfields; */ i = uint32(0) for { if !(i < n) { break } fip = XTIFFFindField(tls, tif, (*(*TTIFFField)(unsafe.Pointer(info + uintptr(i)*36))).Ffield_tag, int32(TIFF_NOTYPE)) /* only add definitions that aren't already present */ if !(fip != 0) { *(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields)*4)) = info + uintptr(i)*36 (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields++ } goto _1 _1: ; i++ } /* Sort the field info by tag number */ libc.Xqsort(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields, (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields, uint32(4), __ccgo_fp(_tagCompare)) return libc.Int32FromUint32(n) } var _module = [17]uint8{'_', 'T', 'I', 'F', 'F', 'M', 'e', 'r', 'g', 'e', 'F', 'i', 'e', 'l', 'd', 's'} var _reason = [17]uint8{'f', 'o', 'r', ' ', 'f', 'i', 'e', 'l', 'd', 's', ' ', 'a', 'r', 'r', 'a', 'y'} func X_TIFFPrintFieldInfo(tls *libc.TLS, tif uintptr, fd uintptr) { bp := tls.Alloc(80) defer tls.Free(80) var fip, v2, v3 uintptr var i Tuint32_t _, _, _, _ = fip, i, v2, v3 libc.Xfprintf(tls, fd, __ccgo_ts+26814, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) i = uint32(0) for { if !(i < (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields) { break } fip = *(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(i)*4)) if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_oktochange != 0 { v2 = __ccgo_ts + 26820 } else { v2 = __ccgo_ts + 26825 } if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_passcount != 0 { v3 = __ccgo_ts + 26820 } else { v3 = __ccgo_ts + 26825 } libc.Xfprintf(tls, fd, __ccgo_ts+26831, libc.VaList(bp+8, libc.Int32FromUint32(i), (*TTIFFField)(unsafe.Pointer(fip)).Ffield_tag, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount), (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type, libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit), v2, v3, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) goto _1 _1: ; i++ } } // C documentation // // /* // * Return size of TIFFDataType within TIFF-file in bytes // */ func XTIFFDataWidth(tls *libc.TLS, type1 TTIFFDataType) (r int32) { switch type1 { case 0: /* nothing */ fallthrough case int32(TIFF_BYTE): fallthrough case int32(TIFF_ASCII): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_UNDEFINED): return int32(1) case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): return int32(2) case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_FLOAT): fallthrough case int32(TIFF_IFD): return int32(4) case int32(TIFF_RATIONAL): fallthrough case int32(TIFF_SRATIONAL): fallthrough case int32(TIFF_DOUBLE): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): fallthrough case int32(TIFF_IFD8): return int32(8) default: return 0 /* will return 0 for unknown types */ } return r } // C documentation // // /* // * Return internal storage size of TIFFSetGetFieldType in bytes. // * TIFFSetField() and TIFFGetField() have to provide the parameter accordingly. // * Replaces internal functions _TIFFDataSize() and _TIFFSetGetFieldSize() // * with now extern available function TIFFFieldSetGetSize(). // */ func XTIFFFieldSetGetSize(tls *libc.TLS, fip uintptr) (r int32) { /* * TIFFSetField() and TIFFGetField() must provide the parameter accordingly * to the definition of "set_field_type" of the tag definition in * dir_info.c. This function returns the data size for that purpose. * * Furthermore, this data size is also used for the internal storage, * even for TIFF_RATIONAL values for FIELD_CUSTOM, which are stored * internally as 4-byte float, but some of them should be stored internally * as 8-byte double, depending on the "set_field_type" _FLOAT_ or _DOUBLE_. */ if fip == libc.UintptrFromInt32(0) { return 0 } switch (*TTIFFField)(unsafe.Pointer(fip)).Fset_field_type { case int32(TIFF_SETGET_UNDEFINED): fallthrough case int32(TIFF_SETGET_ASCII): fallthrough case int32(TIFF_SETGET_C0_ASCII): fallthrough case int32(TIFF_SETGET_C16_ASCII): fallthrough case int32(TIFF_SETGET_C32_ASCII): fallthrough case int32(TIFF_SETGET_OTHER): return int32(1) case int32(TIFF_SETGET_UINT8): fallthrough case int32(TIFF_SETGET_SINT8): fallthrough case int32(TIFF_SETGET_C0_UINT8): fallthrough case int32(TIFF_SETGET_C0_SINT8): fallthrough case int32(TIFF_SETGET_C16_UINT8): fallthrough case int32(TIFF_SETGET_C16_SINT8): fallthrough case int32(TIFF_SETGET_C32_UINT8): fallthrough case int32(TIFF_SETGET_C32_SINT8): return int32(1) case int32(TIFF_SETGET_UINT16): fallthrough case int32(TIFF_SETGET_SINT16): fallthrough case int32(TIFF_SETGET_C0_UINT16): fallthrough case int32(TIFF_SETGET_C0_SINT16): fallthrough case int32(TIFF_SETGET_C16_UINT16): fallthrough case int32(TIFF_SETGET_C16_SINT16): fallthrough case int32(TIFF_SETGET_C32_UINT16): fallthrough case int32(TIFF_SETGET_C32_SINT16): return int32(2) case int32(TIFF_SETGET_INT): fallthrough case int32(TIFF_SETGET_UINT32): fallthrough case int32(TIFF_SETGET_SINT32): fallthrough case int32(TIFF_SETGET_FLOAT): fallthrough case int32(TIFF_SETGET_UINT16_PAIR): fallthrough case int32(TIFF_SETGET_C0_UINT32): fallthrough case int32(TIFF_SETGET_C0_SINT32): fallthrough case int32(TIFF_SETGET_C0_FLOAT): fallthrough case int32(TIFF_SETGET_C16_UINT32): fallthrough case int32(TIFF_SETGET_C16_SINT32): fallthrough case int32(TIFF_SETGET_C16_FLOAT): fallthrough case int32(TIFF_SETGET_C32_UINT32): fallthrough case int32(TIFF_SETGET_C32_SINT32): fallthrough case int32(TIFF_SETGET_C32_FLOAT): return int32(4) case int32(TIFF_SETGET_UINT64): fallthrough case int32(TIFF_SETGET_SINT64): fallthrough case int32(TIFF_SETGET_DOUBLE): fallthrough case int32(TIFF_SETGET_IFD8): fallthrough case int32(TIFF_SETGET_C0_UINT64): fallthrough case int32(TIFF_SETGET_C0_SINT64): fallthrough case int32(TIFF_SETGET_C0_DOUBLE): fallthrough case int32(TIFF_SETGET_C0_IFD8): fallthrough case int32(TIFF_SETGET_C16_UINT64): fallthrough case int32(TIFF_SETGET_C16_SINT64): fallthrough case int32(TIFF_SETGET_C16_DOUBLE): fallthrough case int32(TIFF_SETGET_C16_IFD8): fallthrough case int32(TIFF_SETGET_C32_UINT64): fallthrough case int32(TIFF_SETGET_C32_SINT64): fallthrough case int32(TIFF_SETGET_C32_DOUBLE): fallthrough case int32(TIFF_SETGET_C32_IFD8): return int32(8) default: return 0 } return r } /*-- TIFFFieldSetGetSize() --- */ // C documentation // // /* // * Return size of count parameter of TIFFSetField() and TIFFGetField() // * and also if it is required: 0=none, 2=uint16_t, 4=uint32_t // */ func XTIFFFieldSetGetCountSize(tls *libc.TLS, fip uintptr) (r int32) { if fip == libc.UintptrFromInt32(0) { return 0 } switch (*TTIFFField)(unsafe.Pointer(fip)).Fset_field_type { case int32(TIFF_SETGET_C16_ASCII): fallthrough case int32(TIFF_SETGET_C16_UINT8): fallthrough case int32(TIFF_SETGET_C16_SINT8): fallthrough case int32(TIFF_SETGET_C16_UINT16): fallthrough case int32(TIFF_SETGET_C16_SINT16): fallthrough case int32(TIFF_SETGET_C16_UINT32): fallthrough case int32(TIFF_SETGET_C16_SINT32): fallthrough case int32(TIFF_SETGET_C16_FLOAT): fallthrough case int32(TIFF_SETGET_C16_UINT64): fallthrough case int32(TIFF_SETGET_C16_SINT64): fallthrough case int32(TIFF_SETGET_C16_DOUBLE): fallthrough case int32(TIFF_SETGET_C16_IFD8): return int32(2) case int32(TIFF_SETGET_C32_ASCII): fallthrough case int32(TIFF_SETGET_C32_UINT8): fallthrough case int32(TIFF_SETGET_C32_SINT8): fallthrough case int32(TIFF_SETGET_C32_UINT16): fallthrough case int32(TIFF_SETGET_C32_SINT16): fallthrough case int32(TIFF_SETGET_C32_UINT32): fallthrough case int32(TIFF_SETGET_C32_SINT32): fallthrough case int32(TIFF_SETGET_C32_FLOAT): fallthrough case int32(TIFF_SETGET_C32_UINT64): fallthrough case int32(TIFF_SETGET_C32_SINT64): fallthrough case int32(TIFF_SETGET_C32_DOUBLE): fallthrough case int32(TIFF_SETGET_C32_IFD8): return int32(4) default: return 0 } return r } /*-- TIFFFieldSetGetCountSize() --- */ func XTIFFFindField(tls *libc.TLS, tif uintptr, tag Tuint32_t, dt TTIFFDataType) (r uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var ret, v1, v2 uintptr var _ /* key at bp+0 */ TTIFFField var _ /* pkey at bp+36 */ uintptr _, _, _ = ret, v1, v2 *(*TTIFFField)(unsafe.Pointer(bp)) = TTIFFField{} *(*uintptr)(unsafe.Pointer(bp + 36)) = bp if (*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield != 0 && (*TTIFFField)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield)).Ffield_tag == tag && (dt == int32(TIFF_NOTYPE) || dt == (*TTIFFField)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield)).Ffield_type) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield } /* If we are invoked with no field information, then just return. */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields != 0) { return libc.UintptrFromInt32(0) } /* NB: use sorted search (e.g. binary search) */ (*(*TTIFFField)(unsafe.Pointer(bp))).Ffield_tag = tag (*(*TTIFFField)(unsafe.Pointer(bp))).Ffield_type = dt ret = libc.Xbsearch(tls, bp+36, (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields, (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields, uint32(4), __ccgo_fp(_tagCompare)) if ret != 0 { v2 = *(*uintptr)(unsafe.Pointer(ret)) } else { v2 = libc.UintptrFromInt32(0) } v1 = v2 (*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield = v1 return v1 } func __TIFFFindFieldByName(tls *libc.TLS, tif uintptr, field_name uintptr, dt TTIFFDataType) (r uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var ret, v1, v2 uintptr var _ /* key at bp+0 */ TTIFFField var _ /* pkey at bp+36 */ uintptr _, _, _ = ret, v1, v2 *(*TTIFFField)(unsafe.Pointer(bp)) = TTIFFField{} *(*uintptr)(unsafe.Pointer(bp + 36)) = bp if (*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield != 0 && libc.Xstrcmp(tls, (*TTIFFField)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield)).Ffield_name, field_name) == 0 && (dt == int32(TIFF_NOTYPE) || dt == (*TTIFFField)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield)).Ffield_type) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield } /* If we are invoked with no field information, then just return. */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields != 0) { return libc.UintptrFromInt32(0) } /* NB: use linear search since list is sorted by key#, not name */ (*(*TTIFFField)(unsafe.Pointer(bp))).Ffield_name = field_name (*(*TTIFFField)(unsafe.Pointer(bp))).Ffield_type = dt ret = _td_lfind(tls, bp+36, (*TTIFF)(unsafe.Pointer(tif)).Ftif_fields, tif+884, uint32(4), __ccgo_fp(_tagNameCompare)) if ret != 0 { v2 = *(*uintptr)(unsafe.Pointer(ret)) } else { v2 = libc.UintptrFromInt32(0) } v1 = v2 (*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield = v1 return v1 } func XTIFFFieldWithTag(tls *libc.TLS, tif uintptr, tag Tuint32_t) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var fip uintptr _ = fip fip = XTIFFFindField(tls, tif, tag, int32(TIFF_NOTYPE)) if !(fip != 0) { XTIFFWarningExtR(tls, tif, __ccgo_ts+26881, __ccgo_ts+26898, libc.VaList(bp+8, tag)) } return fip } func XTIFFFieldWithName(tls *libc.TLS, tif uintptr, field_name uintptr) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var fip uintptr _ = fip fip = __TIFFFindFieldByName(tls, tif, field_name, int32(TIFF_NOTYPE)) if !(fip != 0) { XTIFFWarningExtR(tls, tif, __ccgo_ts+26924, __ccgo_ts+26942, libc.VaList(bp+8, field_name)) } return fip } func XTIFFFieldTag(tls *libc.TLS, fip uintptr) (r Tuint32_t) { return (*TTIFFField)(unsafe.Pointer(fip)).Ffield_tag } func XTIFFFieldName(tls *libc.TLS, fip uintptr) (r uintptr) { return (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name } func XTIFFFieldDataType(tls *libc.TLS, fip uintptr) (r TTIFFDataType) { return (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type } func XTIFFFieldPassCount(tls *libc.TLS, fip uintptr) (r int32) { return libc.Int32FromUint8((*TTIFFField)(unsafe.Pointer(fip)).Ffield_passcount) } func XTIFFFieldReadCount(tls *libc.TLS, fip uintptr) (r int32) { return int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) } func XTIFFFieldWriteCount(tls *libc.TLS, fip uintptr) (r int32) { return int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount) } func XTIFFFieldIsAnonymous(tls *libc.TLS, fip uintptr) (r int32) { return libc.Int32FromUint32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_anonymous) } func X_TIFFFindOrRegisterField(tls *libc.TLS, tif uintptr, tag Tuint32_t, dt TTIFFDataType) (r uintptr) { var fld uintptr _ = fld fld = XTIFFFindField(tls, tif, tag, dt) if fld == libc.UintptrFromInt32(0) { fld = X_TIFFCreateAnonField(tls, tif, tag, dt) if fld == libc.UintptrFromInt32(0) || !(X_TIFFMergeFields(tls, tif, fld, uint32(1)) != 0) { return libc.UintptrFromInt32(0) } } return fld } func X_TIFFCreateAnonField(tls *libc.TLS, tif uintptr, tag Tuint32_t, field_type TTIFFDataType) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var fld uintptr _ = fld _ = tif fld = X_TIFFmallocExt(tls, tif, int32(36)) if fld == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } X_TIFFmemset(tls, fld, 0, int32(36)) (*TTIFFField)(unsafe.Pointer(fld)).Ffield_tag = tag (*TTIFFField)(unsafe.Pointer(fld)).Ffield_readcount = int16(-int32(3)) (*TTIFFField)(unsafe.Pointer(fld)).Ffield_writecount = int16(-int32(3)) (*TTIFFField)(unsafe.Pointer(fld)).Ffield_type = field_type (*TTIFFField)(unsafe.Pointer(fld)).Ffield_anonymous = uint32(1) /* indicate that this is an anonymous / unknown tag */ switch field_type { case int32(TIFF_BYTE): fallthrough case int32(TIFF_UNDEFINED): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_UINT8) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_UINT8) case int32(TIFF_ASCII): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_ASCII) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_ASCII) case int32(TIFF_SHORT): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_UINT16) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_UINT16) case int32(TIFF_LONG): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_UINT32) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_UINT32) case int32(TIFF_RATIONAL): fallthrough case int32(TIFF_SRATIONAL): fallthrough case int32(TIFF_FLOAT): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_FLOAT) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_FLOAT) case int32(TIFF_SBYTE): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_SINT8) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_SINT8) case int32(TIFF_SSHORT): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_SINT16) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_SINT16) case int32(TIFF_SLONG): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_SINT32) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_SINT32) case int32(TIFF_DOUBLE): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_DOUBLE) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_DOUBLE) case int32(TIFF_IFD): fallthrough case int32(TIFF_IFD8): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_IFD8) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_IFD8) case int32(TIFF_LONG8): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_UINT64) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_UINT64) case int32(TIFF_SLONG8): (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_C32_SINT64) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_C32_SINT64) default: (*TTIFFField)(unsafe.Pointer(fld)).Fset_field_type = int32(TIFF_SETGET_UNDEFINED) (*TTIFFField)(unsafe.Pointer(fld)).Fget_field_type = int32(TIFF_SETGET_UNDEFINED) break } (*TTIFFField)(unsafe.Pointer(fld)).Ffield_bit = uint16(FIELD_CUSTOM) (*TTIFFField)(unsafe.Pointer(fld)).Ffield_oktochange = uint8(TRUE) (*TTIFFField)(unsafe.Pointer(fld)).Ffield_passcount = uint8(TRUE) (*TTIFFField)(unsafe.Pointer(fld)).Ffield_name = X_TIFFmallocExt(tls, tif, int32(32)) if (*TTIFFField)(unsafe.Pointer(fld)).Ffield_name == libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, fld) return libc.UintptrFromInt32(0) } (*TTIFFField)(unsafe.Pointer(fld)).Ffield_subfields = libc.UintptrFromInt32(0) /* * note that this name is a special sign to TIFFClose() and * _TIFFSetupFields() to free the field * Update: * This special sign is replaced by fld->field_anonymous flag. */ libc.X__builtin_snprintf(tls, (*TTIFFField)(unsafe.Pointer(fld)).Ffield_name, uint32(32), __ccgo_ts+26966, libc.VaList(bp+8, libc.Int32FromUint32(tag))) return fld } /**************************************************************************** * O B S O L E T E D I N T E R F A C E S * * Don't use this stuff in your applications, it may be removed in the future * libtiff versions. ****************************************************************************/ func __TIFFSetGetType(tls *libc.TLS, type1 TTIFFDataType, count int16, passcount uint8) (r TTIFFSetGetFieldType) { if type1 == int32(TIFF_ASCII) && int32(count) == -int32(1) && libc.Int32FromUint8(passcount) == 0 { return int32(TIFF_SETGET_ASCII) } else { if int32(count) == int32(1) && libc.Int32FromUint8(passcount) == 0 { switch type1 { case int32(TIFF_BYTE): fallthrough case int32(TIFF_UNDEFINED): return int32(TIFF_SETGET_UINT8) case int32(TIFF_ASCII): return int32(TIFF_SETGET_ASCII) case int32(TIFF_SHORT): return int32(TIFF_SETGET_UINT16) case int32(TIFF_LONG): return int32(TIFF_SETGET_UINT32) case int32(TIFF_RATIONAL): fallthrough case int32(TIFF_SRATIONAL): fallthrough case int32(TIFF_FLOAT): return int32(TIFF_SETGET_FLOAT) case int32(TIFF_SBYTE): return int32(TIFF_SETGET_SINT8) case int32(TIFF_SSHORT): return int32(TIFF_SETGET_SINT16) case int32(TIFF_SLONG): return int32(TIFF_SETGET_SINT32) case int32(TIFF_DOUBLE): return int32(TIFF_SETGET_DOUBLE) case int32(TIFF_IFD): fallthrough case int32(TIFF_IFD8): return int32(TIFF_SETGET_IFD8) case int32(TIFF_LONG8): return int32(TIFF_SETGET_UINT64) case int32(TIFF_SLONG8): return int32(TIFF_SETGET_SINT64) default: return int32(TIFF_SETGET_UNDEFINED) } } else { if int32(count) >= int32(1) && libc.Int32FromUint8(passcount) == 0 { switch type1 { case int32(TIFF_BYTE): fallthrough case int32(TIFF_UNDEFINED): return int32(TIFF_SETGET_C0_UINT8) case int32(TIFF_ASCII): return int32(TIFF_SETGET_C0_ASCII) case int32(TIFF_SHORT): return int32(TIFF_SETGET_C0_UINT16) case int32(TIFF_LONG): return int32(TIFF_SETGET_C0_UINT32) case int32(TIFF_RATIONAL): fallthrough case int32(TIFF_SRATIONAL): fallthrough case int32(TIFF_FLOAT): return int32(TIFF_SETGET_C0_FLOAT) case int32(TIFF_SBYTE): return int32(TIFF_SETGET_C0_SINT8) case int32(TIFF_SSHORT): return int32(TIFF_SETGET_C0_SINT16) case int32(TIFF_SLONG): return int32(TIFF_SETGET_C0_SINT32) case int32(TIFF_DOUBLE): return int32(TIFF_SETGET_C0_DOUBLE) case int32(TIFF_IFD): fallthrough case int32(TIFF_IFD8): return int32(TIFF_SETGET_C0_IFD8) case int32(TIFF_LONG8): return int32(TIFF_SETGET_C0_UINT64) case int32(TIFF_SLONG8): return int32(TIFF_SETGET_C0_SINT64) default: return int32(TIFF_SETGET_UNDEFINED) } } else { if int32(count) == -int32(1) && libc.Int32FromUint8(passcount) == int32(1) { switch type1 { case int32(TIFF_BYTE): fallthrough case int32(TIFF_UNDEFINED): return int32(TIFF_SETGET_C16_UINT8) case int32(TIFF_ASCII): return int32(TIFF_SETGET_C16_ASCII) case int32(TIFF_SHORT): return int32(TIFF_SETGET_C16_UINT16) case int32(TIFF_LONG): return int32(TIFF_SETGET_C16_UINT32) case int32(TIFF_RATIONAL): fallthrough case int32(TIFF_SRATIONAL): fallthrough case int32(TIFF_FLOAT): return int32(TIFF_SETGET_C16_FLOAT) case int32(TIFF_SBYTE): return int32(TIFF_SETGET_C16_SINT8) case int32(TIFF_SSHORT): return int32(TIFF_SETGET_C16_SINT16) case int32(TIFF_SLONG): return int32(TIFF_SETGET_C16_SINT32) case int32(TIFF_DOUBLE): return int32(TIFF_SETGET_C16_DOUBLE) case int32(TIFF_IFD): fallthrough case int32(TIFF_IFD8): return int32(TIFF_SETGET_C16_IFD8) case int32(TIFF_LONG8): return int32(TIFF_SETGET_C16_UINT64) case int32(TIFF_SLONG8): return int32(TIFF_SETGET_C16_SINT64) default: return int32(TIFF_SETGET_UNDEFINED) } } else { if int32(count) == -int32(3) && libc.Int32FromUint8(passcount) == int32(1) { switch type1 { case int32(TIFF_BYTE): fallthrough case int32(TIFF_UNDEFINED): return int32(TIFF_SETGET_C32_UINT8) case int32(TIFF_ASCII): return int32(TIFF_SETGET_C32_ASCII) case int32(TIFF_SHORT): return int32(TIFF_SETGET_C32_UINT16) case int32(TIFF_LONG): return int32(TIFF_SETGET_C32_UINT32) case int32(TIFF_RATIONAL): fallthrough case int32(TIFF_SRATIONAL): fallthrough case int32(TIFF_FLOAT): return int32(TIFF_SETGET_C32_FLOAT) case int32(TIFF_SBYTE): return int32(TIFF_SETGET_C32_SINT8) case int32(TIFF_SSHORT): return int32(TIFF_SETGET_C32_SINT16) case int32(TIFF_SLONG): return int32(TIFF_SETGET_C32_SINT32) case int32(TIFF_DOUBLE): return int32(TIFF_SETGET_C32_DOUBLE) case int32(TIFF_IFD): fallthrough case int32(TIFF_IFD8): return int32(TIFF_SETGET_C32_IFD8) case int32(TIFF_LONG8): return int32(TIFF_SETGET_C32_UINT64) case int32(TIFF_SLONG8): return int32(TIFF_SETGET_C32_SINT64) default: return int32(TIFF_SETGET_UNDEFINED) } } } } } } return int32(TIFF_SETGET_UNDEFINED) } func XTIFFMergeFieldInfo(tls *libc.TLS, tif uintptr, info uintptr, n Tuint32_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var i Tuint32_t var nfields, v1 Tsize_t var tp, v2 uintptr _, _, _, _, _ = i, nfields, tp, v1, v2 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfieldscompat > uint32(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat = X_TIFFCheckRealloc(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat, libc.Int32FromUint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_nfieldscompat+uint32(1)), int32(16), uintptr(unsafe.Pointer(&_reason1))) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat = X_TIFFCheckMalloc(tls, tif, int32(1), int32(16), uintptr(unsafe.Pointer(&_reason1))) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module1)), __ccgo_ts+26782, 0) return -int32(1) } v2 = tif + 912 v1 = *(*Tsize_t)(unsafe.Pointer(v2)) *(*Tsize_t)(unsafe.Pointer(v2))++ nfields = v1 (*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(nfields)*16))).Ftype1 = int32(tfiatOther) (*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(nfields)*16))).Fallocated_size = n (*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(nfields)*16))).Fcount = n (*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(nfields)*16))).Ffields = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint32(n), int32(36), uintptr(unsafe.Pointer(&_reason1))) if !((*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(nfields)*16))).Ffields != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module1)), __ccgo_ts+26782, 0) return -int32(1) } tp = (*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(nfields)*16))).Ffields i = uint32(0) for { if !(i < n) { break } (*TTIFFField)(unsafe.Pointer(tp)).Ffield_tag = (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_tag if int32((*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_readcount) < -int32(3) || int32((*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_readcount) == 0 || int32((*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_writecount) < -int32(3) || int32((*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_writecount) == 0 { /* The fields (field_readcount) and (field_writecount) may use the * values TIFF_VARIABLE (-1), TIFF_SPP (-2), TIFF_VARIABLE2 (-3). */ XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module1)), __ccgo_ts+26973, 0) return -int32(1) } (*TTIFFField)(unsafe.Pointer(tp)).Ffield_readcount = (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_readcount (*TTIFFField)(unsafe.Pointer(tp)).Ffield_writecount = (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_writecount (*TTIFFField)(unsafe.Pointer(tp)).Ffield_type = (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_type (*TTIFFField)(unsafe.Pointer(tp)).Ffield_anonymous = uint32(0) (*TTIFFField)(unsafe.Pointer(tp)).Fset_field_type = __TIFFSetGetType(tls, (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_type, (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_writecount, (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_passcount) (*TTIFFField)(unsafe.Pointer(tp)).Fget_field_type = __TIFFSetGetType(tls, (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_type, (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_readcount, (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_passcount) (*TTIFFField)(unsafe.Pointer(tp)).Ffield_bit = (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_bit (*TTIFFField)(unsafe.Pointer(tp)).Ffield_oktochange = (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_oktochange (*TTIFFField)(unsafe.Pointer(tp)).Ffield_passcount = (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_passcount if (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_name == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module1)), __ccgo_ts+27073, libc.VaList(bp+8, i, (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_tag)) return -int32(1) } (*TTIFFField)(unsafe.Pointer(tp)).Ffield_name = (*(*TTIFFFieldInfo)(unsafe.Pointer(info + uintptr(i)*20))).Ffield_name (*TTIFFField)(unsafe.Pointer(tp)).Ffield_subfields = libc.UintptrFromInt32(0) tp += 36 goto _3 _3: ; i++ } if !(X_TIFFMergeFields(tls, tif, (*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(nfields)*16))).Ffields, n) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module1)), __ccgo_ts+26753, 0) return -int32(1) } return 0 } var _module1 = [19]uint8{'T', 'I', 'F', 'F', 'M', 'e', 'r', 'g', 'e', 'F', 'i', 'e', 'l', 'd', 'I', 'n', 'f', 'o'} var _reason1 = [17]uint8{'f', 'o', 'r', ' ', 'f', 'i', 'e', 'l', 'd', 's', ' ', 'a', 'r', 'r', 'a', 'y'} func X_TIFFCheckFieldIsValidForCodec(tls *libc.TLS, tif uintptr, tag Tttag_t) (r int32) { /* Filter out non-codec specific tags */ switch tag { /* Shared tags */ case uint32(TIFFTAG_PREDICTOR): /* JPEG tags */ fallthrough case uint32(TIFFTAG_JPEGTABLES): /* OJPEG tags */ fallthrough case uint32(TIFFTAG_JPEGIFOFFSET): fallthrough case uint32(TIFFTAG_JPEGIFBYTECOUNT): fallthrough case uint32(TIFFTAG_JPEGQTABLES): fallthrough case uint32(TIFFTAG_JPEGDCTABLES): fallthrough case uint32(TIFFTAG_JPEGACTABLES): fallthrough case uint32(TIFFTAG_JPEGPROC): fallthrough case uint32(TIFFTAG_JPEGRESTARTINTERVAL): /* CCITT* */ fallthrough case uint32(TIFFTAG_BADFAXLINES): fallthrough case uint32(TIFFTAG_CLEANFAXDATA): fallthrough case uint32(TIFFTAG_CONSECUTIVEBADFAXLINES): fallthrough case uint32(TIFFTAG_GROUP3OPTIONS): fallthrough case uint32(TIFFTAG_GROUP4OPTIONS): /* LERC */ fallthrough case uint32(TIFFTAG_LERC_PARAMETERS): default: return int32(1) } if !(XTIFFIsCODECConfigured(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) != 0) { return 0 } /* Check if codec specific tags are allowed for the current * compression scheme (codec) */ switch libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) { case int32(COMPRESSION_LZW): if tag == uint32(TIFFTAG_PREDICTOR) { return int32(1) } case int32(COMPRESSION_PACKBITS): /* No codec-specific tags */ case int32(COMPRESSION_THUNDERSCAN): /* No codec-specific tags */ case int32(COMPRESSION_NEXT): /* No codec-specific tags */ case int32(COMPRESSION_JPEG): if tag == uint32(TIFFTAG_JPEGTABLES) { return int32(1) } case int32(COMPRESSION_OJPEG): switch tag { case uint32(TIFFTAG_JPEGIFOFFSET): fallthrough case uint32(TIFFTAG_JPEGIFBYTECOUNT): fallthrough case uint32(TIFFTAG_JPEGQTABLES): fallthrough case uint32(TIFFTAG_JPEGDCTABLES): fallthrough case uint32(TIFFTAG_JPEGACTABLES): fallthrough case uint32(TIFFTAG_JPEGPROC): fallthrough case uint32(TIFFTAG_JPEGRESTARTINTERVAL): return int32(1) } case int32(COMPRESSION_CCITTRLE): fallthrough case int32(COMPRESSION_CCITTRLEW): fallthrough case int32(COMPRESSION_CCITTFAX3): fallthrough case int32(COMPRESSION_CCITTFAX4): switch tag { case uint32(TIFFTAG_BADFAXLINES): fallthrough case uint32(TIFFTAG_CLEANFAXDATA): fallthrough case uint32(TIFFTAG_CONSECUTIVEBADFAXLINES): return int32(1) case uint32(TIFFTAG_GROUP3OPTIONS): if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_CCITTFAX3) { return int32(1) } case uint32(TIFFTAG_GROUP4OPTIONS): if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_CCITTFAX4) { return int32(1) } break } case int32(COMPRESSION_JBIG): /* No codec-specific tags */ case int32(COMPRESSION_DEFLATE): fallthrough case int32(COMPRESSION_ADOBE_DEFLATE): if tag == uint32(TIFFTAG_PREDICTOR) { return int32(1) } case int32(COMPRESSION_PIXARLOG): if tag == uint32(TIFFTAG_PREDICTOR) { return int32(1) } case int32(COMPRESSION_SGILOG): fallthrough case int32(COMPRESSION_SGILOG24): /* No codec-specific tags */ case int32(COMPRESSION_LZMA): if tag == uint32(TIFFTAG_PREDICTOR) { return int32(1) } case int32(COMPRESSION_ZSTD): if tag == uint32(TIFFTAG_PREDICTOR) { return int32(1) } case int32(COMPRESSION_LERC): if tag == uint32(TIFFTAG_LERC_PARAMETERS) { return int32(1) } break } return 0 } const DATATYPE_IEEEFP = 3 const DATATYPE_INT = 1 const DATATYPE_UINT = 2 const DATATYPE_VOID = 0 const FLT_MAX2 = 3.40282346638528859812e+38 const O_RDONLY3 = 0 const TIFF_BEENWRITING1 = 64 const TIFF_BIGTIFF1 = 524288 const TIFF_BUF4WRITE1 = 1048576 const TIFF_BUFFERSETUP1 = 16 const TIFF_CODERSETUP1 = 32 const TIFF_DIRTYDIRECT1 = 8 const TIFF_INSUBIFD1 = 8192 const TIFF_ISTILED1 = 1024 const TIFF_MAPPED3 = 2048 const TIFF_MYBUFFER3 = 512 const TIFF_PERSAMPLE1 = 4194304 const TIFF_POSTENCODE1 = 4096 const TIFF_SWAB1 = 128 const UINT32_MAX2 = 4294967295 const UINT_MAX3 = 4294967295 /* * These are used in the backwards compatibility code... */ func _setByteArray(tls *libc.TLS, tif uintptr, vpp uintptr, vp uintptr, nmemb Tsize_t, elem_size Tsize_t) { var bytes Ttmsize_t _ = bytes if *(*uintptr)(unsafe.Pointer(vpp)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(vpp))) *(*uintptr)(unsafe.Pointer(vpp)) = uintptr(0) } if vp != 0 { bytes = X_TIFFMultiplySSize(tls, libc.UintptrFromInt32(0), libc.Int32FromUint32(nmemb), libc.Int32FromUint32(elem_size), libc.UintptrFromInt32(0)) if bytes != 0 { *(*uintptr)(unsafe.Pointer(vpp)) = X_TIFFmallocExt(tls, tif, bytes) } if *(*uintptr)(unsafe.Pointer(vpp)) != 0 { X_TIFFmemcpy(tls, *(*uintptr)(unsafe.Pointer(vpp)), vp, bytes) } } } func X_TIFFsetByteArray(tls *libc.TLS, vpp uintptr, vp uintptr, n Tuint32_t) { _setByteArray(tls, libc.UintptrFromInt32(0), vpp, vp, n, uint32(1)) } func X_TIFFsetByteArrayExt(tls *libc.TLS, tif uintptr, vpp uintptr, vp uintptr, n Tuint32_t) { _setByteArray(tls, tif, vpp, vp, n, uint32(1)) } func __TIFFsetNString(tls *libc.TLS, tif uintptr, cpp uintptr, cp uintptr, n Tuint32_t) { _setByteArray(tls, tif, cpp, cp, n, uint32(1)) } func X_TIFFsetShortArray(tls *libc.TLS, wpp uintptr, wp uintptr, n Tuint32_t) { _setByteArray(tls, libc.UintptrFromInt32(0), wpp, wp, n, uint32(2)) } func X_TIFFsetShortArrayExt(tls *libc.TLS, tif uintptr, wpp uintptr, wp uintptr, n Tuint32_t) { _setByteArray(tls, tif, wpp, wp, n, uint32(2)) } func X_TIFFsetLongArray(tls *libc.TLS, lpp uintptr, lp uintptr, n Tuint32_t) { _setByteArray(tls, libc.UintptrFromInt32(0), lpp, lp, n, uint32(4)) } func X_TIFFsetLongArrayExt(tls *libc.TLS, tif uintptr, lpp uintptr, lp uintptr, n Tuint32_t) { _setByteArray(tls, tif, lpp, lp, n, uint32(4)) } func __TIFFsetLong8Array(tls *libc.TLS, tif uintptr, lpp uintptr, lp uintptr, n Tuint32_t) { _setByteArray(tls, tif, lpp, lp, n, uint32(8)) } func X_TIFFsetFloatArray(tls *libc.TLS, fpp uintptr, fp uintptr, n Tuint32_t) { _setByteArray(tls, libc.UintptrFromInt32(0), fpp, fp, n, uint32(4)) } func X_TIFFsetFloatArrayExt(tls *libc.TLS, tif uintptr, fpp uintptr, fp uintptr, n Tuint32_t) { _setByteArray(tls, tif, fpp, fp, n, uint32(4)) } func X_TIFFsetDoubleArray(tls *libc.TLS, dpp uintptr, dp uintptr, n Tuint32_t) { _setByteArray(tls, libc.UintptrFromInt32(0), dpp, dp, n, uint32(8)) } func X_TIFFsetDoubleArrayExt(tls *libc.TLS, tif uintptr, dpp uintptr, dp uintptr, n Tuint32_t) { _setByteArray(tls, tif, dpp, dp, n, uint32(8)) } func _setDoubleArrayOneValue(tls *libc.TLS, tif uintptr, vpp uintptr, value float64, nmemb Tsize_t) { var v1 Tsize_t _ = v1 if *(*uintptr)(unsafe.Pointer(vpp)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(vpp))) } *(*uintptr)(unsafe.Pointer(vpp)) = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(nmemb*uint32(8))) if *(*uintptr)(unsafe.Pointer(vpp)) != 0 { for { v1 = nmemb nmemb-- if !(v1 != 0) { break } *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(vpp)) + uintptr(nmemb)*8)) = value } } } // C documentation // // /* // * Install extra samples information. // */ func _setExtraSamples(tls *libc.TLS, tif uintptr, ap Tva_list, v uintptr) (r int32) { var i Tuint32_t var td, va uintptr _, _, _ = i, td, va td = tif + 56 *(*Tuint32_t)(unsafe.Pointer(v)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) if libc.Int32FromUint16(uint16(*(*Tuint32_t)(unsafe.Pointer(v)))) > libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) { return 0 } va = libc.VaUintptr(&ap) if *(*Tuint32_t)(unsafe.Pointer(v)) > uint32(0) && va == libc.UintptrFromInt32(0) { /* typically missing param */ return 0 } i = uint32(0) for { if !(i < *(*Tuint32_t)(unsafe.Pointer(v))) { break } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(va + uintptr(i)*2))) > int32(EXTRASAMPLE_UNASSALPHA) { /* * XXX: Corel Draw is known to produce incorrect * ExtraSamples tags which must be patched here if we * want to be able to open some of the damaged TIFF * files: */ if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(va + uintptr(i)*2))) == int32(999) { *(*Tuint16_t)(unsafe.Pointer(va + uintptr(i)*2)) = uint16(EXTRASAMPLE_UNASSALPHA) } else { return 0 } } goto _1 _1: ; i++ } if *(*uintptr)(unsafe.Pointer(td + 224)) != libc.UintptrFromInt32(0) && uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)-*(*Tuint32_t)(unsafe.Pointer(v)) > uint32(1) && !(libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)-libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples) > libc.Int32FromInt32(1)) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module2)), __ccgo_ts+27119, 0) *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TRANSFERFUNCTION)/libc.Int32FromInt32(32))*4)) &= ^(libc.Uint32FromInt32(1) << (libc.Int32FromInt32(FIELD_TRANSFERFUNCTION) & libc.Int32FromInt32(0x1f))) X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(td + 224))) *(*uintptr)(unsafe.Pointer(td + 224)) = libc.UintptrFromInt32(0) } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples = uint16(*(*Tuint32_t)(unsafe.Pointer(v))) X_TIFFsetShortArrayExt(tls, tif, td+120, va, uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples)) return int32(1) } var _module2 = [16]uint8{'s', 'e', 't', 'E', 'x', 't', 'r', 'a', 'S', 'a', 'm', 'p', 'l', 'e', 's'} // C documentation // // /* // * Count ink names separated by \0. Returns // * zero if the ink names are not as expected. // */ func _countInkNamesString(tls *libc.TLS, tif uintptr, slen Tuint32_t, s uintptr) (r Tuint16_t) { bp := tls.Alloc(32) defer tls.Free(32) var cp, ep uintptr var i Tuint16_t _, _, _ = cp, ep, i i = uint16(0) if slen > uint32(0) { ep = s + uintptr(slen) cp = s for cond := true; cond; cond = cp < ep { for { if !(cp < ep && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000')) { break } goto _1 _1: ; cp++ } if cp >= ep { goto bad } cp++ /* skip \0 */ i++ } return i } goto bad bad: ; XTIFFErrorExtR(tls, tif, __ccgo_ts+27222, __ccgo_ts+27235, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, slen, libc.Int32FromUint16(i))) return libc.Uint16FromInt32(libc.Int32FromInt32(0)) } func __TIFFVSetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { bp := tls.Alloc(128) defer tls.Free(128) var dblval float64 var fip, fip2, fip21, fip22, fip23, mb, new_customValues, pi64, pui64, s, td, tv, tv2, val, v10, v11, v4, v5, v9 uintptr var i, ma, standard_tag, v32 Tuint32_t var i1, i2, iC2, iCustom, iCustom2, status, tv_size, v1, v2 int32 var len1 Tsize_t var ninksinstring Tuint16_t var _ /* sv at bp+4 */ Tuint16_t var _ /* v at bp+0 */ Tuint32_t var _ /* v2 at bp+12 */ Tuint8_t var _ /* v2 at bp+13 */ Tint8_t var _ /* v2 at bp+14 */ Tuint16_t var _ /* v2 at bp+16 */ Tint16_t var _ /* v2 at bp+20 */ Tuint32_t var _ /* v2 at bp+24 */ Tint32_t var _ /* v2 at bp+32 */ Tuint64_t var _ /* v2 at bp+40 */ Tint64_t var _ /* v2 at bp+48 */ float64 var _ /* v2 at bp+60 */ float32 var _ /* v2 at bp+64 */ float64 var _ /* v2 at bp+8 */ [2]Tuint16_t var _ /* v3 at bp+56 */ float32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dblval, fip, fip2, fip21, fip22, fip23, i, i1, i2, iC2, iCustom, iCustom2, len1, ma, mb, new_customValues, ninksinstring, pi64, pui64, s, standard_tag, status, td, tv, tv2, tv_size, v32, val, v1, v10, v11, v2, v4, v5, v9 td = tif + 56 status = int32(1) fip = XTIFFFindField(tls, tif, tag, int32(TIFF_NOTYPE)) standard_tag = tag if fip == libc.UintptrFromInt32(0) { /* cannot happen since OkToChangeTag() already checks it */ return 0 } /* * We want to force the custom code to be used for custom * fields even if the tag happens to match a well known * one - important for reinterpreted handling of standard * tag values in custom directories (i.e. EXIF) */ if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) == int32(FIELD_CUSTOM) { standard_tag = uint32(0) } switch standard_tag { case uint32(TIFFTAG_SUBFILETYPE): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subfiletype = libc.VaUint32(&ap) case uint32(TIFFTAG_IMAGEWIDTH): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth = libc.VaUint32(&ap) case uint32(TIFFTAG_IMAGELENGTH): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength = libc.VaUint32(&ap) case uint32(TIFFTAG_BITSPERSAMPLE): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample = libc.Uint16FromInt32(libc.VaInt32(&ap)) /* * If the data require post-decoding processing to byte-swap * samples, set it up here. Note that since tags are required * to be ordered, compression code can override this behavior * in the setup method if it wants to roll the post decoding * work in with its normal work. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) == int32(8) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFNoPostDecode) } else { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) == int32(16) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFSwab16BitData) } else { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) == int32(24) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFSwab24BitData) } else { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) == int32(32) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFSwab32BitData) } else { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) == int32(64) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFSwab64BitData) } else { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) == int32(128) { /* two 64's */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFSwab64BitData) } } } } } } } case uint32(TIFFTAG_COMPRESSION): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) /* * If we're changing the compression scheme, notify the * previous module so that it can cleanup any state it's * setup. */ if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_COMPRESSION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_COMPRESSION)&libc.Int32FromInt32(0x1f))) != 0 { if uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == *(*Tuint32_t)(unsafe.Pointer(bp)) { break } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup})))(tls, tif) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00020) } /* * Setup new compression routine state. */ v1 = XTIFFSetCompressionScheme(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) status = v1 if v1 != 0 { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression = uint16(*(*Tuint32_t)(unsafe.Pointer(bp))) } else { status = 0 } case uint32(TIFFTAG_PHOTOMETRIC): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric = libc.Uint16FromInt32(libc.VaInt32(&ap)) case uint32(TIFFTAG_THRESHHOLDING): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_threshholding = libc.Uint16FromInt32(libc.VaInt32(&ap)) case uint32(TIFFTAG_FILLORDER): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) if *(*Tuint32_t)(unsafe.Pointer(bp)) != uint32(FILLORDER_LSB2MSB) && *(*Tuint32_t)(unsafe.Pointer(bp)) != uint32(FILLORDER_MSB2LSB) { goto badvalue } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder = uint16(*(*Tuint32_t)(unsafe.Pointer(bp))) case uint32(TIFFTAG_ORIENTATION): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) if *(*Tuint32_t)(unsafe.Pointer(bp)) < uint32(ORIENTATION_TOPLEFT) || uint32(ORIENTATION_LEFTBOT) < *(*Tuint32_t)(unsafe.Pointer(bp)) { goto badvalue } else { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_orientation = uint16(*(*Tuint32_t)(unsafe.Pointer(bp))) } case uint32(TIFFTAG_SAMPLESPERPIXEL): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) if *(*Tuint32_t)(unsafe.Pointer(bp)) == uint32(0) { goto badvalue } if *(*Tuint32_t)(unsafe.Pointer(bp)) != uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) { /* See http://bugzilla.maptools.org/show_bug.cgi?id=2500 */ if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue != libc.UintptrFromInt32(0) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+27317, 0) *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SMINSAMPLEVALUE)/libc.Int32FromInt32(32))*4)) &= ^(libc.Uint32FromInt32(1) << (libc.Int32FromInt32(FIELD_SMINSAMPLEVALUE) & libc.Int32FromInt32(0x1f))) X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue = libc.UintptrFromInt32(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue != libc.UintptrFromInt32(0) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+27426, 0) *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SMAXSAMPLEVALUE)/libc.Int32FromInt32(32))*4)) &= ^(libc.Uint32FromInt32(1) << (libc.Int32FromInt32(FIELD_SMAXSAMPLEVALUE) & libc.Int32FromInt32(0x1f))) X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue = libc.UintptrFromInt32(0) } /* Test if 3 transfer functions instead of just one are now needed See http://bugzilla.maptools.org/show_bug.cgi?id=2820 */ if *(*uintptr)(unsafe.Pointer(td + 224)) != libc.UintptrFromInt32(0) && *(*Tuint32_t)(unsafe.Pointer(bp))-uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples) > uint32(1) && !(libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)-libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples) > libc.Int32FromInt32(1)) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+27535, 0) *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TRANSFERFUNCTION)/libc.Int32FromInt32(32))*4)) &= ^(libc.Uint32FromInt32(1) << (libc.Int32FromInt32(FIELD_TRANSFERFUNCTION) & libc.Int32FromInt32(0x1f))) X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(td + 224))) *(*uintptr)(unsafe.Pointer(td + 224)) = libc.UintptrFromInt32(0) } } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel = uint16(*(*Tuint32_t)(unsafe.Pointer(bp))) case uint32(TIFFTAG_ROWSPERSTRIP): v32 = libc.VaUint32(&ap) if v32 == uint32(0) { goto badvalue32 } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip = v32 if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TILEDIMENSIONS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_TILEDIMENSIONS)&libc.Int32FromInt32(0x1f))) != 0) { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength = v32 (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth } case uint32(TIFFTAG_MINSAMPLEVALUE): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_minsamplevalue = libc.Uint16FromInt32(libc.VaInt32(&ap)) case uint32(TIFFTAG_MAXSAMPLEVALUE): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_maxsamplevalue = libc.Uint16FromInt32(libc.VaInt32(&ap)) case uint32(TIFFTAG_SMINSAMPLEVALUE): if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x400000) != 0 { X_TIFFsetDoubleArrayExt(tls, tif, td+68, libc.VaUintptr(&ap), uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)) } else { _setDoubleArrayOneValue(tls, tif, td+68, libc.VaFloat64(&ap), uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)) } case uint32(TIFFTAG_SMAXSAMPLEVALUE): if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x400000) != 0 { X_TIFFsetDoubleArrayExt(tls, tif, td+72, libc.VaUintptr(&ap), uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)) } else { _setDoubleArrayOneValue(tls, tif, td+72, libc.VaFloat64(&ap), uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)) } case uint32(TIFFTAG_XRESOLUTION): dblval = libc.VaFloat64(&ap) if dblval != dblval || dblval < libc.Float64FromInt32(0) { goto badvaluedouble } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_xresolution = X_TIFFClampDoubleToFloat(tls, dblval) case uint32(TIFFTAG_YRESOLUTION): dblval = libc.VaFloat64(&ap) if dblval != dblval || dblval < libc.Float64FromInt32(0) { goto badvaluedouble } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_yresolution = X_TIFFClampDoubleToFloat(tls, dblval) case uint32(TIFFTAG_PLANARCONFIG): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) if *(*Tuint32_t)(unsafe.Pointer(bp)) != uint32(PLANARCONFIG_CONTIG) && *(*Tuint32_t)(unsafe.Pointer(bp)) != uint32(PLANARCONFIG_SEPARATE) { goto badvalue } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig = uint16(*(*Tuint32_t)(unsafe.Pointer(bp))) case uint32(TIFFTAG_XPOSITION): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_xposition = X_TIFFClampDoubleToFloat(tls, libc.VaFloat64(&ap)) case uint32(TIFFTAG_YPOSITION): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_yposition = X_TIFFClampDoubleToFloat(tls, libc.VaFloat64(&ap)) case uint32(TIFFTAG_RESOLUTIONUNIT): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) if *(*Tuint32_t)(unsafe.Pointer(bp)) < uint32(RESUNIT_NONE) || uint32(RESUNIT_CENTIMETER) < *(*Tuint32_t)(unsafe.Pointer(bp)) { goto badvalue } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_resolutionunit = uint16(*(*Tuint32_t)(unsafe.Pointer(bp))) case uint32(TIFFTAG_PAGENUMBER): *(*Tuint16_t)(unsafe.Pointer(td + 96)) = libc.Uint16FromInt32(libc.VaInt32(&ap)) *(*Tuint16_t)(unsafe.Pointer(td + 96 + 1*2)) = libc.Uint16FromInt32(libc.VaInt32(&ap)) case uint32(TIFFTAG_HALFTONEHINTS): *(*Tuint16_t)(unsafe.Pointer(td + 112)) = libc.Uint16FromInt32(libc.VaInt32(&ap)) *(*Tuint16_t)(unsafe.Pointer(td + 112 + 1*2)) = libc.Uint16FromInt32(libc.VaInt32(&ap)) case uint32(TIFFTAG_COLORMAP): v32 = libc.Uint32FromInt32(libc.Int32FromInt32(1) << (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) X_TIFFsetShortArrayExt(tls, tif, td+100, libc.VaUintptr(&ap), v32) X_TIFFsetShortArrayExt(tls, tif, td+100+1*4, libc.VaUintptr(&ap), v32) X_TIFFsetShortArrayExt(tls, tif, td+100+2*4, libc.VaUintptr(&ap), v32) case uint32(TIFFTAG_EXTRASAMPLES): if !(_setExtraSamples(tls, tif, ap, bp) != 0) { goto badvalue } case uint32(TIFFTAG_MATTEING): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples = libc.BoolUint16(libc.Int32FromUint16(libc.Uint16FromInt32(libc.VaInt32(&ap))) != libc.Int32FromInt32(0)) if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples != 0 { *(*Tuint16_t)(unsafe.Pointer(bp + 4)) = uint16(EXTRASAMPLE_ASSOCALPHA) X_TIFFsetShortArrayExt(tls, tif, td+120, bp+4, uint32(1)) } case uint32(TIFFTAG_TILEWIDTH): v32 = libc.VaUint32(&ap) if v32%uint32(16) != 0 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode != O_RDONLY3 { goto badvalue32 } XTIFFWarningExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+27641, libc.VaList(bp+80, v32)) } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth = v32 *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00400) case uint32(TIFFTAG_TILELENGTH): v32 = libc.VaUint32(&ap) if v32%uint32(16) != 0 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode != O_RDONLY3 { goto badvalue32 } XTIFFWarningExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+27681, libc.VaList(bp+80, v32)) } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength = v32 *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00400) case uint32(TIFFTAG_TILEDEPTH): v32 = libc.VaUint32(&ap) if v32 == uint32(0) { goto badvalue32 } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tiledepth = v32 case uint32(TIFFTAG_DATATYPE): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) switch *(*Tuint32_t)(unsafe.Pointer(bp)) { case uint32(DATATYPE_VOID): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(SAMPLEFORMAT_VOID) case uint32(DATATYPE_INT): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(SAMPLEFORMAT_INT) case uint32(DATATYPE_UINT): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(SAMPLEFORMAT_UINT) case uint32(DATATYPE_IEEEFP): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(SAMPLEFORMAT_IEEEFP) default: goto badvalue } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat = uint16(*(*Tuint32_t)(unsafe.Pointer(bp))) case uint32(TIFFTAG_SAMPLEFORMAT): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) if *(*Tuint32_t)(unsafe.Pointer(bp)) < uint32(SAMPLEFORMAT_UINT) || uint32(SAMPLEFORMAT_COMPLEXIEEEFP) < *(*Tuint32_t)(unsafe.Pointer(bp)) { goto badvalue } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat = uint16(*(*Tuint32_t)(unsafe.Pointer(bp))) /* Try to fix up the SWAB function for complex data. */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat) == int32(SAMPLEFORMAT_COMPLEXINT) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) == int32(32) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode == __ccgo_fp(X_TIFFSwab32BitData) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFSwab16BitData) } else { if (libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat) == int32(SAMPLEFORMAT_COMPLEXINT) || libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat) == int32(SAMPLEFORMAT_COMPLEXIEEEFP)) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) == int32(64) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode == __ccgo_fp(X_TIFFSwab64BitData) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFSwab32BitData) } } case uint32(TIFFTAG_IMAGEDEPTH): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth = libc.VaUint32(&ap) case uint32(TIFFTAG_SUBIFD): if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x02000) == uint32(0) { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nsubifd = libc.Uint16FromInt32(libc.VaInt32(&ap)) __TIFFsetLong8Array(tls, tif, td+212, libc.VaUintptr(&ap), uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nsubifd)) } else { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+27722, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) status = 0 } case uint32(TIFFTAG_YCBCRPOSITIONING): (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_ycbcrpositioning = libc.Uint16FromInt32(libc.VaInt32(&ap)) case uint32(TIFFTAG_YCBCRSUBSAMPLING): *(*Tuint16_t)(unsafe.Pointer(td + 216)) = libc.Uint16FromInt32(libc.VaInt32(&ap)) *(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)) = libc.Uint16FromInt32(libc.VaInt32(&ap)) case uint32(TIFFTAG_TRANSFERFUNCTION): if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)-libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples) > int32(1) { v2 = int32(3) } else { v2 = int32(1) } *(*Tuint32_t)(unsafe.Pointer(bp)) = libc.Uint32FromInt32(v2) i = uint32(0) for { if !(i < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } X_TIFFsetShortArrayExt(tls, tif, td+224+uintptr(i)*4, libc.VaUintptr(&ap), uint32(1)<<(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) goto _3 _3: ; i++ } case uint32(TIFFTAG_REFERENCEBLACKWHITE): /* XXX should check for null range */ X_TIFFsetFloatArrayExt(tls, tif, td+236, libc.VaUintptr(&ap), uint32(6)) case uint32(TIFFTAG_INKNAMES): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) s = libc.VaUintptr(&ap) ninksinstring = _countInkNamesString(tls, tif, *(*Tuint32_t)(unsafe.Pointer(bp)), s) status = libc.BoolInt32(libc.Int32FromUint16(ninksinstring) > 0) if libc.Int32FromUint16(ninksinstring) > 0 { __TIFFsetNString(tls, tif, td+244, s, *(*Tuint32_t)(unsafe.Pointer(bp))) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_inknameslen = libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))) /* Set NumberOfInks to the value ninksinstring */ if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_NUMBEROFINKS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_NUMBEROFINKS)&libc.Int32FromInt32(0x1f))) != 0 { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks) != libc.Int32FromUint16(ninksinstring) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+27753, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks), libc.Int32FromUint16(ninksinstring), libc.Int32FromUint16(ninksinstring))) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks = ninksinstring } } else { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks = ninksinstring *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_NUMBEROFINKS)/libc.Int32FromInt32(32))*4)) |= libc.Uint32FromInt32(1) << (libc.Int32FromInt32(FIELD_NUMBEROFINKS) & libc.Int32FromInt32(0x1f)) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SAMPLESPERPIXEL)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SAMPLESPERPIXEL)&libc.Int32FromInt32(0x1f))) != 0 { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks) != libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+27879, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel))) } } } case uint32(TIFFTAG_NUMBEROFINKS): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) /* If InkNames already set also NumberOfInks is set accordingly and * should be equal */ if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_INKNAMES)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_INKNAMES)&libc.Int32FromInt32(0x1f))) != 0 { if *(*Tuint32_t)(unsafe.Pointer(bp)) != uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+27973, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, *(*Tuint32_t)(unsafe.Pointer(bp)), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks))) /* Do not set / overwrite number of inks already set by * InkNames case accordingly. */ status = 0 } } else { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks = uint16(*(*Tuint32_t)(unsafe.Pointer(bp))) if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SAMPLESPERPIXEL)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SAMPLESPERPIXEL)&libc.Int32FromInt32(0x1f))) != 0 { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks) != libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+27879, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, *(*Tuint32_t)(unsafe.Pointer(bp)), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel))) } } } case uint32(TIFFTAG_PERSAMPLE): *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(libc.Uint16FromInt32(libc.VaInt32(&ap))) if *(*Tuint32_t)(unsafe.Pointer(bp)) == uint32(PERSAMPLE_MULTI) { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x400000) } else { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x400000) } default: /* * This can happen if multiple images are open with different * codecs which have private tags. The global tag information * table may then have tags that are valid for one file but not * the other. If the client tries to set a tag that is not valid * for the image's codec then we'll arrive here. This * happens, for example, when tiffcp is used to convert between * compression schemes and codec-specific tags are blindly copied. * * This also happens when a FIELD_IGNORE tag is written. */ if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) == FIELD_IGNORE { if tag > uint32(0xffff) { v4 = __ccgo_ts + 28119 } else { v4 = __ccgo_ts + 9405 } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28127, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, v4, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) status = 0 break } if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) != int32(FIELD_CUSTOM) { if tag > uint32(0xffff) { v5 = __ccgo_ts + 28119 } else { v5 = __ccgo_ts + 9405 } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28177, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, v5, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) status = 0 break } /* * Find the existing entry for this custom value. */ tv = libc.UintptrFromInt32(0) iCustom = 0 for { if !(iCustom < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount) { break } if (*TTIFFField)(unsafe.Pointer((*(*TTIFFTagValue)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(iCustom)*12))).Finfo)).Ffield_tag == tag { tv = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(iCustom)*12 if (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue) (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue = libc.UintptrFromInt32(0) } break } goto _6 _6: ; iCustom++ } /* * Grow the custom list if the entry was not found. */ if tv == libc.UintptrFromInt32(0) { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount++ new_customValues = X_TIFFreallocExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues, libc.Int32FromUint32(uint32(12)*libc.Uint32FromInt32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount))) if !(new_customValues != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28225, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) status = 0 goto end } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues = new_customValues tv = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount-libc.Int32FromInt32(1))*12 (*TTIFFTagValue)(unsafe.Pointer(tv)).Finfo = fip (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue = libc.UintptrFromInt32(0) (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount = 0 } /* * Set custom value ... save a copy of the custom tag value. */ /*--: Rational2Double: For Rationals evaluate "set_field_type" to * determine internal storage size. */ tv_size = XTIFFFieldSetGetSize(tls, fip) if tv_size == 0 { status = 0 XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28280, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) goto end } if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_ASCII) { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_passcount != 0 { ma = libc.VaUint32(&ap) mb = libc.VaUintptr(&ap) } else { mb = libc.VaUintptr(&ap) len1 = libc.Xstrlen(tls, mb) + uint32(1) if len1 >= uint32(0x80000000) { status = 0 XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28311, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) goto end } ma = len1 } (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount = libc.Int32FromUint32(ma) _setByteArray(tls, tif, tv+8, mb, ma, uint32(1)) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_passcount != 0 { if int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount) == -int32(3) { (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount = libc.Int32FromUint32(libc.VaUint32(&ap)) } else { (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount = libc.VaInt32(&ap) } } else { if int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount) == -int32(1) || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount) == -int32(3) { (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount = int32(1) } else { if int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount) == -int32(2) { (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount = int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount) } } } if (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount == 0 { status = 0 XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28385, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount), libc.Int32FromUint8((*TTIFFField)(unsafe.Pointer(fip)).Ffield_passcount))) goto end } (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue = X_TIFFCheckMalloc(tls, tif, (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount, tv_size, __ccgo_ts+28448) if !((*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue != 0) { status = 0 goto end } if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_tag == uint32(TIFFTAG_DOTRANGE) && libc.Xstrcmp(tls, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, __ccgo_ts+23515) == 0 { (*(*[2]Tuint16_t)(unsafe.Pointer(bp + 8)))[0] = libc.Uint16FromInt32(libc.VaInt32(&ap)) (*(*[2]Tuint16_t)(unsafe.Pointer(bp + 8)))[int32(1)] = libc.Uint16FromInt32(libc.VaInt32(&ap)) X_TIFFmemcpy(tls, (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue, bp+8, int32(4)) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_passcount != 0 || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount) == -int32(1) || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount) == -int32(3) || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_writecount) == -int32(2) || (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount > int32(1) { /*--: Rational2Double: For Rationals tv_size is set above to * 4 or 8 according to fip->set_field_type! */ X_TIFFmemcpy(tls, (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue, libc.VaUintptr(&ap), (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount*tv_size) /* Test here for too big values for LONG8, SLONG8 in * ClassicTIFF and delete custom field from custom list */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { if (*TTIFFField)(unsafe.Pointer((*TTIFFTagValue)(unsafe.Pointer(tv)).Finfo)).Ffield_type == int32(TIFF_LONG8) { pui64 = (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue i1 = 0 for { if !(i1 < (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount) { break } if *(*Tuint64_t)(unsafe.Pointer(pui64 + uintptr(i1)*8)) > uint64(0xffffffff) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28473, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, *(*Tuint64_t)(unsafe.Pointer(pui64 + uintptr(i1)*8)), i1, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, tag)) goto badvalueifd8long8 } goto _7 _7: ; i1++ } } else { if (*TTIFFField)(unsafe.Pointer((*TTIFFTagValue)(unsafe.Pointer(tv)).Finfo)).Ffield_type == int32(TIFF_SLONG8) { pi64 = (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue i2 = 0 for { if !(i2 < (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount) { break } if *(*Tint64_t)(unsafe.Pointer(pi64 + uintptr(i2)*8)) > int64(2147483647) || *(*Tint64_t)(unsafe.Pointer(pi64 + uintptr(i2)*8)) < int64(-libc.Int32FromInt32(2147483647)-libc.Int32FromInt32(1)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28581, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, *(*Tint64_t)(unsafe.Pointer(pi64 + uintptr(i2)*8)), i2, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, tag)) goto badvalueifd8long8 } goto _8 _8: ; i2++ } } } } } else { val = (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue switch (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type { case int32(TIFF_BYTE): fallthrough case int32(TIFF_UNDEFINED): *(*Tuint8_t)(unsafe.Pointer(bp + 12)) = libc.Uint8FromInt32(libc.VaInt32(&ap)) X_TIFFmemcpy(tls, val, bp+12, tv_size) case int32(TIFF_SBYTE): *(*Tint8_t)(unsafe.Pointer(bp + 13)) = int8(libc.VaInt32(&ap)) X_TIFFmemcpy(tls, val, bp+13, tv_size) case int32(TIFF_SHORT): *(*Tuint16_t)(unsafe.Pointer(bp + 14)) = libc.Uint16FromInt32(libc.VaInt32(&ap)) X_TIFFmemcpy(tls, val, bp+14, tv_size) case int32(TIFF_SSHORT): *(*Tint16_t)(unsafe.Pointer(bp + 16)) = int16(libc.VaInt32(&ap)) X_TIFFmemcpy(tls, val, bp+16, tv_size) case int32(TIFF_LONG): fallthrough case int32(TIFF_IFD): *(*Tuint32_t)(unsafe.Pointer(bp + 20)) = libc.VaUint32(&ap) X_TIFFmemcpy(tls, val, bp+20, tv_size) case int32(TIFF_SLONG): *(*Tint32_t)(unsafe.Pointer(bp + 24)) = libc.VaInt32(&ap) X_TIFFmemcpy(tls, val, bp+24, tv_size) case int32(TIFF_LONG8): fallthrough case int32(TIFF_IFD8): *(*Tuint64_t)(unsafe.Pointer(bp + 32)) = libc.VaUint64(&ap) X_TIFFmemcpy(tls, val, bp+32, tv_size) /* Test here for too big values for ClassicTIFF and * delete custom field from custom list */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) && *(*Tuint64_t)(unsafe.Pointer(bp + 32)) > uint64(0xffffffff) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28690, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, *(*Tuint64_t)(unsafe.Pointer(bp + 32)), (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, tag)) goto badvalueifd8long8 } case int32(TIFF_SLONG8): *(*Tint64_t)(unsafe.Pointer(bp + 40)) = libc.VaInt64(&ap) X_TIFFmemcpy(tls, val, bp+40, tv_size) /* Test here for too big values for ClassicTIFF and * delete custom field from custom list */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) && (*(*Tint64_t)(unsafe.Pointer(bp + 40)) > int64(2147483647) || *(*Tint64_t)(unsafe.Pointer(bp + 40)) < int64(-libc.Int32FromInt32(2147483647)-libc.Int32FromInt32(1))) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28784, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, *(*Tint64_t)(unsafe.Pointer(bp + 40)), (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, tag)) goto badvalueifd8long8 } case int32(TIFF_RATIONAL): fallthrough case int32(TIFF_SRATIONAL): /*-- Rational2Double: For Rationals tv_size is set * above to 4 or 8 according to fip->set_field_type! */ if tv_size == int32(8) { *(*float64)(unsafe.Pointer(bp + 48)) = libc.VaFloat64(&ap) X_TIFFmemcpy(tls, val, bp+48, tv_size) } else { /*-- default should be tv_size == 4 */ *(*float32)(unsafe.Pointer(bp + 56)) = float32(libc.VaFloat64(&ap)) X_TIFFmemcpy(tls, val, bp+56, tv_size) /*-- ToDo: After Testing, this should be * removed and tv_size==4 should be set as * default. */ if tv_size != int32(4) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28871, libc.VaList(bp+80, tv_size)) } } case int32(TIFF_FLOAT): *(*float32)(unsafe.Pointer(bp + 60)) = X_TIFFClampDoubleToFloat(tls, libc.VaFloat64(&ap)) X_TIFFmemcpy(tls, val, bp+60, tv_size) case int32(TIFF_DOUBLE): *(*float64)(unsafe.Pointer(bp + 64)) = libc.VaFloat64(&ap) X_TIFFmemcpy(tls, val, bp+64, tv_size) default: X_TIFFmemset(tls, val, 0, tv_size) status = 0 break } } } } } if status != 0 { fip2 = XTIFFFieldWithTag(tls, tif, tag) if fip2 != 0 { *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip2)).Ffield_bit)/int32(32))*4)) |= libc.Uint32FromInt32(1) << (libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip2)).Ffield_bit) & libc.Int32FromInt32(0x1f)) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00008) } goto end end: ; _ = ap return status goto badvalue badvalue: ; fip21 = XTIFFFieldWithTag(tls, tif, tag) if fip21 != 0 { v9 = (*TTIFFField)(unsafe.Pointer(fip21)).Ffield_name } else { v9 = __ccgo_ts + 2137 } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28920, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, *(*Tuint32_t)(unsafe.Pointer(bp)), v9)) _ = ap return 0 goto badvalue32 badvalue32: ; fip22 = XTIFFFieldWithTag(tls, tif, tag) if fip22 != 0 { v10 = (*TTIFFField)(unsafe.Pointer(fip22)).Ffield_name } else { v10 = __ccgo_ts + 2137 } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28920, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, v32, v10)) _ = ap return 0 goto badvaluedouble badvaluedouble: ; fip23 = XTIFFFieldWithTag(tls, tif, tag) if fip23 != 0 { v11 = (*TTIFFField)(unsafe.Pointer(fip23)).Ffield_name } else { v11 = __ccgo_ts + 2137 } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module3)), __ccgo_ts+28950, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, dblval, v11)) _ = ap return 0 goto badvalueifd8long8 badvalueifd8long8: ; /* Error message issued already above. */ tv2 = libc.UintptrFromInt32(0) /* Find the existing entry for this custom value. */ iCustom2 = 0 for { if !(iCustom2 < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount) { break } if (*TTIFFField)(unsafe.Pointer((*(*TTIFFTagValue)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(iCustom2)*12))).Finfo)).Ffield_tag == tag { tv2 = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(iCustom2)*12 break } goto _12 _12: ; iCustom2++ } if tv2 != libc.UintptrFromInt32(0) { /* Remove custom field from custom list */ if (*TTIFFTagValue)(unsafe.Pointer(tv2)).Fvalue != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, (*TTIFFTagValue)(unsafe.Pointer(tv2)).Fvalue) (*TTIFFTagValue)(unsafe.Pointer(tv2)).Fvalue = libc.UintptrFromInt32(0) } /* Shorten list and close gap in customValues list. * Re-allocation of td_customValues not necessary here. */ (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount-- iC2 = iCustom2 for { if !(iC2 < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount) { break } *(*TTIFFTagValue)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(iC2)*12)) = *(*TTIFFTagValue)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(iC2+int32(1))*12)) goto _13 _13: ; iC2++ } } else { } _ = ap return 0 } var _module3 = [15]uint8{'_', 'T', 'I', 'F', 'F', 'V', 'S', 'e', 't', 'F', 'i', 'e', 'l', 'd'} /*-- _TIFFVSetField() --*/ // C documentation // // /* // * Return 1/0 according to whether or not // * it is permissible to set the tag's value. // * Note that we allow ImageLength to be changed // * so that we can append and extend to images. // * Any other tag may not be altered once writing // * has commenced, unless its value has no effect // * on the format of the data that is written. // */ func _OkToChangeTag(tls *libc.TLS, tif uintptr, tag Tuint32_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var fip, v1 uintptr _, _ = fip, v1 fip = XTIFFFindField(tls, tif, tag, int32(TIFF_NOTYPE)) if !(fip != 0) { /* unknown tag */ if tag > uint32(0xffff) { v1 = __ccgo_ts + 28119 } else { v1 = __ccgo_ts + 9405 } XTIFFErrorExtR(tls, tif, __ccgo_ts+27222, __ccgo_ts+28980, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, v1, tag)) return 0 } if tag != uint32(TIFFTAG_IMAGELENGTH) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00040) != 0 && !((*TTIFFField)(unsafe.Pointer(fip)).Ffield_oktochange != 0) { /* * Consult info table to see if tag can be changed * after we've started writing. We only allow changes * to those tags that don't/shouldn't affect the * compression and/or format of the data. */ XTIFFErrorExtR(tls, tif, __ccgo_ts+27222, __ccgo_ts+29001, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) return 0 } return int32(1) } // C documentation // // /* // * Record the value of a field in the // * internal directory structure. The // * field will be written to the file // * when/if the directory structure is // * updated. // */ func XTIFFSetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, va uintptr) (r int32) { var ap Tva_list var status int32 _, _ = ap, status ap = va status = XTIFFVSetField(tls, tif, tag, ap) _ = ap return status } // C documentation // // /* // * Clear the contents of the field in the internal structure. // */ func XTIFFUnsetField(tls *libc.TLS, tif uintptr, tag Tuint32_t) (r int32) { var fip, td, tv uintptr var i int32 _, _, _, _ = fip, i, td, tv fip = XTIFFFieldWithTag(tls, tif, tag) td = tif + 56 if !(fip != 0) { return 0 } if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) != int32(FIELD_CUSTOM) { *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit)/int32(32))*4)) &= ^(libc.Uint32FromInt32(1) << (libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) & libc.Int32FromInt32(0x1f))) } else { tv = libc.UintptrFromInt32(0) i = 0 for { if !(i < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount) { break } tv = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(i)*12 if (*TTIFFField)(unsafe.Pointer((*TTIFFTagValue)(unsafe.Pointer(tv)).Finfo)).Ffield_tag == tag { break } goto _1 _1: ; i++ } if i < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount { X_TIFFfreeExt(tls, tif, (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue) for { if !(i < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount-int32(1)) { break } *(*TTIFFTagValue)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(i)*12)) = *(*TTIFFTagValue)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(i+int32(1))*12)) goto _2 _2: ; i++ } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount-- } } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00008) return int32(1) } // C documentation // // /* // * Like TIFFSetField, but taking a varargs // * parameter list. This routine is useful // * for building higher-level interfaces on // * top of the library. // */ func XTIFFVSetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { var v1 int32 _ = v1 if _OkToChangeTag(tls, tif, tag) != 0 { v1 = (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield})))(tls, tif, tag, ap) } else { v1 = 0 } return v1 } func __TIFFVGetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var fip, td, tv, val, v3 uintptr var i, i1 Tuint16_t var i2, ret_val, tv_size int32 var standard_tag Tuint32_t var v, v1 float64 _, _, _, _, _, _, _, _, _, _, _, _, _ = fip, i, i1, i2, ret_val, standard_tag, td, tv, tv_size, v, v1, val, v3 td = tif + 56 ret_val = int32(1) standard_tag = tag fip = XTIFFFindField(tls, tif, tag, int32(TIFF_NOTYPE)) if fip == libc.UintptrFromInt32(0) { /* cannot happen since TIFFGetField() already checks it */ return 0 } /* * We want to force the custom code to be used for custom * fields even if the tag happens to match a well known * one - important for reinterpreted handling of standard * tag values in custom directories (i.e. EXIF) */ if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) == int32(FIELD_CUSTOM) { standard_tag = uint32(0) } switch standard_tag { case uint32(TIFFTAG_SUBFILETYPE): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subfiletype case uint32(TIFFTAG_IMAGEWIDTH): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth case uint32(TIFFTAG_IMAGELENGTH): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength case uint32(TIFFTAG_BITSPERSAMPLE): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample case uint32(TIFFTAG_COMPRESSION): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression case uint32(TIFFTAG_PHOTOMETRIC): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric case uint32(TIFFTAG_THRESHHOLDING): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_threshholding case uint32(TIFFTAG_FILLORDER): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder case uint32(TIFFTAG_ORIENTATION): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_orientation case uint32(TIFFTAG_SAMPLESPERPIXEL): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel case uint32(TIFFTAG_ROWSPERSTRIP): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip case uint32(TIFFTAG_MINSAMPLEVALUE): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_minsamplevalue case uint32(TIFFTAG_MAXSAMPLEVALUE): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_maxsamplevalue case uint32(TIFFTAG_SMINSAMPLEVALUE): if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x400000) != 0 { *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue } else { v = *(*float64)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue)) i = uint16(1) for { if !(libc.Int32FromUint16(i) < libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)) { break } if *(*float64)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue + uintptr(i)*8)) < v { v = *(*float64)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue + uintptr(i)*8)) } goto _1 _1: ; i++ } *(*float64)(unsafe.Pointer(libc.VaUintptr(&ap))) = v } case uint32(TIFFTAG_SMAXSAMPLEVALUE): if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x400000) != 0 { *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue } else { v1 = *(*float64)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue)) i1 = uint16(1) for { if !(libc.Int32FromUint16(i1) < libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)) { break } if *(*float64)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue + uintptr(i1)*8)) > v1 { v1 = *(*float64)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue + uintptr(i1)*8)) } goto _2 _2: ; i1++ } *(*float64)(unsafe.Pointer(libc.VaUintptr(&ap))) = v1 } case uint32(TIFFTAG_XRESOLUTION): *(*float32)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_xresolution case uint32(TIFFTAG_YRESOLUTION): *(*float32)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_yresolution case uint32(TIFFTAG_PLANARCONFIG): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig case uint32(TIFFTAG_XPOSITION): *(*float32)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_xposition case uint32(TIFFTAG_YPOSITION): *(*float32)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_yposition case uint32(TIFFTAG_RESOLUTIONUNIT): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_resolutionunit case uint32(TIFFTAG_PAGENUMBER): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer(td + 96)) *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer(td + 96 + 1*2)) case uint32(TIFFTAG_HALFTONEHINTS): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer(td + 112)) *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer(td + 112 + 1*2)) case uint32(TIFFTAG_COLORMAP): *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*uintptr)(unsafe.Pointer(td + 100)) *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*uintptr)(unsafe.Pointer(td + 100 + 1*4)) *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*uintptr)(unsafe.Pointer(td + 100 + 2*4)) case uint32(TIFFTAG_STRIPOFFSETS): fallthrough case uint32(TIFFTAG_TILEOFFSETS): X_TIFFFillStriles(tls, tif) *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p == libc.UintptrFromInt32(0) { ret_val = 0 } case uint32(TIFFTAG_STRIPBYTECOUNTS): fallthrough case uint32(TIFFTAG_TILEBYTECOUNTS): X_TIFFFillStriles(tls, tif) *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p == libc.UintptrFromInt32(0) { ret_val = 0 } case uint32(TIFFTAG_MATTEING): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = libc.BoolUint16(libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples) == int32(1) && libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo))) == int32(EXTRASAMPLE_ASSOCALPHA)) case uint32(TIFFTAG_EXTRASAMPLES): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo case uint32(TIFFTAG_TILEWIDTH): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth case uint32(TIFFTAG_TILELENGTH): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength case uint32(TIFFTAG_TILEDEPTH): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tiledepth case uint32(TIFFTAG_DATATYPE): switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat) { case int32(SAMPLEFORMAT_UINT): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = uint16(DATATYPE_UINT) case int32(SAMPLEFORMAT_INT): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = uint16(DATATYPE_INT) case int32(SAMPLEFORMAT_IEEEFP): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = uint16(DATATYPE_IEEEFP) case int32(SAMPLEFORMAT_VOID): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = uint16(DATATYPE_VOID) break } case uint32(TIFFTAG_SAMPLEFORMAT): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat case uint32(TIFFTAG_IMAGEDEPTH): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth case uint32(TIFFTAG_SUBIFD): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nsubifd *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subifd case uint32(TIFFTAG_YCBCRPOSITIONING): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_ycbcrpositioning case uint32(TIFFTAG_YCBCRSUBSAMPLING): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer(td + 216)) *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)) case uint32(TIFFTAG_TRANSFERFUNCTION): *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*uintptr)(unsafe.Pointer(td + 224)) if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)-libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples) > int32(1) { *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*uintptr)(unsafe.Pointer(td + 224 + 1*4)) *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*uintptr)(unsafe.Pointer(td + 224 + 2*4)) } else { *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = libc.UintptrFromInt32(0) } case uint32(TIFFTAG_REFERENCEBLACKWHITE): *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite case uint32(TIFFTAG_INKNAMES): *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_inknames case uint32(TIFFTAG_NUMBEROFINKS): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks default: /* * This can happen if multiple images are open * with different codecs which have private * tags. The global tag information table may * then have tags that are valid for one file * but not the other. If the client tries to * get a tag that is not valid for the image's * codec then we'll arrive here. */ if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) != int32(FIELD_CUSTOM) { if tag > uint32(0xffff) { v3 = __ccgo_ts + 28119 } else { v3 = __ccgo_ts + 9405 } XTIFFErrorExtR(tls, tif, __ccgo_ts+29042, __ccgo_ts+28177, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, v3, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) ret_val = 0 break } /* * Do we have a custom value? */ ret_val = 0 i2 = 0 for { if !(i2 < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount) { break } tv = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(i2)*12 if (*TTIFFField)(unsafe.Pointer((*TTIFFTagValue)(unsafe.Pointer(tv)).Finfo)).Ffield_tag != tag { goto _4 } if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_passcount != 0 { if int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(3) { *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = libc.Uint32FromInt32((*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount) } else { /* Assume TIFF_VARIABLE */ *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = libc.Uint16FromInt32((*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount) } *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue ret_val = int32(1) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_tag == uint32(TIFFTAG_DOTRANGE) && libc.Xstrcmp(tls, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, __ccgo_ts+23515) == 0 { /* TODO: This is an evil exception and should not have been handled this way ... likely best if we move it into the directory structure with an explicit field in libtiff 4.1 and assign it a FIELD_ value */ *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer((*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue)) *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer((*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue + 1*2)) ret_val = int32(1) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_ASCII) || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(1) || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(3) || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(2) || (*TTIFFTagValue)(unsafe.Pointer(tv)).Fcount > int32(1) { *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue ret_val = int32(1) } else { val = (*TTIFFTagValue)(unsafe.Pointer(tv)).Fvalue switch (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type { case int32(TIFF_BYTE): fallthrough case int32(TIFF_UNDEFINED): *(*Tuint8_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint8_t)(unsafe.Pointer(val)) ret_val = int32(1) case int32(TIFF_SBYTE): *(*Tint8_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tint8_t)(unsafe.Pointer(val)) ret_val = int32(1) case int32(TIFF_SHORT): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint16_t)(unsafe.Pointer(val)) ret_val = int32(1) case int32(TIFF_SSHORT): *(*Tint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tint16_t)(unsafe.Pointer(val)) ret_val = int32(1) case int32(TIFF_LONG): fallthrough case int32(TIFF_IFD): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint32_t)(unsafe.Pointer(val)) ret_val = int32(1) case int32(TIFF_SLONG): *(*Tint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tint32_t)(unsafe.Pointer(val)) ret_val = int32(1) case int32(TIFF_LONG8): fallthrough case int32(TIFF_IFD8): *(*Tuint64_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tuint64_t)(unsafe.Pointer(val)) ret_val = int32(1) case int32(TIFF_SLONG8): *(*Tint64_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*Tint64_t)(unsafe.Pointer(val)) ret_val = int32(1) case int32(TIFF_RATIONAL): fallthrough case int32(TIFF_SRATIONAL): /*-- Rational2Double: For Rationals evaluate * "set_field_type" to determine internal * storage size and return value size. */ tv_size = XTIFFFieldSetGetSize(tls, fip) if tv_size == int32(8) { *(*float64)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*float64)(unsafe.Pointer(val)) ret_val = int32(1) } else { /*-- default should be tv_size == 4 */ *(*float32)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*float32)(unsafe.Pointer(val)) ret_val = int32(1) /*-- ToDo: After Testing, this should be * removed and tv_size==4 should be set as * default. */ if tv_size != int32(4) { XTIFFErrorExtR(tls, tif, __ccgo_ts+29042, __ccgo_ts+28871, libc.VaList(bp+8, tv_size)) } } case int32(TIFF_FLOAT): *(*float32)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*float32)(unsafe.Pointer(val)) ret_val = int32(1) case int32(TIFF_DOUBLE): *(*float64)(unsafe.Pointer(libc.VaUintptr(&ap))) = *(*float64)(unsafe.Pointer(val)) ret_val = int32(1) default: ret_val = 0 break } } } } break goto _4 _4: ; i2++ } } return ret_val } // C documentation // // /* // * Return the value of a field in the // * internal directory structure. // */ func XTIFFGetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, va uintptr) (r int32) { var ap Tva_list var status int32 _, _ = ap, status ap = va status = XTIFFVGetField(tls, tif, tag, ap) _ = ap return status } // C documentation // // /* // * Like TIFFGetField, but taking a varargs // * parameter list. This routine is useful // * for building higher-level interfaces on // * top of the library. // */ func XTIFFVGetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { var fip uintptr var v1 int32 _, _ = fip, v1 fip = XTIFFFindField(tls, tif, tag, int32(TIFF_NOTYPE)) if fip != 0 && (tag > uint32(0xffff) || *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit)/int32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit)&libc.Int32FromInt32(0x1f))) != 0) { v1 = (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield})))(tls, tif, tag, ap) } else { v1 = 0 } return v1 } // C documentation // // /* // * Release storage associated with a directory. // */ func XTIFFFreeDirectory(tls *libc.TLS, tif uintptr) { var i int32 var td uintptr _, _ = i, td td = tif + 56 X_TIFFmemset(tls, td, 0, int32(16)) if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue = uintptr(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue = uintptr(0) } if *(*uintptr)(unsafe.Pointer(td + 100)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(td + 100))) *(*uintptr)(unsafe.Pointer(td + 100)) = uintptr(0) } if *(*uintptr)(unsafe.Pointer(td + 100 + 1*4)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(td + 100 + 1*4))) *(*uintptr)(unsafe.Pointer(td + 100 + 1*4)) = uintptr(0) } if *(*uintptr)(unsafe.Pointer(td + 100 + 2*4)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(td + 100 + 2*4))) *(*uintptr)(unsafe.Pointer(td + 100 + 2*4)) = uintptr(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo = uintptr(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subifd != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subifd) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subifd = uintptr(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_inknames != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_inknames) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_inknames = uintptr(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite = uintptr(0) } if *(*uintptr)(unsafe.Pointer(td + 224)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(td + 224))) *(*uintptr)(unsafe.Pointer(td + 224)) = uintptr(0) } if *(*uintptr)(unsafe.Pointer(td + 224 + 1*4)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(td + 224 + 1*4))) *(*uintptr)(unsafe.Pointer(td + 224 + 1*4)) = uintptr(0) } if *(*uintptr)(unsafe.Pointer(td + 224 + 2*4)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(td + 224 + 2*4))) *(*uintptr)(unsafe.Pointer(td + 224 + 2*4)) = uintptr(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p = uintptr(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p = uintptr(0) } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffsetbyteallocsize = uint32(0) *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_YCBCRSUBSAMPLING)/libc.Int32FromInt32(32))*4)) &= ^(libc.Uint32FromInt32(1) << (libc.Int32FromInt32(FIELD_YCBCRSUBSAMPLING) & libc.Int32FromInt32(0x1f))) *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_YCBCRPOSITIONING)/libc.Int32FromInt32(32))*4)) &= ^(libc.Uint32FromInt32(1) << (libc.Int32FromInt32(FIELD_YCBCRPOSITIONING) & libc.Int32FromInt32(0x1f))) /* Cleanup custom tag values */ i = 0 for { if !(i < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount) { break } if (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(i)*12))).Fvalue != 0 { X_TIFFfreeExt(tls, tif, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(i)*12))).Fvalue) } goto _1 _1: ; i++ } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount = 0 if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues = uintptr(0) } X_TIFFmemset(tls, td+144, 0, int32(32)) X_TIFFmemset(tls, td+176, 0, int32(32)) /* Reset some internal parameters for IFD data size checking. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_read = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_write = uint64(0) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets) (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_Noffsets = uint32(0) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_iswrittentofile = uint8(FALSE) } // C documentation // // /* // * Client Tag extension support (from Niles Ritter). // */ var __TIFFextender = uintptr(0) func init() { p := unsafe.Pointer(&__TIFFextender) *(*uintptr)(unsafe.Add(p, 0)) = libc.UintptrFromInt32(0) } func XTIFFSetTagExtender(tls *libc.TLS, extender TTIFFExtendProc) (r TTIFFExtendProc) { var prev TTIFFExtendProc _ = prev prev = __TIFFextender __TIFFextender = extender return prev } // C documentation // // /* // * Setup for a new directory. Should we automatically call // * TIFFWriteDirectory() if the current one is dirty? // * // * The newly created directory will not exist on the file till // * TIFFWriteDirectory(), TIFFFlush() or TIFFClose() is called. // */ func XTIFFCreateDirectory(tls *libc.TLS, tif uintptr) (r int32) { /* Free previously allocated memory and setup default values. */ XTIFFFreeDirectory(tls, tif) XTIFFDefaultDirectory(tls, tif) (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_iswrittentofile = uint8(FALSE) return 0 } func XTIFFCreateCustomDirectory(tls *libc.TLS, tif uintptr, infoarray uintptr) (r int32) { /* Free previously allocated memory and setup default values. */ XTIFFFreeDirectory(tls, tif) XTIFFDefaultDirectory(tls, tif) /* * Reset the field definitions to match the application provided list. * Hopefully TIFFDefaultDirectory() won't have done anything irreversible * based on it's assumption this is an image directory. */ X_TIFFSetupFields(tls, tif, infoarray) (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) /* invalidate directory index */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0xffffffff) /* invalidate IFD loop lists */ X_TIFFCleanupIFDOffsetAndNumberMaps(tls, tif) /* To be able to return from SubIFD or custom-IFD to main-IFD */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_setdirectory_force_absolute = int32(TRUE) return 0 } func XTIFFCreateEXIFDirectory(tls *libc.TLS, tif uintptr) (r int32) { var exifFieldArray uintptr _ = exifFieldArray exifFieldArray = X_TIFFGetExifFields(tls) return XTIFFCreateCustomDirectory(tls, tif, exifFieldArray) } // C documentation // // /* // * Creates the EXIF GPS custom directory // */ func XTIFFCreateGPSDirectory(tls *libc.TLS, tif uintptr) (r int32) { var gpsFieldArray uintptr _ = gpsFieldArray gpsFieldArray = X_TIFFGetGpsFields(tls) return XTIFFCreateCustomDirectory(tls, tif, gpsFieldArray) } // C documentation // // /* // * Setup a default directory structure. // */ func XTIFFDefaultDirectory(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var i Tuint32_t var td, tiffFieldArray uintptr _, _, _ = i, td, tiffFieldArray td = tif + 56 tiffFieldArray = X_TIFFGetFields(tls) X_TIFFSetupFields(tls, tif, tiffFieldArray) X_TIFFmemset(tls, td, 0, int32(288)) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder = uint16(FILLORDER_MSB2LSB) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample = uint16(1) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_threshholding = uint16(THRESHHOLD_BILEVEL) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_orientation = uint16(ORIENTATION_TOPLEFT) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel = uint16(1) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth = uint32(0) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength = uint32(0) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tiledepth = uint32(1) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_resolutionunit = uint16(RESUNIT_INCH) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat = uint16(SAMPLEFORMAT_UINT) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth = uint32(1) *(*Tuint16_t)(unsafe.Pointer(td + 216)) = uint16(2) *(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)) = uint16(2) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_ycbcrpositioning = uint16(YCBCRPOSITION_CENTERED) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFNoPostDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_foundfield = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield = __ccgo_fp(__TIFFVSetField) (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield = __ccgo_fp(__TIFFVGetField) (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir = libc.UintptrFromInt32(0) /* additional default values */ (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig = uint16(PLANARCONFIG_CONTIG) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression = uint16(COMPRESSION_NONE) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subfiletype = uint32(0) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_minsamplevalue = uint16(0) /* td_bitspersample=1 is always set in TIFFDefaultDirectory(). * Therefore, td_maxsamplevalue has to be re-calculated in * TIFFGetFieldDefaulted(). */ (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_maxsamplevalue = uint16(1) /* Default for td_bitspersample=1 */ (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples = uint16(0) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo = libc.UintptrFromInt32(0) /* * Give client code a chance to install their own * tag extensions & methods, prior to compression overloads, * but do some prior cleanup first. * (http://trac.osgeo.org/gdal/ticket/5054) */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfieldscompat > uint32(0) { i = uint32(0) for { if !(i < (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfieldscompat) { break } if (*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(i)*16))).Fallocated_size != 0 { X_TIFFfreeExt(tls, tif, (*(*TTIFFFieldArray)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat + uintptr(i)*16))).Ffields) } goto _1 _1: ; i++ } X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat) (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfieldscompat = uint32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_fieldscompat = libc.UintptrFromInt32(0) } if __TIFFextender != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{__TIFFextender})))(tls, tif) } XTIFFSetField(tls, tif, uint32(TIFFTAG_COMPRESSION), libc.VaList(bp+8, int32(COMPRESSION_NONE))) /* * NB: The directory is marked dirty as a result of setting * up the default compression scheme. However, this really * isn't correct -- we want TIFF_DIRTYDIRECT to be set only * if the user does something. We could just do the setup * by hand, but it seems better to use the normal mechanism * (i.e. TIFFSetField). */ *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00008) /* * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=19 * we clear the ISTILED flag when setting up a new directory. * Should we also be clearing stuff like INSUBIFD? */ *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00400) return int32(1) } func _TIFFAdvanceDirectory(tls *libc.TLS, tif uintptr, nextdiroff uintptr, off uintptr, nextdirnum uintptr) (r int32) { bp := tls.Alloc(80) defer tls.Free(80) var dircount16, dircount161 Tuint16_t var poff Tuint64_t var poffa, poffa1, poffb, poffb1, poffc, poffc1, poffd, poffd1 Ttmsize_t var _ /* dircount at bp+0 */ Tuint16_t var _ /* dircount at bp+16 */ Tuint16_t var _ /* dircount64 at bp+24 */ Tuint64_t var _ /* dircount64 at bp+8 */ Tuint64_t var _ /* nextdir32 at bp+20 */ Tuint32_t var _ /* nextdir32 at bp+4 */ Tuint32_t _, _, _, _, _, _, _, _, _, _, _ = dircount16, dircount161, poff, poffa, poffa1, poffb, poffb1, poffc, poffc1, poffd, poffd1 /* Add this directory to the directory list, if not already in. */ if !(X_TIFFCheckDirNumberAndOffset(tls, tif, *(*Ttdir_t)(unsafe.Pointer(nextdirnum)), *(*Tuint64_t)(unsafe.Pointer(nextdiroff))) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29057, libc.VaList(bp+40, *(*Ttdir_t)(unsafe.Pointer(nextdirnum)), *(*Tuint64_t)(unsafe.Pointer(nextdiroff)), *(*Tuint64_t)(unsafe.Pointer(nextdiroff)))) *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) = uint64(0) *(*Ttdir_t)(unsafe.Pointer(nextdirnum)) = uint32(0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) { poff = *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { poffa = libc.Int32FromUint64(poff) poffb = libc.Int32FromUint32(libc.Uint32FromInt32(poffa) + uint32(2)) if libc.Uint64FromInt32(poffa) != poff || poffb < poffa || poffb < libc.Int32FromInt64(2) || poffb > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29127, libc.VaList(bp+40, __ccgo_ts+29169, int32(1869), (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) = uint64(0) return 0 } X_TIFFmemcpy(tls, bp, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(poffa), int32(2)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp) } poffc = poffb + libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp)))*int32(12) poffd = libc.Int32FromUint32(libc.Uint32FromInt32(poffc) + uint32(4)) if poffc < poffb || poffc < libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp)))*int32(12) || poffd < poffc || poffd < libc.Int32FromInt64(4) || poffd > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29207, 0) return 0 } if off != libc.UintptrFromInt32(0) { *(*Tuint64_t)(unsafe.Pointer(off)) = libc.Uint64FromInt32(poffc) } X_TIFFmemcpy(tls, bp+4, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(poffc), int32(4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+4) } *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 4))) } else { if poff > libc.Uint64FromInt32(libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1)))-libc.Uint64FromInt64(8) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29127, libc.VaList(bp+40, __ccgo_ts+29169, int32(1900), (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } poffa1 = libc.Int32FromUint64(poff) poffb1 = libc.Int32FromUint32(libc.Uint32FromInt32(poffa1) + uint32(8)) if poffb1 > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29127, libc.VaList(bp+40, __ccgo_ts+29169, int32(1909), (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } X_TIFFmemcpy(tls, bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(poffa1), int32(8)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+8) } if *(*Tuint64_t)(unsafe.Pointer(bp + 8)) > uint64(0xFFFF) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29237, 0) return 0 } dircount16 = uint16(*(*Tuint64_t)(unsafe.Pointer(bp + 8))) if poffb1 > libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))-libc.Int32FromUint16(dircount16)*libc.Int32FromInt32(20)-libc.Int32FromInt64(8) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29207, 0) return 0 } poffc1 = poffb1 + libc.Int32FromUint16(dircount16)*int32(20) poffd1 = libc.Int32FromUint32(libc.Uint32FromInt32(poffc1) + uint32(8)) if poffd1 > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29207, 0) return 0 } if off != libc.UintptrFromInt32(0) { *(*Tuint64_t)(unsafe.Pointer(off)) = libc.Uint64FromInt32(poffc1) } X_TIFFmemcpy(tls, nextdiroff, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(poffc1), int32(8)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, nextdiroff) } } } else { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { if !(X_TIFFSeekOK(tls, tif, *(*Tuint64_t)(unsafe.Pointer(nextdiroff))) != 0) || !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+16, libc.Int32FromUint32(libc.Uint32FromInt64(2)))) == libc.Uint32FromInt64(2)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29127, libc.VaList(bp+40, __ccgo_ts+29169, int32(1953), (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp+16) } if off != libc.UintptrFromInt32(0) { *(*Tuint64_t)(unsafe.Pointer(off)) = (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 16)))*libc.Int32FromInt32(12)), int32(1)) } else { (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 16)))*libc.Int32FromInt32(12)), int32(1)) } if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+20, libc.Int32FromUint32(libc.Uint32FromInt64(4)))) == libc.Uint32FromInt64(4)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29276, libc.VaList(bp+40, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+20) } *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 20))) } else { if !(X_TIFFSeekOK(tls, tif, *(*Tuint64_t)(unsafe.Pointer(nextdiroff))) != 0) || !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+24, libc.Int32FromUint32(libc.Uint32FromInt64(8)))) == libc.Uint32FromInt64(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29127, libc.VaList(bp+40, __ccgo_ts+29169, int32(1981), (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+24) } if *(*Tuint64_t)(unsafe.Pointer(bp + 24)) > uint64(0xFFFF) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29127, libc.VaList(bp+40, __ccgo_ts+29169, int32(1990), (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } dircount161 = uint16(*(*Tuint64_t)(unsafe.Pointer(bp + 24))) if off != libc.UintptrFromInt32(0) { *(*Tuint64_t)(unsafe.Pointer(off)) = (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromUint16(dircount161)*libc.Int32FromInt32(20)), int32(1)) } else { (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromUint16(dircount161)*libc.Int32FromInt32(20)), int32(1)) } if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, nextdiroff, libc.Int32FromUint32(libc.Uint32FromInt64(8)))) == libc.Uint32FromInt64(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29276, libc.VaList(bp+40, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, nextdiroff) } } } if *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) != uint64(0) { *(*Ttdir_t)(unsafe.Pointer(nextdirnum))++ /* Check next directory for IFD looping and if so, set it as last * directory. */ if !(X_TIFFCheckDirNumberAndOffset(tls, tif, *(*Ttdir_t)(unsafe.Pointer(nextdirnum)), *(*Tuint64_t)(unsafe.Pointer(nextdiroff))) != 0) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module4)), __ccgo_ts+29310, libc.VaList(bp+40, *(*Ttdir_t)(unsafe.Pointer(nextdirnum)), *(*Tuint64_t)(unsafe.Pointer(nextdiroff)), *(*Tuint64_t)(unsafe.Pointer(nextdiroff)), libc.Int32FromUint32(*(*Ttdir_t)(unsafe.Pointer(nextdirnum)))-int32(1))) *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) = uint64(0) *(*Ttdir_t)(unsafe.Pointer(nextdirnum))-- } } return int32(1) } var _module4 = [21]uint8{'T', 'I', 'F', 'F', 'A', 'd', 'v', 'a', 'n', 'c', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y'} // C documentation // // /* // * Count the number of directories in a file. // */ func XTIFFNumberOfDirectories(tls *libc.TLS, tif uintptr) (r Ttdir_t) { bp := tls.Alloc(16) defer tls.Free(16) var n Ttdir_t var _ /* nextdirnum at bp+8 */ Ttdir_t var _ /* nextdiroff at bp+0 */ Tuint64_t _ = n if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint64_t)(unsafe.Pointer(bp)) = uint64((*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff) } else { *(*Tuint64_t)(unsafe.Pointer(bp)) = (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff } *(*Ttdir_t)(unsafe.Pointer(bp + 8)) = uint32(0) n = uint32(0) for *(*Tuint64_t)(unsafe.Pointer(bp)) != uint64(0) && _TIFFAdvanceDirectory(tls, tif, bp, libc.UintptrFromInt32(0), bp+8) != 0 { n++ } /* Update number of main-IFDs in file. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount = n return n } // C documentation // // /* // * Set the n-th directory as the current directory. // * NB: Directories are numbered starting at 0. // */ func XTIFFSetDirectory(tls *libc.TLS, tif uintptr, dirn Ttdir_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var curdir, n Ttdir_t var relative, retval int32 var _ /* nextdirnum at bp+8 */ Ttdir_t var _ /* nextdiroff at bp+0 */ Tuint64_t _, _, _, _ = curdir, n, relative, retval *(*Ttdir_t)(unsafe.Pointer(bp + 8)) = uint32(0) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_setdirectory_force_absolute != 0 { /* tif_setdirectory_force_absolute=1 will force parsing the main IFD * chain from the beginning, thus IFD directory list needs to be cleared * from possible SubIFD offsets. */ X_TIFFCleanupIFDOffsetAndNumberMaps(tls, tif) /* invalidate IFD loop lists */ } /* Even faster path, if offset is available within IFD loop hash list. */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_setdirectory_force_absolute != 0) && X_TIFFGetOffsetFromDirNumber(tls, tif, dirn, bp) != 0 { /* Set parameters for following TIFFReadDirectory() below. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff = *(*Tuint64_t)(unsafe.Pointer(bp)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = dirn /* Reset to relative stepping */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_setdirectory_force_absolute = FALSE } else { /* Fast path when we just advance relative to the current directory: * start at the current dir offset and continue to seek from there. * Check special cases when relative is not allowed: * - jump back from SubIFD or custom directory * - right after TIFFWriteDirectory() jump back to that directory * using TIFFSetDirectory() */ relative = libc.BoolInt32(dirn >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir && (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff != uint64(0) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_setdirectory_force_absolute != 0)) if relative != 0 { *(*Tuint64_t)(unsafe.Pointer(bp)) = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff dirn -= (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir *(*Ttdir_t)(unsafe.Pointer(bp + 8)) = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir } else { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint64_t)(unsafe.Pointer(bp)) = uint64((*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff) } else { *(*Tuint64_t)(unsafe.Pointer(bp)) = (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff } } /* Reset to relative stepping */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_setdirectory_force_absolute = FALSE n = dirn for { if !(n > uint32(0) && *(*Tuint64_t)(unsafe.Pointer(bp)) != uint64(0)) { break } if !(_TIFFAdvanceDirectory(tls, tif, bp, libc.UintptrFromInt32(0), bp+8) != 0) { return 0 } goto _1 _1: ; n-- } /* If the n-th directory could not be reached (does not exist), * return here without touching anything further. */ if *(*Tuint64_t)(unsafe.Pointer(bp)) == uint64(0) || n > uint32(0) { return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff = *(*Tuint64_t)(unsafe.Pointer(bp)) /* Set curdir to the actual directory index. */ if relative != 0 { *(*Ttdir_t)(unsafe.Pointer(tif + 656)) += dirn - n } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = dirn - n } } /* The -1 decrement is because TIFFReadDirectory will increment * tif_curdir after successfully reading the directory. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir == uint32(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0xffffffff) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir-- } curdir = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir retval = XTIFFReadDirectory(tls, tif) if !(retval != 0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir == curdir { /* If tif_curdir has not be incremented, TIFFFetchDirectory() in * TIFFReadDirectory() has failed and tif_curdir shall be set * specifically. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0xffffffff) } return retval } // C documentation // // /* // * Set the current directory to be the directory // * located at the specified file offset. This interface // * is used mainly to access directories linked with // * the SubIFD tag (e.g. thumbnail images). // */ func XTIFFSetSubDirectory(tls *libc.TLS, tif uintptr, diroff Tuint64_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var probablySubIFD Tint8_t var retval int32 var _ /* curdir at bp+0 */ Tuint32_t _, _ = probablySubIFD, retval *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(0) probablySubIFD = 0 if diroff == uint64(0) { /* Special case to set tif_diroff=0, which is done in * TIFFReadDirectory() below to indicate that the currently read IFD is * treated as a new, fresh IFD. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0xffffffff) (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_iswrittentofile = uint8(FALSE) } else { if !(X_TIFFGetDirNumberFromOffset(tls, tif, diroff, bp) != 0) { /* Non-existing offsets might point to a SubIFD or invalid IFD.*/ probablySubIFD = int8(1) } /* -1 because TIFFReadDirectory() will increment tif_curdir. */ if *(*Tuint32_t)(unsafe.Pointer(bp)) >= uint32(1) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = *(*Tuint32_t)(unsafe.Pointer(bp)) - uint32(1) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0xffffffff) } } *(*Tuint32_t)(unsafe.Pointer(bp)) = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff = diroff retval = XTIFFReadDirectory(tls, tif) /* tif_curdir is incremented in TIFFReadDirectory(), but if it has not been * incremented, TIFFFetchDirectory() has failed there and tif_curdir shall * be set specifically. */ if !(retval != 0) && diroff != uint64(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir == *(*Tuint32_t)(unsafe.Pointer(bp)) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0xffffffff) } if probablySubIFD != 0 { if retval != 0 { /* Reset IFD list to start new one for SubIFD chain and also start * SubIFD chain with tif_curdir=0 for IFD loop checking. */ /* invalidate IFD loop lists */ X_TIFFCleanupIFDOffsetAndNumberMaps(tls, tif) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0) /* first directory of new chain */ /* add this offset to new IFD list */ X_TIFFCheckDirNumberAndOffset(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir, diroff) } /* To be able to return from SubIFD or custom-IFD to main-IFD */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_setdirectory_force_absolute = int32(TRUE) } return retval } // C documentation // // /* // * Return file offset of the current directory. // */ func XTIFFCurrentDirOffset(tls *libc.TLS, tif uintptr) (r Tuint64_t) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff } // C documentation // // /* // * Return an indication of whether or not we are // * at the last directory in the file. // */ func XTIFFLastDirectory(tls *libc.TLS, tif uintptr) (r int32) { return libc.BoolInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff == uint64(0)) } // C documentation // // /* // * Unlink the specified directory from the directory chain. // * Note: First directory starts with number dirn=1. // * This is different to TIFFSetDirectory() where the first directory starts with // * zero. // */ func XTIFFUnlinkDirectory(tls *libc.TLS, tif uintptr, dirn Ttdir_t) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var n Ttdir_t var _ /* nextdir at bp+0 */ Tuint64_t var _ /* nextdir32 at bp+24 */ Tuint32_t var _ /* nextdir64 at bp+32 */ Tuint64_t var _ /* nextdirnum at bp+8 */ Ttdir_t var _ /* off at bp+16 */ Tuint64_t _ = n if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY3 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module5)), __ccgo_ts+29418, 0) return 0 } if dirn == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module5)), __ccgo_ts+29461, 0) return 0 } /* * Go to the directory before the one we want * to unlink and nab the offset of the link * field we'll need to patch. */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint64_t)(unsafe.Pointer(bp)) = uint64((*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff) *(*Tuint64_t)(unsafe.Pointer(bp + 16)) = uint64(4) } else { *(*Tuint64_t)(unsafe.Pointer(bp)) = (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff *(*Tuint64_t)(unsafe.Pointer(bp + 16)) = uint64(8) } *(*Ttdir_t)(unsafe.Pointer(bp + 8)) = uint32(0) /* First directory is dirn=0 */ n = dirn - uint32(1) for { if !(n > uint32(0)) { break } if *(*Tuint64_t)(unsafe.Pointer(bp)) == uint64(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module5)), __ccgo_ts+29534, libc.VaList(bp+48, dirn)) return 0 } if !(_TIFFAdvanceDirectory(tls, tif, bp, bp+16, bp+8) != 0) { return 0 } goto _1 _1: ; n-- } /* * Advance to the directory to be unlinked and fetch * the offset of the directory that follows. */ if !(_TIFFAdvanceDirectory(tls, tif, bp, libc.UintptrFromInt32(0), bp+8) != 0) { return 0 } /* * Go back and patch the link field of the preceding * directory to point to the offset of the directory * that follows. */ (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, *(*Tuint64_t)(unsafe.Pointer(bp + 16)), 0) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp + 24)) = uint32(*(*Tuint64_t)(unsafe.Pointer(bp))) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+24) } if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+24, libc.Int32FromUint32(libc.Uint32FromInt64(4)))) == libc.Uint32FromInt64(4)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module5)), __ccgo_ts+29562, 0) return 0 } } else { /* Need local swap because nextdir has to be used unswapped below. */ *(*Tuint64_t)(unsafe.Pointer(bp + 32)) = *(*Tuint64_t)(unsafe.Pointer(bp)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+32) } if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+32, libc.Int32FromUint32(libc.Uint32FromInt64(8)))) == libc.Uint32FromInt64(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module5)), __ccgo_ts+29562, 0) return 0 } } /* For dirn=1 (first directory) also update the libtiff internal * base offset variables. */ if dirn == uint32(1) { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { (*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff = uint32(*(*Tuint64_t)(unsafe.Pointer(bp))) } else { (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff = *(*Tuint64_t)(unsafe.Pointer(bp)) } } /* * Leave directory state setup safely. We don't have * facilities for doing inserting and removing directories, * so it's safest to just invalidate everything. This * means that the caller can only append to the directory * chain. */ (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup})))(tls, tif) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00200) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != 0 { X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^(libc.Uint32FromUint32(0x00040) | libc.Uint32FromUint32(0x00010) | libc.Uint32FromUint32(0x01000) | libc.Uint32FromUint32(0x100000)) XTIFFFreeDirectory(tls, tif) XTIFFDefaultDirectory(tls, tif) (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = uint64(0) /* force link on next write */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff = uint64(0) /* next write must be at end */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff = uint64(0) /* will be updated on next link */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0xffffffff) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount > uint32(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount-- } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount = uint32(0xffffffff) } X_TIFFCleanupIFDOffsetAndNumberMaps(tls, tif) /* invalidate IFD loop lists */ return int32(1) } var _module5 = [20]uint8{'T', 'I', 'F', 'F', 'U', 'n', 'l', 'i', 'n', 'k', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y'} const FILETYPE_PAGE1 = 2 const FILETYPE_REDUCEDIMAGE1 = 1 const FLT_MAX3 = 3.4028234663852886e+38 const INT64_MAX1 = 9223372036854775807 const MAX_SIZE_TAG_DATA = 2147483647 const O_RDWR1 = 2 const THRESHOLD_MULTIPLIER = 10 const TIFF_BUFFERSETUP2 = 0x00010 const TIFF_CHOPPEDUPARRAYS1 = 67108864 const TIFF_CODERSETUP2 = 0x00020 const TIFF_DEFERSTRILELOAD1 = 16777216 const TIFF_DIRTYSTRIP1 = 2097152 const TIFF_INSUBIFD2 = 0x02000 const TIFF_LAZYSTRILELOAD1 = 33554432 const TIFF_MYBUFFER4 = 0x00200 const TIFF_POSTENCODE2 = 0x01000 const TIFF_STRIPCHOP1 = 32768 const TIFF_UPSAMPLED1 = 16384 const UINT64_MAX2 = 18446744073709551615 type TIFFReadDirEntryErr = int32 const TIFFReadDirEntryErrOk = 0 const TIFFReadDirEntryErrCount = 1 const TIFFReadDirEntryErrType = 2 const TIFFReadDirEntryErrIo = 3 const TIFFReadDirEntryErrRange = 4 const TIFFReadDirEntryErrPsdif = 5 const TIFFReadDirEntryErrSizesan = 6 const TIFFReadDirEntryErrAlloc = 7 type TUInt64Aligned_t = struct { F__ccgo_align [0]uint32 Fl [0]Tuint64_t Fi [0][2]Tuint32_t Fs [0][4]Tuint16_t Fc [0][8]Tuint8_t Fd float64 } type T_UInt64Aligned_t = TUInt64Aligned_t // C documentation // // /* // Unaligned safe copy of a uint64_t value from an octet array. // */ func _TIFFReadUInt64(tls *libc.TLS, value uintptr) (r Tuint64_t) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* result at bp+0 */ TUInt64Aligned_t *(*Tuint8_t)(unsafe.Pointer(bp)) = *(*Tuint8_t)(unsafe.Pointer(value)) *(*Tuint8_t)(unsafe.Pointer(bp + 1)) = *(*Tuint8_t)(unsafe.Pointer(value + 1)) *(*Tuint8_t)(unsafe.Pointer(bp + 2)) = *(*Tuint8_t)(unsafe.Pointer(value + 2)) *(*Tuint8_t)(unsafe.Pointer(bp + 3)) = *(*Tuint8_t)(unsafe.Pointer(value + 3)) *(*Tuint8_t)(unsafe.Pointer(bp + 4)) = *(*Tuint8_t)(unsafe.Pointer(value + 4)) *(*Tuint8_t)(unsafe.Pointer(bp + 5)) = *(*Tuint8_t)(unsafe.Pointer(value + 5)) *(*Tuint8_t)(unsafe.Pointer(bp + 6)) = *(*Tuint8_t)(unsafe.Pointer(value + 6)) *(*Tuint8_t)(unsafe.Pointer(bp + 7)) = *(*Tuint8_t)(unsafe.Pointer(value + 7)) return *(*Tuint64_t)(unsafe.Pointer(bp)) } func _TIFFReadDirEntryByte(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(32) defer tls.Free(32) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tint8_t var _ /* m at bp+12 */ Tint32_t var _ /* m at bp+16 */ Tuint64_t var _ /* m at bp+2 */ Tuint16_t var _ /* m at bp+24 */ Tint64_t var _ /* m at bp+4 */ Tint16_t var _ /* m at bp+8 */ Tuint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): fallthrough case int32(TIFF_UNDEFINED): /* Support to read TIFF_UNDEFINED with field_readcount==1 */ _TIFFReadDirEntryCheckedByte(tls, tif, direntry, value) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): _TIFFReadDirEntryCheckedSbyte(tls, tif, direntry, bp) err = _TIFFReadDirEntryCheckRangeByteSbyte(tls, *(*Tint8_t)(unsafe.Pointer(bp))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint8_t)(unsafe.Pointer(value)) = libc.Uint8FromInt8(*(*Tint8_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SHORT): _TIFFReadDirEntryCheckedShort(tls, tif, direntry, bp+2) err = _TIFFReadDirEntryCheckRangeByteShort(tls, *(*Tuint16_t)(unsafe.Pointer(bp + 2))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint8_t)(unsafe.Pointer(value)) = uint8(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): _TIFFReadDirEntryCheckedSshort(tls, tif, direntry, bp+4) err = _TIFFReadDirEntryCheckRangeByteSshort(tls, *(*Tint16_t)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint8_t)(unsafe.Pointer(value)) = libc.Uint8FromInt16(*(*Tint16_t)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, bp+8) err = _TIFFReadDirEntryCheckRangeByteLong(tls, *(*Tuint32_t)(unsafe.Pointer(bp + 8))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint8_t)(unsafe.Pointer(value)) = uint8(*(*Tuint32_t)(unsafe.Pointer(bp + 8))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): _TIFFReadDirEntryCheckedSlong(tls, tif, direntry, bp+12) err = _TIFFReadDirEntryCheckRangeByteSlong(tls, *(*Tint32_t)(unsafe.Pointer(bp + 12))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint8_t)(unsafe.Pointer(value)) = libc.Uint8FromInt32(*(*Tint32_t)(unsafe.Pointer(bp + 12))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, bp+16) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeByteLong8(tls, *(*Tuint64_t)(unsafe.Pointer(bp + 16))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint8_t)(unsafe.Pointer(value)) = uint8(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): err = _TIFFReadDirEntryCheckedSlong8(tls, tif, direntry, bp+24) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeByteSlong8(tls, *(*Tint64_t)(unsafe.Pointer(bp + 24))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint8_t)(unsafe.Pointer(value)) = libc.Uint8FromInt64(*(*Tint64_t)(unsafe.Pointer(bp + 24))) return int32(TIFFReadDirEntryErrOk) default: return int32(TIFFReadDirEntryErrType) } return r } func _TIFFReadDirEntrySbyte(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(32) defer tls.Free(32) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tuint8_t var _ /* m at bp+12 */ Tint32_t var _ /* m at bp+16 */ Tuint64_t var _ /* m at bp+2 */ Tuint16_t var _ /* m at bp+24 */ Tint64_t var _ /* m at bp+4 */ Tint16_t var _ /* m at bp+8 */ Tuint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): fallthrough case int32(TIFF_UNDEFINED): /* Support to read TIFF_UNDEFINED with field_readcount==1 */ _TIFFReadDirEntryCheckedByte(tls, tif, direntry, bp) err = _TIFFReadDirEntryCheckRangeSbyteByte(tls, *(*Tuint8_t)(unsafe.Pointer(bp))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint8_t)(unsafe.Pointer(value)) = libc.Int8FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): _TIFFReadDirEntryCheckedSbyte(tls, tif, direntry, value) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SHORT): _TIFFReadDirEntryCheckedShort(tls, tif, direntry, bp+2) err = _TIFFReadDirEntryCheckRangeSbyteShort(tls, *(*Tuint16_t)(unsafe.Pointer(bp + 2))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint8_t)(unsafe.Pointer(value)) = libc.Int8FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): _TIFFReadDirEntryCheckedSshort(tls, tif, direntry, bp+4) err = _TIFFReadDirEntryCheckRangeSbyteSshort(tls, *(*Tint16_t)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint8_t)(unsafe.Pointer(value)) = int8(*(*Tint16_t)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, bp+8) err = _TIFFReadDirEntryCheckRangeSbyteLong(tls, *(*Tuint32_t)(unsafe.Pointer(bp + 8))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint8_t)(unsafe.Pointer(value)) = libc.Int8FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp + 8))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): _TIFFReadDirEntryCheckedSlong(tls, tif, direntry, bp+12) err = _TIFFReadDirEntryCheckRangeSbyteSlong(tls, *(*Tint32_t)(unsafe.Pointer(bp + 12))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint8_t)(unsafe.Pointer(value)) = int8(*(*Tint32_t)(unsafe.Pointer(bp + 12))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, bp+16) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeSbyteLong8(tls, *(*Tuint64_t)(unsafe.Pointer(bp + 16))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint8_t)(unsafe.Pointer(value)) = libc.Int8FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): err = _TIFFReadDirEntryCheckedSlong8(tls, tif, direntry, bp+24) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeSbyteSlong8(tls, *(*Tint64_t)(unsafe.Pointer(bp + 24))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint8_t)(unsafe.Pointer(value)) = int8(*(*Tint64_t)(unsafe.Pointer(bp + 24))) return int32(TIFFReadDirEntryErrOk) default: return int32(TIFFReadDirEntryErrType) } return r } /*-- TIFFReadDirEntrySbyte() --*/ func _TIFFReadDirEntryShort(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(32) defer tls.Free(32) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tuint8_t var _ /* m at bp+1 */ Tint8_t var _ /* m at bp+16 */ Tuint64_t var _ /* m at bp+2 */ Tint16_t var _ /* m at bp+24 */ Tint64_t var _ /* m at bp+4 */ Tuint32_t var _ /* m at bp+8 */ Tint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): _TIFFReadDirEntryCheckedByte(tls, tif, direntry, bp) *(*Tuint16_t)(unsafe.Pointer(value)) = uint16(*(*Tuint8_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): _TIFFReadDirEntryCheckedSbyte(tls, tif, direntry, bp+1) err = _TIFFReadDirEntryCheckRangeShortSbyte(tls, *(*Tint8_t)(unsafe.Pointer(bp + 1))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint16_t)(unsafe.Pointer(value)) = libc.Uint16FromInt8(*(*Tint8_t)(unsafe.Pointer(bp + 1))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SHORT): _TIFFReadDirEntryCheckedShort(tls, tif, direntry, value) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): _TIFFReadDirEntryCheckedSshort(tls, tif, direntry, bp+2) err = _TIFFReadDirEntryCheckRangeShortSshort(tls, *(*Tint16_t)(unsafe.Pointer(bp + 2))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint16_t)(unsafe.Pointer(value)) = libc.Uint16FromInt16(*(*Tint16_t)(unsafe.Pointer(bp + 2))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, bp+4) err = _TIFFReadDirEntryCheckRangeShortLong(tls, *(*Tuint32_t)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint16_t)(unsafe.Pointer(value)) = uint16(*(*Tuint32_t)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): _TIFFReadDirEntryCheckedSlong(tls, tif, direntry, bp+8) err = _TIFFReadDirEntryCheckRangeShortSlong(tls, *(*Tint32_t)(unsafe.Pointer(bp + 8))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint16_t)(unsafe.Pointer(value)) = libc.Uint16FromInt32(*(*Tint32_t)(unsafe.Pointer(bp + 8))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, bp+16) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeShortLong8(tls, *(*Tuint64_t)(unsafe.Pointer(bp + 16))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint16_t)(unsafe.Pointer(value)) = uint16(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): err = _TIFFReadDirEntryCheckedSlong8(tls, tif, direntry, bp+24) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeShortSlong8(tls, *(*Tint64_t)(unsafe.Pointer(bp + 24))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint16_t)(unsafe.Pointer(value)) = libc.Uint16FromInt64(*(*Tint64_t)(unsafe.Pointer(bp + 24))) return int32(TIFFReadDirEntryErrOk) default: return int32(TIFFReadDirEntryErrType) } return r } /*-- TIFFReadDirEntryShort() --*/ func _TIFFReadDirEntrySshort(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(32) defer tls.Free(32) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tuint8_t var _ /* m at bp+1 */ Tint8_t var _ /* m at bp+16 */ Tuint64_t var _ /* m at bp+2 */ Tuint16_t var _ /* m at bp+24 */ Tint64_t var _ /* m at bp+4 */ Tuint32_t var _ /* m at bp+8 */ Tint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): _TIFFReadDirEntryCheckedByte(tls, tif, direntry, bp) *(*Tint16_t)(unsafe.Pointer(value)) = libc.Int16FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): _TIFFReadDirEntryCheckedSbyte(tls, tif, direntry, bp+1) *(*Tint16_t)(unsafe.Pointer(value)) = int16(*(*Tint8_t)(unsafe.Pointer(bp + 1))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SHORT): _TIFFReadDirEntryCheckedShort(tls, tif, direntry, bp+2) err = _TIFFReadDirEntryCheckRangeSshortShort(tls, *(*Tuint16_t)(unsafe.Pointer(bp + 2))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint16_t)(unsafe.Pointer(value)) = libc.Int16FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): _TIFFReadDirEntryCheckedSshort(tls, tif, direntry, value) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, bp+4) err = _TIFFReadDirEntryCheckRangeSshortLong(tls, *(*Tuint32_t)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint16_t)(unsafe.Pointer(value)) = libc.Int16FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): _TIFFReadDirEntryCheckedSlong(tls, tif, direntry, bp+8) err = _TIFFReadDirEntryCheckRangeSshortSlong(tls, *(*Tint32_t)(unsafe.Pointer(bp + 8))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint16_t)(unsafe.Pointer(value)) = int16(*(*Tint32_t)(unsafe.Pointer(bp + 8))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, bp+16) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeSshortLong8(tls, *(*Tuint64_t)(unsafe.Pointer(bp + 16))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint16_t)(unsafe.Pointer(value)) = libc.Int16FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): err = _TIFFReadDirEntryCheckedSlong8(tls, tif, direntry, bp+24) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeSshortSlong8(tls, *(*Tint64_t)(unsafe.Pointer(bp + 24))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint16_t)(unsafe.Pointer(value)) = int16(*(*Tint64_t)(unsafe.Pointer(bp + 24))) return int32(TIFFReadDirEntryErrOk) default: return int32(TIFFReadDirEntryErrType) } return r } /*-- TIFFReadDirEntrySshort() --*/ func _TIFFReadDirEntryLong(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(32) defer tls.Free(32) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tuint8_t var _ /* m at bp+1 */ Tint8_t var _ /* m at bp+16 */ Tuint64_t var _ /* m at bp+2 */ Tuint16_t var _ /* m at bp+24 */ Tint64_t var _ /* m at bp+4 */ Tint16_t var _ /* m at bp+8 */ Tint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): _TIFFReadDirEntryCheckedByte(tls, tif, direntry, bp) *(*Tuint32_t)(unsafe.Pointer(value)) = uint32(*(*Tuint8_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): _TIFFReadDirEntryCheckedSbyte(tls, tif, direntry, bp+1) err = _TIFFReadDirEntryCheckRangeLongSbyte(tls, *(*Tint8_t)(unsafe.Pointer(bp + 1))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint32_t)(unsafe.Pointer(value)) = libc.Uint32FromInt8(*(*Tint8_t)(unsafe.Pointer(bp + 1))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SHORT): _TIFFReadDirEntryCheckedShort(tls, tif, direntry, bp+2) *(*Tuint32_t)(unsafe.Pointer(value)) = uint32(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): _TIFFReadDirEntryCheckedSshort(tls, tif, direntry, bp+4) err = _TIFFReadDirEntryCheckRangeLongSshort(tls, *(*Tint16_t)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint32_t)(unsafe.Pointer(value)) = libc.Uint32FromInt16(*(*Tint16_t)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, value) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): _TIFFReadDirEntryCheckedSlong(tls, tif, direntry, bp+8) err = _TIFFReadDirEntryCheckRangeLongSlong(tls, *(*Tint32_t)(unsafe.Pointer(bp + 8))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint32_t)(unsafe.Pointer(value)) = libc.Uint32FromInt32(*(*Tint32_t)(unsafe.Pointer(bp + 8))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, bp+16) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeLongLong8(tls, *(*Tuint64_t)(unsafe.Pointer(bp + 16))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint32_t)(unsafe.Pointer(value)) = uint32(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): err = _TIFFReadDirEntryCheckedSlong8(tls, tif, direntry, bp+24) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeLongSlong8(tls, *(*Tint64_t)(unsafe.Pointer(bp + 24))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint32_t)(unsafe.Pointer(value)) = libc.Uint32FromInt64(*(*Tint64_t)(unsafe.Pointer(bp + 24))) return int32(TIFFReadDirEntryErrOk) default: return int32(TIFFReadDirEntryErrType) } return r } /*-- TIFFReadDirEntryLong() --*/ func _TIFFReadDirEntrySlong(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(32) defer tls.Free(32) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tuint8_t var _ /* m at bp+1 */ Tint8_t var _ /* m at bp+16 */ Tuint64_t var _ /* m at bp+2 */ Tuint16_t var _ /* m at bp+24 */ Tint64_t var _ /* m at bp+4 */ Tint16_t var _ /* m at bp+8 */ Tuint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): _TIFFReadDirEntryCheckedByte(tls, tif, direntry, bp) *(*Tint32_t)(unsafe.Pointer(value)) = libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): _TIFFReadDirEntryCheckedSbyte(tls, tif, direntry, bp+1) *(*Tint32_t)(unsafe.Pointer(value)) = int32(*(*Tint8_t)(unsafe.Pointer(bp + 1))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SHORT): _TIFFReadDirEntryCheckedShort(tls, tif, direntry, bp+2) *(*Tint32_t)(unsafe.Pointer(value)) = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): _TIFFReadDirEntryCheckedSshort(tls, tif, direntry, bp+4) *(*Tint32_t)(unsafe.Pointer(value)) = int32(*(*Tint16_t)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, bp+8) err = _TIFFReadDirEntryCheckRangeSlongLong(tls, *(*Tuint32_t)(unsafe.Pointer(bp + 8))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint32_t)(unsafe.Pointer(value)) = libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp + 8))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): _TIFFReadDirEntryCheckedSlong(tls, tif, direntry, value) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, bp+16) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeSlongLong8(tls, *(*Tuint64_t)(unsafe.Pointer(bp + 16))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint32_t)(unsafe.Pointer(value)) = libc.Int32FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): err = _TIFFReadDirEntryCheckedSlong8(tls, tif, direntry, bp+24) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeSlongSlong8(tls, *(*Tint64_t)(unsafe.Pointer(bp + 24))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint32_t)(unsafe.Pointer(value)) = int32(*(*Tint64_t)(unsafe.Pointer(bp + 24))) return int32(TIFFReadDirEntryErrOk) default: return int32(TIFFReadDirEntryErrType) } return r } /*-- TIFFReadDirEntrySlong() --*/ func _TIFFReadDirEntryLong8(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(32) defer tls.Free(32) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tuint8_t var _ /* m at bp+1 */ Tint8_t var _ /* m at bp+12 */ Tint32_t var _ /* m at bp+16 */ Tint64_t var _ /* m at bp+2 */ Tuint16_t var _ /* m at bp+4 */ Tint16_t var _ /* m at bp+8 */ Tuint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): _TIFFReadDirEntryCheckedByte(tls, tif, direntry, bp) *(*Tuint64_t)(unsafe.Pointer(value)) = uint64(*(*Tuint8_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): _TIFFReadDirEntryCheckedSbyte(tls, tif, direntry, bp+1) err = _TIFFReadDirEntryCheckRangeLong8Sbyte(tls, *(*Tint8_t)(unsafe.Pointer(bp + 1))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint64_t)(unsafe.Pointer(value)) = libc.Uint64FromInt8(*(*Tint8_t)(unsafe.Pointer(bp + 1))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SHORT): _TIFFReadDirEntryCheckedShort(tls, tif, direntry, bp+2) *(*Tuint64_t)(unsafe.Pointer(value)) = uint64(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): _TIFFReadDirEntryCheckedSshort(tls, tif, direntry, bp+4) err = _TIFFReadDirEntryCheckRangeLong8Sshort(tls, *(*Tint16_t)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint64_t)(unsafe.Pointer(value)) = libc.Uint64FromInt16(*(*Tint16_t)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, bp+8) *(*Tuint64_t)(unsafe.Pointer(value)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 8))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): _TIFFReadDirEntryCheckedSlong(tls, tif, direntry, bp+12) err = _TIFFReadDirEntryCheckRangeLong8Slong(tls, *(*Tint32_t)(unsafe.Pointer(bp + 12))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint64_t)(unsafe.Pointer(value)) = libc.Uint64FromInt32(*(*Tint32_t)(unsafe.Pointer(bp + 12))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, value) return err case int32(TIFF_SLONG8): err = _TIFFReadDirEntryCheckedSlong8(tls, tif, direntry, bp+16) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeLong8Slong8(tls, *(*Tint64_t)(unsafe.Pointer(bp + 16))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tuint64_t)(unsafe.Pointer(value)) = libc.Uint64FromInt64(*(*Tint64_t)(unsafe.Pointer(bp + 16))) return int32(TIFFReadDirEntryErrOk) default: return int32(TIFFReadDirEntryErrType) } return r } /*-- TIFFReadDirEntryLong8() --*/ func _TIFFReadDirEntrySlong8(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(32) defer tls.Free(32) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tuint8_t var _ /* m at bp+1 */ Tint8_t var _ /* m at bp+12 */ Tint32_t var _ /* m at bp+16 */ Tuint64_t var _ /* m at bp+2 */ Tuint16_t var _ /* m at bp+4 */ Tint16_t var _ /* m at bp+8 */ Tuint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): _TIFFReadDirEntryCheckedByte(tls, tif, direntry, bp) *(*Tint64_t)(unsafe.Pointer(value)) = libc.Int64FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): _TIFFReadDirEntryCheckedSbyte(tls, tif, direntry, bp+1) *(*Tint64_t)(unsafe.Pointer(value)) = int64(*(*Tint8_t)(unsafe.Pointer(bp + 1))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SHORT): _TIFFReadDirEntryCheckedShort(tls, tif, direntry, bp+2) *(*Tint64_t)(unsafe.Pointer(value)) = libc.Int64FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): _TIFFReadDirEntryCheckedSshort(tls, tif, direntry, bp+4) *(*Tint64_t)(unsafe.Pointer(value)) = int64(*(*Tint16_t)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, bp+8) *(*Tint64_t)(unsafe.Pointer(value)) = libc.Int64FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp + 8))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): _TIFFReadDirEntryCheckedSlong(tls, tif, direntry, bp+12) *(*Tint64_t)(unsafe.Pointer(value)) = int64(*(*Tint32_t)(unsafe.Pointer(bp + 12))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, bp+16) if err != int32(TIFFReadDirEntryErrOk) { return err } err = _TIFFReadDirEntryCheckRangeSlong8Long8(tls, *(*Tuint64_t)(unsafe.Pointer(bp + 16))) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*Tint64_t)(unsafe.Pointer(value)) = libc.Int64FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): err = _TIFFReadDirEntryCheckedSlong8(tls, tif, direntry, value) return err default: return int32(TIFFReadDirEntryErrType) } return r } /*-- TIFFReadDirEntrySlong8() --*/ func _TIFFReadDirEntryFloat(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(64) defer tls.Free(64) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tuint8_t var _ /* m at bp+1 */ Tint8_t var _ /* m at bp+12 */ Tint32_t var _ /* m at bp+16 */ Tuint64_t var _ /* m at bp+2 */ Tuint16_t var _ /* m at bp+24 */ Tint64_t var _ /* m at bp+32 */ float64 var _ /* m at bp+4 */ Tint16_t var _ /* m at bp+40 */ float64 var _ /* m at bp+48 */ float64 var _ /* m at bp+8 */ Tuint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): _TIFFReadDirEntryCheckedByte(tls, tif, direntry, bp) *(*float32)(unsafe.Pointer(value)) = float32(*(*Tuint8_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): _TIFFReadDirEntryCheckedSbyte(tls, tif, direntry, bp+1) *(*float32)(unsafe.Pointer(value)) = float32(*(*Tint8_t)(unsafe.Pointer(bp + 1))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SHORT): _TIFFReadDirEntryCheckedShort(tls, tif, direntry, bp+2) *(*float32)(unsafe.Pointer(value)) = float32(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): _TIFFReadDirEntryCheckedSshort(tls, tif, direntry, bp+4) *(*float32)(unsafe.Pointer(value)) = float32(*(*Tint16_t)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, bp+8) *(*float32)(unsafe.Pointer(value)) = float32(*(*Tuint32_t)(unsafe.Pointer(bp + 8))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): _TIFFReadDirEntryCheckedSlong(tls, tif, direntry, bp+12) *(*float32)(unsafe.Pointer(value)) = float32(*(*Tint32_t)(unsafe.Pointer(bp + 12))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, bp+16) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*float32)(unsafe.Pointer(value)) = float32(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): err = _TIFFReadDirEntryCheckedSlong8(tls, tif, direntry, bp+24) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*float32)(unsafe.Pointer(value)) = float32(*(*Tint64_t)(unsafe.Pointer(bp + 24))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_RATIONAL): err = _TIFFReadDirEntryCheckedRational(tls, tif, direntry, bp+32) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*float32)(unsafe.Pointer(value)) = float32(*(*float64)(unsafe.Pointer(bp + 32))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SRATIONAL): err = _TIFFReadDirEntryCheckedSrational(tls, tif, direntry, bp+40) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*float32)(unsafe.Pointer(value)) = float32(*(*float64)(unsafe.Pointer(bp + 40))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_FLOAT): _TIFFReadDirEntryCheckedFloat(tls, tif, direntry, value) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_DOUBLE): err = _TIFFReadDirEntryCheckedDouble(tls, tif, direntry, bp+48) if err != int32(TIFFReadDirEntryErrOk) { return err } if *(*float64)(unsafe.Pointer(bp + 48)) > libc.Float64FromFloat32(3.4028234663852886e+38) || *(*float64)(unsafe.Pointer(bp + 48)) < float64(-libc.Float32FromFloat32(3.4028234663852886e+38)) { return int32(TIFFReadDirEntryErrRange) } *(*float32)(unsafe.Pointer(value)) = float32(*(*float64)(unsafe.Pointer(bp + 48))) return int32(TIFFReadDirEntryErrOk) default: return int32(TIFFReadDirEntryErrType) } return r } func _TIFFReadDirEntryDouble(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(48) defer tls.Free(48) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tuint8_t var _ /* m at bp+1 */ Tint8_t var _ /* m at bp+12 */ Tint32_t var _ /* m at bp+16 */ Tuint64_t var _ /* m at bp+2 */ Tuint16_t var _ /* m at bp+24 */ Tint64_t var _ /* m at bp+32 */ float32 var _ /* m at bp+4 */ Tint16_t var _ /* m at bp+8 */ Tuint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): _TIFFReadDirEntryCheckedByte(tls, tif, direntry, bp) *(*float64)(unsafe.Pointer(value)) = float64(*(*Tuint8_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): _TIFFReadDirEntryCheckedSbyte(tls, tif, direntry, bp+1) *(*float64)(unsafe.Pointer(value)) = float64(*(*Tint8_t)(unsafe.Pointer(bp + 1))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SHORT): _TIFFReadDirEntryCheckedShort(tls, tif, direntry, bp+2) *(*float64)(unsafe.Pointer(value)) = float64(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): _TIFFReadDirEntryCheckedSshort(tls, tif, direntry, bp+4) *(*float64)(unsafe.Pointer(value)) = float64(*(*Tint16_t)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, bp+8) *(*float64)(unsafe.Pointer(value)) = float64(*(*Tuint32_t)(unsafe.Pointer(bp + 8))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): _TIFFReadDirEntryCheckedSlong(tls, tif, direntry, bp+12) *(*float64)(unsafe.Pointer(value)) = float64(*(*Tint32_t)(unsafe.Pointer(bp + 12))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, bp+16) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*float64)(unsafe.Pointer(value)) = float64(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): err = _TIFFReadDirEntryCheckedSlong8(tls, tif, direntry, bp+24) if err != int32(TIFFReadDirEntryErrOk) { return err } *(*float64)(unsafe.Pointer(value)) = float64(*(*Tint64_t)(unsafe.Pointer(bp + 24))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_RATIONAL): err = _TIFFReadDirEntryCheckedRational(tls, tif, direntry, value) return err case int32(TIFF_SRATIONAL): err = _TIFFReadDirEntryCheckedSrational(tls, tif, direntry, value) return err case int32(TIFF_FLOAT): _TIFFReadDirEntryCheckedFloat(tls, tif, direntry, bp+32) *(*float64)(unsafe.Pointer(value)) = float64(*(*float32)(unsafe.Pointer(bp + 32))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_DOUBLE): err = _TIFFReadDirEntryCheckedDouble(tls, tif, direntry, value) return err default: return int32(TIFFReadDirEntryErrType) } return r } func _TIFFReadDirEntryIfd8(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ Tuint32_t _ = err if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count != uint64(1) { return int32(TIFFReadDirEntryErrCount) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_LONG): fallthrough case int32(TIFF_IFD): _TIFFReadDirEntryCheckedLong(tls, tif, direntry, bp) *(*Tuint64_t)(unsafe.Pointer(value)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp))) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_LONG8): fallthrough case int32(TIFF_IFD8): err = _TIFFReadDirEntryCheckedLong8(tls, tif, direntry, value) return err default: return int32(TIFFReadDirEntryErrType) } return r } func _TIFFReadDirEntryDataAndRealloc(tls *libc.TLS, tif uintptr, offset Tuint64_t, size Ttmsize_t, pdest uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(32) defer tls.Free(32) var already_read, bytes_read, to_read Ttmsize_t var new_dest uintptr _, _, _, _ = already_read, bytes_read, new_dest, to_read already_read = 0 if !(X_TIFFSeekOK(tls, tif, offset) != 0) { return int32(TIFFReadDirEntryErrIo) } /* On 64 bit processes, read first a maximum of 1 MB, then 10 MB, etc */ /* so as to avoid allocating too much memory in case the file is too */ /* short. We could ask for the file size, but this might be */ /* expensive with some I/O layers (think of reading a gzipped file) */ /* Restrict to 64 bit processes, so as to avoid reallocs() */ /* on 32 bit processes where virtual memory is scarce. */ for already_read < size { to_read = size - already_read new_dest = X_TIFFreallocExt(tls, tif, *(*uintptr)(unsafe.Pointer(pdest)), already_read+to_read) if new_dest == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+22024, libc.VaList(bp+8, __ccgo_ts+29591, libc.Int32FromInt32(1), already_read+to_read)) return int32(TIFFReadDirEntryErrAlloc) } *(*uintptr)(unsafe.Pointer(pdest)) = new_dest bytes_read = (*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, *(*uintptr)(unsafe.Pointer(pdest))+uintptr(already_read), to_read) already_read += bytes_read if bytes_read != to_read { return int32(TIFFReadDirEntryErrIo) } } return int32(TIFFReadDirEntryErrOk) } /* Caution: if raising that value, make sure int32 / uint32 overflows can't * occur elsewhere */ func _TIFFReadDirEntryArrayWithLimit(tls *libc.TLS, tif uintptr, direntry uintptr, count uintptr, desttypesize Tuint32_t, value uintptr, maxcount Tuint64_t) (r TIFFReadDirEntryErr) { bp := tls.Alloc(64) defer tls.Free(64) var datasize Tuint32_t var err, err1 TIFFReadDirEntryErr var filesize, target_count64 Tuint64_t var original_datasize_clamped, typesize, v2 int32 var v1 uint64 var _ /* data at bp+0 */ uintptr var _ /* offset at bp+4 */ Tuint32_t var _ /* offset at bp+8 */ Tuint64_t _, _, _, _, _, _, _, _, _ = datasize, err, err1, filesize, original_datasize_clamped, target_count64, typesize, v1, v2 typesize = XTIFFDataWidth(tls, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type)) if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count > maxcount { v1 = maxcount } else { v1 = (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count } target_count64 = v1 if target_count64 == uint64(0) || typesize == 0 { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return int32(TIFFReadDirEntryErrOk) } _ = desttypesize /* We just want to know if the original tag size is more than 4 bytes * (classic TIFF) or 8 bytes (BigTIFF) */ if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count > uint64(10) { v2 = int32(10) } else { v2 = libc.Int32FromUint64((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count) } original_datasize_clamped = v2 * typesize /* * As a sanity check, make sure we have no more than a 2GB tag array * in either the current data type or the dest data type. This also * avoids problems with overflow of tmsize_t on 32bit systems. */ if uint64(libc.Uint32FromUint32(2147483647)/libc.Uint32FromInt32(typesize)) < target_count64 { return int32(TIFFReadDirEntryErrSizesan) } if uint64(libc.Uint32FromUint32(2147483647)/desttypesize) < target_count64 { return int32(TIFFReadDirEntryErrSizesan) } *(*Tuint32_t)(unsafe.Pointer(count)) = uint32(target_count64) datasize = *(*Tuint32_t)(unsafe.Pointer(count)) * libc.Uint32FromInt32(typesize) if datasize > libc.Uint32FromInt32(libc.Int32FromInt32(100)*libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) { /* Before allocating a huge amount of memory for corrupted files, check * if size of requested memory is not greater than file size. */ filesize = (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) if uint64(datasize) > filesize { XTIFFWarningExtR(tls, tif, __ccgo_ts+29613, __ccgo_ts+29631, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_tag), libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_tag), datasize, filesize)) return int32(TIFFReadDirEntryErrAlloc) } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) && uint64(datasize) > libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_size) { return int32(TIFFReadDirEntryErrIo) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00800) != libc.Uint32FromInt32(0)) && ((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 && datasize > uint32(8) || !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) && datasize > uint32(4)) { *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0) } else { *(*uintptr)(unsafe.Pointer(bp)) = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(count))), typesize, __ccgo_ts+29613) if *(*uintptr)(unsafe.Pointer(bp)) == uintptr(0) { return int32(TIFFReadDirEntryErrAlloc) } } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { /* Only the condition on original_datasize_clamped. The second * one is implied, but Coverity Scan cannot see it. */ if original_datasize_clamped <= int32(4) && datasize <= uint32(4) { X_TIFFmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp)), direntry+16, libc.Int32FromUint32(datasize)) } else { *(*Tuint32_t)(unsafe.Pointer(bp + 4)) = *(*Tuint32_t)(unsafe.Pointer(&(*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_offset)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+4) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) { err = _TIFFReadDirEntryData(tls, tif, uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 4))), libc.Int32FromUint32(datasize), *(*uintptr)(unsafe.Pointer(bp))) } else { err = _TIFFReadDirEntryDataAndRealloc(tls, tif, uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 4))), libc.Int32FromUint32(datasize), bp) } if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) return err } } } else { /* See above comment for the Classic TIFF case */ if original_datasize_clamped <= int32(8) && datasize <= uint32(8) { X_TIFFmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp)), direntry+16, libc.Int32FromUint32(datasize)) } else { *(*Tuint64_t)(unsafe.Pointer(bp + 8)) = *(*Tuint64_t)(unsafe.Pointer(direntry + 16)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+8) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) { err1 = _TIFFReadDirEntryData(tls, tif, *(*Tuint64_t)(unsafe.Pointer(bp + 8)), libc.Int32FromUint32(datasize), *(*uintptr)(unsafe.Pointer(bp))) } else { err1 = _TIFFReadDirEntryDataAndRealloc(tls, tif, *(*Tuint64_t)(unsafe.Pointer(bp + 8)), libc.Int32FromUint32(datasize), bp) } if err1 != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) return err1 } } } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp)) return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryArray(tls *libc.TLS, tif uintptr, direntry uintptr, count uintptr, desttypesize Tuint32_t, value uintptr) (r TIFFReadDirEntryErr) { return _TIFFReadDirEntryArrayWithLimit(tls, tif, direntry, count, desttypesize, value, ^libc.Uint64FromInt32(0)) } func _TIFFReadDirEntryByteArray(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 uintptr var err TIFFReadDirEntryErr var n, n1, n2, n3, n4, n5, n6 Tuint32_t var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = data, err, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, n, n1, n2, n3, n4, n5, n6, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_ASCII): fallthrough case int32(TIFF_UNDEFINED): fallthrough case int32(TIFF_BYTE): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArray(tls, tif, direntry, bp, uint32(1), bp+4) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_ASCII): fallthrough case int32(TIFF_UNDEFINED): fallthrough case int32(TIFF_BYTE): *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): m = *(*uintptr)(unsafe.Pointer(bp + 4)) n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } err = _TIFFReadDirEntryCheckRangeByteSbyte(tls, *(*Tint8_t)(unsafe.Pointer(m))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return err } m++ goto _1 _1: ; n++ } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_SHORT): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n1 = uint32(0) for { if !(n1 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma) } err = _TIFFReadDirEntryCheckRangeByteShort(tls, *(*Tuint16_t)(unsafe.Pointer(ma))) if err != int32(TIFFReadDirEntryErrOk) { break } v3 = mb mb++ v4 = ma ma += 2 *(*Tuint8_t)(unsafe.Pointer(v3)) = uint8(*(*Tuint16_t)(unsafe.Pointer(v4))) goto _2 _2: ; n1++ } case int32(TIFF_SSHORT): ma1 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb1 = data n2 = uint32(0) for { if !(n2 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma1) } err = _TIFFReadDirEntryCheckRangeByteSshort(tls, *(*Tint16_t)(unsafe.Pointer(ma1))) if err != int32(TIFFReadDirEntryErrOk) { break } v6 = mb1 mb1++ v7 = ma1 ma1 += 2 *(*Tuint8_t)(unsafe.Pointer(v6)) = libc.Uint8FromInt16(*(*Tint16_t)(unsafe.Pointer(v7))) goto _5 _5: ; n2++ } case int32(TIFF_LONG): ma2 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb2 = data n3 = uint32(0) for { if !(n3 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma2) } err = _TIFFReadDirEntryCheckRangeByteLong(tls, *(*Tuint32_t)(unsafe.Pointer(ma2))) if err != int32(TIFFReadDirEntryErrOk) { break } v9 = mb2 mb2++ v10 = ma2 ma2 += 4 *(*Tuint8_t)(unsafe.Pointer(v9)) = uint8(*(*Tuint32_t)(unsafe.Pointer(v10))) goto _8 _8: ; n3++ } case int32(TIFF_SLONG): ma3 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb3 = data n4 = uint32(0) for { if !(n4 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma3) } err = _TIFFReadDirEntryCheckRangeByteSlong(tls, *(*Tint32_t)(unsafe.Pointer(ma3))) if err != int32(TIFFReadDirEntryErrOk) { break } v12 = mb3 mb3++ v13 = ma3 ma3 += 4 *(*Tuint8_t)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(*(*Tint32_t)(unsafe.Pointer(v13))) goto _11 _11: ; n4++ } case int32(TIFF_LONG8): ma4 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb4 = data n5 = uint32(0) for { if !(n5 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma4) } err = _TIFFReadDirEntryCheckRangeByteLong8(tls, *(*Tuint64_t)(unsafe.Pointer(ma4))) if err != int32(TIFFReadDirEntryErrOk) { break } v15 = mb4 mb4++ v16 = ma4 ma4 += 8 *(*Tuint8_t)(unsafe.Pointer(v15)) = uint8(*(*Tuint64_t)(unsafe.Pointer(v16))) goto _14 _14: ; n5++ } case int32(TIFF_SLONG8): ma5 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb5 = data n6 = uint32(0) for { if !(n6 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma5) } err = _TIFFReadDirEntryCheckRangeByteSlong8(tls, *(*Tint64_t)(unsafe.Pointer(ma5))) if err != int32(TIFFReadDirEntryErrOk) { break } v18 = mb5 mb5++ v19 = ma5 ma5 += 8 *(*Tuint8_t)(unsafe.Pointer(v18)) = libc.Uint8FromInt64(*(*Tint64_t)(unsafe.Pointer(v19))) goto _17 _17: ; n6++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, data) return err } *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntrySbyteArray(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 uintptr var err TIFFReadDirEntryErr var n, n1, n2, n3, n4, n5, n6 Tuint32_t var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = data, err, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, n, n1, n2, n3, n4, n5, n6, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_UNDEFINED): fallthrough case int32(TIFF_BYTE): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArray(tls, tif, direntry, bp, uint32(1), bp+4) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_UNDEFINED): fallthrough case int32(TIFF_BYTE): m = *(*uintptr)(unsafe.Pointer(bp + 4)) n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } err = _TIFFReadDirEntryCheckRangeSbyteByte(tls, *(*Tuint8_t)(unsafe.Pointer(m))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return err } m++ goto _1 _1: ; n++ } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SBYTE): *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_SHORT): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n1 = uint32(0) for { if !(n1 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma) } err = _TIFFReadDirEntryCheckRangeSbyteShort(tls, *(*Tuint16_t)(unsafe.Pointer(ma))) if err != int32(TIFFReadDirEntryErrOk) { break } v3 = mb mb++ v4 = ma ma += 2 *(*Tint8_t)(unsafe.Pointer(v3)) = libc.Int8FromUint16(*(*Tuint16_t)(unsafe.Pointer(v4))) goto _2 _2: ; n1++ } case int32(TIFF_SSHORT): ma1 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb1 = data n2 = uint32(0) for { if !(n2 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma1) } err = _TIFFReadDirEntryCheckRangeSbyteSshort(tls, *(*Tint16_t)(unsafe.Pointer(ma1))) if err != int32(TIFFReadDirEntryErrOk) { break } v6 = mb1 mb1++ v7 = ma1 ma1 += 2 *(*Tint8_t)(unsafe.Pointer(v6)) = int8(*(*Tint16_t)(unsafe.Pointer(v7))) goto _5 _5: ; n2++ } case int32(TIFF_LONG): ma2 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb2 = data n3 = uint32(0) for { if !(n3 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma2) } err = _TIFFReadDirEntryCheckRangeSbyteLong(tls, *(*Tuint32_t)(unsafe.Pointer(ma2))) if err != int32(TIFFReadDirEntryErrOk) { break } v9 = mb2 mb2++ v10 = ma2 ma2 += 4 *(*Tint8_t)(unsafe.Pointer(v9)) = libc.Int8FromUint32(*(*Tuint32_t)(unsafe.Pointer(v10))) goto _8 _8: ; n3++ } case int32(TIFF_SLONG): ma3 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb3 = data n4 = uint32(0) for { if !(n4 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma3) } err = _TIFFReadDirEntryCheckRangeSbyteSlong(tls, *(*Tint32_t)(unsafe.Pointer(ma3))) if err != int32(TIFFReadDirEntryErrOk) { break } v12 = mb3 mb3++ v13 = ma3 ma3 += 4 *(*Tint8_t)(unsafe.Pointer(v12)) = int8(*(*Tint32_t)(unsafe.Pointer(v13))) goto _11 _11: ; n4++ } case int32(TIFF_LONG8): ma4 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb4 = data n5 = uint32(0) for { if !(n5 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma4) } err = _TIFFReadDirEntryCheckRangeSbyteLong8(tls, *(*Tuint64_t)(unsafe.Pointer(ma4))) if err != int32(TIFFReadDirEntryErrOk) { break } v15 = mb4 mb4++ v16 = ma4 ma4 += 8 *(*Tint8_t)(unsafe.Pointer(v15)) = libc.Int8FromUint64(*(*Tuint64_t)(unsafe.Pointer(v16))) goto _14 _14: ; n5++ } case int32(TIFF_SLONG8): ma5 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb5 = data n6 = uint32(0) for { if !(n6 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma5) } err = _TIFFReadDirEntryCheckRangeSbyteSlong8(tls, *(*Tint64_t)(unsafe.Pointer(ma5))) if err != int32(TIFFReadDirEntryErrOk) { break } v18 = mb5 mb5++ v19 = ma5 ma5 += 8 *(*Tint8_t)(unsafe.Pointer(v18)) = int8(*(*Tint64_t)(unsafe.Pointer(v19))) goto _17 _17: ; n6++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, data) return err } *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryShortArray(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 uintptr var err TIFFReadDirEntryErr var n, n1, n2, n3, n4, n5, n6 Tuint32_t var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = data, err, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, n, n1, n2, n3, n4, n5, n6, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArray(tls, tif, direntry, bp, uint32(2), bp+4) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_SHORT): *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfShort(tls, *(*uintptr)(unsafe.Pointer(value)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): m = *(*uintptr)(unsafe.Pointer(bp + 4)) n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, m) } err = _TIFFReadDirEntryCheckRangeShortSshort(tls, *(*Tint16_t)(unsafe.Pointer(m))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return err } m += 2 goto _1 _1: ; n++ } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))*uint32(2))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n1 = uint32(0) for { if !(n1 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v3 = mb mb += 2 v4 = ma ma++ *(*Tuint16_t)(unsafe.Pointer(v3)) = uint16(*(*Tuint8_t)(unsafe.Pointer(v4))) goto _2 _2: ; n1++ } case int32(TIFF_SBYTE): ma1 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb1 = data n2 = uint32(0) for { if !(n2 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } err = _TIFFReadDirEntryCheckRangeShortSbyte(tls, *(*Tint8_t)(unsafe.Pointer(ma1))) if err != int32(TIFFReadDirEntryErrOk) { break } v6 = mb1 mb1 += 2 v7 = ma1 ma1++ *(*Tuint16_t)(unsafe.Pointer(v6)) = libc.Uint16FromInt8(*(*Tint8_t)(unsafe.Pointer(v7))) goto _5 _5: ; n2++ } case int32(TIFF_LONG): ma2 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb2 = data n3 = uint32(0) for { if !(n3 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma2) } err = _TIFFReadDirEntryCheckRangeShortLong(tls, *(*Tuint32_t)(unsafe.Pointer(ma2))) if err != int32(TIFFReadDirEntryErrOk) { break } v9 = mb2 mb2 += 2 v10 = ma2 ma2 += 4 *(*Tuint16_t)(unsafe.Pointer(v9)) = uint16(*(*Tuint32_t)(unsafe.Pointer(v10))) goto _8 _8: ; n3++ } case int32(TIFF_SLONG): ma3 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb3 = data n4 = uint32(0) for { if !(n4 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma3) } err = _TIFFReadDirEntryCheckRangeShortSlong(tls, *(*Tint32_t)(unsafe.Pointer(ma3))) if err != int32(TIFFReadDirEntryErrOk) { break } v12 = mb3 mb3 += 2 v13 = ma3 ma3 += 4 *(*Tuint16_t)(unsafe.Pointer(v12)) = libc.Uint16FromInt32(*(*Tint32_t)(unsafe.Pointer(v13))) goto _11 _11: ; n4++ } case int32(TIFF_LONG8): ma4 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb4 = data n5 = uint32(0) for { if !(n5 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma4) } err = _TIFFReadDirEntryCheckRangeShortLong8(tls, *(*Tuint64_t)(unsafe.Pointer(ma4))) if err != int32(TIFFReadDirEntryErrOk) { break } v15 = mb4 mb4 += 2 v16 = ma4 ma4 += 8 *(*Tuint16_t)(unsafe.Pointer(v15)) = uint16(*(*Tuint64_t)(unsafe.Pointer(v16))) goto _14 _14: ; n5++ } case int32(TIFF_SLONG8): ma5 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb5 = data n6 = uint32(0) for { if !(n6 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma5) } err = _TIFFReadDirEntryCheckRangeShortSlong8(tls, *(*Tint64_t)(unsafe.Pointer(ma5))) if err != int32(TIFFReadDirEntryErrOk) { break } v18 = mb5 mb5 += 2 v19 = ma5 ma5 += 8 *(*Tuint16_t)(unsafe.Pointer(v18)) = libc.Uint16FromInt64(*(*Tint64_t)(unsafe.Pointer(v19))) goto _17 _17: ; n6++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, data) return err } *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntrySshortArray(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 uintptr var err TIFFReadDirEntryErr var n, n1, n2, n3, n4, n5, n6 Tuint32_t var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = data, err, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, n, n1, n2, n3, n4, n5, n6, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArray(tls, tif, direntry, bp, uint32(2), bp+4) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_SHORT): m = *(*uintptr)(unsafe.Pointer(bp + 4)) n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, m) } err = _TIFFReadDirEntryCheckRangeSshortShort(tls, *(*Tuint16_t)(unsafe.Pointer(m))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return err } m += 2 goto _1 _1: ; n++ } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SSHORT): *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfShort(tls, *(*uintptr)(unsafe.Pointer(value)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))*uint32(2))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n1 = uint32(0) for { if !(n1 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v3 = mb mb += 2 v4 = ma ma++ *(*Tint16_t)(unsafe.Pointer(v3)) = libc.Int16FromUint8(*(*Tuint8_t)(unsafe.Pointer(v4))) goto _2 _2: ; n1++ } case int32(TIFF_SBYTE): ma1 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb1 = data n2 = uint32(0) for { if !(n2 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v6 = mb1 mb1 += 2 v7 = ma1 ma1++ *(*Tint16_t)(unsafe.Pointer(v6)) = int16(*(*Tint8_t)(unsafe.Pointer(v7))) goto _5 _5: ; n2++ } case int32(TIFF_LONG): ma2 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb2 = data n3 = uint32(0) for { if !(n3 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma2) } err = _TIFFReadDirEntryCheckRangeSshortLong(tls, *(*Tuint32_t)(unsafe.Pointer(ma2))) if err != int32(TIFFReadDirEntryErrOk) { break } v9 = mb2 mb2 += 2 v10 = ma2 ma2 += 4 *(*Tint16_t)(unsafe.Pointer(v9)) = libc.Int16FromUint32(*(*Tuint32_t)(unsafe.Pointer(v10))) goto _8 _8: ; n3++ } case int32(TIFF_SLONG): ma3 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb3 = data n4 = uint32(0) for { if !(n4 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma3) } err = _TIFFReadDirEntryCheckRangeSshortSlong(tls, *(*Tint32_t)(unsafe.Pointer(ma3))) if err != int32(TIFFReadDirEntryErrOk) { break } v12 = mb3 mb3 += 2 v13 = ma3 ma3 += 4 *(*Tint16_t)(unsafe.Pointer(v12)) = int16(*(*Tint32_t)(unsafe.Pointer(v13))) goto _11 _11: ; n4++ } case int32(TIFF_LONG8): ma4 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb4 = data n5 = uint32(0) for { if !(n5 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma4) } err = _TIFFReadDirEntryCheckRangeSshortLong8(tls, *(*Tuint64_t)(unsafe.Pointer(ma4))) if err != int32(TIFFReadDirEntryErrOk) { break } v15 = mb4 mb4 += 2 v16 = ma4 ma4 += 8 *(*Tint16_t)(unsafe.Pointer(v15)) = libc.Int16FromUint64(*(*Tuint64_t)(unsafe.Pointer(v16))) goto _14 _14: ; n5++ } case int32(TIFF_SLONG8): ma5 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb5 = data n6 = uint32(0) for { if !(n6 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma5) } err = _TIFFReadDirEntryCheckRangeSshortSlong8(tls, *(*Tint64_t)(unsafe.Pointer(ma5))) if err != int32(TIFFReadDirEntryErrOk) { break } v18 = mb5 mb5 += 2 v19 = ma5 ma5 += 8 *(*Tint16_t)(unsafe.Pointer(v18)) = int16(*(*Tint64_t)(unsafe.Pointer(v19))) goto _17 _17: ; n6++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, data) return err } *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryLongArray(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 uintptr var err TIFFReadDirEntryErr var n, n1, n2, n3, n4, n5, n6 Tuint32_t var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = data, err, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, n, n1, n2, n3, n4, n5, n6, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArray(tls, tif, direntry, bp, uint32(4), bp+4) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_LONG): *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, *(*uintptr)(unsafe.Pointer(value)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): m = *(*uintptr)(unsafe.Pointer(bp + 4)) n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, m) } err = _TIFFReadDirEntryCheckRangeLongSlong(tls, *(*Tint32_t)(unsafe.Pointer(m))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return err } m += 4 goto _1 _1: ; n++ } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))*uint32(4))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n1 = uint32(0) for { if !(n1 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v3 = mb mb += 4 v4 = ma ma++ *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(*(*Tuint8_t)(unsafe.Pointer(v4))) goto _2 _2: ; n1++ } case int32(TIFF_SBYTE): ma1 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb1 = data n2 = uint32(0) for { if !(n2 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } err = _TIFFReadDirEntryCheckRangeLongSbyte(tls, *(*Tint8_t)(unsafe.Pointer(ma1))) if err != int32(TIFFReadDirEntryErrOk) { break } v6 = mb1 mb1 += 4 v7 = ma1 ma1++ *(*Tuint32_t)(unsafe.Pointer(v6)) = libc.Uint32FromInt8(*(*Tint8_t)(unsafe.Pointer(v7))) goto _5 _5: ; n2++ } case int32(TIFF_SHORT): ma2 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb2 = data n3 = uint32(0) for { if !(n3 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma2) } v9 = mb2 mb2 += 4 v10 = ma2 ma2 += 2 *(*Tuint32_t)(unsafe.Pointer(v9)) = uint32(*(*Tuint16_t)(unsafe.Pointer(v10))) goto _8 _8: ; n3++ } case int32(TIFF_SSHORT): ma3 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb3 = data n4 = uint32(0) for { if !(n4 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma3) } err = _TIFFReadDirEntryCheckRangeLongSshort(tls, *(*Tint16_t)(unsafe.Pointer(ma3))) if err != int32(TIFFReadDirEntryErrOk) { break } v12 = mb3 mb3 += 4 v13 = ma3 ma3 += 2 *(*Tuint32_t)(unsafe.Pointer(v12)) = libc.Uint32FromInt16(*(*Tint16_t)(unsafe.Pointer(v13))) goto _11 _11: ; n4++ } case int32(TIFF_LONG8): ma4 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb4 = data n5 = uint32(0) for { if !(n5 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma4) } err = _TIFFReadDirEntryCheckRangeLongLong8(tls, *(*Tuint64_t)(unsafe.Pointer(ma4))) if err != int32(TIFFReadDirEntryErrOk) { break } v15 = mb4 mb4 += 4 v16 = ma4 ma4 += 8 *(*Tuint32_t)(unsafe.Pointer(v15)) = uint32(*(*Tuint64_t)(unsafe.Pointer(v16))) goto _14 _14: ; n5++ } case int32(TIFF_SLONG8): ma5 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb5 = data n6 = uint32(0) for { if !(n6 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma5) } err = _TIFFReadDirEntryCheckRangeLongSlong8(tls, *(*Tint64_t)(unsafe.Pointer(ma5))) if err != int32(TIFFReadDirEntryErrOk) { break } v18 = mb5 mb5 += 4 v19 = ma5 ma5 += 8 *(*Tuint32_t)(unsafe.Pointer(v18)) = libc.Uint32FromInt64(*(*Tint64_t)(unsafe.Pointer(v19))) goto _17 _17: ; n6++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, data) return err } *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntrySlongArray(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 uintptr var err TIFFReadDirEntryErr var n, n1, n2, n3, n4, n5, n6 Tuint32_t var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = data, err, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, n, n1, n2, n3, n4, n5, n6, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArray(tls, tif, direntry, bp, uint32(4), bp+4) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_LONG): m = *(*uintptr)(unsafe.Pointer(bp + 4)) n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, m) } err = _TIFFReadDirEntryCheckRangeSlongLong(tls, *(*Tuint32_t)(unsafe.Pointer(m))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return err } m += 4 goto _1 _1: ; n++ } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG): *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, *(*uintptr)(unsafe.Pointer(value)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))*uint32(4))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n1 = uint32(0) for { if !(n1 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v3 = mb mb += 4 v4 = ma ma++ *(*Tint32_t)(unsafe.Pointer(v3)) = libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(v4))) goto _2 _2: ; n1++ } case int32(TIFF_SBYTE): ma1 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb1 = data n2 = uint32(0) for { if !(n2 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v6 = mb1 mb1 += 4 v7 = ma1 ma1++ *(*Tint32_t)(unsafe.Pointer(v6)) = int32(*(*Tint8_t)(unsafe.Pointer(v7))) goto _5 _5: ; n2++ } case int32(TIFF_SHORT): ma2 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb2 = data n3 = uint32(0) for { if !(n3 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma2) } v9 = mb2 mb2 += 4 v10 = ma2 ma2 += 2 *(*Tint32_t)(unsafe.Pointer(v9)) = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(v10))) goto _8 _8: ; n3++ } case int32(TIFF_SSHORT): ma3 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb3 = data n4 = uint32(0) for { if !(n4 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma3) } v12 = mb3 mb3 += 4 v13 = ma3 ma3 += 2 *(*Tint32_t)(unsafe.Pointer(v12)) = int32(*(*Tint16_t)(unsafe.Pointer(v13))) goto _11 _11: ; n4++ } case int32(TIFF_LONG8): ma4 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb4 = data n5 = uint32(0) for { if !(n5 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma4) } err = _TIFFReadDirEntryCheckRangeSlongLong8(tls, *(*Tuint64_t)(unsafe.Pointer(ma4))) if err != int32(TIFFReadDirEntryErrOk) { break } v15 = mb4 mb4 += 4 v16 = ma4 ma4 += 8 *(*Tint32_t)(unsafe.Pointer(v15)) = libc.Int32FromUint64(*(*Tuint64_t)(unsafe.Pointer(v16))) goto _14 _14: ; n5++ } case int32(TIFF_SLONG8): ma5 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb5 = data n6 = uint32(0) for { if !(n6 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma5) } err = _TIFFReadDirEntryCheckRangeSlongSlong8(tls, *(*Tint64_t)(unsafe.Pointer(ma5))) if err != int32(TIFFReadDirEntryErrOk) { break } v18 = mb5 mb5 += 4 v19 = ma5 ma5 += 8 *(*Tint32_t)(unsafe.Pointer(v18)) = int32(*(*Tint64_t)(unsafe.Pointer(v19))) goto _17 _17: ; n6++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, data) return err } *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryLong8ArrayWithLimit(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr, maxcount Tuint64_t) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 uintptr var err TIFFReadDirEntryErr var n, n1, n2, n3, n4, n5, n6 Tuint32_t var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = data, err, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, n, n1, n2, n3, n4, n5, n6, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArrayWithLimit(tls, tif, direntry, bp, uint32(8), bp+4, maxcount) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_LONG8): *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong8(tls, *(*uintptr)(unsafe.Pointer(value)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): m = *(*uintptr)(unsafe.Pointer(bp + 4)) n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, m) } err = _TIFFReadDirEntryCheckRangeLong8Slong8(tls, *(*Tint64_t)(unsafe.Pointer(m))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return err } m += 8 goto _1 _1: ; n++ } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))*uint32(8))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n1 = uint32(0) for { if !(n1 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v3 = mb mb += 8 v4 = ma ma++ *(*Tuint64_t)(unsafe.Pointer(v3)) = uint64(*(*Tuint8_t)(unsafe.Pointer(v4))) goto _2 _2: ; n1++ } case int32(TIFF_SBYTE): ma1 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb1 = data n2 = uint32(0) for { if !(n2 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } err = _TIFFReadDirEntryCheckRangeLong8Sbyte(tls, *(*Tint8_t)(unsafe.Pointer(ma1))) if err != int32(TIFFReadDirEntryErrOk) { break } v6 = mb1 mb1 += 8 v7 = ma1 ma1++ *(*Tuint64_t)(unsafe.Pointer(v6)) = libc.Uint64FromInt8(*(*Tint8_t)(unsafe.Pointer(v7))) goto _5 _5: ; n2++ } case int32(TIFF_SHORT): ma2 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb2 = data n3 = uint32(0) for { if !(n3 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma2) } v9 = mb2 mb2 += 8 v10 = ma2 ma2 += 2 *(*Tuint64_t)(unsafe.Pointer(v9)) = uint64(*(*Tuint16_t)(unsafe.Pointer(v10))) goto _8 _8: ; n3++ } case int32(TIFF_SSHORT): ma3 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb3 = data n4 = uint32(0) for { if !(n4 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma3) } err = _TIFFReadDirEntryCheckRangeLong8Sshort(tls, *(*Tint16_t)(unsafe.Pointer(ma3))) if err != int32(TIFFReadDirEntryErrOk) { break } v12 = mb3 mb3 += 8 v13 = ma3 ma3 += 2 *(*Tuint64_t)(unsafe.Pointer(v12)) = libc.Uint64FromInt16(*(*Tint16_t)(unsafe.Pointer(v13))) goto _11 _11: ; n4++ } case int32(TIFF_LONG): ma4 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb4 = data n5 = uint32(0) for { if !(n5 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma4) } v15 = mb4 mb4 += 8 v16 = ma4 ma4 += 4 *(*Tuint64_t)(unsafe.Pointer(v15)) = uint64(*(*Tuint32_t)(unsafe.Pointer(v16))) goto _14 _14: ; n5++ } case int32(TIFF_SLONG): ma5 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb5 = data n6 = uint32(0) for { if !(n6 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma5) } err = _TIFFReadDirEntryCheckRangeLong8Slong(tls, *(*Tint32_t)(unsafe.Pointer(ma5))) if err != int32(TIFFReadDirEntryErrOk) { break } v18 = mb5 mb5 += 8 v19 = ma5 ma5 += 4 *(*Tuint64_t)(unsafe.Pointer(v18)) = libc.Uint64FromInt32(*(*Tint32_t)(unsafe.Pointer(v19))) goto _17 _17: ; n6++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, data) return err } *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryLong8Array(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { return _TIFFReadDirEntryLong8ArrayWithLimit(tls, tif, direntry, value, ^libc.Uint64FromInt32(0)) } func _TIFFReadDirEntrySlong8Array(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 uintptr var err TIFFReadDirEntryErr var n, n1, n2, n3, n4, n5, n6 Tuint32_t var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = data, err, m, ma, ma1, ma2, ma3, ma4, ma5, mb, mb1, mb2, mb3, mb4, mb5, n, n1, n2, n3, n4, n5, n6, v10, v12, v13, v15, v16, v18, v19, v3, v4, v6, v7, v9 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArray(tls, tif, direntry, bp, uint32(8), bp+4) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_LONG8): m = *(*uintptr)(unsafe.Pointer(bp + 4)) n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, m) } err = _TIFFReadDirEntryCheckRangeSlong8Long8(tls, *(*Tuint64_t)(unsafe.Pointer(m))) if err != int32(TIFFReadDirEntryErrOk) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return err } m += 8 goto _1 _1: ; n++ } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) case int32(TIFF_SLONG8): *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong8(tls, *(*uintptr)(unsafe.Pointer(value)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))*uint32(8))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n1 = uint32(0) for { if !(n1 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v3 = mb mb += 8 v4 = ma ma++ *(*Tint64_t)(unsafe.Pointer(v3)) = libc.Int64FromUint8(*(*Tuint8_t)(unsafe.Pointer(v4))) goto _2 _2: ; n1++ } case int32(TIFF_SBYTE): ma1 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb1 = data n2 = uint32(0) for { if !(n2 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v6 = mb1 mb1 += 8 v7 = ma1 ma1++ *(*Tint64_t)(unsafe.Pointer(v6)) = int64(*(*Tint8_t)(unsafe.Pointer(v7))) goto _5 _5: ; n2++ } case int32(TIFF_SHORT): ma2 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb2 = data n3 = uint32(0) for { if !(n3 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma2) } v9 = mb2 mb2 += 8 v10 = ma2 ma2 += 2 *(*Tint64_t)(unsafe.Pointer(v9)) = libc.Int64FromUint16(*(*Tuint16_t)(unsafe.Pointer(v10))) goto _8 _8: ; n3++ } case int32(TIFF_SSHORT): ma3 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb3 = data n4 = uint32(0) for { if !(n4 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma3) } v12 = mb3 mb3 += 8 v13 = ma3 ma3 += 2 *(*Tint64_t)(unsafe.Pointer(v12)) = int64(*(*Tint16_t)(unsafe.Pointer(v13))) goto _11 _11: ; n4++ } case int32(TIFF_LONG): ma4 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb4 = data n5 = uint32(0) for { if !(n5 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma4) } v15 = mb4 mb4 += 8 v16 = ma4 ma4 += 4 *(*Tint64_t)(unsafe.Pointer(v15)) = libc.Int64FromUint32(*(*Tuint32_t)(unsafe.Pointer(v16))) goto _14 _14: ; n5++ } case int32(TIFF_SLONG): ma5 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb5 = data n6 = uint32(0) for { if !(n6 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma5) } v18 = mb5 mb5 += 8 v19 = ma5 ma5 += 4 *(*Tint64_t)(unsafe.Pointer(v18)) = int64(*(*Tint32_t)(unsafe.Pointer(v19))) goto _17 _17: ; n6++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryFloatArray(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, ma, ma1, ma10, ma2, ma3, ma4, ma5, ma6, ma7, ma8, ma9, mb, mb1, mb10, mb2, mb3, mb4, mb5, mb6, mb7, mb8, mb9, v11, v12, v14, v15, v17, v18, v2, v20, v21, v23, v24, v26, v27, v28, v29, v3, v31, v32, v33, v35, v36, v5, v6, v8, v9 uintptr var err TIFFReadDirEntryErr var maa, mab, mab1, n, n1, n10, n2, n3, n4, n5, n6, n7, n8, n9 Tuint32_t var maa1 Tint32_t var val float64 var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = data, err, ma, ma1, ma10, ma2, ma3, ma4, ma5, ma6, ma7, ma8, ma9, maa, maa1, mab, mab1, mb, mb1, mb10, mb2, mb3, mb4, mb5, mb6, mb7, mb8, mb9, n, n1, n10, n2, n3, n4, n5, n6, n7, n8, n9, val, v11, v12, v14, v15, v17, v18, v2, v20, v21, v23, v24, v26, v27, v28, v29, v3, v31, v32, v33, v35, v36, v5, v6, v8, v9 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): fallthrough case int32(TIFF_RATIONAL): fallthrough case int32(TIFF_SRATIONAL): fallthrough case int32(TIFF_FLOAT): fallthrough case int32(TIFF_DOUBLE): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArray(tls, tif, direntry, bp, uint32(4), bp+4) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_FLOAT): if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))*uint32(4))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v2 = mb mb += 4 v3 = ma ma++ *(*float32)(unsafe.Pointer(v2)) = float32(*(*Tuint8_t)(unsafe.Pointer(v3))) goto _1 _1: ; n++ } case int32(TIFF_SBYTE): ma1 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb1 = data n1 = uint32(0) for { if !(n1 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v5 = mb1 mb1 += 4 v6 = ma1 ma1++ *(*float32)(unsafe.Pointer(v5)) = float32(*(*Tint8_t)(unsafe.Pointer(v6))) goto _4 _4: ; n1++ } case int32(TIFF_SHORT): ma2 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb2 = data n2 = uint32(0) for { if !(n2 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma2) } v8 = mb2 mb2 += 4 v9 = ma2 ma2 += 2 *(*float32)(unsafe.Pointer(v8)) = float32(*(*Tuint16_t)(unsafe.Pointer(v9))) goto _7 _7: ; n2++ } case int32(TIFF_SSHORT): ma3 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb3 = data n3 = uint32(0) for { if !(n3 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma3) } v11 = mb3 mb3 += 4 v12 = ma3 ma3 += 2 *(*float32)(unsafe.Pointer(v11)) = float32(*(*Tint16_t)(unsafe.Pointer(v12))) goto _10 _10: ; n3++ } case int32(TIFF_LONG): ma4 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb4 = data n4 = uint32(0) for { if !(n4 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma4) } v14 = mb4 mb4 += 4 v15 = ma4 ma4 += 4 *(*float32)(unsafe.Pointer(v14)) = float32(*(*Tuint32_t)(unsafe.Pointer(v15))) goto _13 _13: ; n4++ } case int32(TIFF_SLONG): ma5 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb5 = data n5 = uint32(0) for { if !(n5 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma5) } v17 = mb5 mb5 += 4 v18 = ma5 ma5 += 4 *(*float32)(unsafe.Pointer(v17)) = float32(*(*Tint32_t)(unsafe.Pointer(v18))) goto _16 _16: ; n5++ } case int32(TIFF_LONG8): ma6 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb6 = data n6 = uint32(0) for { if !(n6 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma6) } v20 = mb6 mb6 += 4 v21 = ma6 ma6 += 8 *(*float32)(unsafe.Pointer(v20)) = float32(*(*Tuint64_t)(unsafe.Pointer(v21))) goto _19 _19: ; n6++ } case int32(TIFF_SLONG8): ma7 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb7 = data n7 = uint32(0) for { if !(n7 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma7) } v23 = mb7 mb7 += 4 v24 = ma7 ma7 += 8 *(*float32)(unsafe.Pointer(v23)) = float32(*(*Tint64_t)(unsafe.Pointer(v24))) goto _22 _22: ; n7++ } case int32(TIFF_RATIONAL): ma8 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb8 = data n8 = uint32(0) for { if !(n8 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma8) } v26 = ma8 ma8 += 4 maa = *(*Tuint32_t)(unsafe.Pointer(v26)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma8) } v27 = ma8 ma8 += 4 mab = *(*Tuint32_t)(unsafe.Pointer(v27)) if mab == uint32(0) { v28 = mb8 mb8 += 4 *(*float32)(unsafe.Pointer(v28)) = float32(0) } else { v29 = mb8 mb8 += 4 *(*float32)(unsafe.Pointer(v29)) = float32(maa) / float32(mab) } goto _25 _25: ; n8++ } case int32(TIFF_SRATIONAL): ma9 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb9 = data n9 = uint32(0) for { if !(n9 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma9) } maa1 = *(*Tint32_t)(unsafe.Pointer(ma9)) ma9 += 4 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma9) } v31 = ma9 ma9 += 4 mab1 = *(*Tuint32_t)(unsafe.Pointer(v31)) if mab1 == uint32(0) { v32 = mb9 mb9 += 4 *(*float32)(unsafe.Pointer(v32)) = float32(0) } else { v33 = mb9 mb9 += 4 *(*float32)(unsafe.Pointer(v33)) = float32(maa1) / float32(mab1) } goto _30 _30: ; n9++ } case int32(TIFF_DOUBLE): if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong8(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } ma10 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb10 = data n10 = uint32(0) for { if !(n10 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v35 = ma10 ma10 += 8 val = *(*float64)(unsafe.Pointer(v35)) if val > libc.Float64FromFloat32(3.4028234663852886e+38) { val = libc.Float64FromFloat32(3.4028234663852886e+38) } else { if val < float64(-libc.Float32FromFloat32(3.4028234663852886e+38)) { val = float64(-libc.Float32FromFloat32(3.4028234663852886e+38)) } } v36 = mb10 mb10 += 4 *(*float32)(unsafe.Pointer(v36)) = float32(val) goto _34 _34: ; n10++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryDoubleArray(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, ma, ma1, ma10, ma2, ma3, ma4, ma5, ma6, ma7, ma8, ma9, mb, mb1, mb10, mb2, mb3, mb4, mb5, mb6, mb7, mb8, mb9, v11, v12, v14, v15, v17, v18, v2, v20, v21, v23, v24, v26, v27, v28, v29, v3, v31, v32, v33, v35, v36, v5, v6, v8, v9 uintptr var err TIFFReadDirEntryErr var maa, mab, mab1, n, n1, n10, n2, n3, n4, n5, n6, n7, n8, n9 Tuint32_t var maa1 Tint32_t var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = data, err, ma, ma1, ma10, ma2, ma3, ma4, ma5, ma6, ma7, ma8, ma9, maa, maa1, mab, mab1, mb, mb1, mb10, mb2, mb3, mb4, mb5, mb6, mb7, mb8, mb9, n, n1, n10, n2, n3, n4, n5, n6, n7, n8, n9, v11, v12, v14, v15, v17, v18, v2, v20, v21, v23, v24, v26, v27, v28, v29, v3, v31, v32, v33, v35, v36, v5, v6, v8, v9 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): fallthrough case int32(TIFF_SBYTE): fallthrough case int32(TIFF_SHORT): fallthrough case int32(TIFF_SSHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_SLONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_SLONG8): fallthrough case int32(TIFF_RATIONAL): fallthrough case int32(TIFF_SRATIONAL): fallthrough case int32(TIFF_FLOAT): fallthrough case int32(TIFF_DOUBLE): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArray(tls, tif, direntry, bp, uint32(8), bp+4) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_DOUBLE): if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong8(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))*uint32(8))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_BYTE): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v2 = mb mb += 8 v3 = ma ma++ *(*float64)(unsafe.Pointer(v2)) = float64(*(*Tuint8_t)(unsafe.Pointer(v3))) goto _1 _1: ; n++ } case int32(TIFF_SBYTE): ma1 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb1 = data n1 = uint32(0) for { if !(n1 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v5 = mb1 mb1 += 8 v6 = ma1 ma1++ *(*float64)(unsafe.Pointer(v5)) = float64(*(*Tint8_t)(unsafe.Pointer(v6))) goto _4 _4: ; n1++ } case int32(TIFF_SHORT): ma2 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb2 = data n2 = uint32(0) for { if !(n2 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma2) } v8 = mb2 mb2 += 8 v9 = ma2 ma2 += 2 *(*float64)(unsafe.Pointer(v8)) = float64(*(*Tuint16_t)(unsafe.Pointer(v9))) goto _7 _7: ; n2++ } case int32(TIFF_SSHORT): ma3 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb3 = data n3 = uint32(0) for { if !(n3 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma3) } v11 = mb3 mb3 += 8 v12 = ma3 ma3 += 2 *(*float64)(unsafe.Pointer(v11)) = float64(*(*Tint16_t)(unsafe.Pointer(v12))) goto _10 _10: ; n3++ } case int32(TIFF_LONG): ma4 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb4 = data n4 = uint32(0) for { if !(n4 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma4) } v14 = mb4 mb4 += 8 v15 = ma4 ma4 += 4 *(*float64)(unsafe.Pointer(v14)) = float64(*(*Tuint32_t)(unsafe.Pointer(v15))) goto _13 _13: ; n4++ } case int32(TIFF_SLONG): ma5 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb5 = data n5 = uint32(0) for { if !(n5 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma5) } v17 = mb5 mb5 += 8 v18 = ma5 ma5 += 4 *(*float64)(unsafe.Pointer(v17)) = float64(*(*Tint32_t)(unsafe.Pointer(v18))) goto _16 _16: ; n5++ } case int32(TIFF_LONG8): ma6 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb6 = data n6 = uint32(0) for { if !(n6 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma6) } v20 = mb6 mb6 += 8 v21 = ma6 ma6 += 8 *(*float64)(unsafe.Pointer(v20)) = float64(*(*Tuint64_t)(unsafe.Pointer(v21))) goto _19 _19: ; n6++ } case int32(TIFF_SLONG8): ma7 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb7 = data n7 = uint32(0) for { if !(n7 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma7) } v23 = mb7 mb7 += 8 v24 = ma7 ma7 += 8 *(*float64)(unsafe.Pointer(v23)) = float64(*(*Tint64_t)(unsafe.Pointer(v24))) goto _22 _22: ; n7++ } case int32(TIFF_RATIONAL): ma8 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb8 = data n8 = uint32(0) for { if !(n8 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma8) } v26 = ma8 ma8 += 4 maa = *(*Tuint32_t)(unsafe.Pointer(v26)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma8) } v27 = ma8 ma8 += 4 mab = *(*Tuint32_t)(unsafe.Pointer(v27)) if mab == uint32(0) { v28 = mb8 mb8 += 8 *(*float64)(unsafe.Pointer(v28)) = float64(0) } else { v29 = mb8 mb8 += 8 *(*float64)(unsafe.Pointer(v29)) = float64(maa) / float64(mab) } goto _25 _25: ; n8++ } case int32(TIFF_SRATIONAL): ma9 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb9 = data n9 = uint32(0) for { if !(n9 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma9) } maa1 = *(*Tint32_t)(unsafe.Pointer(ma9)) ma9 += 4 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma9) } v31 = ma9 ma9 += 4 mab1 = *(*Tuint32_t)(unsafe.Pointer(v31)) if mab1 == uint32(0) { v32 = mb9 mb9 += 8 *(*float64)(unsafe.Pointer(v32)) = float64(0) } else { v33 = mb9 mb9 += 8 *(*float64)(unsafe.Pointer(v33)) = float64(maa1) / float64(mab1) } goto _30 _30: ; n9++ } case int32(TIFF_FLOAT): if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, *(*uintptr)(unsafe.Pointer(bp + 4)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } ma10 = *(*uintptr)(unsafe.Pointer(bp + 4)) mb10 = data n10 = uint32(0) for { if !(n10 < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } v35 = mb10 mb10 += 8 v36 = ma10 ma10 += 4 *(*float64)(unsafe.Pointer(v35)) = float64(*(*float32)(unsafe.Pointer(v36))) goto _34 _34: ; n10++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryIfd8Array(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var data, ma, mb, v2, v3 uintptr var err TIFFReadDirEntryErr var n Tuint32_t var _ /* count at bp+0 */ Tuint32_t var _ /* origdata at bp+4 */ uintptr _, _, _, _, _, _, _ = data, err, ma, mb, n, v2, v3 switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_LONG): fallthrough case int32(TIFF_LONG8): fallthrough case int32(TIFF_IFD): fallthrough case int32(TIFF_IFD8): default: return int32(TIFFReadDirEntryErrType) } err = _TIFFReadDirEntryArray(tls, tif, direntry, bp, uint32(8), bp+4) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 4)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(value)) = uintptr(0) return err } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_LONG8): fallthrough case int32(TIFF_IFD8): *(*uintptr)(unsafe.Pointer(value)) = *(*uintptr)(unsafe.Pointer(bp + 4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong8(tls, *(*uintptr)(unsafe.Pointer(value)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) } return int32(TIFFReadDirEntryErrOk) } data = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))*uint32(8))) if data == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) return int32(TIFFReadDirEntryErrAlloc) } switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_type) { case int32(TIFF_LONG): fallthrough case int32(TIFF_IFD): ma = *(*uintptr)(unsafe.Pointer(bp + 4)) mb = data n = uint32(0) for { if !(n < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma) } v2 = mb mb += 8 v3 = ma ma += 4 *(*Tuint64_t)(unsafe.Pointer(v2)) = uint64(*(*Tuint32_t)(unsafe.Pointer(v3))) goto _1 _1: ; n++ } break } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) *(*uintptr)(unsafe.Pointer(value)) = data return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryPersampleShort(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var err TIFFReadDirEntryErr var na, v1, v2 uintptr var nb Tuint16_t var _ /* m at bp+0 */ uintptr _, _, _, _, _ = err, na, nb, v1, v2 if (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_count < uint64((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel) { return int32(TIFFReadDirEntryErrCount) } err = _TIFFReadDirEntryShortArray(tls, tif, direntry, bp) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp)) == libc.UintptrFromInt32(0) { return err } na = *(*uintptr)(unsafe.Pointer(bp)) nb = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel v1 = na na += 2 *(*Tuint16_t)(unsafe.Pointer(value)) = *(*Tuint16_t)(unsafe.Pointer(v1)) nb-- for libc.Int32FromUint16(nb) > 0 { v2 = na na += 2 if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(v2))) != libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(value))) { err = int32(TIFFReadDirEntryErrPsdif) break } nb-- } X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) return err } func _TIFFReadDirEntryCheckedByte(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) { _ = tif *(*Tuint8_t)(unsafe.Pointer(value)) = *(*Tuint8_t)(unsafe.Pointer(direntry + 16)) } func _TIFFReadDirEntryCheckedSbyte(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) { _ = tif *(*Tint8_t)(unsafe.Pointer(value)) = *(*Tint8_t)(unsafe.Pointer(direntry + 16)) } func _TIFFReadDirEntryCheckedShort(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) { *(*Tuint16_t)(unsafe.Pointer(value)) = (*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_offset.Ftoff_short /* *value=*(uint16_t*)(&direntry->tdir_offset); */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, value) } } func _TIFFReadDirEntryCheckedSshort(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) { *(*Tint16_t)(unsafe.Pointer(value)) = *(*Tint16_t)(unsafe.Pointer(direntry + 16)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, value) } } func _TIFFReadDirEntryCheckedLong(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) { *(*Tuint32_t)(unsafe.Pointer(value)) = *(*Tuint32_t)(unsafe.Pointer(direntry + 16)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, value) } } func _TIFFReadDirEntryCheckedSlong(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) { *(*Tint32_t)(unsafe.Pointer(value)) = *(*Tint32_t)(unsafe.Pointer(direntry + 16)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, value) } } func _TIFFReadDirEntryCheckedLong8(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var err TIFFReadDirEntryErr var _ /* offset at bp+0 */ Tuint32_t _ = err if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp)) = *(*Tuint32_t)(unsafe.Pointer(&(*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_offset)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp) } err = _TIFFReadDirEntryData(tls, tif, uint64(*(*Tuint32_t)(unsafe.Pointer(bp))), int32(8), value) if err != int32(TIFFReadDirEntryErrOk) { return err } } else { *(*Tuint64_t)(unsafe.Pointer(value)) = *(*Tuint64_t)(unsafe.Pointer(direntry + 16)) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, value) } return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryCheckedSlong8(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var err TIFFReadDirEntryErr var _ /* offset at bp+0 */ Tuint32_t _ = err if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp)) = *(*Tuint32_t)(unsafe.Pointer(&(*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_offset)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp) } err = _TIFFReadDirEntryData(tls, tif, uint64(*(*Tuint32_t)(unsafe.Pointer(bp))), int32(8), value) if err != int32(TIFFReadDirEntryErrOk) { return err } } else { *(*Tint64_t)(unsafe.Pointer(value)) = *(*Tint64_t)(unsafe.Pointer(direntry + 16)) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, value) } return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryCheckedRational(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ TUInt64Aligned_t var _ /* offset at bp+8 */ Tuint32_t _ = err if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp + 8)) = *(*Tuint32_t)(unsafe.Pointer(&(*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_offset)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+8) } err = _TIFFReadDirEntryData(tls, tif, uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 8))), int32(8), bp) if err != int32(TIFFReadDirEntryErrOk) { return err } } else { *(*Tuint64_t)(unsafe.Pointer(bp)) = *(*Tuint64_t)(unsafe.Pointer(direntry + 16)) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, bp, int32(2)) } /* Not completely sure what we should do when m.i[1]==0, but some */ /* sanitizers do not like division by 0.0: */ /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */ if *(*Tuint32_t)(unsafe.Pointer(bp)) == uint32(0) || *(*Tuint32_t)(unsafe.Pointer(bp + 1*4)) == uint32(0) { *(*float64)(unsafe.Pointer(value)) = float64(0) } else { *(*float64)(unsafe.Pointer(value)) = float64(*(*Tuint32_t)(unsafe.Pointer(bp))) / float64(*(*Tuint32_t)(unsafe.Pointer(bp + 1*4))) } return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryCheckedSrational(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var err TIFFReadDirEntryErr var _ /* m at bp+0 */ TUInt64Aligned_t var _ /* offset at bp+8 */ Tuint32_t _ = err if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp + 8)) = *(*Tuint32_t)(unsafe.Pointer(&(*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_offset)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+8) } err = _TIFFReadDirEntryData(tls, tif, uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 8))), int32(8), bp) if err != int32(TIFFReadDirEntryErrOk) { return err } } else { *(*Tuint64_t)(unsafe.Pointer(bp)) = *(*Tuint64_t)(unsafe.Pointer(direntry + 16)) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, bp, int32(2)) } /* Not completely sure what we should do when m.i[1]==0, but some */ /* sanitizers do not like division by 0.0: */ /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */ if libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))) == 0 || *(*Tuint32_t)(unsafe.Pointer(bp + 1*4)) == uint32(0) { *(*float64)(unsafe.Pointer(value)) = float64(0) } else { *(*float64)(unsafe.Pointer(value)) = float64(libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)))) / float64(*(*Tuint32_t)(unsafe.Pointer(bp + 1*4))) } return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryCheckedFloat(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* float_union at bp+0 */ struct { Fi [0]Tuint32_t Ff float32 } *(*Tuint32_t)(unsafe.Pointer(bp)) = *(*Tuint32_t)(unsafe.Pointer(direntry + 16)) *(*float32)(unsafe.Pointer(value)) = *(*float32)(unsafe.Pointer(bp)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, value) } } func _TIFFReadDirEntryCheckedDouble(tls *libc.TLS, tif uintptr, direntry uintptr, value uintptr) (r TIFFReadDirEntryErr) { bp := tls.Alloc(16) defer tls.Free(16) var err TIFFReadDirEntryErr var _ /* offset at bp+0 */ Tuint32_t var _ /* uint64_union at bp+8 */ TUInt64Aligned_t _ = err if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp)) = *(*Tuint32_t)(unsafe.Pointer(&(*TTIFFDirEntry)(unsafe.Pointer(direntry)).Ftdir_offset)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp) } err = _TIFFReadDirEntryData(tls, tif, uint64(*(*Tuint32_t)(unsafe.Pointer(bp))), int32(8), value) if err != int32(TIFFReadDirEntryErrOk) { return err } } else { *(*Tuint64_t)(unsafe.Pointer(bp + 8)) = *(*Tuint64_t)(unsafe.Pointer(direntry + 16)) *(*float64)(unsafe.Pointer(value)) = *(*float64)(unsafe.Pointer(bp + 8)) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, value) } return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryCheckRangeByteSbyte(tls *libc.TLS, value Tint8_t) (r TIFFReadDirEntryErr) { if int32(value) < 0 { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeByteShort(tls *libc.TLS, value Tuint16_t) (r TIFFReadDirEntryErr) { if libc.Int32FromUint16(value) > int32(0xFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeByteSshort(tls *libc.TLS, value Tint16_t) (r TIFFReadDirEntryErr) { if int32(value) < 0 || int32(value) > int32(0xFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeByteLong(tls *libc.TLS, value Tuint32_t) (r TIFFReadDirEntryErr) { if value > uint32(0xFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeByteSlong(tls *libc.TLS, value Tint32_t) (r TIFFReadDirEntryErr) { if value < 0 || value > int32(0xFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeByteLong8(tls *libc.TLS, value Tuint64_t) (r TIFFReadDirEntryErr) { if value > uint64(0xFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeByteSlong8(tls *libc.TLS, value Tint64_t) (r TIFFReadDirEntryErr) { if value < 0 || value > int64(0xFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSbyteByte(tls *libc.TLS, value Tuint8_t) (r TIFFReadDirEntryErr) { if libc.Int32FromUint8(value) > int32(0x7F) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSbyteShort(tls *libc.TLS, value Tuint16_t) (r TIFFReadDirEntryErr) { if libc.Int32FromUint16(value) > int32(0x7F) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSbyteSshort(tls *libc.TLS, value Tint16_t) (r TIFFReadDirEntryErr) { if int32(value) < -int32(0x80) || int32(value) > int32(0x7F) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSbyteLong(tls *libc.TLS, value Tuint32_t) (r TIFFReadDirEntryErr) { if value > uint32(0x7F) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSbyteSlong(tls *libc.TLS, value Tint32_t) (r TIFFReadDirEntryErr) { if value < -int32(0x80) || value > int32(0x7F) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSbyteLong8(tls *libc.TLS, value Tuint64_t) (r TIFFReadDirEntryErr) { if value > uint64(0x7F) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSbyteSlong8(tls *libc.TLS, value Tint64_t) (r TIFFReadDirEntryErr) { if value < int64(-int32(0x80)) || value > int64(0x7F) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeShortSbyte(tls *libc.TLS, value Tint8_t) (r TIFFReadDirEntryErr) { if int32(value) < 0 { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeShortSshort(tls *libc.TLS, value Tint16_t) (r TIFFReadDirEntryErr) { if int32(value) < 0 { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeShortLong(tls *libc.TLS, value Tuint32_t) (r TIFFReadDirEntryErr) { if value > uint32(0xFFFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeShortSlong(tls *libc.TLS, value Tint32_t) (r TIFFReadDirEntryErr) { if value < 0 || value > int32(0xFFFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeShortLong8(tls *libc.TLS, value Tuint64_t) (r TIFFReadDirEntryErr) { if value > uint64(0xFFFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeShortSlong8(tls *libc.TLS, value Tint64_t) (r TIFFReadDirEntryErr) { if value < 0 || value > int64(0xFFFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSshortShort(tls *libc.TLS, value Tuint16_t) (r TIFFReadDirEntryErr) { if libc.Int32FromUint16(value) > int32(0x7FFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSshortLong(tls *libc.TLS, value Tuint32_t) (r TIFFReadDirEntryErr) { if value > uint32(0x7FFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSshortSlong(tls *libc.TLS, value Tint32_t) (r TIFFReadDirEntryErr) { if value < -int32(0x8000) || value > int32(0x7FFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSshortLong8(tls *libc.TLS, value Tuint64_t) (r TIFFReadDirEntryErr) { if value > uint64(0x7FFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSshortSlong8(tls *libc.TLS, value Tint64_t) (r TIFFReadDirEntryErr) { if value < int64(-int32(0x8000)) || value > int64(0x7FFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeLongSbyte(tls *libc.TLS, value Tint8_t) (r TIFFReadDirEntryErr) { if int32(value) < 0 { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeLongSshort(tls *libc.TLS, value Tint16_t) (r TIFFReadDirEntryErr) { if int32(value) < 0 { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeLongSlong(tls *libc.TLS, value Tint32_t) (r TIFFReadDirEntryErr) { if value < 0 { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeLongLong8(tls *libc.TLS, value Tuint64_t) (r TIFFReadDirEntryErr) { if value > uint64(libc.Uint32FromUint32(0xffffffff)) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeLongSlong8(tls *libc.TLS, value Tint64_t) (r TIFFReadDirEntryErr) { if value < 0 || value > libc.Int64FromUint32(libc.Uint32FromUint32(0xffffffff)) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSlongLong(tls *libc.TLS, value Tuint32_t) (r TIFFReadDirEntryErr) { if value > uint32(0x7FFFFFFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } // C documentation // // /* Check that the 8-byte unsigned value can fit in a 4-byte unsigned range */ func _TIFFReadDirEntryCheckRangeSlongLong8(tls *libc.TLS, value Tuint64_t) (r TIFFReadDirEntryErr) { if value > uint64(0x7FFFFFFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } // C documentation // // /* Check that the 8-byte signed value can fit in a 4-byte signed range */ func _TIFFReadDirEntryCheckRangeSlongSlong8(tls *libc.TLS, value Tint64_t) (r TIFFReadDirEntryErr) { if value < libc.Int64FromInt32(0)-(libc.Int64FromInt32(0x7FFFFFFF)+libc.Int64FromInt32(1)) || value > int64(0x7FFFFFFF) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeLong8Sbyte(tls *libc.TLS, value Tint8_t) (r TIFFReadDirEntryErr) { if int32(value) < 0 { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeLong8Sshort(tls *libc.TLS, value Tint16_t) (r TIFFReadDirEntryErr) { if int32(value) < 0 { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeLong8Slong(tls *libc.TLS, value Tint32_t) (r TIFFReadDirEntryErr) { if value < 0 { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeLong8Slong8(tls *libc.TLS, value Tint64_t) (r TIFFReadDirEntryErr) { if value < 0 { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryCheckRangeSlong8Long8(tls *libc.TLS, value Tuint64_t) (r TIFFReadDirEntryErr) { if value > libc.Uint64FromInt64(libc.Int64FromInt64(INT64_MAX1)) { return int32(TIFFReadDirEntryErrRange) } else { return int32(TIFFReadDirEntryErrOk) } return r } func _TIFFReadDirEntryData(tls *libc.TLS, tif uintptr, offset Tuint64_t, size Ttmsize_t, dest uintptr) (r TIFFReadDirEntryErr) { var ma, mb Tsize_t _, _ = ma, mb if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00800) != libc.Uint32FromInt32(0)) { if !(X_TIFFSeekOK(tls, tif, offset) != 0) { return int32(TIFFReadDirEntryErrIo) } if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, dest, size) == size) { return int32(TIFFReadDirEntryErrIo) } } else { ma = uint32(offset) if uint64(ma) != offset || ma > ^libc.Uint32FromInt32(0)-libc.Uint32FromInt32(size) { return int32(TIFFReadDirEntryErrIo) } mb = ma + libc.Uint32FromInt32(size) if uint64(mb) > libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_size) { return int32(TIFFReadDirEntryErrIo) } X_TIFFmemcpy(tls, dest, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(ma), size) } return int32(TIFFReadDirEntryErrOk) } func _TIFFReadDirEntryOutputErr(tls *libc.TLS, tif uintptr, err TIFFReadDirEntryErr, module uintptr, tagname uintptr, recover1 int32) { bp := tls.Alloc(16) defer tls.Free(16) if !(recover1 != 0) { switch err { case int32(TIFFReadDirEntryErrCount): XTIFFErrorExtR(tls, tif, module, __ccgo_ts+29740, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrType): XTIFFErrorExtR(tls, tif, module, __ccgo_ts+29765, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrIo): XTIFFErrorExtR(tls, tif, module, __ccgo_ts+29792, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrRange): XTIFFErrorExtR(tls, tif, module, __ccgo_ts+29824, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrPsdif): XTIFFErrorExtR(tls, tif, module, __ccgo_ts+29849, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrSizesan): XTIFFErrorExtR(tls, tif, module, __ccgo_ts+29900, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrAlloc): XTIFFErrorExtR(tls, tif, module, __ccgo_ts+29942, libc.VaList(bp+8, tagname)) default: /* we should never get here */ break } } else { switch err { case int32(TIFFReadDirEntryErrCount): XTIFFWarningExtR(tls, tif, module, __ccgo_ts+29972, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrType): XTIFFWarningExtR(tls, tif, module, __ccgo_ts+30010, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrIo): XTIFFWarningExtR(tls, tif, module, __ccgo_ts+30050, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrRange): XTIFFWarningExtR(tls, tif, module, __ccgo_ts+30095, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrPsdif): XTIFFWarningExtR(tls, tif, module, __ccgo_ts+30133, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrSizesan): XTIFFWarningExtR(tls, tif, module, __ccgo_ts+30197, libc.VaList(bp+8, tagname)) case int32(TIFFReadDirEntryErrAlloc): XTIFFWarningExtR(tls, tif, module, __ccgo_ts+30252, libc.VaList(bp+8, tagname)) default: /* we should never get here */ break } } } // C documentation // // /* // * Return the maximum number of color channels specified for a given photometric // * type. 0 is returned if photometric type isn't supported or no default value // * is defined by the specification. // */ func __TIFFGetMaxColorChannels(tls *libc.TLS, photometric Tuint16_t) (r int32) { switch libc.Int32FromUint16(photometric) { case int32(PHOTOMETRIC_PALETTE): fallthrough case PHOTOMETRIC_MINISWHITE: fallthrough case int32(PHOTOMETRIC_MINISBLACK): return int32(1) case int32(PHOTOMETRIC_YCBCR): fallthrough case int32(PHOTOMETRIC_RGB): fallthrough case int32(PHOTOMETRIC_CIELAB): fallthrough case int32(PHOTOMETRIC_LOGLUV): fallthrough case int32(PHOTOMETRIC_ITULAB): fallthrough case int32(PHOTOMETRIC_ICCLAB): return int32(3) case int32(PHOTOMETRIC_SEPARATED): fallthrough case int32(PHOTOMETRIC_MASK): return int32(4) case int32(PHOTOMETRIC_LOGL): fallthrough case int32(PHOTOMETRIC_CFA): fallthrough default: return 0 } return r } func _ByteCountLooksBad(tls *libc.TLS, tif uintptr) (r int32) { var bytecount, filesize, offset, scanlinesize Tuint64_t _, _, _, _ = bytecount, filesize, offset, scanlinesize /* * Assume we have wrong StripByteCount value (in case * of single strip) in following cases: * - it is equal to zero along with StripOffset; * - it is larger than file itself (in case of uncompressed * image); * - it is smaller than the size of the bytes per row * multiplied on the number of rows. The last case should * not be checked in the case of writing new image, * because we may do not know the exact strip size * until the whole image will be written and directory * dumped out. */ bytecount = XTIFFGetStrileByteCount(tls, tif, uint32(0)) offset = XTIFFGetStrileOffset(tls, tif, uint32(0)) if offset == uint64(0) { return 0 } if bytecount == uint64(0) { return int32(1) } if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) != int32(COMPRESSION_NONE) { return 0 } filesize = (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) if offset <= filesize && bytecount > filesize-offset { return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY3 { scanlinesize = XTIFFScanlineSize64(tls, tif) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagelength > uint32(0) && scanlinesize > uint64(0xffffffffffffffff)/uint64((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagelength) { return int32(1) } if bytecount < scanlinesize*uint64((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagelength) { return int32(1) } } return 0 } // C documentation // // /* // * To evaluate the IFD data size when reading, save the offset and data size of // * all data that does not fit into the IFD entries themselves. // */ func _EvaluateIFDdatasizeReading(tls *libc.TLS, tif uintptr, dp uintptr) (r uint8) { bp := tls.Alloc(16) defer tls.Free(16) var data_width, datalength Tuint64_t var v1 uint32 var _ /* offset at bp+0 */ Tuint32_t _, _, _ = data_width, datalength, v1 data_width = libc.Uint64FromInt32(XTIFFDataWidth(tls, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type))) if data_width != uint64(0) && (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xffffffffffffffff)/data_width { XTIFFErrorExtR(tls, tif, __ccgo_ts+30295, __ccgo_ts+30322, 0) return uint8(false1) } datalength = (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count * data_width if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { v1 = uint32(0x8) } else { v1 = uint32(0x4) } if datalength > uint64(v1) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_read > uint64(0xffffffffffffffff)-datalength { XTIFFErrorExtR(tls, tif, __ccgo_ts+30295, __ccgo_ts+30322, 0) return uint8(false1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_read += datalength if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { /* The offset of TIFFDirEntry are not swapped when read in. That has * to be done when used. */ *(*Tuint32_t)(unsafe.Pointer(bp)) = *(*Tuint32_t)(unsafe.Pointer(&(*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_offset)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp) } (*(*TTIFFEntryOffsetAndLength)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets + uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_Noffsets)*16))).Foffset = uint64(*(*Tuint32_t)(unsafe.Pointer(bp))) } else { (*(*TTIFFEntryOffsetAndLength)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets + uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_Noffsets)*16))).Foffset = *(*Tuint64_t)(unsafe.Pointer(dp + 16)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets+uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_Noffsets)*16) } } (*(*TTIFFEntryOffsetAndLength)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets + uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_Noffsets)*16))).Flength = datalength (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_Noffsets++ } return uint8(true1) } // C documentation // // /* // * Compare function for qsort() sorting TIFFEntryOffsetAndLength array entries. // */ func _cmpTIFFEntryOffsetAndLength(tls *libc.TLS, a uintptr, b uintptr) (r int32) { var ta, tb uintptr _, _ = ta, tb ta = a tb = b /* Compare offsets */ if (*TTIFFEntryOffsetAndLength)(unsafe.Pointer(ta)).Foffset > (*TTIFFEntryOffsetAndLength)(unsafe.Pointer(tb)).Foffset { return int32(1) } else { if (*TTIFFEntryOffsetAndLength)(unsafe.Pointer(ta)).Foffset < (*TTIFFEntryOffsetAndLength)(unsafe.Pointer(tb)).Foffset { return -int32(1) } else { return 0 } } return r } // C documentation // // /* // * Determine the IFD data size after reading an IFD from the file that can be // * overwritten and saving it in tif_dir.td_dirdatasize_read. This data size // * includes the IFD entries themselves as well as the data that does not fit // * directly into the IFD entries but is located directly after the IFD entries // * in the file. // */ func _CalcFinalIFDdatasizeReading(tls *libc.TLS, tif uintptr, dircount Tuint16_t) { var IFDendoffset, offset, size Tuint64_t var i Tuint32_t _, _, _, _ = IFDendoffset, i, offset, size /* IFD data size is only needed if file-writing is enabled. * This also avoids the seek() to EOF to determine the file size, which * causes the stdin-streaming-friendly mode of libtiff for GDAL to fail. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY3 { return } /* Sort TIFFEntryOffsetAndLength array in ascending order. */ libc.Xqsort(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_Noffsets, uint32(16), __ccgo_fp(_cmpTIFFEntryOffsetAndLength)) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { IFDendoffset = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff + uint64(2) + libc.Uint64FromInt32(libc.Int32FromUint16(dircount)*int32(12)) + uint64(4) } else { IFDendoffset = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff + uint64(8) + libc.Uint64FromInt32(libc.Int32FromUint16(dircount)*int32(20)) + uint64(8) } /* Check which offsets are right behind IFD entries. However, LibTIFF * increments the writing address for every external data to an even offset. * Thus gaps of 1 byte can occur. */ size = uint64(0) i = uint32(0) for { if !(i < (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_Noffsets) { break } offset = (*(*TTIFFEntryOffsetAndLength)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets + uintptr(i)*16))).Foffset if offset == IFDendoffset { size += (*(*TTIFFEntryOffsetAndLength)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets + uintptr(i)*16))).Flength IFDendoffset += (*(*TTIFFEntryOffsetAndLength)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets + uintptr(i)*16))).Flength } else { if offset == IFDendoffset+uint64(1) { /* Add gap byte after previous IFD data set. */ size += (*(*TTIFFEntryOffsetAndLength)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets + uintptr(i)*16))).Flength + uint64(1) IFDendoffset += (*(*TTIFFEntryOffsetAndLength)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets + uintptr(i)*16))).Flength } else { /* Further data is no more continuously after IFD */ break } } goto _1 _1: ; i++ } /* Check for gap byte of some easy cases. This should cover 90% of cases. * Otherwise, IFD will be re-written even it might be safely overwritten. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff != uint64(0) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff == IFDendoffset+uint64(1) { size++ } } else { /* Check for IFD data ends at EOF. Then IFD can always be safely * overwritten. */ offset = (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(0)), int32(2)) if offset == IFDendoffset { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_read = libc.Uint64FromUint64(0xffffffffffffffff) return } } /* Finally, add the size of the IFD tag entries themselves. */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_read = libc.Uint64FromInt32(int32(2)+libc.Int32FromUint16(dircount)*int32(12)+int32(4)) + size } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_read = libc.Uint64FromInt32(int32(8)+libc.Int32FromUint16(dircount)*int32(20)+int32(8)) + size } } /*-- CalcFinalIFDdatasizeReading() --*/ // C documentation // // /* // * Read the next TIFF directory from a file and convert it to the internal // * format. We read directories sequentially. // */ func XTIFFReadDirectory(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var bitspersample_read, color_channels, m int32 var countpersample, countrequired, incrementpersample, saved_flags, value3 Tuint32_t var di, dircount, mb, nb, old_extrasamples Tuint16_t var dp, fip, fld, ma, na, new_sampleinfo, v10, v11, v12, v13, v14, v6, v7, v8, v9 uintptr var err, err1, err2, err3 TIFFReadDirEntryErr var nextdiroff Ttoff_t var v1 uint32 var _ /* data at bp+12 */ uintptr var _ /* dir at bp+0 */ uintptr var _ /* fii at bp+4 */ Tuint32_t var _ /* value at bp+10 */ Tuint16_t var _ /* value at bp+16 */ uintptr var _ /* value at bp+8 */ Tuint16_t var _ /* valueo at bp+20 */ Tuint16_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bitspersample_read, color_channels, countpersample, countrequired, di, dircount, dp, err, err1, err2, err3, fip, fld, incrementpersample, m, ma, mb, na, nb, new_sampleinfo, nextdiroff, old_extrasamples, saved_flags, value3, v1, v10, v11, v12, v13, v14, v6, v7, v8, v9 *(*Tuint32_t)(unsafe.Pointer(bp + 4)) = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) bitspersample_read = FALSE if (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff == uint64(0) { /* In this special case, tif_diroff needs also to be set to 0. * This is behind the last IFD, thus no checking or reading necessary. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff return 0 } nextdiroff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff /* tif_curdir++ and tif_nextdiroff should only be updated after SUCCESSFUL * reading of the directory. Otherwise, invalid IFD offsets could corrupt * the IFD list. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir == uint32(0xffffffff) { v1 = uint32(0) } else { v1 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir + uint32(1) } if !(X_TIFFCheckDirNumberAndOffset(tls, tif, v1, nextdiroff) != 0) { return 0 /* bad offset (IFD looping or more than TIFF_MAX_DIR_COUNT IFDs) */ } dircount = _TIFFFetchDirectory(tls, tif, nextdiroff, bp, tif+24) if !(dircount != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30346, libc.VaList(bp+32, nextdiroff)) return 0 } /* Set global values after a valid directory has been fetched. * tif_diroff is already set to nextdiroff in TIFFFetchDirectory() in the * beginning. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir == uint32(0xffffffff) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir++ } _TIFFReadDirectoryCheckOrder(tls, tif, *(*uintptr)(unsafe.Pointer(bp)), dircount) /* * Mark duplicates of any tag to be ignored (bugzilla 1994) * to avoid certain pathological problems. */ ma = *(*uintptr)(unsafe.Pointer(bp)) mb = libc.Uint16FromInt32(0) for { if !(libc.Int32FromUint16(mb) < libc.Int32FromUint16(dircount)) { break } na = ma + uintptr(1)*32 nb = libc.Uint16FromInt32(libc.Int32FromUint16(mb) + libc.Int32FromInt32(1)) for { if !(libc.Int32FromUint16(nb) < libc.Int32FromUint16(dircount)) { break } if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(ma)).Ftdir_tag) == libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(na)).Ftdir_tag) { (*TTIFFDirEntry)(unsafe.Pointer(na)).Ftdir_ignore = uint8(TRUE) } goto _3 _3: ; na += 32 nb++ } goto _2 _2: ; ma += 32 mb++ } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00040) /* reset before new dir */ *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x100000) /* reset before new dir */ *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x4000000) /* free any old stuff and reinit */ (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup})))(tls, tif) /* cleanup any previous compression state */ XTIFFFreeDirectory(tls, tif) XTIFFDefaultDirectory(tls, tif) /* After setup a fresh directory indicate that now active IFD is also * present on file, even if its entries could not be read successfully * below. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_iswrittentofile = uint8(TRUE) /* Allocate arrays for offset values outside IFD entry for IFD data size * checking. Note: Counter are reset within TIFFFreeDirectory(). */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32(dircount)*uint32(16))) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30386, 0) goto bad } /* * Electronic Arts writes gray-scale TIFF files * without a PlanarConfiguration directory entry. * Thus we setup a default value here, even though * the TIFF spec says there is no default value. * After PlanarConfiguration is preset in TIFFDefaultDirectory() * the following setting is not needed, but does not harm either. */ XTIFFSetField(tls, tif, uint32(TIFFTAG_PLANARCONFIG), libc.VaList(bp+32, int32(PLANARCONFIG_CONTIG))) /* * Setup default value and then make a pass over * the fields to check type and tag information, * and to extract info required to size data * structures. A second pass is made afterwards * to read in everything not taken in the first pass. * But we must process the Compression tag first * in order to merge in codec-private tag definitions (otherwise * we may get complaints about unknown tags). However, the * Compression tag may be dependent on the SamplesPerPixel * tag value because older TIFF specs permitted Compression * to be written as a SamplesPerPixel-count tag entry. * Thus if we don't first figure out the correct SamplesPerPixel * tag value then we may end up ignoring the Compression tag * value because it has an incorrect count value (if the * true value of SamplesPerPixel is not 1). */ dp = _TIFFReadDirectoryFindEntry(tls, tif, *(*uintptr)(unsafe.Pointer(bp)), dircount, uint16(TIFFTAG_SAMPLESPERPIXEL)) if dp != 0 { if !(_TIFFFetchNormalTag(tls, tif, dp, 0) != 0) { goto bad } (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore = uint8(TRUE) } dp = _TIFFReadDirectoryFindEntry(tls, tif, *(*uintptr)(unsafe.Pointer(bp)), dircount, uint16(TIFFTAG_COMPRESSION)) if dp != 0 { err = _TIFFReadDirEntryShort(tls, tif, dp, bp+8) if err == int32(TIFFReadDirEntryErrCount) { err = _TIFFReadDirEntryPersampleShort(tls, tif, dp, bp+8) } if err != int32(TIFFReadDirEntryErrOk) { _TIFFReadDirEntryOutputErr(tls, tif, err, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+22917, 0) goto bad } if !(XTIFFSetField(tls, tif, uint32(TIFFTAG_COMPRESSION), libc.VaList(bp+32, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 8))))) != 0) { goto bad } (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore = uint8(TRUE) } else { if !(XTIFFSetField(tls, tif, uint32(TIFFTAG_COMPRESSION), libc.VaList(bp+32, int32(COMPRESSION_NONE))) != 0) { goto bad } } /* * First real pass over the directory. */ di = uint16(0) dp = *(*uintptr)(unsafe.Pointer(bp)) for { if !(libc.Int32FromUint16(di) < libc.Int32FromUint16(dircount)) { break } if !((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore != 0) { _TIFFReadDirectoryFindFieldInfo(tls, tif, (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag, bp+4) if *(*Tuint32_t)(unsafe.Pointer(bp + 4)) == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30450, libc.VaList(bp+32, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag))) /* the following knowingly leaks the anonymous field structure */ fld = X_TIFFCreateAnonField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type)) if fld == libc.UintptrFromInt32(0) || !(X_TIFFMergeFields(tls, tif, fld, uint32(1)) != 0) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30495, libc.VaList(bp+32, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag))) (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore = uint8(TRUE) } else { _TIFFReadDirectoryFindFieldInfo(tls, tif, (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag, bp+4) } } } if !((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore != 0) { fip = *(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(*(*Tuint32_t)(unsafe.Pointer(bp + 4)))*4)) if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) == FIELD_IGNORE { (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore = uint8(TRUE) } else { switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag) { case int32(TIFFTAG_STRIPOFFSETS): fallthrough case int32(TIFFTAG_STRIPBYTECOUNTS): fallthrough case int32(TIFFTAG_TILEOFFSETS): fallthrough case int32(TIFFTAG_TILEBYTECOUNTS): *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit)/int32(32))*4)) |= libc.Uint32FromInt32(1) << (libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) & libc.Int32FromInt32(0x1f)) case int32(TIFFTAG_IMAGEWIDTH): fallthrough case int32(TIFFTAG_IMAGELENGTH): fallthrough case int32(TIFFTAG_IMAGEDEPTH): fallthrough case int32(TIFFTAG_TILELENGTH): fallthrough case int32(TIFFTAG_TILEWIDTH): fallthrough case int32(TIFFTAG_TILEDEPTH): fallthrough case int32(TIFFTAG_PLANARCONFIG): fallthrough case int32(TIFFTAG_ROWSPERSTRIP): fallthrough case int32(TIFFTAG_EXTRASAMPLES): if !(_TIFFFetchNormalTag(tls, tif, dp, 0) != 0) { goto bad } (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore = uint8(TRUE) default: if !(X_TIFFCheckFieldIsValidForCodec(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag)) != 0) { (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore = uint8(TRUE) } break } } } goto _4 _4: ; di++ dp += 32 } /* * XXX: OJPEG hack. * If a) compression is OJPEG, b) planarconfig tag says it's separate, * c) strip offsets/bytecounts tag are both present and * d) both contain exactly one value, then we consistently find * that the buggy implementation of the buggy compression scheme * matches contig planarconfig best. So we 'fix-up' the tag here */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_OJPEG) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { if !(X_TIFFFillStriles(tls, tif) != 0) { goto bad } dp = _TIFFReadDirectoryFindEntry(tls, tif, *(*uintptr)(unsafe.Pointer(bp)), dircount, uint16(TIFFTAG_STRIPOFFSETS)) if dp != uintptr(0) && (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count == uint64(1) { dp = _TIFFReadDirectoryFindEntry(tls, tif, *(*uintptr)(unsafe.Pointer(bp)), dircount, uint16(TIFFTAG_STRIPBYTECOUNTS)) if dp != uintptr(0) && (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count == uint64(1) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_planarconfig = uint16(PLANARCONFIG_CONTIG) XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30549, 0) } } } /* * Allocate directory structure and setup defaults. */ if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_IMAGEDIMENSIONS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_IMAGEDIMENSIONS)&libc.Int32FromInt32(0x1f))) != 0) { _MissingRequired(tls, tif, __ccgo_ts+22891) goto bad } /* * Second pass: extract other information. */ di = uint16(0) dp = *(*uintptr)(unsafe.Pointer(bp)) for { if !(libc.Int32FromUint16(di) < libc.Int32FromUint16(dircount)) { break } if !((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore != 0) { switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag) { case int32(TIFFTAG_MINSAMPLEVALUE): fallthrough case int32(TIFFTAG_MAXSAMPLEVALUE): fallthrough case int32(TIFFTAG_BITSPERSAMPLE): fallthrough case int32(TIFFTAG_DATATYPE): fallthrough case int32(TIFFTAG_SAMPLEFORMAT): /* * The MinSampleValue, MaxSampleValue, BitsPerSample * DataType and SampleFormat tags are supposed to be * written as one value/sample, but some vendors * incorrectly write one value only -- so we accept * that as well (yuck). Other vendors write correct * value for NumberOfSamples, but incorrect one for * BitsPerSample and friends, and we will read this * too. */ err1 = _TIFFReadDirEntryShort(tls, tif, dp, bp+10) if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { goto bad } if err1 == int32(TIFFReadDirEntryErrCount) { err1 = _TIFFReadDirEntryPersampleShort(tls, tif, dp, bp+10) } if err1 != int32(TIFFReadDirEntryErrOk) { fip = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag)) if fip != 0 { v6 = (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name } else { v6 = __ccgo_ts + 30633 } _TIFFReadDirEntryOutputErr(tls, tif, err1, uintptr(unsafe.Pointer(&_module6)), v6, 0) goto bad } if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+32, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 10))))) != 0) { goto bad } if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag) == int32(TIFFTAG_BITSPERSAMPLE) { bitspersample_read = int32(TRUE) } case int32(TIFFTAG_SMINSAMPLEVALUE): fallthrough case int32(TIFFTAG_SMAXSAMPLEVALUE): *(*uintptr)(unsafe.Pointer(bp + 12)) = libc.UintptrFromInt32(0) if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != uint64((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel) { err2 = int32(TIFFReadDirEntryErrCount) } else { err2 = _TIFFReadDirEntryDoubleArray(tls, tif, dp, bp+12) } if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { goto bad } if err2 != int32(TIFFReadDirEntryErrOk) { fip = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag)) if fip != 0 { v7 = (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name } else { v7 = __ccgo_ts + 30633 } _TIFFReadDirEntryOutputErr(tls, tif, err2, uintptr(unsafe.Pointer(&_module6)), v7, 0) goto bad } saved_flags = (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x400000) m = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 12)))) (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags = saved_flags X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 12))) if !(m != 0) { goto bad } case int32(TIFFTAG_STRIPOFFSETS): fallthrough case int32(TIFFTAG_TILEOFFSETS): switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type) { case int32(TIFF_SHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_LONG8): default: /* Warn except if directory typically created with * TIFFDeferStrileArrayWriting() */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == int32(O_RDWR1) && (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count == uint64(0) && libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type) == 0 && *(*Tuint64_t)(unsafe.Pointer(dp + 16)) == uint64(0)) { fip = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag)) if fip != 0 { v8 = (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name } else { v8 = __ccgo_ts + 30633 } XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30649, libc.VaList(bp+32, v8)) } break } X_TIFFmemcpy(tls, tif+56+144, dp, int32(32)) if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { goto bad } case int32(TIFFTAG_STRIPBYTECOUNTS): fallthrough case int32(TIFFTAG_TILEBYTECOUNTS): switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type) { case int32(TIFF_SHORT): fallthrough case int32(TIFF_LONG): fallthrough case int32(TIFF_LONG8): default: /* Warn except if directory typically created with * TIFFDeferStrileArrayWriting() */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == int32(O_RDWR1) && (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count == uint64(0) && libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type) == 0 && *(*Tuint64_t)(unsafe.Pointer(dp + 16)) == uint64(0)) { fip = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag)) if fip != 0 { v9 = (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name } else { v9 = __ccgo_ts + 30633 } XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30649, libc.VaList(bp+32, v9)) } break } X_TIFFmemcpy(tls, tif+56+176, dp, int32(32)) if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { goto bad } case int32(TIFFTAG_COLORMAP): fallthrough case int32(TIFFTAG_TRANSFERFUNCTION): *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0) /* It would be dangerous to instantiate those tag values */ /* since if td_bitspersample has not yet been read (due to */ /* unordered tags), it could be read afterwards with a */ /* values greater than the default one (1), which may cause */ /* crashes in user code */ if !(bitspersample_read != 0) { fip = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag)) if fip != 0 { v10 = (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name } else { v10 = __ccgo_ts + 30633 } XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30678, libc.VaList(bp+32, v10)) goto _5 } /* ColorMap or TransferFunction for high bit */ /* depths do not make much sense and could be */ /* used as a denial of service vector */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) > int32(24) { fip = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag)) if fip != 0 { v11 = (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name } else { v11 = __ccgo_ts + 30633 } XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30724, libc.VaList(bp+32, v11, libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample))) goto _5 } countpersample = libc.Uint32FromUint32(1) << (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag) == int32(TIFFTAG_TRANSFERFUNCTION) && (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count == uint64(countpersample) { countrequired = countpersample incrementpersample = uint32(0) } else { countrequired = uint32(3) * countpersample incrementpersample = countpersample } if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != uint64(countrequired) { err3 = int32(TIFFReadDirEntryErrCount) } else { err3 = _TIFFReadDirEntryShortArray(tls, tif, dp, bp+16) } if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { goto bad } if err3 != int32(TIFFReadDirEntryErrOk) { fip = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag)) if fip != 0 { v12 = (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name } else { v12 = __ccgo_ts + 30633 } _TIFFReadDirEntryOutputErr(tls, tif, err3, uintptr(unsafe.Pointer(&_module6)), v12, int32(1)) } else { XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 16))+uintptr(incrementpersample)*2, *(*uintptr)(unsafe.Pointer(bp + 16))+uintptr(uint32(2)*incrementpersample)*2)) X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 16))) } break /* BEGIN REV 4.0 COMPATIBILITY */ fallthrough case int32(TIFFTAG_OSUBFILETYPE): if _TIFFReadDirEntryShort(tls, tif, dp, bp+20) == int32(TIFFReadDirEntryErrOk) { switch libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 20))) { case int32(OFILETYPE_REDUCEDIMAGE): value3 = uint32(FILETYPE_REDUCEDIMAGE1) case int32(OFILETYPE_PAGE): value3 = uint32(FILETYPE_PAGE1) default: value3 = uint32(0) break } if value3 != uint32(0) { XTIFFSetField(tls, tif, uint32(TIFFTAG_SUBFILETYPE), libc.VaList(bp+32, value3)) } } break /* END REV 4.0 COMPATIBILITY */ fallthrough default: _TIFFFetchNormalTag(tls, tif, dp, int32(TRUE)) break } /* -- switch (dp->tdir_tag) -- */ } /* -- if (!dp->tdir_ignore) */ goto _5 _5: ; di++ dp += 32 } /* -- for-loop -- */ /* Evaluate final IFD data size. */ _CalcFinalIFDdatasizeReading(tls, tif, dircount) /* * OJPEG hack: * - If a) compression is OJPEG, and b) photometric tag is missing, * then we consistently find that photometric should be YCbCr * - If a) compression is OJPEG, and b) photometric tag says it's RGB, * then we consistently find that the buggy implementation of the * buggy compression scheme matches photometric YCbCr instead. * - If a) compression is OJPEG, and b) bitspersample tag is missing, * then we consistently find bitspersample should be 8. * - If a) compression is OJPEG, b) samplesperpixel tag is missing, * and c) photometric is RGB or YCbCr, then we consistently find * samplesperpixel should be 3 * - If a) compression is OJPEG, b) samplesperpixel tag is missing, * and c) photometric is MINISWHITE or MINISBLACK, then we consistently * find samplesperpixel should be 3 */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_OJPEG) { if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_PHOTOMETRIC)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_PHOTOMETRIC)&libc.Int32FromInt32(0x1f))) != 0) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30764, 0) if !(XTIFFSetField(tls, tif, uint32(TIFFTAG_PHOTOMETRIC), libc.VaList(bp+32, int32(PHOTOMETRIC_YCBCR))) != 0) { goto bad } } else { if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric) == int32(PHOTOMETRIC_RGB) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric = uint16(PHOTOMETRIC_YCBCR) XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30815, 0) } } if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_BITSPERSAMPLE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_BITSPERSAMPLE)&libc.Int32FromInt32(0x1f))) != 0) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30894, 0) if !(XTIFFSetField(tls, tif, uint32(TIFFTAG_BITSPERSAMPLE), libc.VaList(bp+32, int32(8))) != 0) { goto bad } } if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SAMPLESPERPIXEL)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SAMPLESPERPIXEL)&libc.Int32FromInt32(0x1f))) != 0) { if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric) == int32(PHOTOMETRIC_RGB) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+30951, 0) if !(XTIFFSetField(tls, tif, uint32(TIFFTAG_SAMPLESPERPIXEL), libc.VaList(bp+32, int32(3))) != 0) { goto bad } } if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric) == int32(PHOTOMETRIC_YCBCR) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+31027, 0) if !(XTIFFSetField(tls, tif, uint32(TIFFTAG_SAMPLESPERPIXEL), libc.VaList(bp+32, int32(3))) != 0) { goto bad } } else { if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric) == PHOTOMETRIC_MINISWHITE || libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric) == int32(PHOTOMETRIC_MINISBLACK) { /* * SamplesPerPixel tag is missing, but is not required * by spec. Assume correct SamplesPerPixel value of 1. */ if !(XTIFFSetField(tls, tif, uint32(TIFFTAG_SAMPLESPERPIXEL), libc.VaList(bp+32, int32(1))) != 0) { goto bad } } } } } /* * Setup appropriate structures (by strip or by tile) * We do that only after the above OJPEG hack which alters SamplesPerPixel * and thus influences the number of strips in the separate planarconfig. */ if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TILEDIMENSIONS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_TILEDIMENSIONS)&libc.Int32FromInt32(0x1f))) != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips = XTIFFNumberOfStrips(tls, tif) (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_tilewidth = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagewidth (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_tilelength = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_rowsperstrip (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_tiledepth = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagedepth *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00400) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips = XTIFFNumberOfTiles(tls, tif) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00400) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips != 0) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v13 = __ccgo_ts + 31103 } else { v13 = __ccgo_ts + 31109 } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+31116, libc.VaList(bp+32, v13)) goto bad } (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripsperimage = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripsperimage /= uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel) } if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_STRIPOFFSETS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_STRIPOFFSETS)&libc.Int32FromInt32(0x1f))) != 0) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v14 = __ccgo_ts + 23452 } else { v14 = __ccgo_ts + 23041 } _MissingRequired(tls, tif, v14) goto bad } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == int32(O_RDWR1) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_tag) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_count == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_type) == 0 && *(*Tuint64_t)(unsafe.Pointer(tif + 56 + 144 + 16)) == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_tag) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_count == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_type) == 0 && *(*Tuint64_t)(unsafe.Pointer(tif + 56 + 176 + 16)) == uint64(0) { /* Directory typically created with TIFFDeferStrileArrayWriting() */ XTIFFSetupStrips(tls, tif) } else { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x1000000) != 0) { if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_tag) != 0 { if !(_TIFFFetchStripThing(tls, tif, tif+56+144, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips, tif+56+132) != 0) { goto bad } } if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_tag) != 0 { if !(_TIFFFetchStripThing(tls, tif, tif+56+176, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips, tif+56+136) != 0) { goto bad } } } } /* * Make sure all non-color channels are extrasamples. * If it's not the case, define them as such. */ color_channels = __TIFFGetMaxColorChannels(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric) if color_channels != 0 && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel)-libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_extrasamples) > color_channels { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+31148, 0) old_extrasamples = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_extrasamples (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_extrasamples = libc.Uint16FromInt32(libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel) - color_channels) // sampleinfo should contain information relative to these new extra // samples new_sampleinfo = X_TIFFcallocExt(tls, tif, libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_extrasamples), int32(2)) if !(new_sampleinfo != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+31288, libc.VaList(bp+32, libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_extrasamples))) goto bad } if libc.Int32FromUint16(old_extrasamples) > 0 { libc.Xmemcpy(tls, new_sampleinfo, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_sampleinfo, uint32(old_extrasamples)*uint32(2)) } X_TIFFsetShortArrayExt(tls, tif, tif+56+120, new_sampleinfo, uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_extrasamples)) X_TIFFfreeExt(tls, tif, new_sampleinfo) } /* * Verify Palette image has a Colormap. */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric) == int32(PHOTOMETRIC_PALETTE) && !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_COLORMAP)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_COLORMAP)&libc.Int32FromInt32(0x1f))) != 0) { if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) >= int32(8) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel) == int32(3) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric = uint16(PHOTOMETRIC_RGB) } else { if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) >= int32(8) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric = uint16(PHOTOMETRIC_MINISBLACK) } else { _MissingRequired(tls, tif, __ccgo_ts+31370) goto bad } } } /* * OJPEG hack: * We do no further messing with strip/tile offsets/bytecounts in OJPEG * TIFFs */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) != int32(COMPRESSION_OJPEG) { /* * Attempt to deal with a missing StripByteCounts tag. */ if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_STRIPBYTECOUNTS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_STRIPBYTECOUNTS)&libc.Int32FromInt32(0x1f))) != 0) { /* * Some manufacturers violate the spec by not giving * the size of the strips. In this case, assume there * is one uncompressed strip of data. */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips > uint32(1) || libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips != uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel) { _MissingRequired(tls, tif, __ccgo_ts+23095) goto bad } XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+31379, 0) if _EstimateStripByteCounts(tls, tif, *(*uintptr)(unsafe.Pointer(bp)), dircount) < 0 { goto bad } } else { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips == uint32(1) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00400) != 0) && _ByteCountLooksBad(tls, tif) != 0 { /* * XXX: Plexus (and others) sometimes give a value of * zero for a tag when they don't know what the * correct value is! Try and handle the simple case * of estimating the size of a one strip image. */ XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+31468, 0) if _EstimateStripByteCounts(tls, tif, *(*uintptr)(unsafe.Pointer(bp)), dircount) < 0 { goto bad } } else { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x1000000) != 0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips > uint32(2) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_NONE) && XTIFFGetStrileByteCount(tls, tif, uint32(0)) != XTIFFGetStrileByteCount(tls, tif, uint32(1)) && XTIFFGetStrileByteCount(tls, tif, uint32(0)) != uint64(0) && XTIFFGetStrileByteCount(tls, tif, uint32(1)) != uint64(0) { /* * XXX: Some vendors fill StripByteCount array with * absolutely wrong values (it can be equal to * StripOffset array, for example). Catch this case * here. * * We avoid this check if deferring strile loading * as it would always force us to load the strip/tile * information. */ XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+31541, 0) if _EstimateStripByteCounts(tls, tif, *(*uintptr)(unsafe.Pointer(bp)), dircount) < 0 { goto bad } } } } } if *(*uintptr)(unsafe.Pointer(bp)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0) } if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_MAXSAMPLEVALUE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_MAXSAMPLEVALUE)&libc.Int32FromInt32(0x1f))) != 0) { if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) >= int32(16) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_maxsamplevalue = uint16(0xFFFF) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_maxsamplevalue = libc.Uint16FromInt32(libc.Int32FromInt32(1)<<(*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample - libc.Int32FromInt32(1)) } } /* * An opportunity for compression mode dependent tag fixup */ (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_fixuptags})))(tls, tif) /* * Some manufacturers make life difficult by writing * large amounts of uncompressed data as a single strip. * This is contrary to the recommendations of the spec. * The following makes an attempt at breaking such images * into strips closer to the recommended 8k bytes. A * side effect, however, is that the RowsPerStrip tag * value may be changed. */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips == uint32(1) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_NONE) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&(libc.Uint32FromUint32(0x08000)|libc.Uint32FromUint32(0x00400)) == uint32(0x08000) { _ChopUpSingleUncompressedStrip(tls, tif) } /* There are also uncompressed striped files with strips larger than */ /* 2 GB, which make them unfriendly with a lot of code. If possible, */ /* try to expose smaller "virtual" strips. */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_NONE) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&(libc.Uint32FromUint32(0x08000)|libc.Uint32FromUint32(0x00400)) == uint32(0x08000) && XTIFFStripSize64(tls, tif) > uint64(0x7FFFFFFF) { _TryChopUpUncompressedBigTiff(tls, tif) } /* * Clear the dirty directory flag. */ *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00008) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x200000) /* * Reinitialize i/o since we are starting on a new directory. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_col = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize = -libc.Int32FromInt32(1) (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize = XTIFFScanlineSize(tls, tif) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+31614, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize = XTIFFTileSize(tls, tif) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+31647, 0) return 0 } } else { if !(XTIFFStripSize(tls, tif) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module6)), __ccgo_ts+31676, 0) return 0 } } return int32(1) goto bad bad: ; if *(*uintptr)(unsafe.Pointer(bp)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) } return 0 } var _module6 = [18]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y'} /*-- TIFFReadDirectory() --*/ func _TIFFReadDirectoryCheckOrder(tls *libc.TLS, tif uintptr, dir uintptr, dircount Tuint16_t) { var m Tuint32_t var n Tuint16_t var o uintptr _, _, _ = m, n, o m = uint32(0) n = uint16(0) o = dir for { if !(libc.Int32FromUint16(n) < libc.Int32FromUint16(dircount)) { break } if uint32((*TTIFFDirEntry)(unsafe.Pointer(o)).Ftdir_tag) < m { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module7)), __ccgo_ts+31706, 0) break } m = libc.Uint32FromInt32(libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(o)).Ftdir_tag) + int32(1)) goto _1 _1: ; n++ o += 32 } } var _module7 = [28]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'C', 'h', 'e', 'c', 'k', 'O', 'r', 'd', 'e', 'r'} func _TIFFReadDirectoryFindEntry(tls *libc.TLS, tif uintptr, dir uintptr, dircount Tuint16_t, tagid Tuint16_t) (r uintptr) { var m uintptr var n Tuint16_t _, _ = m, n _ = tif m = dir n = libc.Uint16FromInt32(0) for { if !(libc.Int32FromUint16(n) < libc.Int32FromUint16(dircount)) { break } if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(m)).Ftdir_tag) == libc.Int32FromUint16(tagid) { return m } goto _1 _1: ; m += 32 n++ } return uintptr(libc.Int32FromInt32(0)) } func _TIFFReadDirectoryFindFieldInfo(tls *libc.TLS, tif uintptr, tagid Tuint16_t, fii uintptr) { var ma, mb, mc Tint32_t _, _, _ = ma, mb, mc ma = -int32(1) mc = libc.Int32FromUint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields) for int32(1) != 0 { if ma+int32(1) == mc { *(*Tuint32_t)(unsafe.Pointer(fii)) = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) return } mb = (ma + mc) / int32(2) if (*TTIFFField)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(mb)*4)))).Ffield_tag == uint32(tagid) { break } if (*TTIFFField)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(mb)*4)))).Ffield_tag < uint32(tagid) { ma = mb } else { mc = mb } } for int32(1) != 0 { if mb == 0 { break } if (*TTIFFField)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(mb-int32(1))*4)))).Ffield_tag != uint32(tagid) { break } mb-- } *(*Tuint32_t)(unsafe.Pointer(fii)) = libc.Uint32FromInt32(mb) } // C documentation // // /* // * Read custom directory from the arbitrary offset. // * The code is very similar to TIFFReadDirectory(). // */ func XTIFFReadCustomDirectory(tls *libc.TLS, tif uintptr, diroff Ttoff_t, infoarray uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var di, dircount, mb, nb Tuint16_t var dp, fip, fld, ma, na uintptr var expected Tuint32_t var _ /* dir at bp+0 */ uintptr var _ /* fii at bp+4 */ Tuint32_t _, _, _, _, _, _, _, _, _, _ = di, dircount, dp, expected, fip, fld, ma, mb, na, nb dircount = _TIFFFetchDirectory(tls, tif, diroff, bp, libc.UintptrFromInt32(0)) if !(dircount != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module8)), __ccgo_ts+31769, libc.VaList(bp+16, diroff)) return 0 } _TIFFReadDirectoryCheckOrder(tls, tif, *(*uintptr)(unsafe.Pointer(bp)), dircount) /* * Mark duplicates of any tag to be ignored (bugzilla 1994) * to avoid certain pathological problems. */ ma = *(*uintptr)(unsafe.Pointer(bp)) mb = libc.Uint16FromInt32(0) for { if !(libc.Int32FromUint16(mb) < libc.Int32FromUint16(dircount)) { break } na = ma + uintptr(1)*32 nb = libc.Uint16FromInt32(libc.Int32FromUint16(mb) + libc.Int32FromInt32(1)) for { if !(libc.Int32FromUint16(nb) < libc.Int32FromUint16(dircount)) { break } if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(ma)).Ftdir_tag) == libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(na)).Ftdir_tag) { (*TTIFFDirEntry)(unsafe.Pointer(na)).Ftdir_ignore = uint8(TRUE) } goto _2 _2: ; na += 32 nb++ } goto _1 _1: ; ma += 32 mb++ } /* Free any old stuff and reinit. */ (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup})))(tls, tif) /* cleanup any previous compression state */ XTIFFFreeDirectory(tls, tif) /* Even if custom directories do not need the default settings of a standard * IFD, the pointer to the TIFFSetField() and TIFFGetField() (i.e. * tif->tif_tagmethods.vsetfield and tif->tif_tagmethods.vgetfield) need to * be initialized, which is done in TIFFDefaultDirectory(). * After that, the field array for the custom tags needs to be setup again. */ XTIFFDefaultDirectory(tls, tif) X_TIFFSetupFields(tls, tif, infoarray) /* Allocate arrays for offset values outside IFD entry for IFD data size * checking. Note: Counter are reset within TIFFFreeDirectory(). */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32(dircount)*uint32(16))) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_offsets == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module8)), __ccgo_ts+30386, 0) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) } return 0 } di = uint16(0) dp = *(*uintptr)(unsafe.Pointer(bp)) for { if !(libc.Int32FromUint16(di) < libc.Int32FromUint16(dircount)) { break } _TIFFReadDirectoryFindFieldInfo(tls, tif, (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag, bp+4) if *(*Tuint32_t)(unsafe.Pointer(bp + 4)) == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module8)), __ccgo_ts+30450, libc.VaList(bp+16, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag))) fld = X_TIFFCreateAnonField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type)) if fld == libc.UintptrFromInt32(0) || !(X_TIFFMergeFields(tls, tif, fld, uint32(1)) != 0) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module8)), __ccgo_ts+30495, libc.VaList(bp+16, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag))) (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore = uint8(TRUE) } else { _TIFFReadDirectoryFindFieldInfo(tls, tif, (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag, bp+4) } } if !((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore != 0) { fip = *(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(*(*Tuint32_t)(unsafe.Pointer(bp + 4)))*4)) if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) == FIELD_IGNORE { (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore = uint8(TRUE) } else { /* check data type */ for (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type != int32(TIFF_NOTYPE) && (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type != libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type) { *(*Tuint32_t)(unsafe.Pointer(bp + 4))++ if *(*Tuint32_t)(unsafe.Pointer(bp + 4)) == (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields || (*TTIFFField)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(*(*Tuint32_t)(unsafe.Pointer(bp + 4)))*4)))).Ffield_tag != uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag) { *(*Tuint32_t)(unsafe.Pointer(bp + 4)) = uint32(0xFFFF) break } fip = *(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(*(*Tuint32_t)(unsafe.Pointer(bp + 4)))*4)) } if *(*Tuint32_t)(unsafe.Pointer(bp + 4)) == uint32(0xFFFF) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module8)), __ccgo_ts+31816, libc.VaList(bp+16, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type), (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore = uint8(TRUE) } else { /* check count if known in advance */ if int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) != -int32(1) && int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) != -int32(3) { if int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(2) { expected = uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel) } else { expected = libc.Uint32FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) } if !(_CheckDirCount(tls, tif, dp, expected) != 0) { (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore = uint8(TRUE) } } } } if !((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_ignore != 0) { switch libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag) { case int32(EXIFTAG_SUBJECTDISTANCE): if !(XTIFFFieldIsAnonymous(tls, fip) != 0) { /* should only be called on a Exif directory */ /* when exifFields[] is active */ _TIFFFetchSubjectDistance(tls, tif, dp) } else { _TIFFFetchNormalTag(tls, tif, dp, int32(TRUE)) } default: _TIFFFetchNormalTag(tls, tif, dp, int32(TRUE)) break } } /*-- if (!dp->tdir_ignore) */ } goto _3 _3: ; di++ dp += 32 } /* Evaluate final IFD data size. */ _CalcFinalIFDdatasizeReading(tls, tif, dircount) /* To be able to return from SubIFD or custom-IFD to main-IFD */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_setdirectory_force_absolute = int32(TRUE) if *(*uintptr)(unsafe.Pointer(bp)) != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) } return int32(1) } var _module8 = [24]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'C', 'u', 's', 't', 'o', 'm', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y'} // C documentation // // /* // * EXIF is important special case of custom IFD, so we have a special // * function to read it. // */ func XTIFFReadEXIFDirectory(tls *libc.TLS, tif uintptr, diroff Ttoff_t) (r int32) { return XTIFFReadCustomDirectory(tls, tif, diroff, X_TIFFGetExifFields(tls)) } // C documentation // // /* // *--: EXIF-GPS custom directory reading as another special case of custom IFD. // */ func XTIFFReadGPSDirectory(tls *libc.TLS, tif uintptr, diroff Ttoff_t) (r int32) { return XTIFFReadCustomDirectory(tls, tif, diroff, X_TIFFGetGpsFields(tls)) } func _EstimateStripByteCounts(tls *libc.TLS, tif uintptr, dir uintptr, dircount Tuint16_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var allocsize, bytespertile, datasize, filesize, rowbytes, space Tuint64_t var dp, td uintptr var n Tuint16_t var rowsperstrip, strip, typewidth Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _ = allocsize, bytespertile, datasize, dp, filesize, n, rowbytes, rowsperstrip, space, strip, td, typewidth td = tif + 56 /* Do not try to load stripbytecount as we will compute it */ if !(__TIFFFillStrilesInternal(tls, tif, 0) != 0) { return -int32(1) } allocsize = uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips) * uint64(8) filesize = uint64(0) if allocsize > libc.Uint64FromInt32(libc.Int32FromInt32(100)*libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) { /* Before allocating a huge amount of memory for corrupted files, check * if size of requested memory is not greater than file size. */ filesize = (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) if allocsize > filesize { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module9)), __ccgo_ts+31857, libc.VaList(bp+8, allocsize, filesize)) return -int32(1) } } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p != 0 { X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p) } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips), int32(8), __ccgo_ts+31959) if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p == libc.UintptrFromInt32(0) { return -int32(1) } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) != int32(COMPRESSION_NONE) { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { space = uint64(libc.Uint32FromInt64(8) + libc.Uint32FromInt32(2) + libc.Uint32FromInt32(libc.Int32FromUint16(dircount)*int32(12)) + uint32(4)) } else { space = uint64(libc.Uint32FromInt64(16) + libc.Uint32FromInt32(8) + libc.Uint32FromInt32(libc.Int32FromUint16(dircount)*int32(20)) + uint32(8)) } /* calculate amount of space used by indirect values */ dp = dir n = dircount for { if !(libc.Int32FromUint16(n) > 0) { break } typewidth = libc.Uint32FromInt32(XTIFFDataWidth(tls, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type))) if typewidth == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module9)), __ccgo_ts+31987, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type))) return -int32(1) } if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xffffffffffffffff)/uint64(typewidth) { return -int32(1) } datasize = uint64(typewidth) * (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { if datasize <= uint64(4) { datasize = uint64(0) } } else { if datasize <= uint64(8) { datasize = uint64(0) } } if space > uint64(0xffffffffffffffff)-datasize { return -int32(1) } space += datasize goto _1 _1: ; n-- dp += 32 } if filesize == uint64(0) { filesize = (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) } if filesize < space { /* we should perhaps return in error ? */ space = filesize } else { space = filesize - space } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { space /= uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } strip = uint32(0) for { if !(strip < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips) { break } *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) = space goto _2 _2: ; strip++ } /* * This gross hack handles the case were the offset to * the last strip is past the place where we think the strip * should begin. Since a strip of data must be contiguous, * it's safe to assume that we've overestimated the amount * of data in the strip and trim this number back accordingly. */ strip-- if *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8)) > uint64(0xffffffffffffffff)-*(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) { return -int32(1) } if *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8))+*(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) > filesize { if *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8)) >= filesize { /* Not sure what we should in that case... */ *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) = uint64(0) } else { *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) = filesize - *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8)) } } } else { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { bytespertile = XTIFFTileSize64(tls, tif) strip = uint32(0) for { if !(strip < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips) { break } *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) = bytespertile goto _3 _3: ; strip++ } } else { rowbytes = XTIFFScanlineSize64(tls, tif) rowsperstrip = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage strip = uint32(0) for { if !(strip < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips) { break } if rowbytes > uint64(0) && uint64(rowsperstrip) > uint64(0xffffffffffffffff)/rowbytes { return -int32(1) } *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) = rowbytes * uint64(rowsperstrip) goto _4 _4: ; strip++ } } } *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_STRIPBYTECOUNTS)/libc.Int32FromInt32(32))*4)) |= libc.Uint32FromInt32(1) << (libc.Int32FromInt32(FIELD_STRIPBYTECOUNTS) & libc.Int32FromInt32(0x1f)) if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_ROWSPERSTRIP)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_ROWSPERSTRIP)&libc.Int32FromInt32(0x1f))) != 0) { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength } return int32(1) } var _module9 = [24]uint8{'E', 's', 't', 'i', 'm', 'a', 't', 'e', 'S', 't', 'r', 'i', 'p', 'B', 'y', 't', 'e', 'C', 'o', 'u', 'n', 't', 's'} func _MissingRequired(tls *libc.TLS, tif uintptr, tagname uintptr) { bp := tls.Alloc(16) defer tls.Free(16) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module10)), __ccgo_ts+32032, libc.VaList(bp+8, tagname)) } var _module10 = [16]uint8{'M', 'i', 's', 's', 'i', 'n', 'g', 'R', 'e', 'q', 'u', 'i', 'r', 'e', 'd'} func _hashFuncOffsetToNumber(tls *libc.TLS, elt uintptr) (r uint32) { var hash Tuint32_t var offsetAndDirNumber uintptr _, _ = hash, offsetAndDirNumber offsetAndDirNumber = elt hash = uint32((*TTIFFOffsetAndDirNumber)(unsafe.Pointer(offsetAndDirNumber)).Foffset>>libc.Int32FromInt32(32)) ^ uint32((*TTIFFOffsetAndDirNumber)(unsafe.Pointer(offsetAndDirNumber)).Foffset)&uint32(0xFFFFFFFF) return hash } func _equalFuncOffsetToNumber(tls *libc.TLS, elt1 uintptr, elt2 uintptr) (r uint8) { var offsetAndDirNumber1, offsetAndDirNumber2 uintptr _, _ = offsetAndDirNumber1, offsetAndDirNumber2 offsetAndDirNumber1 = elt1 offsetAndDirNumber2 = elt2 return libc.BoolUint8((*TTIFFOffsetAndDirNumber)(unsafe.Pointer(offsetAndDirNumber1)).Foffset == (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(offsetAndDirNumber2)).Foffset) } func _hashFuncNumberToOffset(tls *libc.TLS, elt uintptr) (r uint32) { var offsetAndDirNumber uintptr _ = offsetAndDirNumber offsetAndDirNumber = elt return (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(offsetAndDirNumber)).FdirNumber } func _equalFuncNumberToOffset(tls *libc.TLS, elt1 uintptr, elt2 uintptr) (r uint8) { var offsetAndDirNumber1, offsetAndDirNumber2 uintptr _, _ = offsetAndDirNumber1, offsetAndDirNumber2 offsetAndDirNumber1 = elt1 offsetAndDirNumber2 = elt2 return libc.BoolUint8((*TTIFFOffsetAndDirNumber)(unsafe.Pointer(offsetAndDirNumber1)).FdirNumber == (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(offsetAndDirNumber2)).FdirNumber) } // C documentation // // /* // * Check the directory number and offset against the list of already seen // * directory numbers and offsets. This is a trick to prevent IFD looping. // * The one can create TIFF file with looped directory pointers. We will // * maintain a list of already seen directories and check every IFD offset // * and its IFD number against that list. However, the offset of an IFD number // * can change - e.g. when writing updates to file. // * Returns 1 if all is ok; 0 if last directory or IFD loop is encountered, // * or an error has occurred. // */ func X_TIFFCheckDirNumberAndOffset(tls *libc.TLS, tif uintptr, dirn Ttdir_t, diroff Tuint64_t) (r int32) { bp := tls.Alloc(80) defer tls.Free(80) var entryPtr, entryPtr1, foundEntry, foundEntryOld uintptr var _ /* entry at bp+0 */ TTIFFOffsetAndDirNumber var _ /* entryOld at bp+16 */ TTIFFOffsetAndDirNumber _, _, _, _ = entryPtr, entryPtr1, foundEntry, foundEntryOld if diroff == uint64(0) { /* no more directories */ return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number == libc.UintptrFromInt32(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number = XTIFFHashSetNew(tls, __ccgo_fp(_hashFuncOffsetToNumber), __ccgo_fp(_equalFuncOffsetToNumber), __ccgo_fp(libc.Xfree)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+32078, __ccgo_ts+32107, 0) return int32(1) } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset == libc.UintptrFromInt32(0) { /* No free callback for this map, as it shares the same items as * tif->tif_map_dir_offset_to_number. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset = XTIFFHashSetNew(tls, __ccgo_fp(_hashFuncNumberToOffset), __ccgo_fp(_equalFuncNumberToOffset), libc.UintptrFromInt32(0)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+32078, __ccgo_ts+32107, 0) return int32(1) } } (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp))).Foffset = diroff (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp))).FdirNumber = dirn foundEntry = XTIFFHashSetLookup(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number, bp) if foundEntry != 0 { if (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(foundEntry)).FdirNumber == dirn { return int32(1) } else { XTIFFWarningExtR(tls, tif, __ccgo_ts+32078, __ccgo_ts+32125, libc.VaList(bp+40, libc.Int32FromUint32(dirn)-int32(1), (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(foundEntry)).FdirNumber, diroff, diroff)) return 0 } } /* Check if offset of an IFD has been changed and update offset of that IFD * number. */ foundEntry = XTIFFHashSetLookup(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset, bp) if foundEntry != 0 { if (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(foundEntry)).Foffset != diroff { (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp + 16))).Foffset = (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(foundEntry)).Foffset (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp + 16))).FdirNumber = dirn /* We must remove first from tif_map_dir_number_to_offset as the */ /* entry is owned (and thus freed) by */ /* tif_map_dir_offset_to_number */ foundEntryOld = XTIFFHashSetLookup(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset, bp+16) if foundEntryOld != 0 { XTIFFHashSetRemove(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset, foundEntryOld) } foundEntryOld = XTIFFHashSetLookup(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number, bp+16) if foundEntryOld != 0 { XTIFFHashSetRemove(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number, foundEntryOld) } entryPtr = libc.Xmalloc(tls, uint32(16)) if entryPtr == libc.UintptrFromInt32(0) { return 0 } /* Add IFD offset and dirn to IFD directory list */ *(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(entryPtr)) = *(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp)) if !(XTIFFHashSetInsert(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number, entryPtr) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+32078, __ccgo_ts+32199, 0) return 0 } if !(XTIFFHashSetInsert(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset, entryPtr) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+32078, __ccgo_ts+32248, 0) return 0 } } return int32(1) } /* Arbitrary (hopefully big enough) limit */ if XTIFFHashSetSize(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number) >= int32(TIFF_MAX_DIR_COUNT) { XTIFFErrorExtR(tls, tif, __ccgo_ts+32078, __ccgo_ts+32297, libc.VaList(bp+40, int32(TIFF_MAX_DIR_COUNT))) return 0 } entryPtr1 = libc.Xmalloc(tls, uint32(16)) if entryPtr1 == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+32078, __ccgo_ts+32341, 0) return 0 } /* Add IFD offset and dirn to IFD directory list */ *(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(entryPtr1)) = *(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp)) if !(XTIFFHashSetInsert(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number, entryPtr1) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+32078, __ccgo_ts+32199, 0) return 0 } if !(XTIFFHashSetInsert(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset, entryPtr1) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+32078, __ccgo_ts+32248, 0) return 0 } return int32(1) } /* --- _TIFFCheckDirNumberAndOffset() ---*/ // C documentation // // /* // * Retrieve the matching IFD directory number of a given IFD offset // * from the list of directories already seen. // * Returns 1 if the offset was in the list and the directory number // * can be returned. // * Otherwise returns 0 or if an error occurred. // */ func X_TIFFGetDirNumberFromOffset(tls *libc.TLS, tif uintptr, diroff Tuint64_t, dirn uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var foundEntry uintptr var _ /* entry at bp+0 */ TTIFFOffsetAndDirNumber _ = foundEntry if diroff == uint64(0) { /* no more directories */ return 0 } /* Check if offset is already in the list and return matching directory * number. Otherwise update IFD list using TIFFNumberOfDirectories() and * search again in IFD list. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number == libc.UintptrFromInt32(0) { return 0 } (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp))).Foffset = diroff (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp))).FdirNumber = uint32(0) /* not used */ foundEntry = XTIFFHashSetLookup(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number, bp) if foundEntry != 0 { *(*Ttdir_t)(unsafe.Pointer(dirn)) = (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(foundEntry)).FdirNumber return int32(1) } /* This updates the directory list for all main-IFDs in the file. */ XTIFFNumberOfDirectories(tls, tif) foundEntry = XTIFFHashSetLookup(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number, bp) if foundEntry != 0 { *(*Ttdir_t)(unsafe.Pointer(dirn)) = (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(foundEntry)).FdirNumber return int32(1) } return 0 } /*--- _TIFFGetDirNumberFromOffset() ---*/ // C documentation // // /* // * Retrieve the matching IFD directory offset of a given IFD number // * from the list of directories already seen. // * Returns 1 if the offset was in the list of already seen IFDs and the // * directory offset can be returned. The directory list is not updated. // * Otherwise returns 0 or if an error occurred. // */ func X_TIFFGetOffsetFromDirNumber(tls *libc.TLS, tif uintptr, dirn Ttdir_t, diroff uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var foundEntry uintptr var _ /* entry at bp+0 */ TTIFFOffsetAndDirNumber _ = foundEntry if (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset == libc.UintptrFromInt32(0) { return 0 } (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp))).Foffset = uint64(0) /* not used */ (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp))).FdirNumber = dirn foundEntry = XTIFFHashSetLookup(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset, bp) if foundEntry != 0 { *(*Tuint64_t)(unsafe.Pointer(diroff)) = (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(foundEntry)).Foffset return int32(1) } return 0 } /*--- _TIFFGetOffsetFromDirNumber() ---*/ // C documentation // // /* // * Remove an entry from the directory list of already seen directories // * by directory offset. // * If an entry is to be removed from the list, it is also okay if the entry // * is not in the list or the list does not exist. // */ func X_TIFFRemoveEntryFromDirectoryListByOffset(tls *libc.TLS, tif uintptr, diroff Tuint64_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var foundEntryOldDir, foundEntryOldOff uintptr var _ /* entryOld at bp+0 */ TTIFFOffsetAndDirNumber _, _ = foundEntryOldDir, foundEntryOldOff if (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number == libc.UintptrFromInt32(0) { return int32(1) } (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp))).Foffset = diroff (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp))).FdirNumber = uint32(0) /* We must remove first from tif_map_dir_number_to_offset as the * entry is owned (and thus freed) by tif_map_dir_offset_to_number. * However, we need firstly to find the directory number from offset. */ foundEntryOldOff = XTIFFHashSetLookup(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number, bp) if foundEntryOldOff != 0 { (*(*TTIFFOffsetAndDirNumber)(unsafe.Pointer(bp))).FdirNumber = (*TTIFFOffsetAndDirNumber)(unsafe.Pointer(foundEntryOldOff)).FdirNumber if (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset != libc.UintptrFromInt32(0) { foundEntryOldDir = XTIFFHashSetLookup(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset, bp) if foundEntryOldDir != 0 { XTIFFHashSetRemove(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_number_to_offset, foundEntryOldDir) XTIFFHashSetRemove(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_map_dir_offset_to_number, foundEntryOldOff) return int32(1) } } else { XTIFFErrorExtR(tls, tif, __ccgo_ts+32387, __ccgo_ts+32429, 0) return 0 } } return int32(1) } /*--- _TIFFRemoveEntryFromDirectoryListByOffset() ---*/ // C documentation // // /* // * Check the count field of a directory entry against a known value. The // * caller is expected to skip/ignore the tag if there is a mismatch. // */ func _CheckDirCount(tls *libc.TLS, tif uintptr, dir uintptr, count Tuint32_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var fip, fip1, v1, v2 uintptr _, _, _, _ = fip, fip1, v1, v2 if uint64(count) > (*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count { fip = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_tag)) if fip != 0 { v1 = (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name } else { v1 = __ccgo_ts + 30633 } XTIFFWarningExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+32523, libc.VaList(bp+8, v1, (*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count, count)) return 0 } else { if uint64(count) < (*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count { fip1 = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_tag)) if fip1 != 0 { v2 = (*TTIFFField)(unsafe.Pointer(fip1)).Ffield_name } else { v2 = __ccgo_ts + 30633 } XTIFFWarningExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+32588, libc.VaList(bp+8, v2, (*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count, count)) (*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count = uint64(count) return int32(1) } } return int32(1) } // C documentation // // /* // * Read IFD structure from the specified offset. If the pointer to // * nextdiroff variable has been specified, read it too. Function returns a // * number of fields in the directory or 0 if failed. // */ func _TIFFFetchDirectory(tls *libc.TLS, tif uintptr, diroff Tuint64_t, pdir uintptr, nextdiroff uintptr) (r Tuint16_t) { bp := tls.Alloc(64) defer tls.Free(64) var allocsize, filesize Tuint64_t var dir, ma, mb, origdir uintptr var dirsize Tuint32_t var m, off Ttmsize_t var n Tuint16_t var _ /* dircount16 at bp+0 */ Tuint16_t var _ /* dircount64 at bp+24 */ Tuint64_t var _ /* dircount64 at bp+8 */ Tuint64_t var _ /* nextdiroff32 at bp+16 */ Tuint32_t var _ /* nextdiroff32 at bp+32 */ Tuint32_t _, _, _, _, _, _, _, _, _, _ = allocsize, dir, dirsize, filesize, m, ma, mb, n, off, origdir (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = diroff if nextdiroff != 0 { *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) = uint64(0) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00800) != libc.Uint32FromInt32(0)) { if !(X_TIFFSeekOK(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32653, libc.VaList(bp+48, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return uint16(0) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp, libc.Int32FromUint32(libc.Uint32FromInt64(2)))) == libc.Uint32FromInt64(2)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32693, libc.VaList(bp+48, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return uint16(0) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp) } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp))) > int32(4096) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32731, 0) return uint16(0) } dirsize = uint32(12) } else { if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+8, libc.Int32FromUint32(libc.Uint32FromInt64(8)))) == libc.Uint32FromInt64(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32693, libc.VaList(bp+48, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return uint16(0) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+8) } if *(*Tuint64_t)(unsafe.Pointer(bp + 8)) > uint64(4096) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32731, 0) return uint16(0) } *(*Tuint16_t)(unsafe.Pointer(bp)) = uint16(*(*Tuint64_t)(unsafe.Pointer(bp + 8))) dirsize = uint32(20) } origdir = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp))), libc.Int32FromUint32(dirsize), __ccgo_ts+32811) if origdir == libc.UintptrFromInt32(0) { return uint16(0) } if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, origdir, libc.Int32FromUint32(uint32(*(*Tuint16_t)(unsafe.Pointer(bp)))*dirsize)) == libc.Int32FromUint32(uint32(*(*Tuint16_t)(unsafe.Pointer(bp)))*dirsize)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32834, libc.VaList(bp+48, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) X_TIFFfreeExt(tls, tif, origdir) return uint16(0) } /* * Read offset to next directory for sequential scans if * needed. */ if nextdiroff != 0 { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+16, libc.Int32FromUint32(libc.Uint32FromInt64(4)))) == libc.Uint32FromInt64(4)) { *(*Tuint32_t)(unsafe.Pointer(bp + 16)) = uint32(0) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+16) } *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 16))) } else { if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, nextdiroff, libc.Int32FromUint32(libc.Uint32FromInt64(8)))) == libc.Uint32FromInt64(8)) { *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) = uint64(0) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, nextdiroff) } } } } else { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff > libc.Uint64FromInt64(libc.Int64FromInt64(INT64_MAX1)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32870, 0) return libc.Uint16FromInt32(libc.Int32FromInt32(0)) } off = libc.Int32FromUint64((*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff) /* * Check for integer overflow when validating the dir_off, * otherwise a very high offset may cause an OOB read and * crash the client. Make two comparisons instead of * * off + sizeof(uint16_t) > tif->tif_size * * to avoid overflow. */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { m = libc.Int32FromUint32(libc.Uint32FromInt32(off) + uint32(2)) if m < off || m < libc.Int32FromInt64(2) || m > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32870, 0) return uint16(0) } else { X_TIFFmemcpy(tls, bp, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(off), int32(2)) } off = Ttmsize_t(uint32(off) + libc.Uint32FromInt64(2)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp) } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp))) > int32(4096) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32731, 0) return uint16(0) } dirsize = uint32(12) } else { m = libc.Int32FromUint32(libc.Uint32FromInt32(off) + uint32(8)) if m < off || m < libc.Int32FromInt64(8) || m > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32870, 0) return uint16(0) } else { X_TIFFmemcpy(tls, bp+24, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(off), int32(8)) } off = Ttmsize_t(uint32(off) + libc.Uint32FromInt64(8)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+24) } if *(*Tuint64_t)(unsafe.Pointer(bp + 24)) > uint64(4096) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32731, 0) return uint16(0) } *(*Tuint16_t)(unsafe.Pointer(bp)) = uint16(*(*Tuint64_t)(unsafe.Pointer(bp + 24))) dirsize = uint32(20) } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp))) == 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32904, 0) return uint16(0) } /* Before allocating a huge amount of memory for corrupted files, check * if size of requested memory is not greater than file size. */ filesize = (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) allocsize = uint64(*(*Tuint16_t)(unsafe.Pointer(bp))) * uint64(dirsize) if allocsize > filesize { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+32979, libc.VaList(bp+48, allocsize, filesize)) return uint16(0) } origdir = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp))), libc.Int32FromUint32(dirsize), __ccgo_ts+32811) if origdir == libc.UintptrFromInt32(0) { return uint16(0) } m = libc.Int32FromUint32(libc.Uint32FromInt32(off) + uint32(*(*Tuint16_t)(unsafe.Pointer(bp)))*dirsize) if m < off || m < libc.Int32FromUint32(uint32(*(*Tuint16_t)(unsafe.Pointer(bp)))*dirsize) || m > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module11)), __ccgo_ts+33105, 0) X_TIFFfreeExt(tls, tif, origdir) return uint16(0) } else { X_TIFFmemcpy(tls, origdir, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(off), libc.Int32FromUint32(uint32(*(*Tuint16_t)(unsafe.Pointer(bp)))*dirsize)) } if nextdiroff != 0 { off = Ttmsize_t(uint32(off) + uint32(*(*Tuint16_t)(unsafe.Pointer(bp)))*dirsize) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { m = libc.Int32FromUint32(libc.Uint32FromInt32(off) + uint32(4)) if m < off || m < libc.Int32FromInt64(4) || m > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { *(*Tuint32_t)(unsafe.Pointer(bp + 32)) = uint32(0) } else { X_TIFFmemcpy(tls, bp+32, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(off), int32(4)) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+32) } *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 32))) } else { m = libc.Int32FromUint32(libc.Uint32FromInt32(off) + uint32(8)) if m < off || m < libc.Int32FromInt64(8) || m > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { *(*Tuint64_t)(unsafe.Pointer(nextdiroff)) = uint64(0) } else { X_TIFFmemcpy(tls, nextdiroff, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(off), int32(8)) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, nextdiroff) } } } } /* No check against filesize needed here because "dir" should have same size * than "origdir" checked above. */ dir = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp))), int32(32), __ccgo_ts+32811) if dir == uintptr(0) { X_TIFFfreeExt(tls, tif, origdir) return uint16(0) } ma = origdir mb = dir n = uint16(0) for { if !(libc.Int32FromUint16(n) < libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp)))) { break } (*TTIFFDirEntry)(unsafe.Pointer(mb)).Ftdir_ignore = uint8(FALSE) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma) } (*TTIFFDirEntry)(unsafe.Pointer(mb)).Ftdir_tag = *(*Tuint16_t)(unsafe.Pointer(ma)) ma += uintptr(2) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, ma) } (*TTIFFDirEntry)(unsafe.Pointer(mb)).Ftdir_type = *(*Tuint16_t)(unsafe.Pointer(ma)) ma += uintptr(2) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, ma) } (*TTIFFDirEntry)(unsafe.Pointer(mb)).Ftdir_count = uint64(*(*Tuint32_t)(unsafe.Pointer(ma))) ma += uintptr(4) *(*Tuint64_t)(unsafe.Pointer(mb + 16)) = uint64(0) *(*Tuint32_t)(unsafe.Pointer(mb + 16)) = *(*Tuint32_t)(unsafe.Pointer(ma)) ma += uintptr(4) } else { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, ma) } (*TTIFFDirEntry)(unsafe.Pointer(mb)).Ftdir_count = _TIFFReadUInt64(tls, ma) ma += uintptr(8) *(*Tuint64_t)(unsafe.Pointer(mb + 16)) = _TIFFReadUInt64(tls, ma) ma += uintptr(8) } mb += 32 goto _1 _1: ; n++ } X_TIFFfreeExt(tls, tif, origdir) *(*uintptr)(unsafe.Pointer(pdir)) = dir return *(*Tuint16_t)(unsafe.Pointer(bp)) } var _module11 = [19]uint8{'T', 'I', 'F', 'F', 'F', 'e', 't', 'c', 'h', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y'} // C documentation // // /* // * Fetch a tag that is not handled by special case code. // */ func _TIFFFetchNormalTag(tls *libc.TLS, tif uintptr, dp uintptr, recover1 int32) (r int32) { bp := tls.Alloc(256) defer tls.Free(256) var err TIFFReadDirEntryErr var fip, ma, o, o1, o2 uintptr var m, m1, m10, m11, m12, m13, m14, m15, m16, m17, m18, m19, m2, m20, m21, m22, m23, m24, m25, m26, m27, m28, m29, m3, m30, m31, m32, m33, m34, m4, m5, m6, m7, m8, m9, n int32 var mb Tsize_t var _ /* count at bp+164 */ Tuint32_t var _ /* data at bp+10 */ Tuint16_t var _ /* data at bp+100 */ uintptr var _ /* data at bp+104 */ uintptr var _ /* data at bp+108 */ uintptr var _ /* data at bp+112 */ uintptr var _ /* data at bp+116 */ uintptr var _ /* data at bp+12 */ Tint16_t var _ /* data at bp+120 */ uintptr var _ /* data at bp+124 */ uintptr var _ /* data at bp+128 */ uintptr var _ /* data at bp+132 */ uintptr var _ /* data at bp+136 */ uintptr var _ /* data at bp+140 */ uintptr var _ /* data at bp+144 */ uintptr var _ /* data at bp+148 */ uintptr var _ /* data at bp+152 */ uintptr var _ /* data at bp+156 */ uintptr var _ /* data at bp+16 */ Tuint32_t var _ /* data at bp+160 */ uintptr var _ /* data at bp+172 */ uintptr var _ /* data at bp+176 */ uintptr var _ /* data at bp+180 */ uintptr var _ /* data at bp+184 */ uintptr var _ /* data at bp+188 */ uintptr var _ /* data at bp+192 */ uintptr var _ /* data at bp+196 */ uintptr var _ /* data at bp+20 */ Tint32_t var _ /* data at bp+200 */ uintptr var _ /* data at bp+204 */ uintptr var _ /* data at bp+208 */ uintptr var _ /* data at bp+24 */ Tuint64_t var _ /* data at bp+32 */ Tint64_t var _ /* data at bp+4 */ uintptr var _ /* data at bp+40 */ float32 var _ /* data at bp+48 */ float64 var _ /* data at bp+56 */ Tuint64_t var _ /* data at bp+64 */ uintptr var _ /* data at bp+68 */ uintptr var _ /* data at bp+72 */ uintptr var _ /* data at bp+76 */ uintptr var _ /* data at bp+8 */ Tuint8_t var _ /* data at bp+80 */ uintptr var _ /* data at bp+84 */ uintptr var _ /* data at bp+88 */ uintptr var _ /* data at bp+9 */ Tint8_t var _ /* data at bp+92 */ uintptr var _ /* data at bp+96 */ uintptr var _ /* fii at bp+0 */ Tuint32_t var _ /* origdata at bp+168 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = err, fip, m, m1, m10, m11, m12, m13, m14, m15, m16, m17, m18, m19, m2, m20, m21, m22, m23, m24, m25, m26, m27, m28, m29, m3, m30, m31, m32, m33, m34, m4, m5, m6, m7, m8, m9, ma, mb, n, o, o1, o2 fip = libc.UintptrFromInt32(0) _TIFFReadDirectoryFindFieldInfo(tls, tif, (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag, bp) if *(*Tuint32_t)(unsafe.Pointer(bp)) == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { XTIFFErrorExtR(tls, tif, __ccgo_ts+33133, __ccgo_ts+33152, libc.VaList(bp+224, libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag))) return 0 } fip = *(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(*(*Tuint32_t)(unsafe.Pointer(bp)))*4)) /* should not happen */ /* if so, we shouldn't arrive here but deal with this in specialized code */ /* if so, we shouldn't arrive here as this is only the case for pseudo-tags */ err = int32(TIFFReadDirEntryErrOk) switch (*TTIFFField)(unsafe.Pointer(fip)).Fset_field_type { case int32(TIFF_SETGET_UNDEFINED): XTIFFErrorExtR(tls, tif, __ccgo_ts+33133, __ccgo_ts+33183, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_tag, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) case int32(TIFF_SETGET_ASCII): err = _TIFFReadDirEntryByteArray(tls, tif, dp, bp+4) if err == int32(TIFFReadDirEntryErrOk) { mb = uint32(0) if *(*uintptr)(unsafe.Pointer(bp + 4)) != libc.UintptrFromInt32(0) { if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0) && libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + uintptr((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count-uint64(1))))) == 0 { /* optimization: if data is known to be 0 terminated, we * can use strlen() */ mb = libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) } else { /* general case. equivalent to non-portable */ /* mb = strnlen((const char*)data, * (uint32_t)dp->tdir_count); */ ma = *(*uintptr)(unsafe.Pointer(bp + 4)) for mb < uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count) { if libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(ma))) == 0 { break } ma++ mb++ } } } if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 4)) != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) } return 0 } if mb+uint32(1) < uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33288, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) } else { if mb+uint32(1) > uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33419, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) /* TIFFReadDirEntryArrayWithLimit() ensures this can't be * larger than MAX_SIZE_TAG_DATA */ o = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)+uint32(1))) if o == libc.UintptrFromInt32(0) { if *(*uintptr)(unsafe.Pointer(bp + 4)) != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) } return 0 } if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0) { X_TIFFmemcpy(tls, o, *(*uintptr)(unsafe.Pointer(bp + 4)), libc.Int32FromUint32(uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count))) } *(*Tuint8_t)(unsafe.Pointer(o + uintptr(uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)))) = uint8(0) if *(*uintptr)(unsafe.Pointer(bp + 4)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) } *(*uintptr)(unsafe.Pointer(bp + 4)) = o } } n = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 4)))) if *(*uintptr)(unsafe.Pointer(bp + 4)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) } if !(n != 0) { return 0 } } case int32(TIFF_SETGET_UINT8): *(*Tuint8_t)(unsafe.Pointer(bp + 8)) = uint8(0) err = _TIFFReadDirEntryByte(tls, tif, dp, bp+8) if err == int32(TIFFReadDirEntryErrOk) { if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp + 8))))) != 0) { return 0 } } case int32(TIFF_SETGET_SINT8): *(*Tint8_t)(unsafe.Pointer(bp + 9)) = 0 err = _TIFFReadDirEntrySbyte(tls, tif, dp, bp+9) if err == int32(TIFFReadDirEntryErrOk) { if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, int32(*(*Tint8_t)(unsafe.Pointer(bp + 9))))) != 0) { return 0 } } case int32(TIFF_SETGET_UINT16): err = _TIFFReadDirEntryShort(tls, tif, dp, bp+10) if err == int32(TIFFReadDirEntryErrOk) { if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 10))))) != 0) { return 0 } } case int32(TIFF_SETGET_SINT16): err = _TIFFReadDirEntrySshort(tls, tif, dp, bp+12) if err == int32(TIFFReadDirEntryErrOk) { if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, int32(*(*Tint16_t)(unsafe.Pointer(bp + 12))))) != 0) { return 0 } } case int32(TIFF_SETGET_UINT32): err = _TIFFReadDirEntryLong(tls, tif, dp, bp+16) if err == int32(TIFFReadDirEntryErrOk) { if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*Tuint32_t)(unsafe.Pointer(bp + 16)))) != 0) { return 0 } } case int32(TIFF_SETGET_SINT32): err = _TIFFReadDirEntrySlong(tls, tif, dp, bp+20) if err == int32(TIFFReadDirEntryErrOk) { if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*Tint32_t)(unsafe.Pointer(bp + 20)))) != 0) { return 0 } } case int32(TIFF_SETGET_UINT64): err = _TIFFReadDirEntryLong8(tls, tif, dp, bp+24) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { return 0 } if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*Tuint64_t)(unsafe.Pointer(bp + 24)))) != 0) { return 0 } } case int32(TIFF_SETGET_SINT64): err = _TIFFReadDirEntrySlong8(tls, tif, dp, bp+32) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { return 0 } if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*Tint64_t)(unsafe.Pointer(bp + 32)))) != 0) { return 0 } } case int32(TIFF_SETGET_FLOAT): err = _TIFFReadDirEntryFloat(tls, tif, dp, bp+40) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { return 0 } if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, float64(*(*float32)(unsafe.Pointer(bp + 40))))) != 0) { return 0 } } case int32(TIFF_SETGET_DOUBLE): err = _TIFFReadDirEntryDouble(tls, tif, dp, bp+48) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { return 0 } if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*float64)(unsafe.Pointer(bp + 48)))) != 0) { return 0 } } case int32(TIFF_SETGET_IFD8): err = _TIFFReadDirEntryIfd8(tls, tif, dp, bp+56) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { return 0 } if !(XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*Tuint64_t)(unsafe.Pointer(bp + 56)))) != 0) { return 0 } } case int32(TIFF_SETGET_UINT16_PAIR): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != uint64(2) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33493, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } err = _TIFFReadDirEntryShortArray(tls, tif, dp, bp+64) if err == int32(TIFFReadDirEntryErrOk) { /* avoid CLang static Analyzer false positive */ m = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 64))))), libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 64)) + 1*2))))) X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 64))) if !(m != 0) { return 0 } } case int32(TIFF_SETGET_C0_UINT8): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != libc.Uint64FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33546, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } else { err = _TIFFReadDirEntryByteArray(tls, tif, dp, bp+68) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 68)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 68))) } return 0 } m1 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 68)))) if *(*uintptr)(unsafe.Pointer(bp + 68)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 68))) } if !(m1 != 0) { return 0 } } } case int32(TIFF_SETGET_C0_SINT8): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != libc.Uint64FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33546, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } else { err = _TIFFReadDirEntrySbyteArray(tls, tif, dp, bp+72) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 72)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 72))) } return 0 } m2 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 72)))) if *(*uintptr)(unsafe.Pointer(bp + 72)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 72))) } if !(m2 != 0) { return 0 } } } case int32(TIFF_SETGET_C0_UINT16): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != libc.Uint64FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33546, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } else { err = _TIFFReadDirEntryShortArray(tls, tif, dp, bp+76) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 76)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 76))) } return 0 } m3 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 76)))) if *(*uintptr)(unsafe.Pointer(bp + 76)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 76))) } if !(m3 != 0) { return 0 } } } case int32(TIFF_SETGET_C0_SINT16): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != libc.Uint64FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33546, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } else { err = _TIFFReadDirEntrySshortArray(tls, tif, dp, bp+80) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 80)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 80))) } return 0 } m4 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 80)))) if *(*uintptr)(unsafe.Pointer(bp + 80)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 80))) } if !(m4 != 0) { return 0 } } } case int32(TIFF_SETGET_C0_UINT32): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != libc.Uint64FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33546, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } else { err = _TIFFReadDirEntryLongArray(tls, tif, dp, bp+84) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 84)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 84))) } return 0 } m5 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 84)))) if *(*uintptr)(unsafe.Pointer(bp + 84)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 84))) } if !(m5 != 0) { return 0 } } } case int32(TIFF_SETGET_C0_SINT32): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != libc.Uint64FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33546, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } else { err = _TIFFReadDirEntrySlongArray(tls, tif, dp, bp+88) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 88)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 88))) } return 0 } m6 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 88)))) if *(*uintptr)(unsafe.Pointer(bp + 88)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 88))) } if !(m6 != 0) { return 0 } } } case int32(TIFF_SETGET_C0_UINT64): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != libc.Uint64FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33546, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } else { err = _TIFFReadDirEntryLong8Array(tls, tif, dp, bp+92) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 92)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 92))) } return 0 } m7 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 92)))) if *(*uintptr)(unsafe.Pointer(bp + 92)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 92))) } if !(m7 != 0) { return 0 } } } case int32(TIFF_SETGET_C0_SINT64): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != libc.Uint64FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33546, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } else { err = _TIFFReadDirEntrySlong8Array(tls, tif, dp, bp+96) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 96)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 96))) } return 0 } m8 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 96)))) if *(*uintptr)(unsafe.Pointer(bp + 96)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 96))) } if !(m8 != 0) { return 0 } } } case int32(TIFF_SETGET_C0_FLOAT): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != libc.Uint64FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33546, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } else { err = _TIFFReadDirEntryFloatArray(tls, tif, dp, bp+100) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 100)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 100))) } return 0 } m9 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 100)))) if *(*uintptr)(unsafe.Pointer(bp + 100)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 100))) } if !(m9 != 0) { return 0 } } } break /*--: Rational2Double: Extend for Double Arrays and Rational-Arrays read * into Double-Arrays. */ fallthrough case int32(TIFF_SETGET_C0_DOUBLE): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count != libc.Uint64FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33546, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount), (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)) return 0 } else { err = _TIFFReadDirEntryDoubleArray(tls, tif, dp, bp+104) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 104)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 104))) } return 0 } m10 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(bp + 104)))) if *(*uintptr)(unsafe.Pointer(bp + 104)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 104))) } if !(m10 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_ASCII): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntryByteArray(tls, tif, dp, bp+108) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 108)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 108))) } return 0 } if *(*uintptr)(unsafe.Pointer(bp + 108)) != uintptr(0) && (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0) && libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 108)) + uintptr((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count-uint64(1))))) != int32('\000') { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33600, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) /* Enlarge buffer and add terminating null. */ o1 = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)+uint32(1))) if o1 == libc.UintptrFromInt32(0) { if *(*uintptr)(unsafe.Pointer(bp + 108)) != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 108))) } return 0 } if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0) { X_TIFFmemcpy(tls, o1, *(*uintptr)(unsafe.Pointer(bp + 108)), libc.Int32FromUint32(uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count))) } *(*Tuint8_t)(unsafe.Pointer(o1 + uintptr(uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)))) = uint8(0) (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count++ /* Increment for added null. */ if *(*uintptr)(unsafe.Pointer(bp + 108)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 108))) } *(*uintptr)(unsafe.Pointer(bp + 108)) = o1 } m11 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 108)))) if *(*uintptr)(unsafe.Pointer(bp + 108)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 108))) } if !(m11 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_UINT8): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntryByteArray(tls, tif, dp, bp+112) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 112)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 112))) } return 0 } m12 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 112)))) if *(*uintptr)(unsafe.Pointer(bp + 112)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 112))) } if !(m12 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_SINT8): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntrySbyteArray(tls, tif, dp, bp+116) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 116)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 116))) } return 0 } m13 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 116)))) if *(*uintptr)(unsafe.Pointer(bp + 116)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 116))) } if !(m13 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_UINT16): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntryShortArray(tls, tif, dp, bp+120) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 120)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 120))) } return 0 } m14 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 120)))) if *(*uintptr)(unsafe.Pointer(bp + 120)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 120))) } if !(m14 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_SINT16): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntrySshortArray(tls, tif, dp, bp+124) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 124)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 124))) } return 0 } m15 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 124)))) if *(*uintptr)(unsafe.Pointer(bp + 124)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 124))) } if !(m15 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_UINT32): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntryLongArray(tls, tif, dp, bp+128) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 128)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 128))) } return 0 } m16 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 128)))) if *(*uintptr)(unsafe.Pointer(bp + 128)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 128))) } if !(m16 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_SINT32): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntrySlongArray(tls, tif, dp, bp+132) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 132)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 132))) } return 0 } m17 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 132)))) if *(*uintptr)(unsafe.Pointer(bp + 132)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 132))) } if !(m17 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_UINT64): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntryLong8Array(tls, tif, dp, bp+136) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 136)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 136))) } return 0 } m18 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 136)))) if *(*uintptr)(unsafe.Pointer(bp + 136)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 136))) } if !(m18 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_SINT64): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntrySlong8Array(tls, tif, dp, bp+140) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 140)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 140))) } return 0 } m19 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 140)))) if *(*uintptr)(unsafe.Pointer(bp + 140)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 140))) } if !(m19 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_FLOAT): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntryFloatArray(tls, tif, dp, bp+144) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 144)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 144))) } return 0 } m20 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 144)))) if *(*uintptr)(unsafe.Pointer(bp + 144)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 144))) } if !(m20 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_DOUBLE): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntryDoubleArray(tls, tif, dp, bp+148) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 148)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 148))) } return 0 } m21 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 148)))) if *(*uintptr)(unsafe.Pointer(bp + 148)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 148))) } if !(m21 != 0) { return 0 } } } case int32(TIFF_SETGET_C16_IFD8): if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0xFFFF) { err = int32(TIFFReadDirEntryErrCount) } else { err = _TIFFReadDirEntryIfd8Array(tls, tif, dp, bp+152) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 152)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 152))) } return 0 } m22 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, libc.Int32FromUint16(uint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)), *(*uintptr)(unsafe.Pointer(bp + 152)))) if *(*uintptr)(unsafe.Pointer(bp + 152)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 152))) } if !(m22 != 0) { return 0 } } } case int32(TIFF_SETGET_C32_ASCII): err = _TIFFReadDirEntryByteArray(tls, tif, dp, bp+156) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 156)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 156))) } return 0 } if *(*uintptr)(unsafe.Pointer(bp + 156)) != uintptr(0) && (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0) && libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 156)) + uintptr((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count-uint64(1))))) != int32('\000') { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module12)), __ccgo_ts+33600, libc.VaList(bp+224, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name)) /* Enlarge buffer and add terminating null. */ o2 = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)+uint32(1))) if o2 == libc.UintptrFromInt32(0) { if *(*uintptr)(unsafe.Pointer(bp + 156)) != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 156))) } return 0 } if (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count > uint64(0) { X_TIFFmemcpy(tls, o2, *(*uintptr)(unsafe.Pointer(bp + 156)), libc.Int32FromUint32(uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count))) } *(*Tuint8_t)(unsafe.Pointer(o2 + uintptr(uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count)))) = uint8(0) (*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count++ /* Increment for added null. */ if *(*uintptr)(unsafe.Pointer(bp + 156)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 156))) } *(*uintptr)(unsafe.Pointer(bp + 156)) = o2 } m23 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 156)))) if *(*uintptr)(unsafe.Pointer(bp + 156)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 156))) } if !(m23 != 0) { return 0 } } case int32(TIFF_SETGET_C32_UINT8): *(*Tuint32_t)(unsafe.Pointer(bp + 164)) = uint32(0) if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_tag == uint32(TIFFTAG_RICHTIFFIPTC) && libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_type) == int32(TIFF_LONG) { err = _TIFFReadDirEntryArray(tls, tif, dp, bp+164, uint32(4), bp+168) if err != int32(TIFFReadDirEntryErrOk) || *(*uintptr)(unsafe.Pointer(bp + 168)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(bp + 160)) = libc.UintptrFromInt32(0) } else { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, *(*uintptr)(unsafe.Pointer(bp + 168)), libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp + 164)))) } *(*uintptr)(unsafe.Pointer(bp + 160)) = *(*uintptr)(unsafe.Pointer(bp + 168)) *(*Tuint32_t)(unsafe.Pointer(bp + 164)) = *(*Tuint32_t)(unsafe.Pointer(bp + 164)) * libc.Uint32FromInt32(4) } } else { err = _TIFFReadDirEntryByteArray(tls, tif, dp, bp+160) *(*Tuint32_t)(unsafe.Pointer(bp + 164)) = uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count) } if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 160)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 160))) } return 0 } m24 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, *(*Tuint32_t)(unsafe.Pointer(bp + 164)), *(*uintptr)(unsafe.Pointer(bp + 160)))) if *(*uintptr)(unsafe.Pointer(bp + 160)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 160))) } if !(m24 != 0) { return 0 } } case int32(TIFF_SETGET_C32_SINT8): *(*uintptr)(unsafe.Pointer(bp + 172)) = libc.UintptrFromInt32(0) err = _TIFFReadDirEntrySbyteArray(tls, tif, dp, bp+172) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 172)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 172))) } return 0 } m25 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 172)))) if *(*uintptr)(unsafe.Pointer(bp + 172)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 172))) } if !(m25 != 0) { return 0 } } case int32(TIFF_SETGET_C32_UINT16): err = _TIFFReadDirEntryShortArray(tls, tif, dp, bp+176) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 176)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 176))) } return 0 } m26 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 176)))) if *(*uintptr)(unsafe.Pointer(bp + 176)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 176))) } if !(m26 != 0) { return 0 } } case int32(TIFF_SETGET_C32_SINT16): *(*uintptr)(unsafe.Pointer(bp + 180)) = libc.UintptrFromInt32(0) err = _TIFFReadDirEntrySshortArray(tls, tif, dp, bp+180) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 180)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 180))) } return 0 } m27 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 180)))) if *(*uintptr)(unsafe.Pointer(bp + 180)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 180))) } if !(m27 != 0) { return 0 } } case int32(TIFF_SETGET_C32_UINT32): err = _TIFFReadDirEntryLongArray(tls, tif, dp, bp+184) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 184)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 184))) } return 0 } m28 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 184)))) if *(*uintptr)(unsafe.Pointer(bp + 184)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 184))) } if !(m28 != 0) { return 0 } } case int32(TIFF_SETGET_C32_SINT32): *(*uintptr)(unsafe.Pointer(bp + 188)) = libc.UintptrFromInt32(0) err = _TIFFReadDirEntrySlongArray(tls, tif, dp, bp+188) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 188)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 188))) } return 0 } m29 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 188)))) if *(*uintptr)(unsafe.Pointer(bp + 188)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 188))) } if !(m29 != 0) { return 0 } } case int32(TIFF_SETGET_C32_UINT64): err = _TIFFReadDirEntryLong8Array(tls, tif, dp, bp+192) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 192)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 192))) } return 0 } m30 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 192)))) if *(*uintptr)(unsafe.Pointer(bp + 192)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 192))) } if !(m30 != 0) { return 0 } } case int32(TIFF_SETGET_C32_SINT64): *(*uintptr)(unsafe.Pointer(bp + 196)) = libc.UintptrFromInt32(0) err = _TIFFReadDirEntrySlong8Array(tls, tif, dp, bp+196) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 196)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 196))) } return 0 } m31 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 196)))) if *(*uintptr)(unsafe.Pointer(bp + 196)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 196))) } if !(m31 != 0) { return 0 } } case int32(TIFF_SETGET_C32_FLOAT): err = _TIFFReadDirEntryFloatArray(tls, tif, dp, bp+200) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 200)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 200))) } return 0 } m32 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 200)))) if *(*uintptr)(unsafe.Pointer(bp + 200)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 200))) } if !(m32 != 0) { return 0 } } case int32(TIFF_SETGET_C32_DOUBLE): err = _TIFFReadDirEntryDoubleArray(tls, tif, dp, bp+204) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 204)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 204))) } return 0 } m33 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 204)))) if *(*uintptr)(unsafe.Pointer(bp + 204)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 204))) } if !(m33 != 0) { return 0 } } case int32(TIFF_SETGET_C32_IFD8): err = _TIFFReadDirEntryIfd8Array(tls, tif, dp, bp+208) if err == int32(TIFFReadDirEntryErrOk) { if !(_EvaluateIFDdatasizeReading(tls, tif, dp) != 0) { if *(*uintptr)(unsafe.Pointer(bp + 208)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 208))) } return 0 } m34 = XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_tag), libc.VaList(bp+224, uint32((*TTIFFDirEntry)(unsafe.Pointer(dp)).Ftdir_count), *(*uintptr)(unsafe.Pointer(bp + 208)))) if *(*uintptr)(unsafe.Pointer(bp + 208)) != uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 208))) } if !(m34 != 0) { return 0 } } default: /* we should never get here */ break } if err != int32(TIFFReadDirEntryErrOk) { _TIFFReadDirEntryOutputErr(tls, tif, err, uintptr(unsafe.Pointer(&_module12)), (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, recover1) return 0 } return int32(1) } var _module12 = [19]uint8{'T', 'I', 'F', 'F', 'F', 'e', 't', 'c', 'h', 'N', 'o', 'r', 'm', 'a', 'l', 'T', 'a', 'g'} // C documentation // // /* // * Fetch a set of offsets or lengths. // * While this routine says "strips", in fact it's also used for tiles. // */ func _TIFFFetchStripThing(tls *libc.TLS, tif uintptr, dir uintptr, nstrips Tuint32_t, lpp uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var allocsize, filesize Tuint64_t var err TIFFReadDirEntryErr var fip, fip1, pszMax, resizeddata, v1, v2 uintptr var max_nstrips Tuint32_t var _ /* data at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _ = allocsize, err, filesize, fip, fip1, max_nstrips, pszMax, resizeddata, v1, v2 err = _TIFFReadDirEntryLong8ArrayWithLimit(tls, tif, dir, bp, uint64(nstrips)) if err != int32(TIFFReadDirEntryErrOk) { fip = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_tag)) if fip != 0 { v1 = (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name } else { v1 = __ccgo_ts + 30633 } _TIFFReadDirEntryOutputErr(tls, tif, err, uintptr(unsafe.Pointer(&_module13)), v1, 0) return 0 } if (*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count < uint64(nstrips) { fip1 = XTIFFFieldWithTag(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_tag)) pszMax = libc.Xgetenv(tls, __ccgo_ts+33686) max_nstrips = uint32(1000000) if pszMax != 0 { max_nstrips = libc.Uint32FromInt32(libc.Xatoi(tls, pszMax)) } if fip1 != 0 { v2 = (*TTIFFField)(unsafe.Pointer(fip1)).Ffield_name } else { v2 = __ccgo_ts + 30633 } _TIFFReadDirEntryOutputErr(tls, tif, int32(TIFFReadDirEntryErrCount), uintptr(unsafe.Pointer(&_module13)), v2, libc.BoolInt32(nstrips <= max_nstrips)) if nstrips > max_nstrips { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) return 0 } allocsize = uint64(nstrips) * uint64(8) if allocsize > libc.Uint64FromInt32(libc.Int32FromInt32(100)*libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) { /* Before allocating a huge amount of memory for corrupted files, * check if size of requested memory is not greater than file size. */ filesize = (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) if allocsize > filesize { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module13)), __ccgo_ts+33724, libc.VaList(bp+16, allocsize, filesize)) X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) return 0 } } resizeddata = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint32(nstrips), int32(8), __ccgo_ts+33821) if resizeddata == uintptr(0) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) return 0 } if (*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count != 0 { X_TIFFmemcpy(tls, resizeddata, *(*uintptr)(unsafe.Pointer(bp)), libc.Int32FromUint32(uint32((*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count)*uint32(8))) } X_TIFFmemset(tls, resizeddata+uintptr(uint32((*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count))*8, 0, libc.Int32FromUint32((nstrips-uint32((*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count))*uint32(8))) X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp))) *(*uintptr)(unsafe.Pointer(bp)) = resizeddata } *(*uintptr)(unsafe.Pointer(lpp)) = *(*uintptr)(unsafe.Pointer(bp)) return int32(1) } var _module13 = [20]uint8{'T', 'I', 'F', 'F', 'F', 'e', 't', 'c', 'h', 'S', 't', 'r', 'i', 'p', 'T', 'h', 'i', 'n', 'g'} // C documentation // // /* // * Fetch and set the SubjectDistance EXIF tag. // */ func _TIFFFetchSubjectDistance(tls *libc.TLS, tif uintptr, dir uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var err TIFFReadDirEntryErr var n float64 var _ /* m at bp+0 */ TUInt64Aligned_t var _ /* offset at bp+8 */ Tuint32_t _, _ = err, n *(*Tuint64_t)(unsafe.Pointer(bp)) = uint64(0) if (*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_count != uint64(1) { err = int32(TIFFReadDirEntryErrCount) } else { if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_type) != int32(TIFF_RATIONAL) { err = int32(TIFFReadDirEntryErrType) } else { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp + 8)) = *(*Tuint32_t)(unsafe.Pointer(dir + 16)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+8) } err = _TIFFReadDirEntryData(tls, tif, uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 8))), int32(8), bp) } else { *(*Tuint64_t)(unsafe.Pointer(bp)) = *(*Tuint64_t)(unsafe.Pointer(dir + 16)) err = int32(TIFFReadDirEntryErrOk) } } } if err == int32(TIFFReadDirEntryErrOk) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, bp, int32(2)) } if *(*Tuint32_t)(unsafe.Pointer(bp)) == uint32(0) { n = float64(0) } else { if *(*Tuint32_t)(unsafe.Pointer(bp)) == uint32(0xFFFFFFFF) || *(*Tuint32_t)(unsafe.Pointer(bp + 1*4)) == uint32(0) { /* * XXX: Numerator 0xFFFFFFFF means that we have infinite * distance. Indicate that with a negative floating point * SubjectDistance value. */ n = -libc.Float64FromFloat64(1) } else { n = float64(*(*Tuint32_t)(unsafe.Pointer(bp))) / float64(*(*Tuint32_t)(unsafe.Pointer(bp + 1*4))) } } return XTIFFSetField(tls, tif, uint32((*TTIFFDirEntry)(unsafe.Pointer(dir)).Ftdir_tag), libc.VaList(bp+24, n)) } else { _TIFFReadDirEntryOutputErr(tls, tif, err, uintptr(unsafe.Pointer(&_module14)), __ccgo_ts+25497, int32(TRUE)) return 0 } return r } var _module14 = [25]uint8{'T', 'I', 'F', 'F', 'F', 'e', 't', 'c', 'h', 'S', 'u', 'b', 'j', 'e', 'c', 't', 'D', 'i', 's', 't', 'a', 'n', 'c', 'e'} func _allocChoppedUpStripArrays(tls *libc.TLS, tif uintptr, nstrips Tuint32_t, stripbytes Tuint64_t, rowsperstrip Tuint32_t) { bp := tls.Alloc(32) defer tls.Free(32) var allocsize, bytecount, filesize, last_bytecount, last_offset, offset Tuint64_t var i, v3 Tuint32_t var newcounts, newoffsets, td uintptr var v2 uint64 _, _, _, _, _, _, _, _, _, _, _, _ = allocsize, bytecount, filesize, i, last_bytecount, last_offset, newcounts, newoffsets, offset, td, v2, v3 td = tif + 56 offset = XTIFFGetStrileOffset(tls, tif, uint32(0)) last_offset = XTIFFGetStrileOffset(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips-uint32(1)) last_bytecount = XTIFFGetStrileByteCount(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips-uint32(1)) if last_offset > uint64(0xffffffffffffffff)-last_bytecount || last_offset+last_bytecount < offset { return } bytecount = last_offset + last_bytecount - offset /* Before allocating a huge amount of memory for corrupted files, check if * size of StripByteCount and StripOffset tags is not greater than * file size. */ allocsize = uint64(nstrips) * uint64(8) * uint64(2) if allocsize > libc.Uint64FromInt32(libc.Int32FromInt32(100)*libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) { filesize = (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) if allocsize > filesize { XTIFFWarningExtR(tls, tif, __ccgo_ts+33837, __ccgo_ts+33863, libc.VaList(bp+8, allocsize, filesize)) return } } newcounts = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint32(nstrips), int32(8), __ccgo_ts+33978) newoffsets = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint32(nstrips), int32(8), __ccgo_ts+34014) if newcounts == libc.UintptrFromInt32(0) || newoffsets == libc.UintptrFromInt32(0) { /* * Unable to allocate new strip information, give up and use * the original one strip information. */ if newcounts != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, newcounts) } if newoffsets != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, newoffsets) } return } /* * Fill the strip information arrays with new bytecounts and offsets * that reflect the broken-up format. */ i = uint32(0) for { if !(i < nstrips) { break } if stripbytes > bytecount { stripbytes = bytecount } *(*Tuint64_t)(unsafe.Pointer(newcounts + uintptr(i)*8)) = stripbytes if stripbytes != 0 { v2 = offset } else { v2 = uint64(0) } *(*Tuint64_t)(unsafe.Pointer(newoffsets + uintptr(i)*8)) = v2 offset += stripbytes bytecount -= stripbytes goto _1 _1: ; i++ } /* * Replace old single strip info with multi-strip info. */ v3 = nstrips (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips = v3 (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage = v3 XTIFFSetField(tls, tif, uint32(TIFFTAG_ROWSPERSTRIP), libc.VaList(bp+8, rowsperstrip)) X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p) X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p = newcounts (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p = newoffsets *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x4000000) } // C documentation // // /* // * Replace a single strip (tile) of uncompressed data by multiple strips // * (tiles), each approximately STRIP_SIZE_DEFAULT bytes. This is useful for // * dealing with large images or for dealing with machines with a limited // * amount memory. // */ func _ChopUpSingleUncompressedStrip(tls *libc.TLS, tif uintptr) { var bytecount, offset, rowblockbytes, stripbytes Tuint64_t var nstrips, rowblock, rowblocksperstrip, rowsperstrip Tuint32_t var td uintptr var v1 uint32 _, _, _, _, _, _, _, _, _, _ = bytecount, nstrips, offset, rowblock, rowblockbytes, rowblocksperstrip, rowsperstrip, stripbytes, td, v1 td = tif + 56 bytecount = XTIFFGetStrileByteCount(tls, tif, uint32(0)) /* On a newly created file, just re-opened to be filled, we */ /* don't want strip chop to trigger as it is going to cause issues */ /* later ( StripOffsets and StripByteCounts improperly filled) . */ if bytecount == uint64(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode != O_RDONLY3 { return } offset = XTIFFGetStrileByteCount(tls, tif, uint32(0)) if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == int32(PHOTOMETRIC_YCBCR) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x04000) != libc.Uint32FromInt32(0)) { rowblock = uint32(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2))) } else { rowblock = uint32(1) } rowblockbytes = XTIFFVTileSize64(tls, tif, rowblock) /* * Make the rows hold at least one scanline, but fill specified amount * of data if possible. */ if rowblockbytes > uint64(STRIP_SIZE_DEFAULT) { stripbytes = rowblockbytes rowsperstrip = rowblock } else { if rowblockbytes > uint64(0) { rowblocksperstrip = uint32(libc.Uint64FromInt32(STRIP_SIZE_DEFAULT) / rowblockbytes) rowsperstrip = rowblocksperstrip * rowblock stripbytes = uint64(rowblocksperstrip) * rowblockbytes } else { return } } /* * never increase the number of rows per strip */ if rowsperstrip >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip || rowsperstrip == uint32(0) { return } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength < uint32(0xffffffff)-(rowsperstrip-libc.Uint32FromInt32(1)) { v1 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength + (rowsperstrip - uint32(1))) / rowsperstrip } else { v1 = 0 } nstrips = v1 if nstrips == uint32(0) { return } /* If we are going to allocate a lot of memory, make sure that the */ /* file is as big as needed */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY3 && nstrips > uint32(1000000) && (offset >= (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) || stripbytes > ((*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata)-offset)/uint64(nstrips-libc.Uint32FromInt32(1))) { return } _allocChoppedUpStripArrays(tls, tif, nstrips, stripbytes, rowsperstrip) } // C documentation // // /* // * Replace a file with contiguous strips > 2 GB of uncompressed data by // * multiple smaller strips. This is useful for // * dealing with large images or for dealing with machines with a limited // * amount memory. // */ func _TryChopUpUncompressedBigTiff(tls *libc.TLS, tif uintptr) { var filesize, last_bytecount, last_offset, rowblockbytes, stripbytes, stripsize Tuint64_t var i, nstrips, rowblock, rowblocksperstrip, rowsperstrip Tuint32_t var td uintptr var v2 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _ = filesize, i, last_bytecount, last_offset, nstrips, rowblock, rowblockbytes, rowblocksperstrip, rowsperstrip, stripbytes, stripsize, td, v2 td = tif + 56 stripsize = XTIFFStripSize64(tls, tif) /* On a newly created file, just re-opened to be filled, we */ /* don't want strip chop to trigger as it is going to cause issues */ /* later ( StripOffsets and StripByteCounts improperly filled) . */ if XTIFFGetStrileByteCount(tls, tif, uint32(0)) == uint64(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode != O_RDONLY3 { return } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == int32(PHOTOMETRIC_YCBCR) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x04000) != libc.Uint32FromInt32(0)) { rowblock = uint32(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2))) } else { rowblock = uint32(1) } rowblockbytes = XTIFFVStripSize64(tls, tif, rowblock) if rowblockbytes == uint64(0) || rowblockbytes > uint64(0x7FFFFFFF) { /* In case of file with gigantic width */ return } /* Check that the strips are contiguous and of the expected size */ i = uint32(0) for { if !(i < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips) { break } if i == (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips-uint32(1) { if XTIFFGetStrileByteCount(tls, tif, i) < XTIFFVStripSize64(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength-i*(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip) { return } } else { if XTIFFGetStrileByteCount(tls, tif, i) != stripsize { return } if i > uint32(0) && XTIFFGetStrileOffset(tls, tif, i) != XTIFFGetStrileOffset(tls, tif, i-uint32(1))+XTIFFGetStrileByteCount(tls, tif, i-uint32(1)) { return } } goto _1 _1: ; i++ } /* Aim for 512 MB strips (that will still be manageable by 32 bit builds */ rowblocksperstrip = uint32(libc.Uint64FromInt32(libc.Int32FromInt32(512)*libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) / rowblockbytes) if rowblocksperstrip == uint32(0) { rowblocksperstrip = uint32(1) } rowsperstrip = rowblocksperstrip * rowblock stripbytes = uint64(rowblocksperstrip) * rowblockbytes if rowsperstrip == uint32(0) { return } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength < uint32(0xffffffff)-(rowsperstrip-libc.Uint32FromInt32(1)) { v2 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength + (rowsperstrip - uint32(1))) / rowsperstrip } else { v2 = 0 } nstrips = v2 if nstrips == uint32(0) { return } /* If we are going to allocate a lot of memory, make sure that the */ /* file is as big as needed */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY3 && nstrips > uint32(1000000) { last_offset = XTIFFGetStrileOffset(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips-uint32(1)) filesize = (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) last_bytecount = XTIFFGetStrileByteCount(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips-uint32(1)) if last_offset > filesize || last_bytecount > filesize-last_offset { return } } _allocChoppedUpStripArrays(tls, tif, nstrips, stripbytes, rowsperstrip) } func __TIFFUnsanitizedAddUInt64AndInt(tls *libc.TLS, a Tuint64_t, b int32) (r Tuint64_t) { return a + libc.Uint64FromInt32(b) } // C documentation // // /* Read the value of [Strip|Tile]Offset or [Strip|Tile]ByteCount around // * strip/tile of number strile. Also fetch the neighbouring values using a // * 4096 byte page size. // */ func __TIFFPartialReadStripArray(tls *libc.TLS, tif uintptr, dirent uintptr, strile int32, panVals uintptr) (r int32) { bp := tls.Alloc(8256) defer tls.Free(8256) var arraySize Tuint32_t var bSwab, i, iStartBefore, sizeofvalint int32 var nBaseOffset, nLastStripOffset, nOffset, nOffsetEndPage, nOffsetStartPage Tuint64_t var nRead, nToRead Ttmsize_t var sizeofval Tsize_t var _ /* buffer at bp+0 */ [8192]uint8 var _ /* offset at bp+8192 */ Tuint64_t var _ /* offset at bp+8200 */ Tuint32_t var _ /* val at bp+8204 */ Tuint16_t var _ /* val at bp+8208 */ Tuint32_t var _ /* val at bp+8216 */ Tuint64_t var _ /* val at bp+8224 */ Tint64_t _, _, _, _, _, _, _, _, _, _, _, _, _ = arraySize, bSwab, i, iStartBefore, nBaseOffset, nLastStripOffset, nOffset, nOffsetEndPage, nOffsetStartPage, nRead, nToRead, sizeofval, sizeofvalint bSwab = libc.BoolInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != uint32(0)) arraySize = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffsetbyteallocsize if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dirent)).Ftdir_type) == int32(TIFF_SHORT) { sizeofval = uint32(2) } else { if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dirent)).Ftdir_type) == int32(TIFF_LONG) { sizeofval = uint32(4) } else { if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dirent)).Ftdir_type) == int32(TIFF_LONG8) { sizeofval = uint32(8) } else { if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dirent)).Ftdir_type) == int32(TIFF_SLONG8) { /* Non conformant but used by some images as in */ /* https://github.com/OSGeo/gdal/issues/2165 */ sizeofval = uint32(8) } else { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module15)), __ccgo_ts+34047, 0) *(*Tuint64_t)(unsafe.Pointer(panVals + uintptr(strile)*8)) = uint64(0) return 0 } } } } sizeofvalint = libc.Int32FromUint32(sizeofval) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { *(*Tuint64_t)(unsafe.Pointer(bp + 8192)) = *(*Tuint64_t)(unsafe.Pointer(dirent + 16)) if bSwab != 0 { XTIFFSwabLong8(tls, bp+8192) } nBaseOffset = *(*Tuint64_t)(unsafe.Pointer(bp + 8192)) } else { *(*Tuint32_t)(unsafe.Pointer(bp + 8200)) = *(*Tuint32_t)(unsafe.Pointer(&(*TTIFFDirEntry)(unsafe.Pointer(dirent)).Ftdir_offset)) if bSwab != 0 { XTIFFSwabLong(tls, bp+8200) } nBaseOffset = uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 8200))) } /* To avoid later unsigned integer overflows */ if nBaseOffset > libc.Uint64FromInt64(libc.Int64FromInt64(INT64_MAX1)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module15)), __ccgo_ts+34099, libc.VaList(bp+8240, strile)) *(*Tuint64_t)(unsafe.Pointer(panVals + uintptr(strile)*8)) = uint64(0) return 0 } nOffset = nBaseOffset + uint64(sizeofval*libc.Uint32FromInt32(strile)) nOffsetStartPage = nOffset / uint64(4096) * uint64(4096) nOffsetEndPage = nOffsetStartPage + uint64(4096) if nOffset+uint64(sizeofval) > nOffsetEndPage { nOffsetEndPage += uint64(4096) } nLastStripOffset = nBaseOffset + uint64(arraySize*sizeofval) if nLastStripOffset < nOffsetEndPage { nOffsetEndPage = nLastStripOffset } if nOffsetStartPage >= nOffsetEndPage { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module15)), __ccgo_ts+34099, libc.VaList(bp+8240, strile)) *(*Tuint64_t)(unsafe.Pointer(panVals + uintptr(strile)*8)) = uint64(0) return 0 } if !(X_TIFFSeekOK(tls, tif, nOffsetStartPage) != 0) { *(*Tuint64_t)(unsafe.Pointer(panVals + uintptr(strile)*8)) = uint64(0) return 0 } nToRead = libc.Int32FromUint64(nOffsetEndPage - nOffsetStartPage) nRead = (*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp, nToRead) if nRead < nToRead { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module15)), __ccgo_ts+34137, libc.VaList(bp+8240, strile)) return 0 } iStartBefore = -libc.Int32FromUint64((nOffset - nOffsetStartPage) / uint64(sizeofval)) if strile+iStartBefore < 0 { iStartBefore = -strile } i = iStartBefore for { if !(libc.Uint32FromInt32(strile+i) < arraySize && __TIFFUnsanitizedAddUInt64AndInt(tls, nOffset, (i+int32(1))*sizeofvalint) <= nOffsetEndPage) { break } if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dirent)).Ftdir_type) == int32(TIFF_SHORT) { libc.Xmemcpy(tls, bp+8204, bp+uintptr(nOffset-nOffsetStartPage)+uintptr(i*sizeofvalint), uint32(2)) if bSwab != 0 { XTIFFSwabShort(tls, bp+8204) } *(*Tuint64_t)(unsafe.Pointer(panVals + uintptr(strile+i)*8)) = uint64(*(*Tuint16_t)(unsafe.Pointer(bp + 8204))) } else { if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dirent)).Ftdir_type) == int32(TIFF_LONG) { libc.Xmemcpy(tls, bp+8208, bp+uintptr(nOffset-nOffsetStartPage)+uintptr(i*sizeofvalint), uint32(4)) if bSwab != 0 { XTIFFSwabLong(tls, bp+8208) } *(*Tuint64_t)(unsafe.Pointer(panVals + uintptr(strile+i)*8)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 8208))) } else { if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(dirent)).Ftdir_type) == int32(TIFF_LONG8) { libc.Xmemcpy(tls, bp+8216, bp+uintptr(nOffset-nOffsetStartPage)+uintptr(i*sizeofvalint), uint32(8)) if bSwab != 0 { XTIFFSwabLong8(tls, bp+8216) } *(*Tuint64_t)(unsafe.Pointer(panVals + uintptr(strile+i)*8)) = *(*Tuint64_t)(unsafe.Pointer(bp + 8216)) } else { /* if( dirent->tdir_type == TIFF_SLONG8 ) */ libc.Xmemcpy(tls, bp+8224, bp+uintptr(nOffset-nOffsetStartPage)+uintptr(i*sizeofvalint), uint32(8)) if bSwab != 0 { XTIFFSwabLong8(tls, bp+8224) } *(*Tuint64_t)(unsafe.Pointer(panVals + uintptr(strile+i)*8)) = libc.Uint64FromInt64(*(*Tint64_t)(unsafe.Pointer(bp + 8224))) } } } goto _1 _1: ; i++ } return int32(1) } var _module15 = [27]uint8{'_', 'T', 'I', 'F', 'F', 'P', 'a', 'r', 't', 'i', 'a', 'l', 'R', 'e', 'a', 'd', 'S', 't', 'r', 'i', 'p', 'A', 'r', 'r', 'a', 'y'} func __TIFFFetchStrileValue(tls *libc.TLS, tif uintptr, strile Tuint32_t, dirent uintptr, parray uintptr) (r int32) { var bytecountArray, offsetArray, td uintptr var filesize, nArraySize64 Tuint64_t var nArraySize Tsize_t var nStripArrayAllocBefore, nStripArrayAllocNew Tuint32_t var v1, v2 uint32 _, _, _, _, _, _, _, _, _, _ = bytecountArray, filesize, nArraySize, nArraySize64, nStripArrayAllocBefore, nStripArrayAllocNew, offsetArray, td, v1, v2 td = tif + 56 if uint64(strile) >= (*TTIFFDirEntry)(unsafe.Pointer(dirent)).Ftdir_count { return 0 } if strile >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffsetbyteallocsize { nStripArrayAllocBefore = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffsetbyteallocsize if strile > uint32(1000000) { filesize = (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) /* Avoid excessive memory allocation attempt */ /* For such a big blockid we need at least a TIFF_LONG per strile */ /* for the offset array. */ if uint64(strile) > filesize/uint64(4) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module16)), __ccgo_ts+34183, 0) return 0 } } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffsetbyteallocsize == uint32(0) && (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips < libc.Uint32FromInt32(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) { nStripArrayAllocNew = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips } else { if strile+uint32(1) > libc.Uint32FromUint32(1024)*libc.Uint32FromUint32(512) { v1 = strile + uint32(1) } else { v1 = libc.Uint32FromUint32(1024) * libc.Uint32FromUint32(512) } nStripArrayAllocNew = v1 if nStripArrayAllocNew < libc.Uint32FromUint32(0xFFFFFFFF)/libc.Uint32FromInt32(2) { nStripArrayAllocNew *= uint32(2) } if nStripArrayAllocNew < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips { v2 = nStripArrayAllocNew } else { v2 = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips } nStripArrayAllocNew = v2 } nArraySize64 = libc.Uint64FromInt64(8) * uint64(nStripArrayAllocNew) nArraySize = uint32(nArraySize64) if uint64(nArraySize) != nArraySize64 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module16)), __ccgo_ts+34198, 0) return 0 } offsetArray = X_TIFFreallocExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p, libc.Int32FromUint32(nArraySize)) bytecountArray = X_TIFFreallocExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p, libc.Int32FromUint32(nArraySize)) if offsetArray != 0 { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p = offsetArray } if bytecountArray != 0 { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p = bytecountArray } if offsetArray != 0 && bytecountArray != 0 { (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffsetbyteallocsize = nStripArrayAllocNew /* Initialize new entries to ~0 / -1 */ /* coverity[overrun-buffer-arg] */ libc.Xmemset(tls, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p+uintptr(nStripArrayAllocBefore)*8, int32(0xFF), ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffsetbyteallocsize-nStripArrayAllocBefore)*uint32(8)) /* coverity[overrun-buffer-arg] */ libc.Xmemset(tls, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p+uintptr(nStripArrayAllocBefore)*8, int32(0xFF), ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffsetbyteallocsize-nStripArrayAllocBefore)*uint32(8)) } else { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module16)), __ccgo_ts+34198, 0) X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p = libc.UintptrFromInt32(0) X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p = libc.UintptrFromInt32(0) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffsetbyteallocsize = uint32(0) } } if *(*uintptr)(unsafe.Pointer(parray)) == libc.UintptrFromInt32(0) || strile >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffsetbyteallocsize { return 0 } if ^*(*Tuint64_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(parray)) + uintptr(strile)*8)) == uint64(0) { if !(__TIFFPartialReadStripArray(tls, tif, dirent, libc.Int32FromUint32(strile), *(*uintptr)(unsafe.Pointer(parray))) != 0) { *(*Tuint64_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(parray)) + uintptr(strile)*8)) = uint64(0) return 0 } } return int32(1) } var _module16 = [22]uint8{'_', 'T', 'I', 'F', 'F', 'F', 'e', 't', 'c', 'h', 'S', 't', 'r', 'i', 'l', 'e', 'V', 'a', 'l', 'u', 'e'} func __TIFFGetStrileOffsetOrByteCountValue(tls *libc.TLS, tif uintptr, strile Tuint32_t, dirent uintptr, parray uintptr, pbErr uintptr) (r Tuint64_t) { var td uintptr _ = td td = tif + 56 if pbErr != 0 { *(*int32)(unsafe.Pointer(pbErr)) = 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x1000000) != 0 && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x4000000) != 0) { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x2000000) != 0) || (*TTIFFDirEntry)(unsafe.Pointer(dirent)).Ftdir_count <= uint64(4) { if !(X_TIFFFillStriles(tls, tif) != 0) { if pbErr != 0 { *(*int32)(unsafe.Pointer(pbErr)) = int32(1) } /* Do not return, as we want this function to always */ /* return the same value if called several times with */ /* the same arguments */ } } else { if !(__TIFFFetchStrileValue(tls, tif, strile, dirent, parray) != 0) { if pbErr != 0 { *(*int32)(unsafe.Pointer(pbErr)) = int32(1) } return uint64(0) } } } if *(*uintptr)(unsafe.Pointer(parray)) == libc.UintptrFromInt32(0) || strile >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips { if pbErr != 0 { *(*int32)(unsafe.Pointer(pbErr)) = int32(1) } return uint64(0) } return *(*Tuint64_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(parray)) + uintptr(strile)*8)) } // C documentation // // /* Return the value of the TileOffsets/StripOffsets array for the specified // * tile/strile */ func XTIFFGetStrileOffset(tls *libc.TLS, tif uintptr, strile Tuint32_t) (r Tuint64_t) { return XTIFFGetStrileOffsetWithErr(tls, tif, strile, libc.UintptrFromInt32(0)) } // C documentation // // /* Return the value of the TileOffsets/StripOffsets array for the specified // * tile/strile */ func XTIFFGetStrileOffsetWithErr(tls *libc.TLS, tif uintptr, strile Tuint32_t, pbErr uintptr) (r Tuint64_t) { var td uintptr _ = td td = tif + 56 return __TIFFGetStrileOffsetOrByteCountValue(tls, tif, strile, td+144, td+132, pbErr) } // C documentation // // /* Return the value of the TileByteCounts/StripByteCounts array for the // * specified tile/strile */ func XTIFFGetStrileByteCount(tls *libc.TLS, tif uintptr, strile Tuint32_t) (r Tuint64_t) { return XTIFFGetStrileByteCountWithErr(tls, tif, strile, libc.UintptrFromInt32(0)) } // C documentation // // /* Return the value of the TileByteCounts/StripByteCounts array for the // * specified tile/strile */ func XTIFFGetStrileByteCountWithErr(tls *libc.TLS, tif uintptr, strile Tuint32_t, pbErr uintptr) (r Tuint64_t) { var td uintptr _ = td td = tif + 56 return __TIFFGetStrileOffsetOrByteCountValue(tls, tif, strile, td+176, td+136, pbErr) } func X_TIFFFillStriles(tls *libc.TLS, tif uintptr) (r int32) { return __TIFFFillStrilesInternal(tls, tif, int32(1)) } func __TIFFFillStrilesInternal(tls *libc.TLS, tif uintptr, loadStripByteCount int32) (r int32) { var return_value int32 var td uintptr _, _ = return_value, td td = tif + 56 return_value = int32(1) /* Do not do anything if TIFF_DEFERSTRILELOAD is not set */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x1000000) != 0) || (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x4000000) != uint32(0) { return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x2000000) != 0 { /* In case of lazy loading, reload completely the arrays */ X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p) X_TIFFfreeExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p = libc.UintptrFromInt32(0) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p = libc.UintptrFromInt32(0) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffsetbyteallocsize = uint32(0) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x2000000) } /* If stripoffset array is already loaded, exit with success */ if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p != libc.UintptrFromInt32(0) { return int32(1) } /* If tdir_count was canceled, then we already got there, but in error */ if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_entry.Ftdir_count == uint64(0) { return 0 } if !(_TIFFFetchStripThing(tls, tif, td+144, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips, td+132) != 0) { return_value = 0 } if loadStripByteCount != 0 && !(_TIFFFetchStripThing(tls, tif, td+176, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips, td+136) != 0) { return_value = 0 } X_TIFFmemset(tls, td+144, 0, int32(32)) X_TIFFmemset(tls, td+176, 0, int32(32)) return return_value } const FILETYPE_PAGE2 = 0x2 const FILETYPE_REDUCEDIMAGE2 = 0x1 const FLT_MAX4 = 3.40282346638528859812e+38 const INT64_MAX2 = 0x7fffffffffffffff const MAX_ITERATIONS = 64 const O_RDWR2 = 02 const TIFF_BUF4WRITE2 = 0x100000 const TIFF_BUFFERSETUP3 = 16 const TIFF_CHOPPEDUPARRAYS2 = 0x4000000 const TIFF_DEFERSTRILELOAD2 = 0x1000000 const TIFF_INSUBIFD3 = 8192 const TIFF_LAZYSTRILELOAD2 = 0x2000000 const TIFF_MYBUFFER5 = 512 const TIFF_PERSAMPLE2 = 0x400000 const TIFF_POSTENCODE3 = 4096 const TIFF_STRIPCHOP2 = 0x08000 const TIFF_UPSAMPLED2 = 0x04000 const UINT32_MAX3 = "0xffffffffu" const UINT64_MAX3 = "0xffffffffffffffffu" // C documentation // // /* // * Write the contents of the current directory // * to the specified file. This routine doesn't // * handle overwriting a directory with auxiliary // * storage that's been changed. // */ func XTIFFWriteDirectory(tls *libc.TLS, tif uintptr) (r int32) { return _TIFFWriteDirectorySec(tls, tif, int32(TRUE), int32(TRUE), libc.UintptrFromInt32(0)) } // C documentation // // /* // * This is an advanced writing function that must be used in a particular // * sequence, and generally together with TIFFForceStrileArrayWriting(), // * to make its intended effect. Its aim is to modify the location // * where the [Strip/Tile][Offsets/ByteCounts] arrays are located in the file. // * More precisely, when TIFFWriteCheck() will be called, the tag entries for // * those arrays will be written with type = count = offset = 0 as a temporary // * value. // * // * Its effect is only valid for the current directory, and before // * TIFFWriteDirectory() is first called, and will be reset when // * changing directory. // * // * The typical sequence of calls is: // * TIFFOpen() // * [ TIFFCreateDirectory(tif) ] // * Set fields with calls to TIFFSetField(tif, ...) // * TIFFDeferStrileArrayWriting(tif) // * TIFFWriteCheck(tif, ...) // * TIFFWriteDirectory(tif) // * ... potentially create other directories and come back to the above directory // * TIFFForceStrileArrayWriting(tif): emit the arrays at the end of file // * // * Returns 1 in case of success, 0 otherwise. // */ func XTIFFDeferStrileArrayWriting(tls *libc.TLS, tif uintptr) (r int32) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY3 { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+34248, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff != uint64(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module17)), __ccgo_ts+34278, 0) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_deferstrilearraywriting = uint8(TRUE) return int32(1) } var _module17 = [28]uint8{'T', 'I', 'F', 'F', 'D', 'e', 'f', 'e', 'r', 'S', 't', 'r', 'i', 'l', 'e', 'A', 'r', 'r', 'a', 'y', 'W', 'r', 'i', 't', 'i', 'n', 'g'} // C documentation // // /* // * Similar to TIFFWriteDirectory(), writes the directory out // * but leaves all data structures in memory so that it can be // * written again. This will make a partially written TIFF file // * readable before it is successfully completed/closed. // */ func XTIFFCheckpointDirectory(tls *libc.TLS, tif uintptr) (r int32) { var rc int32 _ = rc /* Setup the strips arrays, if they haven't already been. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_p == libc.UintptrFromInt32(0) { XTIFFSetupStrips(tls, tif) } rc = _TIFFWriteDirectorySec(tls, tif, int32(TRUE), FALSE, libc.UintptrFromInt32(0)) XTIFFSetWriteOffset(tls, tif, (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(0)), int32(2))) return rc } func XTIFFWriteCustomDirectory(tls *libc.TLS, tif uintptr, pdiroff uintptr) (r int32) { return _TIFFWriteDirectorySec(tls, tif, FALSE, FALSE, pdiroff) } /* * Similar to TIFFWriteDirectorySec(), but if the directory has already * been written once, it is relocated to the end of the file, in case it * has changed in size. Note that this will result in the loss of the * previously used directory space. */ func _TIFFRewriteDirectorySec(tls *libc.TLS, tif uintptr, isimage int32, imagedone int32, pdiroff uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var dircount1 Tuint16_t var nextdir Tuint32_t var nextdir1, torewritediroff Tuint64_t var _ /* dircount at bp+0 */ Tuint16_t var _ /* dircount64 at bp+16 */ Tuint64_t var _ /* m at bp+32 */ Tuint64_t var _ /* m at bp+8 */ Tuint32_t var _ /* nextnextdir at bp+24 */ Tuint64_t var _ /* nextnextdir at bp+4 */ Tuint32_t _, _, _, _ = dircount1, nextdir, nextdir1, torewritediroff /* We don't need to do anything special if it hasn't been written. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff == uint64(0) { return XTIFFWriteDirectory(tls, tif) } /* * Find and zero the pointer to this directory, so that TIFFLinkDirectory * will cause it to be added after this directories current pre-link. */ torewritediroff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { if uint64((*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff) == (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff { (*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff = uint32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = uint64(0) (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(4)), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, tif+632+4, libc.Int32FromInt32(4)) == libc.Int32FromInt32(4)) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+34313, 0) return 0 } } else { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff > uint64(0xFFFFFFFF) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module18)), __ccgo_ts+34340, 0) return 0 } else { nextdir = (*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff for int32(1) != 0 { if !(X_TIFFSeekOK(tls, tif, uint64(nextdir)) != 0) || !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp, libc.Int32FromInt32(2)) == libc.Int32FromInt32(2)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module18)), __ccgo_ts+34402, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp) } (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uint64(nextdir+libc.Uint32FromInt32(2)+libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp)))*libc.Int32FromInt32(12))), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+4, libc.Int32FromInt32(4)) == libc.Int32FromInt32(4)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module18)), __ccgo_ts+29207, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+4) } if uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 4))) == (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff { *(*Tuint32_t)(unsafe.Pointer(bp + 8)) = uint32(0) (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uint64(nextdir+libc.Uint32FromInt32(2)+libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp)))*libc.Int32FromInt32(12))), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+8, libc.Int32FromInt32(4)) == libc.Int32FromInt32(4)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module18)), __ccgo_ts+29562, 0) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = uint64(0) /* Force a full-traversal to reach the zeroed pointer */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff = uint64(0) break } nextdir = *(*Tuint32_t)(unsafe.Pointer(bp + 4)) } } } /* Remove skipped offset from IFD loop directory list. */ X_TIFFRemoveEntryFromDirectoryListByOffset(tls, tif, torewritediroff) } else { if (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff == (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff { (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = uint64(0) (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(8)), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, tif+632+8, libc.Int32FromInt32(8)) == libc.Int32FromInt32(8)) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+34313, 0) return 0 } } else { nextdir1 = (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff for int32(1) != 0 { if !(X_TIFFSeekOK(tls, tif, nextdir1) != 0) || !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+16, libc.Int32FromInt32(8)) == libc.Int32FromInt32(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module18)), __ccgo_ts+34402, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+16) } if *(*Tuint64_t)(unsafe.Pointer(bp + 16)) > uint64(0xFFFF) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module18)), __ccgo_ts+34433, 0) return 0 } dircount1 = uint16(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, nextdir1+libc.Uint64FromInt32(8)+libc.Uint64FromInt32(libc.Int32FromUint16(dircount1)*libc.Int32FromInt32(20)), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+24, libc.Int32FromInt32(8)) == libc.Int32FromInt32(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module18)), __ccgo_ts+29207, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+24) } if *(*Tuint64_t)(unsafe.Pointer(bp + 24)) == (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff { *(*Tuint64_t)(unsafe.Pointer(bp + 32)) = uint64(0) (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, nextdir1+libc.Uint64FromInt32(8)+libc.Uint64FromInt32(libc.Int32FromUint16(dircount1)*libc.Int32FromInt32(20)), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+32, libc.Int32FromInt32(8)) == libc.Int32FromInt32(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module18)), __ccgo_ts+29562, 0) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = uint64(0) /* Force a full-traversal to reach the zeroed pointer */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff = uint64(0) break } nextdir1 = *(*Tuint64_t)(unsafe.Pointer(bp + 24)) } } /* Remove skipped offset from IFD loop directory list. */ X_TIFFRemoveEntryFromDirectoryListByOffset(tls, tif, torewritediroff) } /* * Now use TIFFWriteDirectorySec() normally. */ return _TIFFWriteDirectorySec(tls, tif, isimage, imagedone, pdiroff) } var _module18 = [21]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'w', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y'} /*-- TIFFRewriteDirectorySec() --*/ // C documentation // // /* // * Similar to TIFFWriteDirectory(), but if the directory has already // * been written once, it is relocated to the end of the file, in case it // * has changed in size. Note that this will result in the loss of the // * previously used directory space. // */ func XTIFFRewriteDirectory(tls *libc.TLS, tif uintptr) (r int32) { return _TIFFRewriteDirectorySec(tls, tif, int32(TRUE), int32(TRUE), libc.UintptrFromInt32(0)) } func _TIFFWriteDirectorySec(tls *libc.TLS, tif uintptr, isimage int32, imagedone int32, pdiroff uintptr) (r int32) { bp := tls.Alloc(80) defer tls.Free(80) var count, dirsize, m, n, na1, pa Tuint32_t var dir, dirmem, n1, n2, nb1, o, o1, o2, v2 uintptr var tag Tuint16_t var tv_size, tv_size1 int32 var _ /* nTmp at bp+32 */ Tuint32_t var _ /* na at bp+4 */ Tuint16_t var _ /* nb at bp+8 */ uintptr var _ /* ndir at bp+0 */ Tuint32_t var _ /* p at bp+16 */ Tuint16_t var _ /* p at bp+20 */ Tuint32_t var _ /* pa at bp+24 */ Tuint32_t var _ /* pb at bp+12 */ uintptr var _ /* pb at bp+28 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = count, dir, dirmem, dirsize, m, n, n1, n2, na1, nb1, o, o1, o2, pa, tag, tv_size, tv_size1, v2 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY3 { return int32(1) } X_TIFFFillStriles(tls, tif) /* * Clear write state so that subsequent images with * different characteristics get the right buffers * setup for them. */ if imagedone != 0 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x01000) != 0 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x01000) if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode})))(tls, tif) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+34487, 0) return 0 } } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_close})))(tls, tif) /* shutdown encoder */ /* * Flush any data that might have been written * by the compression close+cleanup routines. But * be careful not to write stuff if we didn't add data * in the previous steps as the "rawcc" data may well be * a previously read tile/strip in mixed read/write mode. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc > 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00040) != uint32(0) { if !(XTIFFFlushData1(tls, tif) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+34530, 0) return 0 } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00200) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != 0 { X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^(libc.Uint32FromUint32(0x00040) | libc.Uint32FromUint32(0x00010)) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_COMPRESSION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_COMPRESSION)&libc.Int32FromInt32(0x1f))) != 0 && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_DEFLATE) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+34573, 0) } dir = libc.UintptrFromInt32(0) dirmem = libc.UintptrFromInt32(0) dirsize = uint32(0) for int32(1) != 0 { /* The first loop only determines "ndir" and uses TIFFLinkDirectory() to * set the offset at which the IFD is to be written to the file. * The second loop writes IFD entries to the file. */ *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(0) if dir == libc.UintptrFromInt32(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_write = uint64(0) } if isimage != 0 { if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_IMAGEDIMENSIONS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_IMAGEDIMENSIONS)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShortLong(tls, tif, bp, dir, uint16(TIFFTAG_IMAGEWIDTH), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagewidth) != 0) { goto bad } if !(_TIFFWriteDirectoryTagShortLong(tls, tif, bp, dir, uint16(TIFFTAG_IMAGELENGTH), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagelength) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TILEDIMENSIONS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_TILEDIMENSIONS)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShortLong(tls, tif, bp, dir, uint16(TIFFTAG_TILEWIDTH), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_tilewidth) != 0) { goto bad } if !(_TIFFWriteDirectoryTagShortLong(tls, tif, bp, dir, uint16(TIFFTAG_TILELENGTH), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_tilelength) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_RESOLUTION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_RESOLUTION)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagRational(tls, tif, bp, dir, uint16(TIFFTAG_XRESOLUTION), float64((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_xresolution)) != 0) { goto bad } if !(_TIFFWriteDirectoryTagRational(tls, tif, bp, dir, uint16(TIFFTAG_YRESOLUTION), float64((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_yresolution)) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_POSITION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_POSITION)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagRational(tls, tif, bp, dir, uint16(TIFFTAG_XPOSITION), float64((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_xposition)) != 0) { goto bad } if !(_TIFFWriteDirectoryTagRational(tls, tif, bp, dir, uint16(TIFFTAG_YPOSITION), float64((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_yposition)) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SUBFILETYPE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SUBFILETYPE)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagLong(tls, tif, bp, dir, uint16(TIFFTAG_SUBFILETYPE), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_subfiletype) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_BITSPERSAMPLE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_BITSPERSAMPLE)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShortPerSample(tls, tif, bp, dir, uint16(TIFFTAG_BITSPERSAMPLE), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_COMPRESSION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_COMPRESSION)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16(TIFFTAG_COMPRESSION), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_PHOTOMETRIC)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_PHOTOMETRIC)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16(TIFFTAG_PHOTOMETRIC), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_THRESHHOLDING)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_THRESHHOLDING)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16(TIFFTAG_THRESHHOLDING), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_threshholding) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_FILLORDER)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_FILLORDER)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16(TIFFTAG_FILLORDER), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_fillorder) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_ORIENTATION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_ORIENTATION)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16(TIFFTAG_ORIENTATION), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_orientation) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SAMPLESPERPIXEL)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SAMPLESPERPIXEL)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16(TIFFTAG_SAMPLESPERPIXEL), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_ROWSPERSTRIP)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_ROWSPERSTRIP)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShortLong(tls, tif, bp, dir, uint16(TIFFTAG_ROWSPERSTRIP), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_rowsperstrip) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_MINSAMPLEVALUE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_MINSAMPLEVALUE)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShortPerSample(tls, tif, bp, dir, uint16(TIFFTAG_MINSAMPLEVALUE), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_minsamplevalue) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_MAXSAMPLEVALUE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_MAXSAMPLEVALUE)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShortPerSample(tls, tif, bp, dir, uint16(TIFFTAG_MAXSAMPLEVALUE), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_maxsamplevalue) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_PLANARCONFIG)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_PLANARCONFIG)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16(TIFFTAG_PLANARCONFIG), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_planarconfig) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_RESOLUTIONUNIT)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_RESOLUTIONUNIT)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16(TIFFTAG_RESOLUTIONUNIT), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_resolutionunit) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_PAGENUMBER)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_PAGENUMBER)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShortArray(tls, tif, bp, dir, uint16(TIFFTAG_PAGENUMBER), uint32(2), tif+56+96) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_STRIPBYTECOUNTS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_STRIPBYTECOUNTS)&libc.Int32FromInt32(0x1f))) != 0 { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00400) != libc.Uint32FromInt32(0)) { if !(_TIFFWriteDirectoryTagLongLong8Array(tls, tif, bp, dir, uint16(TIFFTAG_STRIPBYTECOUNTS), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_p) != 0) { goto bad } } else { if !(_TIFFWriteDirectoryTagLongLong8Array(tls, tif, bp, dir, uint16(TIFFTAG_TILEBYTECOUNTS), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_p) != 0) { goto bad } } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_STRIPOFFSETS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_STRIPOFFSETS)&libc.Int32FromInt32(0x1f))) != 0 { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00400) != libc.Uint32FromInt32(0)) { /* td_stripoffset_p might be NULL in an odd OJPEG case. See * tif_dirread.c around line 3634. * XXX: OJPEG hack. * If a) compression is OJPEG, b) it's not a tiled TIFF, * and c) the number of strips is 1, * then we tolerate the absence of stripoffsets tag, * because, presumably, all required data is in the * JpegInterchangeFormat stream. * We can get here when using tiffset on such a file. * See http://bugzilla.maptools.org/show_bug.cgi?id=2500 */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_p != libc.UintptrFromInt32(0) && !(_TIFFWriteDirectoryTagLongLong8Array(tls, tif, bp, dir, uint16(TIFFTAG_STRIPOFFSETS), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_p) != 0) { goto bad } } else { if !(_TIFFWriteDirectoryTagLongLong8Array(tls, tif, bp, dir, uint16(TIFFTAG_TILEOFFSETS), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_p) != 0) { goto bad } } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_COLORMAP)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_COLORMAP)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagColormap(tls, tif, bp, dir) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_EXTRASAMPLES)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_EXTRASAMPLES)&libc.Int32FromInt32(0x1f))) != 0 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_extrasamples != 0 { XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_EXTRASAMPLES), libc.VaList(bp+48, bp+4, bp+8)) if !(_TIFFWriteDirectoryTagShortArray(tls, tif, bp, dir, uint16(TIFFTAG_EXTRASAMPLES), uint32(*(*Tuint16_t)(unsafe.Pointer(bp + 4))), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) { goto bad } } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SAMPLEFORMAT)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SAMPLEFORMAT)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShortPerSample(tls, tif, bp, dir, uint16(TIFFTAG_SAMPLEFORMAT), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_sampleformat) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SMINSAMPLEVALUE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SMINSAMPLEVALUE)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagSampleformatArray(tls, tif, bp, dir, uint16(TIFFTAG_SMINSAMPLEVALUE), uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_sminsamplevalue) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SMAXSAMPLEVALUE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SMAXSAMPLEVALUE)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagSampleformatArray(tls, tif, bp, dir, uint16(TIFFTAG_SMAXSAMPLEVALUE), uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_smaxsamplevalue) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_IMAGEDEPTH)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_IMAGEDEPTH)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagLong(tls, tif, bp, dir, uint16(TIFFTAG_IMAGEDEPTH), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagedepth) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TILEDEPTH)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_TILEDEPTH)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagLong(tls, tif, bp, dir, uint16(TIFFTAG_TILEDEPTH), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_tiledepth) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_HALFTONEHINTS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_HALFTONEHINTS)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShortArray(tls, tif, bp, dir, uint16(TIFFTAG_HALFTONEHINTS), uint32(2), tif+56+112) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_YCBCRSUBSAMPLING)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_YCBCRSUBSAMPLING)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShortArray(tls, tif, bp, dir, uint16(TIFFTAG_YCBCRSUBSAMPLING), uint32(2), tif+56+216) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_YCBCRPOSITIONING)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_YCBCRPOSITIONING)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16(TIFFTAG_YCBCRPOSITIONING), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_ycbcrpositioning) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_REFBLACKWHITE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_REFBLACKWHITE)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagRationalArray(tls, tif, bp, dir, uint16(TIFFTAG_REFERENCEBLACKWHITE), uint32(6), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_refblackwhite) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TRANSFERFUNCTION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_TRANSFERFUNCTION)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagTransferfunction(tls, tif, bp, dir) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_INKNAMES)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_INKNAMES)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagAscii(tls, tif, bp, dir, uint16(TIFFTAG_INKNAMES), libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_inknameslen), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_inknames) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_NUMBEROFINKS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_NUMBEROFINKS)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16(TIFFTAG_NUMBEROFINKS), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_numberofinks) != 0) { goto bad } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SUBIFD)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SUBIFD)&libc.Int32FromInt32(0x1f))) != 0 { if !(_TIFFWriteDirectoryTagSubifd(tls, tif, bp, dir) != 0) { goto bad } } n = uint32(0) for { if !(n < (*TTIFF)(unsafe.Pointer(tif)).Ftif_nfields) { break } o = *(*uintptr)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_fields + uintptr(n)*4)) if libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(o)).Ffield_bit) >= int32(FIELD_CODEC) && *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(o)).Ffield_bit)/int32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(o)).Ffield_bit)&libc.Int32FromInt32(0x1f))) != 0 { switch (*TTIFFField)(unsafe.Pointer(o)).Fset_field_type { case int32(TIFF_SETGET_ASCII): XTIFFGetField(tls, tif, (*TTIFFField)(unsafe.Pointer(o)).Ffield_tag, libc.VaList(bp+48, bp+12)) pa = libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 12))) if !(_TIFFWriteDirectoryTagAscii(tls, tif, bp, dir, uint16((*TTIFFField)(unsafe.Pointer(o)).Ffield_tag), pa, *(*uintptr)(unsafe.Pointer(bp + 12))) != 0) { goto bad } case int32(TIFF_SETGET_UINT16): XTIFFGetField(tls, tif, (*TTIFFField)(unsafe.Pointer(o)).Ffield_tag, libc.VaList(bp+48, bp+16)) if !(_TIFFWriteDirectoryTagShort(tls, tif, bp, dir, uint16((*TTIFFField)(unsafe.Pointer(o)).Ffield_tag), *(*Tuint16_t)(unsafe.Pointer(bp + 16))) != 0) { goto bad } case int32(TIFF_SETGET_UINT32): XTIFFGetField(tls, tif, (*TTIFFField)(unsafe.Pointer(o)).Ffield_tag, libc.VaList(bp+48, bp+20)) if !(_TIFFWriteDirectoryTagLong(tls, tif, bp, dir, uint16((*TTIFFField)(unsafe.Pointer(o)).Ffield_tag), *(*Tuint32_t)(unsafe.Pointer(bp + 20))) != 0) { goto bad } case int32(TIFF_SETGET_C32_UINT8): XTIFFGetField(tls, tif, (*TTIFFField)(unsafe.Pointer(o)).Ffield_tag, libc.VaList(bp+48, bp+24, bp+28)) if !(_TIFFWriteDirectoryTagUndefinedArray(tls, tif, bp, dir, uint16((*TTIFFField)(unsafe.Pointer(o)).Ffield_tag), *(*Tuint32_t)(unsafe.Pointer(bp + 24)), *(*uintptr)(unsafe.Pointer(bp + 28))) != 0) { goto bad } default: if (*TTIFFField)(unsafe.Pointer(o)).Ffield_name != 0 { v2 = (*TTIFFField)(unsafe.Pointer(o)).Ffield_name } else { v2 = __ccgo_ts + 34676 } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+34684, libc.VaList(bp+48, XTIFFFieldTag(tls, o), v2)) goto bad } } goto _1 _1: ; n++ } } m = uint32(0) for { if !(m < libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValueCount)) { break } tag = uint16((*TTIFFField)(unsafe.Pointer((*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Finfo)).Ffield_tag) count = libc.Uint32FromInt32((*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fcount) switch (*TTIFFField)(unsafe.Pointer((*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Finfo)).Ffield_type { case int32(TIFF_ASCII): if !(_TIFFWriteDirectoryTagAscii(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_UNDEFINED): if !(_TIFFWriteDirectoryTagUndefinedArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_BYTE): if !(_TIFFWriteDirectoryTagByteArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_SBYTE): if !(_TIFFWriteDirectoryTagSbyteArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_SHORT): if !(_TIFFWriteDirectoryTagShortArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_SSHORT): if !(_TIFFWriteDirectoryTagSshortArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_LONG): if !(_TIFFWriteDirectoryTagLongArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_SLONG): if !(_TIFFWriteDirectoryTagSlongArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_LONG8): if !(_TIFFWriteDirectoryTagLong8Array(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_SLONG8): if !(_TIFFWriteDirectoryTagSlong8Array(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_RATIONAL): tv_size = XTIFFFieldSetGetSize(tls, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Finfo) if tv_size == int32(8) { if !(_TIFFWriteDirectoryTagRationalDoubleArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } } else { /*-- default should be tv_size == 4 */ if !(_TIFFWriteDirectoryTagRationalArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } /*-- ToDo: After Testing, this should be removed and * tv_size==4 should be set as default. */ if tv_size != int32(4) { XTIFFErrorExtR(tls, tif, __ccgo_ts+34709, __ccgo_ts+34743, libc.VaList(bp+48, tv_size)) } } case int32(TIFF_SRATIONAL): tv_size1 = XTIFFFieldSetGetSize(tls, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Finfo) if tv_size1 == int32(8) { if !(_TIFFWriteDirectoryTagSrationalDoubleArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } } else { /*-- default should be tv_size == 4 */ if !(_TIFFWriteDirectoryTagSrationalArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } /*-- ToDo: After Testing, this should be removed and * tv_size==4 should be set as default. */ if tv_size1 != int32(4) { XTIFFErrorExtR(tls, tif, __ccgo_ts+34709, __ccgo_ts+34743, libc.VaList(bp+48, tv_size1)) } } case int32(TIFF_FLOAT): if !(_TIFFWriteDirectoryTagFloatArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_DOUBLE): if !(_TIFFWriteDirectoryTagDoubleArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_IFD): if !(_TIFFWriteDirectoryTagIfdArray(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } case int32(TIFF_IFD8): if !(_TIFFWriteDirectoryTagIfdIfd8Array(tls, tif, bp, dir, tag, count, (*(*TTIFFTagValue)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_customValues + uintptr(m)*12))).Fvalue) != 0) { goto bad } default: /* we should never get here */ break } goto _3 _3: ; m++ } /* "break" if IFD has been written above in second pass.*/ if dir != libc.UintptrFromInt32(0) { break } /* Evaluate IFD data size: Finally, add the size of the IFD tag entries * themselves. */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_write += uint64(uint32(2) + *(*Tuint32_t)(unsafe.Pointer(bp))*uint32(12) + uint32(4)) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_write += uint64(uint32(8) + *(*Tuint32_t)(unsafe.Pointer(bp))*uint32(20) + uint32(8)) } /* Setup a new directory within first pass. */ dir = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))*uint32(32))) if dir == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+9697, 0) goto bad } if isimage != 0 { /* Check, weather the IFD to be written is new or an already written * IFD can be overwritten or needs to be re-written to a different * location in the file because the IFD is extended with additional * tags or the IFD data size is increased. * - tif_diroff == 0, if a new directory has to be linked. * - tif_diroff != 0, IFD has been re-read from file and will be * overwritten or re-written. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff == uint64(0) { if !(_TIFFLinkDirectory(tls, tif) != 0) { goto bad } } else { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_write > (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_read { if dir != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, dir) dir = libc.UintptrFromInt32(0) } if !(_TIFFRewriteDirectorySec(tls, tif, isimage, imagedone, pdiroff) != 0) { goto bad } return int32(1) } } } else { /* For !isimage, which means custom-IFD like EXIFIFD or * checkpointing an IFD, determine whether to overwrite or append at * the end of the file. */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_read > uint64(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_write <= (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_read) { /* Append at end of file and increment to an even offset. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = ((*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(0)), int32(2)) + uint64(1)) & ^libc.Uint64FromInt32(1) } } /* Return IFD offset */ if pdiroff != libc.UintptrFromInt32(0) { *(*Tuint64_t)(unsafe.Pointer(pdiroff)) = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { dirsize = uint32(2) + *(*Tuint32_t)(unsafe.Pointer(bp))*uint32(12) + uint32(4) } else { dirsize = uint32(8) + *(*Tuint32_t)(unsafe.Pointer(bp))*uint32(20) + uint32(8) } /* Append IFD data stright after the IFD tag entries. * Data that does not fit into an IFD tag entry is written to the file * in the second pass of the while loop. That offset is stored in "dir". */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff + uint64(dirsize) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff = uint64(uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff)) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff < (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff || (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff < uint64(dirsize) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+34792, 0) goto bad } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff&uint64(1) != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff++ } } /* while() */ if isimage != 0 { /* For SubIFDs remember offset of SubIFD tag within main IFD. * However, might be already done in TIFFWriteDirectoryTagSubifd() if * there are more than one SubIFD. */ if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SUBIFD)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SUBIFD)&libc.Int32FromInt32(0x1f))) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_subifdoff == uint64(0) { na1 = uint32(0) nb1 = dir for { if na1 == *(*Tuint32_t)(unsafe.Pointer(bp)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+34824, 0) goto bad } if libc.Int32FromUint16((*TTIFFDirEntry)(unsafe.Pointer(nb1)).Ftdir_tag) == int32(TIFFTAG_SUBIFD) { break } goto _4 _4: ; na1++ nb1 += 32 } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_subifdoff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff + uint64(2) + uint64(na1*uint32(12)) + uint64(8) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_subifdoff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff + uint64(8) + uint64(na1*uint32(20)) + uint64(12) } } } /* Copy/swab IFD entries from "dir" into "dirmem", * which is then written to file. */ dirmem = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(dirsize)) if dirmem == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+9697, 0) goto bad } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { n1 = dirmem *(*Tuint16_t)(unsafe.Pointer(n1)) = uint16(*(*Tuint32_t)(unsafe.Pointer(bp))) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, n1) } n1 += uintptr(2) o1 = dir m = uint32(0) for { if !(m < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } *(*Tuint16_t)(unsafe.Pointer(n1)) = (*TTIFFDirEntry)(unsafe.Pointer(o1)).Ftdir_tag if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, n1) } n1 += uintptr(2) *(*Tuint16_t)(unsafe.Pointer(n1)) = (*TTIFFDirEntry)(unsafe.Pointer(o1)).Ftdir_type if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, n1) } n1 += uintptr(2) *(*Tuint32_t)(unsafe.Pointer(bp + 32)) = uint32((*TTIFFDirEntry)(unsafe.Pointer(o1)).Ftdir_count) X_TIFFmemcpy(tls, n1, bp+32, int32(4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, n1) } n1 += uintptr(4) /* This is correct. The data has been */ /* swabbed previously in TIFFWriteDirectoryTagData */ X_TIFFmemcpy(tls, n1, o1+16, int32(4)) n1 += uintptr(4) o1 += 32 goto _5 _5: ; m++ } *(*Tuint32_t)(unsafe.Pointer(bp + 32)) = uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+32) } X_TIFFmemcpy(tls, n1, bp+32, int32(4)) } else { n2 = dirmem *(*Tuint64_t)(unsafe.Pointer(n2)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp))) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, n2) } n2 += uintptr(8) o2 = dir m = uint32(0) for { if !(m < *(*Tuint32_t)(unsafe.Pointer(bp))) { break } *(*Tuint16_t)(unsafe.Pointer(n2)) = (*TTIFFDirEntry)(unsafe.Pointer(o2)).Ftdir_tag if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, n2) } n2 += uintptr(2) *(*Tuint16_t)(unsafe.Pointer(n2)) = (*TTIFFDirEntry)(unsafe.Pointer(o2)).Ftdir_type if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, n2) } n2 += uintptr(2) X_TIFFmemcpy(tls, n2, o2+8, int32(8)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, n2) } n2 += uintptr(8) X_TIFFmemcpy(tls, n2, o2+16, int32(8)) n2 += uintptr(8) o2 += 32 goto _6 _6: ; m++ } X_TIFFmemcpy(tls, n2, tif+24, int32(8)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, n2) } } X_TIFFfreeExt(tls, tif, dir) dir = libc.UintptrFromInt32(0) if !(X_TIFFSeekOK(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+34847, 0) goto bad } if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, dirmem, libc.Int32FromUint32(dirsize)) == libc.Int32FromUint32(dirsize)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+34892, 0) goto bad } X_TIFFfreeExt(tls, tif, dirmem) /* Increment tif_curdir if IFD wasn't already written to file and no error * occurred during IFD writing above. */ if isimage != 0 && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_iswrittentofile != 0) { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x02000) != 0 && !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SUBIFD)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SUBIFD)&libc.Int32FromInt32(0x1f))) != 0)) { /*-- Normal main-IFD case --*/ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount != uint32(0xffffffff) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount } else { /*ToDo SU: NEW_IFD_CURDIR_INCREMENTING: Delete this * unexpected case after some testing time. */ /* Attention: tif->tif_curdircount is already set within * TIFFNumberOfDirectories() */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount = XTIFFNumberOfDirectories(tls, tif) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+34919, libc.VaList(bp+48, int32(1330))) goto bad } } else { /*-- SubIFD case -- */ /* tif_curdir is always set to 0 for all SubIFDs. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0) } } /* Increment tif_curdircount only if main-IFD of an image was not already * present on file. */ /* Check in combination with (... && !(TIFFFieldSet(tif, FIELD_SUBIFD))) * is necessary here because TIFF_INSUBIFD was already set above for the * next SubIFD when this main-IFD (with FIELD_SUBIFD) is currently being * written. */ if isimage != 0 && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_iswrittentofile != 0) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x02000) != 0 && !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SUBIFD)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SUBIFD)&libc.Int32FromInt32(0x1f))) != 0)) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount++ } (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_iswrittentofile = uint8(TRUE) /* Reset SubIFD writing stage after last SubIFD has been written. */ if imagedone != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x02000) != 0 && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_nsubifd) == 0 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x02000) } /* Add or update this directory to the IFD list. */ if !(X_TIFFCheckDirNumberAndOffset(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir, (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module19)), __ccgo_ts+29057, libc.VaList(bp+48, (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir, (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff, (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff)) } if imagedone != 0 { XTIFFFreeDirectory(tls, tif) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00008) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x200000) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup})))(tls, tif) /* Reset directory-related state for subsequent directories. */ XTIFFCreateDirectory(tls, tif) } else { /* IFD is only checkpointed to file (or a custom IFD like EXIF is * written), thus set IFD data size written to file. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_read = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_write } return int32(1) goto bad bad: ; if dir != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, dir) } if dirmem != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, dirmem) } return 0 } var _module19 = [22]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'S', 'e', 'c'} func _TIFFClampDoubleToInt8(tls *libc.TLS, val float64) (r Tint8_t) { if val > libc.Float64FromInt32(127) { return int8(127) } if val < float64(-libc.Int32FromInt32(128)) || val != val { return int8(-int32(128)) } return int8(val) } func _TIFFClampDoubleToInt16(tls *libc.TLS, val float64) (r Tint16_t) { if val > libc.Float64FromInt32(32767) { return int16(32767) } if val < float64(-libc.Int32FromInt32(32768)) || val != val { return int16(-int32(32768)) } return int16(val) } func _TIFFClampDoubleToInt32(tls *libc.TLS, val float64) (r Tint32_t) { if val > libc.Float64FromInt32(0x7FFFFFFF) { return int32(0x7FFFFFFF) } if val < float64(-libc.Int32FromInt32(0x7FFFFFFF)-libc.Int32FromInt32(1)) || val != val { return -libc.Int32FromInt32(0x7FFFFFFF) - libc.Int32FromInt32(1) } return int32(val) } func _TIFFClampDoubleToUInt8(tls *libc.TLS, val float64) (r Tuint8_t) { if val < libc.Float64FromInt32(0) { return uint8(0) } if val > libc.Float64FromInt32(255) || val != val { return uint8(255) } return uint8(val) } func _TIFFClampDoubleToUInt16(tls *libc.TLS, val float64) (r Tuint16_t) { if val < libc.Float64FromInt32(0) { return uint16(0) } if val > libc.Float64FromInt32(65535) || val != val { return uint16(65535) } return uint16(val) } func _TIFFClampDoubleToUInt32(tls *libc.TLS, val float64) (r Tuint32_t) { if val < libc.Float64FromInt32(0) { return uint32(0) } if val > libc.Float64FromUint32(0xFFFFFFFF) || val != val { return uint32(0xFFFFFFFF) } return uint32(val) } func _TIFFWriteDirectoryTagSampleformatArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { var conv uintptr var i Tuint32_t var ok int32 _, _, _ = conv, i, ok conv = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(count*uint32(8))) if conv == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module20)), __ccgo_ts+9697, 0) return 0 } switch libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_sampleformat) { case int32(SAMPLEFORMAT_IEEEFP): if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) <= int32(32) { i = uint32(0) for { if !(i < count) { break } *(*float32)(unsafe.Pointer(conv + uintptr(i)*4)) = X_TIFFClampDoubleToFloat(tls, *(*float64)(unsafe.Pointer(value + uintptr(i)*8))) goto _1 _1: ; i++ } ok = _TIFFWriteDirectoryTagFloatArray(tls, tif, ndir, dir, tag, count, conv) } else { ok = _TIFFWriteDirectoryTagDoubleArray(tls, tif, ndir, dir, tag, count, value) } case int32(SAMPLEFORMAT_INT): if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) <= int32(8) { i = uint32(0) for { if !(i < count) { break } *(*Tint8_t)(unsafe.Pointer(conv + uintptr(i))) = _TIFFClampDoubleToInt8(tls, *(*float64)(unsafe.Pointer(value + uintptr(i)*8))) goto _2 _2: ; i++ } ok = _TIFFWriteDirectoryTagSbyteArray(tls, tif, ndir, dir, tag, count, conv) } else { if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) <= int32(16) { i = uint32(0) for { if !(i < count) { break } *(*Tint16_t)(unsafe.Pointer(conv + uintptr(i)*2)) = _TIFFClampDoubleToInt16(tls, *(*float64)(unsafe.Pointer(value + uintptr(i)*8))) goto _3 _3: ; i++ } ok = _TIFFWriteDirectoryTagSshortArray(tls, tif, ndir, dir, tag, count, conv) } else { i = uint32(0) for { if !(i < count) { break } *(*Tint32_t)(unsafe.Pointer(conv + uintptr(i)*4)) = _TIFFClampDoubleToInt32(tls, *(*float64)(unsafe.Pointer(value + uintptr(i)*8))) goto _4 _4: ; i++ } ok = _TIFFWriteDirectoryTagSlongArray(tls, tif, ndir, dir, tag, count, conv) } } case int32(SAMPLEFORMAT_UINT): if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) <= int32(8) { i = uint32(0) for { if !(i < count) { break } *(*Tuint8_t)(unsafe.Pointer(conv + uintptr(i))) = _TIFFClampDoubleToUInt8(tls, *(*float64)(unsafe.Pointer(value + uintptr(i)*8))) goto _5 _5: ; i++ } ok = _TIFFWriteDirectoryTagByteArray(tls, tif, ndir, dir, tag, count, conv) } else { if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) <= int32(16) { i = uint32(0) for { if !(i < count) { break } *(*Tuint16_t)(unsafe.Pointer(conv + uintptr(i)*2)) = _TIFFClampDoubleToUInt16(tls, *(*float64)(unsafe.Pointer(value + uintptr(i)*8))) goto _6 _6: ; i++ } ok = _TIFFWriteDirectoryTagShortArray(tls, tif, ndir, dir, tag, count, conv) } else { i = uint32(0) for { if !(i < count) { break } *(*Tuint32_t)(unsafe.Pointer(conv + uintptr(i)*4)) = _TIFFClampDoubleToUInt32(tls, *(*float64)(unsafe.Pointer(value + uintptr(i)*8))) goto _7 _7: ; i++ } ok = _TIFFWriteDirectoryTagLongArray(tls, tif, ndir, dir, tag, count, conv) } } default: ok = 0 } X_TIFFfreeExt(tls, tif, conv) return ok } var _module20 = [39]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'S', 'a', 'm', 'p', 'l', 'e', 'f', 'o', 'r', 'm', 'a', 't', 'A', 'r', 'r', 'a', 'y'} func _TIFFWriteDirectoryTagAscii(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedAscii(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagUndefinedArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedUndefinedArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagByteArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedByteArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagSbyteArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedSbyteArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagShort(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, value Tuint16_t) (r int32) { return _TIFFWriteDirectoryTagCheckedShort(tls, tif, ndir, dir, tag, value) } func _TIFFWriteDirectoryTagShortArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedShortArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagShortPerSample(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, value Tuint16_t) (r int32) { var m, na uintptr var nb Tuint16_t var o int32 _, _, _, _ = m, na, nb, o if dir == libc.UintptrFromInt32(0) { /* only evaluate IFD data size and inc. ndir */ return _TIFFWriteDirectoryTagCheckedShortArray(tls, tif, ndir, dir, tag, uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel), libc.UintptrFromInt32(0)) } m = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel)*uint32(2))) if m == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module21)), __ccgo_ts+9697, 0) return 0 } na = m nb = libc.Uint16FromInt32(0) for { if !(libc.Int32FromUint16(nb) < libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel)) { break } *(*Tuint16_t)(unsafe.Pointer(na)) = value goto _1 _1: ; na += 2 nb++ } o = _TIFFWriteDirectoryTagCheckedShortArray(tls, tif, ndir, dir, tag, uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel), m) X_TIFFfreeExt(tls, tif, m) return o } var _module21 = [36]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'S', 'h', 'o', 'r', 't', 'P', 'e', 'r', 'S', 'a', 'm', 'p', 'l', 'e'} func _TIFFWriteDirectoryTagSshortArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedSshortArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagLong(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, value Tuint32_t) (r int32) { return _TIFFWriteDirectoryTagCheckedLong(tls, tif, ndir, dir, tag, value) } func _TIFFWriteDirectoryTagLongArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedLongArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagSlongArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedSlongArray(tls, tif, ndir, dir, tag, count, value) } // C documentation // // /************************************************************************/ // /* TIFFWriteDirectoryTagLong8Array() */ // /* */ // /* Write either Long8 or Long array depending on file type. */ // /************************************************************************/ func _TIFFWriteDirectoryTagLong8Array(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var ma, p, q uintptr var mb Tuint32_t var o int32 _, _, _, _, _ = ma, mb, o, p, q /* is this just a counting pass? */ if dir == libc.UintptrFromInt32(0) { /* only evaluate IFD data size and inc. ndir */ return _TIFFWriteDirectoryTagCheckedLong8Array(tls, tif, ndir, dir, tag, count, value) } /* We always write Long8 for BigTIFF, no checking needed. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { return _TIFFWriteDirectoryTagCheckedLong8Array(tls, tif, ndir, dir, tag, count, value) } /* ** For classic tiff we want to verify everything is in range for long ** and convert to long format. */ p = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(count*uint32(4))) if p == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module22)), __ccgo_ts+9697, 0) return 0 } q = p ma = value mb = libc.Uint32FromInt32(0) for { if !(mb < count) { break } if *(*Tuint64_t)(unsafe.Pointer(ma)) > uint64(0xFFFFFFFF) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module22)), __ccgo_ts+34992, libc.VaList(bp+8, *(*Tuint64_t)(unsafe.Pointer(ma)), libc.Int32FromUint16(tag))) X_TIFFfreeExt(tls, tif, p) return 0 } *(*Tuint32_t)(unsafe.Pointer(q)) = uint32(*(*Tuint64_t)(unsafe.Pointer(ma))) goto _1 _1: ; ma += 8 mb++ q += 4 } o = _TIFFWriteDirectoryTagCheckedLongArray(tls, tif, ndir, dir, tag, count, p) X_TIFFfreeExt(tls, tif, p) return o } var _module22 = [32]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'L', 'o', 'n', 'g', '8', 'A', 'r', 'r', 'a', 'y'} // C documentation // // /************************************************************************/ // /* TIFFWriteDirectoryTagSlong8Array() */ // /* */ // /* Write either SLong8 or SLong array depending on file type. */ // /************************************************************************/ func _TIFFWriteDirectoryTagSlong8Array(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var ma, p, q uintptr var mb Tuint32_t var o int32 _, _, _, _, _ = ma, mb, o, p, q /* is this just a counting pass? */ if dir == libc.UintptrFromInt32(0) { /* only evaluate IFD data size and inc. ndir */ return _TIFFWriteDirectoryTagCheckedSlong8Array(tls, tif, ndir, dir, tag, count, value) } /* We always write SLong8 for BigTIFF, no checking needed. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { return _TIFFWriteDirectoryTagCheckedSlong8Array(tls, tif, ndir, dir, tag, count, value) } /* ** For classic tiff we want to verify everything is in range for signed-long ** and convert to signed-long format. */ p = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(count*uint32(4))) if p == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module23)), __ccgo_ts+9697, 0) return 0 } q = p ma = value mb = libc.Uint32FromInt32(0) for { if !(mb < count) { break } if *(*Tint64_t)(unsafe.Pointer(ma)) > int64(libc.Int32FromInt32(2147483647)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module23)), __ccgo_ts+35116, libc.VaList(bp+8, *(*Tint64_t)(unsafe.Pointer(ma)), libc.Int32FromUint16(tag))) X_TIFFfreeExt(tls, tif, p) return 0 } else { if *(*Tint64_t)(unsafe.Pointer(ma)) < int64(-libc.Int32FromInt32(2147483647)-libc.Int32FromInt32(1)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module23)), __ccgo_ts+35254, libc.VaList(bp+8, *(*Tint64_t)(unsafe.Pointer(ma)), libc.Int32FromUint16(tag))) X_TIFFfreeExt(tls, tif, p) return 0 } } *(*Tint32_t)(unsafe.Pointer(q)) = int32(*(*Tint64_t)(unsafe.Pointer(ma))) goto _1 _1: ; ma += 8 mb++ q += 4 } o = _TIFFWriteDirectoryTagCheckedSlongArray(tls, tif, ndir, dir, tag, count, p) X_TIFFfreeExt(tls, tif, p) return o } var _module23 = [33]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'S', 'l', 'o', 'n', 'g', '8', 'A', 'r', 'r', 'a', 'y'} func _TIFFWriteDirectoryTagRational(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, value float64) (r int32) { return _TIFFWriteDirectoryTagCheckedRational(tls, tif, ndir, dir, tag, value) } func _TIFFWriteDirectoryTagRationalArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedRationalArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagSrationalArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedSrationalArray(tls, tif, ndir, dir, tag, count, value) } // C documentation // // /*-- Rational2Double: additional write functions */ func _TIFFWriteDirectoryTagRationalDoubleArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedRationalDoubleArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagSrationalDoubleArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedSrationalDoubleArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagFloatArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedFloatArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagDoubleArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedDoubleArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagIfdArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { return _TIFFWriteDirectoryTagCheckedIfdArray(tls, tif, ndir, dir, tag, count, value) } func _TIFFWriteDirectoryTagShortLong(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, value Tuint32_t) (r int32) { if value <= uint32(0xFFFF) { return _TIFFWriteDirectoryTagCheckedShort(tls, tif, ndir, dir, tag, uint16(value)) } else { return _TIFFWriteDirectoryTagCheckedLong(tls, tif, ndir, dir, tag, value) } return r } func __WriteAsType(tls *libc.TLS, tif uintptr, strile_size Tuint64_t, uncompressed_threshold Tuint64_t) (r int32) { var compression Tuint16_t _ = compression compression = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression if libc.Int32FromUint16(compression) == int32(COMPRESSION_NONE) { return libc.BoolInt32(strile_size > uncompressed_threshold) } else { if libc.Int32FromUint16(compression) == int32(COMPRESSION_JPEG) || libc.Int32FromUint16(compression) == int32(COMPRESSION_LZW) || libc.Int32FromUint16(compression) == int32(COMPRESSION_ADOBE_DEFLATE) || libc.Int32FromUint16(compression) == int32(COMPRESSION_DEFLATE) || libc.Int32FromUint16(compression) == int32(COMPRESSION_LZMA) || libc.Int32FromUint16(compression) == int32(COMPRESSION_LERC) || libc.Int32FromUint16(compression) == int32(COMPRESSION_ZSTD) || libc.Int32FromUint16(compression) == int32(COMPRESSION_WEBP) || libc.Int32FromUint16(compression) == int32(COMPRESSION_JXL) { /* For a few select compression types, we assume that in the worst */ /* case the compressed size will be 10 times the uncompressed size. */ /* This is overly pessismistic ! */ return libc.BoolInt32(strile_size >= uncompressed_threshold/uint64(10)) } } return int32(1) } func _WriteAsLong8(tls *libc.TLS, tif uintptr, strile_size Tuint64_t) (r int32) { return __WriteAsType(tls, tif, strile_size, uint64(0xFFFFFFFF)) } func _WriteAsLong4(tls *libc.TLS, tif uintptr, strile_size Tuint64_t) (r int32) { return __WriteAsType(tls, tif, strile_size, uint64(0xFFFF)) } /************************************************************************/ /* TIFFWriteDirectoryTagLongLong8Array() */ /* */ /* Write out LONG8 array and write a SHORT/LONG/LONG8 depending */ /* on strile size and Classic/BigTIFF mode. */ /************************************************************************/ func _TIFFWriteDirectoryTagLongLong8Array(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { var ma, ma1, p, p1, q, q1 uintptr var mb, mb1 Tuint32_t var o, write_aslong4, write_aslong8 int32 _, _, _, _, _, _, _, _, _, _, _ = ma, ma1, mb, mb1, o, p, p1, q, q1, write_aslong4, write_aslong8 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_deferstrilearraywriting != 0 { if dir == libc.UintptrFromInt32(0) { /* This is just a counting pass to count IFD entries. * For deferstrilearraywriting no extra bytes will be written * into IFD space. */ *(*Tuint32_t)(unsafe.Pointer(ndir))++ return int32(1) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_NOTYPE), uint32(0), uint32(0), libc.UintptrFromInt32(0)) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { write_aslong8 = int32(1) /* In the case of ByteCounts array, we may be able to write them on LONG * if the strip/tilesize is not too big. Also do that for count > 1 in * the case someone would want to create a single-strip file with a * growing height, in which case using LONG8 will be safer. */ if count > uint32(1) && libc.Int32FromUint16(tag) == int32(TIFFTAG_STRIPBYTECOUNTS) { write_aslong8 = _WriteAsLong8(tls, tif, XTIFFStripSize64(tls, tif)) } else { if count > uint32(1) && libc.Int32FromUint16(tag) == int32(TIFFTAG_TILEBYTECOUNTS) { write_aslong8 = _WriteAsLong8(tls, tif, XTIFFTileSize64(tls, tif)) } } if write_aslong8 != 0 { return _TIFFWriteDirectoryTagCheckedLong8Array(tls, tif, ndir, dir, tag, count, value) } } write_aslong4 = int32(1) if count > uint32(1) && libc.Int32FromUint16(tag) == int32(TIFFTAG_STRIPBYTECOUNTS) { write_aslong4 = _WriteAsLong4(tls, tif, XTIFFStripSize64(tls, tif)) } else { if count > uint32(1) && libc.Int32FromUint16(tag) == int32(TIFFTAG_TILEBYTECOUNTS) { write_aslong4 = _WriteAsLong4(tls, tif, XTIFFTileSize64(tls, tif)) } } if write_aslong4 != 0 { /* ** For classic tiff we want to verify everything is in range for LONG ** and convert to long format. */ p = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(count*uint32(4))) if p == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module24)), __ccgo_ts+9697, 0) return 0 } q = p ma = value mb = libc.Uint32FromInt32(0) for { if !(mb < count) { break } if *(*Tuint64_t)(unsafe.Pointer(ma)) > uint64(0xFFFFFFFF) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module24)), __ccgo_ts+35394, 0) X_TIFFfreeExt(tls, tif, p) return 0 } *(*Tuint32_t)(unsafe.Pointer(q)) = uint32(*(*Tuint64_t)(unsafe.Pointer(ma))) goto _1 _1: ; ma += 8 mb++ q += 4 } o = _TIFFWriteDirectoryTagCheckedLongArray(tls, tif, ndir, dir, tag, count, p) X_TIFFfreeExt(tls, tif, p) } else { p1 = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(count*uint32(2))) if p1 == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module24)), __ccgo_ts+9697, 0) return 0 } q1 = p1 ma1 = value mb1 = libc.Uint32FromInt32(0) for { if !(mb1 < count) { break } if *(*Tuint64_t)(unsafe.Pointer(ma1)) > uint64(0xFFFF) { /* Should not happen normally given the check we did before */ XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module24)), __ccgo_ts+35455, 0) X_TIFFfreeExt(tls, tif, p1) return 0 } *(*Tuint16_t)(unsafe.Pointer(q1)) = uint16(*(*Tuint64_t)(unsafe.Pointer(ma1))) goto _2 _2: ; ma1 += 8 mb1++ q1 += 2 } o = _TIFFWriteDirectoryTagCheckedShortArray(tls, tif, ndir, dir, tag, count, p1) X_TIFFfreeExt(tls, tif, p1) } return o } var _module24 = [36]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'L', 'o', 'n', 'g', 'L', 'o', 'n', 'g', '8', 'A', 'r', 'r', 'a', 'y'} /************************************************************************/ /* TIFFWriteDirectoryTagIfdIfd8Array() */ /* */ /* Write either IFD8 or IFD array depending on file type. */ /************************************************************************/ func _TIFFWriteDirectoryTagIfdIfd8Array(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { var ma, p, q uintptr var mb Tuint32_t var o int32 _, _, _, _, _ = ma, mb, o, p, q /* We always write IFD8 for BigTIFF, no checking needed. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { return _TIFFWriteDirectoryTagCheckedIfd8Array(tls, tif, ndir, dir, tag, count, value) } /* ** For classic tiff we want to verify everything is in range for IFD ** and convert to long format. */ p = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(count*uint32(4))) if p == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module25)), __ccgo_ts+9697, 0) return 0 } q = p ma = value mb = libc.Uint32FromInt32(0) for { if !(mb < count) { break } if *(*Tuint64_t)(unsafe.Pointer(ma)) > uint64(0xFFFFFFFF) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module25)), __ccgo_ts+35513, 0) X_TIFFfreeExt(tls, tif, p) return 0 } *(*Tuint32_t)(unsafe.Pointer(q)) = uint32(*(*Tuint64_t)(unsafe.Pointer(ma))) goto _1 _1: ; ma += 8 mb++ q += 4 } o = _TIFFWriteDirectoryTagCheckedIfdArray(tls, tif, ndir, dir, tag, count, p) X_TIFFfreeExt(tls, tif, p) return o } var _module25 = [34]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'I', 'f', 'd', 'I', 'f', 'd', '8', 'A', 'r', 'r', 'a', 'y'} // C documentation // // /* // * Auxiliary function to determine the IFD data size to be written to the file. // * The IFD data size is finally the size of the IFD tag entries plus the IFD // * data that is written directly after the IFD tag entries. // */ func _EvaluateIFDdatasizeWrite(tls *libc.TLS, tif uintptr, count Tuint32_t, typesize Tuint32_t, ndir uintptr) { var datalength Tuint64_t var v1 uint32 _, _ = datalength, v1 datalength = uint64(count) * uint64(typesize) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { v1 = uint32(0x8) } else { v1 = uint32(0x4) } if datalength > uint64(v1) { /* LibTIFF increments write address to an even offset, thus datalength * written is also incremented. */ if datalength&uint64(1) != 0 { datalength++ } (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_write += datalength } *(*Tuint32_t)(unsafe.Pointer(ndir))++ } func _TIFFWriteDirectoryTagColormap(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr) (r int32) { var m Tuint32_t var n uintptr var o int32 _, _, _ = m, n, o m = libc.Uint32FromInt32(libc.Int32FromInt32(1) << (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, uint32(3)*m, uint32(2), ndir) return int32(1) } n = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32(3)*m*uint32(2))) if n == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module26)), __ccgo_ts+9697, 0) return 0 } X_TIFFmemcpy(tls, n, *(*uintptr)(unsafe.Pointer(tif + 56 + 100)), libc.Int32FromUint32(m*uint32(2))) X_TIFFmemcpy(tls, n+uintptr(m)*2, *(*uintptr)(unsafe.Pointer(tif + 56 + 100 + 1*4)), libc.Int32FromUint32(m*uint32(2))) X_TIFFmemcpy(tls, n+uintptr(uint32(2)*m)*2, *(*uintptr)(unsafe.Pointer(tif + 56 + 100 + 2*4)), libc.Int32FromUint32(m*uint32(2))) o = _TIFFWriteDirectoryTagCheckedShortArray(tls, tif, ndir, dir, uint16(TIFFTAG_COLORMAP), uint32(3)*m, n) X_TIFFfreeExt(tls, tif, n) return o } var _module26 = [30]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'C', 'o', 'l', 'o', 'r', 'm', 'a', 'p'} func _TIFFWriteDirectoryTagTransferfunction(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr) (r int32) { var i, p, v1 int32 var m Tuint32_t var n Tuint16_t var o uintptr _, _, _, _, _, _ = i, m, n, o, p, v1 /* TIFFTAG_TRANSFERFUNCTION expects (1 or 3) pointer to arrays with * (1 << BitsPerSample) * uint16_t values. */ m = libc.Uint32FromInt32(libc.Int32FromInt32(1) << (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) /* clang-format off */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel)-libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_extrasamples) > int32(1) { v1 = int32(3) } else { v1 = int32(1) } n = libc.Uint16FromInt32(v1) /* clang-format on */ /* Check for proper number of transferfunctions */ i = 0 for { if !(i < libc.Int32FromUint16(n)) { break } if *(*uintptr)(unsafe.Pointer(tif + 56 + 224 + uintptr(i)*4)) == libc.UintptrFromInt32(0) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module27)), __ccgo_ts+35581, 0) return int32(1) /* Not an error; only tag is not written. */ } goto _2 _2: ; i++ } /* * Check if the table can be written as a single column, * or if it must be written as 3 columns. Note that we * write a 3-column tag if there are 2 samples/pixel and * a single column of data won't suffice--hmm. */ if libc.Int32FromUint16(n) == int32(3) { if !(X_TIFFmemcmp(tls, *(*uintptr)(unsafe.Pointer(tif + 56 + 224)), *(*uintptr)(unsafe.Pointer(tif + 56 + 224 + 2*4)), libc.Int32FromUint32(m*uint32(2))) != 0) && !(X_TIFFmemcmp(tls, *(*uintptr)(unsafe.Pointer(tif + 56 + 224)), *(*uintptr)(unsafe.Pointer(tif + 56 + 224 + 1*4)), libc.Int32FromUint32(m*uint32(2))) != 0) { n = uint16(1) } } if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, uint32(n)*m, uint32(2), ndir) return int32(1) } o = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32(n)*m*uint32(2))) if o == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module27)), __ccgo_ts+9697, 0) return 0 } X_TIFFmemcpy(tls, o, *(*uintptr)(unsafe.Pointer(tif + 56 + 224)), libc.Int32FromUint32(m*uint32(2))) if libc.Int32FromUint16(n) > int32(1) { X_TIFFmemcpy(tls, o+uintptr(m)*2, *(*uintptr)(unsafe.Pointer(tif + 56 + 224 + 1*4)), libc.Int32FromUint32(m*uint32(2))) } if libc.Int32FromUint16(n) > int32(2) { X_TIFFmemcpy(tls, o+uintptr(uint32(2)*m)*2, *(*uintptr)(unsafe.Pointer(tif + 56 + 224 + 2*4)), libc.Int32FromUint32(m*uint32(2))) } p = _TIFFWriteDirectoryTagCheckedShortArray(tls, tif, ndir, dir, uint16(TIFFTAG_TRANSFERFUNCTION), uint32(n)*m, o) X_TIFFfreeExt(tls, tif, o) return p } var _module27 = [38]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'T', 'r', 'a', 'n', 's', 'f', 'e', 'r', 'f', 'u', 'n', 'c', 't', 'i', 'o', 'n'} func _TIFFWriteDirectoryTagSubifd(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr) (r int32) { var m Tuint64_t var n int32 var o, pa, pb, v2, v3 uintptr var p Tuint16_t _, _, _, _, _, _, _, _ = m, n, o, p, pa, pb, v2, v3 if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nsubifd) == 0 { return int32(1) } m = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { o = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nsubifd)*uint32(4))) if o == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module28)), __ccgo_ts+9697, 0) return 0 } pa = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_subifd pb = o p = uint16(0) for { if !(libc.Int32FromUint16(p) < libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nsubifd)) { break } /* Could happen if an classicTIFF has a SubIFD of type LONG8 (which * is illegal) */ if *(*Tuint64_t)(unsafe.Pointer(pa)) > uint64(0xFFFFFFFF) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module28)), __ccgo_ts+35641, 0) X_TIFFfreeExt(tls, tif, o) return 0 } v2 = pb pb += 4 v3 = pa pa += 8 *(*Tuint32_t)(unsafe.Pointer(v2)) = uint32(*(*Tuint64_t)(unsafe.Pointer(v3))) goto _1 _1: ; p++ } n = _TIFFWriteDirectoryTagCheckedIfdArray(tls, tif, ndir, dir, uint16(TIFFTAG_SUBIFD), uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nsubifd), o) X_TIFFfreeExt(tls, tif, o) } else { n = _TIFFWriteDirectoryTagCheckedIfd8Array(tls, tif, ndir, dir, uint16(TIFFTAG_SUBIFD), uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nsubifd), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_subifd) } if dir == libc.UintptrFromInt32(0) { /* Just have evaluated IFD data size and incremented ndir * above in sub-functions. */ return n } if !(n != 0) { return 0 } /* * Total hack: if this directory includes a SubIFD * tag then force the next directories to be * written as ``sub directories'' of this one. This * is used to write things like thumbnails and * image masks that one wants to keep out of the * normal directory linkage access mechanism. */ *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x02000) (*TTIFF)(unsafe.Pointer(tif)).Ftif_nsubifd = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nsubifd if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nsubifd) == int32(1) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_subifdoff = uint64(0) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_subifdoff = m } return int32(1) } var _module28 = [28]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'S', 'u', 'b', 'i', 'f', 'd'} func _TIFFWriteDirectoryTagCheckedAscii(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(1), ndir) return int32(1) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_ASCII), count, count, value) } func _TIFFWriteDirectoryTagCheckedUndefinedArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(1), ndir) return int32(1) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_UNDEFINED), count, count, value) } func _TIFFWriteDirectoryTagCheckedByteArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(1), ndir) return int32(1) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_BYTE), count, count, value) } func _TIFFWriteDirectoryTagCheckedSbyteArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(1), ndir) return int32(1) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_SBYTE), count, count, value) } func _TIFFWriteDirectoryTagCheckedShort(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, value Tuint16_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* m at bp+0 */ Tuint16_t if dir == libc.UintptrFromInt32(0) { /* No additional data to IFD data size just increment ndir. */ *(*Tuint32_t)(unsafe.Pointer(ndir))++ return int32(1) } *(*Tuint16_t)(unsafe.Pointer(bp)) = value if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_SHORT), uint32(1), uint32(2), bp) } func _TIFFWriteDirectoryTagCheckedShortArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(2), ndir) return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfShort(tls, value, libc.Int32FromUint32(count)) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_SHORT), count, count*uint32(2), value) } func _TIFFWriteDirectoryTagCheckedSshortArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(2), ndir) return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfShort(tls, value, libc.Int32FromUint32(count)) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_SSHORT), count, count*uint32(2), value) } func _TIFFWriteDirectoryTagCheckedLong(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, value Tuint32_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* m at bp+0 */ Tuint32_t if dir == libc.UintptrFromInt32(0) { /* No additional data to IFD data size just increment ndir. */ *(*Tuint32_t)(unsafe.Pointer(ndir))++ return int32(1) } *(*Tuint32_t)(unsafe.Pointer(bp)) = value if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_LONG), uint32(1), uint32(4), bp) } func _TIFFWriteDirectoryTagCheckedLongArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(4), ndir) return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, value, libc.Int32FromUint32(count)) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_LONG), count, count*uint32(4), value) } func _TIFFWriteDirectoryTagCheckedSlongArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(4), ndir) return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, value, libc.Int32FromUint32(count)) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_SLONG), count, count*uint32(4), value) } func _TIFFWriteDirectoryTagCheckedLong8Array(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+35670, __ccgo_ts+35709, 0) return 0 } if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(8), ndir) return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong8(tls, value, libc.Int32FromUint32(count)) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_LONG8), count, count*uint32(8), value) } func _TIFFWriteDirectoryTagCheckedSlong8Array(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+35743, __ccgo_ts+35783, 0) return 0 } if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(8), ndir) return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong8(tls, value, libc.Int32FromUint32(count)) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_SLONG8), count, count*uint32(8), value) } func _TIFFWriteDirectoryTagCheckedRational(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, value float64) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var v1 uint32 var _ /* m at bp+0 */ [2]Tuint32_t _ = v1 if value < libc.Float64FromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module29)), __ccgo_ts+35818, 0) return 0 } else { if value != value { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module29)), __ccgo_ts+35844, 0) return 0 } } if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { v1 = uint32(0) } else { v1 = uint32(0x8) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_dirdatasize_write += uint64(v1) *(*Tuint32_t)(unsafe.Pointer(ndir))++ return int32(1) } _DoubleToRational(tls, value, bp, bp+1*4) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp) XTIFFSwabLong(tls, bp+1*4) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_RATIONAL), uint32(1), uint32(8), bp) } var _module29 = [37]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'C', 'h', 'e', 'c', 'k', 'e', 'd', 'R', 'a', 't', 'i', 'o', 'n', 'a', 'l'} func _TIFFWriteDirectoryTagCheckedRationalArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { var m, na, nb uintptr var nc Tuint32_t var o int32 _, _, _, _, _ = m, na, nb, nc, o if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count*uint32(2), uint32(4), ndir) return int32(1) } m = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(count*uint32(2)*uint32(4))) if m == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module30)), __ccgo_ts+9697, 0) return 0 } na = value nb = m nc = libc.Uint32FromInt32(0) for { if !(nc < count) { break } _DoubleToRational(tls, float64(*(*float32)(unsafe.Pointer(na))), nb, nb+1*4) goto _1 _1: ; na += 4 nb += uintptr(2) * 4 nc++ } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, m, libc.Int32FromUint32(count*uint32(2))) } o = _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_RATIONAL), count, count*uint32(8), m) X_TIFFfreeExt(tls, tif, m) return o } var _module30 = [42]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'C', 'h', 'e', 'c', 'k', 'e', 'd', 'R', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'A', 'r', 'r', 'a', 'y'} func _TIFFWriteDirectoryTagCheckedSrationalArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { var m, na, nb uintptr var nc Tuint32_t var o int32 _, _, _, _, _ = m, na, nb, nc, o if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count*uint32(2), uint32(4), ndir) return int32(1) } m = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(count*uint32(2)*uint32(4))) if m == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module31)), __ccgo_ts+9697, 0) return 0 } na = value nb = m nc = libc.Uint32FromInt32(0) for { if !(nc < count) { break } _DoubleToSrational(tls, float64(*(*float32)(unsafe.Pointer(na))), nb, nb+1*4) goto _1 _1: ; na += 4 nb += uintptr(2) * 4 nc++ } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, m, libc.Int32FromUint32(count*uint32(2))) } o = _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_SRATIONAL), count, count*uint32(8), m) X_TIFFfreeExt(tls, tif, m) return o } var _module31 = [43]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'C', 'h', 'e', 'c', 'k', 'e', 'd', 'S', 'r', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'A', 'r', 'r', 'a', 'y'} // C documentation // // /*-- Rational2Double: additional write functions for double arrays */ func _TIFFWriteDirectoryTagCheckedRationalDoubleArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { var m, na, nb uintptr var nc Tuint32_t var o int32 _, _, _, _, _ = m, na, nb, nc, o if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count*uint32(2), uint32(4), ndir) return int32(1) } m = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(count*uint32(2)*uint32(4))) if m == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module32)), __ccgo_ts+9697, 0) return 0 } na = value nb = m nc = libc.Uint32FromInt32(0) for { if !(nc < count) { break } _DoubleToRational(tls, *(*float64)(unsafe.Pointer(na)), nb, nb+1*4) goto _1 _1: ; na += 8 nb += uintptr(2) * 4 nc++ } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, m, libc.Int32FromUint32(count*uint32(2))) } o = _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_RATIONAL), count, count*uint32(8), m) X_TIFFfreeExt(tls, tif, m) return o } var _module32 = [48]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'C', 'h', 'e', 'c', 'k', 'e', 'd', 'R', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'D', 'o', 'u', 'b', 'l', 'e', 'A', 'r', 'r', 'a', 'y'} /*-- TIFFWriteDirectoryTagCheckedRationalDoubleArray() ------- */ func _TIFFWriteDirectoryTagCheckedSrationalDoubleArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { var m, na, nb uintptr var nc Tuint32_t var o int32 _, _, _, _, _ = m, na, nb, nc, o if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count*uint32(2), uint32(4), ndir) return int32(1) } m = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(count*uint32(2)*uint32(4))) if m == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module33)), __ccgo_ts+9697, 0) return 0 } na = value nb = m nc = libc.Uint32FromInt32(0) for { if !(nc < count) { break } _DoubleToSrational(tls, *(*float64)(unsafe.Pointer(na)), nb, nb+1*4) goto _1 _1: ; na += 8 nb += uintptr(2) * 4 nc++ } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, m, libc.Int32FromUint32(count*uint32(2))) } o = _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_SRATIONAL), count, count*uint32(8), m) X_TIFFfreeExt(tls, tif, m) return o } var _module33 = [49]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'C', 'h', 'e', 'c', 'k', 'e', 'd', 'S', 'r', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'D', 'o', 'u', 'b', 'l', 'e', 'A', 'r', 'r', 'a', 'y'} /*--- TIFFWriteDirectoryTagCheckedSrationalDoubleArray() -------- */ /** ----- Rational2Double: Double To Rational Conversion ---------------------------------------------------------- * There is a mathematical theorem to convert real numbers into a rational (integer fraction) number. * This is called "continuous fraction" which uses the Euclidean algorithm to find the greatest common divisor (GCD). * (ref. e.g. https://de.wikipedia.org/wiki/Kettenbruch or https://en.wikipedia.org/wiki/Continued_fraction * https://en.wikipedia.org/wiki/Euclidean_algorithm) * The following functions implement the * - ToRationalEuclideanGCD() auxiliary function which mainly implements euclidean GCD * - DoubleToRational() conversion function for un-signed rationals * - DoubleToSrational() conversion function for signed rationals ------------------------------------------------------------------------------------------------------------------*/ // C documentation // // /**---- ToRationalEuclideanGCD() ----------------------------------------- // * Calculates the rational fractional of a double input value // * using the Euclidean algorithm to find the greatest common divisor (GCD) // ------------------------------------------------------------------------*/ func _ToRationalEuclideanGCD(tls *libc.TLS, value float64, blnUseSignedRange int32, blnUseSmallRange int32, ullNum uintptr, ullDenom uintptr) { var aux, bigDenom, bigNum, nMax, returnLimit, val Tuint64_t var denomSum, numSum [3]Tuint64_t var fMax float64 var i int32 var maxDenom uint32 _, _, _, _, _, _, _, _, _, _, _ = aux, bigDenom, bigNum, denomSum, fMax, i, maxDenom, nMax, numSum, returnLimit, val /* Internally, the integer variables can be bigger than the external ones, * as long as the result will fit into the external variable size. */ numSum = [3]Tuint64_t{ 1: uint64(1), } denomSum = [3]Tuint64_t{ 0: uint64(1), } /*-- nMax and fMax defines the initial accuracy of the starting fractional, * or better, the highest used integer numbers used within the starting * fractional (bigNum/bigDenom). There are two approaches, which can * accidentally lead to different accuracies just depending on the value. * Therefore, blnUseSmallRange steers this behavior. * For long long nMax = ((9223372036854775807-1)/2); for long nMax = * ((2147483647-1)/2); */ if blnUseSmallRange != 0 { nMax = libc.Uint64FromInt32((libc.Int32FromInt32(2147483647) - libc.Int32FromInt32(1)) / libc.Int32FromInt32(2)) /* for ULONG range */ } else { nMax = libc.Uint64FromInt64((libc.Int64FromInt64(9223372036854775807) - libc.Int64FromInt32(1)) / libc.Int64FromInt32(2)) /* for ULLONG range */ } fMax = float64(nMax) /*-- For the Euclidean GCD define the denominator range, so that it stays * within size of unsigned long variables. maxDenom should be LONG_MAX for * negative values and ULONG_MAX for positive ones. Also the final returned * value of ullNum and ullDenom is limited according to signed- or * unsigned-range. */ if blnUseSignedRange != 0 { maxDenom = uint32(2147483647) /*LONG_MAX = 0x7FFFFFFFUL*/ returnLimit = uint64(maxDenom) } else { maxDenom = uint32(0xFFFFFFFF) /*ULONG_MAX = 0xFFFFFFFFUL*/ returnLimit = uint64(maxDenom) } /*-- First generate a rational fraction (bigNum/bigDenom) which represents *the value as a rational number with the highest accuracy. Therefore, *uint64_t (uint64_t) is needed. This rational fraction is then reduced *using the Euclidean algorithm to find the greatest common divisor (GCD). * bigNum = big numinator of value without fraction (or cut residual *fraction) bigDenom = big denominator of value *-- Break-criteria so that uint64_t cast to "bigNum" introduces no error *and bigDenom has no overflow, and stop with enlargement of fraction when *the double-value of it reaches an integer number without fractional part. */ bigDenom = uint64(1) for value != libc.Xfloor(tls, value) && value < fMax && bigDenom < nMax { bigDenom <<= uint64(1) value *= libc.Float64FromInt32(2) } bigNum = uint64(value) /*-- Start Euclidean algorithm to find the greatest common divisor (GCD) -- */ i = 0 for { if !(i < int32(MAX_ITERATIONS)) { break } /* if bigDenom is not zero, calculate integer part of fraction. */ if bigDenom == uint64(0) { break } val = bigNum / bigDenom /* Set bigDenom to reminder of bigNum/bigDenom and bigNum to previous * denominator bigDenom. */ aux = bigNum bigNum = bigDenom bigDenom = aux % bigDenom /* calculate next denominator and check for its given maximum */ aux = val if denomSum[int32(1)]*val+denomSum[0] >= uint64(maxDenom) { aux = (uint64(maxDenom) - denomSum[0]) / denomSum[int32(1)] if aux*uint64(2) >= val || denomSum[int32(1)] >= uint64(maxDenom) { i = libc.Int32FromInt32(MAX_ITERATIONS) + libc.Int32FromInt32(1) } else { break } } /* calculate next numerator to numSum2 and save previous one to numSum0; * numSum1 just copy of numSum2. */ numSum[int32(2)] = aux*numSum[int32(1)] + numSum[0] numSum[0] = numSum[int32(1)] numSum[int32(1)] = numSum[int32(2)] /* calculate next denominator to denomSum2 and save previous one to * denomSum0; denomSum1 just copy of denomSum2. */ denomSum[int32(2)] = aux*denomSum[int32(1)] + denomSum[0] denomSum[0] = denomSum[int32(1)] denomSum[int32(1)] = denomSum[int32(2)] goto _1 _1: ; i++ } /*-- Check and adapt for final variable size and return values; reduces * internal accuracy; denominator is kept in ULONG-range with maxDenom -- */ for numSum[int32(1)] > returnLimit || denomSum[int32(1)] > returnLimit { numSum[int32(1)] = numSum[int32(1)] / uint64(2) denomSum[int32(1)] = denomSum[int32(1)] / uint64(2) } /* return values */ *(*Tuint64_t)(unsafe.Pointer(ullNum)) = numSum[int32(1)] *(*Tuint64_t)(unsafe.Pointer(ullDenom)) = denomSum[int32(1)] } /*-- ToRationalEuclideanGCD() -------------- */ // C documentation // // /**---- DoubleToRational() ----------------------------------------------- // * Calculates the rational fractional of a double input value // * for UN-SIGNED rationals, // * using the Euclidean algorithm to find the greatest common divisor (GCD) // ------------------------------------------------------------------------*/ func _DoubleToRational(tls *libc.TLS, value float64, num uintptr, denom uintptr) { bp := tls.Alloc(80) defer tls.Free(80) var dblDiff, dblDiff2 float64 var v1 Tuint32_t var _ /* ullDenom at bp+8 */ Tuint64_t var _ /* ullDenom2 at bp+24 */ Tuint64_t var _ /* ullNum at bp+0 */ Tuint64_t var _ /* ullNum2 at bp+16 */ Tuint64_t _, _, _ = dblDiff, dblDiff2, v1 /*-- Check for negative values. If so it is an error. */ /* Test written that way to catch NaN */ if !(value >= libc.Float64FromInt32(0)) { v1 = libc.Uint32FromInt32(0) *(*Tuint32_t)(unsafe.Pointer(denom)) = v1 *(*Tuint32_t)(unsafe.Pointer(num)) = v1 XTIFFErrorExt(tls, uintptr(0), __ccgo_ts+35874, __ccgo_ts+35902, 0) return } /*-- Check for too big numbers (> ULONG_MAX) -- */ if value > libc.Float64FromUint32(0xFFFFFFFF) { *(*Tuint32_t)(unsafe.Pointer(num)) = uint32(0xFFFFFFFF) *(*Tuint32_t)(unsafe.Pointer(denom)) = uint32(0) return } /*-- Check for easy integer numbers -- */ if value == float64(uint32(value)) { *(*Tuint32_t)(unsafe.Pointer(num)) = uint32(value) *(*Tuint32_t)(unsafe.Pointer(denom)) = uint32(1) return } /*-- Check for too small numbers for "unsigned long" type rationals -- */ if value < float64(1)/libc.Float64FromUint32(0xFFFFFFFF) { *(*Tuint32_t)(unsafe.Pointer(num)) = uint32(0) *(*Tuint32_t)(unsafe.Pointer(denom)) = uint32(0xFFFFFFFF) return } /*-- There are two approaches using the Euclidean algorithm, * which can accidentally lead to different accuracies just depending on * the value. Try both and define which one was better. */ _ToRationalEuclideanGCD(tls, value, FALSE, FALSE, bp, bp+8) _ToRationalEuclideanGCD(tls, value, FALSE, int32(TRUE), bp+16, bp+24) /*-- Double-Check, that returned values fit into ULONG :*/ if *(*Tuint64_t)(unsafe.Pointer(bp)) > uint64(0xFFFFFFFF) || *(*Tuint64_t)(unsafe.Pointer(bp + 8)) > uint64(0xFFFFFFFF) || *(*Tuint64_t)(unsafe.Pointer(bp + 16)) > uint64(0xFFFFFFFF) || *(*Tuint64_t)(unsafe.Pointer(bp + 24)) > uint64(0xFFFFFFFF) { XTIFFErrorExt(tls, uintptr(0), __ccgo_ts+35874, __ccgo_ts+35947, libc.VaList(bp+40, value, *(*Tuint64_t)(unsafe.Pointer(bp)), *(*Tuint64_t)(unsafe.Pointer(bp + 8)), *(*Tuint64_t)(unsafe.Pointer(bp + 16)), *(*Tuint64_t)(unsafe.Pointer(bp + 24)))) } /* Check, which one has higher accuracy and take that. */ dblDiff = libc.Xfabs(tls, value-float64(*(*Tuint64_t)(unsafe.Pointer(bp)))/float64(*(*Tuint64_t)(unsafe.Pointer(bp + 8)))) dblDiff2 = libc.Xfabs(tls, value-float64(*(*Tuint64_t)(unsafe.Pointer(bp + 16)))/float64(*(*Tuint64_t)(unsafe.Pointer(bp + 24)))) if dblDiff < dblDiff2 { *(*Tuint32_t)(unsafe.Pointer(num)) = uint32(*(*Tuint64_t)(unsafe.Pointer(bp))) *(*Tuint32_t)(unsafe.Pointer(denom)) = uint32(*(*Tuint64_t)(unsafe.Pointer(bp + 8))) } else { *(*Tuint32_t)(unsafe.Pointer(num)) = uint32(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) *(*Tuint32_t)(unsafe.Pointer(denom)) = uint32(*(*Tuint64_t)(unsafe.Pointer(bp + 24))) } } /*-- DoubleToRational() -------------- */ // C documentation // // /**---- DoubleToSrational() ----------------------------------------------- // * Calculates the rational fractional of a double input value // * for SIGNED rationals, // * using the Euclidean algorithm to find the greatest common divisor (GCD) // ------------------------------------------------------------------------*/ func _DoubleToSrational(tls *libc.TLS, value float64, num uintptr, denom uintptr) { bp := tls.Alloc(80) defer tls.Free(80) var dblDiff, dblDiff2 float64 var neg int32 var _ /* ullDenom at bp+8 */ Tuint64_t var _ /* ullDenom2 at bp+24 */ Tuint64_t var _ /* ullNum at bp+0 */ Tuint64_t var _ /* ullNum2 at bp+16 */ Tuint64_t _, _, _ = dblDiff, dblDiff2, neg /*---- SIGNED RATIONAL ----*/ neg = int32(1) /*-- Check for negative values and use then the positive one for internal * calculations, but take the sign into account before returning. */ if value < libc.Float64FromInt32(0) { neg = -int32(1) value = -value } /*-- Check for too big numbers (> LONG_MAX) -- */ if value > libc.Float64FromInt32(0x7FFFFFFF) { *(*Tint32_t)(unsafe.Pointer(num)) = int32(0x7FFFFFFF) *(*Tint32_t)(unsafe.Pointer(denom)) = 0 return } /*-- Check for easy numbers -- */ if value == float64(int32(value)) { *(*Tint32_t)(unsafe.Pointer(num)) = int32(float64(neg) * value) *(*Tint32_t)(unsafe.Pointer(denom)) = int32(1) return } /*-- Check for too small numbers for "long" type rationals -- */ if value < float64(1)/libc.Float64FromInt32(0x7FFFFFFF) { *(*Tint32_t)(unsafe.Pointer(num)) = 0 *(*Tint32_t)(unsafe.Pointer(denom)) = int32(0x7FFFFFFF) return } /*-- There are two approaches using the Euclidean algorithm, * which can accidentally lead to different accuracies just depending on * the value. Try both and define which one was better. Furthermore, set * behavior of ToRationalEuclideanGCD() to the range of signed-long. */ _ToRationalEuclideanGCD(tls, value, int32(TRUE), FALSE, bp, bp+8) _ToRationalEuclideanGCD(tls, value, int32(TRUE), int32(TRUE), bp+16, bp+24) /*-- Double-Check, that returned values fit into LONG :*/ if *(*Tuint64_t)(unsafe.Pointer(bp)) > uint64(0x7FFFFFFF) || *(*Tuint64_t)(unsafe.Pointer(bp + 8)) > uint64(0x7FFFFFFF) || *(*Tuint64_t)(unsafe.Pointer(bp + 16)) > uint64(0x7FFFFFFF) || *(*Tuint64_t)(unsafe.Pointer(bp + 24)) > uint64(0x7FFFFFFF) { XTIFFErrorExt(tls, uintptr(0), __ccgo_ts+36042, __ccgo_ts+36071, libc.VaList(bp+40, float64(neg)*value, *(*Tuint64_t)(unsafe.Pointer(bp)), *(*Tuint64_t)(unsafe.Pointer(bp + 8)), *(*Tuint64_t)(unsafe.Pointer(bp + 16)), *(*Tuint64_t)(unsafe.Pointer(bp + 24)))) } /* Check, which one has higher accuracy and take that. */ dblDiff = libc.Xfabs(tls, value-float64(*(*Tuint64_t)(unsafe.Pointer(bp)))/float64(*(*Tuint64_t)(unsafe.Pointer(bp + 8)))) dblDiff2 = libc.Xfabs(tls, value-float64(*(*Tuint64_t)(unsafe.Pointer(bp + 16)))/float64(*(*Tuint64_t)(unsafe.Pointer(bp + 24)))) if dblDiff < dblDiff2 { *(*Tint32_t)(unsafe.Pointer(num)) = neg * libc.Int32FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp))) *(*Tint32_t)(unsafe.Pointer(denom)) = libc.Int32FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp + 8))) } else { *(*Tint32_t)(unsafe.Pointer(num)) = neg * libc.Int32FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp + 16))) *(*Tint32_t)(unsafe.Pointer(denom)) = libc.Int32FromUint64(*(*Tuint64_t)(unsafe.Pointer(bp + 24))) } } /*-- DoubleToSrational() --------------*/ func _TIFFWriteDirectoryTagCheckedFloatArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(4), ndir) return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfFloat(tls, value, libc.Int32FromUint32(count)) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_FLOAT), count, count*uint32(4), value) } func _TIFFWriteDirectoryTagCheckedDoubleArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(8), ndir) return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfDouble(tls, value, libc.Int32FromUint32(count)) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_DOUBLE), count, count*uint32(8), value) } func _TIFFWriteDirectoryTagCheckedIfdArray(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(4), ndir) return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong(tls, value, libc.Int32FromUint32(count)) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_IFD), count, count*uint32(4), value) } func _TIFFWriteDirectoryTagCheckedIfd8Array(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, count Tuint32_t, value uintptr) (r int32) { if dir == libc.UintptrFromInt32(0) { /* Just evaluate IFD data size and increment ndir. */ _EvaluateIFDdatasizeWrite(tls, tif, count, uint32(8), ndir) return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabArrayOfLong8(tls, value, libc.Int32FromUint32(count)) } return _TIFFWriteDirectoryTagData(tls, tif, ndir, dir, tag, uint16(TIFF_IFD8), count, count*uint32(8), value) } func _TIFFWriteDirectoryTagData(tls *libc.TLS, tif uintptr, ndir uintptr, dir uintptr, tag Tuint16_t, datatype Tuint16_t, count Tuint32_t, datalength Tuint32_t, data uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var m, n Tuint32_t var na, nb Tuint64_t var v2 uint32 var _ /* o at bp+0 */ Tuint32_t _, _, _, _, _ = m, n, na, nb, v2 m = uint32(0) for m < *(*Tuint32_t)(unsafe.Pointer(ndir)) { if libc.Int32FromUint16((*(*TTIFFDirEntry)(unsafe.Pointer(dir + uintptr(m)*32))).Ftdir_tag) > libc.Int32FromUint16(tag) { break } m++ } if m < *(*Tuint32_t)(unsafe.Pointer(ndir)) { n = *(*Tuint32_t)(unsafe.Pointer(ndir)) for { if !(n > m) { break } *(*TTIFFDirEntry)(unsafe.Pointer(dir + uintptr(n)*32)) = *(*TTIFFDirEntry)(unsafe.Pointer(dir + uintptr(n-uint32(1))*32)) goto _1 _1: ; n-- } } (*(*TTIFFDirEntry)(unsafe.Pointer(dir + uintptr(m)*32))).Ftdir_tag = tag (*(*TTIFFDirEntry)(unsafe.Pointer(dir + uintptr(m)*32))).Ftdir_type = datatype (*(*TTIFFDirEntry)(unsafe.Pointer(dir + uintptr(m)*32))).Ftdir_count = uint64(count) *(*Tuint64_t)(unsafe.Pointer(dir + uintptr(m)*32 + 16)) = uint64(0) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { v2 = uint32(0x8) } else { v2 = uint32(0x4) } if datalength <= v2 { if data != 0 && datalength != 0 { X_TIFFmemcpy(tls, dir+uintptr(m)*32+16, data, libc.Int32FromUint32(datalength)) } } else { na = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff nb = na + uint64(datalength) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { nb = uint64(uint32(nb)) } if nb < na || nb < uint64(datalength) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module34)), __ccgo_ts+34792, 0) return 0 } if !(X_TIFFSeekOK(tls, tif, na) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module34)), __ccgo_ts+36165, 0) return 0 } if datalength >= uint32(0x80000000) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module34)), __ccgo_ts+36191, 0) return 0 } if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, data, libc.Int32FromUint32(datalength)) == libc.Int32FromUint32(datalength)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module34)), __ccgo_ts+36165, 0) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff = nb if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff&uint64(1) != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dataoff++ } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(na) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp) } X_TIFFmemcpy(tls, dir+uintptr(m)*32+16, bp, int32(4)) } else { *(*Tuint64_t)(unsafe.Pointer(dir + uintptr(m)*32 + 16)) = na if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, dir+uintptr(m)*32+16) } } } *(*Tuint32_t)(unsafe.Pointer(ndir))++ return int32(1) } var _module34 = [26]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', 'T', 'a', 'g', 'D', 'a', 't', 'a'} // C documentation // // /* // * Link the current directory into the directory chain for the file. // */ func _TIFFLinkDirectory(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var dircount1, v1, v3 Tuint16_t var ndir Ttdir_t var nextdir Tuint32_t var nextdir1 Tuint64_t var v2, v4 uintptr var _ /* dircount at bp+24 */ Tuint16_t var _ /* dircount64 at bp+48 */ Tuint64_t var _ /* dirn at bp+20 */ Ttdir_t var _ /* dirn at bp+40 */ Ttdir_t var _ /* m at bp+0 */ Tuint32_t var _ /* m at bp+16 */ Tuint32_t var _ /* m at bp+32 */ Tuint64_t var _ /* m at bp+8 */ Tuint64_t var _ /* nextnextdir at bp+28 */ Tuint32_t var _ /* nextnextdir at bp+56 */ Tuint64_t _, _, _, _, _, _, _, _ = dircount1, ndir, nextdir, nextdir1, v1, v2, v3, v4 (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = ((*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(0)), int32(2)) + uint64(1)) & ^libc.Uint64FromInt32(1) /* * Handle SubIFDs */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x02000) != 0 { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp) } (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_subifdoff, 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp, libc.Int32FromInt32(4)) == libc.Int32FromInt32(4)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module35)), __ccgo_ts+36258, 0) return 0 } /* * Advance to the next SubIFD or, if this is * the last one configured, reverting back to the * normal directory linkage is done in TIFFWriteDirectorySec() * by tif->tif_flags &= ~TIFF_INSUBIFD;. */ v2 = tif + 696 *(*Tuint16_t)(unsafe.Pointer(v2))-- v1 = *(*Tuint16_t)(unsafe.Pointer(v2)) if v1 != 0 { *(*Tuint64_t)(unsafe.Pointer(tif + 704)) += uint64(4) } return int32(1) } else { *(*Tuint64_t)(unsafe.Pointer(bp + 8)) = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+8) } (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_subifdoff, 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+8, libc.Int32FromInt32(8)) == libc.Int32FromInt32(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module35)), __ccgo_ts+36258, 0) return 0 } /* * Advance to the next SubIFD or, if this is * the last one configured, reverting back to the * normal directory linkage is done in TIFFWriteDirectorySec() * by tif->tif_flags &= ~TIFF_INSUBIFD;. */ v4 = tif + 696 *(*Tuint16_t)(unsafe.Pointer(v4))-- v3 = *(*Tuint16_t)(unsafe.Pointer(v4)) if v3 != 0 { *(*Tuint64_t)(unsafe.Pointer(tif + 704)) += uint64(8) } return int32(1) } } /* * Handle main-IFDs */ ndir = uint32(1) /* count current number of main-IFDs */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp + 16)) = uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+16) } if (*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff == uint32(0) { /* * First directory, overwrite offset in header. */ (*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff = uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff) (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(4)), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+16, libc.Int32FromInt32(4)) == libc.Int32FromInt32(4)) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+36294, 0) return 0 } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_iswrittentofile != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount = uint32(0) } return int32(1) } /* * Not the first directory, search to the last and append. */ *(*Ttdir_t)(unsafe.Pointer(bp + 20)) = uint32(0) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff != uint64(0) && X_TIFFGetDirNumberFromOffset(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff, bp+20) != 0 { /* Start searching from the lastely written IFD. Thus get its IFD * number. */ nextdir = uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff) ndir = *(*Ttdir_t)(unsafe.Pointer(bp + 20)) + uint32(1) } else { nextdir = (*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff ndir = uint32(1) /* start searching from the first IFD */ } for int32(1) != 0 { if !(X_TIFFSeekOK(tls, tif, uint64(nextdir)) != 0) || !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+24, libc.Int32FromInt32(2)) == libc.Int32FromInt32(2)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module35)), __ccgo_ts+34402, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp+24) } (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uint64(nextdir+libc.Uint32FromInt32(2)+libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24)))*libc.Int32FromInt32(12))), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+28, libc.Int32FromInt32(4)) == libc.Int32FromInt32(4)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module35)), __ccgo_ts+29207, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+28) } if *(*Tuint32_t)(unsafe.Pointer(bp + 28)) == uint32(0) { (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uint64(nextdir+libc.Uint32FromInt32(2)+libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24)))*libc.Int32FromInt32(12))), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+16, libc.Int32FromInt32(4)) == libc.Int32FromInt32(4)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module35)), __ccgo_ts+29562, 0) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff break } nextdir = *(*Tuint32_t)(unsafe.Pointer(bp + 28)) ndir++ } } else { *(*Tuint64_t)(unsafe.Pointer(bp + 32)) = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+32) } if (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff == uint64(0) { /* * First directory, overwrite offset in header. */ (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(8)), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+32, libc.Int32FromInt32(8)) == libc.Int32FromInt32(8)) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+36294, 0) return 0 } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_iswrittentofile != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount = uint32(0) } return int32(1) } /* * Not the first directory, search to the last and append. */ *(*Ttdir_t)(unsafe.Pointer(bp + 40)) = uint32(0) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff != uint64(0) && X_TIFFGetDirNumberFromOffset(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff, bp+40) != 0 { /* Start searching from the lastely written IFD. Thus get its IFD * number. */ nextdir1 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff ndir = *(*Ttdir_t)(unsafe.Pointer(bp + 40)) + uint32(1) } else { nextdir1 = (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff ndir = uint32(1) /* start searching from the first IFD */ } for int32(1) != 0 { if !(X_TIFFSeekOK(tls, tif, nextdir1) != 0) || !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+48, libc.Int32FromInt32(8)) == libc.Int32FromInt32(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module35)), __ccgo_ts+34402, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+48) } if *(*Tuint64_t)(unsafe.Pointer(bp + 48)) > uint64(0xFFFF) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module35)), __ccgo_ts+34433, 0) return 0 } dircount1 = uint16(*(*Tuint64_t)(unsafe.Pointer(bp + 48))) (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, nextdir1+libc.Uint64FromInt32(8)+libc.Uint64FromInt32(libc.Int32FromUint16(dircount1)*libc.Int32FromInt32(20)), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+56, libc.Int32FromInt32(8)) == libc.Int32FromInt32(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module35)), __ccgo_ts+29207, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+56) } if *(*Tuint64_t)(unsafe.Pointer(bp + 56)) == uint64(0) { (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, nextdir1+libc.Uint64FromInt32(8)+libc.Uint64FromInt32(libc.Int32FromUint16(dircount1)*libc.Int32FromInt32(20)), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+32, libc.Int32FromInt32(8)) == libc.Int32FromInt32(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module35)), __ccgo_ts+29562, 0) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff break } nextdir1 = *(*Tuint64_t)(unsafe.Pointer(bp + 56)) ndir++ } } /* Offset of next IFD is written to file. * Update number of main-IFDs in file. * However, tif_curdircount shall count only newly written main-IFDs with * entries and not only number of linked offsets! Thus, tif_curdircount is * incremented at the end of TIFFWriteDirectorySec(). * TIFF_NON_EXISTENT_DIR_NUMBER means 'dont know number of IFDs' * 0 means 'empty file opened for writing, but no IFD written yet' */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_iswrittentofile != 0) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x02000) != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount = ndir } return int32(1) } var _module35 = [18]uint8{'T', 'I', 'F', 'F', 'L', 'i', 'n', 'k', 'D', 'i', 'r', 'e', 'c', 't', 'o', 'r', 'y'} /************************************************************************/ /* TIFFRewriteField() */ /* */ /* Rewrite a field in the directory on disk without regard to */ /* updating the TIFF directory structure in memory. Currently */ /* only supported for field that already exist in the on-disk */ /* directory. Mainly used for updating stripoffset / */ /* stripbytecount values after the directory is already on */ /* disk. */ /* */ /* Returns zero on failure, and one on success. */ /************************************************************************/ func X_TIFFRewriteField(tls *libc.TLS, tif uintptr, tag Tuint16_t, in_datatype TTIFFDataType, count Ttmsize_t, data uintptr) (r int32) { bp := tls.Alloc(96) defer tls.Free(96) var buf_to_write uintptr var datatype TTIFFDataType var dirsize, i, i1, i2 Ttmsize_t var read_offset Tuint64_t var value_in_entry, write_aslong4, write_aslong8, v1, v2 int32 var _ /* dircount at bp+0 */ Tuint16_t var _ /* dircount64 at bp+48 */ Tuint64_t var _ /* direntry_raw at bp+2 */ [20]Tuint8_t var _ /* entry_count at bp+32 */ Tuint64_t var _ /* entry_offset at bp+40 */ Tuint64_t var _ /* entry_tag at bp+22 */ Tuint16_t var _ /* entry_type at bp+24 */ Tuint16_t var _ /* value at bp+56 */ Tuint32_t var _ /* value at bp+60 */ Tuint32_t var _ /* value at bp+64 */ Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _ = buf_to_write, datatype, dirsize, i, i1, i2, read_offset, value_in_entry, write_aslong4, write_aslong8, v1, v2 *(*Tuint16_t)(unsafe.Pointer(bp + 22)) = uint16(0) *(*Tuint16_t)(unsafe.Pointer(bp + 24)) = uint16(0) *(*Tuint64_t)(unsafe.Pointer(bp + 32)) = uint64(0) *(*Tuint64_t)(unsafe.Pointer(bp + 40)) = uint64(0) value_in_entry = 0 buf_to_write = libc.UintptrFromInt32(0) /* -------------------------------------------------------------------- */ /* Find field definition. */ /* -------------------------------------------------------------------- */ /*fip =*/ XTIFFFindField(tls, tif, uint32(tag), int32(TIFF_NOTYPE)) /* -------------------------------------------------------------------- */ /* Do some checking this is a straight forward case. */ /* -------------------------------------------------------------------- */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+36320, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff == uint64(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+36384, 0) return 0 } /* -------------------------------------------------------------------- */ /* Read the directory entry count. */ /* -------------------------------------------------------------------- */ if !(X_TIFFSeekOK(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+32653, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } read_offset = (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp, libc.Int32FromUint32(libc.Uint32FromInt64(2)))) == libc.Uint32FromInt64(2)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+32693, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp) } dirsize = int32(12) read_offset += uint64(2) } else { if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+48, libc.Int32FromUint32(libc.Uint32FromInt64(8)))) == libc.Uint32FromInt64(8)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+32693, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+48) } *(*Tuint16_t)(unsafe.Pointer(bp)) = uint16(*(*Tuint64_t)(unsafe.Pointer(bp + 48))) dirsize = int32(20) read_offset += uint64(8) } /* -------------------------------------------------------------------- */ /* Read through directory to find target tag. */ /* -------------------------------------------------------------------- */ for libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp))) > 0 { if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+2, dirsize) == dirsize) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+36441, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } libc.Xmemcpy(tls, bp+22, bp+2+uintptr(0), uint32(2)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp+22) } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 22))) == libc.Int32FromUint16(tag) { break } read_offset += libc.Uint64FromInt32(dirsize) } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 22))) != libc.Int32FromUint16(tag) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+36480, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, libc.Int32FromUint16(tag))) return 0 } /* -------------------------------------------------------------------- */ /* Extract the type, count and offset for this entry. */ /* -------------------------------------------------------------------- */ libc.Xmemcpy(tls, bp+24, bp+2+uintptr(2), uint32(2)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp+24) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { libc.Xmemcpy(tls, bp+56, bp+2+uintptr(4), uint32(4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+56) } *(*Tuint64_t)(unsafe.Pointer(bp + 32)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 56))) libc.Xmemcpy(tls, bp+56, bp+2+uintptr(8), uint32(4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+56) } *(*Tuint64_t)(unsafe.Pointer(bp + 40)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 56))) } else { libc.Xmemcpy(tls, bp+32, bp+2+uintptr(4), uint32(8)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+32) } libc.Xmemcpy(tls, bp+40, bp+2+uintptr(12), uint32(8)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+40) } } /* -------------------------------------------------------------------- */ /* When a dummy tag was written due to TIFFDeferStrileArrayWriting() */ /* -------------------------------------------------------------------- */ if *(*Tuint64_t)(unsafe.Pointer(bp + 40)) == uint64(0) && *(*Tuint64_t)(unsafe.Pointer(bp + 32)) == uint64(0) && libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) == 0 { if libc.Int32FromUint16(tag) == int32(TIFFTAG_TILEOFFSETS) || libc.Int32FromUint16(tag) == int32(TIFFTAG_STRIPOFFSETS) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { v1 = int32(TIFF_LONG8) } else { v1 = int32(TIFF_LONG) } *(*Tuint16_t)(unsafe.Pointer(bp + 24)) = libc.Uint16FromInt32(v1) } else { write_aslong8 = int32(1) if count > int32(1) && libc.Int32FromUint16(tag) == int32(TIFFTAG_STRIPBYTECOUNTS) { write_aslong8 = _WriteAsLong8(tls, tif, XTIFFStripSize64(tls, tif)) } else { if count > int32(1) && libc.Int32FromUint16(tag) == int32(TIFFTAG_TILEBYTECOUNTS) { write_aslong8 = _WriteAsLong8(tls, tif, XTIFFTileSize64(tls, tif)) } } if write_aslong8 != 0 { *(*Tuint16_t)(unsafe.Pointer(bp + 24)) = uint16(TIFF_LONG8) } else { write_aslong4 = int32(1) if count > int32(1) && libc.Int32FromUint16(tag) == int32(TIFFTAG_STRIPBYTECOUNTS) { write_aslong4 = _WriteAsLong4(tls, tif, XTIFFStripSize64(tls, tif)) } else { if count > int32(1) && libc.Int32FromUint16(tag) == int32(TIFFTAG_TILEBYTECOUNTS) { write_aslong4 = _WriteAsLong4(tls, tif, XTIFFTileSize64(tls, tif)) } } if write_aslong4 != 0 { *(*Tuint16_t)(unsafe.Pointer(bp + 24)) = uint16(TIFF_LONG) } else { *(*Tuint16_t)(unsafe.Pointer(bp + 24)) = uint16(TIFF_SHORT) } } } } /* -------------------------------------------------------------------- */ /* What data type do we want to write this as? */ /* -------------------------------------------------------------------- */ if XTIFFDataWidth(tls, in_datatype) == int32(8) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { if in_datatype == int32(TIFF_LONG8) { if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) == int32(TIFF_SHORT) { v2 = int32(TIFF_SHORT) } else { v2 = int32(TIFF_LONG) } datatype = v2 } else { if in_datatype == int32(TIFF_SLONG8) { datatype = int32(TIFF_SLONG) } else { if in_datatype == int32(TIFF_IFD8) { datatype = int32(TIFF_IFD) } else { datatype = in_datatype } } } } else { if in_datatype == int32(TIFF_LONG8) && (libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) == int32(TIFF_SHORT) || libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) == int32(TIFF_LONG) || libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) == int32(TIFF_LONG8)) { datatype = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) } else { if in_datatype == int32(TIFF_SLONG8) && (libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) == int32(TIFF_SLONG) || libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) == int32(TIFF_SLONG8)) { datatype = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) } else { if in_datatype == int32(TIFF_IFD8) && (libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) == int32(TIFF_IFD) || libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) == int32(TIFF_IFD8)) { datatype = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) } else { datatype = in_datatype } } } } /* -------------------------------------------------------------------- */ /* Prepare buffer of actual data to write. This includes */ /* swabbing as needed. */ /* -------------------------------------------------------------------- */ buf_to_write = X_TIFFCheckMalloc(tls, tif, count, XTIFFDataWidth(tls, datatype), __ccgo_ts+36507) if !(buf_to_write != 0) { return 0 } if datatype == in_datatype { libc.Xmemcpy(tls, buf_to_write, data, libc.Uint32FromInt32(count*XTIFFDataWidth(tls, datatype))) } else { if datatype == int32(TIFF_SLONG) && in_datatype == int32(TIFF_SLONG8) { i = 0 for { if !(i < count) { break } *(*Tint32_t)(unsafe.Pointer(buf_to_write + uintptr(i)*4)) = int32(*(*Tint64_t)(unsafe.Pointer(data + uintptr(i)*8))) if int64(*(*Tint32_t)(unsafe.Pointer(buf_to_write + uintptr(i)*4))) != *(*Tint64_t)(unsafe.Pointer(data + uintptr(i)*8)) { X_TIFFfreeExt(tls, tif, buf_to_write) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+36525, 0) return 0 } goto _3 _3: ; i++ } } else { if datatype == int32(TIFF_LONG) && in_datatype == int32(TIFF_LONG8) || datatype == int32(TIFF_IFD) && in_datatype == int32(TIFF_IFD8) { i1 = 0 for { if !(i1 < count) { break } *(*Tuint32_t)(unsafe.Pointer(buf_to_write + uintptr(i1)*4)) = uint32(*(*Tuint64_t)(unsafe.Pointer(data + uintptr(i1)*8))) if uint64(*(*Tuint32_t)(unsafe.Pointer(buf_to_write + uintptr(i1)*4))) != *(*Tuint64_t)(unsafe.Pointer(data + uintptr(i1)*8)) { X_TIFFfreeExt(tls, tif, buf_to_write) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+36525, 0) return 0 } goto _4 _4: ; i1++ } } else { if datatype == int32(TIFF_SHORT) && in_datatype == int32(TIFF_LONG8) { i2 = 0 for { if !(i2 < count) { break } *(*Tuint16_t)(unsafe.Pointer(buf_to_write + uintptr(i2)*2)) = uint16(*(*Tuint64_t)(unsafe.Pointer(data + uintptr(i2)*8))) if uint64(*(*Tuint16_t)(unsafe.Pointer(buf_to_write + uintptr(i2)*2))) != *(*Tuint64_t)(unsafe.Pointer(data + uintptr(i2)*8)) { X_TIFFfreeExt(tls, tif, buf_to_write) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+36567, 0) return 0 } goto _5 _5: ; i2++ } } else { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+36609, 0) return 0 } } } } if XTIFFDataWidth(tls, datatype) > int32(1) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { if XTIFFDataWidth(tls, datatype) == int32(2) { XTIFFSwabArrayOfShort(tls, buf_to_write, count) } else { if XTIFFDataWidth(tls, datatype) == int32(4) { XTIFFSwabArrayOfLong(tls, buf_to_write, count) } else { if XTIFFDataWidth(tls, datatype) == int32(8) { XTIFFSwabArrayOfLong8(tls, buf_to_write, count) } } } } /* -------------------------------------------------------------------- */ /* Is this a value that fits into the directory entry? */ /* -------------------------------------------------------------------- */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { if XTIFFDataWidth(tls, datatype)*count <= int32(4) { *(*Tuint64_t)(unsafe.Pointer(bp + 40)) = read_offset + uint64(8) value_in_entry = int32(1) } } else { if XTIFFDataWidth(tls, datatype)*count <= int32(8) { *(*Tuint64_t)(unsafe.Pointer(bp + 40)) = read_offset + uint64(12) value_in_entry = int32(1) } } if (libc.Int32FromUint16(tag) == int32(TIFFTAG_TILEOFFSETS) || libc.Int32FromUint16(tag) == int32(TIFFTAG_STRIPOFFSETS)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_count == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_type) == 0 && *(*Tuint64_t)(unsafe.Pointer(tif + 56 + 144 + 16)) == uint64(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_type = libc.Uint16FromInt32(datatype) (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_count = libc.Uint64FromInt32(count) } else { if (libc.Int32FromUint16(tag) == int32(TIFFTAG_TILEBYTECOUNTS) || libc.Int32FromUint16(tag) == int32(TIFFTAG_STRIPBYTECOUNTS)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_count == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_type) == 0 && *(*Tuint64_t)(unsafe.Pointer(tif + 56 + 176 + 16)) == uint64(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_type = libc.Uint16FromInt32(datatype) (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_count = libc.Uint64FromInt32(count) } } /* -------------------------------------------------------------------- */ /* If the tag type, and count match, then we just write it out */ /* over the old values without altering the directory entry at */ /* all. */ /* -------------------------------------------------------------------- */ if *(*Tuint64_t)(unsafe.Pointer(bp + 32)) == libc.Uint64FromInt32(count) && libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) == libc.Int32FromUint16(libc.Uint16FromInt32(datatype)) { if !(X_TIFFSeekOK(tls, tif, *(*Tuint64_t)(unsafe.Pointer(bp + 40))) != 0) { X_TIFFfreeExt(tls, tif, buf_to_write) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+32653, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, buf_to_write, count*XTIFFDataWidth(tls, datatype)) == count*XTIFFDataWidth(tls, datatype)) { X_TIFFfreeExt(tls, tif, buf_to_write) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+29562, 0) return 0 } X_TIFFfreeExt(tls, tif, buf_to_write) return int32(1) } /* -------------------------------------------------------------------- */ /* Otherwise, we write the new tag data at the end of the file. */ /* -------------------------------------------------------------------- */ if !(value_in_entry != 0) { *(*Tuint64_t)(unsafe.Pointer(bp + 40)) = (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(0)), int32(2)) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, buf_to_write, count*XTIFFDataWidth(tls, datatype)) == count*XTIFFDataWidth(tls, datatype)) { X_TIFFfreeExt(tls, tif, buf_to_write) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+29562, 0) return 0 } } else { if count*XTIFFDataWidth(tls, datatype) == int32(4) { libc.Xmemcpy(tls, bp+60, buf_to_write, libc.Uint32FromInt32(count*XTIFFDataWidth(tls, datatype))) *(*Tuint64_t)(unsafe.Pointer(bp + 40)) = uint64(*(*Tuint32_t)(unsafe.Pointer(bp + 60))) } else { libc.Xmemcpy(tls, bp+40, buf_to_write, libc.Uint32FromInt32(count*XTIFFDataWidth(tls, datatype))) } } X_TIFFfreeExt(tls, tif, buf_to_write) buf_to_write = uintptr(0) /* -------------------------------------------------------------------- */ /* Adjust the directory entry. */ /* -------------------------------------------------------------------- */ *(*Tuint16_t)(unsafe.Pointer(bp + 24)) = libc.Uint16FromInt32(datatype) *(*Tuint64_t)(unsafe.Pointer(bp + 32)) = libc.Uint64FromInt32(count) libc.Xmemcpy(tls, bp+2+uintptr(2), bp+24, uint32(2)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp+2+libc.UintptrFromInt32(2)) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { *(*Tuint32_t)(unsafe.Pointer(bp + 64)) = uint32(*(*Tuint64_t)(unsafe.Pointer(bp + 32))) libc.Xmemcpy(tls, bp+2+uintptr(4), bp+64, uint32(4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+2+libc.UintptrFromInt32(4)) } *(*Tuint32_t)(unsafe.Pointer(bp + 64)) = uint32(*(*Tuint64_t)(unsafe.Pointer(bp + 40))) libc.Xmemcpy(tls, bp+2+uintptr(8), bp+64, uint32(4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, bp+2+libc.UintptrFromInt32(8)) } } else { libc.Xmemcpy(tls, bp+2+uintptr(4), bp+32, uint32(8)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+2+libc.UintptrFromInt32(4)) } libc.Xmemcpy(tls, bp+2+uintptr(12), bp+40, uint32(8)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong8(tls, bp+2+libc.UintptrFromInt32(12)) } } /* -------------------------------------------------------------------- */ /* Write the directory entry out to disk. */ /* -------------------------------------------------------------------- */ if !(X_TIFFSeekOK(tls, tif, read_offset) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+32653, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+2, dirsize) == dirsize) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module36)), __ccgo_ts+36636, libc.VaList(bp+80, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name)) return 0 } return int32(1) } var _module36 = [15]uint8{'T', 'I', 'F', 'F', 'R', 'e', 's', 'e', 't', 'F', 'i', 'e', 'l', 'd'} const O_RDONLY4 = 00 const TIFF_ANY2 = "TIFF_NOTYPE" const TIFF_BEENWRITING2 = 0x00040 const TIFF_BIGTIFF2 = 0x80000 const TIFF_BUFFERSETUP4 = 0x00010 const TIFF_DIRTYDIRECT2 = 0x00008 const TIFF_DIRTYSTRIP2 = 0x200000 const TIFF_INSUBIFD4 = 0x02000 const TIFF_ISTILED2 = 0x00400 const TIFF_MAPPED4 = 0x00800 const TIFF_MYBUFFER6 = 0x00200 const TIFF_POSTENCODE4 = 0x01000 const TIFF_SWAB2 = 0x00080 const UINT_MAX4 = 0xffffffff func _DumpFixupTags(tls *libc.TLS, tif uintptr) (r int32) { _ = tif return int32(1) } // C documentation // // /* // * Encode a hunk of pixels. // */ func _DumpModeEncode(tls *libc.TLS, tif uintptr, pp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var n Ttmsize_t _ = n _ = s for cc > 0 { n = cc if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc+n > (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { n = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc } /* * Avoid copy if client has setup raw * data buffer to avoid extra copy. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp != pp { X_TIFFmemcpy(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp, pp, n) } *(*uintptr)(unsafe.Pointer(tif + 828)) += uintptr(n) *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) += n pp += uintptr(n) cc -= n if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize && !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } return int32(1) } // C documentation // // /* // * Decode a hunk of pixels. // */ func _DumpModeDecode(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) _ = s if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc < cc { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module37)), __ccgo_ts+36676, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc, cc)) return 0 } /* * Avoid copy if client has setup raw * data buffer to avoid extra copy. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp != buf { X_TIFFmemcpy(tls, buf, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp, cc) } *(*uintptr)(unsafe.Pointer(tif + 828)) += uintptr(cc) *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= cc return int32(1) } var _module37 = [15]uint8{'D', 'u', 'm', 'p', 'M', 'o', 'd', 'e', 'D', 'e', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Seek forwards nrows in the current strip. // */ func _DumpModeSeek(tls *libc.TLS, tif uintptr, nrows Tuint32_t) (r int32) { var p1 uintptr _ = p1 *(*uintptr)(unsafe.Pointer(tif + 828)) += uintptr(nrows * libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize)) p1 = tif + 832 *(*Ttmsize_t)(unsafe.Pointer(p1)) = Ttmsize_t(uint32(*(*Ttmsize_t)(unsafe.Pointer(p1))) - nrows*libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize)) return int32(1) } // C documentation // // /* // * Initialize dump mode. // */ func XTIFFInitDumpMode(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { _ = scheme (*TTIFF)(unsafe.Pointer(tif)).Ftif_fixuptags = __ccgo_fp(_DumpFixupTags) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_DumpModeDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_DumpModeDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_DumpModeDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_DumpModeEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_DumpModeEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_DumpModeEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_seek = __ccgo_fp(_DumpModeSeek) return int32(1) } func XTIFFSetErrorHandler(tls *libc.TLS, handler TTIFFErrorHandler) (r TTIFFErrorHandler) { var prev TTIFFErrorHandler _ = prev prev = X_TIFFerrorHandler X_TIFFerrorHandler = handler return prev } func XTIFFSetErrorHandlerExt(tls *libc.TLS, handler TTIFFErrorHandlerExt) (r TTIFFErrorHandlerExt) { var prev TTIFFErrorHandlerExt _ = prev prev = X_TIFFerrorHandlerExt X_TIFFerrorHandlerExt = handler return prev } func XTIFFError(tls *libc.TLS, module uintptr, fmt uintptr, va uintptr) { var ap Tva_list _ = ap if X_TIFFerrorHandler != 0 { ap = va (*(*func(*libc.TLS, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFerrorHandler})))(tls, module, fmt, ap) _ = ap } if X_TIFFerrorHandlerExt != 0 { ap = va (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFerrorHandlerExt})))(tls, uintptr(0), module, fmt, ap) _ = ap } } func XTIFFErrorExt(tls *libc.TLS, fd Tthandle_t, module uintptr, fmt uintptr, va uintptr) { var ap Tva_list _ = ap if X_TIFFerrorHandler != 0 { ap = va (*(*func(*libc.TLS, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFerrorHandler})))(tls, module, fmt, ap) _ = ap } if X_TIFFerrorHandlerExt != 0 { ap = va (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFerrorHandlerExt})))(tls, fd, module, fmt, ap) _ = ap } } func X_TIFFErrorEarly(tls *libc.TLS, opts uintptr, clientdata Tthandle_t, module uintptr, fmt uintptr, va uintptr) { var ap Tva_list var stop int32 _, _ = ap, stop if opts != 0 && (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Ferrorhandler != 0 { ap = va stop = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFOpenOptions)(unsafe.Pointer(opts)).Ferrorhandler})))(tls, libc.UintptrFromInt32(0), (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Ferrorhandler_user_data, module, fmt, ap) _ = ap if stop != 0 { return } } if X_TIFFerrorHandler != 0 { ap = va (*(*func(*libc.TLS, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFerrorHandler})))(tls, module, fmt, ap) _ = ap } if X_TIFFerrorHandlerExt != 0 { ap = va (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFerrorHandlerExt})))(tls, clientdata, module, fmt, ap) _ = ap } } func XTIFFErrorExtR(tls *libc.TLS, tif uintptr, module uintptr, fmt uintptr, va uintptr) { var ap Tva_list var stop int32 var v1 Tthandle_t _, _, _ = ap, stop, v1 if tif != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_errorhandler != 0 { ap = va stop = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_errorhandler})))(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_errorhandler_user_data, module, fmt, ap) _ = ap if stop != 0 { return } } if X_TIFFerrorHandler != 0 { ap = va (*(*func(*libc.TLS, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFerrorHandler})))(tls, module, fmt, ap) _ = ap } if X_TIFFerrorHandlerExt != 0 { ap = va if tif != 0 { v1 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata } else { v1 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFerrorHandlerExt})))(tls, v1, module, fmt, ap) _ = ap } } func XTIFFGetTagListCount(tls *libc.TLS, tif uintptr) (r int32) { var td uintptr _ = td td = tif + 56 return (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount } func XTIFFGetTagListEntry(tls *libc.TLS, tif uintptr, tag_index int32) (r Tuint32_t) { var td uintptr _ = td td = tif + 56 if tag_index < 0 || tag_index >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValueCount { return libc.Uint32FromInt32(-libc.Int32FromInt32(1)) } else { return (*TTIFFField)(unsafe.Pointer((*(*TTIFFTagValue)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_customValues + uintptr(tag_index)*12))).Finfo)).Ffield_tag } return r } // C documentation // // /* // ** This provides read/write access to the TIFFTagMethods within the TIFF // ** structure to application code without giving access to the private // ** TIFF structure. // */ func XTIFFAccessTagMethods(tls *libc.TLS, tif uintptr) (r uintptr) { return tif + 892 } func XTIFFGetClientInfo(tls *libc.TLS, tif uintptr, name uintptr) (r uintptr) { var psLink uintptr _ = psLink psLink = (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientinfo for psLink != libc.UintptrFromInt32(0) && libc.Xstrcmp(tls, (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fname, name) != 0 { psLink = (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fnext } if psLink != libc.UintptrFromInt32(0) { return (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fdata } else { return libc.UintptrFromInt32(0) } return r } func XTIFFSetClientInfo(tls *libc.TLS, tif uintptr, data uintptr, name uintptr) { var psLink uintptr _ = psLink psLink = (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientinfo /* ** Do we have an existing link with this name? If so, just ** set it. */ for psLink != libc.UintptrFromInt32(0) && libc.Xstrcmp(tls, (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fname, name) != 0 { psLink = (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fnext } if psLink != libc.UintptrFromInt32(0) { (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fdata = data return } /* ** Create a new link. */ psLink = X_TIFFmallocExt(tls, tif, int32(12)) (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fnext = (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientinfo (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fname = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(libc.Xstrlen(tls, name)+libc.Uint32FromInt32(1))) libc.Xstrcpy(tls, (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fname, name) (*TTIFFClientInfoLink)(unsafe.Pointer(psLink)).Fdata = data (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientinfo = psLink } const EOF_REACHED_COUNT_THRESHOLD = 8192 const EOL = 1 const FAXMODE_BYTEALIGN1 = 4 const FAXMODE_NOEOL1 = 2 const FAXMODE_NORTC1 = 1 const FAXMODE_WORDALIGN1 = 8 const GROUP3OPT_2DENCODING1 = 1 const GROUP3OPT_FILLBITS1 = 4 const GROUP3OPT_UNCOMPRESSED1 = 2 const GROUP4OPT_UNCOMPRESSED1 = 2 const O_RDONLY5 = 0 const S_EOL = 12 const S_Ext = 6 const S_Horiz = 2 const S_MakeUp = 11 const S_MakeUpB = 10 const S_MakeUpW = 9 const S_Null = 0 const S_Pass = 1 const S_TermB = 8 const S_TermW = 7 const S_V0 = 3 const S_VL = 5 const S_VR = 4 const TIFF_ANY3 = 0 const TIFF_DIRTYDIRECT3 = 8 const TIFF_ISTILED3 = 1024 const TIFF_NOBITREV3 = 256 type TTIFFFaxFillFunc = uintptr type TTIFFFaxTabEnt = struct { FState uint8 FWidth uint8 FParam Tuint32_t } type Ttableentry = struct { Flength uint16 Fcode uint16 Frunlen int16 } /* Arbitrary threshold to avoid corrupted single-strip files with extremely * large imageheight to cause apparently endless looping, such as in * https://gitlab.com/libtiff/libtiff/-/issues/583 */ // C documentation // // /* // * Compression+decompression state blocks are // * derived from this ``base state'' block. // */ type TFax3BaseState = struct { Frw_mode int32 Fmode int32 Frowbytes Ttmsize_t Frowpixels Tuint32_t Fcleanfaxdata Tuint16_t Fbadfaxrun Tuint32_t Fbadfaxlines Tuint32_t Fgroupoptions Tuint32_t Fvgetparent TTIFFVGetMethod Fvsetparent TTIFFVSetMethod Fprintdir TTIFFPrintMethod } type TTtag = int32 const G3_1D = 0 const G3_2D = 1 type TFax3CodecState = struct { Fb TFax3BaseState Fbitmap uintptr Fdata Tuint32_t Fbit int32 FEOLcnt int32 FeofReachedCount int32 Ffill TTIFFFaxFillFunc Fruns uintptr Fnruns Tuint32_t Frefruns uintptr Fcurruns uintptr Ftag TTtag Frefline uintptr Fk int32 Fmaxk int32 Fline int32 } /* * Group 3 and Group 4 Decoding. */ /* * These macros glue the TIFF library state to * the state expected by Frank's decoder. */ /* * Save state possibly changed during decoding. */ // C documentation // // /* // * Setup state for decoding a strip. // */ func _Fax3PreDecode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = 0 /* force initial read */ (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = uint32(0) (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt = 0 /* force initial scan for EOL */ (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount = 0 /* * Decoder assumes lsb-to-msb bit order. Note that we select * this here rather than in Fax3SetupState so that viewers can * hold the image open, fiddle with the FillOrder tag value, * and then re-decode the image. Otherwise they'd need to close * and open the image to get the state reset. */ (*TFax3CodecState)(unsafe.Pointer(sp)).Fbitmap = XTIFFGetBitRevTable(tls, libc.BoolInt32(libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_fillorder) != int32(FILLORDER_LSB2MSB))) (*TFax3CodecState)(unsafe.Pointer(sp)).Fcurruns = (*TFax3CodecState)(unsafe.Pointer(sp)).Fruns if (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns != 0 { /* init reference line to white */ (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns = (*TFax3CodecState)(unsafe.Pointer(sp)).Fruns + uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 *(*Tuint32_t)(unsafe.Pointer((*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns)) = (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowpixels *(*Tuint32_t)(unsafe.Pointer((*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns + 1*4)) = uint32(0) } (*TFax3CodecState)(unsafe.Pointer(sp)).Fline = 0 return int32(1) } /* * Routine for handling various errors/conditions. * Note how they are "glued into the decoder" by * overriding the definitions used by the decoder. */ func _Fax3Unexpected(tls *libc.TLS, module uintptr, tif uintptr, line Tuint32_t, a0 Tuint32_t) { bp := tls.Alloc(48) defer tls.Free(48) var v1 uintptr var v2 uint32 _, _ = v1, v2 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v1 = __ccgo_ts + 22575 } else { v1 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v2 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v2 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, module, __ccgo_ts+36777, libc.VaList(bp+8, line, v1, v2, a0)) } func _Fax3Extension(tls *libc.TLS, module uintptr, tif uintptr, line Tuint32_t, a0 Tuint32_t) { bp := tls.Alloc(48) defer tls.Free(48) var v1 uintptr var v2 uint32 _, _ = v1, v2 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v1 = __ccgo_ts + 22575 } else { v1 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v2 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v2 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, module, __ccgo_ts+36818, libc.VaList(bp+8, line, v1, v2, a0)) } func _Fax3BadLength(tls *libc.TLS, module uintptr, tif uintptr, line Tuint32_t, a0 Tuint32_t, lastx Tuint32_t) { bp := tls.Alloc(64) defer tls.Free(64) var v1, v2 uintptr var v3 uint32 _, _, _ = v1, v2, v3 if a0 < lastx { v1 = __ccgo_ts + 36879 } else { v1 = __ccgo_ts + 36893 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v2 = __ccgo_ts + 22575 } else { v2 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v3 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v3 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFWarningExtR(tls, tif, module, __ccgo_ts+36914, libc.VaList(bp+8, v1, line, v2, v3, a0, lastx)) } func _Fax3PrematureEOF(tls *libc.TLS, module uintptr, tif uintptr, line Tuint32_t, a0 Tuint32_t) { bp := tls.Alloc(48) defer tls.Free(48) var v1 uintptr var v2 uint32 _, _ = v1, v2 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v1 = __ccgo_ts + 22575 } else { v1 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v2 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v2 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFWarningExtR(tls, tif, module, __ccgo_ts+36959, libc.VaList(bp+8, line, v1, v2, a0)) } // C documentation // // /** // * Decode the requested amount of G3 1D-encoded data. // * @param buf destination buffer // * @param occ available bytes in destination buffer // * @param s number of planes (ignored) // * @returns 1 for success, -1 in case of error // */ func _Fax3Decode1D(tls *libc.TLS, tif uintptr, buf uintptr, occ Ttmsize_t, s Tuint16_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var BitAcc Tuint32_t var BitsAvail, EOLcnt, RunLength, a0, lastx int32 var TabEnt, bitmap, cp, ep, pa, sp, thisrun, v19, v2, v21, v23, v24, v3, v34, v36, v37, v39, v40, v41, v43, v44, v46, v47, v49, v5, v50, v52, v53, v55, v56, v57, v59, v60, v62, v63, v65, v66, v68, v69, v71, v72, v73, v75, v76, v78, v79, v8, v81, v82, v84, v9 uintptr var v20, v35, v38, v42, v45, v48, v51, v54, v58, v61, v64, v67, v70, v74, v77, v80, v83 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = BitAcc, BitsAvail, EOLcnt, RunLength, TabEnt, a0, bitmap, cp, ep, lastx, pa, sp, thisrun, v19, v2, v20, v21, v23, v24, v3, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v5, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63, v64, v65, v66, v67, v68, v69, v70, v71, v72, v73, v74, v75, v76, v77, v78, v79, v8, v80, v81, v82, v83, v84, v9 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* reference element */ lastx = libc.Int32FromUint32((*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowpixels) /* # EOL codes recognized */ bitmap = (*TFax3CodecState)(unsafe.Pointer(sp)).Fbitmap _ = s if occ%(*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37000, 0) return -int32(1) } if (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount >= int32(EOF_REACHED_COUNT_THRESHOLD) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37036, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount)) return -int32(1) } BitAcc = (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata BitsAvail = (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit EOLcnt = (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt cp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp ep = cp + uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) thisrun = (*TFax3CodecState)(unsafe.Pointer(sp)).Fcurruns for occ > 0 { a0 = 0 RunLength = 0 pa = thisrun if EOLcnt == 0 { for { if BitsAvail < int32(11) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto EOF1D } BitsAvail = int32(11) /* pad with zeros */ } else { v2 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v2)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(11) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(11) /* pad with zeros */ } else { v3 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v3)))))) << BitsAvail BitsAvail += int32(8) } } } } if BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) goto _1 _1: } } for { if BitsAvail < int32(8) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto EOF1D } BitsAvail = int32(8) /* pad with zeros */ } else { v5 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v5)))))) << BitsAvail BitsAvail += int32(8) } } if BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(8)) goto _4 _4: } for BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) } BitsAvail -= int32(1) BitAcc >>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) /* EOL bit */ EOLcnt = 0 /* reset EOL counter/flag */ for { for { if BitsAvail < int32(12) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof1d } BitsAvail = int32(12) /* pad with zeros */ } else { v8 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v8)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(12) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(12) /* pad with zeros */ } else { v9 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v9)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxWhiteTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_EOL): goto _10 case int32(S_TermW): goto _11 case int32(S_MakeUp): goto _12 case int32(S_MakeUpW): goto _13 default: goto _14 } goto _15 _10: ; EOLcnt = int32(1) goto done1d _11: ; _18: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v19 = __ccgo_ts + 22575 } else { v19 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v20 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v20 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v19, v20)) return -int32(1) } v21 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v21)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _17 _17: ; if 0 != 0 { goto _18 } goto _16 _16: ; goto doneWhite1d _13: ; _12: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _15 _14: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module38)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto done1d _15: ; goto _7 _7: } goto doneWhite1d doneWhite1d: ; if a0 >= lastx { goto done1d } for { if BitsAvail < int32(13) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof1d } BitsAvail = int32(13) /* pad with zeros */ } else { v23 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v23)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(13) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(13) /* pad with zeros */ } else { v24 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v24)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxBlackTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_EOL): goto _25 case int32(S_TermB): goto _26 case int32(S_MakeUp): goto _27 case int32(S_MakeUpB): goto _28 default: goto _29 } goto _30 _25: ; EOLcnt = int32(1) goto done1d _26: ; _33: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v34 = __ccgo_ts + 22575 } else { v34 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v35 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v35 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v34, v35)) return -int32(1) } v36 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v36)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _32 _32: ; if 0 != 0 { goto _33 } goto _31 _31: ; goto doneBlack1d _28: ; _27: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _30 _29: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module38)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto done1d _30: ; goto _22 _22: } goto doneBlack1d doneBlack1d: ; if a0 >= lastx { goto done1d } if *(*Tuint32_t)(unsafe.Pointer(pa - libc.UintptrFromInt32(1)*4)) == uint32(0) && *(*Tuint32_t)(unsafe.Pointer(pa - libc.UintptrFromInt32(2)*4)) == uint32(0) { pa -= uintptr(2) * 4 } goto _6 _6: } goto eof1d eof1d: ; _Fax3PrematureEOF(tls, uintptr(unsafe.Pointer(&_module38)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount++ if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v37 = __ccgo_ts + 22575 } else { v37 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v38 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v38 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v37, v38)) return -int32(1) } v39 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v39)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module38)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v40 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v40))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v41 = __ccgo_ts + 22575 } else { v41 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v42 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v42 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v41, v42)) return -int32(1) } v43 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v43)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v44 = __ccgo_ts + 22575 } else { v44 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v45 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v45 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v44, v45)) return -int32(1) } v46 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v46)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v47 = __ccgo_ts + 22575 } else { v47 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v48 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v48 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v47, v48)) return -int32(1) } v49 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v49)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v50 = __ccgo_ts + 22575 } else { v50 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v51 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v51 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v50, v51)) return -int32(1) } v52 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v52)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } goto EOF1Da goto done1d done1d: ; if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v53 = __ccgo_ts + 22575 } else { v53 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v54 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v54 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v53, v54)) return -int32(1) } v55 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v55)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module38)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v56 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v56))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v57 = __ccgo_ts + 22575 } else { v57 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v58 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v58 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v57, v58)) return -int32(1) } v59 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v59)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v60 = __ccgo_ts + 22575 } else { v60 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v61 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v61 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v60, v61)) return -int32(1) } v62 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v62)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v63 = __ccgo_ts + 22575 } else { v63 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v64 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v64 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v63, v64)) return -int32(1) } v65 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v65)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v66 = __ccgo_ts + 22575 } else { v66 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v67 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v67 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v66, v67)) return -int32(1) } v68 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v68)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tuint32_t))(unsafe.Pointer(&struct{ uintptr }{(*TFax3CodecState)(unsafe.Pointer(sp)).Ffill})))(tls, buf, thisrun, pa, libc.Uint32FromInt32(lastx)) buf += uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes) occ -= (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes (*TFax3CodecState)(unsafe.Pointer(sp)).Fline++ continue goto EOF1D EOF1D: ; /* premature EOF */ if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v69 = __ccgo_ts + 22575 } else { v69 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v70 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v70 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v69, v70)) return -int32(1) } v71 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v71)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module38)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v72 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v72))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v73 = __ccgo_ts + 22575 } else { v73 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v74 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v74 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v73, v74)) return -int32(1) } v75 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v75)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v76 = __ccgo_ts + 22575 } else { v76 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v77 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v77 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v76, v77)) return -int32(1) } v78 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v78)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v79 = __ccgo_ts + 22575 } else { v79 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v80 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v80 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v79, v80)) return -int32(1) } v81 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v81)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v82 = __ccgo_ts + 22575 } else { v82 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v83 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v83 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module38)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v82, v83)) return -int32(1) } v84 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v84)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } goto EOF1Da EOF1Da: ; /* premature EOF */ (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tuint32_t))(unsafe.Pointer(&struct{ uintptr }{(*TFax3CodecState)(unsafe.Pointer(sp)).Ffill})))(tls, buf, thisrun, pa, libc.Uint32FromInt32(lastx)) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = BitsAvail (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = BitAcc (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt = EOLcnt *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= int32(cp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = cp return -int32(1) } (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = BitsAvail (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = BitAcc (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt = EOLcnt *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= int32(cp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = cp return int32(1) } var _module38 = [13]uint8{'F', 'a', 'x', '3', 'D', 'e', 'c', 'o', 'd', 'e', '1', 'D'} // C documentation // // /* // * Decode the requested amount of G3 2D-encoded data. // */ func _Fax3Decode2D(tls *libc.TLS, tif uintptr, buf uintptr, occ Ttmsize_t, s Tuint16_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var BitAcc Tuint32_t var BitsAvail, EOLcnt, RunLength, a0, b1, is1D, lastx int32 var TabEnt, bitmap, cp, ep, pa, pb, sp, thisrun, x, v1, v106, v108, v11, v110, v111, v12, v120, v122, v124, v125, v134, v136, v138, v139, v148, v150, v151, v153, v155, v157, v158, v160, v161, v163, v165, v166, v168, v169, v171, v173, v174, v175, v176, v177, v178, v180, v181, v182, v184, v185, v187, v188, v190, v191, v193, v194, v195, v197, v198, v200, v201, v202, v204, v205, v207, v208, v210, v211, v213, v214, v216, v217, v219, v22, v220, v221, v223, v224, v226, v227, v229, v230, v232, v24, v26, v27, v3, v37, v39, v4, v40, v42, v43, v44, v46, v47, v49, v50, v52, v53, v55, v56, v58, v59, v6, v60, v62, v63, v65, v66, v68, v69, v7, v71, v77, v79, v8, v89, v91, v93, v94, v96, v97 uintptr var v107, v121, v135, v149, v152, v154, v156, v159, v162, v164, v167, v170, v172, v179, v183, v186, v189, v192, v196, v199, v203, v206, v209, v212, v215, v218, v222, v225, v228, v23, v231, v38, v41, v45, v48, v51, v54, v57, v61, v64, v67, v70, v78, v90, v92 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = BitAcc, BitsAvail, EOLcnt, RunLength, TabEnt, a0, b1, bitmap, cp, ep, is1D, lastx, pa, pb, sp, thisrun, x, v1, v106, v107, v108, v11, v110, v111, v12, v120, v121, v122, v124, v125, v134, v135, v136, v138, v139, v148, v149, v150, v151, v152, v153, v154, v155, v156, v157, v158, v159, v160, v161, v162, v163, v164, v165, v166, v167, v168, v169, v170, v171, v172, v173, v174, v175, v176, v177, v178, v179, v180, v181, v182, v183, v184, v185, v186, v187, v188, v189, v190, v191, v192, v193, v194, v195, v196, v197, v198, v199, v200, v201, v202, v203, v204, v205, v206, v207, v208, v209, v210, v211, v212, v213, v214, v215, v216, v217, v218, v219, v22, v220, v221, v222, v223, v224, v225, v226, v227, v228, v229, v23, v230, v231, v232, v24, v26, v27, v3, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v6, v60, v61, v62, v63, v64, v65, v66, v67, v68, v69, v7, v70, v71, v77, v78, v79, v8, v89, v90, v91, v92, v93, v94, v96, v97 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* reference element */ lastx = libc.Int32FromUint32((*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowpixels) /* # EOL codes recognized */ bitmap = (*TFax3CodecState)(unsafe.Pointer(sp)).Fbitmap /* current line is 1d/2d-encoded */ _ = s if occ%(*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37000, 0) return -int32(1) } if (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount >= int32(EOF_REACHED_COUNT_THRESHOLD) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37036, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount)) return -int32(1) } BitAcc = (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata BitsAvail = (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit EOLcnt = (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt cp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp ep = cp + uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) for occ > 0 { a0 = 0 RunLength = 0 v1 = (*TFax3CodecState)(unsafe.Pointer(sp)).Fcurruns thisrun = v1 pa = v1 if EOLcnt == 0 { for { if BitsAvail < int32(11) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto EOF2D } BitsAvail = int32(11) /* pad with zeros */ } else { v3 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v3)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(11) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(11) /* pad with zeros */ } else { v4 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v4)))))) << BitsAvail BitsAvail += int32(8) } } } } if BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) goto _2 _2: } } for { if BitsAvail < int32(8) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto EOF2D } BitsAvail = int32(8) /* pad with zeros */ } else { v6 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v6)))))) << BitsAvail BitsAvail += int32(8) } } if BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(8)) goto _5 _5: } for BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) } BitsAvail -= int32(1) BitAcc >>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) /* EOL bit */ EOLcnt = 0 /* reset EOL counter/flag */ if BitsAvail < int32(1) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto EOF2D } BitsAvail = int32(1) /* pad with zeros */ } else { v7 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v7)))))) << BitsAvail BitsAvail += int32(8) } } is1D = libc.Int32FromUint32(BitAcc & libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) pb = (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns v8 = pb pb += 4 b1 = libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(v8))) if is1D != 0 { for { for { if BitsAvail < int32(12) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof1d } BitsAvail = int32(12) /* pad with zeros */ } else { v11 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v11)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(12) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(12) /* pad with zeros */ } else { v12 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v12)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxWhiteTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_EOL): goto _13 case int32(S_TermW): goto _14 case int32(S_MakeUp): goto _15 case int32(S_MakeUpW): goto _16 default: goto _17 } goto _18 _13: ; EOLcnt = int32(1) goto done1d _14: ; _21: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v22 = __ccgo_ts + 22575 } else { v22 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v23 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v23 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v22, v23)) return -int32(1) } v24 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v24)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _20 _20: ; if 0 != 0 { goto _21 } goto _19 _19: ; goto doneWhite1d _16: ; _15: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _18 _17: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto done1d _18: ; goto _10 _10: } goto doneWhite1d doneWhite1d: ; if a0 >= lastx { goto done1d } for { if BitsAvail < int32(13) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof1d } BitsAvail = int32(13) /* pad with zeros */ } else { v26 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v26)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(13) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(13) /* pad with zeros */ } else { v27 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v27)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxBlackTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_EOL): goto _28 case int32(S_TermB): goto _29 case int32(S_MakeUp): goto _30 case int32(S_MakeUpB): goto _31 default: goto _32 } goto _33 _28: ; EOLcnt = int32(1) goto done1d _29: ; _36: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v37 = __ccgo_ts + 22575 } else { v37 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v38 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v38 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v37, v38)) return -int32(1) } v39 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v39)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _35 _35: ; if 0 != 0 { goto _36 } goto _34 _34: ; goto doneBlack1d _31: ; _30: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _33 _32: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto done1d _33: ; goto _25 _25: } goto doneBlack1d doneBlack1d: ; if a0 >= lastx { goto done1d } if *(*Tuint32_t)(unsafe.Pointer(pa - libc.UintptrFromInt32(1)*4)) == uint32(0) && *(*Tuint32_t)(unsafe.Pointer(pa - libc.UintptrFromInt32(2)*4)) == uint32(0) { pa -= uintptr(2) * 4 } goto _9 _9: } goto eof1d eof1d: ; _Fax3PrematureEOF(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount++ if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v40 = __ccgo_ts + 22575 } else { v40 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v41 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v41 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v40, v41)) return -int32(1) } v42 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v42)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v43 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v43))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v44 = __ccgo_ts + 22575 } else { v44 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v45 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v45 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v44, v45)) return -int32(1) } v46 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v46)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v47 = __ccgo_ts + 22575 } else { v47 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v48 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v48 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v47, v48)) return -int32(1) } v49 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v49)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v50 = __ccgo_ts + 22575 } else { v50 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v51 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v51 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v50, v51)) return -int32(1) } v52 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v52)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v53 = __ccgo_ts + 22575 } else { v53 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v54 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v54 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v53, v54)) return -int32(1) } v55 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v55)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } goto EOF2Da goto done1d done1d: ; if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v56 = __ccgo_ts + 22575 } else { v56 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v57 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v57 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v56, v57)) return -int32(1) } v58 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v58)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v59 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v59))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v60 = __ccgo_ts + 22575 } else { v60 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v61 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v61 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v60, v61)) return -int32(1) } v62 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v62)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v63 = __ccgo_ts + 22575 } else { v63 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v64 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v64 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v63, v64)) return -int32(1) } v65 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v65)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v66 = __ccgo_ts + 22575 } else { v66 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v67 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v67 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v66, v67)) return -int32(1) } v68 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v68)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v69 = __ccgo_ts + 22575 } else { v69 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v70 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v70 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v69, v70)) return -int32(1) } v71 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v71)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } } else { _74: ; _76: ; if !(a0 < lastx) { goto _75 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v77 = __ccgo_ts + 22575 } else { v77 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v78 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v78 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v77, v78)) return -int32(1) } if BitsAvail < int32(7) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(7) /* pad with zeros */ } else { v79 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v79)))))) << BitsAvail BitsAvail += int32(8) } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxMainTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_Pass): goto _80 case int32(S_Horiz): goto _81 case int32(S_V0): goto _82 case int32(S_VR): goto _83 case int32(S_VL): goto _84 case int32(S_Ext): goto _85 case int32(S_EOL): goto _86 default: goto _87 } goto _88 _80: ; if pa != thisrun { for b1 <= a0 && b1 < lastx { if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v89 = __ccgo_ts + 22575 } else { v89 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v90 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v90 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v89, v90)) return -int32(1) } b1 = int32(uint32(b1) + (*(*Tuint32_t)(unsafe.Pointer(pb)) + *(*Tuint32_t)(unsafe.Pointer(pb + 1*4)))) pb += uintptr(2) * 4 } } if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v91 = __ccgo_ts + 22575 } else { v91 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v92 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v92 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v91, v92)) return -int32(1) } v93 = pb pb += 4 b1 = int32(uint32(b1) + *(*Tuint32_t)(unsafe.Pointer(v93))) RunLength += b1 - a0 a0 = b1 v94 = pb pb += 4 b1 = int32(uint32(b1) + *(*Tuint32_t)(unsafe.Pointer(v94))) goto _88 _81: ; if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { for { if BitsAvail < int32(13) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(13) /* pad with zeros */ } else { v96 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v96)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(13) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(13) /* pad with zeros */ } else { v97 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v97)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxBlackTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_TermB): goto _98 case int32(S_MakeUp): goto _99 case int32(S_MakeUpB): goto _100 default: goto _101 } goto _102 _98: ; _105: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v106 = __ccgo_ts + 22575 } else { v106 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v107 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v107 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v106, v107)) return -int32(1) } v108 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v108)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _104 _104: ; if 0 != 0 { goto _105 } goto _103 _103: ; goto doneWhite2da _100: ; _99: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _102 _101: ; goto badBlack2d _102: ; goto _95 _95: } goto doneWhite2da doneWhite2da: ; for { if BitsAvail < int32(12) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(12) /* pad with zeros */ } else { v110 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v110)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(12) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(12) /* pad with zeros */ } else { v111 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v111)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxWhiteTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_TermW): goto _112 case int32(S_MakeUp): goto _113 case int32(S_MakeUpW): goto _114 default: goto _115 } goto _116 _112: ; _119: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v120 = __ccgo_ts + 22575 } else { v120 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v121 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v121 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v120, v121)) return -int32(1) } v122 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v122)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _118 _118: ; if 0 != 0 { goto _119 } goto _117 _117: ; goto doneBlack2da _114: ; _113: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _116 _115: ; goto badWhite2d _116: ; goto _109 _109: } goto doneBlack2da doneBlack2da: } else { for { if BitsAvail < int32(12) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(12) /* pad with zeros */ } else { v124 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v124)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(12) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(12) /* pad with zeros */ } else { v125 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v125)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxWhiteTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_TermW): goto _126 case int32(S_MakeUp): goto _127 case int32(S_MakeUpW): goto _128 default: goto _129 } goto _130 _126: ; _133: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v134 = __ccgo_ts + 22575 } else { v134 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v135 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v135 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v134, v135)) return -int32(1) } v136 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v136)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _132 _132: ; if 0 != 0 { goto _133 } goto _131 _131: ; goto doneWhite2db _128: ; _127: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _130 _129: ; goto badWhite2d _130: ; goto _123 _123: } goto doneWhite2db doneWhite2db: ; for { if BitsAvail < int32(13) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(13) /* pad with zeros */ } else { v138 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v138)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(13) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(13) /* pad with zeros */ } else { v139 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v139)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxBlackTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_TermB): goto _140 case int32(S_MakeUp): goto _141 case int32(S_MakeUpB): goto _142 default: goto _143 } goto _144 _140: ; _147: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v148 = __ccgo_ts + 22575 } else { v148 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v149 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v149 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v148, v149)) return -int32(1) } v150 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v150)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _146 _146: ; if 0 != 0 { goto _147 } goto _145 _145: ; goto doneBlack2db _142: ; _141: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _144 _143: ; goto badBlack2d _144: ; goto _137 _137: } goto doneBlack2db doneBlack2db: } if pa != thisrun { for b1 <= a0 && b1 < lastx { if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v151 = __ccgo_ts + 22575 } else { v151 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v152 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v152 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v151, v152)) return -int32(1) } b1 = int32(uint32(b1) + (*(*Tuint32_t)(unsafe.Pointer(pb)) + *(*Tuint32_t)(unsafe.Pointer(pb + 1*4)))) pb += uintptr(2) * 4 } } goto _88 _82: ; if pa != thisrun { for b1 <= a0 && b1 < lastx { if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v153 = __ccgo_ts + 22575 } else { v153 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v154 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v154 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v153, v154)) return -int32(1) } b1 = int32(uint32(b1) + (*(*Tuint32_t)(unsafe.Pointer(pb)) + *(*Tuint32_t)(unsafe.Pointer(pb + 1*4)))) pb += uintptr(2) * 4 } } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v155 = __ccgo_ts + 22575 } else { v155 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v156 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v156 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v155, v156)) return -int32(1) } v157 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v157)) = libc.Uint32FromInt32(RunLength + (b1 - a0)) a0 += b1 - a0 RunLength = 0 if pb >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v158 = __ccgo_ts + 22575 } else { v158 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v159 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v159 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v158, v159)) return -int32(1) } v160 = pb pb += 4 b1 = int32(uint32(b1) + *(*Tuint32_t)(unsafe.Pointer(v160))) goto _88 _83: ; if pa != thisrun { for b1 <= a0 && b1 < lastx { if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v161 = __ccgo_ts + 22575 } else { v161 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v162 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v162 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v161, v162)) return -int32(1) } b1 = int32(uint32(b1) + (*(*Tuint32_t)(unsafe.Pointer(pb)) + *(*Tuint32_t)(unsafe.Pointer(pb + 1*4)))) pb += uintptr(2) * 4 } } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v163 = __ccgo_ts + 22575 } else { v163 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v164 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v164 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v163, v164)) return -int32(1) } v165 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v165)) = libc.Uint32FromInt32(RunLength) + (libc.Uint32FromInt32(b1-a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) a0 = int32(uint32(a0) + (libc.Uint32FromInt32(b1-a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam)) RunLength = 0 if pb >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v166 = __ccgo_ts + 22575 } else { v166 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v167 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v167 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v166, v167)) return -int32(1) } v168 = pb pb += 4 b1 = int32(uint32(b1) + *(*Tuint32_t)(unsafe.Pointer(v168))) goto _88 _84: ; if pa != thisrun { for b1 <= a0 && b1 < lastx { if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v169 = __ccgo_ts + 22575 } else { v169 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v170 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v170 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v169, v170)) return -int32(1) } b1 = int32(uint32(b1) + (*(*Tuint32_t)(unsafe.Pointer(pb)) + *(*Tuint32_t)(unsafe.Pointer(pb + 1*4)))) pb += uintptr(2) * 4 } } if b1 < libc.Int32FromUint32(libc.Uint32FromInt32(a0)+(*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) { _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto eol2d } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v171 = __ccgo_ts + 22575 } else { v171 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v172 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v172 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v171, v172)) return -int32(1) } v173 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v173)) = libc.Uint32FromInt32(RunLength) + (libc.Uint32FromInt32(b1-a0) - (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) a0 = int32(uint32(a0) + (libc.Uint32FromInt32(b1-a0) - (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam)) RunLength = 0 pb -= 4 v174 = pb b1 = int32(uint32(b1) - *(*Tuint32_t)(unsafe.Pointer(v174))) goto _88 _85: ; v175 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v175)) = libc.Uint32FromInt32(lastx - a0) _Fax3Extension(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto eol2d _86: ; v176 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v176)) = libc.Uint32FromInt32(lastx - a0) if BitsAvail < int32(4) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(4) /* pad with zeros */ } else { v177 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v177)))))) << BitsAvail BitsAvail += int32(8) } } if BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(4)) EOLcnt = int32(1) goto eol2d _87: ; goto badMain2d badMain2d: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto eol2d goto badBlack2d badBlack2d: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto eol2d goto badWhite2d badWhite2d: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto eol2d goto eof2d eof2d: ; _Fax3PrematureEOF(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount++ if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v178 = __ccgo_ts + 22575 } else { v178 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v179 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v179 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v178, v179)) return -int32(1) } v180 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v180)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v181 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v181))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v182 = __ccgo_ts + 22575 } else { v182 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v183 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v183 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v182, v183)) return -int32(1) } v184 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v184)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v185 = __ccgo_ts + 22575 } else { v185 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v186 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v186 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v185, v186)) return -int32(1) } v187 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v187)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v188 = __ccgo_ts + 22575 } else { v188 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v189 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v189 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v188, v189)) return -int32(1) } v190 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v190)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v191 = __ccgo_ts + 22575 } else { v191 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v192 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v192 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v191, v192)) return -int32(1) } v193 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v193)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } goto EOF2Da _88: ; goto _76 _75: ; if RunLength != 0 { if RunLength+a0 < lastx { if BitsAvail < int32(1) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(1) /* pad with zeros */ } else { v194 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v194)))))) << BitsAvail BitsAvail += int32(8) } } if !(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v195 = __ccgo_ts + 22575 } else { v195 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v196 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v196 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v195, v196)) return -int32(1) } v197 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v197)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } goto eol2d eol2d: ; if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v198 = __ccgo_ts + 22575 } else { v198 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v199 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v199 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v198, v199)) return -int32(1) } v200 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v200)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v201 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v201))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v202 = __ccgo_ts + 22575 } else { v202 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v203 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v203 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v202, v203)) return -int32(1) } v204 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v204)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v205 = __ccgo_ts + 22575 } else { v205 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v206 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v206 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v205, v206)) return -int32(1) } v207 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v207)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v208 = __ccgo_ts + 22575 } else { v208 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v209 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v209 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v208, v209)) return -int32(1) } v210 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v210)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v211 = __ccgo_ts + 22575 } else { v211 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v212 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v212 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v211, v212)) return -int32(1) } v213 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v213)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } goto _73 _73: ; if 0 != 0 { goto _74 } goto _72 _72: } (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tuint32_t))(unsafe.Pointer(&struct{ uintptr }{(*TFax3CodecState)(unsafe.Pointer(sp)).Ffill})))(tls, buf, thisrun, pa, libc.Uint32FromInt32(lastx)) if pa < thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v214 = __ccgo_ts + 22575 } else { v214 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v215 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v215 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v214, v215)) return -int32(1) } v216 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v216)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 /* imaginary change for reference */ } x = (*TFax3CodecState)(unsafe.Pointer(sp)).Fcurruns (*TFax3CodecState)(unsafe.Pointer(sp)).Fcurruns = (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns = x buf += uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes) occ -= (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes (*TFax3CodecState)(unsafe.Pointer(sp)).Fline++ continue goto EOF2D EOF2D: ; /* premature EOF */ if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v217 = __ccgo_ts + 22575 } else { v217 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v218 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v218 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v217, v218)) return -int32(1) } v219 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v219)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module39)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v220 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v220))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v221 = __ccgo_ts + 22575 } else { v221 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v222 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v222 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v221, v222)) return -int32(1) } v223 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v223)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v224 = __ccgo_ts + 22575 } else { v224 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v225 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v225 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v224, v225)) return -int32(1) } v226 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v226)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v227 = __ccgo_ts + 22575 } else { v227 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v228 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v228 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v227, v228)) return -int32(1) } v229 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v229)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v230 = __ccgo_ts + 22575 } else { v230 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v231 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v231 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module39)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v230, v231)) return -int32(1) } v232 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v232)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } goto EOF2Da EOF2Da: ; /* premature EOF */ (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tuint32_t))(unsafe.Pointer(&struct{ uintptr }{(*TFax3CodecState)(unsafe.Pointer(sp)).Ffill})))(tls, buf, thisrun, pa, libc.Uint32FromInt32(lastx)) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = BitsAvail (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = BitAcc (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt = EOLcnt *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= int32(cp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = cp return -int32(1) } (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = BitsAvail (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = BitAcc (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt = EOLcnt *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= int32(cp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = cp return int32(1) } var _module39 = [13]uint8{'F', 'a', 'x', '3', 'D', 'e', 'c', 'o', 'd', 'e', '2', 'D'} // C documentation // // /* // * Bit-fill a row according to the white/black // * runs generated during G3/G4 decoding. // */ func X_TIFFFax3fillruns(tls *libc.TLS, buf uintptr, runs uintptr, erun uintptr, lastx Tuint32_t) { var bx, run, x, v15, v3 Tuint32_t var cp, lp, v1, v11, v17, v20, v23, v5, v8, p13, p14, p16, p25, p4 uintptr var ifill, izero, n, nw, v18, v21, v6, v9 Tint32_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bx, cp, ifill, izero, lp, n, nw, run, x, v1, v11, v15, v17, v18, v20, v21, v23, v3, v5, v6, v8, v9, p13, p14, p16, p25, p4 if (int32(erun)-int32(runs))/4&int32(1) != 0 { v1 = erun erun += 4 *(*Tuint32_t)(unsafe.Pointer(v1)) = uint32(0) } x = uint32(0) for { if !(runs < erun) { break } run = *(*Tuint32_t)(unsafe.Pointer(runs)) if x+run > lastx || run > lastx { v3 = lastx - x *(*Tuint32_t)(unsafe.Pointer(runs)) = v3 run = v3 } if run != 0 { cp = buf + uintptr(x>>libc.Int32FromInt32(3)) bx = x & uint32(7) if run > uint32(8)-bx { if bx != 0 { /* align to byte boundary */ v5 = cp cp++ p4 = v5 *(*uint8)(unsafe.Pointer(p4)) = uint8(int32(*(*uint8)(unsafe.Pointer(p4))) & (libc.Int32FromInt32(0xff) << (libc.Uint32FromInt32(8) - bx))) run -= uint32(8) - bx } v6 = libc.Int32FromUint32(run >> libc.Int32FromInt32(3)) n = v6 if v6 != 0 { /* multiple bytes to fill */ if libc.Uint32FromInt32(n)/uint32(8) > uint32(1) { /* * Align to int64_tword boundary and fill. */ for { if !(n != 0 && !(uint32(cp)&(libc.Uint32FromInt64(8)-libc.Uint32FromInt32(1)) == libc.Uint32FromInt32(0))) { break } v8 = cp cp++ *(*uint8)(unsafe.Pointer(v8)) = uint8(0x00) goto _7 _7: ; n-- } lp = cp nw = libc.Int32FromUint32(libc.Uint32FromInt32(n) / libc.Uint32FromInt64(8)) n = Tint32_t(uint32(n) - libc.Uint32FromInt32(nw)*libc.Uint32FromInt64(8)) for { v11 = lp lp += 8 *(*Tint64_t)(unsafe.Pointer(v11)) = 0 goto _10 _10: ; nw-- v9 = nw if !(v9 != 0) { break } } cp = lp } izero = 0 for { if !(izero < n) { break } *(*uint8)(unsafe.Pointer(cp + uintptr(izero))) = uint8(0) goto _12 _12: ; izero++ } cp += uintptr(n) run &= uint32(7) } if run != 0 { p13 = cp *(*uint8)(unsafe.Pointer(p13)) = uint8(int32(*(*uint8)(unsafe.Pointer(p13))) & (libc.Int32FromInt32(0xff) >> run)) } } else { p14 = cp *(*uint8)(unsafe.Pointer(p14)) = uint8(int32(*(*uint8)(unsafe.Pointer(p14))) & ^(libc.Int32FromUint8(__fillmasks[run]) >> bx)) } x += *(*Tuint32_t)(unsafe.Pointer(runs)) } run = *(*Tuint32_t)(unsafe.Pointer(runs + 1*4)) if x+run > lastx || run > lastx { v15 = lastx - x *(*Tuint32_t)(unsafe.Pointer(runs + 1*4)) = v15 run = v15 } if run != 0 { cp = buf + uintptr(x>>libc.Int32FromInt32(3)) bx = x & uint32(7) if run > uint32(8)-bx { if bx != 0 { /* align to byte boundary */ v17 = cp cp++ p16 = v17 *(*uint8)(unsafe.Pointer(p16)) = uint8(int32(*(*uint8)(unsafe.Pointer(p16))) | libc.Int32FromInt32(0xff)>>bx) run -= uint32(8) - bx } v18 = libc.Int32FromUint32(run >> libc.Int32FromInt32(3)) n = v18 if v18 != 0 { /* multiple bytes to fill */ if libc.Uint32FromInt32(n)/uint32(8) > uint32(1) { /* * Align to int64_t boundary and fill. */ for { if !(n != 0 && !(uint32(cp)&(libc.Uint32FromInt64(8)-libc.Uint32FromInt32(1)) == libc.Uint32FromInt32(0))) { break } v20 = cp cp++ *(*uint8)(unsafe.Pointer(v20)) = uint8(0xff) goto _19 _19: ; n-- } lp = cp nw = libc.Int32FromUint32(libc.Uint32FromInt32(n) / libc.Uint32FromInt64(8)) n = Tint32_t(uint32(n) - libc.Uint32FromInt32(nw)*libc.Uint32FromInt64(8)) for { v23 = lp lp += 8 *(*Tint64_t)(unsafe.Pointer(v23)) = int64(-int32(1)) goto _22 _22: ; nw-- v21 = nw if !(v21 != 0) { break } } cp = lp } ifill = 0 for { if !(ifill < n) { break } *(*uint8)(unsafe.Pointer(cp + uintptr(ifill))) = uint8(0xff) goto _24 _24: ; ifill++ } cp += uintptr(n) run &= uint32(7) } /* Explicit 0xff masking to make icc -check=conversions happy */ if run != 0 { *(*uint8)(unsafe.Pointer(cp)) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) | libc.Int32FromInt32(0xff00)>>run) & libc.Int32FromInt32(0xff)) } } else { p25 = cp *(*uint8)(unsafe.Pointer(p25)) = uint8(int32(*(*uint8)(unsafe.Pointer(p25))) | libc.Int32FromUint8(__fillmasks[run])>>bx) } x += *(*Tuint32_t)(unsafe.Pointer(runs + 1*4)) } goto _2 _2: ; runs += uintptr(2) * 4 } } var __fillmasks = [9]uint8{ 1: uint8(0x80), 2: uint8(0xc0), 3: uint8(0xe0), 4: uint8(0xf0), 5: uint8(0xf8), 6: uint8(0xfc), 7: uint8(0xfe), 8: uint8(0xff), } func _Fax3FixupTags(tls *libc.TLS, tif uintptr) (r int32) { _ = tif return int32(1) } // C documentation // // /* // * Setup G3/G4-related compression/decompression state // * before data is processed. This routine is called once // * per image -- it sets up different state based on whether // * or not decoding or encoding is being done and whether // * 1D- or 2D-encoded data is involved. // */ func _Fax3SetupState(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var dsp, esp, sp, td uintptr var needsRefLine int32 var rowbytes Ttmsize_t var rowpixels Tuint32_t var v1, v2, v3, v5, v6 uint32 var v4 bool _, _, _, _, _, _, _, _, _, _, _, _, _ = dsp, esp, needsRefLine, rowbytes, rowpixels, sp, td, v1, v2, v3, v4, v5, v6 td = tif + 56 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data dsp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(1) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module40)), __ccgo_ts+37136, 0) return 0 } /* * Calculate the scanline/tile widths. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { rowbytes = XTIFFTileRowSize(tls, tif) rowpixels = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth } else { rowbytes = XTIFFScanlineSize(tls, tif) rowpixels = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth } if int64(rowbytes) < (libc.Int64FromUint32(rowpixels)+int64(7))/int64(8) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module40)), __ccgo_ts+37190, libc.VaList(bp+8, int64(rowbytes), rowpixels)) return 0 } (*TFax3BaseState)(unsafe.Pointer(sp)).Frowbytes = rowbytes (*TFax3BaseState)(unsafe.Pointer(sp)).Frowpixels = rowpixels /* * Allocate any additional space required for decoding/encoding. */ needsRefLine = libc.BoolInt32((*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions&uint32(GROUP3OPT_2DENCODING1) != 0 || libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == int32(COMPRESSION_CCITTFAX4)) /* Assure that allocation computations do not overflow. TIFFroundup and TIFFSafeMultiply return zero on integer overflow */ if (*TFax3CodecState)(unsafe.Pointer(dsp)).Fruns != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, (*TFax3CodecState)(unsafe.Pointer(dsp)).Fruns) (*TFax3CodecState)(unsafe.Pointer(dsp)).Fruns = libc.UintptrFromInt32(0) } if rowpixels+uint32(1) < libc.Uint32FromUint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromInt32(32)-libc.Int32FromInt32(1)) { v1 = (rowpixels + libc.Uint32FromInt32(1) + (libc.Uint32FromInt32(libc.Int32FromInt32(32)) - libc.Uint32FromInt32(1))) / libc.Uint32FromInt32(libc.Int32FromInt32(32)) } else { v1 = 0 } (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns = v1 * libc.Uint32FromInt32(libc.Int32FromInt32(32)) if needsRefLine != 0 { if libc.Bool(libc.Uint32FromInt32(libc.Int32FromInt32(2)) != libc.Uint32FromInt32(0)) && (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns*libc.Uint32FromInt32(libc.Int32FromInt32(2))/libc.Uint32FromInt32(libc.Int32FromInt32(2)) == (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns { v2 = (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns * libc.Uint32FromInt32(libc.Int32FromInt32(2)) } else { v2 = libc.Uint32FromInt32(0) } (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns = v2 } if v4 = (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns == uint32(0); !v4 { if libc.Bool(libc.Uint32FromInt32(libc.Int32FromInt32(2)) != libc.Uint32FromInt32(0)) && (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns*libc.Uint32FromInt32(libc.Int32FromInt32(2))/libc.Uint32FromInt32(libc.Int32FromInt32(2)) == (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns { v3 = (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns * libc.Uint32FromInt32(libc.Int32FromInt32(2)) } else { v3 = libc.Uint32FromInt32(0) } } if v4 || v3 == uint32(0) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+37256, libc.VaList(bp+8, rowpixels)) return 0 } if libc.Bool(libc.Uint32FromInt32(libc.Int32FromInt32(2)) != libc.Uint32FromInt32(0)) && (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns*libc.Uint32FromInt32(libc.Int32FromInt32(2))/libc.Uint32FromInt32(libc.Int32FromInt32(2)) == (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns { v5 = (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns * libc.Uint32FromInt32(libc.Int32FromInt32(2)) } else { v5 = libc.Uint32FromInt32(0) } (*TFax3CodecState)(unsafe.Pointer(dsp)).Fruns = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint32(v5), int32(4), __ccgo_ts+37299) if (*TFax3CodecState)(unsafe.Pointer(dsp)).Fruns == libc.UintptrFromInt32(0) { return 0 } if libc.Bool(libc.Uint32FromInt32(libc.Int32FromInt32(2)) != libc.Uint32FromInt32(0)) && (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns*libc.Uint32FromInt32(libc.Int32FromInt32(2))/libc.Uint32FromInt32(libc.Int32FromInt32(2)) == (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns { v6 = (*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns * libc.Uint32FromInt32(libc.Int32FromInt32(2)) } else { v6 = libc.Uint32FromInt32(0) } libc.Xmemset(tls, (*TFax3CodecState)(unsafe.Pointer(dsp)).Fruns, 0, v6*uint32(4)) (*TFax3CodecState)(unsafe.Pointer(dsp)).Fcurruns = (*TFax3CodecState)(unsafe.Pointer(dsp)).Fruns if needsRefLine != 0 { (*TFax3CodecState)(unsafe.Pointer(dsp)).Frefruns = (*TFax3CodecState)(unsafe.Pointer(dsp)).Fruns + uintptr((*TFax3CodecState)(unsafe.Pointer(dsp)).Fnruns)*4 } else { (*TFax3CodecState)(unsafe.Pointer(dsp)).Frefruns = libc.UintptrFromInt32(0) } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == int32(COMPRESSION_CCITTFAX3) && (*TFax3CodecState)(unsafe.Pointer(dsp)).Fb.Fgroupoptions&uint32(GROUP3OPT_2DENCODING1) != 0 { /* NB: default is 1D routine */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_Fax3Decode2D) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_Fax3Decode2D) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_Fax3Decode2D) } if needsRefLine != 0 { /* 2d encoding */ esp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* * 2d encoding requires a scanline * buffer for the ``reference line''; the * scanline against which delta encoding * is referenced. The reference line must * be initialized to be ``white'' (done elsewhere). */ if (*TFax3CodecState)(unsafe.Pointer(esp)).Frefline != libc.UintptrFromInt32(0) { X_TIFFfreeExt(tls, tif, (*TFax3CodecState)(unsafe.Pointer(esp)).Frefline) } (*TFax3CodecState)(unsafe.Pointer(esp)).Frefline = X_TIFFmallocExt(tls, tif, rowbytes) if (*TFax3CodecState)(unsafe.Pointer(esp)).Frefline == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module40)), __ccgo_ts+37324, 0) return 0 } } else { /* 1d encoding */ (*TFax3CodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Frefline = libc.UintptrFromInt32(0) } return int32(1) } var _module40 = [15]uint8{'F', 'a', 'x', '3', 'S', 'e', 't', 'u', 'p', 'S', 't', 'a', 't', 'e'} /* * CCITT Group 3 FAX Encoding. */ var __msbmask = [9]int32{ 1: int32(0x01), 2: int32(0x03), 3: int32(0x07), 4: int32(0x0f), 5: int32(0x1f), 6: int32(0x3f), 7: int32(0x7f), 8: int32(0xff), } // C documentation // // /* // * Write a variable-length bit-value to // * the output stream. Values are // * assumed to be at most 16 bits. // */ func _Fax3PutBits(tls *libc.TLS, tif uintptr, bits uint32, length uint32) (r int32) { var bit uint32 var data int32 var sp, v1, v2, v3, v4 uintptr _, _, _, _, _, _, _ = bit, data, sp, v1, v2, v3, v4 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data bit = libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fbit) data = libc.Int32FromUint32((*TFax3CodecState)(unsafe.Pointer(sp)).Fdata) for length > bit { data = int32(uint32(data) | bits>>(length-bit)) length -= bit if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v2 = tif + 828 v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ *(*Tuint8_t)(unsafe.Pointer(v1)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } data = int32(uint32(data) | bits&libc.Uint32FromInt32(__msbmask[length])<<(bit-length)) bit -= length if bit == uint32(0) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v4 = tif + 828 v3 = *(*uintptr)(unsafe.Pointer(v4)) *(*uintptr)(unsafe.Pointer(v4))++ *(*Tuint8_t)(unsafe.Pointer(v3)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = libc.Uint32FromInt32(data) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = libc.Int32FromUint32(bit) return int32(1) } /* * Write a code to the output stream. */ // C documentation // // /* // * Write the sequence of codes that describes // * the specified span of zero's or one's. The // * appropriate table that holds the make-up and // * terminating codes is supplied. // */ func _putspan(tls *libc.TLS, tif uintptr, span Tint32_t, tab uintptr) (r int32) { var bit, code, length uint32 var data int32 var sp, te, te1, v1, v10, v11, v12, v2, v3, v4, v5, v6, v7, v8, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bit, code, data, length, sp, te, te1, v1, v10, v11, v12, v2, v3, v4, v5, v6, v7, v8, v9 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data bit = libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fbit) data = libc.Int32FromUint32((*TFax3CodecState)(unsafe.Pointer(sp)).Fdata) for span >= int32(2624) { te = tab + uintptr(libc.Int32FromInt32(63)+libc.Int32FromInt32(2560)>>libc.Int32FromInt32(6))*6 code = uint32((*Ttableentry)(unsafe.Pointer(te)).Fcode) length = uint32((*Ttableentry)(unsafe.Pointer(te)).Flength) for length > bit { data = int32(uint32(data) | code>>(length-bit)) length -= bit if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v2 = tif + 828 v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ *(*Tuint8_t)(unsafe.Pointer(v1)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } data = int32(uint32(data) | code&libc.Uint32FromInt32(__msbmask[length])<<(bit-length)) bit -= length if bit == uint32(0) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v4 = tif + 828 v3 = *(*uintptr)(unsafe.Pointer(v4)) *(*uintptr)(unsafe.Pointer(v4))++ *(*Tuint8_t)(unsafe.Pointer(v3)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } span -= int32((*Ttableentry)(unsafe.Pointer(te)).Frunlen) } if span >= int32(64) { te1 = tab + uintptr(int32(63)+span>>libc.Int32FromInt32(6))*6 code = uint32((*Ttableentry)(unsafe.Pointer(te1)).Fcode) length = uint32((*Ttableentry)(unsafe.Pointer(te1)).Flength) for length > bit { data = int32(uint32(data) | code>>(length-bit)) length -= bit if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v6 = tif + 828 v5 = *(*uintptr)(unsafe.Pointer(v6)) *(*uintptr)(unsafe.Pointer(v6))++ *(*Tuint8_t)(unsafe.Pointer(v5)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } data = int32(uint32(data) | code&libc.Uint32FromInt32(__msbmask[length])<<(bit-length)) bit -= length if bit == uint32(0) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v8 = tif + 828 v7 = *(*uintptr)(unsafe.Pointer(v8)) *(*uintptr)(unsafe.Pointer(v8))++ *(*Tuint8_t)(unsafe.Pointer(v7)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } span -= int32((*Ttableentry)(unsafe.Pointer(te1)).Frunlen) } code = uint32((*(*Ttableentry)(unsafe.Pointer(tab + uintptr(span)*6))).Fcode) length = uint32((*(*Ttableentry)(unsafe.Pointer(tab + uintptr(span)*6))).Flength) for length > bit { data = int32(uint32(data) | code>>(length-bit)) length -= bit if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v10 = tif + 828 v9 = *(*uintptr)(unsafe.Pointer(v10)) *(*uintptr)(unsafe.Pointer(v10))++ *(*Tuint8_t)(unsafe.Pointer(v9)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } data = int32(uint32(data) | code&libc.Uint32FromInt32(__msbmask[length])<<(bit-length)) bit -= length if bit == uint32(0) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v12 = tif + 828 v11 = *(*uintptr)(unsafe.Pointer(v12)) *(*uintptr)(unsafe.Pointer(v12))++ *(*Tuint8_t)(unsafe.Pointer(v11)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = libc.Uint32FromInt32(data) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = libc.Int32FromUint32(bit) return int32(1) } // C documentation // // /* // * Write an EOL code to the output stream. The zero-fill // * logic for byte-aligning encoded scanlines is handled // * here. We also handle writing the tag bit for the next // * scanline when doing 2d encoding. // */ func _Fax3PutEOL(tls *libc.TLS, tif uintptr) (r int32) { var align, data int32 var bit, code, length, tparm uint32 var sp, v1, v2, v3, v4, v5, v6, v7, v8 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = align, bit, code, data, length, sp, tparm, v1, v2, v3, v4, v5, v6, v7, v8 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data bit = libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fbit) data = libc.Int32FromUint32((*TFax3CodecState)(unsafe.Pointer(sp)).Fdata) if (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fgroupoptions&uint32(GROUP3OPT_FILLBITS1) != 0 { /* * Force bit alignment so EOL will terminate on * a byte boundary. That is, force the bit alignment * to 16-12 = 4 before putting out the EOL code. */ align = libc.Int32FromInt32(8) - libc.Int32FromInt32(4) if align != (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit { if align > (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit { align = (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit + (int32(8) - align) } else { align = (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit - align } tparm = libc.Uint32FromInt32(align) for tparm > bit { data |= 0 >> (tparm - bit) tparm -= bit if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v2 = tif + 828 v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ *(*Tuint8_t)(unsafe.Pointer(v1)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } data |= 0 & __msbmask[tparm] << (bit - tparm) bit -= tparm if bit == uint32(0) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v4 = tif + 828 v3 = *(*uintptr)(unsafe.Pointer(v4)) *(*uintptr)(unsafe.Pointer(v4))++ *(*Tuint8_t)(unsafe.Pointer(v3)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } } } code = uint32(EOL) length = uint32(12) if (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fgroupoptions&uint32(GROUP3OPT_2DENCODING1) != 0 { code = code< bit { data = int32(uint32(data) | code>>(length-bit)) length -= bit if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v6 = tif + 828 v5 = *(*uintptr)(unsafe.Pointer(v6)) *(*uintptr)(unsafe.Pointer(v6))++ *(*Tuint8_t)(unsafe.Pointer(v5)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } data = int32(uint32(data) | code&libc.Uint32FromInt32(__msbmask[length])<<(bit-length)) bit -= length if bit == uint32(0) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v8 = tif + 828 v7 = *(*uintptr)(unsafe.Pointer(v8)) *(*uintptr)(unsafe.Pointer(v8))++ *(*Tuint8_t)(unsafe.Pointer(v7)) = libc.Uint8FromInt32(data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ data = 0 bit = libc.Uint32FromInt32(8) } (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = libc.Uint32FromInt32(data) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = libc.Int32FromUint32(bit) return int32(1) } // C documentation // // /* // * Reset encoding state at the start of a strip. // */ func _Fax3PreEncode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { var res float32 var sp uintptr var v1, v2 int32 _, _, _, _ = res, sp, v1, v2 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = int32(8) (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = uint32(0) (*TFax3CodecState)(unsafe.Pointer(sp)).Ftag = int32(G3_1D) /* * This is necessary for Group 4; otherwise it isn't * needed because the first scanline of each strip ends * up being copied into the refline. */ if (*TFax3CodecState)(unsafe.Pointer(sp)).Frefline != 0 { X_TIFFmemset(tls, (*TFax3CodecState)(unsafe.Pointer(sp)).Frefline, 0x00, (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes) } if (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fgroupoptions&uint32(GROUP3OPT_2DENCODING1) != 0 { res = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_yresolution /* * The CCITT spec says that when doing 2d encoding, you * should only do it on K consecutive scanlines, where K * depends on the resolution of the image being encoded * (2 for <= 200 lpi, 4 for > 200 lpi). Since the directory * code initializes td_yresolution to 0, this code will * select a K of 2 unless the YResolution tag is set * appropriately. (Note also that we fudge a little here * and use 150 lpi to avoid problems with units conversion.) */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_resolutionunit) == int32(RESUNIT_CENTIMETER) { res *= libc.Float32FromFloat32(2.54) } /* convert to inches */ if res > libc.Float32FromInt32(150) { v1 = int32(4) } else { v1 = int32(2) } (*TFax3CodecState)(unsafe.Pointer(sp)).Fmaxk = v1 (*TFax3CodecState)(unsafe.Pointer(sp)).Fk = (*TFax3CodecState)(unsafe.Pointer(sp)).Fmaxk - int32(1) } else { v2 = libc.Int32FromInt32(0) (*TFax3CodecState)(unsafe.Pointer(sp)).Fmaxk = v2 (*TFax3CodecState)(unsafe.Pointer(sp)).Fk = v2 } (*TFax3CodecState)(unsafe.Pointer(sp)).Fline = 0 return int32(1) } var _zeroruns = [256]uint8{ 0: uint8(8), 1: uint8(7), 2: uint8(6), 3: uint8(6), 4: uint8(5), 5: uint8(5), 6: uint8(5), 7: uint8(5), 8: uint8(4), 9: uint8(4), 10: uint8(4), 11: uint8(4), 12: uint8(4), 13: uint8(4), 14: uint8(4), 15: uint8(4), 16: uint8(3), 17: uint8(3), 18: uint8(3), 19: uint8(3), 20: uint8(3), 21: uint8(3), 22: uint8(3), 23: uint8(3), 24: uint8(3), 25: uint8(3), 26: uint8(3), 27: uint8(3), 28: uint8(3), 29: uint8(3), 30: uint8(3), 31: uint8(3), 32: uint8(2), 33: uint8(2), 34: uint8(2), 35: uint8(2), 36: uint8(2), 37: uint8(2), 38: uint8(2), 39: uint8(2), 40: uint8(2), 41: uint8(2), 42: uint8(2), 43: uint8(2), 44: uint8(2), 45: uint8(2), 46: uint8(2), 47: uint8(2), 48: uint8(2), 49: uint8(2), 50: uint8(2), 51: uint8(2), 52: uint8(2), 53: uint8(2), 54: uint8(2), 55: uint8(2), 56: uint8(2), 57: uint8(2), 58: uint8(2), 59: uint8(2), 60: uint8(2), 61: uint8(2), 62: uint8(2), 63: uint8(2), 64: uint8(1), 65: uint8(1), 66: uint8(1), 67: uint8(1), 68: uint8(1), 69: uint8(1), 70: uint8(1), 71: uint8(1), 72: uint8(1), 73: uint8(1), 74: uint8(1), 75: uint8(1), 76: uint8(1), 77: uint8(1), 78: uint8(1), 79: uint8(1), 80: uint8(1), 81: uint8(1), 82: uint8(1), 83: uint8(1), 84: uint8(1), 85: uint8(1), 86: uint8(1), 87: uint8(1), 88: uint8(1), 89: uint8(1), 90: uint8(1), 91: uint8(1), 92: uint8(1), 93: uint8(1), 94: uint8(1), 95: uint8(1), 96: uint8(1), 97: uint8(1), 98: uint8(1), 99: uint8(1), 100: uint8(1), 101: uint8(1), 102: uint8(1), 103: uint8(1), 104: uint8(1), 105: uint8(1), 106: uint8(1), 107: uint8(1), 108: uint8(1), 109: uint8(1), 110: uint8(1), 111: uint8(1), 112: uint8(1), 113: uint8(1), 114: uint8(1), 115: uint8(1), 116: uint8(1), 117: uint8(1), 118: uint8(1), 119: uint8(1), 120: uint8(1), 121: uint8(1), 122: uint8(1), 123: uint8(1), 124: uint8(1), 125: uint8(1), 126: uint8(1), 127: uint8(1), } var _oneruns = [256]uint8{ 128: uint8(1), 129: uint8(1), 130: uint8(1), 131: uint8(1), 132: uint8(1), 133: uint8(1), 134: uint8(1), 135: uint8(1), 136: uint8(1), 137: uint8(1), 138: uint8(1), 139: uint8(1), 140: uint8(1), 141: uint8(1), 142: uint8(1), 143: uint8(1), 144: uint8(1), 145: uint8(1), 146: uint8(1), 147: uint8(1), 148: uint8(1), 149: uint8(1), 150: uint8(1), 151: uint8(1), 152: uint8(1), 153: uint8(1), 154: uint8(1), 155: uint8(1), 156: uint8(1), 157: uint8(1), 158: uint8(1), 159: uint8(1), 160: uint8(1), 161: uint8(1), 162: uint8(1), 163: uint8(1), 164: uint8(1), 165: uint8(1), 166: uint8(1), 167: uint8(1), 168: uint8(1), 169: uint8(1), 170: uint8(1), 171: uint8(1), 172: uint8(1), 173: uint8(1), 174: uint8(1), 175: uint8(1), 176: uint8(1), 177: uint8(1), 178: uint8(1), 179: uint8(1), 180: uint8(1), 181: uint8(1), 182: uint8(1), 183: uint8(1), 184: uint8(1), 185: uint8(1), 186: uint8(1), 187: uint8(1), 188: uint8(1), 189: uint8(1), 190: uint8(1), 191: uint8(1), 192: uint8(2), 193: uint8(2), 194: uint8(2), 195: uint8(2), 196: uint8(2), 197: uint8(2), 198: uint8(2), 199: uint8(2), 200: uint8(2), 201: uint8(2), 202: uint8(2), 203: uint8(2), 204: uint8(2), 205: uint8(2), 206: uint8(2), 207: uint8(2), 208: uint8(2), 209: uint8(2), 210: uint8(2), 211: uint8(2), 212: uint8(2), 213: uint8(2), 214: uint8(2), 215: uint8(2), 216: uint8(2), 217: uint8(2), 218: uint8(2), 219: uint8(2), 220: uint8(2), 221: uint8(2), 222: uint8(2), 223: uint8(2), 224: uint8(3), 225: uint8(3), 226: uint8(3), 227: uint8(3), 228: uint8(3), 229: uint8(3), 230: uint8(3), 231: uint8(3), 232: uint8(3), 233: uint8(3), 234: uint8(3), 235: uint8(3), 236: uint8(3), 237: uint8(3), 238: uint8(3), 239: uint8(3), 240: uint8(4), 241: uint8(4), 242: uint8(4), 243: uint8(4), 244: uint8(4), 245: uint8(4), 246: uint8(4), 247: uint8(4), 248: uint8(5), 249: uint8(5), 250: uint8(5), 251: uint8(5), 252: uint8(6), 253: uint8(6), 254: uint8(7), 255: uint8(8), } // C documentation // // /* // * Find a span of ones or zeros using the supplied // * table. The ``base'' of the bit string is supplied // * along with the start+end bit indices. // */ func _find0span(tls *libc.TLS, bp uintptr, bs Tint32_t, be Tint32_t) (r Tint32_t) { var bits, n, span, v1 Tint32_t var lp uintptr var v2 bool var v3 int32 _, _, _, _, _, _, _ = bits, lp, n, span, v1, v2, v3 bits = be - bs bp += uintptr(bs >> int32(3)) /* * Check partial byte on lhs. */ if v2 = bits > 0; v2 { v1 = bs & libc.Int32FromInt32(7) n = v1 } if v2 && v1 != 0 { span = libc.Int32FromUint8(_zeroruns[libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))< int32(8)-n { /* table value too generous */ span = int32(8) - n } if span > bits { /* constrain span to bit range */ span = bits } if n+span < int32(8) { /* doesn't extend to edge of byte */ return span } bits -= span bp++ } else { span = 0 } if bits >= libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(2)*libc.Int32FromInt32(8))*libc.Uint32FromInt64(8)) { /* * Align to int64_t boundary and check int64_t words. */ for !(uint32(bp)&(libc.Uint32FromInt64(8)-libc.Uint32FromInt32(1)) == libc.Uint32FromInt32(0)) { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != 0x00 { return span + libc.Int32FromUint8(_zeroruns[*(*uint8)(unsafe.Pointer(bp))]) } span += int32(8) bits -= int32(8) bp++ } lp = bp for bits >= libc.Int32FromUint32(libc.Uint32FromInt32(8)*libc.Uint32FromInt64(8)) && 0 == *(*Tint64_t)(unsafe.Pointer(lp)) { span = Tint32_t(uint32(span) + libc.Uint32FromInt32(8)*libc.Uint32FromInt64(8)) bits = Tint32_t(uint32(bits) - libc.Uint32FromInt32(8)*libc.Uint32FromInt64(8)) lp += 8 } bp = lp } /* * Scan full bytes for all 0's. */ for bits >= int32(8) { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != 0x00 { /* end of run */ return span + libc.Int32FromUint8(_zeroruns[*(*uint8)(unsafe.Pointer(bp))]) } span += int32(8) bits -= int32(8) bp++ } /* * Check partial byte on rhs. */ if bits > 0 { n = libc.Int32FromUint8(_zeroruns[*(*uint8)(unsafe.Pointer(bp))]) if n > bits { v3 = bits } else { v3 = n } span += v3 } return span } func _find1span(tls *libc.TLS, bp uintptr, bs Tint32_t, be Tint32_t) (r Tint32_t) { var bits, n, span, v1 Tint32_t var lp uintptr var v2 bool var v3 int32 _, _, _, _, _, _, _ = bits, lp, n, span, v1, v2, v3 bits = be - bs bp += uintptr(bs >> int32(3)) /* * Check partial byte on lhs. */ if v2 = bits > 0; v2 { v1 = bs & libc.Int32FromInt32(7) n = v1 } if v2 && v1 != 0 { span = libc.Int32FromUint8(_oneruns[libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))< int32(8)-n { /* table value too generous */ span = int32(8) - n } if span > bits { /* constrain span to bit range */ span = bits } if n+span < int32(8) { /* doesn't extend to edge of byte */ return span } bits -= span bp++ } else { span = 0 } if bits >= libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(2)*libc.Int32FromInt32(8))*libc.Uint32FromInt64(8)) { /* * Align to int64_t boundary and check int64_t words. */ for !(uint32(bp)&(libc.Uint32FromInt64(8)-libc.Uint32FromInt32(1)) == libc.Uint32FromInt32(0)) { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32(0xff) { return span + libc.Int32FromUint8(_oneruns[*(*uint8)(unsafe.Pointer(bp))]) } span += int32(8) bits -= int32(8) bp++ } lp = bp for bits >= libc.Int32FromUint32(libc.Uint32FromInt32(8)*libc.Uint32FromInt64(8)) && ^libc.Uint64FromInt32(0) == libc.Uint64FromInt64(*(*Tint64_t)(unsafe.Pointer(lp))) { span = Tint32_t(uint32(span) + libc.Uint32FromInt32(8)*libc.Uint32FromInt64(8)) bits = Tint32_t(uint32(bits) - libc.Uint32FromInt32(8)*libc.Uint32FromInt64(8)) lp += 8 } bp = lp } /* * Scan full bytes for all 1's. */ for bits >= int32(8) { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32(0xff) { /* end of run */ return span + libc.Int32FromUint8(_oneruns[*(*uint8)(unsafe.Pointer(bp))]) } span += int32(8) bits -= int32(8) bp++ } /* * Check partial byte on rhs. */ if bits > 0 { n = libc.Int32FromUint8(_oneruns[*(*uint8)(unsafe.Pointer(bp))]) if n > bits { v3 = bits } else { v3 = n } span += v3 } return span } /* * Return the offset of the next bit in the range * [bs..be] that is different from the specified * color. The end, be, is returned if no such bit * exists. */ /* * Like finddiff, but also check the starting bit * against the end in case start > end. */ // C documentation // // /* // * 1d-encode a row of pixels. The encoding is // * a sequence of all-white or all-black spans // * of pixels encoded with Huffman codes. // */ func _Fax3Encode1DRow(tls *libc.TLS, tif uintptr, bp uintptr, bits Tuint32_t) (r int32) { var bs Tuint32_t var sp, v2, v3, v4, v5 uintptr var span Tint32_t _, _, _, _, _, _, _ = bs, sp, span, v2, v3, v4, v5 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data bs = uint32(0) for { span = _find0span(tls, bp, libc.Int32FromUint32(bs), libc.Int32FromUint32(bits)) /* white span */ if !(_putspan(tls, tif, span, uintptr(unsafe.Pointer(&XTIFFFaxWhiteCodes))) != 0) { return 0 } bs += libc.Uint32FromInt32(span) if bs >= bits { break } span = _find1span(tls, bp, libc.Int32FromUint32(bs), libc.Int32FromUint32(bits)) /* black span */ if !(_putspan(tls, tif, span, uintptr(unsafe.Pointer(&XTIFFFaxBlackCodes))) != 0) { return 0 } bs += libc.Uint32FromInt32(span) if bs >= bits { break } goto _1 _1: } if (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fmode&(libc.Int32FromInt32(FAXMODE_BYTEALIGN1)|libc.Int32FromInt32(FAXMODE_WORDALIGN1)) != 0 { if (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit != int32(8) { /* byte-align */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v3 = tif + 828 v2 = *(*uintptr)(unsafe.Pointer(v3)) *(*uintptr)(unsafe.Pointer(v3))++ *(*Tuint8_t)(unsafe.Pointer(v2)) = uint8((*TFax3CodecState)(unsafe.Pointer(sp)).Fdata) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = uint32(0) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = libc.Int32FromInt32(8) } if (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fmode&int32(FAXMODE_WORDALIGN1) != 0 && !(uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp)&(libc.Uint32FromInt64(2)-libc.Uint32FromInt32(1)) == libc.Uint32FromInt32(0)) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v5 = tif + 828 v4 = *(*uintptr)(unsafe.Pointer(v5)) *(*uintptr)(unsafe.Pointer(v5))++ *(*Tuint8_t)(unsafe.Pointer(v4)) = uint8((*TFax3CodecState)(unsafe.Pointer(sp)).Fdata) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = uint32(0) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = libc.Int32FromInt32(8) } } return int32(1) } var _horizcode = Ttableentry{ Flength: uint16(3), Fcode: uint16(0x1), } /* 001 */ var _passcode = Ttableentry{ Flength: uint16(4), Fcode: uint16(0x1), } /* 0001 */ var _vcodes = [7]Ttableentry{ 0: { Flength: uint16(7), Fcode: uint16(0x03), }, 1: { Flength: uint16(6), Fcode: uint16(0x03), }, 2: { Flength: uint16(3), Fcode: uint16(0x03), }, 3: { Flength: uint16(1), Fcode: uint16(0x1), }, 4: { Flength: uint16(3), Fcode: uint16(0x2), }, 5: { Flength: uint16(6), Fcode: uint16(0x02), }, 6: { Flength: uint16(7), Fcode: uint16(0x02), }, } // C documentation // // /* // * 2d-encode a row of pixels. Consult the CCITT // * documentation for the algorithm. // */ func _Fax3Encode2DRow(tls *libc.TLS, tif uintptr, bp uintptr, rp uintptr, bits Tuint32_t) (r int32) { var a0, a1, a2, b1, b2 Tuint32_t var d Tint32_t var v1, v10, v11, v12, v2, v5, v6, v7, v9 int32 var v4, v8 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a0, a1, a2, b1, b2, d, v1, v10, v11, v12, v2, v4, v5, v6, v7, v8, v9 a0 = uint32(0) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + uintptr(libc.Int32FromInt32(0)>>libc.Int32FromInt32(3)))))>>(libc.Int32FromInt32(7)-libc.Int32FromInt32(0)&libc.Int32FromInt32(7))&int32(1) != 0 { v1 = 0 } else { v1 = 0 + _find0span(tls, bp, 0, libc.Int32FromUint32(bits)) } a1 = libc.Uint32FromInt32(v1) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(rp + uintptr(libc.Int32FromInt32(0)>>libc.Int32FromInt32(3)))))>>(libc.Int32FromInt32(7)-libc.Int32FromInt32(0)&libc.Int32FromInt32(7))&int32(1) != 0 { v2 = 0 } else { v2 = 0 + _find0span(tls, rp, 0, libc.Int32FromUint32(bits)) } b1 = libc.Uint32FromInt32(v2) for { if b1 < bits { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(rp + uintptr(b1>>int32(3)))))>>(uint32(7)-b1&uint32(7))&int32(1) != 0 { v5 = _find1span(tls, rp, libc.Int32FromUint32(b1), libc.Int32FromUint32(bits)) } else { v5 = _find0span(tls, rp, libc.Int32FromUint32(b1), libc.Int32FromUint32(bits)) } v4 = b1 + libc.Uint32FromInt32(v5) } else { v4 = bits } b2 = v4 if b2 >= a1 { if b1 >= a1 && b1-a1 <= uint32(3) { v6 = libc.Int32FromUint32(b1 - a1) } else { if b1 < a1 && a1-b1 <= uint32(3) { v7 = -libc.Int32FromUint32(a1 - b1) } else { v7 = int32(0x7FFFFFFF) } v6 = v7 } /* Naive computation triggers * -fsanitize=undefined,unsigned-integer-overflow */ /* although it is correct unless the difference between both is < 31 * bit */ /* int32_t d = b1 - a1; */ d = v6 if !(-int32(3) <= d && d <= int32(3)) { /* horizontal mode */ if a1 < bits { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + uintptr(a1>>int32(3)))))>>(uint32(7)-a1&uint32(7))&int32(1) != 0 { v9 = _find1span(tls, bp, libc.Int32FromUint32(a1), libc.Int32FromUint32(bits)) } else { v9 = _find0span(tls, bp, libc.Int32FromUint32(a1), libc.Int32FromUint32(bits)) } v8 = a1 + libc.Uint32FromInt32(v9) } else { v8 = bits } a2 = v8 if !(_Fax3PutBits(tls, tif, uint32((*Ttableentry)(unsafe.Pointer(uintptr(unsafe.Pointer(&_horizcode)))).Fcode), uint32((*Ttableentry)(unsafe.Pointer(uintptr(unsafe.Pointer(&_horizcode)))).Flength)) != 0) { return 0 } if a0+a1 == uint32(0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + uintptr(a0>>int32(3)))))>>(uint32(7)-a0&uint32(7))&int32(1) == 0 { if !(_putspan(tls, tif, libc.Int32FromUint32(a1-a0), uintptr(unsafe.Pointer(&XTIFFFaxWhiteCodes))) != 0) { return 0 } if !(_putspan(tls, tif, libc.Int32FromUint32(a2-a1), uintptr(unsafe.Pointer(&XTIFFFaxBlackCodes))) != 0) { return 0 } } else { if !(_putspan(tls, tif, libc.Int32FromUint32(a1-a0), uintptr(unsafe.Pointer(&XTIFFFaxBlackCodes))) != 0) { return 0 } if !(_putspan(tls, tif, libc.Int32FromUint32(a2-a1), uintptr(unsafe.Pointer(&XTIFFFaxWhiteCodes))) != 0) { return 0 } } a0 = a2 } else { /* vertical mode */ if !(_Fax3PutBits(tls, tif, uint32((*Ttableentry)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vcodes))+uintptr(d+int32(3))*6)).Fcode), uint32((*Ttableentry)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vcodes))+uintptr(d+int32(3))*6)).Flength)) != 0) { return 0 } a0 = a1 } } else { /* pass mode */ if !(_Fax3PutBits(tls, tif, uint32((*Ttableentry)(unsafe.Pointer(uintptr(unsafe.Pointer(&_passcode)))).Fcode), uint32((*Ttableentry)(unsafe.Pointer(uintptr(unsafe.Pointer(&_passcode)))).Flength)) != 0) { return 0 } a0 = b2 } if a0 >= bits { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + uintptr(a0>>int32(3)))))>>(uint32(7)-a0&uint32(7))&int32(1) != 0 { v10 = _find1span(tls, bp, libc.Int32FromUint32(a0), libc.Int32FromUint32(bits)) } else { v10 = _find0span(tls, bp, libc.Int32FromUint32(a0), libc.Int32FromUint32(bits)) } a1 = a0 + libc.Uint32FromInt32(v10) if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + uintptr(a0>>int32(3)))))>>(libc.Uint32FromInt32(7)-a0&libc.Uint32FromInt32(7))&libc.Int32FromInt32(1) != 0) { v11 = _find1span(tls, rp, libc.Int32FromUint32(a0), libc.Int32FromUint32(bits)) } else { v11 = _find0span(tls, rp, libc.Int32FromUint32(a0), libc.Int32FromUint32(bits)) } b1 = a0 + libc.Uint32FromInt32(v11) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + uintptr(a0>>int32(3)))))>>(uint32(7)-a0&uint32(7))&int32(1) != 0 { v12 = _find1span(tls, rp, libc.Int32FromUint32(b1), libc.Int32FromUint32(bits)) } else { v12 = _find0span(tls, rp, libc.Int32FromUint32(b1), libc.Int32FromUint32(bits)) } b1 = b1 + libc.Uint32FromInt32(v12) goto _3 _3: } return int32(1) } // C documentation // // /* // * Encode a buffer of pixels. // */ func _Fax3Encode(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s if cc%(*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module41)), __ccgo_ts+37362, 0) return 0 } for cc > 0 { if (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fmode&int32(FAXMODE_NOEOL1) == 0 { if !(_Fax3PutEOL(tls, tif) != 0) { return 0 } } if (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fgroupoptions&uint32(GROUP3OPT_2DENCODING1) != 0 { if (*TFax3CodecState)(unsafe.Pointer(sp)).Ftag == int32(G3_1D) { if !(_Fax3Encode1DRow(tls, tif, bp, (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowpixels) != 0) { return 0 } (*TFax3CodecState)(unsafe.Pointer(sp)).Ftag = int32(G3_2D) } else { if !(_Fax3Encode2DRow(tls, tif, bp, (*TFax3CodecState)(unsafe.Pointer(sp)).Frefline, (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowpixels) != 0) { return 0 } (*TFax3CodecState)(unsafe.Pointer(sp)).Fk-- } if (*TFax3CodecState)(unsafe.Pointer(sp)).Fk == 0 { (*TFax3CodecState)(unsafe.Pointer(sp)).Ftag = int32(G3_1D) (*TFax3CodecState)(unsafe.Pointer(sp)).Fk = (*TFax3CodecState)(unsafe.Pointer(sp)).Fmaxk - int32(1) } else { X_TIFFmemcpy(tls, (*TFax3CodecState)(unsafe.Pointer(sp)).Frefline, bp, (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes) } } else { if !(_Fax3Encode1DRow(tls, tif, bp, (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowpixels) != 0) { return 0 } } bp += uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes) cc -= (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes } return int32(1) } var _module41 = [11]uint8{'F', 'a', 'x', '3', 'E', 'n', 'c', 'o', 'd', 'e'} func _Fax3PostEncode(tls *libc.TLS, tif uintptr) (r int32) { var sp, v1, v2 uintptr _, _, _ = sp, v1, v2 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data if (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit != int32(8) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v2 = tif + 828 v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ *(*Tuint8_t)(unsafe.Pointer(v1)) = uint8((*TFax3CodecState)(unsafe.Pointer(sp)).Fdata) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = uint32(0) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = libc.Int32FromInt32(8) } return int32(1) } func __Fax3Close(tls *libc.TLS, tif uintptr) (r int32) { var code, length uint32 var i int32 var sp, v2, v3 uintptr _, _, _, _, _, _ = code, i, length, sp, v2, v3 if (*TFax3BaseState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fmode&int32(FAXMODE_NORTC1) == 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp != 0 { sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data code = uint32(EOL) length = uint32(12) if (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fgroupoptions&uint32(GROUP3OPT_2DENCODING1) != 0 { code = code<= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v3 = tif + 828 v2 = *(*uintptr)(unsafe.Pointer(v3)) *(*uintptr)(unsafe.Pointer(v3))++ *(*Tuint8_t)(unsafe.Pointer(v2)) = uint8((*TFax3CodecState)(unsafe.Pointer(sp)).Fdata) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = uint32(0) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = libc.Int32FromInt32(8) } return int32(1) } func _Fax3Close(tls *libc.TLS, tif uintptr) { __Fax3Close(tls, tif) } func _Fax3Cleanup(tls *libc.TLS, tif uintptr) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield = (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fvgetparent (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield = (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fvsetparent (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir = (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fprintdir if (*TFax3CodecState)(unsafe.Pointer(sp)).Fruns != 0 { X_TIFFfreeExt(tls, tif, (*TFax3CodecState)(unsafe.Pointer(sp)).Fruns) } if (*TFax3CodecState)(unsafe.Pointer(sp)).Frefline != 0 { X_TIFFfreeExt(tls, tif, (*TFax3CodecState)(unsafe.Pointer(sp)).Frefline) } X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_data = libc.UintptrFromInt32(0) X_TIFFSetDefaultCompressionState(tls, tif) } var _faxFields = [5]TTIFFField{ 0: { Ffield_tag: uint32(TIFFTAG_FAXMODE), Fset_field_type: int32(TIFF_SETGET_INT), Ffield_name: __ccgo_ts + 37401, }, 1: { Ffield_tag: uint32(TIFFTAG_FAXFILLFUNC), Fset_field_type: int32(TIFF_SETGET_OTHER), Ffield_name: __ccgo_ts + 37409, }, 2: { Ffield_tag: uint32(TIFFTAG_BADFAXLINES), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Fget_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: libc.Uint16FromInt32(libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(0)), Ffield_oktochange: uint8(TRUE), Ffield_name: __ccgo_ts + 37421, }, 3: { Ffield_tag: uint32(TIFFTAG_CLEANFAXDATA), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Fget_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: libc.Uint16FromInt32(libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(1)), Ffield_oktochange: uint8(TRUE), Ffield_name: __ccgo_ts + 37433, }, 4: { Ffield_tag: uint32(TIFFTAG_CONSECUTIVEBADFAXLINES), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Fget_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: libc.Uint16FromInt32(libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(2)), Ffield_oktochange: uint8(TRUE), Ffield_name: __ccgo_ts + 37446, }, } var _fax3Fields = [1]TTIFFField{ 0: { Ffield_tag: uint32(TIFFTAG_GROUP3OPTIONS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Fget_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: libc.Uint16FromInt32(libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(7)), Ffield_name: __ccgo_ts + 37469, }, } var _fax4Fields = [1]TTIFFField{ 0: { Ffield_tag: uint32(TIFFTAG_GROUP4OPTIONS), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_LONG), Fset_field_type: int32(TIFF_SETGET_UINT32), Fget_field_type: int32(TIFF_SETGET_UINT32), Ffield_bit: libc.Uint16FromInt32(libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(7)), Ffield_name: __ccgo_ts + 37483, }, } func _Fax3VSetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { var fip, sp, v1 uintptr _, _, _ = fip, sp, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data switch tag { case uint32(TIFFTAG_FAXMODE): (*TFax3BaseState)(unsafe.Pointer(sp)).Fmode = libc.VaInt32(&ap) return int32(1) /* NB: pseudo tag */ case uint32(TIFFTAG_FAXFILLFUNC): (*TFax3CodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Ffill = libc.VaUintptr(&ap) return int32(1) /* NB: pseudo tag */ case uint32(TIFFTAG_GROUP3OPTIONS): /* XXX: avoid reading options if compression mismatches. */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_CCITTFAX3) { (*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions = libc.VaUint32(&ap) } case uint32(TIFFTAG_GROUP4OPTIONS): /* XXX: avoid reading options if compression mismatches. */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_CCITTFAX4) { (*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions = libc.VaUint32(&ap) } case uint32(TIFFTAG_BADFAXLINES): (*TFax3BaseState)(unsafe.Pointer(sp)).Fbadfaxlines = libc.VaUint32(&ap) case uint32(TIFFTAG_CLEANFAXDATA): (*TFax3BaseState)(unsafe.Pointer(sp)).Fcleanfaxdata = libc.Uint16FromInt32(libc.VaInt32(&ap)) case uint32(TIFFTAG_CONSECUTIVEBADFAXLINES): (*TFax3BaseState)(unsafe.Pointer(sp)).Fbadfaxrun = libc.VaUint32(&ap) default: return (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFax3BaseState)(unsafe.Pointer(sp)).Fvsetparent})))(tls, tif, tag, ap) } v1 = XTIFFFieldWithTag(tls, tif, tag) fip = v1 if v1 != libc.UintptrFromInt32(0) { *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit)/int32(32))*4)) |= libc.Uint32FromInt32(1) << (libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) & libc.Int32FromInt32(0x1f)) } else { return 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00008) return int32(1) } func _Fax3VGetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data switch tag { case uint32(TIFFTAG_FAXMODE): *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TFax3BaseState)(unsafe.Pointer(sp)).Fmode case uint32(TIFFTAG_FAXFILLFUNC): *(*TTIFFFaxFillFunc)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TFax3CodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Ffill case uint32(TIFFTAG_GROUP3OPTIONS): fallthrough case uint32(TIFFTAG_GROUP4OPTIONS): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions case uint32(TIFFTAG_BADFAXLINES): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TFax3BaseState)(unsafe.Pointer(sp)).Fbadfaxlines case uint32(TIFFTAG_CLEANFAXDATA): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TFax3BaseState)(unsafe.Pointer(sp)).Fcleanfaxdata case uint32(TIFFTAG_CONSECUTIVEBADFAXLINES): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TFax3BaseState)(unsafe.Pointer(sp)).Fbadfaxrun default: return (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFax3BaseState)(unsafe.Pointer(sp)).Fvgetparent})))(tls, tif, tag, ap) } return int32(1) } func _Fax3PrintDir(tls *libc.TLS, tif uintptr, fd uintptr, flags int32) { bp := tls.Alloc(32) defer tls.Free(32) var sep, sp uintptr _, _ = sep, sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = flags if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(7))/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(7))&libc.Int32FromInt32(0x1f))) != 0 { sep = __ccgo_ts + 37497 if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_compression) == int32(COMPRESSION_CCITTFAX4) { libc.Xfprintf(tls, fd, __ccgo_ts+37499, 0) if (*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions&uint32(GROUP4OPT_UNCOMPRESSED1) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+37518, libc.VaList(bp+8, sep)) } } else { libc.Xfprintf(tls, fd, __ccgo_ts+37538, 0) if (*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions&uint32(GROUP3OPT_2DENCODING1) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+37557, libc.VaList(bp+8, sep)) sep = __ccgo_ts + 37572 } if (*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions&uint32(GROUP3OPT_FILLBITS1) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+37574, libc.VaList(bp+8, sep)) sep = __ccgo_ts + 37572 } if (*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions&uint32(GROUP3OPT_UNCOMPRESSED1) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+37518, libc.VaList(bp+8, sep)) } } libc.Xfprintf(tls, fd, __ccgo_ts+37588, libc.VaList(bp+8, (*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions, (*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions)) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(1))/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(1))&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+37602, 0) switch libc.Int32FromUint16((*TFax3BaseState)(unsafe.Pointer(sp)).Fcleanfaxdata) { case CLEANFAXDATA_CLEAN: libc.Xfprintf(tls, fd, __ccgo_ts+37614, 0) case int32(CLEANFAXDATA_REGENERATED): libc.Xfprintf(tls, fd, __ccgo_ts+37621, 0) case int32(CLEANFAXDATA_UNCLEAN): libc.Xfprintf(tls, fd, __ccgo_ts+37643, 0) break } libc.Xfprintf(tls, fd, __ccgo_ts+37588, libc.VaList(bp+8, libc.Int32FromUint16((*TFax3BaseState)(unsafe.Pointer(sp)).Fcleanfaxdata), libc.Int32FromUint16((*TFax3BaseState)(unsafe.Pointer(sp)).Fcleanfaxdata))) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(0))/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+37663, libc.VaList(bp+8, (*TFax3BaseState)(unsafe.Pointer(sp)).Fbadfaxlines)) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(2))/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(2))&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+37684, libc.VaList(bp+8, (*TFax3BaseState)(unsafe.Pointer(sp)).Fbadfaxrun)) } if (*TFax3BaseState)(unsafe.Pointer(sp)).Fprintdir != 0 { (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TFax3BaseState)(unsafe.Pointer(sp)).Fprintdir})))(tls, tif, fd, flags) } } func _InitCCITTFax3(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var sp uintptr _ = sp /* * Merge codec-specific tag information. */ if !(X_TIFFMergeFields(tls, tif, uintptr(unsafe.Pointer(&_faxFields)), libc.Uint32FromInt64(180)/libc.Uint32FromInt64(36)) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+37717, __ccgo_ts+37731, 0) return 0 } /* * Allocate state block so tag methods have storage to record values. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_data = X_TIFFmallocExt(tls, tif, int32(104)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_data == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module42)), __ccgo_ts+37783, 0) return 0 } X_TIFFmemset(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_data, 0, int32(104)) sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data (*TFax3BaseState)(unsafe.Pointer(sp)).Frw_mode = (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode /* * Override parent get/set field methods. */ (*TFax3BaseState)(unsafe.Pointer(sp)).Fvgetparent = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield = __ccgo_fp(_Fax3VGetField) /* hook for codec tags */ (*TFax3BaseState)(unsafe.Pointer(sp)).Fvsetparent = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield = __ccgo_fp(_Fax3VSetField) /* hook for codec tags */ (*TFax3BaseState)(unsafe.Pointer(sp)).Fprintdir = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir = __ccgo_fp(_Fax3PrintDir) /* hook for codec tags */ (*TFax3BaseState)(unsafe.Pointer(sp)).Fgroupoptions = uint32(0) if (*TFax3BaseState)(unsafe.Pointer(sp)).Frw_mode == O_RDONLY5 { /* FIXME: improve for in place update */ *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00100) } /* decoder does bit reversal */ (*TFax3CodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fruns = libc.UintptrFromInt32(0) XTIFFSetField(tls, tif, uint32(TIFFTAG_FAXFILLFUNC), libc.VaList(bp+8, __ccgo_fp(X_TIFFFax3fillruns))) (*TFax3CodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Frefline = libc.UintptrFromInt32(0) /* * Install codec methods. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_fixuptags = __ccgo_fp(_Fax3FixupTags) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode = __ccgo_fp(_Fax3SetupState) (*TTIFF)(unsafe.Pointer(tif)).Ftif_predecode = __ccgo_fp(_Fax3PreDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_Fax3Decode1D) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_Fax3Decode1D) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_Fax3Decode1D) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode = __ccgo_fp(_Fax3SetupState) (*TTIFF)(unsafe.Pointer(tif)).Ftif_preencode = __ccgo_fp(_Fax3PreEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode = __ccgo_fp(_Fax3PostEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_Fax3Encode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_Fax3Encode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_Fax3Encode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_close = __ccgo_fp(_Fax3Close) (*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup = __ccgo_fp(_Fax3Cleanup) return int32(1) } var _module42 = [14]uint8{'I', 'n', 'i', 't', 'C', 'C', 'I', 'T', 'T', 'F', 'a', 'x', '3'} func XTIFFInitCCITTFax3(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) _ = scheme if _InitCCITTFax3(tls, tif) != 0 { /* * Merge codec-specific tag information. */ if !(X_TIFFMergeFields(tls, tif, uintptr(unsafe.Pointer(&_fax3Fields)), libc.Uint32FromInt64(36)/libc.Uint32FromInt64(36)) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+37808, __ccgo_ts+37826, 0) return 0 } /* * The default format is Class/F-style w/o RTC. */ return XTIFFSetField(tls, tif, uint32(TIFFTAG_FAXMODE), libc.VaList(bp+8, int32(FAXMODE_NORTC1))) } else { return int32(01) } return r } /* * CCITT Group 4 (T.6) Facsimile-compatible * Compression Scheme Support. */ // C documentation // // /* // * Decode the requested amount of G4-encoded data. // */ func _Fax4Decode(tls *libc.TLS, tif uintptr, buf uintptr, occ Ttmsize_t, s Tuint16_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var BitAcc Tuint32_t var BitsAvail, EOLcnt, RunLength, a0, b1, lastx, start, v150 int32 var TabEnt, bitmap, cp, ep, pa, pb, sp, thisrun, x, v1, v10, v100, v102, v104, v105, v106, v107, v108, v109, v111, v112, v113, v115, v116, v118, v119, v121, v122, v124, v125, v126, v128, v129, v131, v132, v133, v135, v136, v138, v139, v141, v142, v144, v145, v147, v148, v149, v2, v20, v22, v24, v25, v27, v28, v37, v39, v41, v42, v51, v53, v55, v56, v65, v67, v69, v70, v79, v8, v81, v82, v84, v86, v88, v89, v91, v92, v94, v96, v97, v99 uintptr var v101, v103, v110, v114, v117, v120, v123, v127, v130, v134, v137, v140, v143, v146, v21, v23, v38, v52, v66, v80, v83, v85, v87, v9, v90, v93, v95, v98 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = BitAcc, BitsAvail, EOLcnt, RunLength, TabEnt, a0, b1, bitmap, cp, ep, lastx, pa, pb, sp, start, thisrun, x, v1, v10, v100, v101, v102, v103, v104, v105, v106, v107, v108, v109, v110, v111, v112, v113, v114, v115, v116, v117, v118, v119, v120, v121, v122, v123, v124, v125, v126, v127, v128, v129, v130, v131, v132, v133, v134, v135, v136, v137, v138, v139, v140, v141, v142, v143, v144, v145, v146, v147, v148, v149, v150, v2, v20, v21, v22, v23, v24, v25, v27, v28, v37, v38, v39, v41, v42, v51, v52, v53, v55, v56, v65, v66, v67, v69, v70, v79, v8, v80, v81, v82, v83, v84, v85, v86, v87, v88, v89, v9, v90, v91, v92, v93, v94, v95, v96, v97, v98, v99 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* reference element */ lastx = libc.Int32FromUint32((*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowpixels) /* # EOL codes recognized */ bitmap = (*TFax3CodecState)(unsafe.Pointer(sp)).Fbitmap _ = s if occ%(*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37000, 0) return -int32(1) } if (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount >= int32(EOF_REACHED_COUNT_THRESHOLD) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37036, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount)) return -int32(1) } BitAcc = (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata BitsAvail = (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit EOLcnt = (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt cp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp ep = cp + uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) start = (*TFax3CodecState)(unsafe.Pointer(sp)).Fline for occ > 0 { a0 = 0 RunLength = 0 v1 = (*TFax3CodecState)(unsafe.Pointer(sp)).Fcurruns thisrun = v1 pa = v1 pb = (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns v2 = pb pb += 4 b1 = libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(v2))) _5: ; _7: ; if !(a0 < lastx) { goto _6 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v8 = __ccgo_ts + 22575 } else { v8 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v9 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v9 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v8, v9)) return -int32(1) } if BitsAvail < int32(7) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(7) /* pad with zeros */ } else { v10 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v10)))))) << BitsAvail BitsAvail += int32(8) } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxMainTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_Pass): goto _11 case int32(S_Horiz): goto _12 case int32(S_V0): goto _13 case int32(S_VR): goto _14 case int32(S_VL): goto _15 case int32(S_Ext): goto _16 case int32(S_EOL): goto _17 default: goto _18 } goto _19 _11: ; if pa != thisrun { for b1 <= a0 && b1 < lastx { if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v20 = __ccgo_ts + 22575 } else { v20 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v21 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v21 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v20, v21)) return -int32(1) } b1 = int32(uint32(b1) + (*(*Tuint32_t)(unsafe.Pointer(pb)) + *(*Tuint32_t)(unsafe.Pointer(pb + 1*4)))) pb += uintptr(2) * 4 } } if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v22 = __ccgo_ts + 22575 } else { v22 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v23 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v23 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v22, v23)) return -int32(1) } v24 = pb pb += 4 b1 = int32(uint32(b1) + *(*Tuint32_t)(unsafe.Pointer(v24))) RunLength += b1 - a0 a0 = b1 v25 = pb pb += 4 b1 = int32(uint32(b1) + *(*Tuint32_t)(unsafe.Pointer(v25))) goto _19 _12: ; if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { for { if BitsAvail < int32(13) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(13) /* pad with zeros */ } else { v27 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v27)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(13) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(13) /* pad with zeros */ } else { v28 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v28)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxBlackTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_TermB): goto _29 case int32(S_MakeUp): goto _30 case int32(S_MakeUpB): goto _31 default: goto _32 } goto _33 _29: ; _36: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v37 = __ccgo_ts + 22575 } else { v37 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v38 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v38 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v37, v38)) return -int32(1) } v39 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v39)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _35 _35: ; if 0 != 0 { goto _36 } goto _34 _34: ; goto doneWhite2da _31: ; _30: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _33 _32: ; goto badBlack2d _33: ; goto _26 _26: } goto doneWhite2da doneWhite2da: ; for { if BitsAvail < int32(12) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(12) /* pad with zeros */ } else { v41 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v41)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(12) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(12) /* pad with zeros */ } else { v42 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v42)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxWhiteTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_TermW): goto _43 case int32(S_MakeUp): goto _44 case int32(S_MakeUpW): goto _45 default: goto _46 } goto _47 _43: ; _50: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v51 = __ccgo_ts + 22575 } else { v51 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v52 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v52 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v51, v52)) return -int32(1) } v53 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v53)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _49 _49: ; if 0 != 0 { goto _50 } goto _48 _48: ; goto doneBlack2da _45: ; _44: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _47 _46: ; goto badWhite2d _47: ; goto _40 _40: } goto doneBlack2da doneBlack2da: } else { for { if BitsAvail < int32(12) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(12) /* pad with zeros */ } else { v55 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v55)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(12) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(12) /* pad with zeros */ } else { v56 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v56)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxWhiteTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_TermW): goto _57 case int32(S_MakeUp): goto _58 case int32(S_MakeUpW): goto _59 default: goto _60 } goto _61 _57: ; _64: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v65 = __ccgo_ts + 22575 } else { v65 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v66 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v66 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v65, v66)) return -int32(1) } v67 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v67)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _63 _63: ; if 0 != 0 { goto _64 } goto _62 _62: ; goto doneWhite2db _59: ; _58: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _61 _60: ; goto badWhite2d _61: ; goto _54 _54: } goto doneWhite2db doneWhite2db: ; for { if BitsAvail < int32(13) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(13) /* pad with zeros */ } else { v69 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v69)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(13) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(13) /* pad with zeros */ } else { v70 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v70)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxBlackTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_TermB): goto _71 case int32(S_MakeUp): goto _72 case int32(S_MakeUpB): goto _73 default: goto _74 } goto _75 _71: ; _78: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v79 = __ccgo_ts + 22575 } else { v79 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v80 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v80 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v79, v80)) return -int32(1) } v81 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v81)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _77 _77: ; if 0 != 0 { goto _78 } goto _76 _76: ; goto doneBlack2db _73: ; _72: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _75 _74: ; goto badBlack2d _75: ; goto _68 _68: } goto doneBlack2db doneBlack2db: } if pa != thisrun { for b1 <= a0 && b1 < lastx { if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v82 = __ccgo_ts + 22575 } else { v82 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v83 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v83 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v82, v83)) return -int32(1) } b1 = int32(uint32(b1) + (*(*Tuint32_t)(unsafe.Pointer(pb)) + *(*Tuint32_t)(unsafe.Pointer(pb + 1*4)))) pb += uintptr(2) * 4 } } goto _19 _13: ; if pa != thisrun { for b1 <= a0 && b1 < lastx { if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v84 = __ccgo_ts + 22575 } else { v84 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v85 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v85 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v84, v85)) return -int32(1) } b1 = int32(uint32(b1) + (*(*Tuint32_t)(unsafe.Pointer(pb)) + *(*Tuint32_t)(unsafe.Pointer(pb + 1*4)))) pb += uintptr(2) * 4 } } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v86 = __ccgo_ts + 22575 } else { v86 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v87 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v87 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v86, v87)) return -int32(1) } v88 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v88)) = libc.Uint32FromInt32(RunLength + (b1 - a0)) a0 += b1 - a0 RunLength = 0 if pb >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v89 = __ccgo_ts + 22575 } else { v89 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v90 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v90 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v89, v90)) return -int32(1) } v91 = pb pb += 4 b1 = int32(uint32(b1) + *(*Tuint32_t)(unsafe.Pointer(v91))) goto _19 _14: ; if pa != thisrun { for b1 <= a0 && b1 < lastx { if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v92 = __ccgo_ts + 22575 } else { v92 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v93 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v93 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v92, v93)) return -int32(1) } b1 = int32(uint32(b1) + (*(*Tuint32_t)(unsafe.Pointer(pb)) + *(*Tuint32_t)(unsafe.Pointer(pb + 1*4)))) pb += uintptr(2) * 4 } } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v94 = __ccgo_ts + 22575 } else { v94 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v95 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v95 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v94, v95)) return -int32(1) } v96 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v96)) = libc.Uint32FromInt32(RunLength) + (libc.Uint32FromInt32(b1-a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) a0 = int32(uint32(a0) + (libc.Uint32FromInt32(b1-a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam)) RunLength = 0 if pb >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v97 = __ccgo_ts + 22575 } else { v97 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v98 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v98 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v97, v98)) return -int32(1) } v99 = pb pb += 4 b1 = int32(uint32(b1) + *(*Tuint32_t)(unsafe.Pointer(v99))) goto _19 _15: ; if pa != thisrun { for b1 <= a0 && b1 < lastx { if pb+uintptr(1)*4 >= (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v100 = __ccgo_ts + 22575 } else { v100 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v101 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v101 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v100, v101)) return -int32(1) } b1 = int32(uint32(b1) + (*(*Tuint32_t)(unsafe.Pointer(pb)) + *(*Tuint32_t)(unsafe.Pointer(pb + 1*4)))) pb += uintptr(2) * 4 } } if b1 < libc.Int32FromUint32(libc.Uint32FromInt32(a0)+(*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) { _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module43)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto eol2d } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v102 = __ccgo_ts + 22575 } else { v102 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v103 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v103 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v102, v103)) return -int32(1) } v104 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v104)) = libc.Uint32FromInt32(RunLength) + (libc.Uint32FromInt32(b1-a0) - (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) a0 = int32(uint32(a0) + (libc.Uint32FromInt32(b1-a0) - (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam)) RunLength = 0 pb -= 4 v105 = pb b1 = int32(uint32(b1) - *(*Tuint32_t)(unsafe.Pointer(v105))) goto _19 _16: ; v106 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v106)) = libc.Uint32FromInt32(lastx - a0) _Fax3Extension(tls, uintptr(unsafe.Pointer(&_module43)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto eol2d _17: ; v107 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v107)) = libc.Uint32FromInt32(lastx - a0) if BitsAvail < int32(4) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(4) /* pad with zeros */ } else { v108 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v108)))))) << BitsAvail BitsAvail += int32(8) } } if BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(4)) EOLcnt = int32(1) goto eol2d _18: ; goto badMain2d badMain2d: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module43)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto eol2d goto badBlack2d badBlack2d: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module43)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto eol2d goto badWhite2d badWhite2d: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module43)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto eol2d goto eof2d eof2d: ; _Fax3PrematureEOF(tls, uintptr(unsafe.Pointer(&_module43)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount++ if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v109 = __ccgo_ts + 22575 } else { v109 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v110 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v110 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v109, v110)) return -int32(1) } v111 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v111)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module43)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v112 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v112))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v113 = __ccgo_ts + 22575 } else { v113 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v114 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v114 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v113, v114)) return -int32(1) } v115 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v115)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v116 = __ccgo_ts + 22575 } else { v116 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v117 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v117 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v116, v117)) return -int32(1) } v118 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v118)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v119 = __ccgo_ts + 22575 } else { v119 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v120 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v120 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v119, v120)) return -int32(1) } v121 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v121)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v122 = __ccgo_ts + 22575 } else { v122 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v123 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v123 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v122, v123)) return -int32(1) } v124 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v124)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } goto EOFG4 _19: ; goto _7 _6: ; if RunLength != 0 { if RunLength+a0 < lastx { if BitsAvail < int32(1) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof2d } BitsAvail = int32(1) /* pad with zeros */ } else { v125 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v125)))))) << BitsAvail BitsAvail += int32(8) } } if !(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v126 = __ccgo_ts + 22575 } else { v126 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v127 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v127 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v126, v127)) return -int32(1) } v128 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v128)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } goto eol2d eol2d: ; if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v129 = __ccgo_ts + 22575 } else { v129 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v130 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v130 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v129, v130)) return -int32(1) } v131 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v131)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module43)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v132 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v132))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v133 = __ccgo_ts + 22575 } else { v133 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v134 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v134 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v133, v134)) return -int32(1) } v135 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v135)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v136 = __ccgo_ts + 22575 } else { v136 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v137 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v137 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v136, v137)) return -int32(1) } v138 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v138)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v139 = __ccgo_ts + 22575 } else { v139 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v140 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v140 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v139, v140)) return -int32(1) } v141 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v141)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v142 = __ccgo_ts + 22575 } else { v142 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v143 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v143 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v142, v143)) return -int32(1) } v144 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v144)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } goto _4 _4: ; if 0 != 0 { goto _5 } goto _3 _3: ; if EOLcnt != 0 { goto EOFG4 } if (lastx+int32(7))>>int32(3) > occ { /* check for buffer overrun */ XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37873, libc.VaList(bp+8, occ, lastx)) return -int32(1) } (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tuint32_t))(unsafe.Pointer(&struct{ uintptr }{(*TFax3CodecState)(unsafe.Pointer(sp)).Ffill})))(tls, buf, thisrun, pa, libc.Uint32FromInt32(lastx)) if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v145 = __ccgo_ts + 22575 } else { v145 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v146 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v146 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v145, v146)) return -int32(1) } v147 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v147)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 /* imaginary change for reference */ x = (*TFax3CodecState)(unsafe.Pointer(sp)).Fcurruns (*TFax3CodecState)(unsafe.Pointer(sp)).Fcurruns = (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns (*TFax3CodecState)(unsafe.Pointer(sp)).Frefruns = x buf += uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes) occ -= (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes (*TFax3CodecState)(unsafe.Pointer(sp)).Fline++ continue goto EOFG4 EOFG4: ; if BitsAvail < int32(13) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto BADG4 } BitsAvail = int32(13) /* pad with zeros */ } else { v148 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v148)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(13) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(13) /* pad with zeros */ } else { v149 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v149)))))) << BitsAvail BitsAvail += int32(8) } } } } goto BADG4 BADG4: ; BitsAvail -= int32(13) BitAcc >>= libc.Uint32FromInt32(libc.Int32FromInt32(13)) if (lastx+int32(7))>>int32(3) > occ { /* check for buffer overrun */ XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module43)), __ccgo_ts+37873, libc.VaList(bp+8, occ, lastx)) return -int32(1) } (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tuint32_t))(unsafe.Pointer(&struct{ uintptr }{(*TFax3CodecState)(unsafe.Pointer(sp)).Ffill})))(tls, buf, thisrun, pa, libc.Uint32FromInt32(lastx)) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = BitsAvail (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = BitAcc (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt = EOLcnt *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= int32(cp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = cp if (*TFax3CodecState)(unsafe.Pointer(sp)).Fline != start { v150 = int32(1) } else { v150 = -int32(1) } return v150 /* don't error on badly-terminated strips */ } (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = BitsAvail (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = BitAcc (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt = EOLcnt *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= int32(cp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = cp return int32(1) } var _module43 = [11]uint8{'F', 'a', 'x', '4', 'D', 'e', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Encode the requested amount of data. // */ func _Fax4Encode(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s if cc%(*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module44)), __ccgo_ts+37362, 0) return 0 } for cc > 0 { if !(_Fax3Encode2DRow(tls, tif, bp, (*TFax3CodecState)(unsafe.Pointer(sp)).Frefline, (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowpixels) != 0) { return 0 } X_TIFFmemcpy(tls, (*TFax3CodecState)(unsafe.Pointer(sp)).Frefline, bp, (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes) bp += uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes) cc -= (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes } return int32(1) } var _module44 = [11]uint8{'F', 'a', 'x', '4', 'E', 'n', 'c', 'o', 'd', 'e'} func _Fax4PostEncode(tls *libc.TLS, tif uintptr) (r int32) { var sp, v1, v2 uintptr _, _, _ = sp, v1, v2 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* terminate strip w/ EOFB */ _Fax3PutBits(tls, tif, uint32(EOL), uint32(12)) _Fax3PutBits(tls, tif, uint32(EOL), uint32(12)) if (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit != int32(8) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } } v2 = tif + 828 v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ *(*Tuint8_t)(unsafe.Pointer(v1)) = uint8((*TFax3CodecState)(unsafe.Pointer(sp)).Fdata) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc++ (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = uint32(0) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = libc.Int32FromInt32(8) } return int32(1) } func XTIFFInitCCITTFax4(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) _ = scheme if _InitCCITTFax3(tls, tif) != 0 { /* reuse G3 support */ /* * Merge codec-specific tag information. */ if !(X_TIFFMergeFields(tls, tif, uintptr(unsafe.Pointer(&_fax4Fields)), libc.Uint32FromInt64(36)/libc.Uint32FromInt64(36)) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+37934, __ccgo_ts+37952, 0) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_Fax4Decode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_Fax4Decode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_Fax4Decode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_Fax4Encode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_Fax4Encode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_Fax4Encode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode = __ccgo_fp(_Fax4PostEncode) /* * Suppress RTC at the end of each strip. */ return XTIFFSetField(tls, tif, uint32(TIFFTAG_FAXMODE), libc.VaList(bp+8, int32(FAXMODE_NORTC1))) } else { return 0 } return r } /* * CCITT Group 3 1-D Modified Huffman RLE Compression Support. * (Compression algorithms 2 and 32771) */ // C documentation // // /* // * Decode the requested amount of RLE-encoded data. // */ func _Fax3DecodeRLE(tls *libc.TLS, tif uintptr, buf uintptr, occ Ttmsize_t, s Tuint16_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var BitAcc Tuint32_t var BitsAvail, EOLcnt, RunLength, a0, lastx, mode, n, n1 int32 var TabEnt, bitmap, cp, ep, pa, sp, thisrun, v14, v16, v18, v19, v29, v3, v31, v32, v34, v35, v36, v38, v39, v4, v41, v42, v44, v45, v47, v48, v50, v51, v52, v54, v55, v57, v58, v60, v61, v63 uintptr var v15, v30, v33, v37, v40, v43, v46, v49, v53, v56, v59, v62 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = BitAcc, BitsAvail, EOLcnt, RunLength, TabEnt, a0, bitmap, cp, ep, lastx, mode, n, n1, pa, sp, thisrun, v14, v15, v16, v18, v19, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* reference element */ lastx = libc.Int32FromUint32((*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowpixels) /* # EOL codes recognized */ bitmap = (*TFax3CodecState)(unsafe.Pointer(sp)).Fbitmap mode = (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Fmode _ = s if occ%(*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37000, 0) return -int32(1) } BitAcc = (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata BitsAvail = (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit EOLcnt = (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt cp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp ep = cp + uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) thisrun = (*TFax3CodecState)(unsafe.Pointer(sp)).Fcurruns for occ > 0 { a0 = 0 RunLength = 0 pa = thisrun for { for { if BitsAvail < int32(12) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof1d } BitsAvail = int32(12) /* pad with zeros */ } else { v3 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v3)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(12) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(12) /* pad with zeros */ } else { v4 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v4)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxWhiteTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_EOL): goto _5 case int32(S_TermW): goto _6 case int32(S_MakeUp): goto _7 case int32(S_MakeUpW): goto _8 default: goto _9 } goto _10 _5: ; EOLcnt = int32(1) goto done1d _6: ; _13: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v14 = __ccgo_ts + 22575 } else { v14 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v15 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v15 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v14, v15)) return -int32(1) } v16 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v16)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _12 _12: ; if 0 != 0 { goto _13 } goto _11 _11: ; goto doneWhite1d _8: ; _7: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _10 _9: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module45)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto done1d _10: ; goto _2 _2: } goto doneWhite1d doneWhite1d: ; if a0 >= lastx { goto done1d } for { if BitsAvail < int32(13) { if cp >= ep { if BitsAvail == 0 { /* no valid bits */ goto eof1d } BitsAvail = int32(13) /* pad with zeros */ } else { v18 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v18)))))) << BitsAvail BitsAvail += int32(8) if BitsAvail < int32(13) { if cp >= ep { /* NB: we know BitsAvail is non-zero here */ BitsAvail = int32(13) /* pad with zeros */ } else { v19 = cp cp++ BitAcc |= uint32(*(*uint8)(unsafe.Pointer(bitmap + uintptr(*(*uint8)(unsafe.Pointer(v19)))))) << BitsAvail BitsAvail += int32(8) } } } } TabEnt = uintptr(unsafe.Pointer(&XTIFFFaxBlackTable)) + uintptr(BitAcc&libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= uint32((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FWidth) switch libc.Int32FromUint8((*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FState) { case int32(S_EOL): goto _20 case int32(S_TermB): goto _21 case int32(S_MakeUp): goto _22 case int32(S_MakeUpB): goto _23 default: goto _24 } goto _25 _20: ; EOLcnt = int32(1) goto done1d _21: ; _28: ; if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v29 = __ccgo_ts + 22575 } else { v29 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v30 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v30 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v29, v30)) return -int32(1) } v31 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v31)) = libc.Uint32FromInt32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = 0 goto _27 _27: ; if 0 != 0 { goto _28 } goto _26 _26: ; goto doneBlack1d _23: ; _22: ; a0 = int32(uint32(a0) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) RunLength = int32(uint32(RunLength) + (*TTIFFFaxTabEnt)(unsafe.Pointer(TabEnt)).FParam) goto _25 _24: ; _Fax3Unexpected(tls, uintptr(unsafe.Pointer(&_module45)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) goto done1d _25: ; goto _17 _17: } goto doneBlack1d doneBlack1d: ; if a0 >= lastx { goto done1d } if *(*Tuint32_t)(unsafe.Pointer(pa - libc.UintptrFromInt32(1)*4)) == uint32(0) && *(*Tuint32_t)(unsafe.Pointer(pa - libc.UintptrFromInt32(2)*4)) == uint32(0) { pa -= uintptr(2) * 4 } goto _1 _1: } goto eof1d eof1d: ; _Fax3PrematureEOF(tls, uintptr(unsafe.Pointer(&_module45)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0)) (*TFax3CodecState)(unsafe.Pointer(sp)).FeofReachedCount++ if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v32 = __ccgo_ts + 22575 } else { v32 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v33 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v33 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v32, v33)) return -int32(1) } v34 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v34)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module45)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v35 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v35))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v36 = __ccgo_ts + 22575 } else { v36 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v37 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v37 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v36, v37)) return -int32(1) } v38 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v38)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v39 = __ccgo_ts + 22575 } else { v39 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v40 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v40 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v39, v40)) return -int32(1) } v41 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v41)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v42 = __ccgo_ts + 22575 } else { v42 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v43 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v43 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v42, v43)) return -int32(1) } v44 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v44)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v45 = __ccgo_ts + 22575 } else { v45 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v46 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v46 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v45, v46)) return -int32(1) } v47 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v47)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } goto EOFRLE goto done1d done1d: ; if RunLength != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v48 = __ccgo_ts + 22575 } else { v48 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v49 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v49 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v48, v49)) return -int32(1) } v50 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v50)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if a0 != lastx { _Fax3BadLength(tls, uintptr(unsafe.Pointer(&_module45)), tif, libc.Uint32FromInt32((*TFax3CodecState)(unsafe.Pointer(sp)).Fline), libc.Uint32FromInt32(a0), libc.Uint32FromInt32(lastx)) for a0 > lastx && pa > thisrun { pa -= 4 v51 = pa a0 = int32(uint32(a0) - *(*Tuint32_t)(unsafe.Pointer(v51))) } if a0 < lastx { if a0 < 0 { a0 = 0 } if (int32(pa)-int32(thisrun))/4&int32(1) != 0 { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v52 = __ccgo_ts + 22575 } else { v52 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v53 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v53 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v52, v53)) return -int32(1) } v54 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v54)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v55 = __ccgo_ts + 22575 } else { v55 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v56 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v56 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v55, v56)) return -int32(1) } v57 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v57)) = libc.Uint32FromInt32(RunLength + (lastx - a0)) a0 += lastx - a0 RunLength = 0 } else { if a0 > lastx { if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v58 = __ccgo_ts + 22575 } else { v58 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v59 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v59 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v58, v59)) return -int32(1) } v60 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v60)) = libc.Uint32FromInt32(RunLength + lastx) a0 += lastx RunLength = 0 if pa >= thisrun+uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fnruns)*4 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v61 = __ccgo_ts + 22575 } else { v61 = __ccgo_ts + 22569 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v62 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v62 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module45)), __ccgo_ts+37100, libc.VaList(bp+8, (*TFax3CodecState)(unsafe.Pointer(sp)).Fline, v61, v62)) return -int32(1) } v63 = pa pa += 4 *(*Tuint32_t)(unsafe.Pointer(v63)) = libc.Uint32FromInt32(RunLength + 0) a0 += 0 RunLength = 0 } } } (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tuint32_t))(unsafe.Pointer(&struct{ uintptr }{(*TFax3CodecState)(unsafe.Pointer(sp)).Ffill})))(tls, buf, thisrun, pa, libc.Uint32FromInt32(lastx)) /* * Cleanup at the end of the row. */ if mode&int32(FAXMODE_BYTEALIGN1) != 0 { n = BitsAvail - BitsAvail & ^libc.Int32FromInt32(7) BitsAvail -= n BitAcc >>= libc.Uint32FromInt32(n) } else { if mode&int32(FAXMODE_WORDALIGN1) != 0 { n1 = BitsAvail - BitsAvail & ^libc.Int32FromInt32(15) BitsAvail -= n1 BitAcc >>= libc.Uint32FromInt32(n1) if BitsAvail == 0 && !(uint32(cp)&(libc.Uint32FromInt64(2)-libc.Uint32FromInt32(1)) == libc.Uint32FromInt32(0)) { cp++ } } } buf += uintptr((*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes) occ -= (*TFax3CodecState)(unsafe.Pointer(sp)).Fb.Frowbytes (*TFax3CodecState)(unsafe.Pointer(sp)).Fline++ continue goto EOFRLE EOFRLE: ; /* premature EOF */ (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Tuint32_t))(unsafe.Pointer(&struct{ uintptr }{(*TFax3CodecState)(unsafe.Pointer(sp)).Ffill})))(tls, buf, thisrun, pa, libc.Uint32FromInt32(lastx)) (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = BitsAvail (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = BitAcc (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt = EOLcnt *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= int32(cp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = cp return -int32(1) } (*TFax3CodecState)(unsafe.Pointer(sp)).Fbit = BitsAvail (*TFax3CodecState)(unsafe.Pointer(sp)).Fdata = BitAcc (*TFax3CodecState)(unsafe.Pointer(sp)).FEOLcnt = EOLcnt *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= int32(cp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = cp return int32(1) } var _module45 = [14]uint8{'F', 'a', 'x', '3', 'D', 'e', 'c', 'o', 'd', 'e', 'R', 'L', 'E'} func XTIFFInitCCITTRLE(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) _ = scheme if _InitCCITTFax3(tls, tif) != 0 { /* reuse G3 support */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_Fax3DecodeRLE) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_Fax3DecodeRLE) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_Fax3DecodeRLE) /* * Suppress RTC+EOLs when encoding and byte-align data. */ return XTIFFSetField(tls, tif, uint32(TIFFTAG_FAXMODE), libc.VaList(bp+8, libc.Int32FromInt32(FAXMODE_NORTC1)|libc.Int32FromInt32(FAXMODE_NOEOL1)|libc.Int32FromInt32(FAXMODE_BYTEALIGN1))) } else { return 0 } return r } func XTIFFInitCCITTRLEW(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) _ = scheme if _InitCCITTFax3(tls, tif) != 0 { /* reuse G3 support */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_Fax3DecodeRLE) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_Fax3DecodeRLE) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_Fax3DecodeRLE) /* * Suppress RTC+EOLs when encoding and word-align data. */ return XTIFFSetField(tls, tif, uint32(TIFFTAG_FAXMODE), libc.VaList(bp+8, libc.Int32FromInt32(FAXMODE_NORTC1)|libc.Int32FromInt32(FAXMODE_NOEOL1)|libc.Int32FromInt32(FAXMODE_WORDALIGN1))) } else { return 0 } return r } const FAXMODE_BYTEALIGN2 = 0x0004 const FAXMODE_NOEOL2 = 0x0002 const FAXMODE_NORTC2 = 0x0001 const FAXMODE_WORDALIGN2 = 0x0008 const GROUP3OPT_2DENCODING2 = 0x1 const GROUP3OPT_FILLBITS2 = 0x4 const GROUP3OPT_UNCOMPRESSED2 = 0x2 const GROUP4OPT_UNCOMPRESSED2 = 0x2 const PACKAGE_NAME9 = "tifftcl" const PACKAGE_TARNAME9 = "tifftcl" const O_RDWR3 = 2 const TIFF_ANY4 = "TIFF_NOTYPE" const TIFF_BEENWRITING3 = 64 const TIFF_DIRTYSTRIP3 = 2097152 const TIFF_ISTILED4 = 0x00400 const TIFF_NOBITREV4 = 0x00100 const TIFF_POSTENCODE5 = 4096 func XTIFFFlush(tls *libc.TLS, tif uintptr) (r int32) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY5 { return int32(1) } if !(XTIFFFlushData(tls, tif) != 0) { return 0 } /* In update (r+) mode we try to detect the case where only the strip/tile map has been altered, and we try to rewrite only that portion of the directory without making any other changes */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x200000) != 0 && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00008) != 0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == int32(O_RDWR3) { if XTIFFForceStrileArrayWriting(tls, tif) != 0 { return int32(1) } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&(libc.Uint32FromUint32(0x00008)|libc.Uint32FromUint32(0x200000)) != 0 && !(XTIFFRewriteDirectory(tls, tif) != 0) { return 0 } return int32(1) } // C documentation // // /* // * This is an advanced writing function that must be used in a particular // * sequence, and together with TIFFDeferStrileArrayWriting(), // * to make its intended effect. Its aim is to force the writing of // * the [Strip/Tile][Offsets/ByteCounts] arrays at the end of the file, when // * they have not yet been rewritten. // * // * The typical sequence of calls is: // * TIFFOpen() // * [ TIFFCreateDirectory(tif) ] // * Set fields with calls to TIFFSetField(tif, ...) // * TIFFDeferStrileArrayWriting(tif) // * TIFFWriteCheck(tif, ...) // * TIFFWriteDirectory(tif) // * ... potentially create other directories and come back to the above directory // * TIFFForceStrileArrayWriting(tif) // * // * Returns 1 in case of success, 0 otherwise. // */ func XTIFFForceStrileArrayWriting(tls *libc.TLS, tif uintptr) (r int32) { var isTiled, v1, v2 int32 var v3 bool _, _, _, _ = isTiled, v1, v2, v3 isTiled = XTIFFIsTiled(tls, tif) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY5 { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+34248, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff == uint64(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module46)), __ccgo_ts+37999, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00008) != uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module46)), __ccgo_ts+38034, 0) return 0 } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x200000) != 0) { if !(libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_tag) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_count == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_type) == 0 && *(*Tuint64_t)(unsafe.Pointer(tif + 56 + 144 + 16)) == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_tag) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_count == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_type) == 0 && *(*Tuint64_t)(unsafe.Pointer(tif + 56 + 176 + 16)) == uint64(0)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module46)), __ccgo_ts+38134, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_p == libc.UintptrFromInt32(0) && !(XTIFFSetupStrips(tls, tif) != 0) { return 0 } } if isTiled != 0 { v1 = int32(TIFFTAG_TILEOFFSETS) } else { v1 = int32(TIFFTAG_STRIPOFFSETS) } if v3 = X_TIFFRewriteField(tls, tif, libc.Uint16FromInt32(v1), int32(TIFF_LONG8), libc.Int32FromUint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_p) != 0; v3 { if isTiled != 0 { v2 = int32(TIFFTAG_TILEBYTECOUNTS) } else { v2 = int32(TIFFTAG_STRIPBYTECOUNTS) } } if v3 && X_TIFFRewriteField(tls, tif, libc.Uint16FromInt32(v2), int32(TIFF_LONG8), libc.Int32FromUint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips), (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_p) != 0 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x200000) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00040) return int32(1) } return 0 } var _module46 = [28]uint8{'T', 'I', 'F', 'F', 'F', 'o', 'r', 'c', 'e', 'S', 't', 'r', 'i', 'l', 'e', 'A', 'r', 'r', 'a', 'y', 'W', 'r', 'i', 't', 'i', 'n', 'g'} // C documentation // // /* // * Flush buffered data to the file. // * // * Frank Warmerdam'2000: I modified this to return 1 if TIFF_BEENWRITING // * is not set, so that TIFFFlush() will proceed to write out the directory. // * The documentation says returning 1 is an error indicator, but not having // * been writing isn't exactly a an error. Hopefully this doesn't cause // * problems for other people. // */ func XTIFFFlushData(tls *libc.TLS, tif uintptr) (r int32) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00040) == uint32(0) { return int32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x01000) != 0 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x01000) if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode})))(tls, tif) != 0) { return 0 } } return XTIFFFlushData1(tls, tif) } const O_RDONLY6 = 00 const O_RDWR4 = 02 const TIFFTCL_MAJOR_VERSION = 4 const TIFFTCL_MINOR_VERSION = 7 const TIFFTCL_PATCH_LEVEL = "4.7.0" const TIFFTCL_RELEASE_LEVEL = "TCL_RELEASE" const TIFFTCL_RELEASE_SERIAL = 0 const TIFFTCL_VERSION = "4.7.0" const TIFF_BEENWRITING4 = 0x00040 const TIFF_DIRTYDIRECT4 = 0x00008 const TIFF_DIRTYSTRIP4 = 0x200000 const TIFF_POSTENCODE6 = 0x01000 /* * tifftcl.c -- * * Generic interface to XML parsers. * * Copyright (c) 2002 Andreas Kupries * * Zveno Pty Ltd makes this software and associated documentation * available free of charge for any purpose. You may make copies * of the software but you must include all of this notice on any copy. * * Zveno Pty Ltd does not warrant that this software is error free * or fit for any purpose. Zveno Pty Ltd disclaims any liability for * all claims, expenses, losses, damages and costs any user may incur * as a result of using, copying or modifying the software. * */ // C documentation // // /* // * Macros PACKAGE_NAME and PACKAGE_VERSION are correctly supplied on // * the command line, but are overwritten by settings in tif_config.h // * when using libtiff version 4.X. // * So we save the supplied macro values before including any header // * file and use these values in (Tcl_PkgProvideEx. // */ var _MY_PACKAGE_NAME = __ccgo_ts + 38198 var _MY_PACKAGE_VERSION = __ccgo_ts + 38206 type TTifftclStubs = struct { Fmagic int32 Fhooks uintptr FtIFFGetVersion uintptr FtIFFFindCODEC uintptr FtIFFRegisterCODEC uintptr FtIFFUnRegisterCODEC uintptr F_TIFFmallocPtr uintptr F_TIFFreallocPtr uintptr F_TIFFmemsetPtr uintptr F_TIFFmemcpyPtr uintptr F_TIFFmemcmpPtr uintptr F_TIFFfreePtr uintptr FtIFFClose uintptr FtIFFFlush uintptr FtIFFFlushData uintptr FtIFFGetField uintptr FtIFFVGetField uintptr FtIFFGetFieldDefaulted uintptr FtIFFVGetFieldDefaulted uintptr FtIFFReadDirectory uintptr FtIFFScanlineSize uintptr FtIFFRasterScanlineSize uintptr FtIFFStripSize uintptr FtIFFVStripSize uintptr FtIFFTileRowSize uintptr FtIFFTileSize uintptr FtIFFVTileSize uintptr FtIFFDefaultStripSize uintptr FtIFFDefaultTileSize uintptr FtIFFFileno uintptr FtIFFGetMode uintptr FtIFFIsTiled uintptr FtIFFIsByteSwapped uintptr FtIFFIsUpSampled uintptr FtIFFIsMSB2LSB uintptr FtIFFCurrentRow uintptr FtIFFCurrentDirectory uintptr FtIFFNumberOfDirectories uintptr FtIFFCurrentDirOffset uintptr FtIFFCurrentStrip uintptr FtIFFCurrentTile uintptr FtIFFReadBufferSetup uintptr FtIFFWriteBufferSetup uintptr FtIFFWriteCheck uintptr FtIFFCreateDirectory uintptr FtIFFLastDirectory uintptr FtIFFSetDirectory uintptr FtIFFSetSubDirectory uintptr FtIFFUnlinkDirectory uintptr FtIFFSetField uintptr FtIFFVSetField uintptr FtIFFWriteDirectory uintptr Freserved50 uintptr FtIFFPrintDirectory uintptr FtIFFReadScanline uintptr FtIFFWriteScanline uintptr FtIFFReadRGBAImage uintptr FtIFFReadRGBAStrip uintptr FtIFFReadRGBATile uintptr Freserved57 uintptr Freserved58 uintptr FtIFFRGBAImageGet uintptr FtIFFRGBAImageEnd uintptr FtIFFOpen uintptr FtIFFFdOpen uintptr FtIFFClientOpen uintptr FtIFFFileName uintptr FtIFFError uintptr FtIFFWarning uintptr FtIFFSetErrorHandler uintptr FtIFFSetWarningHandler uintptr FtIFFSetTagExtender uintptr FtIFFComputeTile uintptr FtIFFCheckTile uintptr FtIFFNumberOfTiles uintptr FtIFFReadTile uintptr FtIFFWriteTile uintptr FtIFFComputeStrip uintptr FtIFFNumberOfStrips uintptr FtIFFReadEncodedStrip uintptr FtIFFReadRawStrip uintptr FtIFFReadEncodedTile uintptr FtIFFReadRawTile uintptr FtIFFWriteEncodedStrip uintptr FtIFFWriteRawStrip uintptr FtIFFWriteEncodedTile uintptr FtIFFWriteRawTile uintptr FtIFFSetWriteOffset uintptr FtIFFSwabShort uintptr FtIFFSwabLong uintptr FtIFFSwabDouble uintptr FtIFFSwabArrayOfShort uintptr FtIFFSwabArrayOfLong uintptr FtIFFSwabArrayOfDouble uintptr FtIFFReverseBits uintptr FtIFFGetBitRevTable uintptr FtIFFErrorExt uintptr FtIFFGetStrileByteCount uintptr FtIFFGetStrileOffset uintptr Freserved97 uintptr Freserved98 uintptr Freserved99 uintptr FtIFFPredictorInit uintptr FtIFFPredictorCleanup uintptr Freserved102 uintptr Freserved103 uintptr Freserved104 uintptr Freserved105 uintptr Freserved106 uintptr Freserved107 uintptr Freserved108 uintptr Freserved109 uintptr Freserved110 uintptr FtIFFMergeFieldInfo uintptr F_TIFFPrintFieldInfoPtr uintptr Freserved113 uintptr FtIFFFieldWithTag uintptr F_TIFFMergeFieldsPtr uintptr Freserved116 uintptr Freserved117 uintptr Freserved118 uintptr Freserved119 uintptr Freserved120 uintptr Freserved121 uintptr Freserved122 uintptr Freserved123 uintptr Freserved124 uintptr Freserved125 uintptr Freserved126 uintptr F_TIFFNoPostDecodePtr uintptr Freserved128 uintptr Freserved129 uintptr Freserved130 uintptr Freserved131 uintptr Freserved132 uintptr FtIFFFlushData1 uintptr FtIFFFreeDirectory uintptr FtIFFDefaultDirectory uintptr FtIFFSetCompressionScheme uintptr F_TIFFSetDefaultCompressionStatePtr uintptr F_TIFFDefaultStripSizePtr uintptr Freserved139 uintptr F_TIFFsetByteArrayPtr uintptr Freserved141 uintptr Freserved142 uintptr Freserved143 uintptr Freserved144 uintptr Freserved145 uintptr Freserved146 uintptr Freserved147 uintptr FtIFFInitDumpMode uintptr FtIFFInitPackBits uintptr FtIFFInitCCITTRLE uintptr FtIFFInitCCITTRLEW uintptr FtIFFInitCCITTFax3 uintptr FtIFFInitCCITTFax4 uintptr FtIFFInitThunderScan uintptr FtIFFInitNeXT uintptr FtIFFInitLZW uintptr FtIFFInitOJPEG uintptr FtIFFInitJPEG uintptr FtIFFInitJBIG uintptr FtIFFInitZIP uintptr FtIFFInitPixarLog uintptr FtIFFInitSGILog uintptr F_TIFFMultiplySSizePtr uintptr FtIFFWarningExt uintptr } /* * Prototypes for procedures defined later in this file: */ /* *---------------------------------------------------------------------------- * * Tifftcl_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, * loads xml package. * *---------------------------------------------------------------------------- */ func XTifftcl_Init(tls *libc.TLS, interp uintptr) (r int32) { /* Interpreter to initialise. */ if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<= int32(1) { switch libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) { case EXTRASAMPLE_UNSPECIFIED: /* Workaround for some images without */ if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) > int32(3) { /* correct info about alpha channel */ (*TTIFFRGBAImage)(unsafe.Pointer(img)).Falpha = int32(EXTRASAMPLE_ASSOCALPHA) } case int32(EXTRASAMPLE_ASSOCALPHA): /* data is pre-multiplied */ fallthrough case int32(EXTRASAMPLE_UNASSALPHA): /* data is not pre-multiplied */ (*TTIFFRGBAImage)(unsafe.Pointer(img)).Falpha = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) break } } if !(XTIFFGetField(tls, tif, uint32(TIFFTAG_PHOTOMETRIC), libc.VaList(bp+40, img+32)) != 0) { (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric = uint16(PHOTOMETRIC_MINISWHITE) } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 4))) == 0 && libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) == int32(4) && libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric) == int32(PHOTOMETRIC_RGB) { (*TTIFFRGBAImage)(unsafe.Pointer(img)).Falpha = int32(EXTRASAMPLE_ASSOCALPHA) *(*Tuint16_t)(unsafe.Pointer(bp + 4)) = uint16(1) } colorchannels = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) - libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 4))) XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_COMPRESSION), libc.VaList(bp+40, bp+8)) XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_PLANARCONFIG), libc.VaList(bp+40, bp+6)) if !(XTIFFGetField(tls, tif, uint32(TIFFTAG_PHOTOMETRIC), libc.VaList(bp+40, img+32)) != 0) { switch colorchannels { case int32(1): if _isCCITTCompression(tls, tif) != 0 { (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric = uint16(PHOTOMETRIC_MINISWHITE) } else { (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric = uint16(PHOTOMETRIC_MINISBLACK) } case int32(3): (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric = uint16(PHOTOMETRIC_RGB) default: libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38377, libc.VaList(bp+40, uintptr(unsafe.Pointer(&_photoTag)))) goto fail_return } } switch libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric) { case int32(PHOTOMETRIC_PALETTE): if !(XTIFFGetField(tls, tif, uint32(TIFFTAG_COLORMAP), libc.VaList(bp+40, bp+12, bp+16, bp+20)) != 0) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38956, 0) goto fail_return } /* copy the colormaps so we can modify them */ n_color = libc.Int32FromUint32(libc.Uint32FromUint32(1) << (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample) (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fredcmap = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32(2)*libc.Uint32FromInt32(n_color))) (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fgreencmap = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32(2)*libc.Uint32FromInt32(n_color))) (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbluecmap = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(uint32(2)*libc.Uint32FromInt32(n_color))) if !((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fredcmap != 0) || !((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fgreencmap != 0) || !((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbluecmap != 0) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38988, 0) goto fail_return } X_TIFFmemcpy(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fredcmap, *(*uintptr)(unsafe.Pointer(bp + 12)), n_color*int32(2)) X_TIFFmemcpy(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fgreencmap, *(*uintptr)(unsafe.Pointer(bp + 16)), n_color*int32(2)) X_TIFFmemcpy(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbluecmap, *(*uintptr)(unsafe.Pointer(bp + 20)), n_color*int32(2)) /* fall through... */ fallthrough case PHOTOMETRIC_MINISWHITE: fallthrough case int32(PHOTOMETRIC_MINISBLACK): if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 6))) == int32(PLANARCONFIG_CONTIG) && libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) != int32(1) && libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample) < int32(8) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38399, libc.VaList(bp+40, uintptr(unsafe.Pointer(&_photoTag)), libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric), __ccgo_ts+38478, libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel), libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample))) goto fail_return } case int32(PHOTOMETRIC_YCBCR): /* It would probably be nice to have a reality check here. */ if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 6))) == int32(PLANARCONFIG_CONTIG) { /* can rely on libjpeg to convert to RGB */ /* XXX should restore current state on exit */ switch libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 8))) { case int32(COMPRESSION_JPEG): /* * TODO: when complete tests verify complete * desubsampling and YCbCr handling, remove use of * TIFFTAG_JPEGCOLORMODE in favor of tif_getimage.c * native handling */ XTIFFSetField(tls, tif, uint32(TIFFTAG_JPEGCOLORMODE), libc.VaList(bp+40, int32(JPEGCOLORMODE_RGB1))) (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric = uint16(PHOTOMETRIC_RGB) default: /* do nothing */ break } } /* * TODO: if at all meaningful and useful, make more complete * support check here, or better still, refactor to let supporting * code decide whether there is support and what meaningful * error to return */ case int32(PHOTOMETRIC_RGB): if colorchannels < int32(3) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38492, libc.VaList(bp+40, __ccgo_ts+38535, colorchannels)) goto fail_return } case int32(PHOTOMETRIC_SEPARATED): XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_INKSET), libc.VaList(bp+40, bp+24)) if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))) != int32(INKSET_CMYK) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38599, libc.VaList(bp+40, __ccgo_ts+23486, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 24))))) goto fail_return } if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) < int32(4) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38599, libc.VaList(bp+40, __ccgo_ts+38478, libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel))) goto fail_return } case int32(PHOTOMETRIC_LOGL): if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 8))) != int32(COMPRESSION_SGILOG) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38648, libc.VaList(bp+40, __ccgo_ts+22917, int32(COMPRESSION_SGILOG))) goto fail_return } XTIFFSetField(tls, tif, uint32(TIFFTAG_SGILOGDATAFMT), libc.VaList(bp+40, int32(SGILOGDATAFMT_8BIT))) (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric = uint16(PHOTOMETRIC_MINISBLACK) /* little white lie */ (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample = uint16(8) case int32(PHOTOMETRIC_LOGLUV): if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 8))) != int32(COMPRESSION_SGILOG) && libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 8))) != int32(COMPRESSION_SGILOG24) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38681, libc.VaList(bp+40, __ccgo_ts+22917, int32(COMPRESSION_SGILOG), int32(COMPRESSION_SGILOG24))) goto fail_return } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 6))) != int32(PLANARCONFIG_CONTIG) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38722, libc.VaList(bp+40, __ccgo_ts+38769, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 6))))) return 0 } XTIFFSetField(tls, tif, uint32(TIFFTAG_SGILOGDATAFMT), libc.VaList(bp+40, int32(SGILOGDATAFMT_8BIT))) (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric = uint16(PHOTOMETRIC_RGB) /* little white lie */ (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample = uint16(8) case int32(PHOTOMETRIC_CIELAB): default: libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+38917, libc.VaList(bp+40, uintptr(unsafe.Pointer(&_photoTag)), libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric))) goto fail_return } XTIFFGetField(tls, tif, uint32(TIFFTAG_IMAGEWIDTH), libc.VaList(bp+40, img+16)) XTIFFGetField(tls, tif, uint32(TIFFTAG_IMAGELENGTH), libc.VaList(bp+40, img+20)) XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_ORIENTATION), libc.VaList(bp+40, img+28)) (*TTIFFRGBAImage)(unsafe.Pointer(img)).FisContig = libc.BoolInt32(!(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 6))) == int32(PLANARCONFIG_SEPARATE) && libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) > int32(1))) if (*TTIFFRGBAImage)(unsafe.Pointer(img)).FisContig != 0 { if !(_PickContigCase(tls, img) != 0) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+39020, 0) goto fail_return } } else { if !(_PickSeparateCase(tls, img) != 0) { libc.X__builtin_snprintf(tls, emsg, uint32(EMSG_BUF_SIZE), __ccgo_ts+39020, 0) goto fail_return } } return int32(1) goto fail_return fail_return: ; XTIFFRGBAImageEnd(tls, img) return 0 } func XTIFFRGBAImageGet(tls *libc.TLS, img uintptr, raster uintptr, w Tuint32_t, h Tuint32_t) (r int32) { if (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fget == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, XTIFFFileName(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif), __ccgo_ts+39048, 0) return 0 } if *(*uintptr)(unsafe.Pointer(img + 52)) == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, XTIFFFileName(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif), __ccgo_ts+39071, 0) return 0 } return (*(*func(*libc.TLS, uintptr, uintptr, Tuint32_t, Tuint32_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFRGBAImage)(unsafe.Pointer(img)).Fget})))(tls, img, raster, w, h) } // C documentation // // /* // * Read the specified image into an ABGR-format rastertaking in account // * specified orientation. // */ func XTIFFReadRGBAImageOriented(tls *libc.TLS, tif uintptr, rwidth Tuint32_t, rheight Tuint32_t, raster uintptr, orientation int32, stop int32) (r int32) { bp := tls.Alloc(1136) defer tls.Free(1136) var ok int32 var _ /* emsg at bp+0 */ [1024]uint8 var _ /* img at bp+1024 */ TTIFFRGBAImage _ = ok *(*[1024]uint8)(unsafe.Pointer(bp)) = [1024]uint8{} if XTIFFRGBAImageOK(tls, tif, bp) != 0 && XTIFFRGBAImageBegin(tls, bp+1024, tif, stop, bp) != 0 { (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Freq_orientation = libc.Uint16FromInt32(orientation) /* XXX verify rwidth and rheight against width and height */ ok = XTIFFRGBAImageGet(tls, bp+1024, raster+uintptr((rheight-(*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fheight)*rwidth)*4, rwidth, (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fheight) XTIFFRGBAImageEnd(tls, bp+1024) } else { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39133, libc.VaList(bp+1128, bp)) ok = 0 } return ok } // C documentation // // /* // * Read the specified image into an ABGR-format raster. Use bottom left // * origin for raster by default. // */ func XTIFFReadRGBAImage(tls *libc.TLS, tif uintptr, rwidth Tuint32_t, rheight Tuint32_t, raster uintptr, stop int32) (r int32) { return XTIFFReadRGBAImageOriented(tls, tif, rwidth, rheight, raster, int32(ORIENTATION_BOTLEFT), stop) } func _setorientation(tls *libc.TLS, img uintptr) (r int32) { switch libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Forientation) { case int32(ORIENTATION_TOPLEFT): fallthrough case int32(ORIENTATION_LEFTTOP): if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_TOPRIGHT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_RIGHTTOP) { return int32(FLIP_HORIZONTALLY) } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_BOTRIGHT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_RIGHTBOT) { return libc.Int32FromInt32(FLIP_HORIZONTALLY) | libc.Int32FromInt32(FLIP_VERTICALLY) } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_BOTLEFT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_LEFTBOT) { return int32(FLIP_VERTICALLY) } else { return 0 } } } fallthrough case int32(ORIENTATION_TOPRIGHT): fallthrough case int32(ORIENTATION_RIGHTTOP): if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_TOPLEFT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_LEFTTOP) { return int32(FLIP_HORIZONTALLY) } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_BOTRIGHT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_RIGHTBOT) { return int32(FLIP_VERTICALLY) } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_BOTLEFT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_LEFTBOT) { return libc.Int32FromInt32(FLIP_HORIZONTALLY) | libc.Int32FromInt32(FLIP_VERTICALLY) } else { return 0 } } } fallthrough case int32(ORIENTATION_BOTRIGHT): fallthrough case int32(ORIENTATION_RIGHTBOT): if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_TOPLEFT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_LEFTTOP) { return libc.Int32FromInt32(FLIP_HORIZONTALLY) | libc.Int32FromInt32(FLIP_VERTICALLY) } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_TOPRIGHT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_RIGHTTOP) { return int32(FLIP_VERTICALLY) } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_BOTLEFT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_LEFTBOT) { return int32(FLIP_HORIZONTALLY) } else { return 0 } } } fallthrough case int32(ORIENTATION_BOTLEFT): fallthrough case int32(ORIENTATION_LEFTBOT): if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_TOPLEFT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_LEFTTOP) { return int32(FLIP_VERTICALLY) } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_TOPRIGHT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_RIGHTTOP) { return libc.Int32FromInt32(FLIP_HORIZONTALLY) | libc.Int32FromInt32(FLIP_VERTICALLY) } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_BOTRIGHT) || libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Freq_orientation) == int32(ORIENTATION_RIGHTBOT) { return int32(FLIP_HORIZONTALLY) } else { return 0 } } } fallthrough default: /* NOTREACHED */ return 0 } return r } // C documentation // // /* // * Get an tile-organized image that has // * PlanarConfiguration contiguous if SamplesPerPixel > 1 // * or // * SamplesPerPixel == 1 // */ func _gtTileContig(tls *libc.TLS, img uintptr, raster uintptr, w Tuint32_t, h Tuint32_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var bufsize, pos, roffset Ttmsize_t var col, leftmost_tw, line, nrow, row, rowstoread, temp, this_tw, tocol, y Tuint32_t var flip, ret, v3 int32 var fromskew, leftmost_fromskew, leftmost_toskew, this_toskew, toskew Tint32_t var left, right, tif uintptr var put TtileContigRoutine var v2 uint32 var _ /* buf at bp+8 */ uintptr var _ /* th at bp+4 */ Tuint32_t var _ /* tw at bp+0 */ Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufsize, col, flip, fromskew, left, leftmost_fromskew, leftmost_toskew, leftmost_tw, line, nrow, pos, put, ret, right, roffset, row, rowstoread, temp, this_toskew, this_tw, tif, tocol, toskew, y, v2, v3 tif = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif put = *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0) ret = int32(1) bufsize = XTIFFTileSize(tls, tif) if bufsize == 0 { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39133, libc.VaList(bp+24, __ccgo_ts+39136)) return 0 } XTIFFGetField(tls, tif, uint32(TIFFTAG_TILEWIDTH), libc.VaList(bp+24, bp)) XTIFFGetField(tls, tif, uint32(TIFFTAG_TILELENGTH), libc.VaList(bp+24, bp+4)) flip = _setorientation(tls, img) if flip&int32(FLIP_VERTICALLY) != 0 { if *(*Tuint32_t)(unsafe.Pointer(bp))+w > uint32(INT_MAX5) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39133, libc.VaList(bp+24, __ccgo_ts+39161)) return 0 } y = h - uint32(1) toskew = -libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)) + w) } else { if *(*Tuint32_t)(unsafe.Pointer(bp)) > uint32(INT_MAX5)+w { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39133, libc.VaList(bp+24, __ccgo_ts+39161)) return 0 } y = uint32(0) toskew = -libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)) - w) } if *(*Tuint32_t)(unsafe.Pointer(bp)) == uint32(0) || *(*Tuint32_t)(unsafe.Pointer(bp + 4)) == uint32(0) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39194, 0) return 0 } /* * Leftmost tile is clipped on left side if col_offset > 0. */ leftmost_fromskew = libc.Int32FromUint32(libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcol_offset) % *(*Tuint32_t)(unsafe.Pointer(bp))) leftmost_tw = *(*Tuint32_t)(unsafe.Pointer(bp)) - libc.Uint32FromInt32(leftmost_fromskew) leftmost_toskew = toskew + leftmost_fromskew row = uint32(0) for { if !(ret != 0 && row < h) { break } rowstoread = *(*Tuint32_t)(unsafe.Pointer(bp + 4)) - (row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset))%*(*Tuint32_t)(unsafe.Pointer(bp + 4)) if row+rowstoread > h { v2 = h - row } else { v2 = rowstoread } nrow = v2 fromskew = leftmost_fromskew this_tw = leftmost_tw this_toskew = leftmost_toskew tocol = uint32(0) col = libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcol_offset) for tocol < w { if X_TIFFReadTileAndAllocBuffer(tls, tif, bp+8, bufsize, col, row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset), uint32(0), uint16(0)) == -libc.Int32FromInt32(1) && (*(*uintptr)(unsafe.Pointer(bp + 8)) == libc.UintptrFromInt32(0) || (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0) { ret = 0 break } pos = libc.Int32FromUint32((row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset))%*(*Tuint32_t)(unsafe.Pointer(bp + 4))*libc.Uint32FromInt32(XTIFFTileRowSize(tls, tif)) + libc.Uint32FromInt32(fromskew*libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel))) if tocol+this_tw > w { /* * Rightmost tile is clipped on right side. */ fromskew = libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)) - (w - tocol)) this_tw = *(*Tuint32_t)(unsafe.Pointer(bp)) - libc.Uint32FromInt32(fromskew) this_toskew = toskew + fromskew } roffset = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32(y))*w + tocol) (*(*func(*libc.TLS, uintptr, uintptr, Tuint32_t, Tuint32_t, Tuint32_t, Tuint32_t, Tint32_t, Tint32_t, uintptr))(unsafe.Pointer(&struct{ uintptr }{put})))(tls, img, raster+uintptr(roffset)*4, tocol, y, this_tw, nrow, fromskew, this_toskew, *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(pos)) tocol += this_tw col += this_tw /* * After the leftmost tile, tiles are no longer clipped on left * side. */ fromskew = 0 this_tw = *(*Tuint32_t)(unsafe.Pointer(bp)) this_toskew = toskew } if flip&int32(FLIP_VERTICALLY) != 0 { v3 = -libc.Int32FromUint32(nrow) } else { v3 = libc.Int32FromUint32(nrow) } y += libc.Uint32FromInt32(v3) goto _1 _1: ; row += nrow } X_TIFFfreeExt(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, *(*uintptr)(unsafe.Pointer(bp + 8))) if flip&int32(FLIP_HORIZONTALLY) != 0 { line = uint32(0) for { if !(line < h) { break } left = raster + uintptr(line*w)*4 right = left + uintptr(w)*4 - uintptr(1)*4 for left < right { temp = *(*Tuint32_t)(unsafe.Pointer(left)) *(*Tuint32_t)(unsafe.Pointer(left)) = *(*Tuint32_t)(unsafe.Pointer(right)) *(*Tuint32_t)(unsafe.Pointer(right)) = temp left += 4 right -= 4 } goto _4 _4: ; line++ } } return ret } // C documentation // // /* // * Get an tile-organized image that has // * SamplesPerPixel > 1 // * PlanarConfiguration separated // * We assume that all such images are RGB. // */ func _gtTileSeparate(tls *libc.TLS, img uintptr, raster uintptr, w Tuint32_t, h Tuint32_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var alpha, flip, ret, v1, v8 int32 var bufsize, pos, roffset, tilesize Ttmsize_t var col, leftmost_tw, line, nrow, row, rowstoread, temp, this_tw, tocol, y Tuint32_t var colorchannels Tuint16_t var fromskew, leftmost_fromskew, leftmost_toskew, this_toskew, toskew Tint32_t var left, p0, p1, p2, pa, right, tif, v4, v5, v6, v7 uintptr var put TtileSeparateRoutine var v3 uint32 var _ /* buf at bp+8 */ uintptr var _ /* th at bp+4 */ Tuint32_t var _ /* tw at bp+0 */ Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alpha, bufsize, col, colorchannels, flip, fromskew, left, leftmost_fromskew, leftmost_toskew, leftmost_tw, line, nrow, p0, p1, p2, pa, pos, put, ret, right, roffset, row, rowstoread, temp, this_toskew, this_tw, tif, tilesize, tocol, toskew, y, v1, v3, v4, v5, v6, v7, v8 tif = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif put = *(*TtileSeparateRoutine)(unsafe.Pointer(img + 52)) *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0) p0 = libc.UintptrFromInt32(0) p1 = libc.UintptrFromInt32(0) p2 = libc.UintptrFromInt32(0) pa = libc.UintptrFromInt32(0) alpha = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Falpha ret = int32(1) tilesize = XTIFFTileSize(tls, tif) if alpha != 0 { v1 = int32(4) } else { v1 = int32(3) } bufsize = X_TIFFMultiplySSize(tls, tif, v1, tilesize, __ccgo_ts+39223) if bufsize == 0 { return 0 } XTIFFGetField(tls, tif, uint32(TIFFTAG_TILEWIDTH), libc.VaList(bp+24, bp)) XTIFFGetField(tls, tif, uint32(TIFFTAG_TILELENGTH), libc.VaList(bp+24, bp+4)) flip = _setorientation(tls, img) if flip&int32(FLIP_VERTICALLY) != 0 { if *(*Tuint32_t)(unsafe.Pointer(bp))+w > uint32(INT_MAX5) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39133, libc.VaList(bp+24, __ccgo_ts+39161)) return 0 } y = h - uint32(1) toskew = -libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)) + w) } else { if *(*Tuint32_t)(unsafe.Pointer(bp)) > uint32(INT_MAX5)+w { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39133, libc.VaList(bp+24, __ccgo_ts+39161)) return 0 } y = uint32(0) toskew = -libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)) - w) } switch libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric) { case PHOTOMETRIC_MINISWHITE: fallthrough case int32(PHOTOMETRIC_MINISBLACK): fallthrough case int32(PHOTOMETRIC_PALETTE): colorchannels = uint16(1) default: colorchannels = uint16(3) break } if *(*Tuint32_t)(unsafe.Pointer(bp)) == uint32(0) || *(*Tuint32_t)(unsafe.Pointer(bp + 4)) == uint32(0) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39194, 0) return 0 } /* * Leftmost tile is clipped on left side if col_offset > 0. */ leftmost_fromskew = libc.Int32FromUint32(libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcol_offset) % *(*Tuint32_t)(unsafe.Pointer(bp))) leftmost_tw = *(*Tuint32_t)(unsafe.Pointer(bp)) - libc.Uint32FromInt32(leftmost_fromskew) leftmost_toskew = toskew + leftmost_fromskew row = uint32(0) for { if !(ret != 0 && row < h) { break } rowstoread = *(*Tuint32_t)(unsafe.Pointer(bp + 4)) - (row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset))%*(*Tuint32_t)(unsafe.Pointer(bp + 4)) if row+rowstoread > h { v3 = h - row } else { v3 = rowstoread } nrow = v3 fromskew = leftmost_fromskew this_tw = leftmost_tw this_toskew = leftmost_toskew tocol = uint32(0) col = libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcol_offset) for tocol < w { if *(*uintptr)(unsafe.Pointer(bp + 8)) == libc.UintptrFromInt32(0) { if X_TIFFReadTileAndAllocBuffer(tls, tif, bp+8, bufsize, col, row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset), uint32(0), uint16(0)) == -libc.Int32FromInt32(1) && (*(*uintptr)(unsafe.Pointer(bp + 8)) == libc.UintptrFromInt32(0) || (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0) { ret = 0 break } p0 = *(*uintptr)(unsafe.Pointer(bp + 8)) if libc.Int32FromUint16(colorchannels) == int32(1) { v4 = p0 p1 = v4 p2 = v4 if alpha != 0 { v5 = p0 + uintptr(int32(3)*tilesize) } else { v5 = libc.UintptrFromInt32(0) } pa = v5 } else { p1 = p0 + uintptr(tilesize) p2 = p1 + uintptr(tilesize) if alpha != 0 { v6 = p2 + uintptr(tilesize) } else { v6 = libc.UintptrFromInt32(0) } pa = v6 } } else { if XTIFFReadTile(tls, tif, p0, col, row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset), uint32(0), uint16(0)) == -libc.Int32FromInt32(1) && (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0 { ret = 0 break } } if libc.Int32FromUint16(colorchannels) > int32(1) && XTIFFReadTile(tls, tif, p1, col, row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset), uint32(0), uint16(1)) == -libc.Int32FromInt32(1) && (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0 { ret = 0 break } if libc.Int32FromUint16(colorchannels) > int32(1) && XTIFFReadTile(tls, tif, p2, col, row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset), uint32(0), uint16(2)) == -libc.Int32FromInt32(1) && (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0 { ret = 0 break } if alpha != 0 && XTIFFReadTile(tls, tif, pa, col, row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset), uint32(0), colorchannels) == -libc.Int32FromInt32(1) && (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0 { ret = 0 break } pos = libc.Int32FromUint32((row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset))%*(*Tuint32_t)(unsafe.Pointer(bp + 4))*libc.Uint32FromInt32(XTIFFTileRowSize(tls, tif)) + libc.Uint32FromInt32(fromskew*libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel))) if tocol+this_tw > w { /* * Rightmost tile is clipped on right side. */ fromskew = libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp)) - (w - tocol)) this_tw = *(*Tuint32_t)(unsafe.Pointer(bp)) - libc.Uint32FromInt32(fromskew) this_toskew = toskew + fromskew } roffset = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32(y))*w + tocol) if alpha != 0 { v7 = pa + uintptr(pos) } else { v7 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, uintptr, uintptr, Tuint32_t, Tuint32_t, Tuint32_t, Tuint32_t, Tint32_t, Tint32_t, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{put})))(tls, img, raster+uintptr(roffset)*4, tocol, y, this_tw, nrow, fromskew, this_toskew, p0+uintptr(pos), p1+uintptr(pos), p2+uintptr(pos), v7) tocol += this_tw col += this_tw /* * After the leftmost tile, tiles are no longer clipped on left * side. */ fromskew = 0 this_tw = *(*Tuint32_t)(unsafe.Pointer(bp)) this_toskew = toskew } if flip&int32(FLIP_VERTICALLY) != 0 { v8 = -libc.Int32FromUint32(nrow) } else { v8 = libc.Int32FromUint32(nrow) } y += libc.Uint32FromInt32(v8) goto _2 _2: ; row += nrow } if flip&int32(FLIP_HORIZONTALLY) != 0 { line = uint32(0) for { if !(line < h) { break } left = raster + uintptr(line*w)*4 right = left + uintptr(w)*4 - uintptr(1)*4 for left < right { temp = *(*Tuint32_t)(unsafe.Pointer(left)) *(*Tuint32_t)(unsafe.Pointer(left)) = *(*Tuint32_t)(unsafe.Pointer(right)) *(*Tuint32_t)(unsafe.Pointer(right)) = temp left += 4 right -= 4 } goto _9 _9: ; line++ } } X_TIFFfreeExt(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, *(*uintptr)(unsafe.Pointer(bp + 8))) return ret } // C documentation // // /* // * Get a strip-organized image that has // * PlanarConfiguration contiguous if SamplesPerPixel > 1 // * or // * SamplesPerPixel == 1 // */ func _gtStripContig(tls *libc.TLS, img uintptr, raster uintptr, w Tuint32_t, h Tuint32_t) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var flip, ret, v4 int32 var fromskew, toskew Tint32_t var imagewidth, line, nrow, nrowsub, row, rowstoread, temp, temp1, y Tuint32_t var left, right, tif uintptr var maxstripsize, pos, roffset, scanline Ttmsize_t var put TtileContigRoutine var v1, v3 uint32 var _ /* buf at bp+0 */ uintptr var _ /* rowsperstrip at bp+4 */ Tuint32_t var _ /* subsamplinghor at bp+8 */ Tuint16_t var _ /* subsamplingver at bp+10 */ Tuint16_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = flip, fromskew, imagewidth, left, line, maxstripsize, nrow, nrowsub, pos, put, ret, right, roffset, row, rowstoread, scanline, temp, temp1, tif, toskew, y, v1, v3, v4 tif = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif put = *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0) imagewidth = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fwidth ret = int32(1) XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_YCBCRSUBSAMPLING), libc.VaList(bp+24, bp+8, bp+10)) if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 10))) == 0 { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39238, 0) return 0 } maxstripsize = XTIFFStripSize(tls, tif) flip = _setorientation(tls, img) if flip&int32(FLIP_VERTICALLY) != 0 { if w > uint32(INT_MAX5) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39273, 0) return 0 } y = h - uint32(1) toskew = -libc.Int32FromUint32(w + w) } else { y = uint32(0) toskew = -libc.Int32FromUint32(w - w) } XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_ROWSPERSTRIP), libc.VaList(bp+24, bp+4)) if *(*Tuint32_t)(unsafe.Pointer(bp + 4)) == uint32(0) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39288, 0) return 0 } scanline = XTIFFScanlineSize(tls, tif) if w < imagewidth { v1 = imagewidth - w } else { v1 = uint32(0) } fromskew = libc.Int32FromUint32(v1) row = uint32(0) for { if !(row < h) { break } rowstoread = *(*Tuint32_t)(unsafe.Pointer(bp + 4)) - (row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset))%*(*Tuint32_t)(unsafe.Pointer(bp + 4)) if row+rowstoread > h { v3 = h - row } else { v3 = rowstoread } nrow = v3 nrowsub = nrow if nrowsub%uint32(*(*Tuint16_t)(unsafe.Pointer(bp + 10))) != uint32(0) { nrowsub += uint32(*(*Tuint16_t)(unsafe.Pointer(bp + 10))) - nrowsub%uint32(*(*Tuint16_t)(unsafe.Pointer(bp + 10))) } temp = (row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset))%*(*Tuint32_t)(unsafe.Pointer(bp + 4)) + nrowsub if scanline > 0 && temp > libc.Uint32FromInt32(libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))/scanline) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39309, 0) return 0 } if X_TIFFReadEncodedStripAndAllocBuffer(tls, tif, XTIFFComputeStrip(tls, tif, row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset), uint16(0)), bp, maxstripsize, libc.Int32FromUint32(temp*libc.Uint32FromInt32(scanline))) == -libc.Int32FromInt32(1) && (*(*uintptr)(unsafe.Pointer(bp)) == libc.UintptrFromInt32(0) || (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0) { ret = 0 break } pos = libc.Int32FromUint32((row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset))%*(*Tuint32_t)(unsafe.Pointer(bp + 4))*libc.Uint32FromInt32(scanline) + libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcol_offset*libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel))) roffset = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32(y)) * w) (*(*func(*libc.TLS, uintptr, uintptr, Tuint32_t, Tuint32_t, Tuint32_t, Tuint32_t, Tint32_t, Tint32_t, uintptr))(unsafe.Pointer(&struct{ uintptr }{put})))(tls, img, raster+uintptr(roffset)*4, uint32(0), y, w, nrow, fromskew, toskew, *(*uintptr)(unsafe.Pointer(bp))+uintptr(pos)) if flip&int32(FLIP_VERTICALLY) != 0 { v4 = -libc.Int32FromUint32(nrow) } else { v4 = libc.Int32FromUint32(nrow) } y += libc.Uint32FromInt32(v4) goto _2 _2: ; row += nrow } if flip&int32(FLIP_HORIZONTALLY) != 0 { line = uint32(0) for { if !(line < h) { break } left = raster + uintptr(line*w)*4 right = left + uintptr(w)*4 - uintptr(1)*4 for left < right { temp1 = *(*Tuint32_t)(unsafe.Pointer(left)) *(*Tuint32_t)(unsafe.Pointer(left)) = *(*Tuint32_t)(unsafe.Pointer(right)) *(*Tuint32_t)(unsafe.Pointer(right)) = temp1 left += 4 right -= 4 } goto _5 _5: ; line++ } } X_TIFFfreeExt(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, *(*uintptr)(unsafe.Pointer(bp))) return ret } // C documentation // // /* // * Get a strip-organized image with // * SamplesPerPixel > 1 // * PlanarConfiguration separated // * We assume that all such images are RGB. // */ func _gtStripSeparate(tls *libc.TLS, img uintptr, raster uintptr, w Tuint32_t, h Tuint32_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var alpha, flip, ret, v1, v9 int32 var bufsize, pos, roffset, scanline, stripsize Ttmsize_t var colorchannels Tuint16_t var fromskew, toskew Tint32_t var imagewidth, line, nrow, offset_row, row, rowstoread, temp, temp1, y Tuint32_t var left, p0, p1, p2, pa, right, tif, v5, v6, v7, v8 uintptr var put TtileSeparateRoutine var v2, v4 uint32 var _ /* buf at bp+0 */ uintptr var _ /* rowsperstrip at bp+4 */ Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alpha, bufsize, colorchannels, flip, fromskew, imagewidth, left, line, nrow, offset_row, p0, p1, p2, pa, pos, put, ret, right, roffset, row, rowstoread, scanline, stripsize, temp, temp1, tif, toskew, y, v1, v2, v4, v5, v6, v7, v8, v9 tif = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif put = *(*TtileSeparateRoutine)(unsafe.Pointer(img + 52)) *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0) p0 = libc.UintptrFromInt32(0) p1 = libc.UintptrFromInt32(0) p2 = libc.UintptrFromInt32(0) pa = libc.UintptrFromInt32(0) imagewidth = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fwidth alpha = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Falpha ret = int32(1) stripsize = XTIFFStripSize(tls, tif) if alpha != 0 { v1 = int32(4) } else { v1 = int32(3) } bufsize = X_TIFFMultiplySSize(tls, tif, v1, stripsize, __ccgo_ts+39343) if bufsize == 0 { return 0 } flip = _setorientation(tls, img) if flip&int32(FLIP_VERTICALLY) != 0 { if w > uint32(INT_MAX5) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39273, 0) return 0 } y = h - uint32(1) toskew = -libc.Int32FromUint32(w + w) } else { y = uint32(0) toskew = -libc.Int32FromUint32(w - w) } switch libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fphotometric) { case PHOTOMETRIC_MINISWHITE: fallthrough case int32(PHOTOMETRIC_MINISBLACK): fallthrough case int32(PHOTOMETRIC_PALETTE): colorchannels = uint16(1) default: colorchannels = uint16(3) break } XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_ROWSPERSTRIP), libc.VaList(bp+16, bp+4)) if *(*Tuint32_t)(unsafe.Pointer(bp + 4)) == uint32(0) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39288, 0) return 0 } scanline = XTIFFScanlineSize(tls, tif) if w < imagewidth { v2 = imagewidth - w } else { v2 = uint32(0) } fromskew = libc.Int32FromUint32(v2) row = uint32(0) for { if !(row < h) { break } rowstoread = *(*Tuint32_t)(unsafe.Pointer(bp + 4)) - (row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset))%*(*Tuint32_t)(unsafe.Pointer(bp + 4)) if row+rowstoread > h { v4 = h - row } else { v4 = rowstoread } nrow = v4 offset_row = row + libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset) temp = (row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset))%*(*Tuint32_t)(unsafe.Pointer(bp + 4)) + nrow if scanline > 0 && temp > libc.Uint32FromInt32(libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))/scanline) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39359, 0) return 0 } if *(*uintptr)(unsafe.Pointer(bp)) == libc.UintptrFromInt32(0) { if X_TIFFReadEncodedStripAndAllocBuffer(tls, tif, XTIFFComputeStrip(tls, tif, offset_row, uint16(0)), bp, bufsize, libc.Int32FromUint32(temp*libc.Uint32FromInt32(scanline))) == -libc.Int32FromInt32(1) && (*(*uintptr)(unsafe.Pointer(bp)) == libc.UintptrFromInt32(0) || (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0) { ret = 0 break } p0 = *(*uintptr)(unsafe.Pointer(bp)) if libc.Int32FromUint16(colorchannels) == int32(1) { v5 = p0 p1 = v5 p2 = v5 if alpha != 0 { v6 = p0 + uintptr(int32(3)*stripsize) } else { v6 = libc.UintptrFromInt32(0) } pa = v6 } else { p1 = p0 + uintptr(stripsize) p2 = p1 + uintptr(stripsize) if alpha != 0 { v7 = p2 + uintptr(stripsize) } else { v7 = libc.UintptrFromInt32(0) } pa = v7 } } else { if XTIFFReadEncodedStrip(tls, tif, XTIFFComputeStrip(tls, tif, offset_row, uint16(0)), p0, libc.Int32FromUint32(temp*libc.Uint32FromInt32(scanline))) == -libc.Int32FromInt32(1) && (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0 { ret = 0 break } } if libc.Int32FromUint16(colorchannels) > int32(1) && XTIFFReadEncodedStrip(tls, tif, XTIFFComputeStrip(tls, tif, offset_row, uint16(1)), p1, libc.Int32FromUint32(temp*libc.Uint32FromInt32(scanline))) == -libc.Int32FromInt32(1) && (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0 { ret = 0 break } if libc.Int32FromUint16(colorchannels) > int32(1) && XTIFFReadEncodedStrip(tls, tif, XTIFFComputeStrip(tls, tif, offset_row, uint16(2)), p2, libc.Int32FromUint32(temp*libc.Uint32FromInt32(scanline))) == -libc.Int32FromInt32(1) && (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0 { ret = 0 break } if alpha != 0 { if XTIFFReadEncodedStrip(tls, tif, XTIFFComputeStrip(tls, tif, offset_row, colorchannels), pa, libc.Int32FromUint32(temp*libc.Uint32FromInt32(scanline))) == -libc.Int32FromInt32(1) && (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fstoponerr != 0 { ret = 0 break } } pos = libc.Int32FromUint32((row+libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Frow_offset))%*(*Tuint32_t)(unsafe.Pointer(bp + 4))*libc.Uint32FromInt32(scanline) + libc.Uint32FromInt32((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcol_offset*libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel))) roffset = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32(y)) * w) if alpha != 0 { v8 = pa + uintptr(pos) } else { v8 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, uintptr, uintptr, Tuint32_t, Tuint32_t, Tuint32_t, Tuint32_t, Tint32_t, Tint32_t, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{put})))(tls, img, raster+uintptr(roffset)*4, uint32(0), y, w, nrow, fromskew, toskew, p0+uintptr(pos), p1+uintptr(pos), p2+uintptr(pos), v8) if flip&int32(FLIP_VERTICALLY) != 0 { v9 = -libc.Int32FromUint32(nrow) } else { v9 = libc.Int32FromUint32(nrow) } y += libc.Uint32FromInt32(v9) goto _3 _3: ; row += nrow } if flip&int32(FLIP_HORIZONTALLY) != 0 { line = uint32(0) for { if !(line < h) { break } left = raster + uintptr(line*w)*4 right = left + uintptr(w)*4 - uintptr(1)*4 for left < right { temp1 = *(*Tuint32_t)(unsafe.Pointer(left)) *(*Tuint32_t)(unsafe.Pointer(left)) = *(*Tuint32_t)(unsafe.Pointer(right)) *(*Tuint32_t)(unsafe.Pointer(right)) = temp1 left += 4 right -= 4 } goto _10 _10: ; line++ } } X_TIFFfreeExt(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, *(*uintptr)(unsafe.Pointer(bp))) return ret } /* * The following routines move decoded data returned * from the TIFF library into rasters filled with packed * ABGR pixels (i.e. suitable for passing to lrecwrite.) * * The routines have been created according to the most * important cases and optimized. PickContigCase and * PickSeparateCase analyze the parameters and select * the appropriate "get" and "put" routine to use. */ /* TODO: PACKW should have be made redundant in favor of Bitdepth16To8 LUT */ // C documentation // // /* // * 8-bit palette => colormap/RGB // */ func _put8bitcmaptile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var PALmap, v3 uintptr var samplesperpixel int32 _, _, _ = PALmap, samplesperpixel, v3 PALmap = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FPALmap samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) _ = y for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = *(*Tuint32_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(PALmap + uintptr(*(*uint8)(unsafe.Pointer(pp)))*4)))) pp += uintptr(samplesperpixel) goto _2 _2: ; x-- } cp += uintptr(toskew) * 4 pp += uintptr(fromskew) goto _1 _1: ; h-- } } // C documentation // // /* // * 4-bit palette => colormap/RGB // */ func _put4bitcmaptile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var PALmap, bw, v10, v3, v4, v5, v6, v7, v8, v9 uintptr var _x Tuint32_t _, _, _, _, _, _, _, _, _, _, _ = PALmap, _x, bw, v10, v3, v4, v5, v6, v7, v8, v9 PALmap = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FPALmap _ = x _ = y fromskew /= int32(2) for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(2)) { break } v3 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(PALmap + uintptr(*(*uint8)(unsafe.Pointer(v3)))*4)) v4 = cp cp += 4 v5 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v4)) = *(*Tuint32_t)(unsafe.Pointer(v5)) v6 = cp cp += 4 v7 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v6)) = *(*Tuint32_t)(unsafe.Pointer(v7)) goto _2 _2: ; _x -= uint32(2) } if _x != 0 { v8 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(PALmap + uintptr(*(*uint8)(unsafe.Pointer(v8)))*4)) v9 = cp cp += 4 v10 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v9)) = *(*Tuint32_t)(unsafe.Pointer(v10)) } cp += uintptr(toskew) * 4 pp += uintptr(fromskew) goto _1 _1: ; h-- } } // C documentation // // /* // * 2-bit palette => colormap/RGB // */ func _put2bitcmaptile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var PALmap, bw, v10, v11, v12, v13, v14, v15, v16, v17, v18, v3, v4, v5, v6, v7, v8, v9 uintptr var _x Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = PALmap, _x, bw, v10, v11, v12, v13, v14, v15, v16, v17, v18, v3, v4, v5, v6, v7, v8, v9 PALmap = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FPALmap _ = x _ = y fromskew /= int32(4) for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(4)) { break } v3 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(PALmap + uintptr(*(*uint8)(unsafe.Pointer(v3)))*4)) v4 = cp cp += 4 v5 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v4)) = *(*Tuint32_t)(unsafe.Pointer(v5)) v6 = cp cp += 4 v7 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v6)) = *(*Tuint32_t)(unsafe.Pointer(v7)) v8 = cp cp += 4 v9 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v8)) = *(*Tuint32_t)(unsafe.Pointer(v9)) v10 = cp cp += 4 v11 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v10)) = *(*Tuint32_t)(unsafe.Pointer(v11)) goto _2 _2: ; _x -= uint32(4) } if _x > uint32(0) { v12 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(PALmap + uintptr(*(*uint8)(unsafe.Pointer(v12)))*4)) switch _x { case uint32(3): v13 = cp cp += 4 v14 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v13)) = *(*Tuint32_t)(unsafe.Pointer(v14)) /*-fallthrough*/ fallthrough case uint32(2): v15 = cp cp += 4 v16 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v15)) = *(*Tuint32_t)(unsafe.Pointer(v16)) /*-fallthrough*/ fallthrough case uint32(1): v17 = cp cp += 4 v18 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v17)) = *(*Tuint32_t)(unsafe.Pointer(v18)) } } cp += uintptr(toskew) * 4 pp += uintptr(fromskew) goto _1 _1: ; h-- } } // C documentation // // /* // * 1-bit palette => colormap/RGB // */ func _put1bitcmaptile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var PALmap, bw, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v4, v5, v6, v7, v8, v9 uintptr var _x Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = PALmap, _x, bw, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v4, v5, v6, v7, v8, v9 PALmap = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FPALmap _ = x _ = y fromskew /= int32(8) for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(8)) { break } v3 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(PALmap + uintptr(*(*uint8)(unsafe.Pointer(v3)))*4)) v4 = cp cp += 4 v5 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v4)) = *(*Tuint32_t)(unsafe.Pointer(v5)) v6 = cp cp += 4 v7 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v6)) = *(*Tuint32_t)(unsafe.Pointer(v7)) v8 = cp cp += 4 v9 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v8)) = *(*Tuint32_t)(unsafe.Pointer(v9)) v10 = cp cp += 4 v11 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v10)) = *(*Tuint32_t)(unsafe.Pointer(v11)) v12 = cp cp += 4 v13 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v12)) = *(*Tuint32_t)(unsafe.Pointer(v13)) v14 = cp cp += 4 v15 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v14)) = *(*Tuint32_t)(unsafe.Pointer(v15)) v16 = cp cp += 4 v17 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v16)) = *(*Tuint32_t)(unsafe.Pointer(v17)) v18 = cp cp += 4 v19 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v18)) = *(*Tuint32_t)(unsafe.Pointer(v19)) goto _2 _2: ; _x -= uint32(8) } if _x > uint32(0) { v20 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(PALmap + uintptr(*(*uint8)(unsafe.Pointer(v20)))*4)) switch _x { case uint32(7): v21 = cp cp += 4 v22 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v21)) = *(*Tuint32_t)(unsafe.Pointer(v22)) /*-fallthrough*/ fallthrough case uint32(6): v23 = cp cp += 4 v24 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v23)) = *(*Tuint32_t)(unsafe.Pointer(v24)) /*-fallthrough*/ fallthrough case uint32(5): v25 = cp cp += 4 v26 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v25)) = *(*Tuint32_t)(unsafe.Pointer(v26)) /*-fallthrough*/ fallthrough case uint32(4): v27 = cp cp += 4 v28 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v27)) = *(*Tuint32_t)(unsafe.Pointer(v28)) /*-fallthrough*/ fallthrough case uint32(3): v29 = cp cp += 4 v30 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v29)) = *(*Tuint32_t)(unsafe.Pointer(v30)) /*-fallthrough*/ fallthrough case uint32(2): v31 = cp cp += 4 v32 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v31)) = *(*Tuint32_t)(unsafe.Pointer(v32)) /*-fallthrough*/ fallthrough case uint32(1): v33 = cp cp += 4 v34 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v33)) = *(*Tuint32_t)(unsafe.Pointer(v34)) } } cp += uintptr(toskew) * 4 pp += uintptr(fromskew) goto _1 _1: ; h-- } } // C documentation // // /* // * 8-bit greyscale => colormap/RGB // */ func _putgreytile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var BWmap, v3 uintptr var samplesperpixel int32 _, _, _ = BWmap, samplesperpixel, v3 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) BWmap = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FBWmap _ = y for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = *(*Tuint32_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(BWmap + uintptr(*(*uint8)(unsafe.Pointer(pp)))*4)))) pp += uintptr(samplesperpixel) goto _2 _2: ; x-- } cp += uintptr(toskew) * 4 pp += uintptr(fromskew) goto _1 _1: ; h-- } } // C documentation // // /* // * 8-bit greyscale with associated alpha => colormap/RGBA // */ func _putagreytile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var BWmap, v3 uintptr var samplesperpixel int32 _, _, _ = BWmap, samplesperpixel, v3 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) BWmap = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FBWmap _ = y for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = *(*Tuint32_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(BWmap + uintptr(*(*uint8)(unsafe.Pointer(pp)))*4)))) & (uint32(*(*uint8)(unsafe.Pointer(pp + libc.UintptrFromInt32(1))))< colormap/RGB // */ func _put16bitbwtile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var BWmap, wp, v3 uintptr var samplesperpixel int32 _, _, _, _ = BWmap, samplesperpixel, wp, v3 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) BWmap = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FBWmap _ = y for { if !(h > uint32(0)) { break } wp = pp x = w for { if !(x > uint32(0)) { break } /* use high order byte of 16bit value */ v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = *(*Tuint32_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(BWmap + uintptr(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(wp)))>>int32(8))*4)))) pp += uintptr(int32(2) * samplesperpixel) wp += uintptr(samplesperpixel) * 2 goto _2 _2: ; x-- } cp += uintptr(toskew) * 4 pp += uintptr(fromskew) goto _1 _1: ; h-- } } // C documentation // // /* // * 1-bit bilevel => colormap/RGB // */ func _put1bitbwtile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var BWmap, bw, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v4, v5, v6, v7, v8, v9 uintptr var _x Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = BWmap, _x, bw, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v4, v5, v6, v7, v8, v9 BWmap = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FBWmap _ = x _ = y fromskew /= int32(8) for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(8)) { break } v3 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(BWmap + uintptr(*(*uint8)(unsafe.Pointer(v3)))*4)) v4 = cp cp += 4 v5 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v4)) = *(*Tuint32_t)(unsafe.Pointer(v5)) v6 = cp cp += 4 v7 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v6)) = *(*Tuint32_t)(unsafe.Pointer(v7)) v8 = cp cp += 4 v9 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v8)) = *(*Tuint32_t)(unsafe.Pointer(v9)) v10 = cp cp += 4 v11 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v10)) = *(*Tuint32_t)(unsafe.Pointer(v11)) v12 = cp cp += 4 v13 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v12)) = *(*Tuint32_t)(unsafe.Pointer(v13)) v14 = cp cp += 4 v15 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v14)) = *(*Tuint32_t)(unsafe.Pointer(v15)) v16 = cp cp += 4 v17 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v16)) = *(*Tuint32_t)(unsafe.Pointer(v17)) v18 = cp cp += 4 v19 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v18)) = *(*Tuint32_t)(unsafe.Pointer(v19)) goto _2 _2: ; _x -= uint32(8) } if _x > uint32(0) { v20 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(BWmap + uintptr(*(*uint8)(unsafe.Pointer(v20)))*4)) switch _x { case uint32(7): v21 = cp cp += 4 v22 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v21)) = *(*Tuint32_t)(unsafe.Pointer(v22)) /*-fallthrough*/ fallthrough case uint32(6): v23 = cp cp += 4 v24 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v23)) = *(*Tuint32_t)(unsafe.Pointer(v24)) /*-fallthrough*/ fallthrough case uint32(5): v25 = cp cp += 4 v26 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v25)) = *(*Tuint32_t)(unsafe.Pointer(v26)) /*-fallthrough*/ fallthrough case uint32(4): v27 = cp cp += 4 v28 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v27)) = *(*Tuint32_t)(unsafe.Pointer(v28)) /*-fallthrough*/ fallthrough case uint32(3): v29 = cp cp += 4 v30 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v29)) = *(*Tuint32_t)(unsafe.Pointer(v30)) /*-fallthrough*/ fallthrough case uint32(2): v31 = cp cp += 4 v32 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v31)) = *(*Tuint32_t)(unsafe.Pointer(v32)) /*-fallthrough*/ fallthrough case uint32(1): v33 = cp cp += 4 v34 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v33)) = *(*Tuint32_t)(unsafe.Pointer(v34)) } } cp += uintptr(toskew) * 4 pp += uintptr(fromskew) goto _1 _1: ; h-- } } // C documentation // // /* // * 2-bit greyscale => colormap/RGB // */ func _put2bitbwtile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var BWmap, bw, v10, v11, v12, v13, v14, v15, v16, v17, v18, v3, v4, v5, v6, v7, v8, v9 uintptr var _x Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = BWmap, _x, bw, v10, v11, v12, v13, v14, v15, v16, v17, v18, v3, v4, v5, v6, v7, v8, v9 BWmap = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FBWmap _ = x _ = y fromskew /= int32(4) for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(4)) { break } v3 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(BWmap + uintptr(*(*uint8)(unsafe.Pointer(v3)))*4)) v4 = cp cp += 4 v5 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v4)) = *(*Tuint32_t)(unsafe.Pointer(v5)) v6 = cp cp += 4 v7 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v6)) = *(*Tuint32_t)(unsafe.Pointer(v7)) v8 = cp cp += 4 v9 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v8)) = *(*Tuint32_t)(unsafe.Pointer(v9)) v10 = cp cp += 4 v11 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v10)) = *(*Tuint32_t)(unsafe.Pointer(v11)) goto _2 _2: ; _x -= uint32(4) } if _x > uint32(0) { v12 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(BWmap + uintptr(*(*uint8)(unsafe.Pointer(v12)))*4)) switch _x { case uint32(3): v13 = cp cp += 4 v14 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v13)) = *(*Tuint32_t)(unsafe.Pointer(v14)) /*-fallthrough*/ fallthrough case uint32(2): v15 = cp cp += 4 v16 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v15)) = *(*Tuint32_t)(unsafe.Pointer(v16)) /*-fallthrough*/ fallthrough case uint32(1): v17 = cp cp += 4 v18 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v17)) = *(*Tuint32_t)(unsafe.Pointer(v18)) } } cp += uintptr(toskew) * 4 pp += uintptr(fromskew) goto _1 _1: ; h-- } } // C documentation // // /* // * 4-bit greyscale => colormap/RGB // */ func _put4bitbwtile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var BWmap, bw, v10, v3, v4, v5, v6, v7, v8, v9 uintptr var _x Tuint32_t _, _, _, _, _, _, _, _, _, _, _ = BWmap, _x, bw, v10, v3, v4, v5, v6, v7, v8, v9 BWmap = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FBWmap _ = x _ = y fromskew /= int32(2) for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(2)) { break } v3 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(BWmap + uintptr(*(*uint8)(unsafe.Pointer(v3)))*4)) v4 = cp cp += 4 v5 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v4)) = *(*Tuint32_t)(unsafe.Pointer(v5)) v6 = cp cp += 4 v7 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v6)) = *(*Tuint32_t)(unsafe.Pointer(v7)) goto _2 _2: ; _x -= uint32(2) } if _x != 0 { v8 = pp pp++ bw = *(*uintptr)(unsafe.Pointer(BWmap + uintptr(*(*uint8)(unsafe.Pointer(v8)))*4)) v9 = cp cp += 4 v10 = bw bw += 4 *(*Tuint32_t)(unsafe.Pointer(v9)) = *(*Tuint32_t)(unsafe.Pointer(v10)) } cp += uintptr(toskew) * 4 pp += uintptr(fromskew) goto _1 _1: ; h-- } } // C documentation // // /* // * 8-bit packed samples, no Map => RGB // */ func _putRGBcontig8bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var _x Tuint32_t var samplesperpixel int32 var v10, v11, v12, v13, v14, v15, v16, v17, v3, v4, v5, v6, v7, v8, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = _x, samplesperpixel, v10, v11, v12, v13, v14, v15, v16, v17, v3, v4, v5, v6, v7, v8, v9 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) _ = x _ = y fromskew *= samplesperpixel for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(8)) { break } v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(*(*uint8)(unsafe.Pointer(pp))) | uint32(*(*uint8)(unsafe.Pointer(pp + 1)))< uint32(0) { switch _x { case uint32(7): v11 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v11)) = uint32(*(*uint8)(unsafe.Pointer(pp))) | uint32(*(*uint8)(unsafe.Pointer(pp + 1)))< RGBA w/ associated alpha // * (known to have Map == NULL) // */ func _putRGBAAcontig8bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var _x Tuint32_t var samplesperpixel int32 var v10, v11, v12, v13, v14, v15, v16, v17, v3, v4, v5, v6, v7, v8, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = _x, samplesperpixel, v10, v11, v12, v13, v14, v15, v16, v17, v3, v4, v5, v6, v7, v8, v9 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) _ = x _ = y fromskew *= samplesperpixel for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(8)) { break } v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(*(*uint8)(unsafe.Pointer(pp))) | uint32(*(*uint8)(unsafe.Pointer(pp + 1)))< uint32(0) { switch _x { case uint32(7): v11 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v11)) = uint32(*(*uint8)(unsafe.Pointer(pp))) | uint32(*(*uint8)(unsafe.Pointer(pp + 1)))< RGBA w/ unassociated alpha // * (known to have Map == NULL) // */ func _putRGBUAcontig8bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var a, b, g, r Tuint32_t var m, v3 uintptr var samplesperpixel int32 _, _, _, _, _, _, _ = a, b, g, m, r, samplesperpixel, v3 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) _ = y fromskew *= samplesperpixel for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } a = uint32(*(*uint8)(unsafe.Pointer(pp + 3))) m = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FUaToAa + uintptr(a< RGB // */ func _putRGBcontig16bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var samplesperpixel int32 var wp, v3 uintptr _, _, _ = samplesperpixel, wp, v3 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) wp = pp _ = y fromskew *= samplesperpixel for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(*(*Tuint8_t)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBitdepth16To8 + uintptr(*(*Tuint16_t)(unsafe.Pointer(wp)))))) | uint32(*(*Tuint8_t)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBitdepth16To8 + uintptr(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))))))< RGBA w/ associated alpha // * (known to have Map == NULL) // */ func _putRGBAAcontig16bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var samplesperpixel int32 var wp, v3 uintptr _, _, _ = samplesperpixel, wp, v3 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) wp = pp _ = y fromskew *= samplesperpixel for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(*(*Tuint8_t)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBitdepth16To8 + uintptr(*(*Tuint16_t)(unsafe.Pointer(wp)))))) | uint32(*(*Tuint8_t)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBitdepth16To8 + uintptr(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))))))< RGBA w/ unassociated alpha // * (known to have Map == NULL) // */ func _putRGBUAcontig16bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var a, b, g, r Tuint32_t var m, wp, v3 uintptr var samplesperpixel int32 _, _, _, _, _, _, _, _ = a, b, g, m, r, samplesperpixel, wp, v3 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) wp = pp _ = y fromskew *= samplesperpixel for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } a = uint32(*(*Tuint8_t)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBitdepth16To8 + uintptr(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2)))))) m = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FUaToAa + uintptr(a< RGB // * // * NB: The conversion of CMYK->RGB is *very* crude. // */ func _putRGBcontig8bitCMYKtile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var _x Tuint32_t var b, g, k, r Tuint16_t var samplesperpixel int32 var v10, v11, v12, v13, v14, v15, v16, v17, v3, v4, v5, v6, v7, v8, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = _x, b, g, k, r, samplesperpixel, v10, v11, v12, v13, v14, v15, v16, v17, v3, v4, v5, v6, v7, v8, v9 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) _ = x _ = y fromskew *= samplesperpixel for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(8)) { break } k = libc.Uint16FromInt32(int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 3)))) r = libc.Uint16FromInt32(libc.Int32FromUint16(k) * (int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp)))) / int32(255)) g = libc.Uint16FromInt32(libc.Int32FromUint16(k) * (int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 1)))) / int32(255)) b = libc.Uint16FromInt32(libc.Int32FromUint16(k) * (int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 2)))) / int32(255)) v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(r) | uint32(g)< uint32(0) { switch _x { case uint32(7): k = libc.Uint16FromInt32(int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 3)))) r = libc.Uint16FromInt32(libc.Int32FromUint16(k) * (int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp)))) / int32(255)) g = libc.Uint16FromInt32(libc.Int32FromUint16(k) * (int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 1)))) / int32(255)) b = libc.Uint16FromInt32(libc.Int32FromUint16(k) * (int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 2)))) / int32(255)) v11 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v11)) = uint32(r) | uint32(g)< RGB // * // * NB: The conversion of CMYK->RGB is *very* crude. // */ func _putRGBcontig8bitCMYKMaptile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { var Map, v3 uintptr var b, g, k, r Tuint16_t var samplesperpixel int32 _, _, _, _, _, _, _ = Map, b, g, k, r, samplesperpixel, v3 samplesperpixel = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) Map = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FMap _ = y fromskew *= samplesperpixel for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } k = libc.Uint16FromInt32(int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 3)))) r = libc.Uint16FromInt32(libc.Int32FromUint16(k) * (int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp)))) / int32(255)) g = libc.Uint16FromInt32(libc.Int32FromUint16(k) * (int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 1)))) / int32(255)) b = libc.Uint16FromInt32(libc.Int32FromUint16(k) * (int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 2)))) / int32(255)) v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(*(*TTIFFRGBValue)(unsafe.Pointer(Map + uintptr(r)))) | uint32(*(*TTIFFRGBValue)(unsafe.Pointer(Map + uintptr(g))))< RGB // */ func _putRGBseparate8bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, r uintptr, g uintptr, b uintptr, a uintptr) { var _x Tuint32_t var v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v5, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v6, v60, v61, v62, v7, v8, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = _x, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v5, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v6, v60, v61, v62, v7, v8, v9 _ = img _ = x _ = y _ = a for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(8)) { break } v3 = cp cp += 4 v4 = r r++ v5 = g g++ v6 = b b++ *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(*(*uint8)(unsafe.Pointer(v4))) | uint32(*(*uint8)(unsafe.Pointer(v5)))< uint32(0) { switch _x { case uint32(7): v35 = cp cp += 4 v36 = r r++ v37 = g g++ v38 = b b++ *(*Tuint32_t)(unsafe.Pointer(v35)) = uint32(*(*uint8)(unsafe.Pointer(v36))) | uint32(*(*uint8)(unsafe.Pointer(v37)))< RGBA w/ associated alpha // */ func _putRGBAAseparate8bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, r uintptr, g uintptr, b uintptr, a uintptr) { var _x Tuint32_t var v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v5, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v6, v60, v61, v62, v63, v64, v65, v66, v67, v68, v69, v7, v70, v71, v72, v73, v74, v75, v76, v77, v8, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = _x, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v5, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v6, v60, v61, v62, v63, v64, v65, v66, v67, v68, v69, v7, v70, v71, v72, v73, v74, v75, v76, v77, v8, v9 _ = img _ = x _ = y for { if !(h > uint32(0)) { break } _x = w for { if !(_x >= uint32(8)) { break } v3 = cp cp += 4 v4 = r r++ v5 = g g++ v6 = b b++ v7 = a a++ *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(*(*uint8)(unsafe.Pointer(v4))) | uint32(*(*uint8)(unsafe.Pointer(v5)))< uint32(0) { switch _x { case uint32(7): v43 = cp cp += 4 v44 = r r++ v45 = g g++ v46 = b b++ v47 = a a++ *(*Tuint32_t)(unsafe.Pointer(v43)) = uint32(*(*uint8)(unsafe.Pointer(v44))) | uint32(*(*uint8)(unsafe.Pointer(v45)))< RGBA // */ func _putCMYKseparate8bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, r uintptr, g uintptr, b uintptr, a uintptr) { var bv, gv, kv, rv Tuint32_t var v3, v4, v5, v6, v7 uintptr _, _, _, _, _, _, _, _, _ = bv, gv, kv, rv, v3, v4, v5, v6, v7 _ = img _ = y for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } v3 = a a++ kv = libc.Uint32FromInt32(int32(255) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v3)))) v4 = r r++ rv = kv * libc.Uint32FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v4)))) / uint32(255) v5 = g g++ gv = kv * libc.Uint32FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v5)))) / uint32(255) v6 = b b++ bv = kv * libc.Uint32FromInt32(libc.Int32FromInt32(255)-libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v6)))) / uint32(255) v7 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v7)) = rv | gv< RGBA w/ unassociated alpha // */ func _putRGBUAseparate8bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, r uintptr, g uintptr, b uintptr, a uintptr) { var av, bv, gv, rv Tuint32_t var m, v3, v4, v5, v6, v7 uintptr _, _, _, _, _, _, _, _, _, _ = av, bv, gv, m, rv, v3, v4, v5, v6, v7 _ = img _ = y for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } v3 = a a++ av = uint32(*(*uint8)(unsafe.Pointer(v3))) m = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FUaToAa + uintptr(av< RGB // */ func _putRGBseparate16bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, r uintptr, g uintptr, b uintptr, a uintptr) { var wb, wg, wr, v3, v4, v5, v6 uintptr _, _, _, _, _, _, _ = wb, wg, wr, v3, v4, v5, v6 wr = r wg = g wb = b _ = img _ = y _ = a for { if !(h > uint32(0)) { break } x = uint32(0) for { if !(x < w) { break } v3 = cp cp += 4 v4 = wr wr += 2 v5 = wg wg += 2 v6 = wb wb += 2 *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(*(*Tuint8_t)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBitdepth16To8 + uintptr(*(*Tuint16_t)(unsafe.Pointer(v4)))))) | uint32(*(*Tuint8_t)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBitdepth16To8 + uintptr(*(*Tuint16_t)(unsafe.Pointer(v5))))))< RGBA w/ associated alpha // */ func _putRGBAAseparate16bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, r uintptr, g uintptr, b uintptr, a uintptr) { var wa, wb, wg, wr, v3, v4, v5, v6, v7 uintptr _, _, _, _, _, _, _, _, _ = wa, wb, wg, wr, v3, v4, v5, v6, v7 wr = r wg = g wb = b wa = a _ = img _ = y for { if !(h > uint32(0)) { break } x = uint32(0) for { if !(x < w) { break } v3 = cp cp += 4 v4 = wr wr += 2 v5 = wg wg += 2 v6 = wb wb += 2 v7 = wa wa += 2 *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(*(*Tuint8_t)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBitdepth16To8 + uintptr(*(*Tuint16_t)(unsafe.Pointer(v4)))))) | uint32(*(*Tuint8_t)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBitdepth16To8 + uintptr(*(*Tuint16_t)(unsafe.Pointer(v5))))))< RGBA w/ unassociated alpha // */ func _putRGBUAseparate16bittile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, r uintptr, g uintptr, b uintptr, a uintptr) { var a2, b2, g2, r2 Tuint32_t var m, wa, wb, wg, wr, v3, v4, v5, v6, v7 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a2, b2, g2, m, r2, wa, wb, wg, wr, v3, v4, v5, v6, v7 wr = r wg = g wb = b wa = a _ = img _ = y for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } v3 = wa wa += 2 a2 = uint32(*(*Tuint8_t)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBitdepth16To8 + uintptr(*(*Tuint16_t)(unsafe.Pointer(v3)))))) m = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FUaToAa + uintptr(a2< RGB // */ func _putcontig8bitCIELab8(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var v3 uintptr var _ /* X at bp+0 */ float32 var _ /* Y at bp+4 */ float32 var _ /* Z at bp+8 */ float32 var _ /* b at bp+20 */ Tuint32_t var _ /* g at bp+16 */ Tuint32_t var _ /* r at bp+12 */ Tuint32_t _ = v3 _ = y fromskew *= int32(3) for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } XTIFFCIELabToXYZ(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcielab, uint32(*(*uint8)(unsafe.Pointer(pp))), int32(libc.Int8FromUint8(*(*uint8)(unsafe.Pointer(pp + 1)))), int32(libc.Int8FromUint8(*(*uint8)(unsafe.Pointer(pp + 2)))), bp, bp+4, bp+8) XTIFFXYZToRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcielab, *(*float32)(unsafe.Pointer(bp)), *(*float32)(unsafe.Pointer(bp + 4)), *(*float32)(unsafe.Pointer(bp + 8)), bp+12, bp+16, bp+20) v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = *(*Tuint32_t)(unsafe.Pointer(bp + 12)) | *(*Tuint32_t)(unsafe.Pointer(bp + 16))< RGB // */ func _putcontig8bitCIELab16(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var wp, v3 uintptr var _ /* X at bp+0 */ float32 var _ /* Y at bp+4 */ float32 var _ /* Z at bp+8 */ float32 var _ /* b at bp+20 */ Tuint32_t var _ /* g at bp+16 */ Tuint32_t var _ /* r at bp+12 */ Tuint32_t _, _ = wp, v3 wp = pp _ = y fromskew *= int32(3) for { if !(h > uint32(0)) { break } x = w for { if !(x > uint32(0)) { break } XTIFFCIELab16ToXYZ(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcielab, uint32(*(*Tuint16_t)(unsafe.Pointer(wp))), int32(libc.Int16FromUint16(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2)))), int32(libc.Int16FromUint16(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2)))), bp, bp+4, bp+8) XTIFFXYZToRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcielab, *(*float32)(unsafe.Pointer(bp)), *(*float32)(unsafe.Pointer(bp + 4)), *(*float32)(unsafe.Pointer(bp + 8)), bp+12, bp+16, bp+20) v3 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = *(*Tuint32_t)(unsafe.Pointer(bp + 12)) | *(*Tuint32_t)(unsafe.Pointer(bp + 16))< RGB conversion and packing routines. */ // C documentation // // /* // * 8-bit packed YCbCr samples w/ 4,4 subsampling => RGB // */ func _putcontig8bitYCbCr44tile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { bp := tls.Alloc(384) defer tls.Free(384) var Cb, Cb1, Cr, Cr1, incr Tint32_t var cp1, cp2, cp3 uintptr var v2 Tuint32_t var _ /* b at bp+104 */ Tuint32_t var _ /* b at bp+116 */ Tuint32_t var _ /* b at bp+128 */ Tuint32_t var _ /* b at bp+140 */ Tuint32_t var _ /* b at bp+152 */ Tuint32_t var _ /* b at bp+164 */ Tuint32_t var _ /* b at bp+176 */ Tuint32_t var _ /* b at bp+188 */ Tuint32_t var _ /* b at bp+20 */ Tuint32_t var _ /* b at bp+200 */ Tuint32_t var _ /* b at bp+212 */ Tuint32_t var _ /* b at bp+224 */ Tuint32_t var _ /* b at bp+236 */ Tuint32_t var _ /* b at bp+248 */ Tuint32_t var _ /* b at bp+260 */ Tuint32_t var _ /* b at bp+272 */ Tuint32_t var _ /* b at bp+284 */ Tuint32_t var _ /* b at bp+296 */ Tuint32_t var _ /* b at bp+308 */ Tuint32_t var _ /* b at bp+32 */ Tuint32_t var _ /* b at bp+320 */ Tuint32_t var _ /* b at bp+332 */ Tuint32_t var _ /* b at bp+344 */ Tuint32_t var _ /* b at bp+356 */ Tuint32_t var _ /* b at bp+368 */ Tuint32_t var _ /* b at bp+380 */ Tuint32_t var _ /* b at bp+44 */ Tuint32_t var _ /* b at bp+56 */ Tuint32_t var _ /* b at bp+68 */ Tuint32_t var _ /* b at bp+8 */ Tuint32_t var _ /* b at bp+80 */ Tuint32_t var _ /* b at bp+92 */ Tuint32_t var _ /* g at bp+100 */ Tuint32_t var _ /* g at bp+112 */ Tuint32_t var _ /* g at bp+124 */ Tuint32_t var _ /* g at bp+136 */ Tuint32_t var _ /* g at bp+148 */ Tuint32_t var _ /* g at bp+16 */ Tuint32_t var _ /* g at bp+160 */ Tuint32_t var _ /* g at bp+172 */ Tuint32_t var _ /* g at bp+184 */ Tuint32_t var _ /* g at bp+196 */ Tuint32_t var _ /* g at bp+208 */ Tuint32_t var _ /* g at bp+220 */ Tuint32_t var _ /* g at bp+232 */ Tuint32_t var _ /* g at bp+244 */ Tuint32_t var _ /* g at bp+256 */ Tuint32_t var _ /* g at bp+268 */ Tuint32_t var _ /* g at bp+28 */ Tuint32_t var _ /* g at bp+280 */ Tuint32_t var _ /* g at bp+292 */ Tuint32_t var _ /* g at bp+304 */ Tuint32_t var _ /* g at bp+316 */ Tuint32_t var _ /* g at bp+328 */ Tuint32_t var _ /* g at bp+340 */ Tuint32_t var _ /* g at bp+352 */ Tuint32_t var _ /* g at bp+364 */ Tuint32_t var _ /* g at bp+376 */ Tuint32_t var _ /* g at bp+4 */ Tuint32_t var _ /* g at bp+40 */ Tuint32_t var _ /* g at bp+52 */ Tuint32_t var _ /* g at bp+64 */ Tuint32_t var _ /* g at bp+76 */ Tuint32_t var _ /* g at bp+88 */ Tuint32_t var _ /* r at bp+0 */ Tuint32_t var _ /* r at bp+108 */ Tuint32_t var _ /* r at bp+12 */ Tuint32_t var _ /* r at bp+120 */ Tuint32_t var _ /* r at bp+132 */ Tuint32_t var _ /* r at bp+144 */ Tuint32_t var _ /* r at bp+156 */ Tuint32_t var _ /* r at bp+168 */ Tuint32_t var _ /* r at bp+180 */ Tuint32_t var _ /* r at bp+192 */ Tuint32_t var _ /* r at bp+204 */ Tuint32_t var _ /* r at bp+216 */ Tuint32_t var _ /* r at bp+228 */ Tuint32_t var _ /* r at bp+24 */ Tuint32_t var _ /* r at bp+240 */ Tuint32_t var _ /* r at bp+252 */ Tuint32_t var _ /* r at bp+264 */ Tuint32_t var _ /* r at bp+276 */ Tuint32_t var _ /* r at bp+288 */ Tuint32_t var _ /* r at bp+300 */ Tuint32_t var _ /* r at bp+312 */ Tuint32_t var _ /* r at bp+324 */ Tuint32_t var _ /* r at bp+336 */ Tuint32_t var _ /* r at bp+348 */ Tuint32_t var _ /* r at bp+36 */ Tuint32_t var _ /* r at bp+360 */ Tuint32_t var _ /* r at bp+372 */ Tuint32_t var _ /* r at bp+48 */ Tuint32_t var _ /* r at bp+60 */ Tuint32_t var _ /* r at bp+72 */ Tuint32_t var _ /* r at bp+84 */ Tuint32_t var _ /* r at bp+96 */ Tuint32_t _, _, _, _, _, _, _, _, _ = Cb, Cb1, Cr, Cr1, cp1, cp2, cp3, incr, v2 cp1 = cp + uintptr(w)*4 + uintptr(toskew)*4 cp2 = cp1 + uintptr(w)*4 + uintptr(toskew)*4 cp3 = cp2 + uintptr(w)*4 + uintptr(toskew)*4 incr = libc.Int32FromUint32(uint32(3)*w + libc.Uint32FromInt32(int32(4)*toskew)) _ = y /* adjust fromskew */ fromskew = fromskew / int32(4) * (libc.Int32FromInt32(4)*libc.Int32FromInt32(2) + libc.Int32FromInt32(2)) if h&uint32(3) == uint32(0) && w&uint32(3) == uint32(0) { for { if !(h >= uint32(4)) { break } x = w >> int32(2) for { Cb = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 16))) Cr = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 17))) XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(pp))), Cb, Cr, bp, bp+4, bp+8) *(*Tuint32_t)(unsafe.Pointer(cp)) = *(*Tuint32_t)(unsafe.Pointer(bp)) | *(*Tuint32_t)(unsafe.Pointer(bp + 4))< uint32(0) { x = w for { if !(x > uint32(0)) { break } Cb1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 16))) Cr1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 17))) switch x { default: switch h { default: XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(pp + 15))), Cb1, Cr1, bp+192, bp+196, bp+200) *(*Tuint32_t)(unsafe.Pointer(cp3 + 3*4)) = *(*Tuint32_t)(unsafe.Pointer(bp + 192)) | *(*Tuint32_t)(unsafe.Pointer(bp + 196))< RGB // */ func _putcontig8bitYCbCr42tile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { bp := tls.Alloc(192) defer tls.Free(192) var Cb, Cb1, Cr, Cr1, incr Tint32_t var cp1 uintptr var v2 Tuint32_t var _ /* b at bp+104 */ Tuint32_t var _ /* b at bp+116 */ Tuint32_t var _ /* b at bp+128 */ Tuint32_t var _ /* b at bp+140 */ Tuint32_t var _ /* b at bp+152 */ Tuint32_t var _ /* b at bp+164 */ Tuint32_t var _ /* b at bp+176 */ Tuint32_t var _ /* b at bp+188 */ Tuint32_t var _ /* b at bp+20 */ Tuint32_t var _ /* b at bp+32 */ Tuint32_t var _ /* b at bp+44 */ Tuint32_t var _ /* b at bp+56 */ Tuint32_t var _ /* b at bp+68 */ Tuint32_t var _ /* b at bp+8 */ Tuint32_t var _ /* b at bp+80 */ Tuint32_t var _ /* b at bp+92 */ Tuint32_t var _ /* g at bp+100 */ Tuint32_t var _ /* g at bp+112 */ Tuint32_t var _ /* g at bp+124 */ Tuint32_t var _ /* g at bp+136 */ Tuint32_t var _ /* g at bp+148 */ Tuint32_t var _ /* g at bp+16 */ Tuint32_t var _ /* g at bp+160 */ Tuint32_t var _ /* g at bp+172 */ Tuint32_t var _ /* g at bp+184 */ Tuint32_t var _ /* g at bp+28 */ Tuint32_t var _ /* g at bp+4 */ Tuint32_t var _ /* g at bp+40 */ Tuint32_t var _ /* g at bp+52 */ Tuint32_t var _ /* g at bp+64 */ Tuint32_t var _ /* g at bp+76 */ Tuint32_t var _ /* g at bp+88 */ Tuint32_t var _ /* r at bp+0 */ Tuint32_t var _ /* r at bp+108 */ Tuint32_t var _ /* r at bp+12 */ Tuint32_t var _ /* r at bp+120 */ Tuint32_t var _ /* r at bp+132 */ Tuint32_t var _ /* r at bp+144 */ Tuint32_t var _ /* r at bp+156 */ Tuint32_t var _ /* r at bp+168 */ Tuint32_t var _ /* r at bp+180 */ Tuint32_t var _ /* r at bp+24 */ Tuint32_t var _ /* r at bp+36 */ Tuint32_t var _ /* r at bp+48 */ Tuint32_t var _ /* r at bp+60 */ Tuint32_t var _ /* r at bp+72 */ Tuint32_t var _ /* r at bp+84 */ Tuint32_t var _ /* r at bp+96 */ Tuint32_t _, _, _, _, _, _, _ = Cb, Cb1, Cr, Cr1, cp1, incr, v2 cp1 = cp + uintptr(w)*4 + uintptr(toskew)*4 incr = libc.Int32FromUint32(libc.Uint32FromInt32(int32(2)*toskew) + w) _ = y fromskew = fromskew / int32(4) * (libc.Int32FromInt32(4)*libc.Int32FromInt32(2) + libc.Int32FromInt32(2)) if w&uint32(3) == uint32(0) && h&uint32(1) == uint32(0) { for { if !(h >= uint32(2)) { break } x = w >> int32(2) for { Cb = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 8))) Cr = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 9))) XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(pp))), Cb, Cr, bp, bp+4, bp+8) *(*Tuint32_t)(unsafe.Pointer(cp)) = *(*Tuint32_t)(unsafe.Pointer(bp)) | *(*Tuint32_t)(unsafe.Pointer(bp + 4))< uint32(0) { x = w for { if !(x > uint32(0)) { break } Cb1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 8))) Cr1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 9))) switch x { default: switch h { default: XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(pp + 7))), Cb1, Cr1, bp+96, bp+100, bp+104) *(*Tuint32_t)(unsafe.Pointer(cp1 + 3*4)) = *(*Tuint32_t)(unsafe.Pointer(bp + 96)) | *(*Tuint32_t)(unsafe.Pointer(bp + 100))< RGB // */ func _putcontig8bitYCbCr41tile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { bp := tls.Alloc(96) defer tls.Free(96) var Cb, Cb1, Cr, Cr1 Tint32_t var v1 Tuint32_t var _ /* b at bp+20 */ Tuint32_t var _ /* b at bp+32 */ Tuint32_t var _ /* b at bp+44 */ Tuint32_t var _ /* b at bp+56 */ Tuint32_t var _ /* b at bp+68 */ Tuint32_t var _ /* b at bp+8 */ Tuint32_t var _ /* b at bp+80 */ Tuint32_t var _ /* g at bp+16 */ Tuint32_t var _ /* g at bp+28 */ Tuint32_t var _ /* g at bp+4 */ Tuint32_t var _ /* g at bp+40 */ Tuint32_t var _ /* g at bp+52 */ Tuint32_t var _ /* g at bp+64 */ Tuint32_t var _ /* g at bp+76 */ Tuint32_t var _ /* r at bp+0 */ Tuint32_t var _ /* r at bp+12 */ Tuint32_t var _ /* r at bp+24 */ Tuint32_t var _ /* r at bp+36 */ Tuint32_t var _ /* r at bp+48 */ Tuint32_t var _ /* r at bp+60 */ Tuint32_t var _ /* r at bp+72 */ Tuint32_t _, _, _, _, _ = Cb, Cb1, Cr, Cr1, v1 _ = y fromskew = fromskew / int32(4) * (libc.Int32FromInt32(4)*libc.Int32FromInt32(1) + libc.Int32FromInt32(2)) for { x = w >> int32(2) for x > uint32(0) { Cb = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 4))) Cr = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 5))) XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(pp))), Cb, Cr, bp, bp+4, bp+8) *(*Tuint32_t)(unsafe.Pointer(cp)) = *(*Tuint32_t)(unsafe.Pointer(bp)) | *(*Tuint32_t)(unsafe.Pointer(bp + 4))< RGB // */ func _putcontig8bitYCbCr22tile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { bp := tls.Alloc(112) defer tls.Free(112) var Cb, Cb1, Cb2, Cb3, Cr, Cr1, Cr2, Cr3 Tuint32_t var cp2 uintptr var incr Tint32_t var _ /* b at bp+104 */ Tuint32_t var _ /* b at bp+20 */ Tuint32_t var _ /* b at bp+32 */ Tuint32_t var _ /* b at bp+44 */ Tuint32_t var _ /* b at bp+56 */ Tuint32_t var _ /* b at bp+68 */ Tuint32_t var _ /* b at bp+8 */ Tuint32_t var _ /* b at bp+80 */ Tuint32_t var _ /* b at bp+92 */ Tuint32_t var _ /* g at bp+100 */ Tuint32_t var _ /* g at bp+16 */ Tuint32_t var _ /* g at bp+28 */ Tuint32_t var _ /* g at bp+4 */ Tuint32_t var _ /* g at bp+40 */ Tuint32_t var _ /* g at bp+52 */ Tuint32_t var _ /* g at bp+64 */ Tuint32_t var _ /* g at bp+76 */ Tuint32_t var _ /* g at bp+88 */ Tuint32_t var _ /* r at bp+0 */ Tuint32_t var _ /* r at bp+12 */ Tuint32_t var _ /* r at bp+24 */ Tuint32_t var _ /* r at bp+36 */ Tuint32_t var _ /* r at bp+48 */ Tuint32_t var _ /* r at bp+60 */ Tuint32_t var _ /* r at bp+72 */ Tuint32_t var _ /* r at bp+84 */ Tuint32_t var _ /* r at bp+96 */ Tuint32_t _, _, _, _, _, _, _, _, _, _ = Cb, Cb1, Cb2, Cb3, Cr, Cr1, Cr2, Cr3, cp2, incr incr = libc.Int32FromUint32(libc.Uint32FromInt32(int32(2)*toskew) + w) _ = y fromskew = fromskew / int32(2) * (libc.Int32FromInt32(2)*libc.Int32FromInt32(2) + libc.Int32FromInt32(2)) cp2 = cp + uintptr(w)*4 + uintptr(toskew)*4 for h >= uint32(2) { x = w for x >= uint32(2) { Cb = uint32(*(*uint8)(unsafe.Pointer(pp + 4))) Cr = uint32(*(*uint8)(unsafe.Pointer(pp + 5))) XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(pp))), libc.Int32FromUint32(Cb), libc.Int32FromUint32(Cr), bp, bp+4, bp+8) *(*Tuint32_t)(unsafe.Pointer(cp)) = *(*Tuint32_t)(unsafe.Pointer(bp)) | *(*Tuint32_t)(unsafe.Pointer(bp + 4))<= uint32(2) { Cb2 = uint32(*(*uint8)(unsafe.Pointer(pp + 4))) Cr2 = uint32(*(*uint8)(unsafe.Pointer(pp + 5))) XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(pp))), libc.Int32FromUint32(Cb2), libc.Int32FromUint32(Cr2), bp+72, bp+76, bp+80) *(*Tuint32_t)(unsafe.Pointer(cp)) = *(*Tuint32_t)(unsafe.Pointer(bp + 72)) | *(*Tuint32_t)(unsafe.Pointer(bp + 76))< RGB // */ func _putcontig8bitYCbCr21tile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var Cb, Cb1, Cr, Cr1 Tint32_t var v1 Tuint32_t var _ /* b at bp+20 */ Tuint32_t var _ /* b at bp+32 */ Tuint32_t var _ /* b at bp+8 */ Tuint32_t var _ /* g at bp+16 */ Tuint32_t var _ /* g at bp+28 */ Tuint32_t var _ /* g at bp+4 */ Tuint32_t var _ /* r at bp+0 */ Tuint32_t var _ /* r at bp+12 */ Tuint32_t var _ /* r at bp+24 */ Tuint32_t _, _, _, _, _ = Cb, Cb1, Cr, Cr1, v1 _ = y fromskew = fromskew / int32(2) * (libc.Int32FromInt32(2)*libc.Int32FromInt32(1) + libc.Int32FromInt32(2)) for { x = w >> int32(1) for x > uint32(0) { Cb = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 2))) Cr = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 3))) XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(pp))), Cb, Cr, bp, bp+4, bp+8) *(*Tuint32_t)(unsafe.Pointer(cp)) = *(*Tuint32_t)(unsafe.Pointer(bp)) | *(*Tuint32_t)(unsafe.Pointer(bp + 4))< RGB // */ func _putcontig8bitYCbCr12tile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var Cb, Cb1, Cr, Cr1, v1, v3 Tuint32_t var cp2 uintptr var incr Tint32_t var _ /* b at bp+20 */ Tuint32_t var _ /* b at bp+32 */ Tuint32_t var _ /* b at bp+8 */ Tuint32_t var _ /* g at bp+16 */ Tuint32_t var _ /* g at bp+28 */ Tuint32_t var _ /* g at bp+4 */ Tuint32_t var _ /* r at bp+0 */ Tuint32_t var _ /* r at bp+12 */ Tuint32_t var _ /* r at bp+24 */ Tuint32_t _, _, _, _, _, _, _, _ = Cb, Cb1, Cr, Cr1, cp2, incr, v1, v3 incr = libc.Int32FromUint32(libc.Uint32FromInt32(int32(2)*toskew) + w) _ = y fromskew = fromskew / int32(1) * (libc.Int32FromInt32(1)*libc.Int32FromInt32(2) + libc.Int32FromInt32(2)) cp2 = cp + uintptr(w)*4 + uintptr(toskew)*4 for h >= uint32(2) { x = w for { Cb = uint32(*(*uint8)(unsafe.Pointer(pp + 2))) Cr = uint32(*(*uint8)(unsafe.Pointer(pp + 3))) XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(pp))), libc.Int32FromUint32(Cb), libc.Int32FromUint32(Cr), bp, bp+4, bp+8) *(*Tuint32_t)(unsafe.Pointer(cp)) = *(*Tuint32_t)(unsafe.Pointer(bp)) | *(*Tuint32_t)(unsafe.Pointer(bp + 4))< RGB // */ func _putcontig8bitYCbCr11tile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, pp uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var Cb, Cr Tint32_t var v1, v3 Tuint32_t var v5 uintptr var _ /* b at bp+8 */ Tuint32_t var _ /* g at bp+4 */ Tuint32_t var _ /* r at bp+0 */ Tuint32_t _, _, _, _, _ = Cb, Cr, v1, v3, v5 _ = y fromskew = fromskew / int32(1) * (libc.Int32FromInt32(1)*libc.Int32FromInt32(1) + libc.Int32FromInt32(2)) for { x = w /* was x = w>>1; patched 2000/09/25 warmerda@home.com */ for { Cb = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 1))) Cr = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 2))) XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(pp))), Cb, Cr, bp, bp+4, bp+8) v5 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v5)) = *(*Tuint32_t)(unsafe.Pointer(bp)) | *(*Tuint32_t)(unsafe.Pointer(bp + 4))< RGB // */ func _putseparate8bitYCbCr11tile(tls *libc.TLS, img uintptr, cp uintptr, x Tuint32_t, y Tuint32_t, w Tuint32_t, h Tuint32_t, fromskew Tint32_t, toskew Tint32_t, r uintptr, g uintptr, b uintptr, a uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var v2 Tuint32_t var v4, v5, v6, v7 uintptr var _ /* db at bp+8 */ Tuint32_t var _ /* dg at bp+4 */ Tuint32_t var _ /* dr at bp+0 */ Tuint32_t _, _, _, _, _ = v2, v4, v5, v6, v7 _ = y _ = a /* TODO: naming of input vars is still off, change obfuscating declaration * inside define, or resolve obfuscation */ for { if !(h > uint32(0)) { break } x = w for { v4 = r r++ v5 = g g++ v6 = b b++ XTIFFYCbCrtoRGB(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, uint32(*(*uint8)(unsafe.Pointer(v4))), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v5))), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v6))), bp, bp+4, bp+8) v7 = cp cp += 4 *(*Tuint32_t)(unsafe.Pointer(v7)) = *(*Tuint32_t)(unsafe.Pointer(bp)) | *(*Tuint32_t)(unsafe.Pointer(bp + 4))< float32(-libc.Int32FromInt32(0x7FFFFFFF)+libc.Int32FromInt32(128)) && f < libc.Float32FromInt32(0x7FFFFFFF)) } func _initYCbCrConversion(tls *libc.TLS, img uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var _ /* luma at bp+0 */ uintptr var _ /* refBlackWhite at bp+4 */ uintptr if (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr == libc.UintptrFromInt32(0) { (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr = X_TIFFmallocExt(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, libc.Int32FromUint32((libc.Uint32FromInt64(24)+(libc.Uint32FromInt64(4)-libc.Uint32FromInt32(1)))/libc.Uint32FromInt64(4)*libc.Uint32FromInt64(4)+libc.Uint32FromInt32(libc.Int32FromInt32(4)*libc.Int32FromInt32(256))*libc.Uint32FromInt64(1)+libc.Uint32FromInt32(libc.Int32FromInt32(2)*libc.Int32FromInt32(256))*libc.Uint32FromInt64(4)+libc.Uint32FromInt32(libc.Int32FromInt32(3)*libc.Int32FromInt32(256))*libc.Uint32FromInt64(4))) if (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, uintptr(unsafe.Pointer(&_module47)), __ccgo_ts+39395, 0) return 0 } } XTIFFGetFieldDefaulted(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, uint32(TIFFTAG_YCBCRCOEFFICIENTS), libc.VaList(bp+16, bp)) XTIFFGetFieldDefaulted(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, uint32(TIFFTAG_REFERENCEBLACKWHITE), libc.VaList(bp+16, bp+4)) /* Do some validation to avoid later issues. Detect NaN for now */ /* and also if lumaGreen is zero since we divide by it later */ if *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) != *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) || *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1*4)) != *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1*4)) || float64(*(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1*4))) == float64(0) || *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 2*4)) != *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 2*4)) { XTIFFErrorExtR(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, uintptr(unsafe.Pointer(&_module47)), __ccgo_ts+39436, 0) return 0 } if !(_isInRefBlackWhiteRange(tls, *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4))))) != 0) || !(_isInRefBlackWhiteRange(tls, *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + 1*4))) != 0) || !(_isInRefBlackWhiteRange(tls, *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + 2*4))) != 0) || !(_isInRefBlackWhiteRange(tls, *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + 3*4))) != 0) || !(_isInRefBlackWhiteRange(tls, *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + 4*4))) != 0) || !(_isInRefBlackWhiteRange(tls, *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + 5*4))) != 0) { XTIFFErrorExtR(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, uintptr(unsafe.Pointer(&_module47)), __ccgo_ts+39477, 0) return 0 } if XTIFFYCbCrToRGBInit(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fycbcr, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4))) < 0 { return 0 } return int32(1) } var _module47 = [20]uint8{'i', 'n', 'i', 't', 'Y', 'C', 'b', 'C', 'r', 'C', 'o', 'n', 'v', 'e', 'r', 's', 'i', 'o', 'n'} func _initCIELabConversion(tls *libc.TLS, img uintptr) (r TtileContigRoutine) { bp := tls.Alloc(32) defer tls.Free(32) var _ /* refWhite at bp+4 */ [3]float32 var _ /* whitePoint at bp+0 */ uintptr XTIFFGetFieldDefaulted(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, uint32(TIFFTAG_WHITEPOINT), libc.VaList(bp+24, bp)) if *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1*4)) == libc.Float32FromFloat32(0) { XTIFFErrorExtR(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, uintptr(unsafe.Pointer(&_module48)), __ccgo_ts+39520, 0) return libc.UintptrFromInt32(0) } if !((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcielab != 0) { (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcielab = X_TIFFmallocExt(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, int32(18124)) if !((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcielab != 0) { XTIFFErrorExtR(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, uintptr(unsafe.Pointer(&_module48)), __ccgo_ts+39554, 0) return libc.UintptrFromInt32(0) } } (*(*[3]float32)(unsafe.Pointer(bp + 4)))[int32(1)] = libc.Float32FromFloat32(100) (*(*[3]float32)(unsafe.Pointer(bp + 4)))[0] = *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) / *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1*4)) * (*(*[3]float32)(unsafe.Pointer(bp + 4)))[int32(1)] (*(*[3]float32)(unsafe.Pointer(bp + 4)))[int32(2)] = (libc.Float32FromFloat32(1) - *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))) - *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1*4))) / *(*float32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1*4)) * (*(*[3]float32)(unsafe.Pointer(bp + 4)))[int32(1)] if XTIFFCIELabToRGBInit(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcielab, uintptr(unsafe.Pointer(&_display_sRGB)), bp+4) < 0 { XTIFFErrorExtR(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, uintptr(unsafe.Pointer(&_module48)), __ccgo_ts+39601, 0) X_TIFFfreeExt(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fcielab) return libc.UintptrFromInt32(0) } if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample) == int32(8) { return __ccgo_fp(_putcontig8bitCIELab8) } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample) == int32(16) { return __ccgo_fp(_putcontig8bitCIELab16) } } return libc.UintptrFromInt32(0) } var _module48 = [21]uint8{'i', 'n', 'i', 't', 'C', 'I', 'E', 'L', 'a', 'b', 'C', 'o', 'n', 'v', 'e', 'r', 's', 'i', 'o', 'n'} // C documentation // // /* // * Greyscale images with less than 8 bits/sample are handled // * with a table to avoid lots of shifts and masks. The table // * is setup so that put*bwtile (below) can retrieve 8/bitspersample // * pixel values simply by indexing into the table with one // * number. // */ func _makebwmap(tls *libc.TLS, img uintptr) (r int32) { var Map, p, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v7, v8, v9 uintptr var bitspersample, i, nsamples int32 var c TTIFFRGBValue _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = Map, bitspersample, c, i, nsamples, p, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v7, v8, v9 Map = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FMap bitspersample = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample) nsamples = int32(8) / bitspersample if nsamples == 0 { nsamples = int32(1) } (*TTIFFRGBAImage)(unsafe.Pointer(img)).FBWmap = X_TIFFmallocExt(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, libc.Int32FromUint32(libc.Uint32FromInt32(256)*libc.Uint32FromInt64(4)+libc.Uint32FromInt32(int32(256)*nsamples)*uint32(4))) if (*TTIFFRGBAImage)(unsafe.Pointer(img)).FBWmap == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, XTIFFFileName(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif), __ccgo_ts+39656, 0) return 0 } p = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FBWmap + libc.UintptrFromInt32(256)*4 i = 0 for { if !(i < int32(256)) { break } *(*uintptr)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FBWmap + uintptr(i)*4)) = p switch bitspersample { case int32(1): c = *(*TTIFFRGBValue)(unsafe.Pointer(Map + uintptr(i>>int32(7)))) v2 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v2)) = uint32(c) | uint32(c)<>int32(6)&int32(1)))) v3 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = uint32(c) | uint32(c)<>int32(5)&int32(1)))) v4 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v4)) = uint32(c) | uint32(c)<>int32(4)&int32(1)))) v5 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v5)) = uint32(c) | uint32(c)<>int32(3)&int32(1)))) v6 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v6)) = uint32(c) | uint32(c)<>int32(2)&int32(1)))) v7 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v7)) = uint32(c) | uint32(c)<>int32(1)&int32(1)))) v8 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v8)) = uint32(c) | uint32(c)<>int32(6)))) v10 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v10)) = uint32(c) | uint32(c)<>int32(4)&int32(3)))) v11 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v11)) = uint32(c) | uint32(c)<>int32(2)&int32(3)))) v12 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v12)) = uint32(c) | uint32(c)<>int32(4)))) v14 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v14)) = uint32(c) | uint32(c)< 0) { break } v2 = r r += 2 if v4 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(v2))) >= int32(256); !v4 { v3 = g g += 2 } if v6 = v4 || libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(v3))) >= int32(256); !v6 { v5 = b b += 2 } if v6 || libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(v5))) >= int32(256) { return int32(16) } } return int32(8) } func _cvtcmap(tls *libc.TLS, img uintptr) { var b, g, r uintptr var i int32 _, _, _, _ = b, g, i, r r = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fredcmap g = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fgreencmap b = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbluecmap i = int32(1)<<(*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample - int32(1) for { if !(i >= 0) { break } *(*Tuint16_t)(unsafe.Pointer(r + uintptr(i)*2)) = libc.Uint16FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(i)*2))) >> libc.Int32FromInt32(8)) *(*Tuint16_t)(unsafe.Pointer(g + uintptr(i)*2)) = libc.Uint16FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(i)*2))) >> libc.Int32FromInt32(8)) *(*Tuint16_t)(unsafe.Pointer(b + uintptr(i)*2)) = libc.Uint16FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(b + uintptr(i)*2))) >> libc.Int32FromInt32(8)) goto _1 _1: ; i-- } } // C documentation // // /* // * Palette images with <= 8 bits/sample are handled // * with a table to avoid lots of shifts and masks. The table // * is setup so that put*cmaptile (below) can retrieve 8/bitspersample // * pixel values simply by indexing into the table with one // * number. // */ func _makecmap(tls *libc.TLS, img uintptr) (r1 int32) { var b, g, p, r, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v7, v8, v9 uintptr var bitspersample, i, nsamples int32 var c TTIFFRGBValue _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, bitspersample, c, g, i, nsamples, p, r, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v7, v8, v9 bitspersample = libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample) nsamples = int32(8) / bitspersample r = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fredcmap g = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fgreencmap b = (*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbluecmap (*TTIFFRGBAImage)(unsafe.Pointer(img)).FPALmap = X_TIFFmallocExt(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, libc.Int32FromUint32(libc.Uint32FromInt32(256)*libc.Uint32FromInt64(4)+libc.Uint32FromInt32(int32(256)*nsamples)*uint32(4))) if (*TTIFFRGBAImage)(unsafe.Pointer(img)).FPALmap == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, XTIFFFileName(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif), __ccgo_ts+39729, 0) return 0 } p = (*TTIFFRGBAImage)(unsafe.Pointer(img)).FPALmap + libc.UintptrFromInt32(256)*4 i = 0 for { if !(i < int32(256)) { break } *(*uintptr)(unsafe.Pointer((*TTIFFRGBAImage)(unsafe.Pointer(img)).FPALmap + uintptr(i)*4)) = p switch bitspersample { case int32(1): c = libc.Uint8FromInt32(libc.Int32FromUint8(libc.Uint8FromInt32(i)) >> int32(7)) v2 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v2)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<>libc.Int32FromInt32(6))) & int32(1)) v3 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v3)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<>libc.Int32FromInt32(5))) & int32(1)) v4 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v4)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<>libc.Int32FromInt32(4))) & int32(1)) v5 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v5)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<>libc.Int32FromInt32(3))) & int32(1)) v6 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v6)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<>libc.Int32FromInt32(2))) & int32(1)) v7 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v7)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<>libc.Int32FromInt32(1))) & int32(1)) v8 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v8)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<> int32(6)) v10 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v10)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<>libc.Int32FromInt32(4))) & int32(3)) v11 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v11)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<>libc.Int32FromInt32(2))) & int32(3)) v12 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v12)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<> int32(4)) v14 = p p += 4 *(*Tuint32_t)(unsafe.Pointer(v14)) = libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(r + uintptr(c)*2)))&libc.Int32FromInt32(0xff)) | libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(g + uintptr(c)*2)))&libc.Int32FromInt32(0xff))<= int32(4) { *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_putRGBAAcontig8bittile) } else { if (*TTIFFRGBAImage)(unsafe.Pointer(img)).Falpha == int32(EXTRASAMPLE_UNASSALPHA) && libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) >= int32(4) { if _BuildMapUaToAa(tls, img) != 0 { *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_putRGBUAcontig8bittile) } } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) >= int32(3) { *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_putRGBcontig8bittile) } } } case int32(16): if (*TTIFFRGBAImage)(unsafe.Pointer(img)).Falpha == int32(EXTRASAMPLE_ASSOCALPHA) && libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) >= int32(4) { if _BuildMapBitdepth16To8(tls, img) != 0 { *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_putRGBAAcontig16bittile) } } else { if (*TTIFFRGBAImage)(unsafe.Pointer(img)).Falpha == int32(EXTRASAMPLE_UNASSALPHA) && libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) >= int32(4) { if _BuildMapBitdepth16To8(tls, img) != 0 && _BuildMapUaToAa(tls, img) != 0 { *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_putRGBUAcontig16bittile) } } else { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) >= int32(3) { if _BuildMapBitdepth16To8(tls, img) != 0 { *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_putRGBcontig16bittile) } } } } break } case int32(PHOTOMETRIC_SEPARATED): if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) >= int32(4) && _buildMap(tls, img) != 0 { if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample) == int32(8) { if !((*TTIFFRGBAImage)(unsafe.Pointer(img)).FMap != 0) { *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_putRGBcontig8bitCMYKtile) } else { *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_putRGBcontig8bitCMYKMaptile) } } } case int32(PHOTOMETRIC_PALETTE): if _buildMap(tls, img) != 0 { switch libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample) { case int32(8): *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_put8bitcmaptile) case int32(4): *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_put4bitcmaptile) case int32(2): *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_put2bitcmaptile) case int32(1): *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_put1bitcmaptile) break } } case PHOTOMETRIC_MINISWHITE: fallthrough case int32(PHOTOMETRIC_MINISBLACK): if _buildMap(tls, img) != 0 { switch libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample) { case int32(16): *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_put16bitbwtile) case int32(8): if (*TTIFFRGBAImage)(unsafe.Pointer(img)).Falpha != 0 && libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) == int32(2) { *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_putagreytile) } else { *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_putgreytile) } case int32(4): *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_put4bitbwtile) case int32(2): *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_put2bitbwtile) case int32(1): *(*TtileContigRoutine)(unsafe.Pointer(img + 52)) = __ccgo_fp(_put1bitbwtile) break } } case int32(PHOTOMETRIC_YCBCR): if libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fbitspersample) == int32(8) && libc.Int32FromUint16((*TTIFFRGBAImage)(unsafe.Pointer(img)).Fsamplesperpixel) == int32(3) { if _initYCbCrConversion(tls, img) != 0 { XTIFFGetFieldDefaulted(tls, (*TTIFFRGBAImage)(unsafe.Pointer(img)).Ftif, uint32(TIFFTAG_YCBCRSUBSAMPLING), libc.VaList(bp+16, bp, bp+2)) switch libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp)))<= (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fheight { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39895, 0) XTIFFRGBAImageEnd(tls, bp+1024) return 0 } (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Frow_offset = libc.Int32FromUint32(row) (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fcol_offset = 0 if row+*(*Tuint32_t)(unsafe.Pointer(bp + 1116)) > (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fheight { rows_to_read = (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fheight - row } else { rows_to_read = *(*Tuint32_t)(unsafe.Pointer(bp + 1116)) } ok = XTIFFRGBAImageGet(tls, bp+1024, raster, (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fwidth, rows_to_read) XTIFFRGBAImageEnd(tls, bp+1024) } else { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39133, libc.VaList(bp+1128, bp)) ok = 0 } return ok } /* * Read a whole tile off data from the file, and convert to RGBA form. * The returned RGBA data is organized from bottom to top of tile, * and may include zeroed areas if the tile extends off the image. */ func XTIFFReadRGBATile(tls *libc.TLS, tif uintptr, col Tuint32_t, row Tuint32_t, raster uintptr) (r int32) { return XTIFFReadRGBATileExt(tls, tif, col, row, raster, 0) } func XTIFFReadRGBATileExt(tls *libc.TLS, tif uintptr, col Tuint32_t, row Tuint32_t, raster uintptr, stop_on_error int32) (r int32) { bp := tls.Alloc(1152) defer tls.Free(1152) var i_row, read_xsize, read_ysize Tuint32_t var ok int32 var _ /* emsg at bp+0 */ [1024]uint8 var _ /* img at bp+1024 */ TTIFFRGBAImage var _ /* tile_xsize at bp+1116 */ Tuint32_t var _ /* tile_ysize at bp+1120 */ Tuint32_t _, _, _, _ = i_row, ok, read_xsize, read_ysize *(*[1024]uint8)(unsafe.Pointer(bp)) = [1024]uint8{} /* * Verify that our request is legal - on a tile file, and on a * tile boundary. */ if !(XTIFFIsTiled(tls, tif) != 0) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39938, 0) return 0 } XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_TILEWIDTH), libc.VaList(bp+1136, bp+1116)) XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_TILELENGTH), libc.VaList(bp+1136, bp+1120)) if *(*Tuint32_t)(unsafe.Pointer(bp + 1116)) == uint32(0) || *(*Tuint32_t)(unsafe.Pointer(bp + 1120)) == uint32(0) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39986, 0) return 0 } if col%*(*Tuint32_t)(unsafe.Pointer(bp + 1116)) != uint32(0) || row%*(*Tuint32_t)(unsafe.Pointer(bp + 1120)) != uint32(0) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+40019, 0) return 0 } /* * Setup the RGBA reader. */ if !(XTIFFRGBAImageOK(tls, tif, bp) != 0) || !(XTIFFRGBAImageBegin(tls, bp+1024, tif, stop_on_error, bp) != 0) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39133, libc.VaList(bp+1136, bp)) return 0 } if col >= (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fwidth || row >= (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fheight { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+40090, 0) XTIFFRGBAImageEnd(tls, bp+1024) return 0 } /* * The TIFFRGBAImageGet() function doesn't allow us to get off the * edge of the image, even to fill an otherwise valid tile. So we * figure out how much we can read, and fix up the tile buffer to * a full tile configuration afterwards. */ if row+*(*Tuint32_t)(unsafe.Pointer(bp + 1120)) > (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fheight { read_ysize = (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fheight - row } else { read_ysize = *(*Tuint32_t)(unsafe.Pointer(bp + 1120)) } if col+*(*Tuint32_t)(unsafe.Pointer(bp + 1116)) > (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fwidth { read_xsize = (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fwidth - col } else { read_xsize = *(*Tuint32_t)(unsafe.Pointer(bp + 1116)) } /* * Read the chunk of imagery. */ (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Frow_offset = libc.Int32FromUint32(row) (*(*TTIFFRGBAImage)(unsafe.Pointer(bp + 1024))).Fcol_offset = libc.Int32FromUint32(col) ok = XTIFFRGBAImageGet(tls, bp+1024, raster, read_xsize, read_ysize) XTIFFRGBAImageEnd(tls, bp+1024) /* * If our read was incomplete we will need to fix up the tile by * shifting the data around as if a full tile of data is being returned. * * This is all the more complicated because the image is organized in * bottom to top format. */ if read_xsize == *(*Tuint32_t)(unsafe.Pointer(bp + 1116)) && read_ysize == *(*Tuint32_t)(unsafe.Pointer(bp + 1120)) { return ok } i_row = uint32(0) for { if !(i_row < read_ysize) { break } libc.Xmemmove(tls, raster+uintptr((*(*Tuint32_t)(unsafe.Pointer(bp + 1120))-i_row-libc.Uint32FromInt32(1))**(*Tuint32_t)(unsafe.Pointer(bp + 1116)))*4, raster+uintptr((read_ysize-i_row-libc.Uint32FromInt32(1))*read_xsize)*4, read_xsize*uint32(4)) X_TIFFmemset(tls, raster+uintptr((*(*Tuint32_t)(unsafe.Pointer(bp + 1120))-i_row-libc.Uint32FromInt32(1))**(*Tuint32_t)(unsafe.Pointer(bp + 1116)))*4+uintptr(read_xsize)*4, 0, libc.Int32FromUint32(uint32(4)*(*(*Tuint32_t)(unsafe.Pointer(bp + 1116))-read_xsize))) goto _1 _1: ; i_row++ } i_row = read_ysize for { if !(i_row < *(*Tuint32_t)(unsafe.Pointer(bp + 1120))) { break } X_TIFFmemset(tls, raster+uintptr((*(*Tuint32_t)(unsafe.Pointer(bp + 1120))-i_row-libc.Uint32FromInt32(1))**(*Tuint32_t)(unsafe.Pointer(bp + 1116)))*4, 0, libc.Int32FromUint32(uint32(4)**(*Tuint32_t)(unsafe.Pointer(bp + 1116)))) goto _2 _2: ; i_row++ } return ok } const UINT32_MAX5 = "0xffffffffu" type TTIFFHashSet = struct { FfnHashFunc TTIFFHashSetHashFunc FfnEqualFunc TTIFFHashSetEqualFunc FfnFreeEltFunc TTIFFHashSetFreeEltFunc FtabList uintptr FnSize int32 FnIndiceAllocatedSize int32 FnAllocatedSize int32 FpsRecyclingList uintptr FnRecyclingListSize int32 FbRehash uint8 } type T_TIFFHashSet = TTIFFHashSet // C documentation // // /** List element structure. */ type TTIFFList = struct { FpData uintptr FpsNext uintptr } // C documentation // // /** List element structure. */ type T_TIFFList = TTIFFList var _anPrimes = [26]int32{ 0: int32(53), 1: int32(97), 2: int32(193), 3: int32(389), 4: int32(769), 5: int32(1543), 6: int32(3079), 7: int32(6151), 8: int32(12289), 9: int32(24593), 10: int32(49157), 11: int32(98317), 12: int32(196613), 13: int32(393241), 14: int32(786433), 15: int32(1572869), 16: int32(3145739), 17: int32(6291469), 18: int32(12582917), 19: int32(25165843), 20: int32(50331653), 21: int32(100663319), 22: int32(201326611), 23: int32(402653189), 24: int32(805306457), 25: int32(1610612741), } /************************************************************************/ /* TIFFHashSetHashPointer() */ /************************************************************************/ /** * Hash function for an arbitrary pointer * * @param elt the arbitrary pointer to hash * * @return the hash value of the pointer */ func _TIFFHashSetHashPointer(tls *libc.TLS, elt uintptr) (r uint32) { return uint32(elt) } /************************************************************************/ /* TIFFHashSetEqualPointer() */ /************************************************************************/ /** * Equality function for arbitrary pointers * * @param elt1 the first arbitrary pointer to compare * @param elt2 the second arbitrary pointer to compare * * @return true if the pointers are equal */ func _TIFFHashSetEqualPointer(tls *libc.TLS, elt1 uintptr, elt2 uintptr) (r uint8) { return libc.BoolUint8(elt1 == elt2) } /************************************************************************/ /* TIFFHashSetNew() */ /************************************************************************/ /** * Creates a new hash set * * The hash function must return a hash value for the elements to insert. * If fnHashFunc is NULL, TIFFHashSetHashPointer will be used. * * The equal function must return if two elements are equal. * If fnEqualFunc is NULL, TIFFHashSetEqualPointer will be used. * * The free function is used to free elements inserted in the hash set, * when the hash set is destroyed, when elements are removed or replaced. * If fnFreeEltFunc is NULL, elements inserted into the hash set will not be * freed. * * @param fnHashFunc hash function. May be NULL. * @param fnEqualFunc equal function. May be NULL. * @param fnFreeEltFunc element free function. May be NULL. * * @return a new hash set */ func XTIFFHashSetNew(tls *libc.TLS, fnHashFunc TTIFFHashSetHashFunc, fnEqualFunc TTIFFHashSetEqualFunc, fnFreeEltFunc TTIFFHashSetFreeEltFunc) (r uintptr) { var set uintptr var v1 TTIFFHashSetHashFunc var v2 TTIFFHashSetEqualFunc _, _, _ = set, v1, v2 set = libc.Xmalloc(tls, uint32(40)) if set == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } if fnHashFunc != 0 { v1 = fnHashFunc } else { v1 = __ccgo_fp(_TIFFHashSetHashPointer) } (*TTIFFHashSet)(unsafe.Pointer(set)).FfnHashFunc = v1 if fnEqualFunc != 0 { v2 = fnEqualFunc } else { v2 = __ccgo_fp(_TIFFHashSetEqualPointer) } (*TTIFFHashSet)(unsafe.Pointer(set)).FfnEqualFunc = v2 (*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc = fnFreeEltFunc (*TTIFFHashSet)(unsafe.Pointer(set)).FnSize = 0 (*TTIFFHashSet)(unsafe.Pointer(set)).FtabList = libc.Xcalloc(tls, uint32(53), uint32(4)) if (*TTIFFHashSet)(unsafe.Pointer(set)).FtabList == libc.UintptrFromInt32(0) { libc.Xfree(tls, set) return libc.UintptrFromInt32(0) } (*TTIFFHashSet)(unsafe.Pointer(set)).FnIndiceAllocatedSize = 0 (*TTIFFHashSet)(unsafe.Pointer(set)).FnAllocatedSize = int32(53) (*TTIFFHashSet)(unsafe.Pointer(set)).FpsRecyclingList = libc.UintptrFromInt32(0) (*TTIFFHashSet)(unsafe.Pointer(set)).FnRecyclingListSize = 0 (*TTIFFHashSet)(unsafe.Pointer(set)).FbRehash = uint8(false1) return set } /************************************************************************/ /* TIFFHashSetSize() */ /************************************************************************/ /** * Returns the number of elements inserted in the hash set * * Note: this is not the internal size of the hash set * * @param set the hash set * * @return the number of elements in the hash set */ func XTIFFHashSetSize(tls *libc.TLS, set uintptr) (r int32) { return (*TTIFFHashSet)(unsafe.Pointer(set)).FnSize } /************************************************************************/ /* TIFFHashSetGetNewListElt() */ /************************************************************************/ func _TIFFHashSetGetNewListElt(tls *libc.TLS, set uintptr) (r uintptr) { var psRet uintptr _ = psRet if (*TTIFFHashSet)(unsafe.Pointer(set)).FpsRecyclingList != 0 { psRet = (*TTIFFHashSet)(unsafe.Pointer(set)).FpsRecyclingList (*TTIFFList)(unsafe.Pointer(psRet)).FpData = libc.UintptrFromInt32(0) (*TTIFFHashSet)(unsafe.Pointer(set)).FnRecyclingListSize-- (*TTIFFHashSet)(unsafe.Pointer(set)).FpsRecyclingList = (*TTIFFList)(unsafe.Pointer(psRet)).FpsNext return psRet } return libc.Xmalloc(tls, uint32(8)) } /************************************************************************/ /* TIFFHashSetReturnListElt() */ /************************************************************************/ func _TIFFHashSetReturnListElt(tls *libc.TLS, set uintptr, psList uintptr) { if (*TTIFFHashSet)(unsafe.Pointer(set)).FnRecyclingListSize < int32(128) { (*TTIFFList)(unsafe.Pointer(psList)).FpsNext = (*TTIFFHashSet)(unsafe.Pointer(set)).FpsRecyclingList (*TTIFFHashSet)(unsafe.Pointer(set)).FpsRecyclingList = psList (*TTIFFHashSet)(unsafe.Pointer(set)).FnRecyclingListSize++ } else { libc.Xfree(tls, psList) } } /************************************************************************/ /* TIFFHashSetClearInternal() */ /************************************************************************/ func _TIFFHashSetClearInternal(tls *libc.TLS, set uintptr, bFinalize uint8) { var cur, psNext uintptr var i int32 _, _, _ = cur, i, psNext i = 0 for { if !(i < (*TTIFFHashSet)(unsafe.Pointer(set)).FnAllocatedSize) { break } cur = *(*uintptr)(unsafe.Pointer((*TTIFFHashSet)(unsafe.Pointer(set)).FtabList + uintptr(i)*4)) for cur != 0 { if (*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc})))(tls, (*TTIFFList)(unsafe.Pointer(cur)).FpData) } psNext = (*TTIFFList)(unsafe.Pointer(cur)).FpsNext if bFinalize != 0 { libc.Xfree(tls, cur) } else { _TIFFHashSetReturnListElt(tls, set, cur) } cur = psNext } *(*uintptr)(unsafe.Pointer((*TTIFFHashSet)(unsafe.Pointer(set)).FtabList + uintptr(i)*4)) = libc.UintptrFromInt32(0) goto _1 _1: ; i++ } (*TTIFFHashSet)(unsafe.Pointer(set)).FbRehash = uint8(false1) } /************************************************************************/ /* TIFFListDestroy() */ /************************************************************************/ /** * Destroy a list. Caller responsible for freeing data objects contained in * list elements. * * @param psList pointer to list head. * */ func _TIFFListDestroy(tls *libc.TLS, psList uintptr) { var psCurrent, psNext uintptr _, _ = psCurrent, psNext psCurrent = psList for psCurrent != 0 { psNext = (*TTIFFList)(unsafe.Pointer(psCurrent)).FpsNext libc.Xfree(tls, psCurrent) psCurrent = psNext } } /************************************************************************/ /* TIFFHashSetDestroy() */ /************************************************************************/ /** * Destroys an allocated hash set. * * This function also frees the elements if a free function was * provided at the creation of the hash set. * * @param set the hash set */ func XTIFFHashSetDestroy(tls *libc.TLS, set uintptr) { if set != 0 { _TIFFHashSetClearInternal(tls, set, uint8(true1)) libc.Xfree(tls, (*TTIFFHashSet)(unsafe.Pointer(set)).FtabList) _TIFFListDestroy(tls, (*TTIFFHashSet)(unsafe.Pointer(set)).FpsRecyclingList) libc.Xfree(tls, set) } } /************************************************************************/ /* TIFFHashSetRehash() */ /************************************************************************/ func _TIFFHashSetRehash(tls *libc.TLS, set uintptr) (r uint8) { var cur, newTabList, psNext uintptr var i, nNewAllocatedSize int32 var nNewHashVal uint32 _, _, _, _, _, _ = cur, i, nNewAllocatedSize, nNewHashVal, newTabList, psNext nNewAllocatedSize = _anPrimes[(*TTIFFHashSet)(unsafe.Pointer(set)).FnIndiceAllocatedSize] newTabList = libc.Xcalloc(tls, libc.Uint32FromInt32(nNewAllocatedSize), uint32(4)) if newTabList == libc.UintptrFromInt32(0) { return uint8(false1) } i = 0 for { if !(i < (*TTIFFHashSet)(unsafe.Pointer(set)).FnAllocatedSize) { break } cur = *(*uintptr)(unsafe.Pointer((*TTIFFHashSet)(unsafe.Pointer(set)).FtabList + uintptr(i)*4)) for cur != 0 { nNewHashVal = (*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnHashFunc})))(tls, (*TTIFFList)(unsafe.Pointer(cur)).FpData) % libc.Uint32FromInt32(nNewAllocatedSize) psNext = (*TTIFFList)(unsafe.Pointer(cur)).FpsNext (*TTIFFList)(unsafe.Pointer(cur)).FpsNext = *(*uintptr)(unsafe.Pointer(newTabList + uintptr(nNewHashVal)*4)) *(*uintptr)(unsafe.Pointer(newTabList + uintptr(nNewHashVal)*4)) = cur cur = psNext } goto _1 _1: ; i++ } libc.Xfree(tls, (*TTIFFHashSet)(unsafe.Pointer(set)).FtabList) (*TTIFFHashSet)(unsafe.Pointer(set)).FtabList = newTabList (*TTIFFHashSet)(unsafe.Pointer(set)).FnAllocatedSize = nNewAllocatedSize (*TTIFFHashSet)(unsafe.Pointer(set)).FbRehash = uint8(false1) return uint8(true1) } /************************************************************************/ /* TIFFHashSetFindPtr() */ /************************************************************************/ func _TIFFHashSetFindPtr(tls *libc.TLS, set uintptr, elt uintptr) (r uintptr) { var cur uintptr var nHashVal uint32 _, _ = cur, nHashVal nHashVal = (*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnHashFunc})))(tls, elt) % libc.Uint32FromInt32((*TTIFFHashSet)(unsafe.Pointer(set)).FnAllocatedSize) cur = *(*uintptr)(unsafe.Pointer((*TTIFFHashSet)(unsafe.Pointer(set)).FtabList + uintptr(nHashVal)*4)) for cur != 0 { if (*(*func(*libc.TLS, uintptr, uintptr) uint8)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnEqualFunc})))(tls, (*TTIFFList)(unsafe.Pointer(cur)).FpData, elt) != 0 { return cur } cur = (*TTIFFList)(unsafe.Pointer(cur)).FpsNext } return libc.UintptrFromInt32(0) } /************************************************************************/ /* TIFFHashSetInsert() */ /************************************************************************/ /** * Inserts an element into a hash set. * * If the element was already inserted in the hash set, the previous * element is replaced by the new element. If a free function was provided, * it is used to free the previously inserted element * * @param set the hash set * @param elt the new element to insert in the hash set * * @return true if success. If false is returned, elt has not been inserted, * but TIFFHashSetInsert() will have run the free function if provided. */ func XTIFFHashSetInsert(tls *libc.TLS, set uintptr, elt uintptr) (r uint8) { var nHashVal uint32 var new_elt, pElt uintptr _, _, _ = nHashVal, new_elt, pElt pElt = _TIFFHashSetFindPtr(tls, set, elt) if pElt != 0 { if (*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc})))(tls, *(*uintptr)(unsafe.Pointer(pElt))) } *(*uintptr)(unsafe.Pointer(pElt)) = elt return uint8(true1) } if (*TTIFFHashSet)(unsafe.Pointer(set)).FnSize >= int32(2)*(*TTIFFHashSet)(unsafe.Pointer(set)).FnAllocatedSize/int32(3) || (*TTIFFHashSet)(unsafe.Pointer(set)).FbRehash != 0 && (*TTIFFHashSet)(unsafe.Pointer(set)).FnIndiceAllocatedSize > 0 && (*TTIFFHashSet)(unsafe.Pointer(set)).FnSize <= (*TTIFFHashSet)(unsafe.Pointer(set)).FnAllocatedSize/int32(2) { (*TTIFFHashSet)(unsafe.Pointer(set)).FnIndiceAllocatedSize++ if !(_TIFFHashSetRehash(tls, set) != 0) { (*TTIFFHashSet)(unsafe.Pointer(set)).FnIndiceAllocatedSize-- if (*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc})))(tls, elt) } return uint8(false1) } } nHashVal = (*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnHashFunc})))(tls, elt) % libc.Uint32FromInt32((*TTIFFHashSet)(unsafe.Pointer(set)).FnAllocatedSize) new_elt = _TIFFHashSetGetNewListElt(tls, set) if new_elt == libc.UintptrFromInt32(0) { if (*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc})))(tls, elt) } return uint8(false1) } (*TTIFFList)(unsafe.Pointer(new_elt)).FpData = elt (*TTIFFList)(unsafe.Pointer(new_elt)).FpsNext = *(*uintptr)(unsafe.Pointer((*TTIFFHashSet)(unsafe.Pointer(set)).FtabList + uintptr(nHashVal)*4)) *(*uintptr)(unsafe.Pointer((*TTIFFHashSet)(unsafe.Pointer(set)).FtabList + uintptr(nHashVal)*4)) = new_elt (*TTIFFHashSet)(unsafe.Pointer(set)).FnSize++ return uint8(true1) } /************************************************************************/ /* TIFFHashSetLookup() */ /************************************************************************/ /** * Returns the element found in the hash set corresponding to the element to * look up The element must not be modified. * * @param set the hash set * @param elt the element to look up in the hash set * * @return the element found in the hash set or NULL */ func XTIFFHashSetLookup(tls *libc.TLS, set uintptr, elt uintptr) (r uintptr) { var pElt uintptr _ = pElt pElt = _TIFFHashSetFindPtr(tls, set, elt) if pElt != 0 { return *(*uintptr)(unsafe.Pointer(pElt)) } return libc.UintptrFromInt32(0) } /************************************************************************/ /* TIFFHashSetRemoveInternal() */ /************************************************************************/ func _TIFFHashSetRemoveInternal(tls *libc.TLS, set uintptr, elt uintptr, bDeferRehash uint8) (r uint8) { var cur, prev uintptr var nHashVal int32 _, _, _ = cur, nHashVal, prev if (*TTIFFHashSet)(unsafe.Pointer(set)).FnIndiceAllocatedSize > 0 && (*TTIFFHashSet)(unsafe.Pointer(set)).FnSize <= (*TTIFFHashSet)(unsafe.Pointer(set)).FnAllocatedSize/int32(2) { (*TTIFFHashSet)(unsafe.Pointer(set)).FnIndiceAllocatedSize-- if bDeferRehash != 0 { (*TTIFFHashSet)(unsafe.Pointer(set)).FbRehash = uint8(true1) } else { if !(_TIFFHashSetRehash(tls, set) != 0) { (*TTIFFHashSet)(unsafe.Pointer(set)).FnIndiceAllocatedSize++ return uint8(false1) } } } nHashVal = libc.Int32FromUint32((*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnHashFunc})))(tls, elt) % libc.Uint32FromInt32((*TTIFFHashSet)(unsafe.Pointer(set)).FnAllocatedSize)) cur = *(*uintptr)(unsafe.Pointer((*TTIFFHashSet)(unsafe.Pointer(set)).FtabList + uintptr(nHashVal)*4)) prev = libc.UintptrFromInt32(0) for cur != 0 { if (*(*func(*libc.TLS, uintptr, uintptr) uint8)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnEqualFunc})))(tls, (*TTIFFList)(unsafe.Pointer(cur)).FpData, elt) != 0 { if prev != 0 { (*TTIFFList)(unsafe.Pointer(prev)).FpsNext = (*TTIFFList)(unsafe.Pointer(cur)).FpsNext } else { *(*uintptr)(unsafe.Pointer((*TTIFFHashSet)(unsafe.Pointer(set)).FtabList + uintptr(nHashVal)*4)) = (*TTIFFList)(unsafe.Pointer(cur)).FpsNext } if (*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFFHashSet)(unsafe.Pointer(set)).FfnFreeEltFunc})))(tls, (*TTIFFList)(unsafe.Pointer(cur)).FpData) } _TIFFHashSetReturnListElt(tls, set, cur) (*TTIFFHashSet)(unsafe.Pointer(set)).FnSize-- return uint8(true1) } prev = cur cur = (*TTIFFList)(unsafe.Pointer(cur)).FpsNext } return uint8(false1) } /************************************************************************/ /* TIFFHashSetRemove() */ /************************************************************************/ /** * Removes an element from a hash set * * @param set the hash set * @param elt the new element to remove from the hash set * * @return true if the element was in the hash set */ func XTIFFHashSetRemove(tls *libc.TLS, set uintptr, elt uintptr) (r uint8) { return _TIFFHashSetRemoveInternal(tls, set, elt, uint8(false1)) } const INT_MAX6 = 0x7fffffff const JPEGCOLORMODE_RGB2 = 0x0001 const MINRUN = 4 const M_LN21 = 0.6931471805599453 const M_PI1 = 3.141592653589793 const RAND_MAX1 = 2147483647 const TIFF_ISTILED5 = 1024 const UVSCALE1 = 410 const UV_NDIVS = 16289 const UV_NVS = 163 // C documentation // // /* // * State block for each open TIFF // * file using LogLuv compression/decompression. // */ type TLogLuvState = struct { Fencoder_state int32 Fuser_datafmt int32 Fencode_meth int32 Fpixel_size int32 Ftbuf uintptr Ftbuflen Ttmsize_t Ftfunc uintptr Fvgetparent TTIFFVSetMethod Fvsetparent TTIFFVSetMethod } // C documentation // // /* // * State block for each open TIFF // * file using LogLuv compression/decompression. // */ type TlogLuvState = TLogLuvState // C documentation // // /* // * Decode a string of 16-bit gray pixels. // */ func _LogL16Decode(tls *libc.TLS, tif uintptr, op uintptr, occ Ttmsize_t, s Tuint16_t) (r int32) { bp1 := tls.Alloc(32) defer tls.Free(32) var b Tint16_t var bp, sp, tp, v14, v3, v4, v8, p12, p6 uintptr var cc, i, npixels, v13, v7, v9 Ttmsize_t var rc, shft, v10, v5 int32 var v11 bool _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, bp, cc, i, npixels, rc, shft, sp, tp, v10, v11, v13, v14, v3, v4, v5, v7, v8, v9, p12, p6 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s npixels = occ / (*TLogLuvState)(unsafe.Pointer(sp)).Fpixel_size if (*TLogLuvState)(unsafe.Pointer(sp)).Fuser_datafmt == int32(SGILOGDATAFMT_16BIT) { tp = op } else { if (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuflen < npixels { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module51)), __ccgo_ts+40136, 0) return 0 } tp = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf } X_TIFFmemset(tls, tp, 0, libc.Int32FromUint32(libc.Uint32FromInt32(npixels)*uint32(2))) bp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp cc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc /* get each byte string */ shft = int32(8) for { if !(shft >= 0) { break } i = 0 for { if !(i < npixels && cc > 0) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) >= int32(128) { /* run */ if cc < int32(2) { break } v3 = bp bp++ rc = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v3))) + (libc.Int32FromInt32(2) - libc.Int32FromInt32(128)) v4 = bp bp++ b = int16(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v4))) << shft) cc -= int32(2) for { v5 = rc rc-- if !(v5 != 0 && i < npixels) { break } v7 = i i++ p6 = tp + uintptr(v7)*2 *(*Tint16_t)(unsafe.Pointer(p6)) = Tint16_t(int32(*(*Tint16_t)(unsafe.Pointer(p6))) | int32(b)) } } else { /* non-run */ v8 = bp bp++ rc = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v8))) /* nul is noop */ for { cc-- v9 = cc if v11 = v9 != 0; v11 { v10 = rc rc-- } if !(v11 && v10 != 0 && i < npixels) { break } v13 = i i++ p12 = tp + uintptr(v13)*2 v14 = bp bp++ *(*Tint16_t)(unsafe.Pointer(p12)) = Tint16_t(int32(*(*Tint16_t)(unsafe.Pointer(p12))) | int32(libc.Int16FromUint8(*(*uint8)(unsafe.Pointer(v14))))<= int32(3)) { break } *(*Tuint32_t)(unsafe.Pointer(tp + uintptr(i)*4)) = libc.Uint32FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))<= 0) { break } i = 0 for { if !(i < npixels && cc > 0) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) >= int32(128) { /* run */ if cc < int32(2) { break } v3 = bp bp++ rc = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v3))) + (libc.Int32FromInt32(2) - libc.Int32FromInt32(128)) v4 = bp bp++ b = uint32(*(*uint8)(unsafe.Pointer(v4))) << shft cc -= int32(2) for { v5 = rc rc-- if !(v5 != 0 && i < npixels) { break } v6 = i i++ *(*Tuint32_t)(unsafe.Pointer(tp + uintptr(v6)*4)) |= b } } else { /* non-run */ v7 = bp bp++ rc = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v7))) /* nul is noop */ for { cc-- v8 = cc if v10 = v8 != 0; v10 { v9 = rc rc-- } if !(v10 && v9 != 0 && i < npixels) { break } v11 = i i++ v12 = bp bp++ *(*Tuint32_t)(unsafe.Pointer(tp + uintptr(v11)*4)) |= uint32(*(*uint8)(unsafe.Pointer(v12))) << shft } } goto _2 _2: } if i != npixels { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module53)), __ccgo_ts+40165, libc.VaList(bp1+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, npixels-i)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = bp (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = cc return 0 } goto _1 _1: ; shft -= int32(8) } (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TLogLuvState)(unsafe.Pointer(sp)).Ftfunc})))(tls, sp, op, npixels) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = bp (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = cc return int32(1) } var _module53 = [15]uint8{'L', 'o', 'g', 'L', 'u', 'v', 'D', 'e', 'c', 'o', 'd', 'e', '3', '2'} // C documentation // // /* // * Decode a strip of pixels. We break it into rows to // * maintain synchrony with the encode algorithm, which // * is row by row. // */ func _LogLuvDecodeStrip(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var rowlen Ttmsize_t _ = rowlen rowlen = XTIFFScanlineSize(tls, tif) if rowlen == 0 { return 0 } for cc != 0 && (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow})))(tls, tif, bp, rowlen, s) != 0 { bp += uintptr(rowlen) cc -= rowlen } return libc.BoolInt32(cc == 0) } // C documentation // // /* // * Decode a tile of pixels. We break it into rows to // * maintain synchrony with the encode algorithm, which // * is row by row. // */ func _LogLuvDecodeTile(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var rowlen Ttmsize_t _ = rowlen rowlen = XTIFFTileRowSize(tls, tif) if rowlen == 0 { return 0 } for cc != 0 && (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow})))(tls, tif, bp, rowlen, s) != 0 { bp += uintptr(rowlen) cc -= rowlen } return libc.BoolInt32(cc == 0) } // C documentation // // /* // * Encode a row of 16-bit pixels. // */ func _LogL16Encode(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var b Tint16_t var beg, i, j, npixels, occ, v11, v4, v7, v9 Ttmsize_t var mask, rc, shft int32 var op, sp, tp, v10, v12, v13, v5, v6, v8 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, beg, i, j, mask, npixels, occ, op, rc, shft, sp, tp, v10, v11, v12, v13, v4, v5, v6, v7, v8, v9 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data rc = 0 _ = s npixels = cc / (*TLogLuvState)(unsafe.Pointer(sp)).Fpixel_size if (*TLogLuvState)(unsafe.Pointer(sp)).Fuser_datafmt == int32(SGILOGDATAFMT_16BIT) { tp = bp } else { tp = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf if (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuflen < npixels { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module54)), __ccgo_ts+40136, 0) return 0 } (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TLogLuvState)(unsafe.Pointer(sp)).Ftfunc})))(tls, sp, bp, npixels) } /* compress each byte string */ op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp occ = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc shft = int32(8) for { if !(shft >= 0) { break } i = 0 for { if !(i < npixels) { break } if occ < int32(4) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = op (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - occ if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp occ = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc } mask = int32(0xff) << shft /* find next run */ beg = i for { if !(beg < npixels) { break } b = int16(int32(*(*Tint16_t)(unsafe.Pointer(tp + uintptr(beg)*2))) & mask) rc = int32(1) for rc < libc.Int32FromInt32(127)+libc.Int32FromInt32(2) && beg+rc < npixels && int32(*(*Tint16_t)(unsafe.Pointer(tp + uintptr(beg+rc)*2)))&mask == int32(b) { rc++ } if rc >= int32(MINRUN) { break } /* long enough */ goto _3 _3: ; beg += rc } if beg-i > int32(1) && beg-i < int32(MINRUN) { b = int16(int32(*(*Tint16_t)(unsafe.Pointer(tp + uintptr(i)*2))) & mask) /*check short run */ j = i + int32(1) for { v4 = j j++ if !(int32(*(*Tint16_t)(unsafe.Pointer(tp + uintptr(v4)*2)))&mask == int32(b)) { break } if j == beg { v5 = op op++ *(*Tuint8_t)(unsafe.Pointer(v5)) = libc.Uint8FromInt32(libc.Int32FromInt32(128) - libc.Int32FromInt32(2) + j - i) v6 = op op++ *(*Tuint8_t)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(int32(b) >> shft) occ -= int32(2) i = beg break } } } for i < beg { /* write out non-run */ v7 = beg - i j = v7 if v7 > int32(127) { j = int32(127) } if occ < j+int32(3) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = op (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - occ if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp occ = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc } v8 = op op++ *(*Tuint8_t)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(j) occ-- for { v9 = j j-- if !(v9 != 0) { break } v10 = op op++ v11 = i i++ *(*Tuint8_t)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(int32(*(*Tint16_t)(unsafe.Pointer(tp + uintptr(v11)*2))) >> shft & libc.Int32FromInt32(0xff)) occ-- } } if rc >= int32(MINRUN) { /* write out run */ v12 = op op++ *(*Tuint8_t)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromInt32(128) - libc.Int32FromInt32(2) + rc) v13 = op op++ *(*Tuint8_t)(unsafe.Pointer(v13)) = libc.Uint8FromInt32(int32(*(*Tint16_t)(unsafe.Pointer(tp + uintptr(beg)*2))) >> shft & libc.Int32FromInt32(0xff)) occ -= int32(2) } else { rc = 0 } goto _2 _2: ; i += rc } goto _1 _1: ; shft -= int32(8) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = op (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - occ return int32(1) } var _module54 = [13]uint8{'L', 'o', 'g', 'L', '1', '6', 'E', 'n', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Encode a row of 24-bit pixels. // */ func _LogLuvEncode24(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var i, npixels, occ, v2 Ttmsize_t var op, sp, tp, v3, v4, v5, v6 uintptr _, _, _, _, _, _, _, _, _, _, _ = i, npixels, occ, op, sp, tp, v2, v3, v4, v5, v6 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s npixels = cc / (*TLogLuvState)(unsafe.Pointer(sp)).Fpixel_size if (*TLogLuvState)(unsafe.Pointer(sp)).Fuser_datafmt == int32(SGILOGDATAFMT_RAW) { tp = bp } else { tp = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf if (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuflen < npixels { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module55)), __ccgo_ts+40136, 0) return 0 } (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TLogLuvState)(unsafe.Pointer(sp)).Ftfunc})))(tls, sp, bp, npixels) } /* write out encoded pixels */ op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp occ = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc i = npixels for { v2 = i i-- if !(v2 != 0) { break } if occ < int32(3) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = op (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - occ if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp occ = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc } v3 = op op++ *(*Tuint8_t)(unsafe.Pointer(v3)) = uint8(*(*Tuint32_t)(unsafe.Pointer(tp)) >> libc.Int32FromInt32(16)) v4 = op op++ *(*Tuint8_t)(unsafe.Pointer(v4)) = uint8(*(*Tuint32_t)(unsafe.Pointer(tp)) >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) v5 = op op++ v6 = tp tp += 4 *(*Tuint8_t)(unsafe.Pointer(v5)) = uint8(*(*Tuint32_t)(unsafe.Pointer(v6)) & libc.Uint32FromInt32(0xff)) occ -= int32(3) goto _1 _1: } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = op (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - occ return int32(1) } var _module55 = [15]uint8{'L', 'o', 'g', 'L', 'u', 'v', 'E', 'n', 'c', 'o', 'd', 'e', '2', '4'} // C documentation // // /* // * Encode a row of 32-bit pixels. // */ func _LogLuvEncode32(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var b, mask Tuint32_t var beg, i, j, npixels, occ, v11, v4, v7, v9 Ttmsize_t var op, sp, tp, v10, v12, v13, v5, v6, v8 uintptr var rc, shft int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, beg, i, j, mask, npixels, occ, op, rc, shft, sp, tp, v10, v11, v12, v13, v4, v5, v6, v7, v8, v9 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data rc = 0 _ = s npixels = cc / (*TLogLuvState)(unsafe.Pointer(sp)).Fpixel_size if (*TLogLuvState)(unsafe.Pointer(sp)).Fuser_datafmt == int32(SGILOGDATAFMT_RAW) { tp = bp } else { tp = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf if (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuflen < npixels { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module56)), __ccgo_ts+40136, 0) return 0 } (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TLogLuvState)(unsafe.Pointer(sp)).Ftfunc})))(tls, sp, bp, npixels) } /* compress each byte string */ op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp occ = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc shft = int32(24) for { if !(shft >= 0) { break } mask = uint32(0xff) << shft /* find next run */ i = 0 for { if !(i < npixels) { break } if occ < int32(4) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = op (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - occ if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp occ = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc } beg = i for { if !(beg < npixels) { break } b = *(*Tuint32_t)(unsafe.Pointer(tp + uintptr(beg)*4)) & mask rc = int32(1) for rc < libc.Int32FromInt32(127)+libc.Int32FromInt32(2) && beg+rc < npixels && *(*Tuint32_t)(unsafe.Pointer(tp + uintptr(beg+rc)*4))&mask == b { rc++ } if rc >= int32(MINRUN) { break } /* long enough */ goto _3 _3: ; beg += rc } if beg-i > int32(1) && beg-i < int32(MINRUN) { b = *(*Tuint32_t)(unsafe.Pointer(tp + uintptr(i)*4)) & mask /* check short run */ j = i + int32(1) for { v4 = j j++ if !(*(*Tuint32_t)(unsafe.Pointer(tp + uintptr(v4)*4))&mask == b) { break } if j == beg { v5 = op op++ *(*Tuint8_t)(unsafe.Pointer(v5)) = libc.Uint8FromInt32(libc.Int32FromInt32(128) - libc.Int32FromInt32(2) + j - i) v6 = op op++ *(*Tuint8_t)(unsafe.Pointer(v6)) = uint8(b >> shft) occ -= int32(2) i = beg break } } } for i < beg { /* write out non-run */ v7 = beg - i j = v7 if v7 > int32(127) { j = int32(127) } if occ < j+int32(3) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = op (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - occ if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp occ = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc } v8 = op op++ *(*Tuint8_t)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(j) occ-- for { v9 = j j-- if !(v9 != 0) { break } v10 = op op++ v11 = i i++ *(*Tuint8_t)(unsafe.Pointer(v10)) = uint8(*(*Tuint32_t)(unsafe.Pointer(tp + uintptr(v11)*4)) >> shft & libc.Uint32FromInt32(0xff)) occ-- } } if rc >= int32(MINRUN) { /* write out run */ v12 = op op++ *(*Tuint8_t)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromInt32(128) - libc.Int32FromInt32(2) + rc) v13 = op op++ *(*Tuint8_t)(unsafe.Pointer(v13)) = uint8(*(*Tuint32_t)(unsafe.Pointer(tp + uintptr(beg)*4)) >> shft & libc.Uint32FromInt32(0xff)) occ -= int32(2) } else { rc = 0 } goto _2 _2: ; i += rc } goto _1 _1: ; shft -= int32(8) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = op (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - occ return int32(1) } var _module56 = [15]uint8{'L', 'o', 'g', 'L', 'u', 'v', 'E', 'n', 'c', 'o', 'd', 'e', '3', '2'} // C documentation // // /* // * Encode a strip of pixels. We break it into rows to // * avoid encoding runs across row boundaries. // */ func _LogLuvEncodeStrip(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var rowlen Ttmsize_t _ = rowlen rowlen = XTIFFScanlineSize(tls, tif) if rowlen == 0 { return 0 } for cc != 0 && (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow})))(tls, tif, bp, rowlen, s) == int32(1) { bp += uintptr(rowlen) cc -= rowlen } return libc.BoolInt32(cc == 0) } // C documentation // // /* // * Encode a tile of pixels. We break it into rows to // * avoid encoding runs across row boundaries. // */ func _LogLuvEncodeTile(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var rowlen Ttmsize_t _ = rowlen rowlen = XTIFFTileRowSize(tls, tif) if rowlen == 0 { return 0 } for cc != 0 && (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow})))(tls, tif, bp, rowlen, s) == int32(1) { bp += uintptr(rowlen) cc -= rowlen } return libc.BoolInt32(cc == 0) } var _uv_row = [163]struct { Fustart float32 Fnus int16 Fncum int16 }{ 0: { Fustart: libc.Float32FromFloat64(0.247663), Fnus: int16(4), }, 1: { Fustart: libc.Float32FromFloat64(0.243779), Fnus: int16(6), Fncum: int16(4), }, 2: { Fustart: libc.Float32FromFloat64(0.241684), Fnus: int16(7), Fncum: int16(10), }, 3: { Fustart: libc.Float32FromFloat64(0.237874), Fnus: int16(9), Fncum: int16(17), }, 4: { Fustart: libc.Float32FromFloat64(0.235906), Fnus: int16(10), Fncum: int16(26), }, 5: { Fustart: libc.Float32FromFloat64(0.232153), Fnus: int16(12), Fncum: int16(36), }, 6: { Fustart: libc.Float32FromFloat64(0.228352), Fnus: int16(14), Fncum: int16(48), }, 7: { Fustart: libc.Float32FromFloat64(0.226259), Fnus: int16(15), Fncum: int16(62), }, 8: { Fustart: libc.Float32FromFloat64(0.222371), Fnus: int16(17), Fncum: int16(77), }, 9: { Fustart: libc.Float32FromFloat64(0.22041), Fnus: int16(18), Fncum: int16(94), }, 10: { Fustart: libc.Float32FromFloat64(0.21471), Fnus: int16(21), Fncum: int16(112), }, 11: { Fustart: libc.Float32FromFloat64(0.212714), Fnus: int16(22), Fncum: int16(133), }, 12: { Fustart: libc.Float32FromFloat64(0.210721), Fnus: int16(23), Fncum: int16(155), }, 13: { Fustart: libc.Float32FromFloat64(0.204976), Fnus: int16(26), Fncum: int16(178), }, 14: { Fustart: libc.Float32FromFloat64(0.202986), Fnus: int16(27), Fncum: int16(204), }, 15: { Fustart: libc.Float32FromFloat64(0.199245), Fnus: int16(29), Fncum: int16(231), }, 16: { Fustart: libc.Float32FromFloat64(0.195525), Fnus: int16(31), Fncum: int16(260), }, 17: { Fustart: libc.Float32FromFloat64(0.19356), Fnus: int16(32), Fncum: int16(291), }, 18: { Fustart: libc.Float32FromFloat64(0.189878), Fnus: int16(34), Fncum: int16(323), }, 19: { Fustart: libc.Float32FromFloat64(0.186216), Fnus: int16(36), Fncum: int16(357), }, 20: { Fustart: libc.Float32FromFloat64(0.186216), Fnus: int16(36), Fncum: int16(393), }, 21: { Fustart: libc.Float32FromFloat64(0.182592), Fnus: int16(38), Fncum: int16(429), }, 22: { Fustart: libc.Float32FromFloat64(0.179003), Fnus: int16(40), Fncum: int16(467), }, 23: { Fustart: libc.Float32FromFloat64(0.175466), Fnus: int16(42), Fncum: int16(507), }, 24: { Fustart: libc.Float32FromFloat64(0.172001), Fnus: int16(44), Fncum: int16(549), }, 25: { Fustart: libc.Float32FromFloat64(0.172001), Fnus: int16(44), Fncum: int16(593), }, 26: { Fustart: libc.Float32FromFloat64(0.168612), Fnus: int16(46), Fncum: int16(637), }, 27: { Fustart: libc.Float32FromFloat64(0.168612), Fnus: int16(46), Fncum: int16(683), }, 28: { Fustart: libc.Float32FromFloat64(0.163575), Fnus: int16(49), Fncum: int16(729), }, 29: { Fustart: libc.Float32FromFloat64(0.158642), Fnus: int16(52), Fncum: int16(778), }, 30: { Fustart: libc.Float32FromFloat64(0.158642), Fnus: int16(52), Fncum: int16(830), }, 31: { Fustart: libc.Float32FromFloat64(0.158642), Fnus: int16(52), Fncum: int16(882), }, 32: { Fustart: libc.Float32FromFloat64(0.153815), Fnus: int16(55), Fncum: int16(934), }, 33: { Fustart: libc.Float32FromFloat64(0.153815), Fnus: int16(55), Fncum: int16(989), }, 34: { Fustart: libc.Float32FromFloat64(0.149097), Fnus: int16(58), Fncum: int16(1044), }, 35: { Fustart: libc.Float32FromFloat64(0.149097), Fnus: int16(58), Fncum: int16(1102), }, 36: { Fustart: libc.Float32FromFloat64(0.142746), Fnus: int16(62), Fncum: int16(1160), }, 37: { Fustart: libc.Float32FromFloat64(0.142746), Fnus: int16(62), Fncum: int16(1222), }, 38: { Fustart: libc.Float32FromFloat64(0.142746), Fnus: int16(62), Fncum: int16(1284), }, 39: { Fustart: libc.Float32FromFloat64(0.13827), Fnus: int16(65), Fncum: int16(1346), }, 40: { Fustart: libc.Float32FromFloat64(0.13827), Fnus: int16(65), Fncum: int16(1411), }, 41: { Fustart: libc.Float32FromFloat64(0.13827), Fnus: int16(65), Fncum: int16(1476), }, 42: { Fustart: libc.Float32FromFloat64(0.132166), Fnus: int16(69), Fncum: int16(1541), }, 43: { Fustart: libc.Float32FromFloat64(0.132166), Fnus: int16(69), Fncum: int16(1610), }, 44: { Fustart: libc.Float32FromFloat64(0.126204), Fnus: int16(73), Fncum: int16(1679), }, 45: { Fustart: libc.Float32FromFloat64(0.126204), Fnus: int16(73), Fncum: int16(1752), }, 46: { Fustart: libc.Float32FromFloat64(0.126204), Fnus: int16(73), Fncum: int16(1825), }, 47: { Fustart: libc.Float32FromFloat64(0.120381), Fnus: int16(77), Fncum: int16(1898), }, 48: { Fustart: libc.Float32FromFloat64(0.120381), Fnus: int16(77), Fncum: int16(1975), }, 49: { Fustart: libc.Float32FromFloat64(0.120381), Fnus: int16(77), Fncum: int16(2052), }, 50: { Fustart: libc.Float32FromFloat64(0.120381), Fnus: int16(77), Fncum: int16(2129), }, 51: { Fustart: libc.Float32FromFloat64(0.112962), Fnus: int16(82), Fncum: int16(2206), }, 52: { Fustart: libc.Float32FromFloat64(0.112962), Fnus: int16(82), Fncum: int16(2288), }, 53: { Fustart: libc.Float32FromFloat64(0.112962), Fnus: int16(82), Fncum: int16(2370), }, 54: { Fustart: libc.Float32FromFloat64(0.10745), Fnus: int16(86), Fncum: int16(2452), }, 55: { Fustart: libc.Float32FromFloat64(0.10745), Fnus: int16(86), Fncum: int16(2538), }, 56: { Fustart: libc.Float32FromFloat64(0.10745), Fnus: int16(86), Fncum: int16(2624), }, 57: { Fustart: libc.Float32FromFloat64(0.10745), Fnus: int16(86), Fncum: int16(2710), }, 58: { Fustart: libc.Float32FromFloat64(0.100343), Fnus: int16(91), Fncum: int16(2796), }, 59: { Fustart: libc.Float32FromFloat64(0.100343), Fnus: int16(91), Fncum: int16(2887), }, 60: { Fustart: libc.Float32FromFloat64(0.100343), Fnus: int16(91), Fncum: int16(2978), }, 61: { Fustart: libc.Float32FromFloat64(0.095126), Fnus: int16(95), Fncum: int16(3069), }, 62: { Fustart: libc.Float32FromFloat64(0.095126), Fnus: int16(95), Fncum: int16(3164), }, 63: { Fustart: libc.Float32FromFloat64(0.095126), Fnus: int16(95), Fncum: int16(3259), }, 64: { Fustart: libc.Float32FromFloat64(0.095126), Fnus: int16(95), Fncum: int16(3354), }, 65: { Fustart: libc.Float32FromFloat64(0.088276), Fnus: int16(100), Fncum: int16(3449), }, 66: { Fustart: libc.Float32FromFloat64(0.088276), Fnus: int16(100), Fncum: int16(3549), }, 67: { Fustart: libc.Float32FromFloat64(0.088276), Fnus: int16(100), Fncum: int16(3649), }, 68: { Fustart: libc.Float32FromFloat64(0.088276), Fnus: int16(100), Fncum: int16(3749), }, 69: { Fustart: libc.Float32FromFloat64(0.081523), Fnus: int16(105), Fncum: int16(3849), }, 70: { Fustart: libc.Float32FromFloat64(0.081523), Fnus: int16(105), Fncum: int16(3954), }, 71: { Fustart: libc.Float32FromFloat64(0.081523), Fnus: int16(105), Fncum: int16(4059), }, 72: { Fustart: libc.Float32FromFloat64(0.081523), Fnus: int16(105), Fncum: int16(4164), }, 73: { Fustart: libc.Float32FromFloat64(0.074861), Fnus: int16(110), Fncum: int16(4269), }, 74: { Fustart: libc.Float32FromFloat64(0.074861), Fnus: int16(110), Fncum: int16(4379), }, 75: { Fustart: libc.Float32FromFloat64(0.074861), Fnus: int16(110), Fncum: int16(4489), }, 76: { Fustart: libc.Float32FromFloat64(0.074861), Fnus: int16(110), Fncum: int16(4599), }, 77: { Fustart: libc.Float32FromFloat64(0.06829), Fnus: int16(115), Fncum: int16(4709), }, 78: { Fustart: libc.Float32FromFloat64(0.06829), Fnus: int16(115), Fncum: int16(4824), }, 79: { Fustart: libc.Float32FromFloat64(0.06829), Fnus: int16(115), Fncum: int16(4939), }, 80: { Fustart: libc.Float32FromFloat64(0.06829), Fnus: int16(115), Fncum: int16(5054), }, 81: { Fustart: libc.Float32FromFloat64(0.063573), Fnus: int16(119), Fncum: int16(5169), }, 82: { Fustart: libc.Float32FromFloat64(0.063573), Fnus: int16(119), Fncum: int16(5288), }, 83: { Fustart: libc.Float32FromFloat64(0.063573), Fnus: int16(119), Fncum: int16(5407), }, 84: { Fustart: libc.Float32FromFloat64(0.063573), Fnus: int16(119), Fncum: int16(5526), }, 85: { Fustart: libc.Float32FromFloat64(0.057219), Fnus: int16(124), Fncum: int16(5645), }, 86: { Fustart: libc.Float32FromFloat64(0.057219), Fnus: int16(124), Fncum: int16(5769), }, 87: { Fustart: libc.Float32FromFloat64(0.057219), Fnus: int16(124), Fncum: int16(5893), }, 88: { Fustart: libc.Float32FromFloat64(0.057219), Fnus: int16(124), Fncum: int16(6017), }, 89: { Fustart: libc.Float32FromFloat64(0.050985), Fnus: int16(129), Fncum: int16(6141), }, 90: { Fustart: libc.Float32FromFloat64(0.050985), Fnus: int16(129), Fncum: int16(6270), }, 91: { Fustart: libc.Float32FromFloat64(0.050985), Fnus: int16(129), Fncum: int16(6399), }, 92: { Fustart: libc.Float32FromFloat64(0.050985), Fnus: int16(129), Fncum: int16(6528), }, 93: { Fustart: libc.Float32FromFloat64(0.050985), Fnus: int16(129), Fncum: int16(6657), }, 94: { Fustart: libc.Float32FromFloat64(0.044859), Fnus: int16(134), Fncum: int16(6786), }, 95: { Fustart: libc.Float32FromFloat64(0.044859), Fnus: int16(134), Fncum: int16(6920), }, 96: { Fustart: libc.Float32FromFloat64(0.044859), Fnus: int16(134), Fncum: int16(7054), }, 97: { Fustart: libc.Float32FromFloat64(0.044859), Fnus: int16(134), Fncum: int16(7188), }, 98: { Fustart: libc.Float32FromFloat64(0.040571), Fnus: int16(138), Fncum: int16(7322), }, 99: { Fustart: libc.Float32FromFloat64(0.040571), Fnus: int16(138), Fncum: int16(7460), }, 100: { Fustart: libc.Float32FromFloat64(0.040571), Fnus: int16(138), Fncum: int16(7598), }, 101: { Fustart: libc.Float32FromFloat64(0.040571), Fnus: int16(138), Fncum: int16(7736), }, 102: { Fustart: libc.Float32FromFloat64(0.036339), Fnus: int16(142), Fncum: int16(7874), }, 103: { Fustart: libc.Float32FromFloat64(0.036339), Fnus: int16(142), Fncum: int16(8016), }, 104: { Fustart: libc.Float32FromFloat64(0.036339), Fnus: int16(142), Fncum: int16(8158), }, 105: { Fustart: libc.Float32FromFloat64(0.036339), Fnus: int16(142), Fncum: int16(8300), }, 106: { Fustart: libc.Float32FromFloat64(0.032139), Fnus: int16(146), Fncum: int16(8442), }, 107: { Fustart: libc.Float32FromFloat64(0.032139), Fnus: int16(146), Fncum: int16(8588), }, 108: { Fustart: libc.Float32FromFloat64(0.032139), Fnus: int16(146), Fncum: int16(8734), }, 109: { Fustart: libc.Float32FromFloat64(0.032139), Fnus: int16(146), Fncum: int16(8880), }, 110: { Fustart: libc.Float32FromFloat64(0.027947), Fnus: int16(150), Fncum: int16(9026), }, 111: { Fustart: libc.Float32FromFloat64(0.027947), Fnus: int16(150), Fncum: int16(9176), }, 112: { Fustart: libc.Float32FromFloat64(0.027947), Fnus: int16(150), Fncum: int16(9326), }, 113: { Fustart: libc.Float32FromFloat64(0.023739), Fnus: int16(154), Fncum: int16(9476), }, 114: { Fustart: libc.Float32FromFloat64(0.023739), Fnus: int16(154), Fncum: int16(9630), }, 115: { Fustart: libc.Float32FromFloat64(0.023739), Fnus: int16(154), Fncum: int16(9784), }, 116: { Fustart: libc.Float32FromFloat64(0.023739), Fnus: int16(154), Fncum: int16(9938), }, 117: { Fustart: libc.Float32FromFloat64(0.019504), Fnus: int16(158), Fncum: int16(10092), }, 118: { Fustart: libc.Float32FromFloat64(0.019504), Fnus: int16(158), Fncum: int16(10250), }, 119: { Fustart: libc.Float32FromFloat64(0.019504), Fnus: int16(158), Fncum: int16(10408), }, 120: { Fustart: libc.Float32FromFloat64(0.016976), Fnus: int16(161), Fncum: int16(10566), }, 121: { Fustart: libc.Float32FromFloat64(0.016976), Fnus: int16(161), Fncum: int16(10727), }, 122: { Fustart: libc.Float32FromFloat64(0.016976), Fnus: int16(161), Fncum: int16(10888), }, 123: { Fustart: libc.Float32FromFloat64(0.016976), Fnus: int16(161), Fncum: int16(11049), }, 124: { Fustart: libc.Float32FromFloat64(0.012639), Fnus: int16(165), Fncum: int16(11210), }, 125: { Fustart: libc.Float32FromFloat64(0.012639), Fnus: int16(165), Fncum: int16(11375), }, 126: { Fustart: libc.Float32FromFloat64(0.012639), Fnus: int16(165), Fncum: int16(11540), }, 127: { Fustart: libc.Float32FromFloat64(0.009991), Fnus: int16(168), Fncum: int16(11705), }, 128: { Fustart: libc.Float32FromFloat64(0.009991), Fnus: int16(168), Fncum: int16(11873), }, 129: { Fustart: libc.Float32FromFloat64(0.009991), Fnus: int16(168), Fncum: int16(12041), }, 130: { Fustart: libc.Float32FromFloat64(0.009016), Fnus: int16(170), Fncum: int16(12209), }, 131: { Fustart: libc.Float32FromFloat64(0.009016), Fnus: int16(170), Fncum: int16(12379), }, 132: { Fustart: libc.Float32FromFloat64(0.009016), Fnus: int16(170), Fncum: int16(12549), }, 133: { Fustart: libc.Float32FromFloat64(0.006217), Fnus: int16(173), Fncum: int16(12719), }, 134: { Fustart: libc.Float32FromFloat64(0.006217), Fnus: int16(173), Fncum: int16(12892), }, 135: { Fustart: libc.Float32FromFloat64(0.005097), Fnus: int16(175), Fncum: int16(13065), }, 136: { Fustart: libc.Float32FromFloat64(0.005097), Fnus: int16(175), Fncum: int16(13240), }, 137: { Fustart: libc.Float32FromFloat64(0.005097), Fnus: int16(175), Fncum: int16(13415), }, 138: { Fustart: libc.Float32FromFloat64(0.003909), Fnus: int16(177), Fncum: int16(13590), }, 139: { Fustart: libc.Float32FromFloat64(0.003909), Fnus: int16(177), Fncum: int16(13767), }, 140: { Fustart: libc.Float32FromFloat64(0.00234), Fnus: int16(177), Fncum: int16(13944), }, 141: { Fustart: libc.Float32FromFloat64(0.002389), Fnus: int16(170), Fncum: int16(14121), }, 142: { Fustart: libc.Float32FromFloat64(0.001068), Fnus: int16(164), Fncum: int16(14291), }, 143: { Fustart: libc.Float32FromFloat64(0.001653), Fnus: int16(157), Fncum: int16(14455), }, 144: { Fustart: libc.Float32FromFloat64(0.000717), Fnus: int16(150), Fncum: int16(14612), }, 145: { Fustart: libc.Float32FromFloat64(0.001614), Fnus: int16(143), Fncum: int16(14762), }, 146: { Fustart: libc.Float32FromFloat64(0.00027), Fnus: int16(136), Fncum: int16(14905), }, 147: { Fustart: libc.Float32FromFloat64(0.000484), Fnus: int16(129), Fncum: int16(15041), }, 148: { Fustart: libc.Float32FromFloat64(0.001103), Fnus: int16(123), Fncum: int16(15170), }, 149: { Fustart: libc.Float32FromFloat64(0.001242), Fnus: int16(115), Fncum: int16(15293), }, 150: { Fustart: libc.Float32FromFloat64(0.001188), Fnus: int16(109), Fncum: int16(15408), }, 151: { Fustart: libc.Float32FromFloat64(0.001011), Fnus: int16(103), Fncum: int16(15517), }, 152: { Fustart: libc.Float32FromFloat64(0.000709), Fnus: int16(97), Fncum: int16(15620), }, 153: { Fustart: libc.Float32FromFloat64(0.000301), Fnus: int16(89), Fncum: int16(15717), }, 154: { Fustart: libc.Float32FromFloat64(0.002416), Fnus: int16(82), Fncum: int16(15806), }, 155: { Fustart: libc.Float32FromFloat64(0.003251), Fnus: int16(76), Fncum: int16(15888), }, 156: { Fustart: libc.Float32FromFloat64(0.003246), Fnus: int16(69), Fncum: int16(15964), }, 157: { Fustart: libc.Float32FromFloat64(0.004141), Fnus: int16(62), Fncum: int16(16033), }, 158: { Fustart: libc.Float32FromFloat64(0.005963), Fnus: int16(55), Fncum: int16(16095), }, 159: { Fustart: libc.Float32FromFloat64(0.008839), Fnus: int16(47), Fncum: int16(16150), }, 160: { Fustart: libc.Float32FromFloat64(0.01049), Fnus: int16(40), Fncum: int16(16197), }, 161: { Fustart: libc.Float32FromFloat64(0.016994), Fnus: int16(31), Fncum: int16(16237), }, 162: { Fustart: libc.Float32FromFloat64(0.023659), Fnus: int16(21), Fncum: int16(16268), }, } func _tiff_itrunc(tls *libc.TLS, x float64, m int32) (r int32) { if m == SGILOGENCODE_NODITHER { return int32(x) } /* Silence CoverityScan warning about bad crypto function */ /* coverity[dont_call] */ return int32(x + float64(libc.Xrand(tls))*(libc.Float64FromFloat64(1)/float64(libc.Int32FromInt32(RAND_MAX1))) - libc.Float64FromFloat64(0.5)) } func XLogL16toY(tls *libc.TLS, p16 int32) (r float64) { /* compute luminance from 16-bit LogL */ var Le int32 var Y, v1 float64 _, _, _ = Le, Y, v1 Le = p16 & int32(0x7fff) if !(Le != 0) { return float64(0) } Y = libc.Xexp(tls, libc.Float64FromFloat64(0.6931471805599453)/libc.Float64FromFloat64(256)*(float64(Le)+float64(0.5))-libc.Float64FromFloat64(0.6931471805599453)*libc.Float64FromFloat64(64)) if !(p16&libc.Int32FromInt32(0x8000) != 0) { v1 = Y } else { v1 = -Y } return v1 } func XLogL16fromY(tls *libc.TLS, Y float64, em int32) (r int32) { /* get 16-bit LogL from Y */ if Y >= float64(1.8371976e+19) { return int32(0x7fff) } if Y <= -libc.Float64FromFloat64(1.8371976e+19) { return int32(0xffff) } if Y > float64(5.4136769e-20) { return _tiff_itrunc(tls, float64(256)*(libc.Float64FromFloat64(1)/libc.Float64FromFloat64(0.6931471805599453)*libc.Xlog(tls, Y)+float64(64)), em) } if Y < -libc.Float64FromFloat64(5.4136769e-20) { return ^libc.Int32FromInt32(0x7fff) | _tiff_itrunc(tls, float64(256)*(libc.Float64FromFloat64(1)/libc.Float64FromFloat64(0.6931471805599453)*libc.Xlog(tls, -Y)+float64(64)), em) } return 0 } func _L16toY(tls *libc.TLS, sp uintptr, op uintptr, n Ttmsize_t) { var l16, yp, v2, v3 uintptr var v1 Ttmsize_t _, _, _, _, _ = l16, yp, v1, v2, v3 l16 = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf yp = op for { v1 = n n-- if !(v1 > 0) { break } v2 = yp yp += 4 v3 = l16 l16 += 2 *(*float32)(unsafe.Pointer(v2)) = float32(XLogL16toY(tls, int32(*(*Tint16_t)(unsafe.Pointer(v3))))) } } func _L16toGry(tls *libc.TLS, sp uintptr, op uintptr, n Ttmsize_t) { var Y float64 var gp, l16, v2, v3 uintptr var v1 Ttmsize_t var v4, v5 int32 _, _, _, _, _, _, _, _ = Y, gp, l16, v1, v2, v3, v4, v5 l16 = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf gp = op for { v1 = n n-- if !(v1 > 0) { break } v2 = l16 l16 += 2 Y = XLogL16toY(tls, int32(*(*Tint16_t)(unsafe.Pointer(v2)))) v3 = gp gp++ if Y <= float64(0) { v4 = 0 } else { if Y >= float64(1) { v5 = int32(255) } else { v5 = int32(libc.Float64FromFloat64(256) * libc.Xsqrt(tls, Y)) } v4 = v5 } *(*Tuint8_t)(unsafe.Pointer(v3)) = libc.Uint8FromInt32(v4) } } func _L16fromY(tls *libc.TLS, sp uintptr, op uintptr, n Ttmsize_t) { var l16, yp, v2, v3 uintptr var v1 Ttmsize_t _, _, _, _, _ = l16, yp, v1, v2, v3 l16 = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf yp = op for { v1 = n n-- if !(v1 > 0) { break } v2 = l16 l16 += 2 v3 = yp yp += 4 *(*Tint16_t)(unsafe.Pointer(v2)) = int16(XLogL16fromY(tls, float64(*(*float32)(unsafe.Pointer(v3))), (*TLogLuvState)(unsafe.Pointer(sp)).Fencode_meth)) } } func XXYZtoRGB24(tls *libc.TLS, xyz uintptr, rgb uintptr) { var b, g, r float64 var v1, v2, v3, v4, v5, v6 int32 _, _, _, _, _, _, _, _, _ = b, g, r, v1, v2, v3, v4, v5, v6 /* assume CCIR-709 primaries */ r = float64(2.69)*float64(*(*float32)(unsafe.Pointer(xyz))) + -libc.Float64FromFloat64(1.276)*float64(*(*float32)(unsafe.Pointer(xyz + 1*4))) + -libc.Float64FromFloat64(0.414)*float64(*(*float32)(unsafe.Pointer(xyz + 2*4))) g = -libc.Float64FromFloat64(1.022)*float64(*(*float32)(unsafe.Pointer(xyz))) + float64(1.978)*float64(*(*float32)(unsafe.Pointer(xyz + 1*4))) + float64(0.044)*float64(*(*float32)(unsafe.Pointer(xyz + 2*4))) b = float64(0.061)*float64(*(*float32)(unsafe.Pointer(xyz))) + -libc.Float64FromFloat64(0.224)*float64(*(*float32)(unsafe.Pointer(xyz + 1*4))) + float64(1.163)*float64(*(*float32)(unsafe.Pointer(xyz + 2*4))) /* assume 2.0 gamma for speed */ /* could use integer sqrt approx., but this is probably faster */ if r <= float64(0) { v1 = 0 } else { if r >= float64(1) { v2 = int32(255) } else { v2 = int32(libc.Float64FromFloat64(256) * libc.Xsqrt(tls, r)) } v1 = v2 } *(*Tuint8_t)(unsafe.Pointer(rgb)) = libc.Uint8FromInt32(v1) if g <= float64(0) { v3 = 0 } else { if g >= float64(1) { v4 = int32(255) } else { v4 = int32(libc.Float64FromFloat64(256) * libc.Xsqrt(tls, g)) } v3 = v4 } *(*Tuint8_t)(unsafe.Pointer(rgb + 1)) = libc.Uint8FromInt32(v3) if b <= float64(0) { v5 = 0 } else { if b >= float64(1) { v6 = int32(255) } else { v6 = int32(libc.Float64FromFloat64(256) * libc.Xsqrt(tls, b)) } v5 = v6 } *(*Tuint8_t)(unsafe.Pointer(rgb + 2)) = libc.Uint8FromInt32(v5) } func XLogL10toY(tls *libc.TLS, p10 int32) (r float64) { /* compute luminance from 10-bit LogL */ if p10 == 0 { return float64(0) } return libc.Xexp(tls, libc.Float64FromFloat64(0.6931471805599453)/libc.Float64FromFloat64(64)*(float64(p10)+float64(0.5))-libc.Float64FromFloat64(0.6931471805599453)*libc.Float64FromFloat64(12)) } func XLogL10fromY(tls *libc.TLS, Y float64, em int32) (r int32) { /* get 10-bit LogL from Y */ if Y >= float64(15.742) { return int32(0x3ff) } else { if Y <= float64(0.00024283) { return 0 } else { return _tiff_itrunc(tls, float64(64)*(libc.Float64FromFloat64(1)/libc.Float64FromFloat64(0.6931471805599453)*libc.Xlog(tls, Y)+float64(12)), em) } } return r } func _oog_encode(tls *libc.TLS, u float64, v float64) (r int32) { /* encode out-of-gamut chroma */ var ang, epsa, ua, va float64 var eps [100]float64 var i, i1, i2, ui, ustep, vi, v2, v4, v7 int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ang, eps, epsa, i, i1, i2, ua, ui, ustep, va, vi, v2, v4, v7 if !(_initialized != 0) { i = int32(100) for { v2 = i i-- if !(v2 != 0) { break } eps[i] = float64(2) goto _1 _1: } vi = int32(UV_NVS) for { v4 = vi vi-- if !(v4 != 0) { break } va = float64(libc.Float32FromFloat64(0.01694)) + (float64(vi)+float64(0.5))*float64(libc.Float32FromFloat64(0.0035)) ustep = int32(_uv_row[vi].Fnus) - int32(1) if vi == libc.Int32FromInt32(UV_NVS)-libc.Int32FromInt32(1) || vi == 0 || ustep <= 0 { ustep = int32(1) } ui = int32(_uv_row[vi].Fnus) - int32(1) for { if !(ui >= 0) { break } ua = float64(_uv_row[vi].Fustart) + (float64(ui)+float64(0.5))*float64(libc.Float32FromFloat64(0.0035)) ang = libc.Float64FromInt32(100)*libc.Float64FromFloat64(0.499999999)/float64(3.141592653589793)*libc.Xatan2(tls, va-float64(V_NEU), ua-float64(U_NEU)) + libc.Float64FromFloat64(0.5)*libc.Float64FromInt32(100) i = int32(ang) epsa = libc.Xfabs(tls, ang-(float64(i)+float64(0.5))) if epsa < eps[i] { _oog_table[i] = int32(_uv_row[vi].Fncum) + ui eps[i] = epsa } goto _5 _5: ; ui -= ustep } goto _3 _3: } i = int32(100) for { v7 = i i-- if !(v7 != 0) { break } /* fill any holes */ if eps[i] > float64(1.5) { i1 = int32(1) for { if !(i1 < libc.Int32FromInt32(100)/libc.Int32FromInt32(2)) { break } if eps[(i+i1)%int32(100)] < float64(1.5) { break } goto _8 _8: ; i1++ } i2 = int32(1) for { if !(i2 < libc.Int32FromInt32(100)/libc.Int32FromInt32(2)) { break } if eps[(i+int32(100)-i2)%int32(100)] < float64(1.5) { break } goto _9 _9: ; i2++ } if i1 < i2 { _oog_table[i] = _oog_table[(i+i1)%int32(100)] } else { _oog_table[i] = _oog_table[(i+int32(100)-i2)%int32(100)] } } goto _6 _6: } _initialized = int32(1) } i = int32(libc.Float64FromInt32(100)*libc.Float64FromFloat64(0.499999999)/libc.Float64FromFloat64(3.141592653589793)*libc.Xatan2(tls, v-float64(V_NEU), u-float64(U_NEU)) + libc.Float64FromFloat64(0.5)*libc.Float64FromInt32(100)) /* look up hue angle */ return _oog_table[i] } var _oog_table [100]int32 var _initialized int32 func Xuv_encode(tls *libc.TLS, u float64, v float64, em int32) (r int32) { /* encode (u',v') coordinates */ var ui int32 var vi uint32 _, _ = ui, vi /* check for NaN */ if u != u || v != v { u = float64(U_NEU) v = float64(V_NEU) } if v < float64(libc.Float32FromFloat64(0.01694)) { return _oog_encode(tls, u, v) } vi = libc.Uint32FromInt32(_tiff_itrunc(tls, (v-float64(libc.Float32FromFloat64(0.01694)))*(float64(1)/float64(libc.Float32FromFloat64(0.0035))), em)) if vi >= uint32(UV_NVS) { return _oog_encode(tls, u, v) } if u < float64(_uv_row[vi].Fustart) { return _oog_encode(tls, u, v) } ui = _tiff_itrunc(tls, (u-float64(_uv_row[vi].Fustart))*(float64(1)/float64(libc.Float32FromFloat64(0.0035))), em) if ui >= int32(_uv_row[vi].Fnus) { return _oog_encode(tls, u, v) } return int32(_uv_row[vi].Fncum) + ui } func Xuv_decode(tls *libc.TLS, up uintptr, vp uintptr, c int32) (r int32) { /* decode (u',v') index */ var lower, upper, vi uint32 var ui int32 _, _, _, _ = lower, ui, upper, vi if c < 0 || c >= int32(UV_NDIVS) { return -int32(1) } lower = uint32(0) /* binary search */ upper = uint32(UV_NVS) for upper-lower > uint32(1) { vi = (lower + upper) >> int32(1) ui = c - int32(_uv_row[vi].Fncum) if ui > 0 { lower = vi } else { if ui < 0 { upper = vi } else { lower = vi break } } } vi = lower ui = c - int32(_uv_row[vi].Fncum) *(*float64)(unsafe.Pointer(up)) = float64(_uv_row[vi].Fustart) + (float64(ui)+float64(0.5))*float64(libc.Float32FromFloat64(0.0035)) *(*float64)(unsafe.Pointer(vp)) = float64(libc.Float32FromFloat64(0.01694)) + (float64(vi)+float64(0.5))*float64(libc.Float32FromFloat64(0.0035)) return 0 } func XLogLuv24toXYZ(tls *libc.TLS, p Tuint32_t, XYZ uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var Ce int32 var L, s, x, y float64 var v1, v2 float32 var _ /* u at bp+0 */ float64 var _ /* v at bp+8 */ float64 _, _, _, _, _, _, _ = Ce, L, s, x, y, v1, v2 /* decode luminance */ L = XLogL10toY(tls, libc.Int32FromUint32(p>>int32(14)&uint32(0x3ff))) if L <= float64(0) { v2 = libc.Float32FromFloat64(0) *(*float32)(unsafe.Pointer(XYZ + 2*4)) = v2 v1 = v2 *(*float32)(unsafe.Pointer(XYZ + 1*4)) = v1 *(*float32)(unsafe.Pointer(XYZ)) = v1 return } /* decode color */ Ce = libc.Int32FromUint32(p & uint32(0x3fff)) if Xuv_decode(tls, bp, bp+8, Ce) < 0 { *(*float64)(unsafe.Pointer(bp)) = float64(U_NEU) *(*float64)(unsafe.Pointer(bp + 8)) = float64(V_NEU) } s = float64(1) / (float64(6)**(*float64)(unsafe.Pointer(bp)) - float64(16)**(*float64)(unsafe.Pointer(bp + 8)) + float64(12)) x = float64(9) * *(*float64)(unsafe.Pointer(bp)) * s y = float64(4) * *(*float64)(unsafe.Pointer(bp + 8)) * s /* convert to XYZ */ *(*float32)(unsafe.Pointer(XYZ)) = float32(x / y * L) *(*float32)(unsafe.Pointer(XYZ + 1*4)) = float32(L) *(*float32)(unsafe.Pointer(XYZ + 2*4)) = float32((libc.Float64FromFloat64(1) - x - y) / y * L) } func XLogLuv24fromXYZ(tls *libc.TLS, XYZ uintptr, em int32) (r Tuint32_t) { var Ce, Le int32 var s, u, v float64 _, _, _, _, _ = Ce, Le, s, u, v /* encode luminance */ Le = XLogL10fromY(tls, float64(*(*float32)(unsafe.Pointer(XYZ + 1*4))), em) /* encode color */ s = float64(*(*float32)(unsafe.Pointer(XYZ))) + float64(15)*float64(*(*float32)(unsafe.Pointer(XYZ + 1*4))) + float64(3)*float64(*(*float32)(unsafe.Pointer(XYZ + 2*4))) if !(Le != 0) || s <= float64(0) { u = float64(U_NEU) v = float64(V_NEU) } else { u = float64(4) * float64(*(*float32)(unsafe.Pointer(XYZ))) / s v = float64(9) * float64(*(*float32)(unsafe.Pointer(XYZ + 1*4))) / s } Ce = Xuv_encode(tls, u, v, em) if Ce < 0 { /* never happens */ Ce = Xuv_encode(tls, float64(U_NEU), float64(V_NEU), SGILOGENCODE_NODITHER) } /* combine encodings */ return libc.Uint32FromInt32(Le< 0) { break } XLogLuv24toXYZ(tls, *(*Tuint32_t)(unsafe.Pointer(luv)), xyz) xyz += uintptr(3) * 4 luv += 4 } } func _Luv24toLuv48(tls *libc.TLS, sp uintptr, op uintptr, n Ttmsize_t) { bp := tls.Alloc(16) defer tls.Free(16) var luv, luv3, v2, v3, v4 uintptr var v1 Ttmsize_t var _ /* u at bp+0 */ float64 var _ /* v at bp+8 */ float64 _, _, _, _, _, _ = luv, luv3, v1, v2, v3, v4 luv = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf luv3 = op for { v1 = n n-- if !(v1 > 0) { break } v2 = luv3 luv3 += 2 *(*Tint16_t)(unsafe.Pointer(v2)) = libc.Int16FromUint32(*(*Tuint32_t)(unsafe.Pointer(luv))>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0xffd) + libc.Uint32FromInt32(13314)) if Xuv_decode(tls, bp, bp+8, libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(luv))&uint32(0x3fff))) < 0 { *(*float64)(unsafe.Pointer(bp)) = float64(U_NEU) *(*float64)(unsafe.Pointer(bp + 8)) = float64(V_NEU) } v3 = luv3 luv3 += 2 *(*Tint16_t)(unsafe.Pointer(v3)) = int16(*(*float64)(unsafe.Pointer(bp)) * float64(libc.Int32FromInt32(1)< 0) { break } v2 = luv luv += 4 XLogLuv24toXYZ(tls, *(*Tuint32_t)(unsafe.Pointer(v2)), bp) XXYZtoRGB24(tls, bp, rgb) rgb += uintptr(3) } } func _Luv24fromXYZ(tls *libc.TLS, sp uintptr, op uintptr, n Ttmsize_t) { var luv, xyz, v2 uintptr var v1 Ttmsize_t _, _, _, _ = luv, xyz, v1, v2 luv = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf xyz = op for { v1 = n n-- if !(v1 > 0) { break } v2 = luv luv += 4 *(*Tuint32_t)(unsafe.Pointer(v2)) = XLogLuv24fromXYZ(tls, xyz, (*TLogLuvState)(unsafe.Pointer(sp)).Fencode_meth) xyz += uintptr(3) * 4 } } func _Luv24fromLuv48(tls *libc.TLS, sp uintptr, op uintptr, n Ttmsize_t) { var Ce, Le int32 var luv, luv3, v2 uintptr var v1 Ttmsize_t _, _, _, _, _, _ = Ce, Le, luv, luv3, v1, v2 luv = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf luv3 = op for { v1 = n n-- if !(v1 > 0) { break } if int32(*(*Tint16_t)(unsafe.Pointer(luv3))) <= 0 { Le = 0 } else { if int32(*(*Tint16_t)(unsafe.Pointer(luv3))) >= libc.Int32FromInt32(1)<> int32(2) } else { Le = _tiff_itrunc(tls, float64(0.25)*(float64(*(*Tint16_t)(unsafe.Pointer(luv3)))-float64(3314)), (*TLogLuvState)(unsafe.Pointer(sp)).Fencode_meth) } } } Ce = Xuv_encode(tls, (float64(*(*Tint16_t)(unsafe.Pointer(luv3 + 1*2)))+float64(0.5))/float64(libc.Int32FromInt32(1)<>int32(16)) if L <= float64(0) { v2 = libc.Float32FromFloat64(0) *(*float32)(unsafe.Pointer(XYZ + 2*4)) = v2 v1 = v2 *(*float32)(unsafe.Pointer(XYZ + 1*4)) = v1 *(*float32)(unsafe.Pointer(XYZ)) = v1 return } /* decode color */ u = libc.Float64FromFloat64(1) / libc.Float64FromFloat64(410) * (float64(p>>libc.Int32FromInt32(8)&libc.Uint32FromInt32(0xff)) + float64(0.5)) v = libc.Float64FromFloat64(1) / libc.Float64FromFloat64(410) * (float64(p&libc.Uint32FromInt32(0xff)) + float64(0.5)) s = float64(1) / (float64(6)*u - float64(16)*v + float64(12)) x = float64(9) * u * s y = float64(4) * v * s /* convert to XYZ */ *(*float32)(unsafe.Pointer(XYZ)) = float32(x / y * L) *(*float32)(unsafe.Pointer(XYZ + 1*4)) = float32(L) *(*float32)(unsafe.Pointer(XYZ + 2*4)) = float32((libc.Float64FromFloat64(1) - x - y) / y * L) } func XLogLuv32fromXYZ(tls *libc.TLS, XYZ uintptr, em int32) (r Tuint32_t) { var Le, ue, ve uint32 var s, u, v float64 _, _, _, _, _, _ = Le, s, u, ue, v, ve /* encode luminance */ Le = libc.Uint32FromInt32(XLogL16fromY(tls, float64(*(*float32)(unsafe.Pointer(XYZ + 1*4))), em)) /* encode color */ s = float64(*(*float32)(unsafe.Pointer(XYZ))) + float64(15)*float64(*(*float32)(unsafe.Pointer(XYZ + 1*4))) + float64(3)*float64(*(*float32)(unsafe.Pointer(XYZ + 2*4))) if !(Le != 0) || s <= float64(0) { u = float64(U_NEU) v = float64(V_NEU) } else { u = float64(4) * float64(*(*float32)(unsafe.Pointer(XYZ))) / s v = float64(9) * float64(*(*float32)(unsafe.Pointer(XYZ + 1*4))) / s } if u <= float64(0) { ue = uint32(0) } else { ue = libc.Uint32FromInt32(_tiff_itrunc(tls, float64(410)*u, em)) } if ue > uint32(255) { ue = uint32(255) } if v <= float64(0) { ve = uint32(0) } else { ve = libc.Uint32FromInt32(_tiff_itrunc(tls, float64(410)*v, em)) } if ve > uint32(255) { ve = uint32(255) } /* combine encodings */ return Le< 0) { break } v2 = luv luv += 4 XLogLuv32toXYZ(tls, *(*Tuint32_t)(unsafe.Pointer(v2)), xyz) xyz += uintptr(3) * 4 } } func _Luv32toLuv48(tls *libc.TLS, sp uintptr, op uintptr, n Ttmsize_t) { var luv, luv3, v2, v3, v4 uintptr var u, v float64 var v1 Ttmsize_t _, _, _, _, _, _, _, _ = luv, luv3, u, v, v1, v2, v3, v4 luv = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf luv3 = op for { v1 = n n-- if !(v1 > 0) { break } v2 = luv3 luv3 += 2 *(*Tint16_t)(unsafe.Pointer(v2)) = libc.Int16FromUint32(*(*Tuint32_t)(unsafe.Pointer(luv)) >> libc.Int32FromInt32(16)) u = libc.Float64FromFloat64(1) / libc.Float64FromFloat64(410) * (float64(*(*Tuint32_t)(unsafe.Pointer(luv))>>libc.Int32FromInt32(8)&libc.Uint32FromInt32(0xff)) + float64(0.5)) v = libc.Float64FromFloat64(1) / libc.Float64FromFloat64(410) * (float64(*(*Tuint32_t)(unsafe.Pointer(luv))&libc.Uint32FromInt32(0xff)) + float64(0.5)) v3 = luv3 luv3 += 2 *(*Tint16_t)(unsafe.Pointer(v3)) = int16(u * float64(libc.Int32FromInt32(1)< 0) { break } v2 = luv luv += 4 XLogLuv32toXYZ(tls, *(*Tuint32_t)(unsafe.Pointer(v2)), bp) XXYZtoRGB24(tls, bp, rgb) rgb += uintptr(3) } } func _Luv32fromXYZ(tls *libc.TLS, sp uintptr, op uintptr, n Ttmsize_t) { var luv, xyz, v2 uintptr var v1 Ttmsize_t _, _, _, _ = luv, xyz, v1, v2 luv = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf xyz = op for { v1 = n n-- if !(v1 > 0) { break } v2 = luv luv += 4 *(*Tuint32_t)(unsafe.Pointer(v2)) = XLogLuv32fromXYZ(tls, xyz, (*TLogLuvState)(unsafe.Pointer(sp)).Fencode_meth) xyz += uintptr(3) * 4 } } func _Luv32fromLuv48(tls *libc.TLS, sp uintptr, op uintptr, n Ttmsize_t) { var luv, luv3, v2, v4 uintptr var v1, v3 Ttmsize_t _, _, _, _, _, _ = luv, luv3, v1, v2, v3, v4 luv = (*TLogLuvState)(unsafe.Pointer(sp)).Ftbuf luv3 = op if (*TLogLuvState)(unsafe.Pointer(sp)).Fencode_meth == SGILOGENCODE_NODITHER { for { v1 = n n-- if !(v1 > 0) { break } v2 = luv luv += 4 *(*Tuint32_t)(unsafe.Pointer(v2)) = libc.Uint32FromInt16(*(*Tint16_t)(unsafe.Pointer(luv3)))<>int32(7)&uint32(0xff00) | libc.Uint32FromInt16(*(*Tint16_t)(unsafe.Pointer(luv3 + 2*2)))*uint32(libc.Float64FromFloat64(410)+libc.Float64FromFloat64(0.5))>>int32(15)&uint32(0xff) luv3 += uintptr(3) * 2 } return } for { v3 = n n-- if !(v3 > 0) { break } v4 = luv luv += 4 *(*Tuint32_t)(unsafe.Pointer(v4)) = libc.Uint32FromInt16(*(*Tint16_t)(unsafe.Pointer(luv3)))<= int32(2) && libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata))) == 0 && libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata + 1)))&int32(0x1) != 0 { if !((*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_decode != 0) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module64)), __ccgo_ts+40869, 0) /* * Override default decoding methods with * ones that deal with the old coding. * Otherwise the predictor versions set * above will call the compatibility routines * through the dec_decode method. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_LZWDecodeCompat) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_LZWDecodeCompat) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_LZWDecodeCompat) /* * If doing horizontal differencing, must * re-setup the predictor logic since we * switched the basic decoder methods... */ (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode})))(tls, tif) (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_decode = __ccgo_fp(_LZWDecodeCompat) } (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fmaxcode = libc.Uint16FromInt32(libc.Int32FromInt32(1)< occ { /* * Residue from previous decode is sufficient * to satisfy decode request. Skip to the * start of the decoded string, place decoded * values in the output buffer, and return. */ *(*Ttmsize_t)(unsafe.Pointer(sp + 88)) += occ for { codep = (*Tcode_t)(unsafe.Pointer(codep)).Fnext goto _2 _2: ; residue-- v1 = residue if !(v1 > occ && codep != 0) { break } } if codep != 0 { tp = op + uintptr(occ) for { tp-- v5 = tp *(*Tuint8_t)(unsafe.Pointer(v5)) = (*Tcode_t)(unsafe.Pointer(codep)).Fvalue codep = (*Tcode_t)(unsafe.Pointer(codep)).Fnext goto _4 _4: ; occ-- v3 = occ if !(v3 != 0 && codep != 0) { break } } } return int32(1) } /* * Residue satisfies only part of the decode request. */ op += uintptr(residue) occ -= residue tp1 = op for { tp1-- v8 = tp1 *(*Tuint8_t)(unsafe.Pointer(v8)) = (*Tcode_t)(unsafe.Pointer(codep)).Fvalue codep = (*Tcode_t)(unsafe.Pointer(codep)).Fnext goto _7 _7: ; residue-- v6 = residue if !(v6 != 0 && codep != 0) { break } } (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_restart = 0 } bp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp *(*Tuint64_t)(unsafe.Pointer(sp + 96)) += (libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) - libc.Uint64FromInt32((*TLZWCodecState)(unsafe.Pointer(sp)).Fold_tif_rawcc)) << int32(3) dec_bitsleft = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_bitsleft nbits = libc.Int32FromUint16((*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnbits) *(*TWordType)(unsafe.Pointer(bp1)) = (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnextdata nextbits = (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnextbits nbitsmask = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_nbitsmask oldcodep = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_oldcodep free_entp = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_free_entp maxcodep = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_maxcodep dec_codetab = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_codetab if occ == 0 { goto after_loop } goto begin begin: ; nextbits -= nbits if nextbits < 0 { if dec_bitsleft >= libc.Uint64FromInt32(libc.Int32FromInt32(8)*libc.Int32FromInt32(SIZEOF_SIZE_T)) { codetmp = *(*TWordType)(unsafe.Pointer(bp1)) << -nextbits libc.Xmemcpy(tls, bp1, bp, uint32(4)) *(*TWordType)(unsafe.Pointer(bp1)) = libc.X__builtin_bswap32(tls, *(*TWordType)(unsafe.Pointer(bp1))) bp += uintptr(SIZEOF_SIZE_T) nextbits += libc.Int32FromInt32(8) * libc.Int32FromInt32(SIZEOF_SIZE_T) dec_bitsleft -= libc.Uint64FromInt32(libc.Int32FromInt32(8) * libc.Int32FromInt32(SIZEOF_SIZE_T)) code = (codetmp | *(*TWordType)(unsafe.Pointer(bp1))>>nextbits) & libc.Uint32FromInt32(nbitsmask) goto _9 } else { if dec_bitsleft < uint64(8) { goto no_eoi } v11 = bp bp++ *(*TWordType)(unsafe.Pointer(bp1)) = *(*TWordType)(unsafe.Pointer(bp1))<> nextbits & libc.Uint32FromInt32(nbitsmask) goto _10 _10: ; goto _9 _9: /**/ ; // codep1 = dec_codetab + uintptr(code)*12 if code >= uint32(CODE_FIRST) { goto code_above_or_equal_to_258 } if code < uint32(256) { goto code_below_256 } if code == uint32(CODE_EOI) { goto after_loop } goto code_clear goto code_below_256 code_below_256: ; if codep1 > free_entp { goto error_code } (*Tcode_t)(unsafe.Pointer(free_entp)).Fnext = oldcodep (*Tcode_t)(unsafe.Pointer(free_entp)).Ffirstchar = (*Tcode_t)(unsafe.Pointer(oldcodep)).Ffirstchar (*Tcode_t)(unsafe.Pointer(free_entp)).Flength = libc.Uint16FromInt32(libc.Int32FromUint16((*Tcode_t)(unsafe.Pointer(oldcodep)).Flength) + int32(1)) (*Tcode_t)(unsafe.Pointer(free_entp)).Fvalue = uint8(code) (*Tcode_t)(unsafe.Pointer(free_entp)).Frepeated = libc.Uint8FromInt32(libc.Int32FromUint8((*Tcode_t)(unsafe.Pointer(oldcodep)).Frepeated) & libc.BoolInt32(uint32((*Tcode_t)(unsafe.Pointer(oldcodep)).Fvalue) == code)) free_entp += 12 v13 = free_entp if v13 > maxcodep { nbits++ v14 = nbits if v14 > int32(BITS_MAX) { /* should not happen for a conformant encoder */ nbits = int32(BITS_MAX) } nbitsmask = int32(1)<= dec_codetab+uintptr(libc.Int32FromInt32(1)<= free_entp { if codep1 != free_entp { goto error_code } (*Tcode_t)(unsafe.Pointer(free_entp)).Fvalue = (*Tcode_t)(unsafe.Pointer(oldcodep)).Ffirstchar } else { (*Tcode_t)(unsafe.Pointer(free_entp)).Fvalue = (*Tcode_t)(unsafe.Pointer(codep1)).Ffirstchar } (*Tcode_t)(unsafe.Pointer(free_entp)).Frepeated = libc.Uint8FromInt32(libc.Int32FromUint8((*Tcode_t)(unsafe.Pointer(oldcodep)).Frepeated) & libc.BoolInt32(libc.Int32FromUint8((*Tcode_t)(unsafe.Pointer(oldcodep)).Fvalue) == libc.Int32FromUint8((*Tcode_t)(unsafe.Pointer(free_entp)).Fvalue))) (*Tcode_t)(unsafe.Pointer(free_entp)).Fnext = oldcodep (*Tcode_t)(unsafe.Pointer(free_entp)).Ffirstchar = (*Tcode_t)(unsafe.Pointer(oldcodep)).Ffirstchar (*Tcode_t)(unsafe.Pointer(free_entp)).Flength = libc.Uint16FromInt32(libc.Int32FromUint16((*Tcode_t)(unsafe.Pointer(oldcodep)).Flength) + int32(1)) free_entp += 12 v16 = free_entp if v16 > maxcodep { nbits++ v17 = nbits if v17 > int32(BITS_MAX) { /* should not happen for a conformant encoder */ nbits = int32(BITS_MAX) } nbitsmask = int32(1)<= dec_codetab+uintptr(libc.Int32FromInt32(1)< 0 */ } if libc.Int32FromUint16(len1) == int32(3) { if occ <= int32(3) { if occ == int32(3) { *(*Tuint8_t)(unsafe.Pointer(op)) = (*Tcode_t)(unsafe.Pointer(codep1)).Ffirstchar *(*Tuint8_t)(unsafe.Pointer(op + 1)) = (*Tcode_ent)(unsafe.Pointer((*Tcode_t)(unsafe.Pointer(codep1)).Fnext)).Fvalue *(*Tuint8_t)(unsafe.Pointer(op + 2)) = (*Tcode_t)(unsafe.Pointer(codep1)).Fvalue op += uintptr(3) occ -= int32(3) goto after_loop } goto too_short_buffer } *(*Tuint8_t)(unsafe.Pointer(op)) = (*Tcode_t)(unsafe.Pointer(codep1)).Ffirstchar *(*Tuint8_t)(unsafe.Pointer(op + 1)) = (*Tcode_ent)(unsafe.Pointer((*Tcode_t)(unsafe.Pointer(codep1)).Fnext)).Fvalue *(*Tuint8_t)(unsafe.Pointer(op + 2)) = (*Tcode_t)(unsafe.Pointer(codep1)).Fvalue op += uintptr(3) occ -= int32(3) goto begin /* we can save the comparison occ > 0 */ } if libc.Int32FromUint16(len1) > occ { goto too_short_buffer } if (*Tcode_t)(unsafe.Pointer(codep1)).Frepeated != 0 { libc.Xmemset(tls, op, libc.Int32FromUint8((*Tcode_t)(unsafe.Pointer(codep1)).Fvalue), uint32(len1)) op += uintptr(len1) occ -= libc.Int32FromUint16(len1) if occ == 0 { goto after_loop } goto begin } tp2 = op + uintptr(len1) tp2-- v18 = tp2 *(*Tuint8_t)(unsafe.Pointer(v18)) = (*Tcode_t)(unsafe.Pointer(codep1)).Fvalue codep1 = (*Tcode_t)(unsafe.Pointer(codep1)).Fnext tp2-- v19 = tp2 *(*Tuint8_t)(unsafe.Pointer(v19)) = (*Tcode_t)(unsafe.Pointer(codep1)).Fvalue codep1 = (*Tcode_t)(unsafe.Pointer(codep1)).Fnext tp2-- v20 = tp2 *(*Tuint8_t)(unsafe.Pointer(v20)) = (*Tcode_t)(unsafe.Pointer(codep1)).Fvalue codep1 = (*Tcode_t)(unsafe.Pointer(codep1)).Fnext tp2-- v21 = tp2 *(*Tuint8_t)(unsafe.Pointer(v21)) = (*Tcode_t)(unsafe.Pointer(codep1)).Fvalue if tp2 > op { for cond := true; cond; cond = tp2 > op { codep1 = (*Tcode_t)(unsafe.Pointer(codep1)).Fnext tp2-- v22 = tp2 *(*Tuint8_t)(unsafe.Pointer(v22)) = (*Tcode_t)(unsafe.Pointer(codep1)).Fvalue } } op += uintptr(len1) occ -= libc.Int32FromUint16(len1) if occ == 0 { goto after_loop } goto begin goto code_clear code_clear: ; free_entp = dec_codetab + uintptr(CODE_FIRST)*12 nbits = int32(BITS_MIN) nbitsmask = libc.Int32FromInt32(1)<= libc.Uint64FromInt32(libc.Int32FromInt32(8)*libc.Int32FromInt32(SIZEOF_SIZE_T)) { codetmp1 = *(*TWordType)(unsafe.Pointer(bp1)) << -nextbits libc.Xmemcpy(tls, bp1, bp, uint32(4)) *(*TWordType)(unsafe.Pointer(bp1)) = libc.X__builtin_bswap32(tls, *(*TWordType)(unsafe.Pointer(bp1))) bp += uintptr(SIZEOF_SIZE_T) nextbits += libc.Int32FromInt32(8) * libc.Int32FromInt32(SIZEOF_SIZE_T) dec_bitsleft -= libc.Uint64FromInt32(libc.Int32FromInt32(8) * libc.Int32FromInt32(SIZEOF_SIZE_T)) code = (codetmp1 | *(*TWordType)(unsafe.Pointer(bp1))>>nextbits) & libc.Uint32FromInt32(nbitsmask) goto _23 } else { if dec_bitsleft < uint64(8) { goto no_eoi } v25 = bp bp++ *(*TWordType)(unsafe.Pointer(bp1)) = *(*TWordType)(unsafe.Pointer(bp1))<> nextbits & libc.Uint32FromInt32(nbitsmask) goto _24 _24: ; goto _23 _23: /**/ // } /* consecutive CODE_CLEAR codes */ if code == uint32(CODE_EOI) { goto after_loop } if code > uint32(CODE_EOI) { goto error_code } v27 = op op++ *(*Tuint8_t)(unsafe.Pointer(v27)) = uint8(code) occ-- oldcodep = dec_codetab + uintptr(code)*12 if occ == 0 { goto after_loop } goto begin goto too_short_buffer too_short_buffer: ; /* * String is too long for decode buffer, * locate portion that will fit, copy to * the decode buffer, and setup restart * logic for the next decoding call. */ (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_codep = codep1 for cond := true; cond; cond = libc.Int32FromUint16((*Tcode_t)(unsafe.Pointer(codep1)).Flength) > occ { codep1 = (*Tcode_t)(unsafe.Pointer(codep1)).Fnext } (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_restart = occ tp3 = op + uintptr(occ) for { tp3-- v30 = tp3 *(*Tuint8_t)(unsafe.Pointer(v30)) = (*Tcode_t)(unsafe.Pointer(codep1)).Fvalue codep1 = (*Tcode_t)(unsafe.Pointer(codep1)).Fnext goto _29 _29: ; occ-- v28 = occ if !(v28 != 0) { break } } goto after_loop after_loop: ; *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= int32(bp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = bp (*TLZWCodecState)(unsafe.Pointer(sp)).Fold_tif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_bitsleft = dec_bitsleft (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnbits = libc.Uint16FromInt32(nbits) (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnextdata = *(*TWordType)(unsafe.Pointer(bp1)) (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnextbits = nextbits (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_nbitsmask = nbitsmask (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_oldcodep = oldcodep (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_free_entp = free_entp (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_maxcodep = maxcodep if occ > 0 { libc.Xmemset(tls, op, 0, libc.Uint32FromInt32(occ)) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module65)), __ccgo_ts+40963, libc.VaList(bp1+16, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, libc.Uint64FromInt32(occ))) return 0 } return int32(1) goto no_eoi no_eoi: ; libc.Xmemset(tls, op, 0, libc.Uint32FromInt32(occ)) (*TLZWCodecState)(unsafe.Pointer(sp)).Fread_error = int32(1) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module65)), __ccgo_ts+41013, libc.VaList(bp1+16, (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip)) return 0 goto error_code error_code: ; libc.Xmemset(tls, op, 0, libc.Uint32FromInt32(occ)) (*TLZWCodecState)(unsafe.Pointer(sp)).Fread_error = int32(1) XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+41062, 0) return 0 } var _module65 = [10]uint8{'L', 'Z', 'W', 'D', 'e', 'c', 'o', 'd', 'e'} /* * This check shouldn't be necessary because each * strip is suppose to be terminated with CODE_EOI. */ /* * Decode a "hunk of data" for old images. */ func _LZWDecodeCompat(tls *libc.TLS, tif uintptr, op0 uintptr, occ0 Ttmsize_t, s Tuint16_t) (r int32) { bp1 := tls.Alloc(32) defer tls.Free(32) var bp, codep, free_entp, maxcodep, oldcodep, op, sp, tp, v10, v11, v12, v13, v15, v19, v20, v21, v5, v8, v9 uintptr var code, len1, nbits, nbitsmask, nextbits, v14, v16 int32 var dec_bitsleft Tuint64_t var nextdata TWordType var occ, residue, v1, v17, v3, v6 Ttmsize_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bp, code, codep, dec_bitsleft, free_entp, len1, maxcodep, nbits, nbitsmask, nextbits, nextdata, occ, oldcodep, op, residue, sp, tp, v1, v10, v11, v12, v13, v14, v15, v16, v17, v19, v20, v21, v3, v5, v6, v8, v9 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data op = op0 occ = occ0 _ = s /* * Restart interrupted output operation. */ if (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_restart != 0 { codep = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_codep residue = libc.Int32FromUint16((*Tcode_t)(unsafe.Pointer(codep)).Flength) - (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_restart if residue > occ { /* * Residue from previous decode is sufficient * to satisfy decode request. Skip to the * start of the decoded string, place decoded * values in the output buffer, and return. */ *(*Ttmsize_t)(unsafe.Pointer(sp + 88)) += occ for { codep = (*Tcode_t)(unsafe.Pointer(codep)).Fnext goto _2 _2: ; residue-- v1 = residue if !(v1 > occ) { break } } tp = op + uintptr(occ) for { tp-- v5 = tp *(*Tuint8_t)(unsafe.Pointer(v5)) = (*Tcode_t)(unsafe.Pointer(codep)).Fvalue codep = (*Tcode_t)(unsafe.Pointer(codep)).Fnext goto _4 _4: ; occ-- v3 = occ if !(v3 != 0) { break } } return int32(1) } /* * Residue satisfies only part of the decode request. */ op += uintptr(residue) occ -= residue tp = op for { tp-- v8 = tp *(*Tuint8_t)(unsafe.Pointer(v8)) = (*Tcode_t)(unsafe.Pointer(codep)).Fvalue codep = (*Tcode_t)(unsafe.Pointer(codep)).Fnext goto _7 _7: ; residue-- v6 = residue if !(v6 != 0) { break } } (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_restart = 0 } bp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp *(*Tuint64_t)(unsafe.Pointer(sp + 96)) += (libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) - libc.Uint64FromInt32((*TLZWCodecState)(unsafe.Pointer(sp)).Fold_tif_rawcc)) << int32(3) dec_bitsleft = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_bitsleft nbits = libc.Int32FromUint16((*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnbits) nextdata = (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnextdata nextbits = (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnextbits nbitsmask = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_nbitsmask oldcodep = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_oldcodep free_entp = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_free_entp maxcodep = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_maxcodep for occ > 0 { if dec_bitsleft < libc.Uint64FromInt32(nbits) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module66)), __ccgo_ts+41013, libc.VaList(bp1+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip)) code = int32(CODE_EOI) } else { v9 = bp bp++ nextdata = nextdata | uint32(*(*Tuint8_t)(unsafe.Pointer(v9)))<>= libc.Uint32FromInt32(nbits) nextbits -= nbits dec_bitsleft -= libc.Uint64FromInt32(nbits) } if code == int32(CODE_EOI) { break } if code == int32(CODE_CLEAR) { for cond := true; cond; cond = code == int32(CODE_CLEAR) { free_entp = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_codetab + uintptr(CODE_FIRST)*12 X_TIFFmemset(tls, free_entp, 0, libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt32(1)<>= libc.Uint32FromInt32(nbits) nextbits -= nbits dec_bitsleft -= libc.Uint64FromInt32(nbits) } } /* consecutive CODE_CLEAR codes */ if code == int32(CODE_EOI) { break } if code > int32(CODE_CLEAR) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+41090, libc.VaList(bp1+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row)) return 0 } v13 = op op++ *(*Tuint8_t)(unsafe.Pointer(v13)) = libc.Uint8FromInt32(code) occ-- oldcodep = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_codetab + uintptr(code)*12 continue } codep = (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_codetab + uintptr(code)*12 /* * Add the new entry to the code table. */ if free_entp < (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_codetab || free_entp >= (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_codetab+uintptr(libc.Int32FromInt32(1)<= (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_codetab+uintptr(libc.Int32FromInt32(1)< maxcodep { nbits++ v16 = nbits if v16 > int32(BITS_MAX) { /* should not happen */ nbits = int32(BITS_MAX) } nbitsmask = int32(1)<= int32(256) { /* * Code maps to a string, copy string * value to output (written in reverse). */ if libc.Int32FromUint16((*Tcode_t)(unsafe.Pointer(codep)).Flength) == 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module66)), __ccgo_ts+41171, libc.VaList(bp1+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row)) return 0 } if libc.Int32FromUint16((*Tcode_t)(unsafe.Pointer(codep)).Flength) > occ { /* * String is too long for decode buffer, * locate portion that will fit, copy to * the decode buffer, and setup restart * logic for the next decoding call. */ (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_codep = codep for cond := true; cond; cond = libc.Int32FromUint16((*Tcode_t)(unsafe.Pointer(codep)).Flength) > occ { codep = (*Tcode_t)(unsafe.Pointer(codep)).Fnext } (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_restart = occ tp = op + uintptr(occ) for { tp-- v19 = tp *(*Tuint8_t)(unsafe.Pointer(v19)) = (*Tcode_t)(unsafe.Pointer(codep)).Fvalue codep = (*Tcode_t)(unsafe.Pointer(codep)).Fnext goto _18 _18: ; occ-- v17 = occ if !(v17 != 0) { break } } break } len1 = libc.Int32FromUint16((*Tcode_t)(unsafe.Pointer(codep)).Flength) tp = op + uintptr(len1) for cond := true; cond; cond = codep != 0 && tp > op { tp-- v20 = tp *(*Tuint8_t)(unsafe.Pointer(v20)) = (*Tcode_t)(unsafe.Pointer(codep)).Fvalue codep = (*Tcode_t)(unsafe.Pointer(codep)).Fnext } op += uintptr(len1) occ -= len1 } else { v21 = op op++ *(*Tuint8_t)(unsafe.Pointer(v21)) = libc.Uint8FromInt32(code) occ-- } } *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) -= int32(bp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = bp (*TLZWCodecState)(unsafe.Pointer(sp)).Fold_tif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_bitsleft = dec_bitsleft (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnbits = libc.Uint16FromInt32(nbits) (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnextdata = nextdata (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnextbits = nextbits (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_nbitsmask = nbitsmask (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_oldcodep = oldcodep (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_free_entp = free_entp (*TLZWCodecState)(unsafe.Pointer(sp)).Fdec_maxcodep = maxcodep if occ > 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module66)), __ccgo_ts+40963, libc.VaList(bp1+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, libc.Uint64FromInt32(occ))) return 0 } return int32(1) } var _module66 = [16]uint8{'L', 'Z', 'W', 'D', 'e', 'c', 'o', 'd', 'e', 'C', 'o', 'm', 'p', 'a', 't'} /* * LZW Encoding. */ func _LZWSetupEncode(tls *libc.TLS, tif uintptr) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data (*TLZWCodecState)(unsafe.Pointer(sp)).Fenc_hashtab = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(libc.Uint32FromInt32(9001)*libc.Uint32FromInt64(8))) if (*TLZWCodecState)(unsafe.Pointer(sp)).Fenc_hashtab == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module67)), __ccgo_ts+41242, 0) return 0 } return int32(1) } var _module67 = [15]uint8{'L', 'Z', 'W', 'S', 'e', 't', 'u', 'p', 'E', 'n', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Reset encoding state at the start of a strip. // */ func _LZWPreEncode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s if (*TLZWCodecState)(unsafe.Pointer(sp)).Fenc_hashtab == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode})))(tls, tif) } (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fnbits = uint16(BITS_MIN) (*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fmaxcode = libc.Uint16FromInt32(libc.Int32FromInt32(1)< 0 { /* * NB: This is safe because it can only happen * at the start of a strip where we know there * is space in the data buffer. */ nextdata = nextdata<> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) if nextbits >= int32(8) { v2 = op op++ *(*Tuint8_t)(unsafe.Pointer(v2)) = uint8(nextdata >> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) } outcount += nbits v3 = bp bp++ ent = uint16(*(*Tuint8_t)(unsafe.Pointer(v3))) cc-- incount++ } for cc > 0 { v4 = bp bp++ c = libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(v4))) cc-- incount++ fcode = c<= 0 { /* * Primary hash failed, check secondary hash. */ disp = int32(9001) - h if h == 0 { disp = int32(1) } for cond := true; cond; cond = (*Thash_t)(unsafe.Pointer(hp)).Fhash >= 0 { /* * Avoid pointer arithmetic because of * wraparound problems with segments. */ h = h - disp if h < 0 { h = h + libc.Int32FromInt32(9001) } hp = (*TLZWCodecState)(unsafe.Pointer(sp)).Fenc_hashtab + uintptr(h)*8 if (*Thash_t)(unsafe.Pointer(hp)).Fhash == fcode { ent = (*Thash_t)(unsafe.Pointer(hp)).Fcode goto hit } } } /* * New entry, emit code and add to table. */ /* * Verify there is space in the buffer for the code * and any potential Clear code that might be emitted * below. The value of limit is setup so that there * are at least 4 bytes free--room for 2 codes. */ if op > limit { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = int32(op) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata } nextdata = nextdata<> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) if nextbits >= int32(8) { v6 = op op++ *(*Tuint8_t)(unsafe.Pointer(v6)) = uint8(nextdata >> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) } outcount += nbits ent = libc.Uint16FromInt32(c) v7 = free_ent free_ent++ (*Thash_t)(unsafe.Pointer(hp)).Fcode = libc.Uint16FromInt32(v7) (*Thash_t)(unsafe.Pointer(hp)).Fhash = fcode if free_ent == libc.Int32FromInt32(1)<> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) if nextbits >= int32(8) { v9 = op op++ *(*Tuint8_t)(unsafe.Pointer(v9)) = uint8(nextdata >> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) } outcount += nbits nbits = int32(BITS_MIN) maxcode = libc.Int32FromInt32(1)< maxcode { nbits++ maxcode = libc.Int32FromInt32(1)<= checkpoint { /* * Check compression ratio and, if things seem * to be slipping, clear the hash table and * reset state. The compression ratio is a * 24+8-bit fractional number. */ checkpoint = incount + int32(CHECK_GAP) if incount > int32(0x007fffff) { rat = outcount >> int32(8) if rat == 0 { v10 = int32(0x7fffffff) } else { v10 = incount / rat } rat = v10 } else { rat = incount << libc.Int32FromInt32(8) / outcount } if rat <= (*TLZWCodecState)(unsafe.Pointer(sp)).Fenc_ratio { _cl_hash1(tls, sp) (*TLZWCodecState)(unsafe.Pointer(sp)).Fenc_ratio = 0 incount = 0 outcount = 0 free_ent = int32(CODE_FIRST) nextdata = nextdata<> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) if nextbits >= int32(8) { v12 = op op++ *(*Tuint8_t)(unsafe.Pointer(v12)) = uint8(nextdata >> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) } outcount += nbits nbits = int32(BITS_MIN) maxcode = libc.Int32FromInt32(1)< (*TLZWCodecState)(unsafe.Pointer(sp)).Fenc_rawlimit { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = int32(op) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata } if (*TLZWCodecState)(unsafe.Pointer(sp)).Fenc_oldcode != libc.Int32FromUint16(libc.Uint16FromInt32(-libc.Int32FromInt32(1))) { free_ent = libc.Int32FromUint16((*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Ffree_ent) nextdata = nextdata<> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) if nextbits >= int32(8) { v2 = op op++ *(*Tuint8_t)(unsafe.Pointer(v2)) = uint8(nextdata >> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) } outcount += nbits (*TLZWCodecState)(unsafe.Pointer(sp)).Fenc_oldcode = libc.Int32FromUint16(libc.Uint16FromInt32(-libc.Int32FromInt32(1))) free_ent++ if free_ent == libc.Int32FromInt32(1)<> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) if nextbits >= int32(8) { v4 = op op++ *(*Tuint8_t)(unsafe.Pointer(v4)) = uint8(nextdata >> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) } outcount += nbits nbits = int32(BITS_MIN) } else { /* * If the next entry is going to be too big for * the code size, then increase it, if possible. */ if free_ent > libc.Int32FromUint16((*TLZWCodecState)(unsafe.Pointer(sp)).Fbase.Fmaxcode) { nbits++ } } } nextdata = nextdata<> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) if nextbits >= int32(8) { v6 = op op++ *(*Tuint8_t)(unsafe.Pointer(v6)) = uint8(nextdata >> (nextbits - libc.Int32FromInt32(8)) & libc.Uint32FromInt32(0xff)) nextbits -= int32(8) } outcount += nbits /* Explicit 0xff masking to make icc -check=conversions happy */ if nextbits > 0 { v7 = op op++ *(*Tuint8_t)(unsafe.Pointer(v7)) = uint8(nextdata << (libc.Int32FromInt32(8) - nextbits) & libc.Uint32FromInt32(0xff)) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = int32(op) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) _ = outcount return int32(1) } // C documentation // // /* // * Reset encoding hash table. // */ func _cl_hash1(tls *libc.TLS, sp uintptr) { var hp uintptr var i int32 _, _ = hp, i hp = (*TLZWCodecState)(unsafe.Pointer(sp)).Fenc_hashtab + uintptr(libc.Int32FromInt32(9001)-libc.Int32FromInt32(1))*8 i = libc.Int32FromInt32(9001) - libc.Int32FromInt32(8) for cond := true; cond; cond = i >= 0 { i -= int32(8) (*(*Thash_t)(unsafe.Pointer(hp + uintptr(-libc.Int32FromInt32(7))*8))).Fhash = -int32(1) (*(*Thash_t)(unsafe.Pointer(hp + uintptr(-libc.Int32FromInt32(6))*8))).Fhash = -int32(1) (*(*Thash_t)(unsafe.Pointer(hp + uintptr(-libc.Int32FromInt32(5))*8))).Fhash = -int32(1) (*(*Thash_t)(unsafe.Pointer(hp + uintptr(-libc.Int32FromInt32(4))*8))).Fhash = -int32(1) (*(*Thash_t)(unsafe.Pointer(hp + uintptr(-libc.Int32FromInt32(3))*8))).Fhash = -int32(1) (*(*Thash_t)(unsafe.Pointer(hp + uintptr(-libc.Int32FromInt32(2))*8))).Fhash = -int32(1) (*(*Thash_t)(unsafe.Pointer(hp + uintptr(-libc.Int32FromInt32(1))*8))).Fhash = -int32(1) (*(*Thash_t)(unsafe.Pointer(hp))).Fhash = -int32(1) hp -= uintptr(8) * 8 } i += int32(8) for { if !(i > 0) { break } (*Thash_t)(unsafe.Pointer(hp)).Fhash = -int32(1) goto _1 _1: ; i-- hp -= 8 } } func _LZWCleanup(tls *libc.TLS, tif uintptr) { XTIFFPredictorCleanup(tls, tif) if (*TLZWCodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fdec_codetab != 0 { X_TIFFfreeExt(tls, tif, (*TLZWCodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fdec_codetab) } if (*TLZWCodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fenc_hashtab != 0 { X_TIFFfreeExt(tls, tif, (*TLZWCodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fenc_hashtab) } X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_data) (*TTIFF)(unsafe.Pointer(tif)).Ftif_data = libc.UintptrFromInt32(0) X_TIFFSetDefaultCompressionState(tls, tif) } func XTIFFInitLZW(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { _ = scheme /* * Allocate state block so tag methods have storage to record values. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_data = X_TIFFmallocExt(tls, tif, int32(168)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_data == libc.UintptrFromInt32(0) { goto bad } (*TLZWCodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fdec_codetab = libc.UintptrFromInt32(0) (*TLZWCodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fdec_decode = libc.UintptrFromInt32(0) (*TLZWCodecState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fenc_hashtab = libc.UintptrFromInt32(0) (*TLZWBaseState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Frw_mode = (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode /* * Install codec methods. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_fixuptags = __ccgo_fp(_LZWFixupTags) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode = __ccgo_fp(_LZWSetupDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_predecode = __ccgo_fp(_LZWPreDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_LZWDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_LZWDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_LZWDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode = __ccgo_fp(_LZWSetupEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_preencode = __ccgo_fp(_LZWPreEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode = __ccgo_fp(_LZWPostEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_LZWEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_LZWEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_LZWEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup = __ccgo_fp(_LZWCleanup) /* * Setup predictor setup. */ XTIFFPredictorInit(tls, tif) return int32(1) goto bad bad: ; XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module68)), __ccgo_ts+40812, 0) return 0 } var _module68 = [12]uint8{'T', 'I', 'F', 'F', 'I', 'n', 'i', 't', 'L', 'Z', 'W'} const LITERALROW = 0 const LITERALSPAN = 64 const TIFF_ISTILED7 = 1024 /* * TIFF Library. * * NeXT 2-bit Grey Scale Compression Algorithm Support */ func _NeXTDecode(tls *libc.TLS, tif uintptr, buf uintptr, occ Ttmsize_t, s Tuint16_t) (r int32) { bp1 := tls.Alloc(16) defer tls.Free(16) var bp, op, row, v12, v13, v3, v5, p10, p11, p9 uintptr var cc, n, off, op_offset, scanline, v2, v7 Ttmsize_t var grey, imagewidth, npixels, v8 Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bp, cc, grey, imagewidth, n, npixels, off, op, op_offset, row, scanline, v12, v13, v2, v3, v5, v7, v8, p10, p11, p9 _ = s /* * Each scanline is assumed to start off as all * white (we assume a PhotometricInterpretation * of ``min-is-black''). */ op = buf cc = occ for { v2 = cc cc-- if !(v2 > 0) { break } v3 = op op++ *(*uint8)(unsafe.Pointer(v3)) = uint8(0xff) goto _1 _1: } bp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp cc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc scanline = (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize if occ%scanline != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module69)), __ccgo_ts+37000, 0) return 0 } row = buf for { if !(cc > 0 && occ > 0) { break } v5 = bp bp++ n = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v5))) cc-- switch n { case LITERALROW: /* * The entire scanline is given as literal values. */ if cc < scanline { goto bad } X_TIFFmemcpy(tls, row, bp, scanline) bp += uintptr(scanline) cc -= scanline case int32(LITERALSPAN): /* * The scanline has a literal span that begins at some * offset. */ if cc < int32(4) { goto bad } off = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))*int32(256) + libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 1))) n = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 2)))*int32(256) + libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 3))) if cc < int32(4)+n || off+n > scanline { goto bad } X_TIFFmemcpy(tls, row+uintptr(off), bp+uintptr(4), n) bp += uintptr(int32(4) + n) cc -= int32(4) + n default: npixels = uint32(0) op_offset = 0 imagewidth = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagewidth if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { imagewidth = (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_tilewidth } /* * The scanline is composed of a sequence of constant * color ``runs''. We shift into ``run mode'' and * interpret bytes as codes of the form * until we've filled the scanline. */ op = row for { grey = libc.Uint32FromInt32(n >> libc.Int32FromInt32(6) & libc.Int32FromInt32(0x3)) n &= int32(0x3f) /* * Ensure the run does not exceed the scanline * bounds, potentially resulting in a security * issue. */ for { v7 = n n-- if !(v7 > 0 && npixels < imagewidth && op_offset < scanline) { break } v8 = npixels npixels++ switch v8 & libc.Uint32FromInt32(3) { case uint32(0): *(*uint8)(unsafe.Pointer(op)) = uint8(grey << libc.Int32FromInt32(6)) case uint32(1): p9 = op *(*uint8)(unsafe.Pointer(p9)) = uint8(uint32(*(*uint8)(unsafe.Pointer(p9))) | grey<= imagewidth { break } if op_offset >= scanline { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module69)), __ccgo_ts+41270, libc.VaList(bp1+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row)) return 0 } if cc == 0 { goto bad } v13 = bp bp++ n = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v13))) cc-- goto _6 _6: } break } goto _4 _4: ; occ -= scanline row += uintptr(scanline) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = bp (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = cc return int32(1) goto bad bad: ; XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module69)), __ccgo_ts+41299, libc.VaList(bp1+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row)) return 0 } var _module69 = [11]uint8{'N', 'e', 'X', 'T', 'D', 'e', 'c', 'o', 'd', 'e'} func _NeXTPreDecode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var td uintptr _ = td td = tif + 56 _ = s if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(2) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module70)), __ccgo_ts+41331, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } return int32(1) } var _module70 = [14]uint8{'N', 'e', 'X', 'T', 'P', 'r', 'e', 'D', 'e', 'c', 'o', 'd', 'e'} func XTIFFInitNeXT(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { _ = scheme (*TTIFF)(unsafe.Pointer(tif)).Ftif_predecode = __ccgo_fp(_NeXTPreDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_NeXTDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_NeXTDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_NeXTDecode) return int32(1) } const MDI_LITTLEENDIAN1 = 20549 const O_CREAT1 = 64 const O_RDONLY7 = 0 const O_RDWR5 = 2 const O_TRUNC1 = 512 const TIFF_BIGENDIAN1 = 19789 const TIFF_BIGTIFF3 = 524288 const TIFF_DEFERSTRILELOAD3 = 16777216 const TIFF_FILLORDER1 = 3 const TIFF_HEADERONLY1 = 65536 const TIFF_LAZYSTRILELOAD3 = 33554432 const TIFF_LITTLEENDIAN1 = 18761 const TIFF_MAPPED5 = 2048 const TIFF_MYBUFFER7 = 512 const TIFF_STRIPCHOP3 = 32768 const TIFF_SWAB3 = 128 const TIFF_UPSAMPLED3 = 16384 const UINT32_MAX6 = 4294967295 const UINT_MAX5 = 4294967295 // C documentation // // /* // * Dummy functions to fill the omitted client procedures. // */ func __tiffDummyMapProc(tls *libc.TLS, fd Tthandle_t, pbase uintptr, psize uintptr) (r int32) { _ = fd _ = pbase _ = psize return 0 } func __tiffDummyUnmapProc(tls *libc.TLS, fd Tthandle_t, base uintptr, size Ttoff_t) { _ = fd _ = base _ = size } func X_TIFFgetMode(tls *libc.TLS, opts uintptr, clientdata Tthandle_t, mode uintptr, module uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var m int32 _ = m m = -int32(1) switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(mode))) { case int32('r'): m = O_RDONLY7 if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(mode + 1))) == int32('+') { m = int32(O_RDWR5) } case int32('w'): fallthrough case int32('a'): m = libc.Int32FromInt32(O_RDWR5) | libc.Int32FromInt32(O_CREAT1) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(mode))) == int32('w') { m |= int32(O_TRUNC1) } default: X_TIFFErrorEarly(tls, opts, clientdata, module, __ccgo_ts+41362, libc.VaList(bp+8, mode)) break } return m } func XTIFFOpenOptionsAlloc(tls *libc.TLS) (r uintptr) { var opts uintptr _ = opts opts = X_TIFFcalloc(tls, int32(1), int32(24)) return opts } func XTIFFOpenOptionsFree(tls *libc.TLS, opts uintptr) { X_TIFFfree(tls, opts) } // C documentation // // /** Define a limit in bytes for a single memory allocation done by libtiff. // * If max_single_mem_alloc is set to 0, which is the default, no other limit // * that the underlying _TIFFmalloc() or // * TIFFOpenOptionsSetMaxCumulatedMemAlloc() will be applied. // */ func XTIFFOpenOptionsSetMaxSingleMemAlloc(tls *libc.TLS, opts uintptr, max_single_mem_alloc Ttmsize_t) { (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fmax_single_mem_alloc = max_single_mem_alloc } // C documentation // // /** Define a limit in bytes for the cumulated memory allocations done by libtiff // * on a given TIFF handle. // * If max_cumulated_mem_alloc is set to 0, which is the default, no other limit // * that the underlying _TIFFmalloc() or // * TIFFOpenOptionsSetMaxSingleMemAlloc() will be applied. // */ func XTIFFOpenOptionsSetMaxCumulatedMemAlloc(tls *libc.TLS, opts uintptr, max_cumulated_mem_alloc Ttmsize_t) { (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fmax_cumulated_mem_alloc = max_cumulated_mem_alloc } func XTIFFOpenOptionsSetErrorHandlerExtR(tls *libc.TLS, opts uintptr, handler TTIFFErrorHandlerExtR, errorhandler_user_data uintptr) { (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Ferrorhandler = handler (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Ferrorhandler_user_data = errorhandler_user_data } func XTIFFOpenOptionsSetWarningHandlerExtR(tls *libc.TLS, opts uintptr, handler TTIFFErrorHandlerExtR, warnhandler_user_data uintptr) { (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fwarnhandler = handler (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fwarnhandler_user_data = warnhandler_user_data } func __TIFFEmitErrorAboveMaxSingleMemAlloc(tls *libc.TLS, tif uintptr, pszFunction uintptr, s Ttmsize_t) { bp := tls.Alloc(32) defer tls.Free(32) XTIFFErrorExtR(tls, tif, pszFunction, __ccgo_ts+41377, libc.VaList(bp+8, libc.Uint64FromInt32(s), libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_max_single_mem_alloc))) } func __TIFFEmitErrorAboveMaxCumulatedMemAlloc(tls *libc.TLS, tif uintptr, pszFunction uintptr, s Ttmsize_t) { bp := tls.Alloc(32) defer tls.Free(32) XTIFFErrorExtR(tls, tif, pszFunction, __ccgo_ts+41463, libc.VaList(bp+8, libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_cur_cumulated_mem_alloc), libc.Uint64FromInt32(s), libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_max_cumulated_mem_alloc))) } /* When allocating memory, we write at the beginning of the buffer it size. * This allows us to keep track of the total memory allocated when we * malloc/calloc/realloc and free. In theory we need just SIZEOF_SIZE_T bytes * for that, but on x86_64, allocations of more than 16 bytes are aligned on * 16 bytes. Hence using 2 * SIZEOF_SIZE_T. * It is critical that _TIFFmallocExt/_TIFFcallocExt/_TIFFreallocExt are * paired with _TIFFfreeExt. * CMakeLists.txt defines TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS, which in * turn disables the definition of the non Ext version in tiffio.h */ // C documentation // // /** malloc() version that takes into account memory-specific open options */ func X_TIFFmallocExt(tls *libc.TLS, tif uintptr, _s Ttmsize_t) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) *(*Ttmsize_t)(unsafe.Pointer(bp)) = _s var ptr uintptr _ = ptr if tif != libc.UintptrFromInt32(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_single_mem_alloc > 0 && *(*Ttmsize_t)(unsafe.Pointer(bp)) > (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_single_mem_alloc { __TIFFEmitErrorAboveMaxSingleMemAlloc(tls, tif, __ccgo_ts+41576, *(*Ttmsize_t)(unsafe.Pointer(bp))) return libc.UintptrFromInt32(0) } if tif != libc.UintptrFromInt32(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_cumulated_mem_alloc > 0 { if *(*Ttmsize_t)(unsafe.Pointer(bp)) > (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_cumulated_mem_alloc-(*TTIFF)(unsafe.Pointer(tif)).Ftif_cur_cumulated_mem_alloc || *(*Ttmsize_t)(unsafe.Pointer(bp)) > libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))-libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T) { __TIFFEmitErrorAboveMaxCumulatedMemAlloc(tls, tif, __ccgo_ts+41576, *(*Ttmsize_t)(unsafe.Pointer(bp))) return libc.UintptrFromInt32(0) } ptr = X_TIFFmalloc(tls, libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T)+*(*Ttmsize_t)(unsafe.Pointer(bp))) if !(ptr != 0) { return libc.UintptrFromInt32(0) } *(*Ttmsize_t)(unsafe.Pointer(tif + 940)) += *(*Ttmsize_t)(unsafe.Pointer(bp)) libc.Xmemcpy(tls, ptr, bp, uint32(4)) return ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T)) } return X_TIFFmalloc(tls, *(*Ttmsize_t)(unsafe.Pointer(bp))) } // C documentation // // /** calloc() version that takes into account memory-specific open options */ func X_TIFFcallocExt(tls *libc.TLS, tif uintptr, nmemb Ttmsize_t, siz Ttmsize_t) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var ptr uintptr var _ /* s at bp+0 */ Ttmsize_t _ = ptr if nmemb <= 0 || siz <= 0 || nmemb > libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))/siz { return libc.UintptrFromInt32(0) } if tif != libc.UintptrFromInt32(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_single_mem_alloc > 0 { if nmemb*siz > (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_single_mem_alloc { __TIFFEmitErrorAboveMaxSingleMemAlloc(tls, tif, __ccgo_ts+41591, nmemb*siz) return libc.UintptrFromInt32(0) } } if tif != libc.UintptrFromInt32(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_cumulated_mem_alloc > 0 { *(*Ttmsize_t)(unsafe.Pointer(bp)) = nmemb * siz if *(*Ttmsize_t)(unsafe.Pointer(bp)) > (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_cumulated_mem_alloc-(*TTIFF)(unsafe.Pointer(tif)).Ftif_cur_cumulated_mem_alloc || *(*Ttmsize_t)(unsafe.Pointer(bp)) > libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))-libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T) { __TIFFEmitErrorAboveMaxCumulatedMemAlloc(tls, tif, __ccgo_ts+41591, *(*Ttmsize_t)(unsafe.Pointer(bp))) return libc.UintptrFromInt32(0) } ptr = X_TIFFcalloc(tls, libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T)+*(*Ttmsize_t)(unsafe.Pointer(bp)), int32(1)) if !(ptr != 0) { return libc.UintptrFromInt32(0) } *(*Ttmsize_t)(unsafe.Pointer(tif + 940)) += *(*Ttmsize_t)(unsafe.Pointer(bp)) libc.Xmemcpy(tls, ptr, bp, uint32(4)) return ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T)) } return X_TIFFcalloc(tls, nmemb, siz) } // C documentation // // /** realloc() version that takes into account memory-specific open options */ func X_TIFFreallocExt(tls *libc.TLS, tif uintptr, p uintptr, _s Ttmsize_t) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) *(*Ttmsize_t)(unsafe.Pointer(bp)) = _s var newPtr, oldPtr uintptr var _ /* oldSize at bp+4 */ Ttmsize_t _, _ = newPtr, oldPtr if tif != libc.UintptrFromInt32(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_single_mem_alloc > 0 && *(*Ttmsize_t)(unsafe.Pointer(bp)) > (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_single_mem_alloc { __TIFFEmitErrorAboveMaxSingleMemAlloc(tls, tif, __ccgo_ts+41606, *(*Ttmsize_t)(unsafe.Pointer(bp))) return libc.UintptrFromInt32(0) } if tif != libc.UintptrFromInt32(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_cumulated_mem_alloc > 0 { oldPtr = p *(*Ttmsize_t)(unsafe.Pointer(bp + 4)) = 0 if p != 0 { oldPtr = p - uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T)) libc.Xmemcpy(tls, bp+4, oldPtr, uint32(4)) } if *(*Ttmsize_t)(unsafe.Pointer(bp)) > *(*Ttmsize_t)(unsafe.Pointer(bp + 4)) && (*(*Ttmsize_t)(unsafe.Pointer(bp)) > (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_cumulated_mem_alloc-((*TTIFF)(unsafe.Pointer(tif)).Ftif_cur_cumulated_mem_alloc-*(*Ttmsize_t)(unsafe.Pointer(bp + 4))) || *(*Ttmsize_t)(unsafe.Pointer(bp)) > libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))-libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T)) { __TIFFEmitErrorAboveMaxCumulatedMemAlloc(tls, tif, __ccgo_ts+41606, *(*Ttmsize_t)(unsafe.Pointer(bp))-*(*Ttmsize_t)(unsafe.Pointer(bp + 4))) return libc.UintptrFromInt32(0) } newPtr = X_TIFFrealloc(tls, oldPtr, libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T)+*(*Ttmsize_t)(unsafe.Pointer(bp))) if newPtr == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } *(*Ttmsize_t)(unsafe.Pointer(tif + 940)) -= *(*Ttmsize_t)(unsafe.Pointer(bp + 4)) *(*Ttmsize_t)(unsafe.Pointer(tif + 940)) += *(*Ttmsize_t)(unsafe.Pointer(bp)) libc.Xmemcpy(tls, newPtr, bp, uint32(4)) return newPtr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T)) } return X_TIFFrealloc(tls, p, *(*Ttmsize_t)(unsafe.Pointer(bp))) } // C documentation // // /** free() version that takes into account memory-specific open options */ func X_TIFFfreeExt(tls *libc.TLS, tif uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var oldPtr uintptr var _ /* oldSize at bp+0 */ Ttmsize_t _ = oldPtr if p != libc.UintptrFromInt32(0) && tif != libc.UintptrFromInt32(0) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_cumulated_mem_alloc > 0 { oldPtr = p - uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(SIZEOF_SIZE_T)) libc.Xmemcpy(tls, bp, oldPtr, uint32(4)) *(*Ttmsize_t)(unsafe.Pointer(tif + 940)) -= *(*Ttmsize_t)(unsafe.Pointer(bp)) p = oldPtr } X_TIFFfree(tls, p) } func XTIFFClientOpen(tls *libc.TLS, name uintptr, mode uintptr, clientdata Tthandle_t, readproc TTIFFReadWriteProc, writeproc TTIFFReadWriteProc, seekproc TTIFFSeekProc, closeproc TTIFFCloseProc, sizeproc TTIFFSizeProc, mapproc TTIFFMapFileProc, unmapproc TTIFFUnmapFileProc) (r uintptr) { return XTIFFClientOpenExt(tls, name, mode, clientdata, readproc, writeproc, seekproc, closeproc, sizeproc, mapproc, unmapproc, libc.UintptrFromInt32(0)) } func XTIFFClientOpenExt(tls *libc.TLS, name uintptr, mode uintptr, clientdata Tthandle_t, readproc TTIFFReadWriteProc, writeproc TTIFFReadWriteProc, seekproc TTIFFSeekProc, closeproc TTIFFCloseProc, sizeproc TTIFFSizeProc, mapproc TTIFFMapFileProc, unmapproc TTIFFUnmapFileProc, opts uintptr) (r uintptr) { bp := tls.Alloc(64) defer tls.Free(64) var cp, tif, v5 uintptr var m, v4 int32 var size_to_alloc Ttmsize_t var v1 TTIFFMapFileProc var v2 TTIFFUnmapFileProc var _ /* n at bp+0 */ struct { Fa16 [0]Tuint16_t Fa8 [2]Tuint8_t } var _ /* n at bp+24 */ Ttoff_t var _ /* tif_header_swapped at bp+8 */ TTIFFHeaderUnion _, _, _, _, _, _, _, _ = cp, m, size_to_alloc, tif, v1, v2, v4, v5 /* The following are configuration checks. They should be redundant, but * should not compile to any actual code in an optimised release build * anyway. If any of them fail, (makefile-based or other) configuration is * not correct */ *(*Tuint8_t)(unsafe.Pointer(bp)) = uint8(1) *(*Tuint8_t)(unsafe.Pointer(bp + 1)) = uint8(0) _ = *(*struct { Fa16 [0]Tuint16_t Fa8 [2]Tuint8_t })(unsafe.Pointer(bp)) m = X_TIFFgetMode(tls, opts, clientdata, mode, uintptr(unsafe.Pointer(&_module71))) if m == -int32(1) { goto bad2 } size_to_alloc = libc.Int32FromUint32(libc.Uint32FromInt64(944) + libc.Xstrlen(tls, name) + libc.Uint32FromInt32(1)) if opts != 0 && (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fmax_single_mem_alloc > 0 && size_to_alloc > (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fmax_single_mem_alloc { X_TIFFErrorEarly(tls, opts, clientdata, uintptr(unsafe.Pointer(&_module71)), __ccgo_ts+41622, libc.VaList(bp+40, name, libc.Uint64FromInt32(size_to_alloc), libc.Uint64FromInt32((*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fmax_single_mem_alloc))) goto bad2 } if opts != 0 && (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fmax_cumulated_mem_alloc > 0 && size_to_alloc > (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fmax_cumulated_mem_alloc { X_TIFFErrorEarly(tls, opts, clientdata, uintptr(unsafe.Pointer(&_module71)), __ccgo_ts+41712, libc.VaList(bp+40, name, libc.Uint64FromInt32(size_to_alloc), libc.Uint64FromInt32((*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fmax_cumulated_mem_alloc))) goto bad2 } tif = X_TIFFmallocExt(tls, libc.UintptrFromInt32(0), size_to_alloc) if tif == libc.UintptrFromInt32(0) { X_TIFFErrorEarly(tls, opts, clientdata, uintptr(unsafe.Pointer(&_module71)), __ccgo_ts+41812, libc.VaList(bp+40, name)) goto bad2 } X_TIFFmemset(tls, tif, 0, int32(944)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_name = tif + uintptr(944) libc.Xstrcpy(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, name) (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode = m & ^(libc.Int32FromInt32(O_CREAT1) | libc.Int32FromInt32(O_TRUNC1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir = uint32(0xffffffff) /* non-existent directory */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount = uint32(0xffffffff) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) /* invalid strip */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) /* read/write pre-increment */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata = clientdata (*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc = readproc (*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc = writeproc (*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc = seekproc (*TTIFF)(unsafe.Pointer(tif)).Ftif_closeproc = closeproc (*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc = sizeproc if mapproc != 0 { v1 = mapproc } else { v1 = __ccgo_fp(__tiffDummyMapProc) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_mapproc = v1 if unmapproc != 0 { v2 = unmapproc } else { v2 = __ccgo_fp(__tiffDummyUnmapProc) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_unmapproc = v2 if opts != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_errorhandler = (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Ferrorhandler (*TTIFF)(unsafe.Pointer(tif)).Ftif_errorhandler_user_data = (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Ferrorhandler_user_data (*TTIFF)(unsafe.Pointer(tif)).Ftif_warnhandler = (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fwarnhandler (*TTIFF)(unsafe.Pointer(tif)).Ftif_warnhandler_user_data = (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fwarnhandler_user_data (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_single_mem_alloc = (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fmax_single_mem_alloc (*TTIFF)(unsafe.Pointer(tif)).Ftif_max_cumulated_mem_alloc = (*TTIFFOpenOptions)(unsafe.Pointer(opts)).Fmax_cumulated_mem_alloc } if !(readproc != 0) || !(writeproc != 0) || !(seekproc != 0) || !(closeproc != 0) || !(sizeproc != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module71)), __ccgo_ts+41847, 0) X_TIFFfreeExt(tls, libc.UintptrFromInt32(0), tif) goto bad2 } X_TIFFSetDefaultCompressionState(tls, tif) /* setup default state */ /* * Default is to return data MSB2LSB and enable the * use of memory-mapped files and strip chopping when * a file is opened read-only. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags = uint32(FILLORDER_MSB2LSB) if m == O_RDONLY7 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00800) } if m == O_RDONLY7 || m == int32(O_RDWR5) { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x08000) } /* * Process library-specific flags in the open mode string. * The following flags may be used to control intrinsic library * behavior that may or may not be desirable (usually for * compatibility with some application that claims to support * TIFF but only supports some brain dead idea of what the * vendor thinks TIFF is): * * 'l' use little-endian byte order for creating a file * 'b' use big-endian byte order for creating a file * 'L' read/write information using LSB2MSB bit order * 'B' read/write information using MSB2LSB bit order * 'H' read/write information using host bit order * 'M' enable use of memory-mapped files when supported * 'm' disable use of memory-mapped files * 'C' enable strip chopping support when reading * 'c' disable strip chopping support * 'h' read TIFF header only, do not load the first IFD * '4' ClassicTIFF for creating a file (default) * '8' BigTIFF for creating a file * 'D' enable use of deferred strip/tile offset/bytecount array loading. * 'O' on-demand loading of values instead of whole array loading (implies * D) * * The use of the 'l' and 'b' flags is strongly discouraged. * These flags are provided solely because numerous vendors, * typically on the PC, do not correctly support TIFF; they * only support the Intel little-endian byte order. This * support is not configured by default because it supports * the violation of the TIFF spec that says that readers *MUST* * support both byte orders. It is strongly recommended that * you not use this feature except to deal with busted apps * that write invalid TIFF. And even in those cases you should * bang on the vendors to fix their software. * * The 'L', 'B', and 'H' flags are intended for applications * that can optimize operations on data by using a particular * bit order. By default the library returns data in MSB2LSB * bit order for compatibility with older versions of this * library. Returning data in the bit order of the native CPU * makes the most sense but also requires applications to check * the value of the FillOrder tag; something they probably do * not do right now. * * The 'M' and 'm' flags are provided because some virtual memory * systems exhibit poor behavior when large images are mapped. * These options permit clients to control the use of memory-mapped * files on a per-file basis. * * The 'C' and 'c' flags are provided because the library support * for chopping up large strips into multiple smaller strips is not * application-transparent and as such can cause problems. The 'c' * option permits applications that only want to look at the tags, * for example, to get the unadulterated TIFF tag information. */ cp = mode for { if !(*(*uint8)(unsafe.Pointer(cp)) != 0) { break } switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) { case int32('b'): if m&int32(O_CREAT1) != 0 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00080) } case int32('l'): case int32('B'): (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags = (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags & ^libc.Uint32FromUint32(0x00003) | uint32(FILLORDER_MSB2LSB) case int32('L'): (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags = (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags & ^libc.Uint32FromUint32(0x00003) | uint32(FILLORDER_LSB2MSB) case int32('H'): XTIFFWarningExtR(tls, tif, name, __ccgo_ts+41893, 0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags = (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags & ^libc.Uint32FromUint32(0x00003) | uint32(FILLORDER_MSB2LSB) case int32('M'): if m == O_RDONLY7 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00800) } case int32('m'): if m == O_RDONLY7 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00800) } case int32('C'): if m == O_RDONLY7 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x08000) } case int32('c'): if m == O_RDONLY7 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x08000) } case int32('h'): *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x10000) case int32('8'): if m&int32(O_CREAT1) != 0 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x80000) } case int32('D'): *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x1000000) case int32('O'): if m == O_RDONLY7 { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= libc.Uint32FromUint32(0x2000000) | libc.Uint32FromUint32(0x1000000) } break } goto _3 _3: ; cp++ } /* * Read in TIFF header. */ if m&int32(O_TRUNC1) != 0 || !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, tif+632, libc.Int32FromUint32(libc.Uint32FromInt64(8)))) == libc.Uint32FromInt64(8)) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY7 { XTIFFErrorExtR(tls, tif, name, __ccgo_ts+41984, 0) goto bad } /* * Setup header and write. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { v4 = int32(TIFF_BIGENDIAN1) } else { v4 = int32(TIFF_LITTLEENDIAN1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_magic = libc.Uint16FromInt32(v4) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_version = uint16(TIFF_VERSION_CLASSIC) (*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff = uint32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_header_size = uint16(8) /* Swapped copy for writing */ X_TIFFmemcpy(tls, bp+8, tif+632, int32(16)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp+8+2) } } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_version = uint16(TIFF_VERSION_BIG) (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_offsetsize = uint16(8) (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_unused = uint16(0) (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_header_size = uint16(16) /* Swapped copy for writing */ X_TIFFmemcpy(tls, bp+8, tif+632, int32(16)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, bp+8+2) XTIFFSwabShort(tls, bp+8+4) } } /* * The doc for "fopen" for some STD_C_LIBs says that if you * open a file for modify ("+"), then you must fseek (or * fflush?) between any freads and fwrites. This is not * necessary on most systems, but has been shown to be needed * on Solaris. */ (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(0)), 0) if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, bp+8, libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header_size)) == libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header_size)) { XTIFFErrorExtR(tls, tif, name, __ccgo_ts+36294, 0) goto bad } /* * Setup default directory. */ if !(XTIFFDefaultDirectory(tls, tif) != 0) { goto bad } (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastdiroff = uint64(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setdirectory_force_absolute = FALSE /* tif_curdircount = 0 means 'empty file opened for writing, but no IFD * written yet' */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdircount = uint32(0) return tif } /* * Setup the byte order handling according to the opened file for reading. */ if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_magic) != int32(TIFF_BIGENDIAN1) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_magic) != int32(TIFF_LITTLEENDIAN1) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_magic) != int32(MDI_LITTLEENDIAN1) { XTIFFErrorExtR(tls, tif, name, __ccgo_ts+42008, libc.VaList(bp+40, libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_magic), libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_magic))) goto bad } if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_magic) == int32(TIFF_BIGENDIAN1) { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00080) } else { } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, tif+632+2) } if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_version) != int32(TIFF_VERSION_CLASSIC) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_version) != int32(TIFF_VERSION_BIG) { XTIFFErrorExtR(tls, tif, name, __ccgo_ts+42059, libc.VaList(bp+40, libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_version), libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_version))) goto bad } if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_version) == int32(TIFF_VERSION_CLASSIC) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabLong(tls, tif+632+4) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_header_size = uint16(8) } else { if !(libc.Uint32FromInt32((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, tif+632+libc.UintptrFromInt64(8), libc.Int32FromUint32(libc.Uint32FromInt64(16)-libc.Uint32FromInt64(8)))) == libc.Uint32FromInt64(16)-libc.Uint32FromInt64(8)) { XTIFFErrorExtR(tls, tif, name, __ccgo_ts+41984, 0) goto bad } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { XTIFFSwabShort(tls, tif+632+4) XTIFFSwabLong8(tls, tif+632+8) } if libc.Int32FromUint16((*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_offsetsize) != int32(8) { XTIFFErrorExtR(tls, tif, name, __ccgo_ts+42105, libc.VaList(bp+40, libc.Int32FromUint16((*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_offsetsize), libc.Int32FromUint16((*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_offsetsize))) goto bad } if libc.Int32FromUint16((*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_unused) != 0 { XTIFFErrorExtR(tls, tif, name, __ccgo_ts+42155, libc.VaList(bp+40, libc.Int32FromUint16((*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_unused), libc.Int32FromUint16((*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_unused))) goto bad } (*TTIFF)(unsafe.Pointer(tif)).Ftif_header_size = uint16(16) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x80000) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00200) v5 = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = v5 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = v5 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = 0 switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(mode))) { case int32('r'): if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff = uint64((*(*TTIFFHeaderClassic)(unsafe.Pointer(&(*TTIFF)(unsafe.Pointer(tif)).Ftif_header))).Ftiff_diroff) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_nextdiroff = (*(*TTIFFHeaderBig)(unsafe.Pointer(tif + 632))).Ftiff_diroff } /* * Try to use a memory-mapped file if the client * has not explicitly suppressed usage with the * 'm' flag in the open mode (see above). */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != 0 { if (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_mapproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, tif+836, bp+24) != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_size = libc.Int32FromUint64(*(*Ttoff_t)(unsafe.Pointer(bp + 24))) } else { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00800) } } /* * Sometimes we do not want to read the first directory (for * example, it may be broken) and want to proceed to other * directories. I this case we use the TIFF_HEADERONLY flag to open * file and return immediately after reading TIFF header. * However, the pointer to TIFFSetField() and TIFFGetField() * (i.e. tif->tif_tagmethods.vsetfield and * tif->tif_tagmethods.vgetfield) need to be initialized, which is * done in TIFFDefaultDirectory(). */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x10000) != 0 { if !(XTIFFDefaultDirectory(tls, tif) != 0) { goto bad } return tif } /* * Setup initial directory. */ if XTIFFReadDirectory(tls, tif) != 0 { return tif } case int32('a'): /* * New directories are automatically append * to the end of the directory chain when they * are written out (see TIFFWriteDirectory). */ if !(XTIFFDefaultDirectory(tls, tif) != 0) { goto bad } return tif } goto bad bad: ; (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode = O_RDONLY7 /* XXX avoid flush */ XTIFFCleanup(tls, tif) goto bad2 bad2: ; return libc.UintptrFromInt32(0) return r } var _module71 = [18]uint8{'T', 'I', 'F', 'F', 'C', 'l', 'i', 'e', 'n', 't', 'O', 'p', 'e', 'n', 'E', 'x', 't'} /* * Query functions to access private data. */ // C documentation // // /* // * Return open file's name. // */ func XTIFFFileName(tls *libc.TLS, tif uintptr) (r uintptr) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_name } // C documentation // // /* // * Set the file name. // */ func XTIFFSetFileName(tls *libc.TLS, tif uintptr, name uintptr) (r uintptr) { var old_name uintptr _ = old_name old_name = (*TTIFF)(unsafe.Pointer(tif)).Ftif_name (*TTIFF)(unsafe.Pointer(tif)).Ftif_name = name return old_name } // C documentation // // /* // * Return open file's I/O descriptor. // */ func XTIFFFileno(tls *libc.TLS, tif uintptr) (r int32) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_fd } // C documentation // // /* // * Set open file's I/O descriptor, and return previous value. // */ func XTIFFSetFileno(tls *libc.TLS, tif uintptr, fd int32) (r int32) { var old_fd int32 _ = old_fd old_fd = (*TTIFF)(unsafe.Pointer(tif)).Ftif_fd (*TTIFF)(unsafe.Pointer(tif)).Ftif_fd = fd return old_fd } // C documentation // // /* // * Return open file's clientdata. // */ func XTIFFClientdata(tls *libc.TLS, tif uintptr) (r Tthandle_t) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata } // C documentation // // /* // * Set open file's clientdata, and return previous value. // */ func XTIFFSetClientdata(tls *libc.TLS, tif uintptr, newvalue Tthandle_t) (r Tthandle_t) { var m Tthandle_t _ = m m = (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata = newvalue return m } // C documentation // // /* // * Return read/write mode. // */ func XTIFFGetMode(tls *libc.TLS, tif uintptr) (r int32) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode } // C documentation // // /* // * Return read/write mode. // */ func XTIFFSetMode(tls *libc.TLS, tif uintptr, mode int32) (r int32) { var old_mode int32 _ = old_mode old_mode = (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode = mode return old_mode } // C documentation // // /* // * Return nonzero if file is organized in // * tiles; zero if organized as strips. // */ func XTIFFIsTiled(tls *libc.TLS, tif uintptr) (r int32) { return libc.BoolInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0)) } // C documentation // // /* // * Return current row being read/written. // */ func XTIFFCurrentRow(tls *libc.TLS, tif uintptr) (r Tuint32_t) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_row } // C documentation // // /* // * Return index of the current directory. // */ func XTIFFCurrentDirectory(tls *libc.TLS, tif uintptr) (r Ttdir_t) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_curdir } // C documentation // // /* // * Return current strip. // */ func XTIFFCurrentStrip(tls *libc.TLS, tif uintptr) (r Tuint32_t) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } // C documentation // // /* // * Return current tile. // */ func XTIFFCurrentTile(tls *libc.TLS, tif uintptr) (r Tuint32_t) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } // C documentation // // /* // * Return nonzero if the file has byte-swapped data. // */ func XTIFFIsByteSwapped(tls *libc.TLS, tif uintptr) (r int32) { return libc.BoolInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != uint32(0)) } // C documentation // // /* // * Return nonzero if the data is returned up-sampled. // */ func XTIFFIsUpSampled(tls *libc.TLS, tif uintptr) (r int32) { return libc.BoolInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x04000) != uint32(0)) } // C documentation // // /* // * Return nonzero if the data is returned in MSB-to-LSB bit order. // */ func XTIFFIsMSB2LSB(tls *libc.TLS, tif uintptr) (r int32) { return libc.BoolInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromInt32(libc.Int32FromInt32(FILLORDER_MSB2LSB)) != uint32(0)) } // C documentation // // /* // * Return nonzero if given file was written in big-endian order. // */ func XTIFFIsBigEndian(tls *libc.TLS, tif uintptr) (r int32) { return libc.BoolInt32(libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_header.Fcommon.Ftiff_magic) == int32(TIFF_BIGENDIAN1)) } // C documentation // // /* // * Return nonzero if given file is BigTIFF style. // */ func XTIFFIsBigTIFF(tls *libc.TLS, tif uintptr) (r int32) { return libc.BoolInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != uint32(0)) } // C documentation // // /* // * Return pointer to file read method. // */ func XTIFFGetReadProc(tls *libc.TLS, tif uintptr) (r TTIFFReadWriteProc) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc } // C documentation // // /* // * Return pointer to file write method. // */ func XTIFFGetWriteProc(tls *libc.TLS, tif uintptr) (r TTIFFReadWriteProc) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc } // C documentation // // /* // * Return pointer to file seek method. // */ func XTIFFGetSeekProc(tls *libc.TLS, tif uintptr) (r TTIFFSeekProc) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc } // C documentation // // /* // * Return pointer to file close method. // */ func XTIFFGetCloseProc(tls *libc.TLS, tif uintptr) (r TTIFFCloseProc) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_closeproc } // C documentation // // /* // * Return pointer to file size requesting method. // */ func XTIFFGetSizeProc(tls *libc.TLS, tif uintptr) (r TTIFFSizeProc) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc } // C documentation // // /* // * Return pointer to memory mapping method. // */ func XTIFFGetMapFileProc(tls *libc.TLS, tif uintptr) (r TTIFFMapFileProc) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_mapproc } // C documentation // // /* // * Return pointer to memory unmapping method. // */ func XTIFFGetUnmapFileProc(tls *libc.TLS, tif uintptr) (r TTIFFUnmapFileProc) { return (*TTIFF)(unsafe.Pointer(tif)).Ftif_unmapproc } const MDI_LITTLEENDIAN2 = 0x5045 const O_CREAT2 = 0100 const O_RDONLY8 = 00 const O_RDWR6 = 02 const O_TRUNC2 = 01000 const TIFF_BIGENDIAN2 = 0x4d4d const TIFF_BIGTIFF4 = 0x80000 const TIFF_DEFERSTRILELOAD4 = 0x1000000 const TIFF_FILLORDER2 = 0x00003 const TIFF_HEADERONLY2 = 0x10000 const TIFF_LAZYSTRILELOAD4 = 0x2000000 const TIFF_LITTLEENDIAN2 = 0x4949 const TIFF_MAPPED6 = 0x00800 const TIFF_MYBUFFER8 = 0x00200 const TIFF_STRIPCHOP4 = 0x08000 const TIFF_SWAB4 = 0x00080 const TIFF_UPSAMPLED4 = 0x04000 const UINT32_MAX7 = "0xffffffffu" const UINT_MAX6 = 0xffffffff /* * TIFF Library. * * PackBits Compression Algorithm Support */ func _PackBitsPreEncode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { _ = s (*TTIFF)(unsafe.Pointer(tif)).Ftif_data = X_TIFFmallocExt(tls, tif, int32(4)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_data == libc.UintptrFromInt32(0) { return 0 } /* * Calculate the scanline/tile-width size in bytes. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { *(*Ttmsize_t)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)) = XTIFFTileRowSize(tls, tif) } else { *(*Ttmsize_t)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)) = XTIFFScanlineSize(tls, tif) } return int32(1) } func _PackBitsPostEncode(tls *libc.TLS, tif uintptr) (r int32) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_data != 0 { X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_data) } return int32(1) } // C documentation // // /* // * Encode a run of pixels. // */ func _PackBitsEncode(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var b, n, slop, state, v25, v3 int32 var bp, ep, lastliteral, op, v1, v10, v11, v12, v13, v14, v15, v17, v18, v19, v20, v21, v22, v23, v24, v4, v5, v6, v7, v8, v9, p26 uintptr var v16 Tuint8_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, bp, ep, lastliteral, n, op, slop, state, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v3, v4, v5, v6, v7, v8, v9, p26 bp = buf _ = s op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp ep = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata + uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) state = 0 lastliteral = uintptr(0) for cc > 0 { /* * Find the longest string of identical bytes. */ v1 = bp bp++ b = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v1))) cc-- n = int32(1) for { if !(cc > 0 && b == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp)))) { break } n++ goto _2 _2: ; cc-- bp++ } goto again again: ; if op+uintptr(2) >= ep { /* insure space for new data */ /* * Be careful about writing the last * literal. Must write up to that point * and then copy the remainder to the * front of the buffer. */ if state == 1 || state == 3 { slop = int32(op) - int32(lastliteral) *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) += int32(lastliteral) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp for { v3 = slop slop-- if !(v3 > 0) { break } v4 = op op++ v5 = lastliteral lastliteral++ *(*Tuint8_t)(unsafe.Pointer(v4)) = *(*Tuint8_t)(unsafe.Pointer(v5)) } lastliteral = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp } else { *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) += int32(op) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) if !(XTIFFFlushData1(tls, tif) != 0) { return 0 } op = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp } } switch state { case 0: /* initial state, set run/literal */ if n > int32(1) { state = 2 if n > int32(128) { v6 = op op++ *(*Tuint8_t)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(-libc.Int32FromInt32(127)) v7 = op op++ *(*Tuint8_t)(unsafe.Pointer(v7)) = libc.Uint8FromInt32(b) n -= int32(128) goto again } v8 = op op++ *(*Tuint8_t)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(-(n - libc.Int32FromInt32(1))) v9 = op op++ *(*Tuint8_t)(unsafe.Pointer(v9)) = libc.Uint8FromInt32(b) } else { lastliteral = op v10 = op op++ *(*Tuint8_t)(unsafe.Pointer(v10)) = uint8(0) v11 = op op++ *(*Tuint8_t)(unsafe.Pointer(v11)) = libc.Uint8FromInt32(b) state = 1 } case 1: /* last object was literal string */ if n > int32(1) { state = 3 if n > int32(128) { v12 = op op++ *(*Tuint8_t)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(-libc.Int32FromInt32(127)) v13 = op op++ *(*Tuint8_t)(unsafe.Pointer(v13)) = libc.Uint8FromInt32(b) n -= int32(128) goto again } v14 = op op++ *(*Tuint8_t)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(-(n - libc.Int32FromInt32(1))) /* encode run */ v15 = op op++ *(*Tuint8_t)(unsafe.Pointer(v15)) = libc.Uint8FromInt32(b) } else { /* extend literal */ v17 = lastliteral *(*Tuint8_t)(unsafe.Pointer(v17))++ v16 = *(*Tuint8_t)(unsafe.Pointer(v17)) if libc.Int32FromUint8(v16) == int32(127) { state = 0 } v18 = op op++ *(*Tuint8_t)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(b) } case 2: /* last object was run */ if n > int32(1) { if n > int32(128) { v19 = op op++ *(*Tuint8_t)(unsafe.Pointer(v19)) = libc.Uint8FromInt32(-libc.Int32FromInt32(127)) v20 = op op++ *(*Tuint8_t)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(b) n -= int32(128) goto again } v21 = op op++ *(*Tuint8_t)(unsafe.Pointer(v21)) = libc.Uint8FromInt32(-(n - libc.Int32FromInt32(1))) v22 = op op++ *(*Tuint8_t)(unsafe.Pointer(v22)) = libc.Uint8FromInt32(b) } else { lastliteral = op v23 = op op++ *(*Tuint8_t)(unsafe.Pointer(v23)) = uint8(0) v24 = op op++ *(*Tuint8_t)(unsafe.Pointer(v24)) = libc.Uint8FromInt32(b) state = 1 } case 3: /* literal followed by a run */ /* * Check to see if previous run should * be converted to a literal, in which * case we convert literal-run-literal * to a single literal. */ if n == int32(1) && libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(op + uintptr(-libc.Int32FromInt32(2))))) == libc.Int32FromUint8(libc.Uint8FromInt32(-libc.Int32FromInt32(1))) && libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(lastliteral))) < int32(126) { p26 = lastliteral *(*Tuint8_t)(unsafe.Pointer(p26)) = Tuint8_t(int32(*(*Tuint8_t)(unsafe.Pointer(p26))) + libc.Int32FromInt32(2)) if libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(p26))) == int32(127) { v25 = 0 } else { v25 = 1 } state = v25 *(*Tuint8_t)(unsafe.Pointer(op + uintptr(-libc.Int32FromInt32(2)))) = *(*Tuint8_t)(unsafe.Pointer(op + uintptr(-libc.Int32FromInt32(1)))) /* replicate */ } else { state = 2 } goto again } } *(*Ttmsize_t)(unsafe.Pointer(tif + 832)) += int32(op) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = op return int32(1) } // C documentation // // /* // * Encode a rectangular chunk of pixels. We break it up // * into row-sized pieces to insure that encoded runs do // * not span rows. Otherwise, there can be problems with // * the decoder if data is read, for example, by scanlines // * when it was encoded by strips. // */ func _PackBitsEncodeChunk(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var chunk, rowsize Ttmsize_t _, _ = chunk, rowsize rowsize = *(*Ttmsize_t)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)) for cc > 0 { chunk = rowsize if cc < chunk { chunk = cc } if _PackBitsEncode(tls, tif, bp, chunk, s) < 0 { return -int32(1) } bp += uintptr(chunk) cc -= chunk } return int32(1) } func _PackBitsDecode(tls *libc.TLS, tif uintptr, op uintptr, occ Ttmsize_t, s Tuint16_t) (r int32) { bp1 := tls.Alloc(16) defer tls.Free(16) var b, n, v3, v5 int32 var bp, v1, v2, v4 uintptr var cc Ttmsize_t _, _, _, _, _, _, _, _, _ = b, bp, cc, n, v1, v2, v3, v4, v5 _ = s bp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp cc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc for cc > 0 && occ > 0 { v1 = bp bp++ n = int32(*(*Tint8_t)(unsafe.Pointer(v1))) cc-- if n < 0 { /* replicate next byte -n+1 times */ if n == -int32(128) { /* nop */ continue } n = -n + int32(1) if occ < n { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module72)), __ccgo_ts+42201, libc.VaList(bp1+8, n-occ)) n = occ } if cc == 0 { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module72)), __ccgo_ts+42245, 0) break } occ = occ - n v2 = bp bp++ b = int32(*(*Tint8_t)(unsafe.Pointer(v2))) cc-- for { v3 = n n-- if !(v3 > 0) { break } v4 = op op++ *(*Tuint8_t)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(b) } } else { /* copy next n+1 bytes literally */ if occ < n+libc.Int32FromInt32(1) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module72)), __ccgo_ts+42201, libc.VaList(bp1+8, n-occ+int32(1))) n = occ - int32(1) } if cc < n+libc.Int32FromInt32(1) { XTIFFWarningExtR(tls, tif, uintptr(unsafe.Pointer(&_module72)), __ccgo_ts+42245, 0) break } n++ v5 = n X_TIFFmemcpy(tls, op, bp, v5) op += uintptr(n) occ = occ - n bp += uintptr(n) cc = cc - n } } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = bp (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = cc if occ > 0 { libc.Xmemset(tls, op, 0, libc.Uint32FromInt32(occ)) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module72)), __ccgo_ts+41299, libc.VaList(bp1+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row)) return 0 } return int32(1) } var _module72 = [15]uint8{'P', 'a', 'c', 'k', 'B', 'i', 't', 's', 'D', 'e', 'c', 'o', 'd', 'e'} func XTIFFInitPackBits(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { _ = scheme (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_PackBitsDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_PackBitsDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_PackBitsDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_preencode = __ccgo_fp(_PackBitsPreEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode = __ccgo_fp(_PackBitsPostEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_PackBitsEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_PackBitsEncodeChunk) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_PackBitsEncodeChunk) return int32(1) } const TIFF_DIRTYDIRECT5 = 8 const TIFF_SWAB5 = 128 func _PredictorSetup(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var sp, td uintptr var v1 int32 _, _, _ = sp, td, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 switch (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor { /* no differencing */ case int32(PREDICTOR_NONE): return int32(1) case int32(PREDICTOR_HORIZONTAL): if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(8) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(16) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(32) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(64) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module73)), __ccgo_ts+42293, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } case int32(PREDICTOR_FLOATINGPOINT): if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat) != int32(SAMPLEFORMAT_IEEEFP) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module73)), __ccgo_ts+42363, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat))) return 0 } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(16) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(24) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(32) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(64) { /* Should 64 be allowed? */ XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module73)), __ccgo_ts+42424, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } default: XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module73)), __ccgo_ts+42485, libc.VaList(bp+8, (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor)) return 0 } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { v1 = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { v1 = int32(1) } (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fstride = v1 /* * Calculate the scanline/tile-width size in bytes. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Frowsize = XTIFFTileRowSize(tls, tif) } else { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Frowsize = XTIFFScanlineSize(tls, tif) } if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Frowsize == 0 { return 0 } return int32(1) } var _module73 = [15]uint8{'P', 'r', 'e', 'd', 'i', 'c', 't', 'o', 'r', 'S', 'e', 't', 'u', 'p'} func _PredictorSetupDecode(tls *libc.TLS, tif uintptr) (r int32) { var sp, td uintptr _, _ = sp, td sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 /* Note: when PredictorSetup() fails, the effets of setupdecode() */ /* will not be "canceled" so setupdecode() might be robust to */ /* be called several times. */ if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fsetupdecode})))(tls, tif) != 0) || !(_PredictorSetup(tls, tif) != 0) { return 0 } if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor == int32(2) { switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) { case int32(8): (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc = __ccgo_fp(_horAcc8) case int32(16): (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc = __ccgo_fp(_horAcc16) case int32(32): (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc = __ccgo_fp(_horAcc32) case int32(64): (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc = __ccgo_fp(_horAcc64) break } /* * Override default decoding method with one that does the * predictor stuff. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow != __ccgo_fp(_PredictorDecodeRow) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecoderow = (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_PredictorDecodeRow) (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodestrip = (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_PredictorDecodeTile) (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodetile = (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_PredictorDecodeTile) } /* * If the data is horizontally differenced 16-bit data that * requires byte-swapping, then it must be byte swapped before * the accumulation step. We do this with a special-purpose * routine and override the normal post decoding logic that * the library setup when the directory was read. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc == __ccgo_fp(_horAcc16) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc = __ccgo_fp(_swabHorAcc16) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFNoPostDecode) } else { if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc == __ccgo_fp(_horAcc32) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc = __ccgo_fp(_swabHorAcc32) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFNoPostDecode) } else { if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc == __ccgo_fp(_horAcc64) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc = __ccgo_fp(_swabHorAcc64) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFNoPostDecode) } } } } } else { if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor == int32(3) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc = __ccgo_fp(_fpAcc) /* * Override default decoding method with one that does the * predictor stuff. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow != __ccgo_fp(_PredictorDecodeRow) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecoderow = (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_PredictorDecodeRow) (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodestrip = (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_PredictorDecodeTile) (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodetile = (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_PredictorDecodeTile) } /* * The data should not be swapped outside of the floating * point predictor, the accumulation routine should return * byres in the native order. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFNoPostDecode) } /* * Allocate buffer to keep the decoded bytes before * rearranging in the right order */ } } return int32(1) } func _PredictorSetupEncode(tls *libc.TLS, tif uintptr) (r int32) { var sp, td uintptr _, _ = sp, td sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fsetupencode})))(tls, tif) != 0) || !(_PredictorSetup(tls, tif) != 0) { return 0 } if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor == int32(2) { switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) { case int32(8): (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc = __ccgo_fp(_horDiff8) case int32(16): (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc = __ccgo_fp(_horDiff16) case int32(32): (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc = __ccgo_fp(_horDiff32) case int32(64): (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc = __ccgo_fp(_horDiff64) break } /* * Override default encoding method with one that does the * predictor stuff. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow != __ccgo_fp(_PredictorEncodeRow) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencoderow = (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_PredictorEncodeRow) (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodestrip = (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_PredictorEncodeTile) (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodetile = (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_PredictorEncodeTile) } /* * If the data is horizontally differenced 16-bit data that * requires byte-swapping, then it must be byte swapped after * the differentiation step. We do this with a special-purpose * routine and override the normal post decoding logic that * the library setup when the directory was read. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc == __ccgo_fp(_horDiff16) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc = __ccgo_fp(_swabHorDiff16) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFNoPostDecode) } else { if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc == __ccgo_fp(_horDiff32) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc = __ccgo_fp(_swabHorDiff32) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFNoPostDecode) } else { if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc == __ccgo_fp(_horDiff64) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc = __ccgo_fp(_swabHorDiff64) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = __ccgo_fp(X_TIFFNoPostDecode) } } } } } else { if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor == int32(3) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc = __ccgo_fp(_fpDiff) /* * Override default encoding method with one that does the * predictor stuff. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow != __ccgo_fp(_PredictorEncodeRow) { (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencoderow = (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_PredictorEncodeRow) (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodestrip = (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_PredictorEncodeTile) (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodetile = (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_PredictorEncodeTile) } } } return int32(1) } /* Remarks related to C standard compliance in all below functions : */ /* - to avoid any undefined behavior, we only operate on unsigned types */ /* since the behavior of "overflows" is defined (wrap over) */ /* - when storing into the byte stream, we explicitly mask with 0xff so */ /* as to make icc -check=conversions happy (not necessary by the standard) */ func _horAcc8(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var ca, cb, cb1, cg, cg1, cr, cr1 uint32 var cp uintptr var i, i1, i2, stride Ttmsize_t _, _, _, _, _, _, _, _, _, _, _, _ = ca, cb, cb1, cg, cg1, cp, cr, cr1, i, i1, i2, stride stride = (*TTIFFPredictorState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fstride cp = cp0 if cc%stride != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+42520, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42528)) return 0 } if cc > stride { /* * Pipeline the most common cases. */ if stride == int32(3) { cr = uint32(*(*uint8)(unsafe.Pointer(cp))) cg = uint32(*(*uint8)(unsafe.Pointer(cp + 1))) cb = uint32(*(*uint8)(unsafe.Pointer(cp + 2))) i = stride for { if !(i < cc) { break } cr += uint32(*(*uint8)(unsafe.Pointer(cp + uintptr(i+0)))) *(*uint8)(unsafe.Pointer(cp + uintptr(i+0))) = uint8(cr & libc.Uint32FromInt32(0xff)) cg += uint32(*(*uint8)(unsafe.Pointer(cp + uintptr(i+int32(1))))) *(*uint8)(unsafe.Pointer(cp + uintptr(i+int32(1)))) = uint8(cg & libc.Uint32FromInt32(0xff)) cb += uint32(*(*uint8)(unsafe.Pointer(cp + uintptr(i+int32(2))))) *(*uint8)(unsafe.Pointer(cp + uintptr(i+int32(2)))) = uint8(cb & libc.Uint32FromInt32(0xff)) goto _1 _1: ; i += stride } } else { if stride == int32(4) { cr1 = uint32(*(*uint8)(unsafe.Pointer(cp))) cg1 = uint32(*(*uint8)(unsafe.Pointer(cp + 1))) cb1 = uint32(*(*uint8)(unsafe.Pointer(cp + 2))) ca = uint32(*(*uint8)(unsafe.Pointer(cp + 3))) i1 = stride for { if !(i1 < cc) { break } cr1 += uint32(*(*uint8)(unsafe.Pointer(cp + uintptr(i1+0)))) *(*uint8)(unsafe.Pointer(cp + uintptr(i1+0))) = uint8(cr1 & libc.Uint32FromInt32(0xff)) cg1 += uint32(*(*uint8)(unsafe.Pointer(cp + uintptr(i1+int32(1))))) *(*uint8)(unsafe.Pointer(cp + uintptr(i1+int32(1)))) = uint8(cg1 & libc.Uint32FromInt32(0xff)) cb1 += uint32(*(*uint8)(unsafe.Pointer(cp + uintptr(i1+int32(2))))) *(*uint8)(unsafe.Pointer(cp + uintptr(i1+int32(2)))) = uint8(cb1 & libc.Uint32FromInt32(0xff)) ca += uint32(*(*uint8)(unsafe.Pointer(cp + uintptr(i1+int32(3))))) *(*uint8)(unsafe.Pointer(cp + uintptr(i1+int32(3)))) = uint8(ca & libc.Uint32FromInt32(0xff)) goto _2 _2: ; i1 += stride } } else { cc -= stride for cond := true; cond; cond = cc > 0 { switch stride { default: i2 = stride - int32(4) for { if !(i2 > 0) { break } *(*uint8)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + uintptr(stride)))) + libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp++ goto _3 _3: ; i2-- } /*-fallthrough*/ fallthrough case int32(4): *(*uint8)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + uintptr(stride)))) + libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp++ /*-fallthrough*/ fallthrough case int32(3): *(*uint8)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + uintptr(stride)))) + libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp++ /*-fallthrough*/ fallthrough case int32(2): *(*uint8)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + uintptr(stride)))) + libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp++ /*-fallthrough*/ fallthrough case int32(1): *(*uint8)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + uintptr(stride)))) + libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp++ /*-fallthrough*/ fallthrough case 0: } cc -= stride } } } } return int32(1) } func _swabHorAcc16(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { var wc Ttmsize_t var wp uintptr _, _ = wc, wp wp = cp0 wc = cc / int32(2) XTIFFSwabArrayOfShort(tls, wp, wc) return _horAcc16(tls, tif, cp0, cc) } func _horAcc16(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var i, stride, wc Ttmsize_t var wp uintptr _, _, _, _ = i, stride, wc, wp stride = (*TTIFFPredictorState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fstride wp = cp0 wc = cc / int32(2) if cc%(int32(2)*stride) != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+42543, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42552)) return 0 } if wc > stride { wc -= stride for cond := true; cond; cond = wc > 0 { switch stride { default: i = stride - int32(4) for { if !(i > 0) { break } *(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)) = uint16((uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2))) + uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))) & libc.Uint32FromInt32(0xffff)) wp += 2 goto _1 _1: ; i-- } /*-fallthrough*/ fallthrough case int32(4): *(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)) = uint16((uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2))) + uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))) & libc.Uint32FromInt32(0xffff)) wp += 2 /*-fallthrough*/ fallthrough case int32(3): *(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)) = uint16((uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2))) + uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))) & libc.Uint32FromInt32(0xffff)) wp += 2 /*-fallthrough*/ fallthrough case int32(2): *(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)) = uint16((uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2))) + uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))) & libc.Uint32FromInt32(0xffff)) wp += 2 /*-fallthrough*/ fallthrough case int32(1): *(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)) = uint16((uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2))) + uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))) & libc.Uint32FromInt32(0xffff)) wp += 2 /*-fallthrough*/ fallthrough case 0: } wc -= stride } } return int32(1) } func _swabHorAcc32(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { var wc Ttmsize_t var wp uintptr _, _ = wc, wp wp = cp0 wc = cc / int32(4) XTIFFSwabArrayOfLong(tls, wp, wc) return _horAcc32(tls, tif, cp0, cc) } func _horAcc32(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var i, stride, wc Ttmsize_t var wp uintptr _, _, _, _ = i, stride, wc, wp stride = (*TTIFFPredictorState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fstride wp = cp0 wc = cc / int32(4) if cc%(int32(4)*stride) != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+42570, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42579)) return 0 } if wc > stride { wc -= stride for cond := true; cond; cond = wc > 0 { switch stride { default: i = stride - int32(4) for { if !(i > 0) { break } *(*Tuint32_t)(unsafe.Pointer(wp + uintptr(stride)*4)) += *(*Tuint32_t)(unsafe.Pointer(wp)) wp += 4 goto _1 _1: ; i-- } /*-fallthrough*/ fallthrough case int32(4): *(*Tuint32_t)(unsafe.Pointer(wp + uintptr(stride)*4)) += *(*Tuint32_t)(unsafe.Pointer(wp)) wp += 4 /*-fallthrough*/ fallthrough case int32(3): *(*Tuint32_t)(unsafe.Pointer(wp + uintptr(stride)*4)) += *(*Tuint32_t)(unsafe.Pointer(wp)) wp += 4 /*-fallthrough*/ fallthrough case int32(2): *(*Tuint32_t)(unsafe.Pointer(wp + uintptr(stride)*4)) += *(*Tuint32_t)(unsafe.Pointer(wp)) wp += 4 /*-fallthrough*/ fallthrough case int32(1): *(*Tuint32_t)(unsafe.Pointer(wp + uintptr(stride)*4)) += *(*Tuint32_t)(unsafe.Pointer(wp)) wp += 4 /*-fallthrough*/ fallthrough case 0: } wc -= stride } } return int32(1) } func _swabHorAcc64(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { var wc Ttmsize_t var wp uintptr _, _ = wc, wp wp = cp0 wc = cc / int32(8) XTIFFSwabArrayOfLong8(tls, wp, wc) return _horAcc64(tls, tif, cp0, cc) } func _horAcc64(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var i, stride, wc Ttmsize_t var wp uintptr _, _, _, _ = i, stride, wc, wp stride = (*TTIFFPredictorState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fstride wp = cp0 wc = cc / int32(8) if cc%(int32(8)*stride) != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+42597, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42606)) return 0 } if wc > stride { wc -= stride for cond := true; cond; cond = wc > 0 { switch stride { default: i = stride - int32(4) for { if !(i > 0) { break } *(*Tuint64_t)(unsafe.Pointer(wp + uintptr(stride)*8)) += *(*Tuint64_t)(unsafe.Pointer(wp)) wp += 8 goto _1 _1: ; i-- } /*-fallthrough*/ fallthrough case int32(4): *(*Tuint64_t)(unsafe.Pointer(wp + uintptr(stride)*8)) += *(*Tuint64_t)(unsafe.Pointer(wp)) wp += 8 /*-fallthrough*/ fallthrough case int32(3): *(*Tuint64_t)(unsafe.Pointer(wp + uintptr(stride)*8)) += *(*Tuint64_t)(unsafe.Pointer(wp)) wp += 8 /*-fallthrough*/ fallthrough case int32(2): *(*Tuint64_t)(unsafe.Pointer(wp + uintptr(stride)*8)) += *(*Tuint64_t)(unsafe.Pointer(wp)) wp += 8 /*-fallthrough*/ fallthrough case int32(1): *(*Tuint64_t)(unsafe.Pointer(wp + uintptr(stride)*8)) += *(*Tuint64_t)(unsafe.Pointer(wp)) wp += 8 /*-fallthrough*/ fallthrough case 0: } wc -= stride } } return int32(1) } // C documentation // // /* // * Floating point predictor accumulation routine. // */ func _fpAcc(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var bps, byte1 Tuint32_t var count, i, stride, wc Ttmsize_t var cp, tmp uintptr _, _, _, _, _, _, _, _ = bps, byte1, count, cp, i, stride, tmp, wc stride = (*TTIFFPredictorState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fstride bps = libc.Uint32FromInt32(libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) / int32(8)) wc = libc.Int32FromUint32(libc.Uint32FromInt32(cc) / bps) count = cc cp = cp0 if libc.Uint32FromInt32(cc)%(bps*libc.Uint32FromInt32(stride)) != uint32(0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+42624, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42630)) return 0 } tmp = X_TIFFmallocExt(tls, tif, cc) if !(tmp != 0) { return 0 } for count > stride { switch stride { default: i = stride - int32(4) for { if !(i > 0) { break } *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride)))) + libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp++ goto _1 _1: ; i-- } /*-fallthrough*/ fallthrough case int32(4): *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride)))) + libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp++ /*-fallthrough*/ fallthrough case int32(3): *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride)))) + libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp++ /*-fallthrough*/ fallthrough case int32(2): *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride)))) + libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp++ /*-fallthrough*/ fallthrough case int32(1): *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride)))) + libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp++ /*-fallthrough*/ fallthrough case 0: } count -= stride } X_TIFFmemcpy(tls, tmp, cp0, cc) cp = cp0 count = 0 for { if !(count < wc) { break } byte1 = uint32(0) for { if !(byte1 < bps) { break } *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(bps*libc.Uint32FromInt32(count)+byte1))) = *(*Tuint8_t)(unsafe.Pointer(tmp + uintptr((bps-byte1-uint32(1))*libc.Uint32FromInt32(wc)+libc.Uint32FromInt32(count)))) goto _3 _3: ; byte1++ } goto _2 _2: ; count++ } X_TIFFfreeExt(tls, tif, tmp) return int32(1) } // C documentation // // /* // * Decode a scanline and apply the predictor routine. // */ func _PredictorDecodeRow(tls *libc.TLS, tif uintptr, op0 uintptr, occ0 Ttmsize_t, s Tuint16_t) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data if (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecoderow})))(tls, tif, op0, occ0, s) != 0 { return (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc})))(tls, tif, op0, occ0) } else { return 0 } return r } // C documentation // // /* // * Decode a tile/strip and apply the predictor routine. // * Note that horizontal differencing must be done on a // * row-by-row basis. The width of a "row" has already // * been calculated at pre-decode time according to the // * strip/tile dimensions. // */ func _PredictorDecodeTile(tls *libc.TLS, tif uintptr, op0 uintptr, occ0 Ttmsize_t, s Tuint16_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var rowsize Ttmsize_t var sp uintptr _, _ = rowsize, sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data if (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodetile})))(tls, tif, op0, occ0, s) != 0 { rowsize = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Frowsize if occ0%rowsize != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+42650, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42670)) return 0 } for occ0 > 0 { if !((*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc})))(tls, tif, op0, rowsize) != 0) { return 0 } occ0 -= rowsize op0 += uintptr(rowsize) } return int32(1) } else { return 0 } return r } func _horDiff8(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var a1, a2, b1, b11, b2, b21, g1, g11, g2, g21, r1, r11, r2, r21 uint32 var cp, sp uintptr var i, stride Ttmsize_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a2, b1, b11, b2, b21, cp, g1, g11, g2, g21, i, r1, r11, r2, r21, sp, stride sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data stride = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fstride cp = cp0 if cc%stride != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+42688, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42528)) return 0 } if cc > stride { cc -= stride /* * Pipeline the most common cases. */ if stride == int32(3) { r2 = uint32(*(*uint8)(unsafe.Pointer(cp))) g2 = uint32(*(*uint8)(unsafe.Pointer(cp + 1))) b2 = uint32(*(*uint8)(unsafe.Pointer(cp + 2))) for { r1 = uint32(*(*uint8)(unsafe.Pointer(cp + 3))) *(*uint8)(unsafe.Pointer(cp + 3)) = uint8((r1 - r2) & libc.Uint32FromInt32(0xff)) r2 = r1 g1 = uint32(*(*uint8)(unsafe.Pointer(cp + 4))) *(*uint8)(unsafe.Pointer(cp + 4)) = uint8((g1 - g2) & libc.Uint32FromInt32(0xff)) g2 = g1 b1 = uint32(*(*uint8)(unsafe.Pointer(cp + 5))) *(*uint8)(unsafe.Pointer(cp + 5)) = uint8((b1 - b2) & libc.Uint32FromInt32(0xff)) b2 = b1 cp += uintptr(3) goto _1 _1: ; cc -= int32(3) if !(cc > 0) { break } } } else { if stride == int32(4) { r21 = uint32(*(*uint8)(unsafe.Pointer(cp))) g21 = uint32(*(*uint8)(unsafe.Pointer(cp + 1))) b21 = uint32(*(*uint8)(unsafe.Pointer(cp + 2))) a2 = uint32(*(*uint8)(unsafe.Pointer(cp + 3))) for { r11 = uint32(*(*uint8)(unsafe.Pointer(cp + 4))) *(*uint8)(unsafe.Pointer(cp + 4)) = uint8((r11 - r21) & libc.Uint32FromInt32(0xff)) r21 = r11 g11 = uint32(*(*uint8)(unsafe.Pointer(cp + 5))) *(*uint8)(unsafe.Pointer(cp + 5)) = uint8((g11 - g21) & libc.Uint32FromInt32(0xff)) g21 = g11 b11 = uint32(*(*uint8)(unsafe.Pointer(cp + 6))) *(*uint8)(unsafe.Pointer(cp + 6)) = uint8((b11 - b21) & libc.Uint32FromInt32(0xff)) b21 = b11 a1 = uint32(*(*uint8)(unsafe.Pointer(cp + 7))) *(*uint8)(unsafe.Pointer(cp + 7)) = uint8((a1 - a2) & libc.Uint32FromInt32(0xff)) a2 = a1 cp += uintptr(4) goto _2 _2: ; cc -= int32(4) if !(cc > 0) { break } } } else { cp += uintptr(cc - int32(1)) for { switch stride { default: i = stride - int32(4) for { if !(i > 0) { break } *(*uint8)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + uintptr(stride)))) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp-- goto _4 _4: ; i-- } /*-fallthrough*/ fallthrough case int32(4): *(*uint8)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + uintptr(stride)))) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp-- /*-fallthrough*/ fallthrough case int32(3): *(*uint8)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + uintptr(stride)))) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp-- /*-fallthrough*/ fallthrough case int32(2): *(*uint8)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + uintptr(stride)))) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp-- /*-fallthrough*/ fallthrough case int32(1): *(*uint8)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp + uintptr(stride)))) - libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp-- /*-fallthrough*/ fallthrough case 0: } goto _3 _3: ; cc -= stride if !(cc > 0) { break } } } } } return int32(1) } func _horDiff16(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var i, stride, wc Ttmsize_t var sp, wp uintptr _, _, _, _, _ = i, sp, stride, wc, wp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data stride = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fstride wp = cp0 wc = cc / int32(2) if cc%(int32(2)*stride) != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+42688, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42697)) return 0 } if wc > stride { wc -= stride wp += uintptr(wc-int32(1)) * 2 for cond := true; cond; cond = wc > 0 { switch stride { default: i = stride - int32(4) for { if !(i > 0) { break } *(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)) = uint16((uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2))) - uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))) & libc.Uint32FromInt32(0xffff)) wp -= 2 goto _1 _1: ; i-- } /*-fallthrough*/ fallthrough case int32(4): *(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)) = uint16((uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2))) - uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))) & libc.Uint32FromInt32(0xffff)) wp -= 2 /*-fallthrough*/ fallthrough case int32(3): *(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)) = uint16((uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2))) - uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))) & libc.Uint32FromInt32(0xffff)) wp -= 2 /*-fallthrough*/ fallthrough case int32(2): *(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)) = uint16((uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2))) - uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))) & libc.Uint32FromInt32(0xffff)) wp -= 2 /*-fallthrough*/ fallthrough case int32(1): *(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)) = uint16((uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2))) - uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))) & libc.Uint32FromInt32(0xffff)) wp -= 2 /*-fallthrough*/ fallthrough case 0: } wc -= stride } } return int32(1) } func _swabHorDiff16(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { var wc Ttmsize_t var wp uintptr _, _ = wc, wp wp = cp0 wc = cc / int32(2) if !(_horDiff16(tls, tif, cp0, cc) != 0) { return 0 } XTIFFSwabArrayOfShort(tls, wp, wc) return int32(1) } func _horDiff32(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var i, stride, wc Ttmsize_t var sp, wp uintptr _, _, _, _, _ = i, sp, stride, wc, wp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data stride = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fstride wp = cp0 wc = cc / int32(4) if cc%(int32(4)*stride) != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+42716, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42726)) return 0 } if wc > stride { wc -= stride wp += uintptr(wc-int32(1)) * 4 for cond := true; cond; cond = wc > 0 { switch stride { default: i = stride - int32(4) for { if !(i > 0) { break } *(*Tuint32_t)(unsafe.Pointer(wp + uintptr(stride)*4)) -= *(*Tuint32_t)(unsafe.Pointer(wp)) wp -= 4 goto _1 _1: ; i-- } /*-fallthrough*/ fallthrough case int32(4): *(*Tuint32_t)(unsafe.Pointer(wp + uintptr(stride)*4)) -= *(*Tuint32_t)(unsafe.Pointer(wp)) wp -= 4 /*-fallthrough*/ fallthrough case int32(3): *(*Tuint32_t)(unsafe.Pointer(wp + uintptr(stride)*4)) -= *(*Tuint32_t)(unsafe.Pointer(wp)) wp -= 4 /*-fallthrough*/ fallthrough case int32(2): *(*Tuint32_t)(unsafe.Pointer(wp + uintptr(stride)*4)) -= *(*Tuint32_t)(unsafe.Pointer(wp)) wp -= 4 /*-fallthrough*/ fallthrough case int32(1): *(*Tuint32_t)(unsafe.Pointer(wp + uintptr(stride)*4)) -= *(*Tuint32_t)(unsafe.Pointer(wp)) wp -= 4 /*-fallthrough*/ fallthrough case 0: } wc -= stride } } return int32(1) } func _swabHorDiff32(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { var wc Ttmsize_t var wp uintptr _, _ = wc, wp wp = cp0 wc = cc / int32(4) if !(_horDiff32(tls, tif, cp0, cc) != 0) { return 0 } XTIFFSwabArrayOfLong(tls, wp, wc) return int32(1) } func _horDiff64(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var i, stride, wc Ttmsize_t var sp, wp uintptr _, _, _, _, _ = i, sp, stride, wc, wp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data stride = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fstride wp = cp0 wc = cc / int32(8) if cc%(int32(8)*stride) != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+42745, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42755)) return 0 } if wc > stride { wc -= stride wp += uintptr(wc-int32(1)) * 8 for cond := true; cond; cond = wc > 0 { switch stride { default: i = stride - int32(4) for { if !(i > 0) { break } *(*Tuint64_t)(unsafe.Pointer(wp + uintptr(stride)*8)) -= *(*Tuint64_t)(unsafe.Pointer(wp)) wp -= 8 goto _1 _1: ; i-- } /*-fallthrough*/ fallthrough case int32(4): *(*Tuint64_t)(unsafe.Pointer(wp + uintptr(stride)*8)) -= *(*Tuint64_t)(unsafe.Pointer(wp)) wp -= 8 /*-fallthrough*/ fallthrough case int32(3): *(*Tuint64_t)(unsafe.Pointer(wp + uintptr(stride)*8)) -= *(*Tuint64_t)(unsafe.Pointer(wp)) wp -= 8 /*-fallthrough*/ fallthrough case int32(2): *(*Tuint64_t)(unsafe.Pointer(wp + uintptr(stride)*8)) -= *(*Tuint64_t)(unsafe.Pointer(wp)) wp -= 8 /*-fallthrough*/ fallthrough case int32(1): *(*Tuint64_t)(unsafe.Pointer(wp + uintptr(stride)*8)) -= *(*Tuint64_t)(unsafe.Pointer(wp)) wp -= 8 /*-fallthrough*/ fallthrough case 0: } wc -= stride } } return int32(1) } func _swabHorDiff64(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { var wc Ttmsize_t var wp uintptr _, _ = wc, wp wp = cp0 wc = cc / int32(8) if !(_horDiff64(tls, tif, cp0, cc) != 0) { return 0 } XTIFFSwabArrayOfLong8(tls, wp, wc) return int32(1) } /* * Floating point predictor differencing routine. */ func _fpDiff(tls *libc.TLS, tif uintptr, cp0 uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var bps, byte1 Tuint32_t var count, i, stride, wc Ttmsize_t var cp, tmp uintptr _, _, _, _, _, _, _, _ = bps, byte1, count, cp, i, stride, tmp, wc stride = (*TTIFFPredictorState)(unsafe.Pointer((*TTIFF)(unsafe.Pointer(tif)).Ftif_data)).Fstride bps = libc.Uint32FromInt32(libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) / int32(8)) wc = libc.Int32FromUint32(libc.Uint32FromInt32(cc) / bps) cp = cp0 if libc.Uint32FromInt32(cc)%(bps*libc.Uint32FromInt32(stride)) != uint32(0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+42774, __ccgo_ts+39133, libc.VaList(bp+8, __ccgo_ts+42781)) return 0 } tmp = X_TIFFmallocExt(tls, tif, cc) if !(tmp != 0) { return 0 } X_TIFFmemcpy(tls, tmp, cp0, cc) count = 0 for { if !(count < wc) { break } byte1 = uint32(0) for { if !(byte1 < bps) { break } *(*Tuint8_t)(unsafe.Pointer(cp + uintptr((bps-byte1-uint32(1))*libc.Uint32FromInt32(wc)+libc.Uint32FromInt32(count)))) = *(*Tuint8_t)(unsafe.Pointer(tmp + uintptr(bps*libc.Uint32FromInt32(count)+byte1))) goto _2 _2: ; byte1++ } goto _1 _1: ; count++ } X_TIFFfreeExt(tls, tif, tmp) cp = cp0 cp += uintptr(cc - stride - int32(1)) count = cc for { if !(count > stride) { break } switch stride { default: i = stride - int32(4) for { if !(i > 0) { break } *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride)))) - libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp-- goto _4 _4: ; i-- } /*-fallthrough*/ fallthrough case int32(4): *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride)))) - libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp-- /*-fallthrough*/ fallthrough case int32(3): *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride)))) - libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp-- /*-fallthrough*/ fallthrough case int32(2): *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride)))) - libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp-- /*-fallthrough*/ fallthrough case int32(1): *(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride))) = libc.Uint8FromInt32((libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp + uintptr(stride)))) - libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(cp)))) & libc.Int32FromInt32(0xff)) cp-- /*-fallthrough*/ fallthrough case 0: } goto _3 _3: ; count -= stride } return int32(1) } func _PredictorEncodeRow(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* XXX horizontal differencing alters user's data XXX */ if !((*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc})))(tls, tif, bp, cc) != 0) { return 0 } return (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencoderow})))(tls, tif, bp, cc, s) } func _PredictorEncodeTile(tls *libc.TLS, tif uintptr, bp0 uintptr, cc0 Ttmsize_t, s Tuint16_t) (r int32) { bp1 := tls.Alloc(16) defer tls.Free(16) var bp, sp, working_copy uintptr var cc, rowsize Ttmsize_t var result_code int32 _, _, _, _, _, _ = bp, cc, result_code, rowsize, sp, working_copy sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data cc = cc0 /* * Do predictor manipulation in a working buffer to avoid altering * the callers buffer. http://trac.osgeo.org/gdal/ticket/1965 */ working_copy = X_TIFFmallocExt(tls, tif, cc0) if working_copy == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module74)), __ccgo_ts+42802, libc.VaList(bp1+8, int64(cc0))) return 0 } libc.Xmemcpy(tls, working_copy, bp0, libc.Uint32FromInt32(cc0)) bp = working_copy rowsize = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Frowsize if cc0%rowsize != 0 { XTIFFErrorExtR(tls, tif, __ccgo_ts+42850, __ccgo_ts+39133, libc.VaList(bp1+8, __ccgo_ts+42870)) X_TIFFfreeExt(tls, tif, working_copy) return 0 } for cc > 0 { (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc})))(tls, tif, bp, rowsize) cc -= rowsize bp += uintptr(rowsize) } result_code = (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodetile})))(tls, tif, working_copy, cc0, s) X_TIFFfreeExt(tls, tif, working_copy) return result_code } var _module74 = [20]uint8{'P', 'r', 'e', 'd', 'i', 'c', 't', 'o', 'r', 'E', 'n', 'c', 'o', 'd', 'e', 'T', 'i', 'l', 'e'} var _predictFields = [1]TTIFFField{ 0: { Ffield_tag: uint32(TIFFTAG_PREDICTOR), Ffield_readcount: int16(1), Ffield_writecount: int16(1), Ffield_type: int32(TIFF_SHORT), Fset_field_type: int32(TIFF_SETGET_UINT16), Fget_field_type: int32(TIFF_SETGET_UINT16), Ffield_bit: libc.Uint16FromInt32(libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(0)), Ffield_name: __ccgo_ts + 42887, }, } func _PredictorVSetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data switch tag { case uint32(TIFFTAG_PREDICTOR): (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor = libc.Int32FromUint16(libc.Uint16FromInt32(libc.VaInt32(&ap))) *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(0))/libc.Int32FromInt32(32))*4)) |= libc.Uint32FromInt32(1) << ((libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(0)) & libc.Int32FromInt32(0x1f)) default: return (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fvsetparent})))(tls, tif, tag, ap) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00008) return int32(1) } func _PredictorVGetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data switch tag { case uint32(TIFFTAG_PREDICTOR): *(*Tuint16_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = libc.Uint16FromInt32((*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor) default: return (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fvgetparent})))(tls, tif, tag, ap) } return int32(1) } func _PredictorPrintDir(tls *libc.TLS, tif uintptr, fd uintptr, flags int32) { bp := tls.Alloc(32) defer tls.Free(32) var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = flags if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(0))/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+42897, 0) switch (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor { case int32(1): libc.Xfprintf(tls, fd, __ccgo_ts+42911, 0) case int32(2): libc.Xfprintf(tls, fd, __ccgo_ts+42917, 0) case int32(3): libc.Xfprintf(tls, fd, __ccgo_ts+42942, 0) break } libc.Xfprintf(tls, fd, __ccgo_ts+42968, libc.VaList(bp+8, (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor, (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor)) } if (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fprintdir != 0 { (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTIFFPredictorState)(unsafe.Pointer(sp)).Fprintdir})))(tls, tif, fd, flags) } } func XTIFFPredictorInit(tls *libc.TLS, tif uintptr) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* * Merge codec-specific tag information. */ if !(X_TIFFMergeFields(tls, tif, uintptr(unsafe.Pointer(&_predictFields)), libc.Uint32FromInt64(36)/libc.Uint32FromInt64(36)) != 0) { XTIFFErrorExtR(tls, tif, __ccgo_ts+42979, __ccgo_ts+42997, 0) return 0 } /* * Override parent get/set field methods. */ (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fvgetparent = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield = __ccgo_fp(_PredictorVGetField) /* hook for predictor tag */ (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fvsetparent = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield = __ccgo_fp(_PredictorVSetField) /* hook for predictor tag */ (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fprintdir = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir = __ccgo_fp(_PredictorPrintDir) /* hook for predictor tag */ (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fsetupdecode = (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode = __ccgo_fp(_PredictorSetupDecode) (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fsetupencode = (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode = __ccgo_fp(_PredictorSetupEncode) (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fpredictor = int32(1) /* default value */ (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fencodepfunc = libc.UintptrFromInt32(0) /* no predictor routine */ (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fdecodepfunc = libc.UintptrFromInt32(0) /* no predictor routine */ return int32(1) } func XTIFFPredictorCleanup(tls *libc.TLS, tif uintptr) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fvgetparent (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fvsetparent (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fprintdir (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fsetupdecode (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode = (*TTIFFPredictorState)(unsafe.Pointer(sp)).Fsetupencode return int32(1) } const FILETYPE_MASK1 = 4 const FILETYPE_PAGE3 = 2 const FILETYPE_REDUCEDIMAGE3 = 1 const TIFFPRINT_COLORMAP1 = 4 const TIFFPRINT_CURVES1 = 2 const TIFFPRINT_STRIPS1 = 1 const TIFF_DIRTYDIRECT6 = 0x00008 const TIFF_PERSAMPLE3 = 4194304 const TIFF_SWAB6 = 0x00080 var _photoNames = [11]uintptr{ 0: __ccgo_ts + 43042, 1: __ccgo_ts + 43055, 2: __ccgo_ts + 43068, 3: __ccgo_ts + 43078, 4: __ccgo_ts + 43112, 5: __ccgo_ts + 43130, 6: __ccgo_ts + 43140, 7: __ccgo_ts + 43146, 8: __ccgo_ts + 43154, 9: __ccgo_ts + 43165, 10: __ccgo_ts + 43176, } var _orientNames = [9]uintptr{ 0: __ccgo_ts + 43187, 1: __ccgo_ts + 43195, 2: __ccgo_ts + 43216, 3: __ccgo_ts + 43237, 4: __ccgo_ts + 43261, 5: __ccgo_ts + 43285, 6: __ccgo_ts + 43306, 7: __ccgo_ts + 43327, 8: __ccgo_ts + 43351, } type Ttagname = struct { Ftag Tuint16_t Fname uintptr } var _tagnames = [2]Ttagname{ 0: { Ftag: uint16(TIFFTAG_GDAL_METADATA), Fname: __ccgo_ts + 43375, }, 1: { Ftag: uint16(TIFFTAG_GDAL_NODATA), Fname: __ccgo_ts + 43389, }, } func __TIFFPrintField(tls *libc.TLS, fd uintptr, fip uintptr, value_count Tuint32_t, raw_data uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var field_name uintptr var i Tsize_t var j Tuint32_t var tv_size int32 _, _, _, _ = field_name, i, j, tv_size /* Print a user-friendly name for tags of relatively common use, but */ /* which aren't registered by libtiff itself. */ field_name = (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name if XTIFFFieldIsAnonymous(tls, fip) != 0 { i = uint32(0) for { if !(i < libc.Uint32FromInt64(16)/libc.Uint32FromInt64(8)) { break } if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_tag == uint32(_tagnames[i].Ftag) { field_name = _tagnames[i].Fname break } goto _1 _1: ; i++ } } libc.Xfprintf(tls, fd, __ccgo_ts+43406, libc.VaList(bp+8, field_name)) j = uint32(0) for { if !(j < value_count) { break } if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_BYTE) { libc.Xfprintf(tls, fd, __ccgo_ts+22429, libc.VaList(bp+8, libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(raw_data + uintptr(j)))))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_UNDEFINED) { libc.Xfprintf(tls, fd, __ccgo_ts+43413, libc.VaList(bp+8, libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(raw_data + uintptr(j)))))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_SBYTE) { libc.Xfprintf(tls, fd, __ccgo_ts+999, libc.VaList(bp+8, int32(*(*Tint8_t)(unsafe.Pointer(raw_data + uintptr(j)))))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_SHORT) { libc.Xfprintf(tls, fd, __ccgo_ts+22429, libc.VaList(bp+8, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(raw_data + uintptr(j)*2))))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_SSHORT) { libc.Xfprintf(tls, fd, __ccgo_ts+999, libc.VaList(bp+8, int32(*(*Tint16_t)(unsafe.Pointer(raw_data + uintptr(j)*2))))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_LONG) { libc.Xfprintf(tls, fd, __ccgo_ts+22429, libc.VaList(bp+8, *(*Tuint32_t)(unsafe.Pointer(raw_data + uintptr(j)*4)))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_SLONG) { libc.Xfprintf(tls, fd, __ccgo_ts+999, libc.VaList(bp+8, *(*Tint32_t)(unsafe.Pointer(raw_data + uintptr(j)*4)))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_IFD) { libc.Xfprintf(tls, fd, __ccgo_ts+43413, libc.VaList(bp+8, *(*Tuint32_t)(unsafe.Pointer(raw_data + uintptr(j)*4)))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_RATIONAL) || (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_SRATIONAL) { tv_size = XTIFFFieldSetGetSize(tls, fip) if tv_size == int32(8) { libc.Xfprintf(tls, fd, __ccgo_ts+43418, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(raw_data + uintptr(j)*8)))) } else { libc.Xfprintf(tls, fd, __ccgo_ts+43422, libc.VaList(bp+8, float64(*(*float32)(unsafe.Pointer(raw_data + uintptr(j)*4))))) } } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_FLOAT) { libc.Xfprintf(tls, fd, __ccgo_ts+43422, libc.VaList(bp+8, float64(*(*float32)(unsafe.Pointer(raw_data + uintptr(j)*4))))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_LONG8) { libc.Xfprintf(tls, fd, __ccgo_ts+43425, libc.VaList(bp+8, *(*Tuint64_t)(unsafe.Pointer(raw_data + uintptr(j)*8)))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_SLONG8) { libc.Xfprintf(tls, fd, __ccgo_ts+43430, libc.VaList(bp+8, *(*Tint64_t)(unsafe.Pointer(raw_data + uintptr(j)*8)))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_IFD8) { libc.Xfprintf(tls, fd, __ccgo_ts+43435, libc.VaList(bp+8, *(*Tuint64_t)(unsafe.Pointer(raw_data + uintptr(j)*8)))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_DOUBLE) { libc.Xfprintf(tls, fd, __ccgo_ts+43418, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(raw_data + uintptr(j)*8)))) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_ASCII) { libc.Xfprintf(tls, fd, __ccgo_ts+39133, libc.VaList(bp+8, raw_data)) break } else { libc.Xfprintf(tls, fd, __ccgo_ts+43442, 0) break } } } } } } } } } } } } } } } if j < value_count-uint32(1) { libc.Xfprintf(tls, fd, __ccgo_ts+43479, 0) } goto _2 _2: ; j++ } libc.Xfprintf(tls, fd, __ccgo_ts+165, 0) } func __TIFFPrettyPrintField(tls *libc.TLS, tif uintptr, fip uintptr, fd uintptr, tag Tuint32_t, value_count Tuint32_t, raw_data uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var i Tuint32_t _ = i _ = tif /* do not try to pretty print auto-defined fields */ if XTIFFFieldIsAnonymous(tls, fip) != 0 { return 0 } switch tag { case uint32(TIFFTAG_INKSET): if value_count == uint32(2) && (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_SHORT) { libc.Xfprintf(tls, fd, __ccgo_ts+43481, 0) switch libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(raw_data))) { case int32(INKSET_CMYK): libc.Xfprintf(tls, fd, __ccgo_ts+43493, 0) default: libc.Xfprintf(tls, fd, __ccgo_ts+43499, libc.VaList(bp+8, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(raw_data))), libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(raw_data))))) break } return int32(1) } return 0 case uint32(TIFFTAG_DOTRANGE): if value_count == uint32(2) && (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_SHORT) { libc.Xfprintf(tls, fd, __ccgo_ts+43510, libc.VaList(bp+8, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(raw_data))), libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(raw_data + 1*2))))) return int32(1) } return 0 case uint32(TIFFTAG_WHITEPOINT): if value_count == uint32(2) && (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_RATIONAL) { libc.Xfprintf(tls, fd, __ccgo_ts+43530, libc.VaList(bp+8, float64(*(*float32)(unsafe.Pointer(raw_data))), float64(*(*float32)(unsafe.Pointer(raw_data + 1*4))))) return int32(1) } return 0 case uint32(TIFFTAG_XMLPACKET): libc.Xfprintf(tls, fd, __ccgo_ts+43552, 0) i = uint32(0) for { if !(i < value_count) { break } libc.Xfputc(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(raw_data + uintptr(i)))), fd) goto _1 _1: ; i++ } libc.Xfprintf(tls, fd, __ccgo_ts+165, 0) return int32(1) case uint32(TIFFTAG_RICHTIFFIPTC): libc.Xfprintf(tls, fd, __ccgo_ts+43581, libc.VaList(bp+8, value_count)) return int32(1) case uint32(TIFFTAG_PHOTOSHOP): libc.Xfprintf(tls, fd, __ccgo_ts+43623, libc.VaList(bp+8, value_count)) return int32(1) case uint32(TIFFTAG_ICCPROFILE): libc.Xfprintf(tls, fd, __ccgo_ts+43662, libc.VaList(bp+8, value_count)) return int32(1) case uint32(TIFFTAG_STONITS): if value_count == uint32(1) && (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_DOUBLE) { libc.Xfprintf(tls, fd, __ccgo_ts+43698, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(raw_data)))) return int32(1) } return 0 } return 0 } // C documentation // // /* // * Print the contents of the current directory // * to the specified stdio file stream. // */ func XTIFFPrintDirectory(tls *libc.TLS, tif uintptr, fd uintptr, flags int32) { bp := tls.Alloc(64) defer tls.Free(64) var c, cp, fip, sep, td, v13 uintptr var count, count1, i2, i3, i4, i7, l, mem_alloc, n, tv_size, v3, v5 int32 var count2 int16 var i, i1, i5, i6 Tuint16_t var max_chars Tsize_t var s, tag Tuint32_t var _ /* dotrange at bp+8 */ [2]Tuint16_t var _ /* raw_data at bp+4 */ uintptr var _ /* small_value_count at bp+12 */ Tuint16_t var _ /* value_count at bp+0 */ Tuint32_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, count, count1, count2, cp, fip, i, i1, i2, i3, i4, i5, i6, i7, l, max_chars, mem_alloc, n, s, sep, tag, td, tv_size, v13, v3, v5 td = tif + 56 libc.Xfprintf(tls, fd, __ccgo_ts+43740, libc.VaList(bp+24, (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff, (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff)) if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SUBFILETYPE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SUBFILETYPE)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+43780, 0) sep = __ccgo_ts + 37497 if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subfiletype&uint32(FILETYPE_REDUCEDIMAGE3) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+43796, libc.VaList(bp+24, sep)) sep = __ccgo_ts + 43823 } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subfiletype&uint32(FILETYPE_PAGE3) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+43825, libc.VaList(bp+24, sep)) sep = __ccgo_ts + 43823 } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subfiletype&uint32(FILETYPE_MASK1) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+43847, libc.VaList(bp+24, sep)) } libc.Xfprintf(tls, fd, __ccgo_ts+37588, libc.VaList(bp+24, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subfiletype, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subfiletype)) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_IMAGEDIMENSIONS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_IMAGEDIMENSIONS)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+43867, libc.VaList(bp+24, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength)) if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_IMAGEDEPTH)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_IMAGEDEPTH)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+43902, libc.VaList(bp+24, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth)) } libc.Xfprintf(tls, fd, __ccgo_ts+165, 0) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TILEDIMENSIONS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_TILEDIMENSIONS)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+43919, libc.VaList(bp+24, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength)) if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TILEDEPTH)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_TILEDEPTH)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+43952, libc.VaList(bp+24, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tiledepth)) } libc.Xfprintf(tls, fd, __ccgo_ts+165, 0) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_RESOLUTION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_RESOLUTION)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+43968, libc.VaList(bp+24, float64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_xresolution), float64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_yresolution))) if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_RESOLUTIONUNIT)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_RESOLUTIONUNIT)&libc.Int32FromInt32(0x1f))) != 0 { switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_resolutionunit) { case int32(RESUNIT_NONE): libc.Xfprintf(tls, fd, __ccgo_ts+43989, 0) case int32(RESUNIT_INCH): libc.Xfprintf(tls, fd, __ccgo_ts+44001, 0) case int32(RESUNIT_CENTIMETER): libc.Xfprintf(tls, fd, __ccgo_ts+44014, 0) default: libc.Xfprintf(tls, fd, __ccgo_ts+44025, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_resolutionunit), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_resolutionunit))) break } } libc.Xfprintf(tls, fd, __ccgo_ts+165, 0) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_POSITION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_POSITION)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44043, libc.VaList(bp+24, float64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_xposition), float64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_yposition))) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_BITSPERSAMPLE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_BITSPERSAMPLE)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44063, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SAMPLEFORMAT)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SAMPLEFORMAT)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44082, 0) switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat) { case int32(SAMPLEFORMAT_VOID): libc.Xfprintf(tls, fd, __ccgo_ts+44100, 0) case int32(SAMPLEFORMAT_INT): libc.Xfprintf(tls, fd, __ccgo_ts+44106, 0) case int32(SAMPLEFORMAT_UINT): libc.Xfprintf(tls, fd, __ccgo_ts+44122, 0) case int32(SAMPLEFORMAT_IEEEFP): libc.Xfprintf(tls, fd, __ccgo_ts+44140, 0) case int32(SAMPLEFORMAT_COMPLEXINT): libc.Xfprintf(tls, fd, __ccgo_ts+44161, 0) case int32(SAMPLEFORMAT_COMPLEXIEEEFP): libc.Xfprintf(tls, fd, __ccgo_ts+44185, 0) default: libc.Xfprintf(tls, fd, __ccgo_ts+43499, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat))) break } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_COMPRESSION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_COMPRESSION)&libc.Int32FromInt32(0x1f))) != 0 { c = XTIFFFindCODEC(tls, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) libc.Xfprintf(tls, fd, __ccgo_ts+44214, 0) if c != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+1161, libc.VaList(bp+24, (*TTIFFCodec)(unsafe.Pointer(c)).Fname)) } else { libc.Xfprintf(tls, fd, __ccgo_ts+43499, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression))) } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_PHOTOMETRIC)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_PHOTOMETRIC)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44237, 0) if uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) < libc.Uint32FromInt64(44)/libc.Uint32FromInt64(4) { libc.Xfprintf(tls, fd, __ccgo_ts+1161, libc.VaList(bp+24, _photoNames[(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric])) } else { switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) { case int32(PHOTOMETRIC_LOGL): libc.Xfprintf(tls, fd, __ccgo_ts+44268, 0) case int32(PHOTOMETRIC_LOGLUV): libc.Xfprintf(tls, fd, __ccgo_ts+44281, 0) default: libc.Xfprintf(tls, fd, __ccgo_ts+43499, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric))) break } } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_EXTRASAMPLES)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_EXTRASAMPLES)&libc.Int32FromInt32(0x1f))) != 0 && (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44302, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples))) sep = __ccgo_ts + 9405 i = uint16(0) for { if !(libc.Int32FromUint16(i) < libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples)) { break } switch libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo + uintptr(i)*2))) { case EXTRASAMPLE_UNSPECIFIED: libc.Xfprintf(tls, fd, __ccgo_ts+44323, libc.VaList(bp+24, sep)) case int32(EXTRASAMPLE_ASSOCALPHA): libc.Xfprintf(tls, fd, __ccgo_ts+44337, libc.VaList(bp+24, sep)) case int32(EXTRASAMPLE_UNASSALPHA): libc.Xfprintf(tls, fd, __ccgo_ts+44351, libc.VaList(bp+24, sep)) default: libc.Xfprintf(tls, fd, __ccgo_ts+44367, libc.VaList(bp+24, sep, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo + uintptr(i)*2))), libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleinfo + uintptr(i)*2))))) break } sep = __ccgo_ts + 44379 goto _1 _1: ; i++ } libc.Xfprintf(tls, fd, __ccgo_ts+44382, 0) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_INKNAMES)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_INKNAMES)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44385, 0) i1 = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel sep = __ccgo_ts + 9405 cp = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_inknames for { if !(libc.Int32FromUint16(i1) > 0 && cp < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_inknames+uintptr((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_inknameslen)) { break } max_chars = libc.Uint32FromInt32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_inknameslen - (int32(cp) - int32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_inknames))) libc.Xfputs(tls, sep, fd) __TIFFprintAsciiBounded(tls, fd, cp, max_chars) sep = __ccgo_ts + 44379 goto _2 _2: ; cp = libc.Xstrchr(tls, cp, int32('\000')) + uintptr(1) i1-- } libc.Xfputs(tls, __ccgo_ts+165, fd) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_NUMBEROFINKS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_NUMBEROFINKS)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44399, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_numberofinks))) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_THRESHHOLDING)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_THRESHHOLDING)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44419, 0) switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_threshholding) { case int32(THRESHHOLD_BILEVEL): libc.Xfprintf(tls, fd, __ccgo_ts+44436, 0) case int32(THRESHHOLD_HALFTONE): libc.Xfprintf(tls, fd, __ccgo_ts+44454, 0) case int32(THRESHHOLD_ERRORDIFFUSE): libc.Xfprintf(tls, fd, __ccgo_ts+44481, 0) default: libc.Xfprintf(tls, fd, __ccgo_ts+43499, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_threshholding), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_threshholding))) break } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_FILLORDER)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_FILLORDER)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44497, 0) switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) { case int32(FILLORDER_MSB2LSB): libc.Xfprintf(tls, fd, __ccgo_ts+44511, 0) case int32(FILLORDER_LSB2MSB): libc.Xfprintf(tls, fd, __ccgo_ts+44523, 0) default: libc.Xfprintf(tls, fd, __ccgo_ts+43499, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder))) break } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_YCBCRSUBSAMPLING)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_YCBCRSUBSAMPLING)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44535, libc.VaList(bp+24, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216))), libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2))))) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_YCBCRPOSITIONING)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_YCBCRPOSITIONING)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44564, 0) switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_ycbcrpositioning) { case int32(YCBCRPOSITION_CENTERED): libc.Xfprintf(tls, fd, __ccgo_ts+44586, 0) case int32(YCBCRPOSITION_COSITED): libc.Xfprintf(tls, fd, __ccgo_ts+44596, 0) default: libc.Xfprintf(tls, fd, __ccgo_ts+43499, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_ycbcrpositioning), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_ycbcrpositioning))) break } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_HALFTONEHINTS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_HALFTONEHINTS)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44605, libc.VaList(bp+24, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 112))), libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 112 + 1*2))))) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_ORIENTATION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_ORIENTATION)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44641, 0) if uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_orientation) < libc.Uint32FromInt64(36)/libc.Uint32FromInt64(4) { libc.Xfprintf(tls, fd, __ccgo_ts+1161, libc.VaList(bp+24, _orientNames[(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_orientation])) } else { libc.Xfprintf(tls, fd, __ccgo_ts+43499, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_orientation), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_orientation))) } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SAMPLESPERPIXEL)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SAMPLESPERPIXEL)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44657, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel))) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_ROWSPERSTRIP)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_ROWSPERSTRIP)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44678, 0) if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { libc.Xfprintf(tls, fd, __ccgo_ts+44693, 0) } else { libc.Xfprintf(tls, fd, __ccgo_ts+44705, libc.VaList(bp+24, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip)) } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_MINSAMPLEVALUE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_MINSAMPLEVALUE)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44709, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_minsamplevalue))) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_MAXSAMPLEVALUE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_MAXSAMPLEVALUE)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44733, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_maxsamplevalue))) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SMINSAMPLEVALUE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SMINSAMPLEVALUE)&libc.Int32FromInt32(0x1f))) != 0 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x400000) != 0 { v3 = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { v3 = int32(1) } count = v3 libc.Xfprintf(tls, fd, __ccgo_ts+44757, 0) i2 = 0 for { if !(i2 < count) { break } libc.Xfprintf(tls, fd, __ccgo_ts+44778, libc.VaList(bp+24, *(*float64)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sminsamplevalue + uintptr(i2)*8)))) goto _4 _4: ; i2++ } libc.Xfprintf(tls, fd, __ccgo_ts+165, 0) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SMAXSAMPLEVALUE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SMAXSAMPLEVALUE)&libc.Int32FromInt32(0x1f))) != 0 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x400000) != 0 { v5 = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { v5 = int32(1) } count1 = v5 libc.Xfprintf(tls, fd, __ccgo_ts+44782, 0) i3 = 0 for { if !(i3 < count1) { break } libc.Xfprintf(tls, fd, __ccgo_ts+44778, libc.VaList(bp+24, *(*float64)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_smaxsamplevalue + uintptr(i3)*8)))) goto _6 _6: ; i3++ } libc.Xfprintf(tls, fd, __ccgo_ts+165, 0) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_PLANARCONFIG)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_PLANARCONFIG)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44803, 0) switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) { case int32(PLANARCONFIG_CONTIG): libc.Xfprintf(tls, fd, __ccgo_ts+44828, 0) case int32(PLANARCONFIG_SEPARATE): libc.Xfprintf(tls, fd, __ccgo_ts+44848, 0) default: libc.Xfprintf(tls, fd, __ccgo_ts+43499, libc.VaList(bp+24, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig))) break } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_PAGENUMBER)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_PAGENUMBER)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44871, libc.VaList(bp+24, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 96))), libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 96 + 1*2))))) } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_COLORMAP)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_COLORMAP)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44893, 0) if flags&int32(TIFFPRINT_COLORMAP1) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+165, 0) n = int32(1) << (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample l = 0 for { if !(l < n) { break } libc.Xfprintf(tls, fd, __ccgo_ts+44907, libc.VaList(bp+24, l, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(td + 100)) + uintptr(l)*2))), libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(td + 100 + 1*4)) + uintptr(l)*2))), libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(td + 100 + 2*4)) + uintptr(l)*2))))) goto _7 _7: ; l++ } } else { libc.Xfprintf(tls, fd, __ccgo_ts+44929, 0) } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_REFBLACKWHITE)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_REFBLACKWHITE)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44940, 0) i4 = 0 for { if !(i4 < int32(3)) { break } libc.Xfprintf(tls, fd, __ccgo_ts+44966, libc.VaList(bp+24, i4, float64(*(*float32)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite + uintptr(int32(2)*i4+0)*4))), float64(*(*float32)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_refblackwhite + uintptr(int32(2)*i4+int32(1))*4))))) goto _8 _8: ; i4++ } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TRANSFERFUNCTION)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_TRANSFERFUNCTION)&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+44984, 0) if flags&int32(TIFFPRINT_CURVES1) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+165, 0) n = int32(1) << (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample l = 0 for { if !(l < n) { break } libc.Xfprintf(tls, fd, __ccgo_ts+45006, libc.VaList(bp+24, l, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(td + 224)) + uintptr(l)*2))))) i5 = uint16(1) for { if !(libc.Int32FromUint16(i5) < libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)-libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_extrasamples) && libc.Int32FromUint16(i5) < int32(3)) { break } libc.Xfprintf(tls, fd, __ccgo_ts+45020, libc.VaList(bp+24, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(td + 224 + uintptr(i5)*4)) + uintptr(l)*2))))) goto _10 _10: ; i5++ } libc.Xfputc(tls, int32('\n'), fd) goto _9 _9: ; l++ } } else { libc.Xfprintf(tls, fd, __ccgo_ts+44929, 0) } } if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_SUBIFD)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_SUBIFD)&libc.Int32FromInt32(0x1f))) != 0 && (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subifd != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+45025, 0) i6 = uint16(0) for { if !(libc.Int32FromUint16(i6) < libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nsubifd)) { break } libc.Xfprintf(tls, fd, __ccgo_ts+45043, libc.VaList(bp+24, *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_subifd + uintptr(i6)*8)))) goto _11 _11: ; i6++ } libc.Xfputc(tls, int32('\n'), fd) } /* ** Custom tag support. */ count2 = int16(XTIFFGetTagListCount(tls, tif)) i7 = 0 for { if !(i7 < int32(count2)) { break } tag = XTIFFGetTagListEntry(tls, tif, i7) mem_alloc = 0 *(*uintptr)(unsafe.Pointer(bp + 4)) = libc.UintptrFromInt32(0) /* must be kept in that scope and not moved in the below TIFFTAG_DOTRANGE specific case */ fip = XTIFFFieldWithTag(tls, tif, tag) if fip == libc.UintptrFromInt32(0) { goto _12 } if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_passcount != 0 { if int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(3) { if XTIFFGetField(tls, tif, tag, libc.VaList(bp+24, bp, bp+4)) != int32(1) { goto _12 } } else { if int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(1) { if XTIFFGetField(tls, tif, tag, libc.VaList(bp+24, bp+12, bp+4)) != int32(1) { goto _12 } *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(*(*Tuint16_t)(unsafe.Pointer(bp + 12))) } else { goto _12 } } } else { if int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(1) || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(3) { *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32(1) } else { if int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(2) { *(*Tuint32_t)(unsafe.Pointer(bp)) = uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { *(*Tuint32_t)(unsafe.Pointer(bp)) = libc.Uint32FromInt16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) } } if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_tag == uint32(TIFFTAG_DOTRANGE) && libc.Xstrcmp(tls, (*TTIFFField)(unsafe.Pointer(fip)).Ffield_name, __ccgo_ts+23515) == 0 { /* TODO: This is an evil exception and should not have been handled this way ... likely best if we move it into the directory structure with an explicit field in libtiff 4.1 and assign it a FIELD_ value */ *(*uintptr)(unsafe.Pointer(bp + 4)) = bp + 8 XTIFFGetField(tls, tif, tag, libc.VaList(bp+24, bp+8+uintptr(0)*2, bp+8+uintptr(1)*2)) } else { if (*TTIFFField)(unsafe.Pointer(fip)).Ffield_type == int32(TIFF_ASCII) || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(1) || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(3) || int32((*TTIFFField)(unsafe.Pointer(fip)).Ffield_readcount) == -int32(2) || *(*Tuint32_t)(unsafe.Pointer(bp)) > uint32(1) { if XTIFFGetField(tls, tif, tag, libc.VaList(bp+24, bp+4)) != int32(1) { goto _12 } } else { /*--: Rational2Double: For Rationals evaluate * "set_field_type" to determine internal storage size. */ tv_size = XTIFFFieldSetGetSize(tls, fip) *(*uintptr)(unsafe.Pointer(bp + 4)) = X_TIFFmallocExt(tls, tif, libc.Int32FromUint32(libc.Uint32FromInt32(tv_size)**(*Tuint32_t)(unsafe.Pointer(bp)))) mem_alloc = int32(1) if XTIFFGetField(tls, tif, tag, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(bp + 4)))) != int32(1) { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) goto _12 } } } } /* * Catch the tags which needs to be specially handled * and pretty print them. If tag not handled in * _TIFFPrettyPrintField() fall down and print it as * any other tag. */ if *(*uintptr)(unsafe.Pointer(bp + 4)) != libc.UintptrFromInt32(0) && !(__TIFFPrettyPrintField(tls, tif, fip, fd, tag, *(*Tuint32_t)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4))) != 0) { __TIFFPrintField(tls, fd, fip, *(*Tuint32_t)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4))) } if mem_alloc != 0 { X_TIFFfreeExt(tls, tif, *(*uintptr)(unsafe.Pointer(bp + 4))) } goto _12 _12: ; i7++ } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir != 0 { (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir})))(tls, tif, fd, flags) } if flags&int32(TIFFPRINT_STRIPS1) != 0 && *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_STRIPOFFSETS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_STRIPOFFSETS)&libc.Int32FromInt32(0x1f))) != 0 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v13 = __ccgo_ts + 45050 } else { v13 = __ccgo_ts + 45056 } libc.Xfprintf(tls, fd, __ccgo_ts+45063, libc.VaList(bp+24, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips, v13)) s = uint32(0) for { if !(s < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips) { break } libc.Xfprintf(tls, fd, __ccgo_ts+45073, libc.VaList(bp+24, s, XTIFFGetStrileOffset(tls, tif, s), XTIFFGetStrileByteCount(tls, tif, s))) goto _14 _14: ; s++ } } } func X_TIFFprintAscii(tls *libc.TLS, fd uintptr, cp uintptr) { __TIFFprintAsciiBounded(tls, fd, cp, libc.Xstrlen(tls, cp)) } func __TIFFprintAsciiBounded(tls *libc.TLS, fd uintptr, cp uintptr, max_chars Tsize_t) { bp := tls.Alloc(16) defer tls.Free(16) var tp, v3 uintptr _, _ = tp, v3 for { if !(max_chars > uint32(0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) != int32('\000')) { break } if libc.BoolInt32(libc.Uint32FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))))-uint32(0x20) < uint32(0x5f)) != 0 { libc.Xfputc(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))), fd) goto _1 } tp = __ccgo_ts + 45098 for { if !(*(*uint8)(unsafe.Pointer(tp)) != 0) { break } v3 = tp tp++ if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v3))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp))) { break } goto _2 _2: ; tp++ } if *(*uint8)(unsafe.Pointer(tp)) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+45109, libc.VaList(bp+8, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(tp))))) } else { libc.Xfprintf(tls, fd, __ccgo_ts+45113, libc.VaList(bp+8, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(cp)))&int32(0xff))) } goto _1 _1: ; cp++ max_chars-- } } func X_TIFFprintAsciiTag(tls *libc.TLS, fd uintptr, name uintptr, value uintptr) { bp := tls.Alloc(16) defer tls.Free(16) libc.Xfprintf(tls, fd, __ccgo_ts+45119, libc.VaList(bp+8, name)) X_TIFFprintAscii(tls, fd, value) libc.Xfprintf(tls, fd, __ccgo_ts+45127, 0) } const FILETYPE_MASK2 = 0x4 const FILETYPE_PAGE4 = 0x2 const FILETYPE_REDUCEDIMAGE4 = 0x1 const O_WRONLY1 = 1 const TIFFPRINT_COLORMAP2 = 0x4 const TIFFPRINT_CURVES2 = 0x2 const TIFFPRINT_STRIPS2 = 0x1 const TIFF_BUF4WRITE3 = 1048576 const TIFF_BUFFERMMAP1 = 8388608 const TIFF_CODERSETUP3 = 32 const TIFF_MAPPED7 = 2048 const TIFF_MYBUFFER9 = 512 const TIFF_NOBITREV5 = 256 const TIFF_NOREADRAW3 = 131072 const TIFF_PERSAMPLE4 = 0x400000 const UINT32_MAX8 = 4294967295 // C documentation // // /* Read 'size' bytes in tif_rawdata buffer starting at offset 'rawdata_offset' // * Returns 1 in case of success, 0 otherwise. */ func _TIFFReadAndRealloc(tls *libc.TLS, tif uintptr, size Ttmsize_t, rawdata_offset Ttmsize_t, is_strip int32, strip_or_tile Tuint32_t, module uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var already_read, bytes_read, to_read Ttmsize_t var filesize Tuint64_t var new_rawdata uintptr _, _, _, _, _ = already_read, bytes_read, filesize, new_rawdata, to_read already_read = 0 /* On 32 bit processes, if the request is large enough, check against */ /* file size */ if size > libc.Int32FromInt32(1000)*libc.Int32FromInt32(1000)*libc.Int32FromInt32(1000) { filesize = (*(*func(*libc.TLS, Tthandle_t) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_sizeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata) if libc.Uint64FromInt32(size) >= filesize { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45130, 0) return 0 } } /* On 64 bit processes, read first a maximum of 1 MB, then 10 MB, etc */ /* so as to avoid allocating too much memory in case the file is too */ /* short. We could ask for the file size, but this might be */ /* expensive with some I/O layers (think of reading a gzipped file) */ /* Restrict to 64 bit processes, so as to avoid reallocs() */ /* on 32 bit processes where virtual memory is scarce. */ for already_read < size { to_read = size - already_read if already_read+to_read+rawdata_offset > (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = libc.Int32FromUint64((libc.Uint64FromInt32(already_read) + libc.Uint64FromInt32(to_read) + libc.Uint64FromInt32(rawdata_offset) + (libc.Uint64FromInt32(libc.Int32FromInt32(1024)) - libc.Uint64FromInt32(1))) / libc.Uint64FromInt32(libc.Int32FromInt32(1024)) * libc.Uint64FromInt32(libc.Int32FromInt32(1024))) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize == 0 { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45177, 0) return 0 } new_rawdata = X_TIFFreallocExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) if new_rawdata == uintptr(0) { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45197, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row)) X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = uintptr(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = 0 return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = new_rawdata } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata == libc.UintptrFromInt32(0) { /* should not happen in practice but helps CoverityScan */ return 0 } bytes_read = (*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata+uintptr(rawdata_offset)+uintptr(already_read), to_read) already_read += bytes_read if bytes_read != to_read { libc.Xmemset(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata+uintptr(rawdata_offset)+uintptr(already_read), 0, libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize-rawdata_offset-already_read)) if is_strip != 0 { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45237, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, already_read, size)) } else { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45290, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, (*TTIFF)(unsafe.Pointer(tif)).Ftif_col, strip_or_tile, already_read, size)) } return 0 } } return int32(1) } func _TIFFFillStripPartial(tls *libc.TLS, tif uintptr, strip int32, read_ahead Ttmsize_t, restart int32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var read_ahead_mod, to_read, unused_data Ttmsize_t var read_offset Tuint64_t var td uintptr _, _, _, _, _ = read_ahead_mod, read_offset, td, to_read, unused_data td = tif + 56 /* tmsize_t bytecountm; */ /* * Expand raw data buffer, if needed, to hold data * strip coming from file (perhaps should set upper * bound on the size of a buffer we'll use?). */ /* bytecountm=(tmsize_t) TIFFGetStrileByteCount(tif, strip); */ /* Not completely sure where the * 2 comes from, but probably for */ /* an exponentional growth strategy of tif_rawdatasize */ if read_ahead < libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))/libc.Int32FromInt32(2) { read_ahead_mod = read_ahead * int32(2) } else { read_ahead_mod = read_ahead } if read_ahead_mod > (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00200) == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module75)), __ccgo_ts+45355, libc.VaList(bp+8, strip)) return 0 } } if restart != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = 0 } /* ** If we are reading more data, move any unused data to the ** start of the buffer. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded > 0 { unused_data = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded - (int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) - int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata)) } else { unused_data = 0 } if unused_data > 0 { libc.Xmemmove(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp, libc.Uint32FromInt32(unused_data)) } /* ** Seek to the point in the file where more data should be read. */ read_offset = XTIFFGetStrileOffset(tls, tif, libc.Uint32FromInt32(strip)) + libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff) + libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded) if !(X_TIFFSeekOK(tls, tif, read_offset) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module75)), __ccgo_ts+45402, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, strip)) return 0 } /* ** How much do we want to read? */ if read_ahead_mod > (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { to_read = read_ahead_mod - unused_data } else { to_read = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - unused_data } if libc.Uint64FromInt32(to_read) > XTIFFGetStrileByteCount(tls, tif, libc.Uint32FromInt32(strip))-libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff)-libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded) { to_read = libc.Int32FromUint64(XTIFFGetStrileByteCount(tls, tif, libc.Uint32FromInt32(strip))) - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff - (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded } if !(_TIFFReadAndRealloc(tls, tif, to_read, unused_data, int32(1), uint32(0), uintptr(unsafe.Pointer(&_module75))) != 0) { return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff + (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded - unused_data (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = unused_data + to_read (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata+uintptr(unused_data), to_read) } /* ** When starting a strip from the beginning we need to ** restart the decoder. */ if restart != 0 { return _TIFFStartStrip(tls, tif, libc.Uint32FromInt32(strip)) } else { return int32(1) } return r } var _module75 = [21]uint8{'T', 'I', 'F', 'F', 'F', 'i', 'l', 'l', 'S', 't', 'r', 'i', 'p', 'P', 'a', 'r', 't', 'i', 'a', 'l'} // C documentation // // /* // * Seek to a random row+sample in a file. // * // * Only used by TIFFReadScanline, and is only used on // * strip organized files. We do some tricky stuff to try // * and avoid reading the whole compressed raw data for big // * strips. // */ func _TIFFSeek(tls *libc.TLS, tif uintptr, row Tuint32_t, sample Tuint16_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var read_ahead Ttmsize_t var strip Tuint32_t var td uintptr var whole_strip int32 _, _, _, _ = read_ahead, strip, td, whole_strip td = tif + 56 read_ahead = 0 /* ** Establish what strip we are working from. */ if row >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength { /* out of range */ XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+45438, libc.VaList(bp+8, row, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength)) return 0 } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { if libc.Int32FromUint16(sample) >= libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+45467, libc.VaList(bp+8, libc.Int32FromUint16(sample), libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel))) return 0 } strip = uint32(sample)*(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage + row/(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip } else { strip = row / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip } /* * Do we want to treat this strip as one whole chunk or * read it a few lines at a time? */ whole_strip = int32(1) if !(whole_strip != 0) { /* 16 is for YCbCr mode where we may need to read 16 */ /* lines at a time to get a decompressed line, and 5000 */ /* is some constant value, for example for JPEG tables */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize < libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))/libc.Int32FromInt32(16) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize*int32(16) < libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))-libc.Int32FromInt32(5000) { read_ahead = (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize*int32(16) + int32(5000) } else { read_ahead = (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize } } /* * If we haven't loaded this strip, do so now, possibly * only reading the first part. */ if strip != (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip { /* different strip, refill */ if whole_strip != 0 { if !(XTIFFFillStrip(tls, tif, strip) != 0) { return 0 } } else { if !(_TIFFFillStripPartial(tls, tif, libc.Int32FromUint32(strip), read_ahead, int32(1)) != 0) { return 0 } } } else { if !(whole_strip != 0) { if int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata+uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded))-int32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp) < read_ahead && libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff)+libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded) < XTIFFGetStrileByteCount(tls, tif, strip) { if !(_TIFFFillStripPartial(tls, tif, libc.Int32FromUint32(strip), read_ahead, 0) != 0) { return 0 } } } } if row < (*TTIFF)(unsafe.Pointer(tif)).Ftif_row { /* * Moving backwards within the same strip: backup * to the start and then decode forward (below). * * NB: If you're planning on lots of random access within a * strip, it's better to just read and decode the entire * strip, and then access the decoded data in a random fashion. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff != 0 { if !(_TIFFFillStripPartial(tls, tif, libc.Int32FromUint32(strip), read_ahead, int32(1)) != 0) { return 0 } } else { if !(_TIFFStartStrip(tls, tif, strip) != 0) { return 0 } } } if row != (*TTIFF)(unsafe.Pointer(tif)).Ftif_row { /* * Seek forward to the desired row. */ /* TODO: Will this really work with partial buffers? */ if !((*(*func(*libc.TLS, uintptr, Tuint32_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seek})))(tls, tif, row-(*TTIFF)(unsafe.Pointer(tif)).Ftif_row) != 0) { return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = row } return int32(1) } func XTIFFReadScanline(tls *libc.TLS, tif uintptr, buf uintptr, row Tuint32_t, sample Tuint16_t) (r int32) { var e, v1, v2 int32 _, _, _ = e, v1, v2 if !(_TIFFCheckRead(tls, tif, 0) != 0) { return -int32(1) } v1 = _TIFFSeek(tls, tif, row, sample) e = v1 if v1 != 0 { /* * Decompress desired row into user buffer. */ e = (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow})))(tls, tif, buf, (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize, sample) /* we are now poised at the beginning of the next row */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = row + uint32(1) if e != 0 { (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, buf, (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize) } } else { libc.Xmemset(tls, buf, 0, libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize)) } if e > 0 { v2 = int32(1) } else { v2 = -int32(1) } return v2 } // C documentation // // /* // * Calculate the strip size according to the number of // * rows in the strip (check for truncated last strip on any // * of the separations). // */ func _TIFFReadEncodedStripGetStripSize(tls *libc.TLS, tif uintptr, strip Tuint32_t, pplane uintptr) (r Ttmsize_t) { bp := tls.Alloc(32) defer tls.Free(32) var rows, rowsperstrip, stripinplane, stripsperplane Tuint32_t var stripsize Ttmsize_t var td uintptr var v1 int32 _, _, _, _, _, _, _ = rows, rowsperstrip, stripinplane, stripsize, stripsperplane, td, v1 td = tif + 56 if !(_TIFFCheckRead(tls, tif, 0) != 0) { return -libc.Int32FromInt32(1) } if strip >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module76)), __ccgo_ts+45499, libc.VaList(bp+8, strip, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips)) return -libc.Int32FromInt32(1) } rowsperstrip = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip if rowsperstrip > (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength { rowsperstrip = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength } if rowsperstrip == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module76)), __ccgo_ts+39288, 0) return -libc.Int32FromInt32(1) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength%rowsperstrip != uint32(0) { v1 = int32(1) } else { v1 = 0 } stripsperplane = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength/rowsperstrip + libc.Uint32FromInt32(v1) stripinplane = strip % stripsperplane if pplane != 0 { *(*Tuint16_t)(unsafe.Pointer(pplane)) = uint16(strip / stripsperplane) } rows = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength - stripinplane*rowsperstrip if rows > rowsperstrip { rows = rowsperstrip } stripsize = XTIFFVStripSize(tls, tif, rows) if stripsize == 0 { return -libc.Int32FromInt32(1) } return stripsize } var _module76 = [21]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'E', 'n', 'c', 'o', 'd', 'e', 'd', 'S', 't', 'r', 'i', 'p'} // C documentation // // /* // * Read a strip of data and decompress the specified // * amount into the user-supplied buffer. // */ func XTIFFReadEncodedStrip(tls *libc.TLS, tif uintptr, strip Tuint32_t, buf uintptr, size Ttmsize_t) (r Ttmsize_t) { bp := tls.Alloc(16) defer tls.Free(16) var stripsize Ttmsize_t var td uintptr var _ /* plane at bp+0 */ Tuint16_t _, _ = stripsize, td td = tif + 56 stripsize = _TIFFReadEncodedStripGetStripSize(tls, tif, strip, bp) if stripsize == -libc.Int32FromInt32(1) { return -libc.Int32FromInt32(1) } /* shortcut to avoid an extra memcpy() */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == int32(COMPRESSION_NONE) && size != -libc.Int32FromInt32(1) && size >= stripsize && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00800) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x20000) == uint32(0) { if _TIFFReadRawStrip1(tls, tif, strip, buf, stripsize, uintptr(unsafe.Pointer(&_module77))) != stripsize { return -libc.Int32FromInt32(1) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, buf, stripsize) } (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, buf, stripsize) return stripsize } if size != -libc.Int32FromInt32(1) && size < stripsize { stripsize = size } if !(XTIFFFillStrip(tls, tif, strip) != 0) { libc.Xmemset(tls, buf, 0, libc.Uint32FromInt32(stripsize)) return -libc.Int32FromInt32(1) } if (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip})))(tls, tif, buf, stripsize, *(*Tuint16_t)(unsafe.Pointer(bp))) <= 0 { return -libc.Int32FromInt32(1) } (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, buf, stripsize) return stripsize } var _module77 = [21]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'E', 'n', 'c', 'o', 'd', 'e', 'd', 'S', 't', 'r', 'i', 'p'} // C documentation // // /* Variant of TIFFReadEncodedStrip() that does // * * if *buf == NULL, *buf = _TIFFmallocExt(tif, bufsizetoalloc) only after // * TIFFFillStrip() has succeeded. This avoid excessive memory allocation in case // * of truncated file. // * * calls regular TIFFReadEncodedStrip() if *buf != NULL // */ func X_TIFFReadEncodedStripAndAllocBuffer(tls *libc.TLS, tif uintptr, strip Tuint32_t, buf uintptr, bufsizetoalloc Ttmsize_t, size_to_read Ttmsize_t) (r Ttmsize_t) { bp := tls.Alloc(16) defer tls.Free(16) var this_stripsize Ttmsize_t var _ /* plane at bp+0 */ Tuint16_t _ = this_stripsize if *(*uintptr)(unsafe.Pointer(buf)) != libc.UintptrFromInt32(0) { return XTIFFReadEncodedStrip(tls, tif, strip, *(*uintptr)(unsafe.Pointer(buf)), size_to_read) } this_stripsize = _TIFFReadEncodedStripGetStripSize(tls, tif, strip, bp) if this_stripsize == -libc.Int32FromInt32(1) { return -libc.Int32FromInt32(1) } if size_to_read != -libc.Int32FromInt32(1) && size_to_read < this_stripsize { this_stripsize = size_to_read } if !(XTIFFFillStrip(tls, tif, strip) != 0) { return -libc.Int32FromInt32(1) } *(*uintptr)(unsafe.Pointer(buf)) = X_TIFFmallocExt(tls, tif, bufsizetoalloc) if *(*uintptr)(unsafe.Pointer(buf)) == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+45530, 0) return -libc.Int32FromInt32(1) } X_TIFFmemset(tls, *(*uintptr)(unsafe.Pointer(buf)), 0, bufsizetoalloc) if (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip})))(tls, tif, *(*uintptr)(unsafe.Pointer(buf)), this_stripsize, *(*Tuint16_t)(unsafe.Pointer(bp))) <= 0 { return -libc.Int32FromInt32(1) } (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, *(*uintptr)(unsafe.Pointer(buf)), this_stripsize) return this_stripsize } func _TIFFReadRawStrip1(tls *libc.TLS, tif uintptr, strip Tuint32_t, buf uintptr, size Ttmsize_t, module uintptr) (r Ttmsize_t) { bp := tls.Alloc(48) defer tls.Free(48) var cc, ma, mb, n, v1 Ttmsize_t var v2 bool _, _, _, _, _, _ = cc, ma, mb, n, v1, v2 if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00800) != libc.Uint32FromInt32(0)) { if !(X_TIFFSeekOK(tls, tif, XTIFFGetStrileOffset(tls, tif, strip)) != 0) { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45556, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, strip)) return -libc.Int32FromInt32(1) } cc = (*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, buf, size) if cc != size { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45237, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, cc, size)) return -libc.Int32FromInt32(1) } } else { ma = 0 if v2 = XTIFFGetStrileOffset(tls, tif, strip) > libc.Uint64FromInt32(libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))); !v2 { v1 = libc.Int32FromUint64(XTIFFGetStrileOffset(tls, tif, strip)) ma = v1 } if v2 || v1 > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { n = 0 } else { if ma > libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))-size { n = 0 } else { mb = ma + size if mb > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { n = (*TTIFF)(unsafe.Pointer(tif)).Ftif_size - ma } else { n = size } } } if n != size { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45592, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, strip, n, size)) return -libc.Int32FromInt32(1) } X_TIFFmemcpy(tls, buf, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(ma), size) } return size } func _TIFFReadRawStripOrTile2(tls *libc.TLS, tif uintptr, strip_or_tile Tuint32_t, is_strip int32, size Ttmsize_t, module uintptr) (r Ttmsize_t) { bp := tls.Alloc(32) defer tls.Free(32) if !(X_TIFFSeekOK(tls, tif, XTIFFGetStrileOffset(tls, tif, strip_or_tile)) != 0) { if is_strip != 0 { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45556, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, strip_or_tile)) } else { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45655, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, (*TTIFF)(unsafe.Pointer(tif)).Ftif_col, strip_or_tile)) } return -libc.Int32FromInt32(1) } if !(_TIFFReadAndRealloc(tls, tif, size, 0, is_strip, strip_or_tile, module) != 0) { return -libc.Int32FromInt32(1) } return size } // C documentation // // /* // * Read a strip of data from the file. // */ func XTIFFReadRawStrip(tls *libc.TLS, tif uintptr, strip Tuint32_t, buf uintptr, size Ttmsize_t) (r Ttmsize_t) { bp := tls.Alloc(32) defer tls.Free(32) var bytecount64 Tuint64_t var bytecountm Ttmsize_t var td uintptr _, _, _ = bytecount64, bytecountm, td td = tif + 56 if !(_TIFFCheckRead(tls, tif, 0) != 0) { return -libc.Int32FromInt32(1) } if strip >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module78)), __ccgo_ts+45499, libc.VaList(bp+8, strip, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips)) return -libc.Int32FromInt32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x20000) != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module78)), __ccgo_ts+45693, 0) return -libc.Int32FromInt32(1) } bytecount64 = XTIFFGetStrileByteCount(tls, tif, strip) if size != -libc.Int32FromInt32(1) && libc.Uint64FromInt32(size) <= bytecount64 { bytecountm = size } else { bytecountm = X_TIFFCastUInt64ToSSize(tls, tif, bytecount64, uintptr(unsafe.Pointer(&_module78))) } if bytecountm == 0 { return -libc.Int32FromInt32(1) } return _TIFFReadRawStrip1(tls, tif, strip, buf, bytecountm, uintptr(unsafe.Pointer(&_module78))) } var _module78 = [17]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'R', 'a', 'w', 'S', 't', 'r', 'i', 'p'} func _NoSanitizeSubUInt64(tls *libc.TLS, a Tuint64_t, b Tuint64_t) (r Tuint64_t) { return a - b } // C documentation // // /* // * Read the specified strip and setup for decoding. The data buffer is // * expanded, as necessary, to hold the strip's data. // */ func XTIFFFillStrip(tls *libc.TLS, tif uintptr, strip Tuint32_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var bytecount, newbytecount Tuint64_t var bytecountm, stripsize Ttmsize_t var td uintptr _, _, _, _, _ = bytecount, bytecountm, newbytecount, stripsize, td td = tif + 56 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x20000) == uint32(0) { bytecount = XTIFFGetStrileByteCount(tls, tif, strip) if bytecount == uint64(0) || bytecount > libc.Uint64FromInt64(libc.Int64FromInt32(0x7FFFFFFF)< libc.Uint64FromInt32(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) { /* 10 and 4096 are just values that could be adjusted. */ /* Hopefully they are safe enough for all codecs */ stripsize = XTIFFStripSize(tls, tif) if stripsize != 0 && (bytecount-uint64(4096))/uint64(10) > libc.Uint64FromInt32(stripsize) { newbytecount = libc.Uint64FromInt32(stripsize)*uint64(10) + uint64(4096) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module79)), __ccgo_ts+45801, libc.VaList(bp+8, bytecount, strip, newbytecount)) bytecount = newbytecount } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) { /* * We must check for overflow, potentially causing * an OOB read. Instead of simple * * TIFFGetStrileOffset(tif, strip)+bytecount > tif->tif_size * * comparison (which can overflow) we do the following * two comparisons: */ if bytecount > libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_size) || XTIFFGetStrileOffset(tls, tif, strip) > libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_size)-bytecount { /* * This error message might seem strange, but * it's what would happen if a read were done * instead. */ XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module79)), __ccgo_ts+45861, libc.VaList(bp+8, strip, _NoSanitizeSubUInt64(tls, libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_size), XTIFFGetStrileOffset(tls, tif, strip)), bytecount)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) return 0 } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) && ((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != uint32(0) || (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) != 0) { /* * The image is mapped into memory and we either don't * need to flip bits or the compression routine is * going to handle this operation itself. In this * case, avoid copying the raw data and instead just * reference the data from the memory mapped file * image. This assumes that the decompression * routines do not modify the contents of the raw data * buffer (if they try to, the application will get a * fault since the file is mapped read-only). */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00200) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != 0 { X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00200) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = libc.Int32FromUint64(bytecount) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = (*TTIFF)(unsafe.Pointer(tif)).Ftif_base + uintptr(libc.Int32FromUint64(XTIFFGetStrileOffset(tls, tif, strip))) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = libc.Int32FromUint64(bytecount) /* * When we have tif_rawdata reference directly into the memory * mapped file we need to be pretty careful about how we use the * rawdata. It is not a general purpose working buffer as it * normally otherwise is. So we keep track of this fact to avoid * using it improperly. */ *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x800000) } else { bytecountm = libc.Int32FromUint64(bytecount) if libc.Uint64FromInt32(bytecountm) != bytecount { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module79)), __ccgo_ts+22007, 0) return 0 } if bytecountm > (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00200) == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module79)), __ccgo_ts+45915, libc.VaList(bp+8, strip)) return 0 } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x800000) != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = 0 *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x800000) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) { if bytecountm > (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize && !(XTIFFReadBufferSetup(tls, tif, uintptr(0), bytecountm) != 0) { return 0 } if _TIFFReadRawStrip1(tls, tif, strip, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, bytecountm, uintptr(unsafe.Pointer(&_module79))) != bytecountm { return 0 } } else { if _TIFFReadRawStripOrTile2(tls, tif, strip, int32(1), bytecountm, uintptr(unsafe.Pointer(&_module79))) != bytecountm { return 0 } } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = bytecountm if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, bytecountm) } } } return _TIFFStartStrip(tls, tif, strip) } var _module79 = [14]uint8{'T', 'I', 'F', 'F', 'F', 'i', 'l', 'l', 'S', 't', 'r', 'i', 'p'} /* * Tile-oriented Read Support * Contributed by Nancy Cam (Silicon Graphics). */ // C documentation // // /* // * Read and decompress a tile of data. The // * tile is selected by the (x,y,z,s) coordinates. // */ func XTIFFReadTile(tls *libc.TLS, tif uintptr, buf uintptr, x Tuint32_t, y Tuint32_t, z Tuint32_t, s Tuint16_t) (r Ttmsize_t) { if !(_TIFFCheckRead(tls, tif, int32(1)) != 0) || !(XTIFFCheckTile(tls, tif, x, y, z, s) != 0) { return -libc.Int32FromInt32(1) } return XTIFFReadEncodedTile(tls, tif, XTIFFComputeTile(tls, tif, x, y, z, s), buf, -libc.Int32FromInt32(1)) } // C documentation // // /* // * Read a tile of data and decompress the specified // * amount into the user-supplied buffer. // */ func XTIFFReadEncodedTile(tls *libc.TLS, tif uintptr, tile Tuint32_t, buf uintptr, size Ttmsize_t) (r Ttmsize_t) { bp := tls.Alloc(32) defer tls.Free(32) var td uintptr var tilesize Ttmsize_t _, _ = td, tilesize td = tif + 56 tilesize = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize if !(_TIFFCheckRead(tls, tif, int32(1)) != 0) { return -libc.Int32FromInt32(1) } if tile >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module80)), __ccgo_ts+45954, libc.VaList(bp+8, tile, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips)) return -libc.Int32FromInt32(1) } /* shortcut to avoid an extra memcpy() */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == int32(COMPRESSION_NONE) && size != -libc.Int32FromInt32(1) && size >= tilesize && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00800) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x20000) == uint32(0) { if _TIFFReadRawTile1(tls, tif, tile, buf, tilesize, uintptr(unsafe.Pointer(&_module80))) != tilesize { return -libc.Int32FromInt32(1) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, buf, tilesize) } (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, buf, tilesize) return tilesize } if size == -libc.Int32FromInt32(1) { size = tilesize } else { if size > tilesize { size = tilesize } } if !(XTIFFFillTile(tls, tif, tile) != 0) { libc.Xmemset(tls, buf, 0, libc.Uint32FromInt32(size)) return -libc.Int32FromInt32(1) } else { if (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile})))(tls, tif, buf, size, uint16(tile/(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage)) != 0 { (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, buf, size) return size } else { return -libc.Int32FromInt32(1) } } return r } var _module80 = [20]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'E', 'n', 'c', 'o', 'd', 'e', 'd', 'T', 'i', 'l', 'e'} // C documentation // // /* Variant of TIFFReadTile() that does // * * if *buf == NULL, *buf = _TIFFmallocExt(tif, bufsizetoalloc) only after // * TIFFFillTile() has succeeded. This avoid excessive memory allocation in case // * of truncated file. // * * calls regular TIFFReadEncodedTile() if *buf != NULL // */ func X_TIFFReadTileAndAllocBuffer(tls *libc.TLS, tif uintptr, buf uintptr, bufsizetoalloc Ttmsize_t, x Tuint32_t, y Tuint32_t, z Tuint32_t, s Tuint16_t) (r Ttmsize_t) { if !(_TIFFCheckRead(tls, tif, int32(1)) != 0) || !(XTIFFCheckTile(tls, tif, x, y, z, s) != 0) { return -libc.Int32FromInt32(1) } return X_TIFFReadEncodedTileAndAllocBuffer(tls, tif, XTIFFComputeTile(tls, tif, x, y, z, s), buf, bufsizetoalloc, -libc.Int32FromInt32(1)) } // C documentation // // /* Variant of TIFFReadEncodedTile() that does // * * if *buf == NULL, *buf = _TIFFmallocExt(tif, bufsizetoalloc) only after // * TIFFFillTile() has succeeded. This avoid excessive memory allocation in case // * of truncated file. // * * calls regular TIFFReadEncodedTile() if *buf != NULL // */ func X_TIFFReadEncodedTileAndAllocBuffer(tls *libc.TLS, tif uintptr, tile Tuint32_t, buf uintptr, bufsizetoalloc Ttmsize_t, size_to_read Ttmsize_t) (r Ttmsize_t) { bp := tls.Alloc(32) defer tls.Free(32) var maxCompressionRatio, v1, v2, v3, v4 int32 var td uintptr var tilesize Ttmsize_t _, _, _, _, _, _, _ = maxCompressionRatio, td, tilesize, v1, v2, v3, v4 td = tif + 56 tilesize = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize if *(*uintptr)(unsafe.Pointer(buf)) != libc.UintptrFromInt32(0) { return XTIFFReadEncodedTile(tls, tif, tile, *(*uintptr)(unsafe.Pointer(buf)), size_to_read) } if !(_TIFFCheckRead(tls, tif, int32(1)) != 0) { return -libc.Int32FromInt32(1) } if tile >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module81)), __ccgo_ts+45954, libc.VaList(bp+8, tile, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips)) return -libc.Int32FromInt32(1) } if !(XTIFFFillTile(tls, tif, tile) != 0) { return -libc.Int32FromInt32(1) } /* Sanity checks to avoid excessive memory allocation */ /* Cf https://gitlab.com/libtiff/libtiff/-/issues/479 */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == int32(COMPRESSION_NONE) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize != tilesize { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+45984, libc.VaList(bp+8, tile, libc.Uint64FromInt32(tilesize), libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize))) return -libc.Int32FromInt32(1) } } else { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == int32(COMPRESSION_ZSTD) { v1 = int32(33000) } else { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == int32(COMPRESSION_JXL) { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { v3 = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { v3 = int32(1) } v2 = int32(25000) * v3 } else { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == int32(COMPRESSION_LZMA) { v4 = int32(7000) } else { v4 = int32(1000) } v2 = v4 } v1 = v2 } /* Max compression ratio experimentally determined. Might be fragile... * Only apply this heuristics to situations where the memory allocation * would be big, to avoid breaking nominal use cases. */ maxCompressionRatio = v1 if bufsizetoalloc > libc.Int32FromInt32(100)*libc.Int32FromInt32(1000)*libc.Int32FromInt32(1000) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize < tilesize/maxCompressionRatio { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+46045, libc.VaList(bp+8, tile, libc.Uint64FromInt32(tilesize), libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize))) return -libc.Int32FromInt32(1) } } *(*uintptr)(unsafe.Pointer(buf)) = X_TIFFmallocExt(tls, tif, bufsizetoalloc) if *(*uintptr)(unsafe.Pointer(buf)) == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, XTIFFFileName(tls, tif), __ccgo_ts+39136, 0) return -libc.Int32FromInt32(1) } X_TIFFmemset(tls, *(*uintptr)(unsafe.Pointer(buf)), 0, bufsizetoalloc) if size_to_read == -libc.Int32FromInt32(1) { size_to_read = tilesize } else { if size_to_read > tilesize { size_to_read = tilesize } } if (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile})))(tls, tif, *(*uintptr)(unsafe.Pointer(buf)), size_to_read, uint16(tile/(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage)) != 0 { (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, *(*uintptr)(unsafe.Pointer(buf)), size_to_read) return size_to_read } else { return -libc.Int32FromInt32(1) } return r } var _module81 = [35]uint8{'_', 'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'E', 'n', 'c', 'o', 'd', 'e', 'd', 'T', 'i', 'l', 'e', 'A', 'n', 'd', 'A', 'l', 'l', 'o', 'c', 'B', 'u', 'f', 'f', 'e', 'r'} func _TIFFReadRawTile1(tls *libc.TLS, tif uintptr, tile Tuint32_t, buf uintptr, size Ttmsize_t, module uintptr) (r Ttmsize_t) { bp := tls.Alloc(48) defer tls.Free(48) var cc, ma, mb, n Ttmsize_t _, _, _, _ = cc, ma, mb, n if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00800) != libc.Uint32FromInt32(0)) { if !(X_TIFFSeekOK(tls, tif, XTIFFGetStrileOffset(tls, tif, tile)) != 0) { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45655, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, (*TTIFF)(unsafe.Pointer(tif)).Ftif_col, tile)) return -libc.Int32FromInt32(1) } cc = (*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, buf, size) if cc != size { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+46144, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, (*TTIFF)(unsafe.Pointer(tif)).Ftif_col, cc, size)) return -libc.Int32FromInt32(1) } } else { ma = libc.Int32FromUint64(XTIFFGetStrileOffset(tls, tif, tile)) mb = ma + size if XTIFFGetStrileOffset(tls, tif, tile) > libc.Uint64FromInt32(libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))) || ma > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { n = 0 } else { if mb < ma || mb < size || mb > (*TTIFF)(unsafe.Pointer(tif)).Ftif_size { n = (*TTIFF)(unsafe.Pointer(tif)).Ftif_size - ma } else { n = size } } if n != size { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+45290, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, (*TTIFF)(unsafe.Pointer(tif)).Ftif_col, tile, n, size)) return -libc.Int32FromInt32(1) } X_TIFFmemcpy(tls, buf, (*TTIFF)(unsafe.Pointer(tif)).Ftif_base+uintptr(ma), size) } return size } // C documentation // // /* // * Read a tile of data from the file. // */ func XTIFFReadRawTile(tls *libc.TLS, tif uintptr, tile Tuint32_t, buf uintptr, size Ttmsize_t) (r Ttmsize_t) { bp := tls.Alloc(32) defer tls.Free(32) var bytecount64 Tuint64_t var bytecountm Ttmsize_t var td uintptr _, _, _ = bytecount64, bytecountm, td td = tif + 56 if !(_TIFFCheckRead(tls, tif, int32(1)) != 0) { return -libc.Int32FromInt32(1) } if tile >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module82)), __ccgo_ts+45954, libc.VaList(bp+8, tile, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips)) return -libc.Int32FromInt32(1) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x20000) != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module82)), __ccgo_ts+45693, 0) return -libc.Int32FromInt32(1) } bytecount64 = XTIFFGetStrileByteCount(tls, tif, tile) if size != -libc.Int32FromInt32(1) && libc.Uint64FromInt32(size) <= bytecount64 { bytecountm = size } else { bytecountm = X_TIFFCastUInt64ToSSize(tls, tif, bytecount64, uintptr(unsafe.Pointer(&_module82))) } if bytecountm == 0 { return -libc.Int32FromInt32(1) } return _TIFFReadRawTile1(tls, tif, tile, buf, bytecountm, uintptr(unsafe.Pointer(&_module82))) } var _module82 = [16]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'R', 'a', 'w', 'T', 'i', 'l', 'e'} // C documentation // // /* // * Read the specified tile and setup for decoding. The data buffer is // * expanded, as necessary, to hold the tile's data. // */ func XTIFFFillTile(tls *libc.TLS, tif uintptr, tile Tuint32_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var bytecount, newbytecount Tuint64_t var bytecountm, stripsize Ttmsize_t var td uintptr _, _, _, _, _ = bytecount, bytecountm, newbytecount, stripsize, td td = tif + 56 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x20000) == uint32(0) { bytecount = XTIFFGetStrileByteCount(tls, tif, tile) if bytecount == uint64(0) || bytecount > libc.Uint64FromInt64(libc.Int64FromInt32(0x7FFFFFFF)< libc.Uint64FromInt32(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) { /* 10 and 4096 are just values that could be adjusted. */ /* Hopefully they are safe enough for all codecs */ stripsize = XTIFFTileSize(tls, tif) if stripsize != 0 && (bytecount-uint64(4096))/uint64(10) > libc.Uint64FromInt32(stripsize) { newbytecount = libc.Uint64FromInt32(stripsize)*uint64(10) + uint64(4096) XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module83)), __ccgo_ts+46239, libc.VaList(bp+8, bytecount, tile, newbytecount)) bytecount = newbytecount } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) { /* * We must check for overflow, potentially causing * an OOB read. Instead of simple * * TIFFGetStrileOffset(tif, tile)+bytecount > tif->tif_size * * comparison (which can overflow) we do the following * two comparisons: */ if bytecount > libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_size) || XTIFFGetStrileOffset(tls, tif, tile) > libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_size)-bytecount { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) return 0 } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) && ((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != uint32(0) || (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) != 0) { /* * The image is mapped into memory and we either don't * need to flip bits or the compression routine is * going to handle this operation itself. In this * case, avoid copying the raw data and instead just * reference the data from the memory mapped file * image. This assumes that the decompression * routines do not modify the contents of the raw data * buffer (if they try to, the application will get a * fault since the file is mapped read-only). */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00200) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != 0 { X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00200) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = libc.Int32FromUint64(bytecount) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = (*TTIFF)(unsafe.Pointer(tif)).Ftif_base + uintptr(libc.Int32FromUint64(XTIFFGetStrileOffset(tls, tif, tile))) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = libc.Int32FromUint64(bytecount) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x800000) } else { bytecountm = libc.Int32FromUint64(bytecount) if libc.Uint64FromInt32(bytecountm) != bytecount { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module83)), __ccgo_ts+22007, 0) return 0 } if bytecountm > (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00200) == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module83)), __ccgo_ts+46297, libc.VaList(bp+8, tile)) return 0 } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x800000) != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = 0 *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x800000) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00800) != uint32(0) { if bytecountm > (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize && !(XTIFFReadBufferSetup(tls, tif, uintptr(0), bytecountm) != 0) { return 0 } if _TIFFReadRawTile1(tls, tif, tile, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, bytecountm, uintptr(unsafe.Pointer(&_module83))) != bytecountm { return 0 } } else { if _TIFFReadRawStripOrTile2(tls, tif, tile, 0, bytecountm, uintptr(unsafe.Pointer(&_module83))) != bytecountm { return 0 } } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = bytecountm if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != libc.UintptrFromInt32(0) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded) } } } return _TIFFStartTile(tls, tif, tile) } var _module83 = [13]uint8{'T', 'I', 'F', 'F', 'F', 'i', 'l', 'l', 'T', 'i', 'l', 'e'} // C documentation // // /* // * Setup the raw data buffer in preparation for // * reading a strip of raw data. If the buffer // * is specified as zero, then a buffer of appropriate // * size is allocated by the library. Otherwise, // * the client must guarantee that the buffer is // * large enough to hold any individual strip of // * raw data. // */ func XTIFFReadBufferSetup(tls *libc.TLS, tif uintptr, bp uintptr, size Ttmsize_t) (r int32) { bp1 := tls.Alloc(16) defer tls.Free(16) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x800000) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != 0 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00200) != 0 { X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = 0 } if bp != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = size (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = bp *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00200) } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = libc.Int32FromUint64((libc.Uint64FromInt32(size) + (libc.Uint64FromInt32(libc.Int32FromInt32(1024)) - libc.Uint64FromInt32(1))) / libc.Uint64FromInt32(libc.Int32FromInt32(1024)) * libc.Uint64FromInt32(libc.Int32FromInt32(1024))) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize == 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module84)), __ccgo_ts+45177, 0) return 0 } /* Initialize to zero to avoid uninitialized buffers in case of */ /* short reads (http://bugzilla.maptools.org/show_bug.cgi?id=2651) */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = X_TIFFcallocExt(tls, tif, int32(1), (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00200) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module84)), __ccgo_ts+45197, libc.VaList(bp1+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = 0 return 0 } return int32(1) } var _module84 = [20]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'B', 'u', 'f', 'f', 'e', 'r', 'S', 'e', 't', 'u', 'p'} // C documentation // // /* // * Set state to appear as if a // * strip has just been read in. // */ func _TIFFStartStrip(tls *libc.TLS, tif uintptr, strip Tuint32_t) (r int32) { var td uintptr _ = td td = tif + 56 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00020) == uint32(0) { if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode})))(tls, tif) != 0) { return 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00020) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = strip (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = strip % (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x100000) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x20000) != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded > 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = libc.Int32FromUint64(XTIFFGetStrileByteCount(tls, tif, strip)) } } if (*(*func(*libc.TLS, uintptr, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_predecode})))(tls, tif, uint16(strip/(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage)) == 0 { /* Needed for example for scanline access, if tif_predecode */ /* fails, and we try to read the same strip again. Without invalidating */ /* tif_curstrip, we'd call tif_decoderow() on a possibly invalid */ /* codec state. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) return 0 } return int32(1) } // C documentation // // /* // * Set state to appear as if a // * tile has just been read in. // */ func _TIFFStartTile(tls *libc.TLS, tif uintptr, tile Tuint32_t) (r int32) { var howmany32 Tuint32_t var td uintptr var v1, v2 uint32 _, _, _, _ = howmany32, td, v1, v2 td = tif + 56 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00020) == uint32(0) { if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode})))(tls, tif) != 0) { return 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00020) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile = tile if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module85)), __ccgo_ts+46335, 0) return 0 } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth < uint32(0xffffffff)-((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth-libc.Uint32FromInt32(1)) { v1 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth + ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth - uint32(1))) / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth } else { v1 = 0 } howmany32 = v1 if howmany32 == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module85)), __ccgo_ts+46350, 0) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = tile % howmany32 * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength < uint32(0xffffffff)-((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength-libc.Uint32FromInt32(1)) { v2 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength + ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength - uint32(1))) / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength } else { v2 = 0 } howmany32 = v2 if howmany32 == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module85)), __ccgo_ts+46350, 0) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_col = tile % howmany32 * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x100000) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x20000) != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = libc.UintptrFromInt32(0) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded > 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = libc.Int32FromUint64(XTIFFGetStrileByteCount(tls, tif, tile)) } } return (*(*func(*libc.TLS, uintptr, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_predecode})))(tls, tif, uint16(tile/(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage)) } var _module85 = [14]uint8{'T', 'I', 'F', 'F', 'S', 't', 'a', 'r', 't', 'T', 'i', 'l', 'e'} func _TIFFCheckRead(tls *libc.TLS, tif uintptr, tiles int32) (r int32) { var v1 uintptr _ = v1 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == int32(O_WRONLY1) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+46361, 0) return 0 } if tiles^libc.BoolInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0)) != 0 { if tiles != 0 { v1 = __ccgo_ts + 46387 } else { v1 = __ccgo_ts + 46427 } XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, v1, 0) return 0 } return int32(1) } // C documentation // // /* Use the provided input buffer (inbuf, insize) and decompress it into // * (outbuf, outsize). // * This function replaces the use of // * TIFFReadEncodedStrip()/TIFFReadEncodedTile() when the user can provide the // * buffer for the input data, for example when he wants to avoid libtiff to read // * the strile offset/count values from the [Strip|Tile][Offsets/ByteCounts] // * array. inbuf content must be writable (if bit reversal is needed) Returns 1 // * in case of success, 0 otherwise. // */ func XTIFFReadFromUserBuffer(tls *libc.TLS, tif uintptr, strile Tuint32_t, inbuf uintptr, insize Ttmsize_t, outbuf uintptr, outsize Ttmsize_t) (r int32) { var old_rawdata, td uintptr var old_rawdatasize Ttmsize_t var old_tif_flags, rowsperstrip, stripsperplane Tuint32_t var ret, v1 int32 _, _, _, _, _, _, _, _ = old_rawdata, old_rawdatasize, old_tif_flags, ret, rowsperstrip, stripsperplane, td, v1 td = tif + 56 ret = int32(1) old_tif_flags = (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags old_rawdatasize = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize old_rawdata = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == int32(O_WRONLY1) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+46361, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x20000) != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module86)), __ccgo_ts+45693, 0) return 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00200) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x800000) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = insize (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = inbuf (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = insize if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, inbuf, insize) } if XTIFFIsTiled(tls, tif) != 0 { if !(_TIFFStartTile(tls, tif, strile) != 0) { ret = 0 libc.Xmemset(tls, outbuf, 0, libc.Uint32FromInt32(outsize)) } else { if !((*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile})))(tls, tif, outbuf, outsize, uint16(strile/(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage)) != 0) { ret = 0 } } } else { rowsperstrip = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip if rowsperstrip > (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength { rowsperstrip = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength } if rowsperstrip == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module86)), __ccgo_ts+39288, 0) ret = 0 } else { if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength%rowsperstrip != uint32(0) { v1 = int32(1) } else { v1 = 0 } stripsperplane = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength/rowsperstrip + libc.Uint32FromInt32(v1) if !(_TIFFStartStrip(tls, tif, strile) != 0) { ret = 0 libc.Xmemset(tls, outbuf, 0, libc.Uint32FromInt32(outsize)) } else { if !((*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip})))(tls, tif, outbuf, outsize, uint16(strile/stripsperplane)) != 0) { ret = 0 } } } } if ret != 0 { (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, outbuf, outsize) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, inbuf, insize) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags = old_tif_flags&(libc.Uint32FromUint32(0x00200)|libc.Uint32FromUint32(0x800000)) | (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags & ^(libc.Uint32FromUint32(0x00200)|libc.Uint32FromUint32(0x800000)) (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = old_rawdatasize (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = old_rawdata (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataoff = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdataloaded = 0 return ret } var _module86 = [23]uint8{'T', 'I', 'F', 'F', 'R', 'e', 'a', 'd', 'F', 'r', 'o', 'm', 'U', 's', 'e', 'r', 'B', 'u', 'f', 'f', 'e', 'r'} func X_TIFFNoPostDecode(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t) { _ = tif _ = buf _ = cc } func X_TIFFSwab16BitData(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t) { _ = tif XTIFFSwabArrayOfShort(tls, buf, cc/int32(2)) } func X_TIFFSwab24BitData(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t) { _ = tif XTIFFSwabArrayOfTriples(tls, buf, cc/int32(3)) } func X_TIFFSwab32BitData(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t) { _ = tif XTIFFSwabArrayOfLong(tls, buf, cc/int32(4)) } func X_TIFFSwab64BitData(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t) { _ = tif XTIFFSwabArrayOfDouble(tls, buf, cc/int32(8)) } const O_WRONLY2 = 01 const TIFF_BUF4WRITE4 = 0x100000 const TIFF_BUFFERMMAP2 = 0x800000 const TIFF_CODERSETUP4 = 0x00020 const TIFF_ISTILED8 = 0x00400 const TIFF_MAPPED8 = 0x00800 const TIFF_MYBUFFER10 = 0x00200 const TIFF_NOBITREV6 = 0x00100 const TIFF_NOREADRAW4 = 0x20000 const TIFF_UPSAMPLED5 = 16384 const UINT32_MAX9 = "0xffffffffu" // C documentation // // /* // * Compute which strip a (row,sample) value is in. // */ func XTIFFComputeStrip(tls *libc.TLS, tif uintptr, row Tuint32_t, sample Tuint16_t) (r Tuint32_t) { bp := tls.Alloc(32) defer tls.Free(32) var strip Tuint32_t var td uintptr _, _ = strip, td td = tif + 56 if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module87)), __ccgo_ts+46469, 0) return uint32(0) } strip = row / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { if libc.Int32FromUint16(sample) >= libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module87)), __ccgo_ts+46512, libc.VaList(bp+8, uint32(sample), uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel))) return libc.Uint32FromInt32(libc.Int32FromInt32(0)) } strip += uint32(sample) * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage } return strip } var _module87 = [17]uint8{'T', 'I', 'F', 'F', 'C', 'o', 'm', 'p', 'u', 't', 'e', 'S', 't', 'r', 'i', 'p'} // C documentation // // /* // * Compute how many strips are in an image. // */ func XTIFFNumberOfStrips(tls *libc.TLS, tif uintptr) (r Tuint32_t) { var nstrips Tuint32_t var td uintptr var v1, v2 uint32 _, _, _, _ = nstrips, td, v1, v2 td = tif + 56 if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip == uint32(0) { XTIFFWarningExtR(tls, tif, __ccgo_ts+46546, __ccgo_ts+46565, 0) return uint32(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { v1 = uint32(1) } else { if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength < uint32(0xffffffff)-((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip-libc.Uint32FromInt32(1)) { v2 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength + ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip - uint32(1))) / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip } else { v2 = 0 } v1 = v2 } nstrips = v1 if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { nstrips = X_TIFFMultiply32(tls, tif, nstrips, uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel), __ccgo_ts+46546) } return nstrips } // C documentation // // /* // * Compute the # bytes in a variable height, row-aligned strip. // */ func XTIFFVStripSize64(tls *libc.TLS, tif uintptr, nrows Tuint32_t) (r Tuint64_t) { bp := tls.Alloc(32) defer tls.Free(32) var samplingblock_samples Tuint16_t var samplingblocks_hor, samplingblocks_ver Tuint32_t var samplingrow_samples, samplingrow_size Tuint64_t var td uintptr var v1, v2 uint32 var v3 uint64 var _ /* ycbcrsubsampling at bp+0 */ [2]Tuint16_t _, _, _, _, _, _, _, _, _ = samplingblock_samples, samplingblocks_hor, samplingblocks_ver, samplingrow_samples, samplingrow_size, td, v1, v2, v3 td = tif + 56 if nrows == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { nrows = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == int32(PHOTOMETRIC_YCBCR) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x04000) != libc.Uint32FromInt32(0)) { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) != int32(3) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module88)), __ccgo_ts+46586, 0) return uint64(0) } XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_YCBCRSUBSAMPLING), libc.VaList(bp+16, bp+uintptr(0)*2, bp+uintptr(1)*2)) if libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) != int32(1) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) != int32(2) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) != int32(4) || libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) != int32(1) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) != int32(2) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) != int32(4) || (libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) == 0 || libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) == 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module88)), __ccgo_ts+46619, libc.VaList(bp+16, libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]), libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]))) return uint64(0) } samplingblock_samples = libc.Uint16FromInt32(libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0])*libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) + int32(2)) if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0])-libc.Int32FromInt32(1)) { v1 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth + (uint32((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) - uint32(1))) / uint32((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) } else { v1 = 0 } samplingblocks_hor = v1 if nrows < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)])-libc.Int32FromInt32(1)) { v2 = (nrows + (uint32((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) - uint32(1))) / uint32((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) } else { v2 = 0 } samplingblocks_ver = v2 samplingrow_samples = X_TIFFMultiply64(tls, tif, uint64(samplingblocks_hor), uint64(samplingblock_samples), uintptr(unsafe.Pointer(&_module88))) if X_TIFFMultiply64(tls, tif, samplingrow_samples, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uintptr(unsafe.Pointer(&_module88)))&uint64(0x07) != 0 { v3 = X_TIFFMultiply64(tls, tif, samplingrow_samples, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uintptr(unsafe.Pointer(&_module88)))>>libc.Int32FromInt32(3) + uint64(1) } else { v3 = X_TIFFMultiply64(tls, tif, samplingrow_samples, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uintptr(unsafe.Pointer(&_module88))) >> int32(3) } samplingrow_size = v3 return X_TIFFMultiply64(tls, tif, samplingrow_size, uint64(samplingblocks_ver), uintptr(unsafe.Pointer(&_module88))) } else { return X_TIFFMultiply64(tls, tif, uint64(nrows), XTIFFScanlineSize64(tls, tif), uintptr(unsafe.Pointer(&_module88))) } return r } var _module88 = [17]uint8{'T', 'I', 'F', 'F', 'V', 'S', 't', 'r', 'i', 'p', 'S', 'i', 'z', 'e', '6', '4'} func XTIFFVStripSize(tls *libc.TLS, tif uintptr, nrows Tuint32_t) (r Ttmsize_t) { var m Tuint64_t _ = m m = XTIFFVStripSize64(tls, tif, nrows) return X_TIFFCastUInt64ToSSize(tls, tif, m, uintptr(unsafe.Pointer(&_module89))) } var _module89 = [15]uint8{'T', 'I', 'F', 'F', 'V', 'S', 't', 'r', 'i', 'p', 'S', 'i', 'z', 'e'} // C documentation // // /* // * Compute the # bytes in a raw strip. // */ func XTIFFRawStripSize64(tls *libc.TLS, tif uintptr, strip Tuint32_t) (r Tuint64_t) { bp := tls.Alloc(32) defer tls.Free(32) var bytecount Tuint64_t _ = bytecount bytecount = XTIFFGetStrileByteCount(tls, tif, strip) if bytecount == uint64(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module90)), __ccgo_ts+46653, libc.VaList(bp+8, bytecount, strip)) bytecount = libc.Uint64FromInt32(-libc.Int32FromInt32(1)) } return bytecount } var _module90 = [19]uint8{'T', 'I', 'F', 'F', 'R', 'a', 'w', 'S', 't', 'r', 'i', 'p', 'S', 'i', 'z', 'e', '6', '4'} func XTIFFRawStripSize(tls *libc.TLS, tif uintptr, strip Tuint32_t) (r Ttmsize_t) { var m Tuint64_t var n Ttmsize_t _, _ = m, n m = XTIFFRawStripSize64(tls, tif, strip) if m == libc.Uint64FromInt32(-libc.Int32FromInt32(1)) { n = -libc.Int32FromInt32(1) } else { n = libc.Int32FromUint64(m) if libc.Uint64FromInt32(n) != m { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module91)), __ccgo_ts+22007, 0) n = 0 } } return n } var _module91 = [17]uint8{'T', 'I', 'F', 'F', 'R', 'a', 'w', 'S', 't', 'r', 'i', 'p', 'S', 'i', 'z', 'e'} // C documentation // // /* // * Compute the # bytes in a (row-aligned) strip. // * // * Note that if RowsPerStrip is larger than the // * recorded ImageLength, then the strip size is // * truncated to reflect the actual space required // * to hold the strip. // */ func XTIFFStripSize64(tls *libc.TLS, tif uintptr) (r Tuint64_t) { var rps Tuint32_t var td uintptr _, _ = rps, td td = tif + 56 rps = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip if rps > (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength { rps = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength } return XTIFFVStripSize64(tls, tif, rps) } func XTIFFStripSize(tls *libc.TLS, tif uintptr) (r Ttmsize_t) { var m Tuint64_t _ = m m = XTIFFStripSize64(tls, tif) return X_TIFFCastUInt64ToSSize(tls, tif, m, uintptr(unsafe.Pointer(&_module92))) } var _module92 = [14]uint8{'T', 'I', 'F', 'F', 'S', 't', 'r', 'i', 'p', 'S', 'i', 'z', 'e'} // C documentation // // /* // * Compute a default strip size based on the image // * characteristics and a requested value. If the // * request is <1 then we choose a strip size according // * to certain heuristics. // */ func XTIFFDefaultStripSize(tls *libc.TLS, tif uintptr, request Tuint32_t) (r Tuint32_t) { return (*(*func(*libc.TLS, uintptr, Tuint32_t) Tuint32_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_defstripsize})))(tls, tif, request) } func X_TIFFDefaultStripSize(tls *libc.TLS, tif uintptr, s Tuint32_t) (r Tuint32_t) { var rows, scanlinesize Tuint64_t _, _ = rows, scanlinesize if libc.Int32FromUint32(s) < int32(1) { scanlinesize = XTIFFScanlineSize64(tls, tif) if scanlinesize == uint64(0) { scanlinesize = uint64(1) } rows = libc.Uint64FromInt32(STRIP_SIZE_DEFAULT) / scanlinesize if rows == uint64(0) { rows = uint64(1) } else { if rows > uint64(0xFFFFFFFF) { rows = uint64(0xFFFFFFFF) } } s = uint32(rows) } return s } // C documentation // // /* // * Return the number of bytes to read/write in a call to // * one of the scanline-oriented i/o routines. Note that // * this number may be 1/samples-per-pixel if data is // * stored as separate planes. // * The ScanlineSize in case of YCbCrSubsampling is defined as the // * strip size divided by the strip height, i.e. the size of a pack of vertical // * subsampling lines divided by vertical subsampling. It should thus make // * sense when multiplied by a multiple of vertical subsampling. // */ func XTIFFScanlineSize64(tls *libc.TLS, tif uintptr) (r Tuint64_t) { bp := tls.Alloc(32) defer tls.Free(32) var samplingblock_samples Tuint16_t var samplingblocks_hor, scanline_width Tuint32_t var samplingrow_samples, samplingrow_size, scanline_samples, scanline_size Tuint64_t var td uintptr var v1 uint32 var _ /* ycbcrsubsampling at bp+0 */ [2]Tuint16_t _, _, _, _, _, _, _, _, _ = samplingblock_samples, samplingblocks_hor, samplingrow_samples, samplingrow_size, scanline_samples, scanline_size, scanline_width, td, v1 td = tif + 56 if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == int32(PHOTOMETRIC_YCBCR) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) == int32(3) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x04000) != libc.Uint32FromInt32(0)) { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) != int32(3) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module93)), __ccgo_ts+46586, 0) return uint64(0) } XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_YCBCRSUBSAMPLING), libc.VaList(bp+16, bp+uintptr(0)*2, bp+uintptr(1)*2)) if libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) != int32(1) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) != int32(2) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) != int32(4) || libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) != int32(1) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) != int32(2) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) != int32(4) || (libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) == 0 || libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) == 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module93)), __ccgo_ts+46695, 0) return uint64(0) } samplingblock_samples = libc.Uint16FromInt32(libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0])*libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) + int32(2)) if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0])-libc.Int32FromInt32(1)) { v1 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth + (uint32((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) - uint32(1))) / uint32((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) } else { v1 = 0 } samplingblocks_hor = v1 samplingrow_samples = X_TIFFMultiply64(tls, tif, uint64(samplingblocks_hor), uint64(samplingblock_samples), uintptr(unsafe.Pointer(&_module93))) samplingrow_size = (X_TIFFMultiply64(tls, tif, samplingrow_samples, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uintptr(unsafe.Pointer(&_module93))) + (libc.Uint64FromInt32(libc.Int32FromInt32(8)) - libc.Uint64FromInt32(1))) / libc.Uint64FromInt32(libc.Int32FromInt32(8)) scanline_size = samplingrow_size / uint64((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) } else { scanline_width = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth scanline_samples = X_TIFFMultiply64(tls, tif, uint64(scanline_width), uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel), uintptr(unsafe.Pointer(&_module93))) scanline_size = (X_TIFFMultiply64(tls, tif, scanline_samples, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uintptr(unsafe.Pointer(&_module93))) + (libc.Uint64FromInt32(libc.Int32FromInt32(8)) - libc.Uint64FromInt32(1))) / libc.Uint64FromInt32(libc.Int32FromInt32(8)) } } else { scanline_size = (X_TIFFMultiply64(tls, tif, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth), uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uintptr(unsafe.Pointer(&_module93))) + (libc.Uint64FromInt32(libc.Int32FromInt32(8)) - libc.Uint64FromInt32(1))) / libc.Uint64FromInt32(libc.Int32FromInt32(8)) } if scanline_size == uint64(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module93)), __ccgo_ts+46721, 0) return uint64(0) } return scanline_size } var _module93 = [19]uint8{'T', 'I', 'F', 'F', 'S', 'c', 'a', 'n', 'l', 'i', 'n', 'e', 'S', 'i', 'z', 'e', '6', '4'} func XTIFFScanlineSize(tls *libc.TLS, tif uintptr) (r Ttmsize_t) { var m Tuint64_t _ = m m = XTIFFScanlineSize64(tls, tif) return X_TIFFCastUInt64ToSSize(tls, tif, m, uintptr(unsafe.Pointer(&_module94))) } var _module94 = [17]uint8{'T', 'I', 'F', 'F', 'S', 'c', 'a', 'n', 'l', 'i', 'n', 'e', 'S', 'i', 'z', 'e'} // C documentation // // /* // * Return the number of bytes required to store a complete // * decoded and packed raster scanline (as opposed to the // * I/O size returned by TIFFScanlineSize which may be less // * if data is store as separate planes). // */ func XTIFFRasterScanlineSize64(tls *libc.TLS, tif uintptr) (r Tuint64_t) { var scanline Tuint64_t var td uintptr var v1, v2 uint64 _, _, _, _ = scanline, td, v1, v2 td = tif + 56 scanline = X_TIFFMultiply64(tls, tif, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth), uintptr(unsafe.Pointer(&_module95))) if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { scanline = X_TIFFMultiply64(tls, tif, scanline, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel), uintptr(unsafe.Pointer(&_module95))) if scanline&uint64(0x07) != 0 { v1 = scanline>>libc.Int32FromInt32(3) + uint64(1) } else { v1 = scanline >> int32(3) } return v1 } else { if scanline&uint64(0x07) != 0 { v2 = scanline>>libc.Int32FromInt32(3) + uint64(1) } else { v2 = scanline >> int32(3) } return X_TIFFMultiply64(tls, tif, v2, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel), uintptr(unsafe.Pointer(&_module95))) } return r } var _module95 = [25]uint8{'T', 'I', 'F', 'F', 'R', 'a', 's', 't', 'e', 'r', 'S', 'c', 'a', 'n', 'l', 'i', 'n', 'e', 'S', 'i', 'z', 'e', '6', '4'} func XTIFFRasterScanlineSize(tls *libc.TLS, tif uintptr) (r Ttmsize_t) { var m Tuint64_t _ = m m = XTIFFRasterScanlineSize64(tls, tif) return X_TIFFCastUInt64ToSSize(tls, tif, m, uintptr(unsafe.Pointer(&_module96))) } var _module96 = [23]uint8{'T', 'I', 'F', 'F', 'R', 'a', 's', 't', 'e', 'r', 'S', 'c', 'a', 'n', 'l', 'i', 'n', 'e', 'S', 'i', 'z', 'e'} const TIFF_UPSAMPLED6 = 0x04000 func XTIFFSwabShort(tls *libc.TLS, wp uintptr) { var cp uintptr var t uint8 _, _ = cp, t cp = wp t = *(*uint8)(unsafe.Pointer(cp + 1)) *(*uint8)(unsafe.Pointer(cp + 1)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t } func XTIFFSwabLong(tls *libc.TLS, lp uintptr) { var cp uintptr var t uint8 _, _ = cp, t cp = lp t = *(*uint8)(unsafe.Pointer(cp + 3)) *(*uint8)(unsafe.Pointer(cp + 3)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t t = *(*uint8)(unsafe.Pointer(cp + 2)) *(*uint8)(unsafe.Pointer(cp + 2)) = *(*uint8)(unsafe.Pointer(cp + 1)) *(*uint8)(unsafe.Pointer(cp + 1)) = t } func XTIFFSwabLong8(tls *libc.TLS, lp uintptr) { var cp uintptr var t uint8 _, _ = cp, t cp = lp t = *(*uint8)(unsafe.Pointer(cp + 7)) *(*uint8)(unsafe.Pointer(cp + 7)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t t = *(*uint8)(unsafe.Pointer(cp + 6)) *(*uint8)(unsafe.Pointer(cp + 6)) = *(*uint8)(unsafe.Pointer(cp + 1)) *(*uint8)(unsafe.Pointer(cp + 1)) = t t = *(*uint8)(unsafe.Pointer(cp + 5)) *(*uint8)(unsafe.Pointer(cp + 5)) = *(*uint8)(unsafe.Pointer(cp + 2)) *(*uint8)(unsafe.Pointer(cp + 2)) = t t = *(*uint8)(unsafe.Pointer(cp + 4)) *(*uint8)(unsafe.Pointer(cp + 4)) = *(*uint8)(unsafe.Pointer(cp + 3)) *(*uint8)(unsafe.Pointer(cp + 3)) = t } func XTIFFSwabArrayOfShort(tls *libc.TLS, wp uintptr, n Ttmsize_t) { var cp uintptr var t uint8 var v1 Ttmsize_t _, _, _ = cp, t, v1 /* XXX unroll loop some */ for { v1 = n n-- if !(v1 > 0) { break } cp = wp t = *(*uint8)(unsafe.Pointer(cp + 1)) *(*uint8)(unsafe.Pointer(cp + 1)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t wp += 2 } } func XTIFFSwabArrayOfTriples(tls *libc.TLS, tp uintptr, n Ttmsize_t) { var cp uintptr var t uint8 var v1 Ttmsize_t _, _, _ = cp, t, v1 /* XXX unroll loop some */ for { v1 = n n-- if !(v1 > 0) { break } cp = tp t = *(*uint8)(unsafe.Pointer(cp + 2)) *(*uint8)(unsafe.Pointer(cp + 2)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t tp += uintptr(3) } } func XTIFFSwabArrayOfLong(tls *libc.TLS, lp uintptr, n Ttmsize_t) { var cp uintptr var t uint8 var v1 Ttmsize_t _, _, _ = cp, t, v1 /* XXX unroll loop some */ for { v1 = n n-- if !(v1 > 0) { break } cp = lp t = *(*uint8)(unsafe.Pointer(cp + 3)) *(*uint8)(unsafe.Pointer(cp + 3)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t t = *(*uint8)(unsafe.Pointer(cp + 2)) *(*uint8)(unsafe.Pointer(cp + 2)) = *(*uint8)(unsafe.Pointer(cp + 1)) *(*uint8)(unsafe.Pointer(cp + 1)) = t lp += 4 } } func XTIFFSwabArrayOfLong8(tls *libc.TLS, lp uintptr, n Ttmsize_t) { var cp uintptr var t uint8 var v1 Ttmsize_t _, _, _ = cp, t, v1 /* XXX unroll loop some */ for { v1 = n n-- if !(v1 > 0) { break } cp = lp t = *(*uint8)(unsafe.Pointer(cp + 7)) *(*uint8)(unsafe.Pointer(cp + 7)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t t = *(*uint8)(unsafe.Pointer(cp + 6)) *(*uint8)(unsafe.Pointer(cp + 6)) = *(*uint8)(unsafe.Pointer(cp + 1)) *(*uint8)(unsafe.Pointer(cp + 1)) = t t = *(*uint8)(unsafe.Pointer(cp + 5)) *(*uint8)(unsafe.Pointer(cp + 5)) = *(*uint8)(unsafe.Pointer(cp + 2)) *(*uint8)(unsafe.Pointer(cp + 2)) = t t = *(*uint8)(unsafe.Pointer(cp + 4)) *(*uint8)(unsafe.Pointer(cp + 4)) = *(*uint8)(unsafe.Pointer(cp + 3)) *(*uint8)(unsafe.Pointer(cp + 3)) = t lp += 8 } } func XTIFFSwabFloat(tls *libc.TLS, fp uintptr) { var cp uintptr var t uint8 _, _ = cp, t cp = fp t = *(*uint8)(unsafe.Pointer(cp + 3)) *(*uint8)(unsafe.Pointer(cp + 3)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t t = *(*uint8)(unsafe.Pointer(cp + 2)) *(*uint8)(unsafe.Pointer(cp + 2)) = *(*uint8)(unsafe.Pointer(cp + 1)) *(*uint8)(unsafe.Pointer(cp + 1)) = t } func XTIFFSwabArrayOfFloat(tls *libc.TLS, fp uintptr, n Ttmsize_t) { var cp uintptr var t uint8 var v1 Ttmsize_t _, _, _ = cp, t, v1 /* XXX unroll loop some */ for { v1 = n n-- if !(v1 > 0) { break } cp = fp t = *(*uint8)(unsafe.Pointer(cp + 3)) *(*uint8)(unsafe.Pointer(cp + 3)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t t = *(*uint8)(unsafe.Pointer(cp + 2)) *(*uint8)(unsafe.Pointer(cp + 2)) = *(*uint8)(unsafe.Pointer(cp + 1)) *(*uint8)(unsafe.Pointer(cp + 1)) = t fp += 4 } } func XTIFFSwabDouble(tls *libc.TLS, dp uintptr) { var cp uintptr var t uint8 _, _ = cp, t cp = dp t = *(*uint8)(unsafe.Pointer(cp + 7)) *(*uint8)(unsafe.Pointer(cp + 7)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t t = *(*uint8)(unsafe.Pointer(cp + 6)) *(*uint8)(unsafe.Pointer(cp + 6)) = *(*uint8)(unsafe.Pointer(cp + 1)) *(*uint8)(unsafe.Pointer(cp + 1)) = t t = *(*uint8)(unsafe.Pointer(cp + 5)) *(*uint8)(unsafe.Pointer(cp + 5)) = *(*uint8)(unsafe.Pointer(cp + 2)) *(*uint8)(unsafe.Pointer(cp + 2)) = t t = *(*uint8)(unsafe.Pointer(cp + 4)) *(*uint8)(unsafe.Pointer(cp + 4)) = *(*uint8)(unsafe.Pointer(cp + 3)) *(*uint8)(unsafe.Pointer(cp + 3)) = t } func XTIFFSwabArrayOfDouble(tls *libc.TLS, dp uintptr, n Ttmsize_t) { var cp uintptr var t uint8 var v1 Ttmsize_t _, _, _ = cp, t, v1 /* XXX unroll loop some */ for { v1 = n n-- if !(v1 > 0) { break } cp = dp t = *(*uint8)(unsafe.Pointer(cp + 7)) *(*uint8)(unsafe.Pointer(cp + 7)) = *(*uint8)(unsafe.Pointer(cp)) *(*uint8)(unsafe.Pointer(cp)) = t t = *(*uint8)(unsafe.Pointer(cp + 6)) *(*uint8)(unsafe.Pointer(cp + 6)) = *(*uint8)(unsafe.Pointer(cp + 1)) *(*uint8)(unsafe.Pointer(cp + 1)) = t t = *(*uint8)(unsafe.Pointer(cp + 5)) *(*uint8)(unsafe.Pointer(cp + 5)) = *(*uint8)(unsafe.Pointer(cp + 2)) *(*uint8)(unsafe.Pointer(cp + 2)) = t t = *(*uint8)(unsafe.Pointer(cp + 4)) *(*uint8)(unsafe.Pointer(cp + 4)) = *(*uint8)(unsafe.Pointer(cp + 3)) *(*uint8)(unsafe.Pointer(cp + 3)) = t dp += 8 } } // C documentation // // /* // * Bit reversal tables. TIFFBitRevTable[] gives // * the bit reversed value of . Used in various // * places in the library when the FillOrder requires // * bit reversal of byte values (e.g. CCITT Fax 3 // * encoding/decoding). TIFFNoBitRevTable is provided // * for algorithms that want an equivalent table that // * do not reverse bit values. // */ var _TIFFBitRevTable = [256]uint8{ 1: uint8(0x80), 2: uint8(0x40), 3: uint8(0xc0), 4: uint8(0x20), 5: uint8(0xa0), 6: uint8(0x60), 7: uint8(0xe0), 8: uint8(0x10), 9: uint8(0x90), 10: uint8(0x50), 11: uint8(0xd0), 12: uint8(0x30), 13: uint8(0xb0), 14: uint8(0x70), 15: uint8(0xf0), 16: uint8(0x08), 17: uint8(0x88), 18: uint8(0x48), 19: uint8(0xc8), 20: uint8(0x28), 21: uint8(0xa8), 22: uint8(0x68), 23: uint8(0xe8), 24: uint8(0x18), 25: uint8(0x98), 26: uint8(0x58), 27: uint8(0xd8), 28: uint8(0x38), 29: uint8(0xb8), 30: uint8(0x78), 31: uint8(0xf8), 32: uint8(0x04), 33: uint8(0x84), 34: uint8(0x44), 35: uint8(0xc4), 36: uint8(0x24), 37: uint8(0xa4), 38: uint8(0x64), 39: uint8(0xe4), 40: uint8(0x14), 41: uint8(0x94), 42: uint8(0x54), 43: uint8(0xd4), 44: uint8(0x34), 45: uint8(0xb4), 46: uint8(0x74), 47: uint8(0xf4), 48: uint8(0x0c), 49: uint8(0x8c), 50: uint8(0x4c), 51: uint8(0xcc), 52: uint8(0x2c), 53: uint8(0xac), 54: uint8(0x6c), 55: uint8(0xec), 56: uint8(0x1c), 57: uint8(0x9c), 58: uint8(0x5c), 59: uint8(0xdc), 60: uint8(0x3c), 61: uint8(0xbc), 62: uint8(0x7c), 63: uint8(0xfc), 64: uint8(0x02), 65: uint8(0x82), 66: uint8(0x42), 67: uint8(0xc2), 68: uint8(0x22), 69: uint8(0xa2), 70: uint8(0x62), 71: uint8(0xe2), 72: uint8(0x12), 73: uint8(0x92), 74: uint8(0x52), 75: uint8(0xd2), 76: uint8(0x32), 77: uint8(0xb2), 78: uint8(0x72), 79: uint8(0xf2), 80: uint8(0x0a), 81: uint8(0x8a), 82: uint8(0x4a), 83: uint8(0xca), 84: uint8(0x2a), 85: uint8(0xaa), 86: uint8(0x6a), 87: uint8(0xea), 88: uint8(0x1a), 89: uint8(0x9a), 90: uint8(0x5a), 91: uint8(0xda), 92: uint8(0x3a), 93: uint8(0xba), 94: uint8(0x7a), 95: uint8(0xfa), 96: uint8(0x06), 97: uint8(0x86), 98: uint8(0x46), 99: uint8(0xc6), 100: uint8(0x26), 101: uint8(0xa6), 102: uint8(0x66), 103: uint8(0xe6), 104: uint8(0x16), 105: uint8(0x96), 106: uint8(0x56), 107: uint8(0xd6), 108: uint8(0x36), 109: uint8(0xb6), 110: uint8(0x76), 111: uint8(0xf6), 112: uint8(0x0e), 113: uint8(0x8e), 114: uint8(0x4e), 115: uint8(0xce), 116: uint8(0x2e), 117: uint8(0xae), 118: uint8(0x6e), 119: uint8(0xee), 120: uint8(0x1e), 121: uint8(0x9e), 122: uint8(0x5e), 123: uint8(0xde), 124: uint8(0x3e), 125: uint8(0xbe), 126: uint8(0x7e), 127: uint8(0xfe), 128: uint8(0x01), 129: uint8(0x81), 130: uint8(0x41), 131: uint8(0xc1), 132: uint8(0x21), 133: uint8(0xa1), 134: uint8(0x61), 135: uint8(0xe1), 136: uint8(0x11), 137: uint8(0x91), 138: uint8(0x51), 139: uint8(0xd1), 140: uint8(0x31), 141: uint8(0xb1), 142: uint8(0x71), 143: uint8(0xf1), 144: uint8(0x09), 145: uint8(0x89), 146: uint8(0x49), 147: uint8(0xc9), 148: uint8(0x29), 149: uint8(0xa9), 150: uint8(0x69), 151: uint8(0xe9), 152: uint8(0x19), 153: uint8(0x99), 154: uint8(0x59), 155: uint8(0xd9), 156: uint8(0x39), 157: uint8(0xb9), 158: uint8(0x79), 159: uint8(0xf9), 160: uint8(0x05), 161: uint8(0x85), 162: uint8(0x45), 163: uint8(0xc5), 164: uint8(0x25), 165: uint8(0xa5), 166: uint8(0x65), 167: uint8(0xe5), 168: uint8(0x15), 169: uint8(0x95), 170: uint8(0x55), 171: uint8(0xd5), 172: uint8(0x35), 173: uint8(0xb5), 174: uint8(0x75), 175: uint8(0xf5), 176: uint8(0x0d), 177: uint8(0x8d), 178: uint8(0x4d), 179: uint8(0xcd), 180: uint8(0x2d), 181: uint8(0xad), 182: uint8(0x6d), 183: uint8(0xed), 184: uint8(0x1d), 185: uint8(0x9d), 186: uint8(0x5d), 187: uint8(0xdd), 188: uint8(0x3d), 189: uint8(0xbd), 190: uint8(0x7d), 191: uint8(0xfd), 192: uint8(0x03), 193: uint8(0x83), 194: uint8(0x43), 195: uint8(0xc3), 196: uint8(0x23), 197: uint8(0xa3), 198: uint8(0x63), 199: uint8(0xe3), 200: uint8(0x13), 201: uint8(0x93), 202: uint8(0x53), 203: uint8(0xd3), 204: uint8(0x33), 205: uint8(0xb3), 206: uint8(0x73), 207: uint8(0xf3), 208: uint8(0x0b), 209: uint8(0x8b), 210: uint8(0x4b), 211: uint8(0xcb), 212: uint8(0x2b), 213: uint8(0xab), 214: uint8(0x6b), 215: uint8(0xeb), 216: uint8(0x1b), 217: uint8(0x9b), 218: uint8(0x5b), 219: uint8(0xdb), 220: uint8(0x3b), 221: uint8(0xbb), 222: uint8(0x7b), 223: uint8(0xfb), 224: uint8(0x07), 225: uint8(0x87), 226: uint8(0x47), 227: uint8(0xc7), 228: uint8(0x27), 229: uint8(0xa7), 230: uint8(0x67), 231: uint8(0xe7), 232: uint8(0x17), 233: uint8(0x97), 234: uint8(0x57), 235: uint8(0xd7), 236: uint8(0x37), 237: uint8(0xb7), 238: uint8(0x77), 239: uint8(0xf7), 240: uint8(0x0f), 241: uint8(0x8f), 242: uint8(0x4f), 243: uint8(0xcf), 244: uint8(0x2f), 245: uint8(0xaf), 246: uint8(0x6f), 247: uint8(0xef), 248: uint8(0x1f), 249: uint8(0x9f), 250: uint8(0x5f), 251: uint8(0xdf), 252: uint8(0x3f), 253: uint8(0xbf), 254: uint8(0x7f), 255: uint8(0xff), } var _TIFFNoBitRevTable = [256]uint8{ 1: uint8(0x01), 2: uint8(0x02), 3: uint8(0x03), 4: uint8(0x04), 5: uint8(0x05), 6: uint8(0x06), 7: uint8(0x07), 8: uint8(0x08), 9: uint8(0x09), 10: uint8(0x0a), 11: uint8(0x0b), 12: uint8(0x0c), 13: uint8(0x0d), 14: uint8(0x0e), 15: uint8(0x0f), 16: uint8(0x10), 17: uint8(0x11), 18: uint8(0x12), 19: uint8(0x13), 20: uint8(0x14), 21: uint8(0x15), 22: uint8(0x16), 23: uint8(0x17), 24: uint8(0x18), 25: uint8(0x19), 26: uint8(0x1a), 27: uint8(0x1b), 28: uint8(0x1c), 29: uint8(0x1d), 30: uint8(0x1e), 31: uint8(0x1f), 32: uint8(0x20), 33: uint8(0x21), 34: uint8(0x22), 35: uint8(0x23), 36: uint8(0x24), 37: uint8(0x25), 38: uint8(0x26), 39: uint8(0x27), 40: uint8(0x28), 41: uint8(0x29), 42: uint8(0x2a), 43: uint8(0x2b), 44: uint8(0x2c), 45: uint8(0x2d), 46: uint8(0x2e), 47: uint8(0x2f), 48: uint8(0x30), 49: uint8(0x31), 50: uint8(0x32), 51: uint8(0x33), 52: uint8(0x34), 53: uint8(0x35), 54: uint8(0x36), 55: uint8(0x37), 56: uint8(0x38), 57: uint8(0x39), 58: uint8(0x3a), 59: uint8(0x3b), 60: uint8(0x3c), 61: uint8(0x3d), 62: uint8(0x3e), 63: uint8(0x3f), 64: uint8(0x40), 65: uint8(0x41), 66: uint8(0x42), 67: uint8(0x43), 68: uint8(0x44), 69: uint8(0x45), 70: uint8(0x46), 71: uint8(0x47), 72: uint8(0x48), 73: uint8(0x49), 74: uint8(0x4a), 75: uint8(0x4b), 76: uint8(0x4c), 77: uint8(0x4d), 78: uint8(0x4e), 79: uint8(0x4f), 80: uint8(0x50), 81: uint8(0x51), 82: uint8(0x52), 83: uint8(0x53), 84: uint8(0x54), 85: uint8(0x55), 86: uint8(0x56), 87: uint8(0x57), 88: uint8(0x58), 89: uint8(0x59), 90: uint8(0x5a), 91: uint8(0x5b), 92: uint8(0x5c), 93: uint8(0x5d), 94: uint8(0x5e), 95: uint8(0x5f), 96: uint8(0x60), 97: uint8(0x61), 98: uint8(0x62), 99: uint8(0x63), 100: uint8(0x64), 101: uint8(0x65), 102: uint8(0x66), 103: uint8(0x67), 104: uint8(0x68), 105: uint8(0x69), 106: uint8(0x6a), 107: uint8(0x6b), 108: uint8(0x6c), 109: uint8(0x6d), 110: uint8(0x6e), 111: uint8(0x6f), 112: uint8(0x70), 113: uint8(0x71), 114: uint8(0x72), 115: uint8(0x73), 116: uint8(0x74), 117: uint8(0x75), 118: uint8(0x76), 119: uint8(0x77), 120: uint8(0x78), 121: uint8(0x79), 122: uint8(0x7a), 123: uint8(0x7b), 124: uint8(0x7c), 125: uint8(0x7d), 126: uint8(0x7e), 127: uint8(0x7f), 128: uint8(0x80), 129: uint8(0x81), 130: uint8(0x82), 131: uint8(0x83), 132: uint8(0x84), 133: uint8(0x85), 134: uint8(0x86), 135: uint8(0x87), 136: uint8(0x88), 137: uint8(0x89), 138: uint8(0x8a), 139: uint8(0x8b), 140: uint8(0x8c), 141: uint8(0x8d), 142: uint8(0x8e), 143: uint8(0x8f), 144: uint8(0x90), 145: uint8(0x91), 146: uint8(0x92), 147: uint8(0x93), 148: uint8(0x94), 149: uint8(0x95), 150: uint8(0x96), 151: uint8(0x97), 152: uint8(0x98), 153: uint8(0x99), 154: uint8(0x9a), 155: uint8(0x9b), 156: uint8(0x9c), 157: uint8(0x9d), 158: uint8(0x9e), 159: uint8(0x9f), 160: uint8(0xa0), 161: uint8(0xa1), 162: uint8(0xa2), 163: uint8(0xa3), 164: uint8(0xa4), 165: uint8(0xa5), 166: uint8(0xa6), 167: uint8(0xa7), 168: uint8(0xa8), 169: uint8(0xa9), 170: uint8(0xaa), 171: uint8(0xab), 172: uint8(0xac), 173: uint8(0xad), 174: uint8(0xae), 175: uint8(0xaf), 176: uint8(0xb0), 177: uint8(0xb1), 178: uint8(0xb2), 179: uint8(0xb3), 180: uint8(0xb4), 181: uint8(0xb5), 182: uint8(0xb6), 183: uint8(0xb7), 184: uint8(0xb8), 185: uint8(0xb9), 186: uint8(0xba), 187: uint8(0xbb), 188: uint8(0xbc), 189: uint8(0xbd), 190: uint8(0xbe), 191: uint8(0xbf), 192: uint8(0xc0), 193: uint8(0xc1), 194: uint8(0xc2), 195: uint8(0xc3), 196: uint8(0xc4), 197: uint8(0xc5), 198: uint8(0xc6), 199: uint8(0xc7), 200: uint8(0xc8), 201: uint8(0xc9), 202: uint8(0xca), 203: uint8(0xcb), 204: uint8(0xcc), 205: uint8(0xcd), 206: uint8(0xce), 207: uint8(0xcf), 208: uint8(0xd0), 209: uint8(0xd1), 210: uint8(0xd2), 211: uint8(0xd3), 212: uint8(0xd4), 213: uint8(0xd5), 214: uint8(0xd6), 215: uint8(0xd7), 216: uint8(0xd8), 217: uint8(0xd9), 218: uint8(0xda), 219: uint8(0xdb), 220: uint8(0xdc), 221: uint8(0xdd), 222: uint8(0xde), 223: uint8(0xdf), 224: uint8(0xe0), 225: uint8(0xe1), 226: uint8(0xe2), 227: uint8(0xe3), 228: uint8(0xe4), 229: uint8(0xe5), 230: uint8(0xe6), 231: uint8(0xe7), 232: uint8(0xe8), 233: uint8(0xe9), 234: uint8(0xea), 235: uint8(0xeb), 236: uint8(0xec), 237: uint8(0xed), 238: uint8(0xee), 239: uint8(0xef), 240: uint8(0xf0), 241: uint8(0xf1), 242: uint8(0xf2), 243: uint8(0xf3), 244: uint8(0xf4), 245: uint8(0xf5), 246: uint8(0xf6), 247: uint8(0xf7), 248: uint8(0xf8), 249: uint8(0xf9), 250: uint8(0xfa), 251: uint8(0xfb), 252: uint8(0xfc), 253: uint8(0xfd), 254: uint8(0xfe), 255: uint8(0xff), } func XTIFFGetBitRevTable(tls *libc.TLS, reversed int32) (r uintptr) { var v1 uintptr _ = v1 if reversed != 0 { v1 = uintptr(unsafe.Pointer(&_TIFFBitRevTable)) } else { v1 = uintptr(unsafe.Pointer(&_TIFFNoBitRevTable)) } return v1 } func XTIFFReverseBits(tls *libc.TLS, cp uintptr, n Ttmsize_t) { var v2 Ttmsize_t _ = v2 for { if !(n > int32(8)) { break } *(*Tuint8_t)(unsafe.Pointer(cp)) = _TIFFBitRevTable[*(*Tuint8_t)(unsafe.Pointer(cp))] *(*Tuint8_t)(unsafe.Pointer(cp + 1)) = _TIFFBitRevTable[*(*Tuint8_t)(unsafe.Pointer(cp + 1))] *(*Tuint8_t)(unsafe.Pointer(cp + 2)) = _TIFFBitRevTable[*(*Tuint8_t)(unsafe.Pointer(cp + 2))] *(*Tuint8_t)(unsafe.Pointer(cp + 3)) = _TIFFBitRevTable[*(*Tuint8_t)(unsafe.Pointer(cp + 3))] *(*Tuint8_t)(unsafe.Pointer(cp + 4)) = _TIFFBitRevTable[*(*Tuint8_t)(unsafe.Pointer(cp + 4))] *(*Tuint8_t)(unsafe.Pointer(cp + 5)) = _TIFFBitRevTable[*(*Tuint8_t)(unsafe.Pointer(cp + 5))] *(*Tuint8_t)(unsafe.Pointer(cp + 6)) = _TIFFBitRevTable[*(*Tuint8_t)(unsafe.Pointer(cp + 6))] *(*Tuint8_t)(unsafe.Pointer(cp + 7)) = _TIFFBitRevTable[*(*Tuint8_t)(unsafe.Pointer(cp + 7))] cp += uintptr(8) goto _1 _1: ; n -= int32(8) } for { v2 = n n-- if !(v2 > 0) { break } *(*Tuint8_t)(unsafe.Pointer(cp)) = _TIFFBitRevTable[*(*Tuint8_t)(unsafe.Pointer(cp))] cp++ } } const DELTA2_SKIP = 2 const DELTA3_SKIP = 4 const THUNDER_2BITDELTAS = 64 const THUNDER_3BITDELTAS = 128 const THUNDER_CODE = 192 const THUNDER_DATA = 0x3f const THUNDER_RAW = 192 const THUNDER_RUN = 0 /* * TIFF Library. * * ThunderScan 4-bit Compression Algorithm Support */ /* * ThunderScan uses an encoding scheme designed for * 4-bit pixel values. Data is encoded in bytes, with * each byte split into a 2-bit code word and a 6-bit * data value. The encoding gives raw data, runs of * pixels, or pixel values encoded as a delta from the * previous pixel value. For the latter, either 2-bit * or 3-bit delta values are used, with the deltas packed * into a single byte. */ /* code values */ var _twobitdeltas = [4]int32{ 1: int32(1), 3: -int32(1), } var _threebitdeltas = [8]int32{ 1: int32(1), 2: int32(2), 3: int32(3), 5: -int32(3), 6: -int32(2), 7: -int32(1), } func _ThunderSetupDecode(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample) != int32(4) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module97)), __ccgo_ts+46752, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_bitspersample))) return 0 } return int32(1) } var _module97 = [19]uint8{'T', 'h', 'u', 'n', 'd', 'e', 'r', 'S', 'e', 't', 'u', 'p', 'D', 'e', 'c', 'o', 'd', 'e'} func _ThunderDecode(tls *libc.TLS, tif uintptr, op0 uintptr, maxpixels Ttmsize_t) (r int32) { bp1 := tls.Alloc(48) defer tls.Free(48) var bp, op, op_end, v1, v11, v15, v19, v23, v27, v3, v30, v31, v5, v7, p10, p14, p18, p2, p22, p26, p29, p6 uintptr var cc, npixels, v13, v17, v21, v25, v28, v9 Ttmsize_t var delta, n, v12, v16, v20, v24, v8 int32 var lastpixel uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bp, cc, delta, lastpixel, n, npixels, op, op_end, v1, v11, v12, v13, v15, v16, v17, v19, v20, v21, v23, v24, v25, v27, v28, v3, v30, v31, v5, v7, v8, v9, p10, p14, p18, p2, p22, p26, p29, p6 op = op0 bp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp cc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc lastpixel = uint32(0) npixels = 0 for cc > 0 && npixels < maxpixels { v1 = bp bp++ n = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v1))) cc-- switch n & libc.Int32FromInt32(THUNDER_CODE) { case THUNDER_RUN: /* pixel run */ /* * Replicate the last pixel n times, * where n is the lower-order 6 bits. */ if n == 0 { break } if npixels&int32(1) != 0 { p2 = op *(*Tuint8_t)(unsafe.Pointer(p2)) = Tuint8_t(uint32(*(*Tuint8_t)(unsafe.Pointer(p2))) | lastpixel) v3 = op op++ lastpixel = uint32(*(*Tuint8_t)(unsafe.Pointer(v3))) npixels++ n-- } else { lastpixel |= lastpixel << int32(4) } npixels += n if npixels > maxpixels { break } for { if !(n > 0) { break } v5 = op op++ *(*Tuint8_t)(unsafe.Pointer(v5)) = uint8(lastpixel) goto _4 _4: ; n -= int32(2) } if n == -int32(1) { op-- v7 = op p6 = v7 *(*Tuint8_t)(unsafe.Pointer(p6)) = Tuint8_t(int32(*(*Tuint8_t)(unsafe.Pointer(p6))) & libc.Int32FromInt32(0xf0)) } lastpixel &= uint32(0xf) case int32(THUNDER_2BITDELTAS): /* 2-bit deltas */ v8 = n >> libc.Int32FromInt32(4) & libc.Int32FromInt32(3) delta = v8 if v8 != int32(DELTA2_SKIP) { lastpixel = libc.Uint32FromInt32(libc.Int32FromUint32(lastpixel)+_twobitdeltas[delta]) & uint32(0xf) if npixels < maxpixels { v9 = npixels npixels++ if v9&int32(1) != 0 { v11 = op op++ p10 = v11 *(*Tuint8_t)(unsafe.Pointer(p10)) = Tuint8_t(uint32(*(*Tuint8_t)(unsafe.Pointer(p10))) | lastpixel) } else { *(*Tuint8_t)(unsafe.Pointer(op)) = uint8(lastpixel << libc.Int32FromInt32(4)) } } } v12 = n >> libc.Int32FromInt32(2) & libc.Int32FromInt32(3) delta = v12 if v12 != int32(DELTA2_SKIP) { lastpixel = libc.Uint32FromInt32(libc.Int32FromUint32(lastpixel)+_twobitdeltas[delta]) & uint32(0xf) if npixels < maxpixels { v13 = npixels npixels++ if v13&int32(1) != 0 { v15 = op op++ p14 = v15 *(*Tuint8_t)(unsafe.Pointer(p14)) = Tuint8_t(uint32(*(*Tuint8_t)(unsafe.Pointer(p14))) | lastpixel) } else { *(*Tuint8_t)(unsafe.Pointer(op)) = uint8(lastpixel << libc.Int32FromInt32(4)) } } } v16 = n & libc.Int32FromInt32(3) delta = v16 if v16 != int32(DELTA2_SKIP) { lastpixel = libc.Uint32FromInt32(libc.Int32FromUint32(lastpixel)+_twobitdeltas[delta]) & uint32(0xf) if npixels < maxpixels { v17 = npixels npixels++ if v17&int32(1) != 0 { v19 = op op++ p18 = v19 *(*Tuint8_t)(unsafe.Pointer(p18)) = Tuint8_t(uint32(*(*Tuint8_t)(unsafe.Pointer(p18))) | lastpixel) } else { *(*Tuint8_t)(unsafe.Pointer(op)) = uint8(lastpixel << libc.Int32FromInt32(4)) } } } case int32(THUNDER_3BITDELTAS): /* 3-bit deltas */ v20 = n >> libc.Int32FromInt32(3) & libc.Int32FromInt32(7) delta = v20 if v20 != int32(DELTA3_SKIP) { lastpixel = libc.Uint32FromInt32(libc.Int32FromUint32(lastpixel)+_threebitdeltas[delta]) & uint32(0xf) if npixels < maxpixels { v21 = npixels npixels++ if v21&int32(1) != 0 { v23 = op op++ p22 = v23 *(*Tuint8_t)(unsafe.Pointer(p22)) = Tuint8_t(uint32(*(*Tuint8_t)(unsafe.Pointer(p22))) | lastpixel) } else { *(*Tuint8_t)(unsafe.Pointer(op)) = uint8(lastpixel << libc.Int32FromInt32(4)) } } } v24 = n & libc.Int32FromInt32(7) delta = v24 if v24 != int32(DELTA3_SKIP) { lastpixel = libc.Uint32FromInt32(libc.Int32FromUint32(lastpixel)+_threebitdeltas[delta]) & uint32(0xf) if npixels < maxpixels { v25 = npixels npixels++ if v25&int32(1) != 0 { v27 = op op++ p26 = v27 *(*Tuint8_t)(unsafe.Pointer(p26)) = Tuint8_t(uint32(*(*Tuint8_t)(unsafe.Pointer(p26))) | lastpixel) } else { *(*Tuint8_t)(unsafe.Pointer(op)) = uint8(lastpixel << libc.Int32FromInt32(4)) } } } case int32(THUNDER_RAW): /* raw data */ lastpixel = libc.Uint32FromInt32(n & int32(0xf)) if npixels < maxpixels { v28 = npixels npixels++ if v28&int32(1) != 0 { v30 = op op++ p29 = v30 *(*Tuint8_t)(unsafe.Pointer(p29)) = Tuint8_t(uint32(*(*Tuint8_t)(unsafe.Pointer(p29))) | lastpixel) } else { *(*Tuint8_t)(unsafe.Pointer(op)) = uint8(lastpixel << libc.Int32FromInt32(4)) } } break } } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = bp (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = cc if npixels != maxpixels { op_end = op0 + uintptr((maxpixels+int32(1))/int32(2)) libc.Xmemset(tls, op, 0, libc.Uint32FromInt32(int32(op_end)-int32(op))) if npixels < maxpixels { v31 = __ccgo_ts + 46832 } else { v31 = __ccgo_ts + 46843 } XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module98)), __ccgo_ts+46852, libc.VaList(bp1+8, v31, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, libc.Uint64FromInt32(npixels), libc.Uint64FromInt32(maxpixels))) return 0 } return int32(1) } var _module98 = [14]uint8{'T', 'h', 'u', 'n', 'd', 'e', 'r', 'D', 'e', 'c', 'o', 'd', 'e'} func _ThunderDecodeRow(tls *libc.TLS, tif uintptr, buf uintptr, occ Ttmsize_t, s Tuint16_t) (r int32) { var row uintptr _ = row row = buf _ = s if occ%(*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize != 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module99)), __ccgo_ts+37000, 0) return 0 } for occ > 0 { if !(_ThunderDecode(tls, tif, row, libc.Int32FromUint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagewidth)) != 0) { return 0 } occ -= (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize row += uintptr((*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize) } return int32(1) } var _module99 = [17]uint8{'T', 'h', 'u', 'n', 'd', 'e', 'r', 'D', 'e', 'c', 'o', 'd', 'e', 'R', 'o', 'w'} func XTIFFInitThunderScan(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { _ = scheme (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode = __ccgo_fp(_ThunderSetupDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_ThunderDecodeRow) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_ThunderDecodeRow) return int32(1) } const TIFF_UPSAMPLED7 = 16384 // C documentation // // /* // * Compute which tile an (x,y,z,s) value is in. // */ func XTIFFComputeTile(tls *libc.TLS, tif uintptr, x Tuint32_t, y Tuint32_t, z Tuint32_t, s Tuint16_t) (r Tuint32_t) { var dx, dy, dz, tile, xpt, ypt, zpt Tuint32_t var td uintptr var v1, v2, v3 uint32 _, _, _, _, _, _, _, _, _, _, _ = dx, dy, dz, td, tile, xpt, ypt, zpt, v1, v2, v3 td = tif + 56 dx = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth dy = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength dz = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tiledepth tile = uint32(1) if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth == uint32(1) { z = uint32(0) } if dx == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { dx = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth } if dy == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { dy = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength } if dz == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { dz = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth } if dx != uint32(0) && dy != uint32(0) && dz != uint32(0) { if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth < uint32(0xffffffff)-(dx-libc.Uint32FromInt32(1)) { v1 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth + (dx - uint32(1))) / dx } else { v1 = 0 } xpt = v1 if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength < uint32(0xffffffff)-(dy-libc.Uint32FromInt32(1)) { v2 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength + (dy - uint32(1))) / dy } else { v2 = 0 } ypt = v2 if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth < uint32(0xffffffff)-(dz-libc.Uint32FromInt32(1)) { v3 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth + (dz - uint32(1))) / dz } else { v3 = 0 } zpt = v3 if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { tile = xpt*ypt*zpt*uint32(s) + xpt*ypt*(z/dz) + xpt*(y/dy) + x/dx } else { tile = xpt*ypt*(z/dz) + xpt*(y/dy) + x/dx } } return tile } // C documentation // // /* // * Check an (x,y,z,s) coordinate // * against the image bounds. // */ func XTIFFCheckTile(tls *libc.TLS, tif uintptr, x Tuint32_t, y Tuint32_t, z Tuint32_t, s Tuint16_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var td uintptr _ = td td = tif + 56 if x >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+46891, libc.VaList(bp+8, x, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth-libc.Uint32FromInt32(1))) return 0 } if y >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+46922, libc.VaList(bp+8, y, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength-libc.Uint32FromInt32(1))) return 0 } if z >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+46953, libc.VaList(bp+8, z, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth-libc.Uint32FromInt32(1))) return 0 } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) && libc.Int32FromUint16(s) >= libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) { XTIFFErrorExtR(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+46512, libc.VaList(bp+8, uint32(s), libc.Uint32FromInt32(libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel)-libc.Int32FromInt32(1)))) return 0 } return int32(1) } // C documentation // // /* // * Compute how many tiles are in an image. // */ func XTIFFNumberOfTiles(tls *libc.TLS, tif uintptr) (r Tuint32_t) { var dx, dy, dz, ntiles Tuint32_t var td uintptr var v1, v2, v3, v4 uint32 _, _, _, _, _, _, _, _, _ = dx, dy, dz, ntiles, td, v1, v2, v3, v4 td = tif + 56 dx = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth dy = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength dz = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tiledepth if dx == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { dx = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth } if dy == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { dy = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength } if dz == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { dz = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth } if dx == uint32(0) || dy == uint32(0) || dz == uint32(0) { v1 = uint32(0) } else { if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth < uint32(0xffffffff)-(dx-libc.Uint32FromInt32(1)) { v2 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth + (dx - uint32(1))) / dx } else { v2 = 0 } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength < uint32(0xffffffff)-(dy-libc.Uint32FromInt32(1)) { v3 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength + (dy - uint32(1))) / dy } else { v3 = 0 } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth < uint32(0xffffffff)-(dz-libc.Uint32FromInt32(1)) { v4 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagedepth + (dz - uint32(1))) / dz } else { v4 = 0 } v1 = X_TIFFMultiply32(tls, tif, X_TIFFMultiply32(tls, tif, v2, v3, __ccgo_ts+46986), v4, __ccgo_ts+46986) } ntiles = v1 if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { ntiles = X_TIFFMultiply32(tls, tif, ntiles, uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel), __ccgo_ts+46986) } return ntiles } // C documentation // // /* // * Compute the # bytes in each row of a tile. // */ func XTIFFTileRowSize64(tls *libc.TLS, tif uintptr) (r Tuint64_t) { var rowsize, tilerowsize Tuint64_t var td uintptr var v1 uint64 _, _, _, _ = rowsize, td, tilerowsize, v1 td = tif + 56 if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module100)), __ccgo_ts+47004, 0) return uint64(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module100)), __ccgo_ts+47024, 0) return libc.Uint64FromInt32(libc.Int32FromInt32(0)) } rowsize = X_TIFFMultiply64(tls, tif, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth), __ccgo_ts+47043) if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) == 0 { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module100)), __ccgo_ts+47059, 0) return uint64(0) } rowsize = X_TIFFMultiply64(tls, tif, rowsize, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel), __ccgo_ts+47043) } if rowsize&uint64(0x07) != 0 { v1 = rowsize>>libc.Int32FromInt32(3) + uint64(1) } else { v1 = rowsize >> int32(3) } tilerowsize = v1 if tilerowsize == uint64(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module100)), __ccgo_ts+47085, 0) return uint64(0) } return tilerowsize } var _module100 = [18]uint8{'T', 'I', 'F', 'F', 'T', 'i', 'l', 'e', 'R', 'o', 'w', 'S', 'i', 'z', 'e', '6', '4'} func XTIFFTileRowSize(tls *libc.TLS, tif uintptr) (r Ttmsize_t) { var m Tuint64_t _ = m m = XTIFFTileRowSize64(tls, tif) return X_TIFFCastUInt64ToSSize(tls, tif, m, uintptr(unsafe.Pointer(&_module101))) } var _module101 = [16]uint8{'T', 'I', 'F', 'F', 'T', 'i', 'l', 'e', 'R', 'o', 'w', 'S', 'i', 'z', 'e'} // C documentation // // /* // * Compute the # bytes in a variable length, row-aligned tile. // */ func XTIFFVTileSize64(tls *libc.TLS, tif uintptr, nrows Tuint32_t) (r Tuint64_t) { bp := tls.Alloc(32) defer tls.Free(32) var samplingblock_samples Tuint16_t var samplingblocks_hor, samplingblocks_ver Tuint32_t var samplingrow_samples, samplingrow_size Tuint64_t var td uintptr var v1, v2 uint32 var v3 uint64 var _ /* ycbcrsubsampling at bp+0 */ [2]Tuint16_t _, _, _, _, _, _, _, _, _ = samplingblock_samples, samplingblocks_hor, samplingblocks_ver, samplingrow_samples, samplingrow_size, td, v1, v2, v3 td = tif + 56 if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength == uint32(0) || (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth == uint32(0) || (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tiledepth == uint32(0) { return libc.Uint64FromInt32(libc.Int32FromInt32(0)) } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == int32(PHOTOMETRIC_YCBCR) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) == int32(3) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x04000) != libc.Uint32FromInt32(0)) { XTIFFGetFieldDefaulted(tls, tif, uint32(TIFFTAG_YCBCRSUBSAMPLING), libc.VaList(bp+16, bp+uintptr(0)*2, bp+uintptr(1)*2)) if libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) != int32(1) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) != int32(2) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) != int32(4) || libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) != int32(1) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) != int32(2) && libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) != int32(4) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module102)), __ccgo_ts+46619, libc.VaList(bp+16, libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]), libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]))) return uint64(0) } samplingblock_samples = libc.Uint16FromInt32(libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0])*libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) + int32(2)) if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0])-libc.Int32FromInt32(1)) { v1 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth + (uint32((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) - uint32(1))) / uint32((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[0]) } else { v1 = 0 } samplingblocks_hor = v1 if nrows < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)])-libc.Int32FromInt32(1)) { v2 = (nrows + (uint32((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) - uint32(1))) / uint32((*(*[2]Tuint16_t)(unsafe.Pointer(bp)))[int32(1)]) } else { v2 = 0 } samplingblocks_ver = v2 samplingrow_samples = X_TIFFMultiply64(tls, tif, uint64(samplingblocks_hor), uint64(samplingblock_samples), uintptr(unsafe.Pointer(&_module102))) if X_TIFFMultiply64(tls, tif, samplingrow_samples, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uintptr(unsafe.Pointer(&_module102)))&uint64(0x07) != 0 { v3 = X_TIFFMultiply64(tls, tif, samplingrow_samples, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uintptr(unsafe.Pointer(&_module102)))>>libc.Int32FromInt32(3) + uint64(1) } else { v3 = X_TIFFMultiply64(tls, tif, samplingrow_samples, uint64((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample), uintptr(unsafe.Pointer(&_module102))) >> int32(3) } samplingrow_size = v3 return X_TIFFMultiply64(tls, tif, samplingrow_size, uint64(samplingblocks_ver), uintptr(unsafe.Pointer(&_module102))) } else { return X_TIFFMultiply64(tls, tif, uint64(nrows), XTIFFTileRowSize64(tls, tif), uintptr(unsafe.Pointer(&_module102))) } return r } var _module102 = [16]uint8{'T', 'I', 'F', 'F', 'V', 'T', 'i', 'l', 'e', 'S', 'i', 'z', 'e', '6', '4'} func XTIFFVTileSize(tls *libc.TLS, tif uintptr, nrows Tuint32_t) (r Ttmsize_t) { var m Tuint64_t _ = m m = XTIFFVTileSize64(tls, tif, nrows) return X_TIFFCastUInt64ToSSize(tls, tif, m, uintptr(unsafe.Pointer(&_module103))) } var _module103 = [14]uint8{'T', 'I', 'F', 'F', 'V', 'T', 'i', 'l', 'e', 'S', 'i', 'z', 'e'} // C documentation // // /* // * Compute the # bytes in a row-aligned tile. // */ func XTIFFTileSize64(tls *libc.TLS, tif uintptr) (r Tuint64_t) { return XTIFFVTileSize64(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_tilelength) } func XTIFFTileSize(tls *libc.TLS, tif uintptr) (r Ttmsize_t) { var m Tuint64_t _ = m m = XTIFFTileSize64(tls, tif) return X_TIFFCastUInt64ToSSize(tls, tif, m, uintptr(unsafe.Pointer(&_module104))) } var _module104 = [13]uint8{'T', 'I', 'F', 'F', 'T', 'i', 'l', 'e', 'S', 'i', 'z', 'e'} // C documentation // // /* // * Compute a default tile size based on the image // * characteristics and a requested value. If a // * request is <1 then we choose a size according // * to certain heuristics. // */ func XTIFFDefaultTileSize(tls *libc.TLS, tif uintptr, tw uintptr, th uintptr) { (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_deftilesize})))(tls, tif, tw, th) } func X_TIFFDefaultTileSize(tls *libc.TLS, tif uintptr, tw uintptr, th uintptr) { var v1, v2 uint32 _, _ = v1, v2 _ = tif if *(*Tint32_t)(unsafe.Pointer(tw)) < int32(1) { *(*Tuint32_t)(unsafe.Pointer(tw)) = uint32(256) } if *(*Tint32_t)(unsafe.Pointer(th)) < int32(1) { *(*Tuint32_t)(unsafe.Pointer(th)) = uint32(256) } /* roundup to a multiple of 16 per the spec */ if *(*Tuint32_t)(unsafe.Pointer(tw))&uint32(0xf) != 0 { if *(*Tuint32_t)(unsafe.Pointer(tw)) < libc.Uint32FromUint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromInt32(16)-libc.Int32FromInt32(1)) { v1 = (*(*Tuint32_t)(unsafe.Pointer(tw)) + (libc.Uint32FromInt32(libc.Int32FromInt32(16)) - libc.Uint32FromInt32(1))) / libc.Uint32FromInt32(libc.Int32FromInt32(16)) } else { v1 = 0 } *(*Tuint32_t)(unsafe.Pointer(tw)) = v1 * libc.Uint32FromInt32(libc.Int32FromInt32(16)) } if *(*Tuint32_t)(unsafe.Pointer(th))&uint32(0xf) != 0 { if *(*Tuint32_t)(unsafe.Pointer(th)) < libc.Uint32FromUint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromInt32(16)-libc.Int32FromInt32(1)) { v2 = (*(*Tuint32_t)(unsafe.Pointer(th)) + (libc.Uint32FromInt32(libc.Int32FromInt32(16)) - libc.Uint32FromInt32(1))) / libc.Uint32FromInt32(libc.Int32FromInt32(16)) } else { v2 = 0 } *(*Tuint32_t)(unsafe.Pointer(th)) = v2 * libc.Uint32FromInt32(libc.Int32FromInt32(16)) } } const MADV_COLD = 20 const MADV_DODUMP = 17 const MADV_DOFORK = 11 const MADV_DONTDUMP = 16 const MADV_DONTFORK = 10 const MADV_DONTNEED = 4 const MADV_FREE = 8 const MADV_HUGEPAGE = 14 const MADV_HWPOISON = 100 const MADV_KEEPONFORK = 19 const MADV_MERGEABLE = 12 const MADV_NOHUGEPAGE = 15 const MADV_NORMAL = 0 const MADV_PAGEOUT = 21 const MADV_RANDOM = 1 const MADV_REMOVE = 9 const MADV_SEQUENTIAL = 2 const MADV_SOFT_OFFLINE = 101 const MADV_UNMERGEABLE = 13 const MADV_WILLNEED = 3 const MADV_WIPEONFORK = 18 const MAP_ANON = 0x20 const MAP_ANONYMOUS = "MAP_ANON" const MAP_DENYWRITE = 0x0800 const MAP_EXECUTABLE = 0x1000 const MAP_FILE = 0 const MAP_FIXED = 0x10 const MAP_FIXED_NOREPLACE = 0x100000 const MAP_GROWSDOWN = 0x0100 const MAP_HUGETLB = 0x40000 const MAP_HUGE_MASK = 0x3f const MAP_HUGE_SHIFT = 26 const MAP_LOCKED = 0x2000 const MAP_NONBLOCK = 0x10000 const MAP_NORESERVE = 0x4000 const MAP_POPULATE = 0x8000 const MAP_PRIVATE = 0x02 const MAP_SHARED = 1 const MAP_SHARED_VALIDATE = 0x03 const MAP_STACK = 0x20000 const MAP_SYNC = 0x80000 const MAP_TYPE = 0x0f const MCL_CURRENT = 1 const MCL_FUTURE = 2 const MCL_ONFAULT = 4 const MFD_ALLOW_SEALING = 0x0002 const MFD_CLOEXEC = 0x0001 const MFD_HUGETLB = 0x0004 const MLOCK_ONFAULT = 0x01 const MREMAP_DONTUNMAP = 4 const MREMAP_FIXED = 2 const MREMAP_MAYMOVE = 1 const MS_ASYNC = 1 const MS_INVALIDATE = 2 const MS_SYNC = 4 const POSIX_MADV_DONTNEED = 4 const POSIX_MADV_NORMAL = 0 const POSIX_MADV_RANDOM = 1 const POSIX_MADV_SEQUENTIAL = 2 const POSIX_MADV_WILLNEED = 3 const PROT_EXEC = 4 const PROT_GROWSDOWN = 0x01000000 const PROT_GROWSUP = 0x02000000 const PROT_NONE = 0 const PROT_READ = 1 const PROT_WRITE = 2 const STATX_ALL = 0xfff const STATX_ATIME = 0x20 const STATX_BASIC_STATS = 0x7ff const STATX_BLOCKS = 0x400 const STATX_BTIME = 0x800 const STATX_CTIME = 0x80 const STATX_GID = 0x10 const STATX_INO = 0x100 const STATX_MODE = 2 const STATX_MTIME = 0x40 const STATX_NLINK = 4 const STATX_SIZE = 0x200 const STATX_TYPE = 1 const STATX_UID = 8 const S_IEXEC = "S_IXUSR" const S_IFBLK = 0060000 const S_IFCHR = 0020000 const S_IFDIR = 0040000 const S_IFIFO = 0010000 const S_IFLNK = 0120000 const S_IFMT = 0170000 const S_IFREG = 0100000 const S_IFSOCK = 0140000 const S_IREAD = "S_IRUSR" const S_IWRITE = "S_IWUSR" const TIFF_IO_MAX = 2147483647 const TIFF_UPSAMPLED8 = 0x04000 const UTIME_NOW = 0x3fffffff const UTIME_OMIT = 0x3ffffffe type Tstat = struct { F__ccgo_align [0]uint32 Fst_dev Tdev_t F__st_dev_padding int32 F__st_ino_truncated int32 Fst_mode Tmode_t Fst_nlink Tnlink_t Fst_uid Tuid_t Fst_gid Tgid_t Fst_rdev Tdev_t F__st_rdev_padding int32 F__ccgo_align9 [4]byte Fst_size Toff_t Fst_blksize Tblksize_t F__ccgo_align11 [4]byte Fst_blocks Tblkcnt_t F__st_atim32 struct { Ftv_sec int32 Ftv_nsec int32 } F__st_mtim32 struct { Ftv_sec int32 Ftv_nsec int32 } F__st_ctim32 struct { Ftv_sec int32 Ftv_nsec int32 } Fst_ino Tino_t Fst_atim Ttimespec Fst_mtim Ttimespec Fst_ctim Ttimespec } type Tstatx_timestamp = struct { F__ccgo_align [0]uint32 Ftv_sec Tint64_t Ftv_nsec Tuint32_t F__pad Tuint32_t } type Tstatx = struct { F__ccgo_align [0]uint32 Fstx_mask Tuint32_t Fstx_blksize Tuint32_t Fstx_attributes Tuint64_t Fstx_nlink Tuint32_t Fstx_uid Tuint32_t Fstx_gid Tuint32_t Fstx_mode Tuint16_t F__pad0 [1]Tuint16_t Fstx_ino Tuint64_t Fstx_size Tuint64_t Fstx_blocks Tuint64_t Fstx_attributes_mask Tuint64_t Fstx_atime Tstatx_timestamp Fstx_btime Tstatx_timestamp Fstx_ctime Tstatx_timestamp Fstx_mtime Tstatx_timestamp Fstx_rdev_major Tuint32_t Fstx_rdev_minor Tuint32_t Fstx_dev_major Tuint32_t Fstx_dev_minor Tuint32_t F__pad1 [14]Tuint64_t } type Tfd_as_handle_union_t = struct { Fh [0]Tthandle_t Ffd int32 } type Tfd_as_handle_union = Tfd_as_handle_union_t func __tiffReadProc(tls *libc.TLS, fd Tthandle_t, buf uintptr, size Ttmsize_t) (r Ttmsize_t) { bp := tls.Alloc(16) defer tls.Free(16) var buf_offset uintptr var bytes_read, bytes_total, io_size Tsize_t var count Ttmsize_t var _ /* fdh at bp+0 */ Tfd_as_handle_union_t _, _, _, _, _ = buf_offset, bytes_read, bytes_total, count, io_size bytes_total = libc.Uint32FromInt32(size) count = -int32(1) if libc.Int32FromUint32(bytes_total) != size { *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(EINVAL) return -libc.Int32FromInt32(1) } *(*Tthandle_t)(unsafe.Pointer(bp)) = fd bytes_read = uint32(0) for { if !(bytes_read < bytes_total) { break } buf_offset = buf + uintptr(bytes_read) io_size = bytes_total - bytes_read if io_size > uint32(2147483647) { io_size = uint32(2147483647) } /* Below is an obvious false positive of Coverity Scan */ /* coverity[overflow_sink] */ count = libc.Xread(tls, *(*int32)(unsafe.Pointer(bp)), buf_offset, io_size) if count <= 0 { break } goto _1 _1: ; bytes_read += libc.Uint32FromInt32(count) } if count < 0 { return -libc.Int32FromInt32(1) } return libc.Int32FromUint32(bytes_read) } func __tiffWriteProc(tls *libc.TLS, fd Tthandle_t, buf uintptr, size Ttmsize_t) (r Ttmsize_t) { bp := tls.Alloc(16) defer tls.Free(16) var buf_offset uintptr var bytes_total, bytes_written, io_size Tsize_t var count Ttmsize_t var _ /* fdh at bp+0 */ Tfd_as_handle_union_t _, _, _, _, _ = buf_offset, bytes_total, bytes_written, count, io_size bytes_total = libc.Uint32FromInt32(size) count = -int32(1) if libc.Int32FromUint32(bytes_total) != size { *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(EINVAL) return -libc.Int32FromInt32(1) } *(*Tthandle_t)(unsafe.Pointer(bp)) = fd bytes_written = uint32(0) for { if !(bytes_written < bytes_total) { break } buf_offset = buf + uintptr(bytes_written) io_size = bytes_total - bytes_written if io_size > uint32(2147483647) { io_size = uint32(2147483647) } /* Below is an obvious false positive of Coverity Scan */ /* coverity[overflow_sink] */ count = libc.Xwrite(tls, *(*int32)(unsafe.Pointer(bp)), buf_offset, io_size) if count <= 0 { break } goto _1 _1: ; bytes_written += libc.Uint32FromInt32(count) } if count < 0 { return -libc.Int32FromInt32(1) } return libc.Int32FromUint32(bytes_written) /* return ((tmsize_t) write(fdh.fd, buf, bytes_total)); */ } func __tiffSeekProc(tls *libc.TLS, fd Tthandle_t, off Tuint64_t, whence int32) (r Tuint64_t) { bp := tls.Alloc(16) defer tls.Free(16) var off_io Toff_t var _ /* fdh at bp+0 */ Tfd_as_handle_union_t _ = off_io off_io = libc.Int64FromUint64(off) if libc.Uint64FromInt64(off_io) != off { *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = int32(EINVAL) return libc.Uint64FromInt32(-libc.Int32FromInt32(1)) /* this is really gross */ } *(*Tthandle_t)(unsafe.Pointer(bp)) = fd return libc.Uint64FromInt64(libc.Xlseek(tls, *(*int32)(unsafe.Pointer(bp)), off_io, whence)) } func __tiffCloseProc(tls *libc.TLS, fd Tthandle_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* fdh at bp+0 */ Tfd_as_handle_union_t *(*Tthandle_t)(unsafe.Pointer(bp)) = fd return libc.Xclose(tls, *(*int32)(unsafe.Pointer(bp))) } func __tiffSizeProc(tls *libc.TLS, fd Tthandle_t) (r Tuint64_t) { bp := tls.Alloc(160) defer tls.Free(160) var _ /* fdh at bp+152 */ Tfd_as_handle_union_t var _ /* sb at bp+0 */ Tstat *(*Tthandle_t)(unsafe.Pointer(bp + 152)) = fd if libc.Xfstat(tls, *(*int32)(unsafe.Pointer(bp + 152)), bp) < 0 { return libc.Uint64FromInt32(libc.Int32FromInt32(0)) } else { return libc.Uint64FromInt64((*(*Tstat)(unsafe.Pointer(bp))).Fst_size) } return r } func __tiffMapProc(tls *libc.TLS, fd Tthandle_t, pbase uintptr, psize uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var size64 Tuint64_t var sizem Ttmsize_t var _ /* fdh at bp+0 */ Tfd_as_handle_union_t _, _ = size64, sizem size64 = __tiffSizeProc(tls, fd) sizem = libc.Int32FromUint64(size64) if size64 != 0 && libc.Uint64FromInt32(sizem) == size64 { *(*Tthandle_t)(unsafe.Pointer(bp)) = fd *(*uintptr)(unsafe.Pointer(pbase)) = libc.Xmmap(tls, uintptr(0), libc.Uint32FromInt32(sizem), int32(PROT_READ), int32(MAP_SHARED), *(*int32)(unsafe.Pointer(bp)), 0) if *(*uintptr)(unsafe.Pointer(pbase)) != uintptr(-libc.Int32FromInt32(1)) { *(*Ttoff_t)(unsafe.Pointer(psize)) = libc.Uint64FromInt32(sizem) return int32(1) } } return 0 } func __tiffUnmapProc(tls *libc.TLS, fd Tthandle_t, base uintptr, size Ttoff_t) { _ = fd libc.Xmunmap(tls, base, libc.Uint32FromInt64(libc.Int64FromUint64(size))) } // C documentation // // /* // * Open a TIFF file descriptor for read/writing. // */ func XTIFFFdOpen(tls *libc.TLS, fd int32, name uintptr, mode uintptr) (r uintptr) { return XTIFFFdOpenExt(tls, fd, name, mode, libc.UintptrFromInt32(0)) } func XTIFFFdOpenExt(tls *libc.TLS, fd int32, name uintptr, mode uintptr, opts uintptr) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var tif uintptr var _ /* fdh at bp+0 */ Tfd_as_handle_union_t _ = tif *(*int32)(unsafe.Pointer(bp)) = fd tif = XTIFFClientOpenExt(tls, name, mode, *(*Tthandle_t)(unsafe.Pointer(bp)), __ccgo_fp(__tiffReadProc), __ccgo_fp(__tiffWriteProc), __ccgo_fp(__tiffSeekProc), __ccgo_fp(__tiffCloseProc), __ccgo_fp(__tiffSizeProc), __ccgo_fp(__tiffMapProc), __ccgo_fp(__tiffUnmapProc), opts) if tif != 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_fd = fd } return tif } // C documentation // // /* // * Open a TIFF file for read/writing. // */ func XTIFFOpen(tls *libc.TLS, name uintptr, mode uintptr) (r uintptr) { return XTIFFOpenExt(tls, name, mode, libc.UintptrFromInt32(0)) } func XTIFFOpenExt(tls *libc.TLS, name uintptr, mode uintptr, opts uintptr) (r uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var fd, m int32 var tif uintptr _, _, _ = fd, m, tif m = X_TIFFgetMode(tls, opts, libc.UintptrFromInt32(0), mode, uintptr(unsafe.Pointer(&_module105))) if m == -int32(1) { return libc.UintptrFromInt32(0) } /* for cygwin and mingw */ fd = libc.Xopen(tls, name, m, libc.VaList(bp+8, int32(0666))) if fd < 0 { if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) > 0 && libc.Xstrerror(tls, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) != libc.UintptrFromInt32(0) { X_TIFFErrorEarly(tls, opts, libc.UintptrFromInt32(0), uintptr(unsafe.Pointer(&_module105)), __ccgo_ts+47116, libc.VaList(bp+8, name, libc.Xstrerror(tls, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))))) } else { X_TIFFErrorEarly(tls, opts, libc.UintptrFromInt32(0), uintptr(unsafe.Pointer(&_module105)), __ccgo_ts+47123, libc.VaList(bp+8, name)) } return libc.UintptrFromInt32(0) } tif = XTIFFFdOpenExt(tls, fd, name, mode, opts) if !(tif != 0) { libc.Xclose(tls, fd) } return tif } var _module105 = [9]uint8{'T', 'I', 'F', 'F', 'O', 'p', 'e', 'n'} func X_TIFFmalloc(tls *libc.TLS, s Ttmsize_t) (r uintptr) { if s == 0 { return libc.UintptrFromInt32(0) } return libc.Xmalloc(tls, libc.Uint32FromInt32(s)) } func X_TIFFcalloc(tls *libc.TLS, nmemb Ttmsize_t, siz Ttmsize_t) (r uintptr) { if nmemb == 0 || siz == 0 { return libc.UintptrFromInt32(0) } return libc.Xcalloc(tls, libc.Uint32FromInt32(nmemb), libc.Uint32FromInt32(siz)) } func X_TIFFfree(tls *libc.TLS, p uintptr) { libc.Xfree(tls, p) } func X_TIFFrealloc(tls *libc.TLS, p uintptr, s Ttmsize_t) (r uintptr) { return libc.Xrealloc(tls, p, libc.Uint32FromInt32(s)) } func X_TIFFmemset(tls *libc.TLS, p uintptr, v int32, c Ttmsize_t) { libc.Xmemset(tls, p, v, libc.Uint32FromInt32(c)) } func X_TIFFmemcpy(tls *libc.TLS, d uintptr, s uintptr, c Ttmsize_t) { libc.Xmemcpy(tls, d, s, libc.Uint32FromInt32(c)) } func X_TIFFmemcmp(tls *libc.TLS, p1 uintptr, p2 uintptr, c Ttmsize_t) (r int32) { return libc.Xmemcmp(tls, p1, p2, libc.Uint32FromInt32(c)) } func _unixWarningHandler(tls *libc.TLS, module uintptr, fmt uintptr, ap Tva_list) { bp := tls.Alloc(16) defer tls.Free(16) if module != libc.UintptrFromInt32(0) { libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+47139, libc.VaList(bp+8, module)) } libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+47144, 0) libc.Xvfprintf(tls, libc.Xstderr, fmt, ap) libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+47154, 0) } func init() { p := unsafe.Pointer(&X_TIFFwarningHandler) *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_unixWarningHandler) } func _unixErrorHandler(tls *libc.TLS, module uintptr, fmt uintptr, ap Tva_list) { bp := tls.Alloc(16) defer tls.Free(16) if module != libc.UintptrFromInt32(0) { libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+47139, libc.VaList(bp+8, module)) } libc.Xvfprintf(tls, libc.Xstderr, fmt, ap) libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+47154, 0) } func init() { p := unsafe.Pointer(&X_TIFFerrorHandler) *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_unixErrorHandler) } const TIFFLIB_VERSION_STR1 = "LIBTIFF, Version 4.7.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." var _TIFFVersion = [106]uint8{'L', 'I', 'B', 'T', 'I', 'F', 'F', ',', ' ', 'V', 'e', 'r', 's', 'i', 'o', 'n', ' ', '4', '.', '7', '.', '0', 10, 'C', 'o', 'p', 'y', 'r', 'i', 'g', 'h', 't', ' ', '(', 'c', ')', ' ', '1', '9', '8', '8', '-', '1', '9', '9', '6', ' ', 'S', 'a', 'm', ' ', 'L', 'e', 'f', 'f', 'l', 'e', 'r', 10, 'C', 'o', 'p', 'y', 'r', 'i', 'g', 'h', 't', ' ', '(', 'c', ')', ' ', '1', '9', '9', '1', '-', '1', '9', '9', '6', ' ', 'S', 'i', 'l', 'i', 'c', 'o', 'n', ' ', 'G', 'r', 'a', 'p', 'h', 'i', 'c', 's', ',', ' ', 'I', 'n', 'c', '.'} func XTIFFGetVersion(tls *libc.TLS) (r uintptr) { return uintptr(unsafe.Pointer(&_TIFFVersion)) } const TIFFLIB_VERSION_STR2 = "LIBTIFF, Version 4.7.0\\nCopyright (c) 1988-1996 Sam Leffler\\nCopyright (c) 1991-1996 Silicon Graphics, Inc." func XTIFFSetWarningHandler(tls *libc.TLS, handler TTIFFErrorHandler) (r TTIFFErrorHandler) { var prev TTIFFErrorHandler _ = prev prev = X_TIFFwarningHandler X_TIFFwarningHandler = handler return prev } func XTIFFSetWarningHandlerExt(tls *libc.TLS, handler TTIFFErrorHandlerExt) (r TTIFFErrorHandlerExt) { var prev TTIFFErrorHandlerExt _ = prev prev = X_TIFFwarningHandlerExt X_TIFFwarningHandlerExt = handler return prev } func XTIFFWarning(tls *libc.TLS, module uintptr, fmt uintptr, va uintptr) { var ap Tva_list _ = ap if X_TIFFwarningHandler != 0 { ap = va (*(*func(*libc.TLS, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFwarningHandler})))(tls, module, fmt, ap) _ = ap } if X_TIFFwarningHandlerExt != 0 { ap = va (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFwarningHandlerExt})))(tls, uintptr(0), module, fmt, ap) _ = ap } } func XTIFFWarningExt(tls *libc.TLS, fd Tthandle_t, module uintptr, fmt uintptr, va uintptr) { var ap Tva_list _ = ap if X_TIFFwarningHandler != 0 { ap = va (*(*func(*libc.TLS, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFwarningHandler})))(tls, module, fmt, ap) _ = ap } if X_TIFFwarningHandlerExt != 0 { ap = va (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFwarningHandlerExt})))(tls, fd, module, fmt, ap) _ = ap } } func XTIFFWarningExtR(tls *libc.TLS, tif uintptr, module uintptr, fmt uintptr, va uintptr) { var ap Tva_list var stop int32 var v1 Tthandle_t _, _, _ = ap, stop, v1 if tif != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_warnhandler != 0 { ap = va stop = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_warnhandler})))(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_warnhandler_user_data, module, fmt, ap) _ = ap if stop != 0 { return } } if X_TIFFwarningHandler != 0 { ap = va (*(*func(*libc.TLS, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFwarningHandler})))(tls, module, fmt, ap) _ = ap } if X_TIFFwarningHandlerExt != 0 { ap = va if tif != 0 { v1 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata } else { v1 = uintptr(0) } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, Tva_list))(unsafe.Pointer(&struct{ uintptr }{X_TIFFwarningHandlerExt})))(tls, v1, module, fmt, ap) _ = ap } } const O_RDONLY9 = 0 const STRIPINCR = 20 const TIFF_BEENWRITING5 = 64 const TIFF_BIGTIFF5 = 524288 const TIFF_BUF4WRITE5 = 1048576 const TIFF_BUFFERSETUP5 = 16 const TIFF_CODERSETUP5 = 32 const TIFF_DIRTYDIRECT7 = 8 const TIFF_DIRTYSTRIP5 = 2097152 const TIFF_ISTILED9 = 1024 const TIFF_MYBUFFER11 = 512 const TIFF_NOBITREV7 = 256 const TIFF_POSTENCODE7 = 4096 const UINT32_MAX10 = 4294967295 func XTIFFWriteScanline(tls *libc.TLS, tif uintptr, buf uintptr, row Tuint32_t, sample Tuint16_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var imagegrew, status int32 var strip Tuint32_t var td uintptr var v1 uint32 _, _, _, _, _ = imagegrew, status, strip, td, v1 imagegrew = 0 if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00040) != 0 || XTIFFWriteCheck(tls, tif, 0, uintptr(unsafe.Pointer(&_module106))) != 0) { return -int32(1) } /* * Handle delayed allocation of data buffer. This * permits it to be sized more intelligently (using * directory information). */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00010) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != 0 || XTIFFWriteBufferSetup(tls, tif, libc.UintptrFromInt32(0), -libc.Int32FromInt32(1)) != 0) { return -int32(1) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x100000) /* not strictly sure this is right*/ td = tif + 56 /* * Extend image length if needed * (but only for PlanarConfig=1). */ if row >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength { /* extend image */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module106)), __ccgo_ts+47157, 0) return -int32(1) } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength = row + uint32(1) imagegrew = int32(1) } /* * Calculate strip and check for crossings. */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { if libc.Int32FromUint16(sample) >= libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module106)), __ccgo_ts+46512, libc.VaList(bp+8, uint32(sample), uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel))) return -int32(1) } strip = uint32(sample)*(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage + row/(*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip } else { strip = row / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip } /* * Check strip array to make sure there's space. We don't support * dynamically growing files that have data organized in separate * bitplanes because it's too painful. In that case we require that * the imagelength be set properly before the first write (so that the * strips array will be fully allocated above). */ if strip >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips && !(_TIFFGrowStrips(tls, tif, uint32(1), uintptr(unsafe.Pointer(&_module106))) != 0) { return -int32(1) } if strip != (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip { /* * Changing strips -- flush any data present. */ if !(XTIFFFlushData(tls, tif) != 0) { return -int32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = strip /* * Watch out for a growing image. The value of strips/image * will initially be 1 (since it can't be deduced until the * imagelength is known). */ if strip >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage && imagegrew != 0 { if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength < uint32(0xffffffff)-((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip-libc.Uint32FromInt32(1)) { v1 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength + ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip - uint32(1))) / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip } else { v1 = 0 } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage = v1 } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module106)), __ccgo_ts+47213, 0) return -int32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = strip % (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00020) == uint32(0) { if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode})))(tls, tif) != 0) { return -int32(1) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00020) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata /* this informs TIFFAppendToStrip() we have changed strip */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = uint64(0) if !((*(*func(*libc.TLS, uintptr, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_preencode})))(tls, tif, sample) != 0) { return -int32(1) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x01000) } /* * Ensure the write is either sequential or at the * beginning of a strip (or that we can randomly * access the data -- i.e. no encoding). */ if row != (*TTIFF)(unsafe.Pointer(tif)).Ftif_row { if row < (*TTIFF)(unsafe.Pointer(tif)).Ftif_row { /* * Moving backwards within the same strip: * backup to the start and then decode * forward (below). */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = strip % (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata } /* * Seek forward to the desired row. */ if !((*(*func(*libc.TLS, uintptr, Tuint32_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seek})))(tls, tif, row-(*TTIFF)(unsafe.Pointer(tif)).Ftif_row) != 0) { return -int32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = row } /* swab if needed - note that source buffer will be altered */ (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, buf, (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize) status = (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow})))(tls, tif, buf, (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize, sample) /* we are now poised at the beginning of the next row */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = row + uint32(1) return status } var _module106 = [18]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'S', 'c', 'a', 'n', 'l', 'i', 'n', 'e'} // C documentation // // /* Make sure that at the first attempt of rewriting a tile/strip, we will have // */ // /* more bytes available in the output buffer than the previous byte count, */ // /* so that TIFFAppendToStrip() will detect the overflow when it is called the // * first */ // /* time if the new compressed tile is bigger than the older one. (GDAL #4771) */ func __TIFFReserveLargeEnoughWriteBuffer(tls *libc.TLS, tif uintptr, strip_or_tile Tuint32_t) (r int32) { var safe_buffer_size Tuint64_t var td uintptr _, _ = safe_buffer_size, td td = tif + 56 if *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip_or_tile)*8)) > uint64(0) { /* The +1 is to ensure at least one extra bytes */ /* The +4 is because the LZW encoder flushes 4 bytes before the limit */ safe_buffer_size = *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip_or_tile)*8)) + libc.Uint64FromInt32(1) + libc.Uint64FromInt32(4) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize <= libc.Int32FromUint64(safe_buffer_size) { if !(XTIFFWriteBufferSetup(tls, tif, libc.UintptrFromInt32(0), libc.Int32FromUint64((safe_buffer_size+(libc.Uint64FromInt32(libc.Int32FromInt32(1024))-libc.Uint64FromInt32(1)))/libc.Uint64FromInt32(libc.Int32FromInt32(1024))*libc.Uint64FromInt32(libc.Int32FromInt32(1024)))) != 0) { return 0 } } } return int32(1) } // C documentation // // /* // * Encode the supplied data and write it to the // * specified strip. // * // * NB: Image length must be setup before writing. // */ func XTIFFWriteEncodedStrip(tls *libc.TLS, tif uintptr, strip Tuint32_t, data uintptr, cc Ttmsize_t) (r Ttmsize_t) { var sample Tuint16_t var td uintptr var v1 uint32 _, _, _ = sample, td, v1 td = tif + 56 if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00040) != 0 || XTIFFWriteCheck(tls, tif, 0, uintptr(unsafe.Pointer(&_module107))) != 0) { return -libc.Int32FromInt32(1) } /* * Check strip array to make sure there's space. * We don't support dynamically growing files that * have data organized in separate bitplanes because * it's too painful. In that case we require that * the imagelength be set properly before the first * write (so that the strips array will be fully * allocated above). */ if strip >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module107)), __ccgo_ts+47235, 0) return -libc.Int32FromInt32(1) } if !(_TIFFGrowStrips(tls, tif, uint32(1), uintptr(unsafe.Pointer(&_module107))) != 0) { return -libc.Int32FromInt32(1) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength < uint32(0xffffffff)-((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip-libc.Uint32FromInt32(1)) { v1 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength + ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip - uint32(1))) / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip } else { v1 = 0 } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage = v1 } /* * Handle delayed allocation of data buffer. This * permits it to be sized according to the directory * info. */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00010) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != 0 || XTIFFWriteBufferSetup(tls, tif, libc.UintptrFromInt32(0), -libc.Int32FromInt32(1)) != 0) { return -libc.Int32FromInt32(1) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x100000) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = strip /* this informs TIFFAppendToStrip() we have changed or reset strip */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = uint64(0) if !(__TIFFReserveLargeEnoughWriteBuffer(tls, tif, strip) != 0) { return -libc.Int32FromInt32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module107)), __ccgo_ts+47213, 0) return -libc.Int32FromInt32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = strip % (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00020) == uint32(0) { if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode})))(tls, tif) != 0) { return -libc.Int32FromInt32(1) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00020) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x01000) /* shortcut to avoid an extra memcpy() */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == int32(COMPRESSION_NONE) { /* swab if needed - note that source buffer will be altered */ (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, data, cc) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, data, cc) } if cc > 0 && !(_TIFFAppendToStrip(tls, tif, strip, data, cc) != 0) { return -libc.Int32FromInt32(1) } return cc } sample = uint16(strip / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage) if !((*(*func(*libc.TLS, uintptr, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_preencode})))(tls, tif, sample) != 0) { return -libc.Int32FromInt32(1) } /* swab if needed - note that source buffer will be altered */ (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, data, cc) if !((*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip})))(tls, tif, data, cc, sample) != 0) { return -libc.Int32FromInt32(1) } if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode})))(tls, tif) != 0) { return -libc.Int32FromInt32(1) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc > 0 && !(_TIFFAppendToStrip(tls, tif, strip, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) != 0) { return -libc.Int32FromInt32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata return cc } var _module107 = [22]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'E', 'n', 'c', 'o', 'd', 'e', 'd', 'S', 't', 'r', 'i', 'p'} // C documentation // // /* // * Write the supplied data to the specified strip. // * // * NB: Image length must be setup before writing. // */ func XTIFFWriteRawStrip(tls *libc.TLS, tif uintptr, strip Tuint32_t, data uintptr, cc Ttmsize_t) (r Ttmsize_t) { var td uintptr var v1 uint32 var v2 int32 _, _, _ = td, v1, v2 td = tif + 56 if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00040) != 0 || XTIFFWriteCheck(tls, tif, 0, uintptr(unsafe.Pointer(&_module108))) != 0) { return -libc.Int32FromInt32(1) } /* * Check strip array to make sure there's space. * We don't support dynamically growing files that * have data organized in separate bitplanes because * it's too painful. In that case we require that * the imagelength be set properly before the first * write (so that the strips array will be fully * allocated above). */ if strip >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module108)), __ccgo_ts+47235, 0) return -libc.Int32FromInt32(1) } /* * Watch out for a growing image. The value of * strips/image will initially be 1 (since it * can't be deduced until the imagelength is known). */ if strip >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage { if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength < uint32(0xffffffff)-((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip-libc.Uint32FromInt32(1)) { v1 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength + ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip - uint32(1))) / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip } else { v1 = 0 } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage = v1 } if !(_TIFFGrowStrips(tls, tif, uint32(1), uintptr(unsafe.Pointer(&_module108))) != 0) { return -libc.Int32FromInt32(1) } } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip != strip { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip = strip /* this informs TIFFAppendToStrip() we have changed or reset strip */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = uint64(0) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module108)), __ccgo_ts+47213, 0) return -libc.Int32FromInt32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = strip % (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip if _TIFFAppendToStrip(tls, tif, strip, data, cc) != 0 { v2 = cc } else { v2 = -libc.Int32FromInt32(1) } return v2 } var _module108 = [18]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'R', 'a', 'w', 'S', 't', 'r', 'i', 'p'} // C documentation // // /* // * Write and compress a tile of data. The // * tile is selected by the (x,y,z,s) coordinates. // */ func XTIFFWriteTile(tls *libc.TLS, tif uintptr, buf uintptr, x Tuint32_t, y Tuint32_t, z Tuint32_t, s Tuint16_t) (r Ttmsize_t) { if !(XTIFFCheckTile(tls, tif, x, y, z, s) != 0) { return -libc.Int32FromInt32(1) } /* * NB: A tile size of -1 is used instead of tif_tilesize knowing * that TIFFWriteEncodedTile will clamp this to the tile size. * This is done because the tile size may not be defined until * after the output buffer is setup in TIFFWriteBufferSetup. */ return XTIFFWriteEncodedTile(tls, tif, XTIFFComputeTile(tls, tif, x, y, z, s), buf, -libc.Int32FromInt32(1)) } // C documentation // // /* // * Encode the supplied data and write it to the // * specified tile. There must be space for the // * data. The function clamps individual writes // * to a tile to the tile size, but does not (and // * can not) check that multiple writes to the same // * tile do not write more than tile size data. // * // * NB: Image length must be setup before writing; this // * interface does not support automatically growing // * the image on each write (as TIFFWriteScanline does). // */ func XTIFFWriteEncodedTile(tls *libc.TLS, tif uintptr, tile Tuint32_t, data uintptr, cc Ttmsize_t) (r Ttmsize_t) { bp := tls.Alloc(32) defer tls.Free(32) var howmany32 Tuint32_t var sample Tuint16_t var td uintptr var v1, v2 uint32 _, _, _, _, _ = howmany32, sample, td, v1, v2 if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00040) != 0 || XTIFFWriteCheck(tls, tif, int32(1), uintptr(unsafe.Pointer(&_module109))) != 0) { return -libc.Int32FromInt32(1) } td = tif + 56 if tile >= (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module109)), __ccgo_ts+47291, libc.VaList(bp+8, tile, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips)) return -libc.Int32FromInt32(1) } /* * Handle delayed allocation of data buffer. This * permits it to be sized more intelligently (using * directory information). */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00010) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != 0 || XTIFFWriteBufferSetup(tls, tif, libc.UintptrFromInt32(0), -libc.Int32FromInt32(1)) != 0) { return -libc.Int32FromInt32(1) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x100000) (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile = tile /* this informs TIFFAppendToStrip() we have changed or reset tile */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = uint64(0) if !(__TIFFReserveLargeEnoughWriteBuffer(tls, tif, tile) != 0) { return -libc.Int32FromInt32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata /* * Compute tiles per row & per column to compute * current row and column */ if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength < uint32(0xffffffff)-((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength-libc.Uint32FromInt32(1)) { v1 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength + ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength - uint32(1))) / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength } else { v1 = 0 } howmany32 = v1 if howmany32 == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module109)), __ccgo_ts+46350, 0) return -libc.Int32FromInt32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_row = tile % howmany32 * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth < uint32(0xffffffff)-((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth-libc.Uint32FromInt32(1)) { v2 = ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth + ((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth - uint32(1))) / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth } else { v2 = 0 } howmany32 = v2 if howmany32 == uint32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module109)), __ccgo_ts+46350, 0) return -libc.Int32FromInt32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_col = tile % howmany32 * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00020) == uint32(0) { if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode})))(tls, tif) != 0) { return -libc.Int32FromInt32(1) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00020) } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x01000) /* * Clamp write amount to the tile size. This is mostly * done so that callers can pass in some large number * (e.g. -1) and have the tile size used instead. */ if cc < int32(1) || cc > (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize { cc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize } /* shortcut to avoid an extra memcpy() */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_compression) == int32(COMPRESSION_NONE) { /* swab if needed - note that source buffer will be altered */ (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, data, cc) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, data, cc) } if cc > 0 && !(_TIFFAppendToStrip(tls, tif, tile, data, cc) != 0) { return -libc.Int32FromInt32(1) } return cc } sample = uint16(tile / (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage) if !((*(*func(*libc.TLS, uintptr, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_preencode})))(tls, tif, sample) != 0) { return -libc.Int32FromInt32(1) } /* swab if needed - note that source buffer will be altered */ (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode})))(tls, tif, data, cc) if !((*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t, Tuint16_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile})))(tls, tif, data, cc, sample) != 0) { return -libc.Int32FromInt32(1) } if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode})))(tls, tif) != 0) { return -libc.Int32FromInt32(1) } if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc > 0 && !(_TIFFAppendToStrip(tls, tif, tile, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) != 0) { return -libc.Int32FromInt32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata return cc } var _module109 = [21]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'E', 'n', 'c', 'o', 'd', 'e', 'd', 'T', 'i', 'l', 'e'} // C documentation // // /* // * Write the supplied data to the specified strip. // * There must be space for the data; we don't check // * if strips overlap! // * // * NB: Image length must be setup before writing; this // * interface does not support automatically growing // * the image on each write (as TIFFWriteScanline does). // */ func XTIFFWriteRawTile(tls *libc.TLS, tif uintptr, tile Tuint32_t, data uintptr, cc Ttmsize_t) (r Ttmsize_t) { bp := tls.Alloc(32) defer tls.Free(32) var v1 int32 _ = v1 if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00040) != 0 || XTIFFWriteCheck(tls, tif, int32(1), uintptr(unsafe.Pointer(&_module110))) != 0) { return -libc.Int32FromInt32(1) } if tile >= (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module110)), __ccgo_ts+47291, libc.VaList(bp+8, tile, (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips)) return -libc.Int32FromInt32(1) } if _TIFFAppendToStrip(tls, tif, tile, data, cc) != 0 { v1 = cc } else { v1 = -libc.Int32FromInt32(1) } return v1 } var _module110 = [17]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'R', 'a', 'w', 'T', 'i', 'l', 'e'} func XTIFFSetupStrips(tls *libc.TLS, tif uintptr) (r int32) { var td uintptr var v1, v2, v3 uint32 _, _, _, _ = td, v1, v2, v3 td = tif + 56 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_TILEDIMENSIONS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_TILEDIMENSIONS)&libc.Int32FromInt32(0x1f))) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagelength == uint32(0) { v1 = uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { v1 = XTIFFNumberOfTiles(tls, tif) } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage = v1 } else { if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_ROWSPERSTRIP)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_ROWSPERSTRIP)&libc.Int32FromInt32(0x1f))) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagelength == uint32(0) { v2 = uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { v2 = XTIFFNumberOfStrips(tls, tif) } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage = v2 } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripsperimage /* TIFFWriteDirectoryTagData has a limitation to 0x80000000U bytes */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x80000) != 0 { v3 = uint32(0x8) } else { v3 = uint32(0x4) } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips >= uint32(0x80000000)/v3 { XTIFFErrorExtR(tls, tif, __ccgo_ts+47322, __ccgo_ts+47338, 0) return 0 } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) { *(*Tuint32_t)(unsafe.Pointer(td + 124)) /= uint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips), int32(8), __ccgo_ts+47385) (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p = X_TIFFCheckMalloc(tls, tif, libc.Int32FromUint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips), int32(8), __ccgo_ts+31959) if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p == libc.UintptrFromInt32(0) || (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p == libc.UintptrFromInt32(0) { return 0 } /* * Place data at the end-of-file * (by setting offsets to zero). */ X_TIFFmemset(tls, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p, 0, libc.Int32FromUint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips*uint32(8))) X_TIFFmemset(tls, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p, 0, libc.Int32FromUint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips*uint32(8))) *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_STRIPOFFSETS)/libc.Int32FromInt32(32))*4)) |= libc.Uint32FromInt32(1) << (libc.Int32FromInt32(FIELD_STRIPOFFSETS) & libc.Int32FromInt32(0x1f)) *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_STRIPBYTECOUNTS)/libc.Int32FromInt32(32))*4)) |= libc.Uint32FromInt32(1) << (libc.Int32FromInt32(FIELD_STRIPBYTECOUNTS) & libc.Int32FromInt32(0x1f)) return int32(1) } // C documentation // // /* // * Verify file is writable and that the directory // * information is setup properly. In doing the latter // * we also "freeze" the state of the directory so // * that important information is not changed. // */ func XTIFFWriteCheck(tls *libc.TLS, tif uintptr, tiles int32, module uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var v1, v2 uintptr _, _ = v1, v2 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_mode == O_RDONLY9 { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+47410, 0) return 0 } if tiles^libc.BoolInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0)) != 0 { if tiles != 0 { v1 = __ccgo_ts + 47436 } else { v1 = __ccgo_ts + 47475 } XTIFFErrorExtR(tls, tif, module, v1, 0) return 0 } X_TIFFFillStriles(tls, tif) /* * On the first write verify all the required information * has been setup and initialize any data structures that * had to wait until directory information was set. * Note that a lot of our work is assumed to remain valid * because we disallow any of the important parameters * from changing after we start writing (i.e. once * TIFF_BEENWRITING is set, TIFFSetField will only allow * the image's length to be changed). */ if !(*(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromInt32(FIELD_IMAGEDIMENSIONS)/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<(libc.Int32FromInt32(FIELD_IMAGEDIMENSIONS)&libc.Int32FromInt32(0x1f))) != 0) { XTIFFErrorExtR(tls, tif, module, __ccgo_ts+47516, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_p == libc.UintptrFromInt32(0) && !(XTIFFSetupStrips(tls, tif) != 0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_nstrips = uint32(0) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v2 = __ccgo_ts + 22575 } else { v2 = __ccgo_ts + 22569 } XTIFFErrorExtR(tls, tif, module, __ccgo_ts+47558, libc.VaList(bp+8, v2)) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize = XTIFFTileSize(tls, tif) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize == 0 { return 0 } } else { (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize = -libc.Int32FromInt32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize = XTIFFScanlineSize(tls, tif) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize == 0 { return 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00040) if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_tag) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_count == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripoffset_entry.Ftdir_type) == 0 && *(*Tuint64_t)(unsafe.Pointer(tif + 56 + 144 + 16)) == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_tag) != 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_count == uint64(0) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_stripbytecount_entry.Ftdir_type) == 0 && *(*Tuint64_t)(unsafe.Pointer(tif + 56 + 176 + 16)) == uint64(0) && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00008) != 0) { XTIFFForceStrileArrayWriting(tls, tif) } return int32(1) } // C documentation // // /* // * Setup the raw data buffer used for encoding. // */ func XTIFFWriteBufferSetup(tls *libc.TLS, tif uintptr, bp uintptr, size Ttmsize_t) (r int32) { var v1 int32 _ = v1 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata != 0 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00200) != 0 { X_TIFFfreeExt(tls, tif, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00200) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = libc.UintptrFromInt32(0) } if size == -libc.Int32FromInt32(1) { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v1 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize } else { v1 = XTIFFStripSize(tls, tif) } size = v1 /* Adds 10% margin for cases where compression would expand a bit */ if size < libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))-size/int32(10) { size += size / int32(10) } /* * Make raw data buffer at least 8K */ if size < libc.Int32FromInt32(8)*libc.Int32FromInt32(1024) { size = libc.Int32FromInt32(8) * libc.Int32FromInt32(1024) } bp = libc.UintptrFromInt32(0) /* NB: force malloc */ } if bp == libc.UintptrFromInt32(0) { bp = X_TIFFmallocExt(tls, tif, size) if bp == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module111)), __ccgo_ts+47581, 0) return 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00200) } else { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x00200) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata = bp (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize = size (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00010) return int32(1) } var _module111 = [21]uint8{'T', 'I', 'F', 'F', 'W', 'r', 'i', 't', 'e', 'B', 'u', 'f', 'f', 'e', 'r', 'S', 'e', 't', 'u', 'p'} // C documentation // // /* // * Grow the strip data structures by delta strips. // */ func _TIFFGrowStrips(tls *libc.TLS, tif uintptr, delta Tuint32_t, module uintptr) (r int32) { var new_stripbytecount, new_stripoffset, td uintptr _, _, _ = new_stripbytecount, new_stripoffset, td td = tif + 56 new_stripoffset = X_TIFFreallocExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p, libc.Int32FromUint32(((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips+delta)*uint32(8))) new_stripbytecount = X_TIFFreallocExt(tls, tif, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p, libc.Int32FromUint32(((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips+delta)*uint32(8))) if new_stripoffset == libc.UintptrFromInt32(0) || new_stripbytecount == libc.UintptrFromInt32(0) { if new_stripoffset != 0 { X_TIFFfreeExt(tls, tif, new_stripoffset) } if new_stripbytecount != 0 { X_TIFFfreeExt(tls, tif, new_stripbytecount) } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips = uint32(0) XTIFFErrorExtR(tls, tif, module, __ccgo_ts+47608, 0) return 0 } (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p = new_stripoffset (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p = new_stripbytecount X_TIFFmemset(tls, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p+uintptr((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips)*8, 0, libc.Int32FromUint32(delta*uint32(8))) X_TIFFmemset(tls, (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p+uintptr((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_nstrips)*8, 0, libc.Int32FromUint32(delta*uint32(8))) *(*Tuint32_t)(unsafe.Pointer(td + 128)) += delta *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00008) return int32(1) } // C documentation // // /* // * Append the data to the specified strip. // */ func _TIFFAppendToStrip(tls *libc.TLS, tif uintptr, strip Tuint32_t, data uintptr, cc Ttmsize_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var m, offsetRead, offsetWrite, toCopy Tuint64_t var old_byte_count Tint64_t var td, temp uintptr var tempSize Ttmsize_t _, _, _, _, _, _, _, _ = m, offsetRead, offsetWrite, old_byte_count, td, temp, tempSize, toCopy td = tif + 56 old_byte_count = int64(-int32(1)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff == uint64(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastvalidoff = uint64(0) } if *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8)) == uint64(0) || (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff == uint64(0) { if *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) != uint64(0) && *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8)) != uint64(0) && *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) >= libc.Uint64FromInt32(cc) { /* * There is already tile data on disk, and the new tile * data we have will fit in the same space. The only * aspect of this that is risky is that there could be * more data to append to this strip before we are done * depending on how we are getting called. */ if !(X_TIFFSeekOK(tls, tif, *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8))) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module112)), __ccgo_ts+47640, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row)) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastvalidoff = *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8)) + *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) } else { /* * Seek to end of file, and set that as our location to * write this strip. */ *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8)) = (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(0)), int32(2)) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x200000) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8)) /* * We are starting a fresh strip/tile, so set the size to zero. */ old_byte_count = libc.Int64FromUint64(*(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8))) *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) = uint64(0) } m = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff + libc.Uint64FromInt32(cc) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) { m = uint64(uint32(m)) } if m < (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff || m < libc.Uint64FromInt32(cc) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module112)), __ccgo_ts+34792, 0) return 0 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastvalidoff != uint64(0) && m > (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastvalidoff && *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) > uint64(0) { toCopy = *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) if toCopy < libc.Uint64FromInt32(libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024)) { tempSize = libc.Int32FromUint64(toCopy) } else { tempSize = libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) } offsetRead = *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8)) offsetWrite = (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, libc.Uint64FromInt32(libc.Int32FromInt32(0)), int32(2)) m = offsetWrite + toCopy + libc.Uint64FromInt32(cc) if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x80000) != 0) && m != uint64(uint32(m)) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module112)), __ccgo_ts+34792, 0) return 0 } temp = X_TIFFmallocExt(tls, tif, tempSize) if temp == libc.UintptrFromInt32(0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module112)), __ccgo_ts+47581, 0) return 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x200000) *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripoffset_p + uintptr(strip)*8)) = offsetWrite *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) = uint64(0) /* Move data written by previous calls to us at end of file */ for toCopy > uint64(0) { if !(X_TIFFSeekOK(tls, tif, offsetRead) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module112)), __ccgo_ts+47667, 0) X_TIFFfreeExt(tls, tif, temp) return 0 } if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, temp, tempSize) == tempSize) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module112)), __ccgo_ts+47678, 0) X_TIFFfreeExt(tls, tif, temp) return 0 } if !(X_TIFFSeekOK(tls, tif, offsetWrite) != 0) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module112)), __ccgo_ts+47667, 0) X_TIFFfreeExt(tls, tif, temp) return 0 } if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, temp, tempSize) == tempSize) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module112)), __ccgo_ts+47690, 0) X_TIFFfreeExt(tls, tif, temp) return 0 } offsetRead += libc.Uint64FromInt32(tempSize) offsetWrite += libc.Uint64FromInt32(tempSize) *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) += libc.Uint64FromInt32(tempSize) toCopy -= libc.Uint64FromInt32(tempSize) } X_TIFFfreeExt(tls, tif, temp) /* Append the data of this call */ offsetWrite += libc.Uint64FromInt32(cc) m = offsetWrite } if !((*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_writeproc})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, data, cc) == cc) { XTIFFErrorExtR(tls, tif, uintptr(unsafe.Pointer(&_module112)), __ccgo_ts+47703, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row)) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = m *(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8)) += libc.Uint64FromInt32(cc) if libc.Int64FromUint64(*(*Tuint64_t)(unsafe.Pointer((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_stripbytecount_p + uintptr(strip)*8))) != old_byte_count { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x200000) } return int32(1) } var _module112 = [18]uint8{'T', 'I', 'F', 'F', 'A', 'p', 'p', 'e', 'n', 'd', 'T', 'o', 'S', 't', 'r', 'i', 'p'} // C documentation // // /* // * Internal version of TIFFFlushData that can be // * called by ``encodestrip routines'' w/o concern // * for infinite recursion. // */ func XTIFFFlushData1(tls *libc.TLS, tif uintptr) (r int32) { var v1 uint32 _ = v1 if (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc > 0 && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x100000) != 0 { if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_fillorder) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00100) == uint32(0) { XTIFFReverseBits(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v1 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curtile } else { v1 = (*TTIFF)(unsafe.Pointer(tif)).Ftif_curstrip } if !(_TIFFAppendToStrip(tls, tif, v1, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) != 0) { /* We update those variables even in case of error since there's */ /* code that doesn't really check the return code of this */ /* function */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata } return int32(1) } // C documentation // // /* // * Set the current write offset. This should only be // * used to set the offset to a known previous location // * (very carefully), or to 0 so that the next write gets // * appended to the end of the file. // */ func XTIFFSetWriteOffset(tls *libc.TLS, tif uintptr, off Ttoff_t) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_curoff = off (*TTIFF)(unsafe.Pointer(tif)).Ftif_lastvalidoff = uint64(0) } const PACKAGE_NAME10 = "tkimgpcx" const PACKAGE_STRING10 = "tkimgpcx 2.0.1" const PACKAGE_TARNAME10 = "tkimgpcx" const PACKAGE_TCLNAME7 = "img::pcx" const PACKAGE_VERSION4 = "2.0.1" var _sImageFormatVersion33 = TTk_PhotoImageFormatVersion3{ Fname: __ccgo_ts + 47731, } func init() { p := unsafe.Pointer(&_sImageFormatVersion33) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatchVersion33) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatchVersion33) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileReadVersion33) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringReadVersion33) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWriteVersion33) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWriteVersion33) } /* *---------------------------------------------------------------------------- * * Tkimgpcx_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgpcx_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<>libc.Int32FromInt32(8)) } else { return x } return r } /* Read 1 byte, representing an unsigned integer number. */ /* Use this macro for better performance, esp. when reading RLE files. */ /* Write 1 byte, representing an unsigned integer to a file. */ func _writeUByte1(tls *libc.TLS, handle uintptr, b TUByte) (r TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [1]TUByte (*(*[1]TUByte)(unsafe.Pointer(bp)))[0] = b if int32(1) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, int32(1)) { return uint8(FALSE) } return uint8(TRUE) } func _read_pcx_header(tls *libc.TLS, ifp uintptr, pcxhdr uintptr) (r TBoln) { if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, ifp, pcxhdr, int32(128)) != int32(128) { return uint8(FALSE) } if libc.Int32FromUint8((*TPCXHEADER)(unsafe.Pointer(pcxhdr)).Fmanufacturer) != int32(10) { return uint8(FALSE) } if libc.Int32FromUint8((*TPCXHEADER)(unsafe.Pointer(pcxhdr)).Fbpp) != int32(1) && libc.Int32FromUint8((*TPCXHEADER)(unsafe.Pointer(pcxhdr)).Fbpp) != int32(8) { return uint8(FALSE) } if libc.Int32FromUint8((*TPCXHEADER)(unsafe.Pointer(pcxhdr)).Fplanes) != int32(1) && libc.Int32FromUint8((*TPCXHEADER)(unsafe.Pointer(pcxhdr)).Fplanes) != int32(3) && libc.Int32FromUint8((*TPCXHEADER)(unsafe.Pointer(pcxhdr)).Fplanes) != int32(4) { return uint8(FALSE) } return uint8(TRUE) } func _printImgInfo6(tls *libc.TLS, ph uintptr, fileName uintptr, msg uintptr) { bp := tls.Alloc(288) defer tls.Free(288) var hdpi, vdpi TShort var height, width TInt var outChan TTcl_Channel var v1 uintptr var _ /* str at bp+0 */ [256]uint8 _, _, _, _, _, _ = hdpi, height, outChan, vdpi, width, v1 outChan = (*(*func(*libc.TLS, int32) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStdChannel})))(tls, libc.Int32FromInt32(1)<= srcY { if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = uint8(FALSE) break } outY++ } goto _1 _1: ; y++ } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) return result } func _load_1(tls *libc.TLS, interp uintptr, ifp uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, fileWidth int32, fileHeight int32, bytesPerLine int32, compr int32) (r TBoln) { bp := tls.Alloc(64) defer tls.Free(64) var buffer, line uintptr var outY, stopY, x, y TInt var result TBoln var _ /* block at bp+0 */ TTk_PhotoImageBlock _, _, _, _, _, _, _ = buffer, line, outY, result, stopY, x, y result = uint8(TRUE) line = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(fileWidth)) buffer = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(fileWidth*int32(1))) if line == libc.UintptrFromInt32(0) || buffer == libc.UintptrFromInt32(0) { if line != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) } if buffer != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) } (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+48, __ccgo_ts+896, libc.UintptrFromInt32(0))) return uint8(FALSE) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = int32(1) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = fileWidth * int32(1) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = width (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) *(*int32)(unsafe.Pointer(bp + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = 0 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = buffer + uintptr(srcX*int32(1)) stopY = srcY + height outY = destY y = 0 for { if !(y < stopY) { break } if !(_readline(tls, ifp, line, bytesPerLine, compr) != 0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) return uint8(FALSE) } x = 0 for { if !(x < fileWidth) { break } if libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(line + uintptr(x/int32(8)))))&(int32(128)>>(x%int32(8))) != 0 { *(*TUByte)(unsafe.Pointer(buffer + uintptr(x))) = uint8(255) } else { *(*TUByte)(unsafe.Pointer(buffer + uintptr(x))) = uint8(0) } goto _2 _2: ; x++ } if y >= srcY { if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = uint8(FALSE) break } outY++ } goto _1 _1: ; y++ } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) return result } func _ParseFormatOpts6(tls *libc.TLS, interp uintptr, format uintptr, opts uintptr, mode int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var i, v2, v3 TTcl_Size var optionStr uintptr var _ /* boolVal at bp+12 */ int32 var _ /* doubleVal at bp+16 */ float64 var _ /* index at bp+4 */ int32 var _ /* objc at bp+0 */ TTcl_Size var _ /* objv at bp+8 */ uintptr _, _, _, _ = i, optionStr, v2, v3 /* Initialize options with default values. */ (*TFMTOPT6)(unsafe.Pointer(opts)).Fverbose = uint8(0) (*TFMTOPT6)(unsafe.Pointer(opts)).Fcompression = int32(1) (*TFMTOPT6)(unsafe.Pointer(opts)).Fxres = libc.Float64FromInt32(IMG_DEFAULT_DPI) (*TFMTOPT6)(unsafe.Pointer(opts)).Fyres = libc.Float64FromInt32(IMG_DEFAULT_DPI) if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ListObjGetElementsPtr})))(tls, interp, format, bp, bp+8) == int32(TCL_ERROR) { return int32(TCL_ERROR) } i = int32(1) for { if !(i < *(*TTcl_Size)(unsafe.Pointer(bp))) { break } if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+32, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { /* No more parameters available. */ break } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i+int32(1))*4)), libc.UintptrFromInt32(0)) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(optionStr))) == int32('-') { /* Next parameter is an option. */ break } if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+32, __ccgo_ts+836, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT6)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 16)) i++ case 3: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+32, __ccgo_ts+807, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT6)(unsafe.Pointer(opts)).Fxres = *(*float64)(unsafe.Pointer(bp + 16)) case 4: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+32, __ccgo_ts+836, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT6)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 16)) break } } goto _1 _1: ; i++ } return TCL_OK } var _readOptions6 = [2]uintptr{ 0: __ccgo_ts + 641, 1: libc.UintptrFromInt32(0), } var _writeOptions4 = [6]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 47998, 2: __ccgo_ts + 650, 3: __ccgo_ts + 662, 4: __ccgo_ts + 675, 5: libc.UintptrFromInt32(0), } func _FileMatchVersion33(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(176) defer tls.Free(176) var retVal int32 var _ /* handle at bp+128 */ Ttkimg_Stream var _ /* ph at bp+0 */ TPCXHEADER _ = retVal libc.Xmemset(tls, bp+128, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp+128, chan1) retVal = _CommonMatch5(tls, bp+128, widthPtr, heightPtr, bp) if retVal != 0 && libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fhdpi))) > 0 && libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fvdpi))) > 0 { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, float64(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fhdpi))), float64(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fvdpi)))) { return 0 } } return retVal } func _StringMatchVersion33(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(176) defer tls.Free(176) var retVal int32 var _ /* handle at bp+128 */ Ttkimg_Stream var _ /* ph at bp+0 */ TPCXHEADER _ = retVal libc.Xmemset(tls, bp+128, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp+128, dataObj) != 0) { return 0 } retVal = _CommonMatch5(tls, bp+128, widthPtr, heightPtr, bp) if retVal != 0 && libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fhdpi))) > 0 && libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fvdpi))) > 0 { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, float64(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fhdpi))), float64(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fvdpi)))) { return 0 } } return retVal } func _CommonMatch5(tls *libc.TLS, handle uintptr, widthPtr uintptr, heightPtr uintptr, pcxHeaderPtr uintptr) (r int32) { bp := tls.Alloc(128) defer tls.Free(128) var offset_x, offset_y TInt var _ /* ph at bp+0 */ TPCXHEADER _, _ = offset_x, offset_y if !(_read_pcx_header(tls, handle, bp) != 0) { return 0 } offset_x = libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fx1))) offset_y = libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fy1))) if offset_x < 0 || offset_y < 0 { return 0 } *(*int32)(unsafe.Pointer(widthPtr)) = libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fx2))) - offset_x + int32(1) *(*int32)(unsafe.Pointer(heightPtr)) = libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp))).Fy2))) - offset_y + int32(1) if *(*int32)(unsafe.Pointer(widthPtr)) < int32(1) || *(*int32)(unsafe.Pointer(heightPtr)) < int32(1) { return 0 } if pcxHeaderPtr != 0 { *(*TPCXHEADER)(unsafe.Pointer(pcxHeaderPtr)) = *(*TPCXHEADER)(unsafe.Pointer(bp)) } return int32(1) } func _FileReadVersion33(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonRead6(tls, interp, bp, fileName, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) } func _StringReadVersion33(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonRead6(tls, interp, bp, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) } func _CommonRead6(tls *libc.TLS, interp uintptr, handle uintptr, fileName uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(448) defer tls.Free(448) var hdpi, vdpi TShort var outHeight, outWidth, retCode int32 var _ /* errMsg at bp+160 */ [256]uint8 var _ /* fileHeight at bp+4 */ int32 var _ /* fileWidth at bp+0 */ int32 var _ /* opts at bp+136 */ TFMTOPT6 var _ /* ph at bp+8 */ TPCXHEADER _, _, _, _, _ = hdpi, outHeight, outWidth, retCode, vdpi retCode = TCL_OK if _ParseFormatOpts6(tls, interp, format, bp+136, libc.Int32FromInt32(1)< *(*int32)(unsafe.Pointer(bp)) { outWidth = *(*int32)(unsafe.Pointer(bp)) - srcX } else { outWidth = width } if srcY+height > *(*int32)(unsafe.Pointer(bp + 4)) { outHeight = *(*int32)(unsafe.Pointer(bp + 4)) - srcY } else { outHeight = height } if outWidth <= 0 || outHeight <= 0 || srcX >= *(*int32)(unsafe.Pointer(bp)) || srcY >= *(*int32)(unsafe.Pointer(bp + 4)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+424, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+outWidth, destY+outHeight) == int32(TCL_ERROR) { return int32(TCL_ERROR) } if (*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fcompression != 0 { (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, int32(1)) } hdpi = libc.Int16FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fhdpi))) vdpi = libc.Int16FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fvdpi))) if int32(hdpi) > 0 && int32(vdpi) > 0 { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, float64(hdpi), float64(vdpi)) { return int32(TCL_ERROR) } } if libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fplanes) == int32(1) && libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fbpp) == int32(1) { if !(_load_1(tls, interp, handle, imageHandle, destX, destY, outWidth, outHeight, srcX, srcY, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fbytesperline))), libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fcompression)) != 0) { retCode = int32(TCL_ERROR) } } else { if libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fplanes) == int32(4) && libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fbpp) == int32(1) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+424, __ccgo_ts+48067, __ccgo_ts+48107, libc.UintptrFromInt32(0))) retCode = int32(TCL_ERROR) } else { if libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fplanes) == int32(1) && libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fbpp) == int32(8) { if !(_load_8(tls, interp, handle, imageHandle, destX, destY, outWidth, outHeight, srcX, srcY, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fbytesperline))), libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fcompression)) != 0) { retCode = int32(TCL_ERROR) } } else { if libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fplanes) == int32(3) && libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fbpp) == int32(8) { if !(_load_24(tls, interp, handle, imageHandle, destX, destY, outWidth, outHeight, srcX, srcY, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), libc.Int32FromUint16(_qtohs(tls, libc.Uint16FromInt16((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fbytesperline))), libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fcompression)) != 0) { retCode = int32(TCL_ERROR) } } else { libc.X__builtin_snprintf(tls, bp+160, uint32(256), __ccgo_ts+48129, libc.VaList(bp+424, libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fplanes), libc.Int32FromUint8((*(*TPCXHEADER)(unsafe.Pointer(bp + 8))).Fbpp))) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+424, bp+160, libc.UintptrFromInt32(0))) retCode = int32(TCL_ERROR) } } } } (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, 0) return retCode } func _FileWriteVersion33(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, fileName, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite4(tls, interp, fileName, format, bp, blockPtr, metadataIn) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } func _StringWriteVersion33(tls *libc.TLS, interp uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = result libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp) result = _CommonWrite4(tls, interp, __ccgo_ts+865, format, bp, blockPtr, metadataIn) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp))).FbyteObj) } return result } func _CommonWrite4(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, handle uintptr, blockPtr uintptr, metadataIn uintptr) (r int32) { bp := tls.Alloc(448) defer tls.Free(448) var alphaOffset, blueOffset, greenOffset, nBytes, nchan, redOffset, x, y, v1 int32 var pixRowPtr, pixelPtr, row uintptr var _ /* errMsg at bp+168 */ [256]uint8 var _ /* opts at bp+144 */ TFMTOPT6 var _ /* ph at bp+16 */ TPCXHEADER var _ /* xdpi at bp+0 */ float64 var _ /* ydpi at bp+8 */ float64 _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, greenOffset, nBytes, nchan, pixRowPtr, pixelPtr, redOffset, row, x, y, v1 if _ParseFormatOpts6(tls, interp, format, bp+144, libc.Int32FromInt32(1)<interp->result. * * Side effects: * Existing instances of the image will be redisplayed to match * the new configuration options. * * If any error occurs, the state of *masterPtr is restored to * previous state. * *---------------------------------------------------------------------- */ func _TkimgXpmConfigureMaster(tls *libc.TLS, masterPtr uintptr, objc int32, objv uintptr, flags int32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var instancePtr, oldData, oldFile uintptr _, _, _ = instancePtr, oldData, oldFile oldData = (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FdataString oldFile = (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FfileString if (*(*func(*libc.TLS, uintptr, TTk_Window, uintptr, TTcl_Size, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_ConfigureWidget})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Finterp, (*(*func(*libc.TLS, uintptr) TTk_Window)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_MainWindow})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Finterp), uintptr(unsafe.Pointer(&_configSpecs)), objc, objv, masterPtr, flags|int32(TK_CONFIG_OBJS1)) != TCL_OK { return int32(TCL_ERROR) } if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FdataString != libc.UintptrFromInt32(0) || (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FfileString != libc.UintptrFromInt32(0) { if _TkimgXpmGetData(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Finterp, masterPtr) != TCL_OK { goto error } } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Finterp, libc.VaList(bp+8, __ccgo_ts+48304, libc.UintptrFromInt32(0))) goto error } /* * Cycle through all of the instances of this image, regenerating * the information for each instance. Then force the image to be * redisplayed everywhere that it is used. */ instancePtr = (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FinstancePtr for { if !(instancePtr != libc.UintptrFromInt32(0)) { break } _TkimgXpmConfigureInstance(tls, instancePtr) goto _1 _1: ; instancePtr = (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FnextPtr } if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata != 0 { (*(*func(*libc.TLS, TTk_ImageModel, int32, int32, int32, int32, int32, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_ImageChanged})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FtkMaster, 0, 0, *(*int32)(unsafe.Pointer(masterPtr + 20)), *(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4)), *(*int32)(unsafe.Pointer(masterPtr + 20)), *(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4))) } else { (*(*func(*libc.TLS, TTk_ImageModel, int32, int32, int32, int32, int32, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_ImageChanged})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FtkMaster, 0, 0, 0, 0, 0, 0) } return TCL_OK goto error error: ; /* Restore it to the original (possible valid) mode */ if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FdataString != 0 && (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FdataString != oldData { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FdataString) } if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FfileString != 0 && (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FfileString != oldFile { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FfileString) } (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FdataString = oldData (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FfileString = oldFile return int32(TCL_ERROR) } /* *---------------------------------------------------------------------- * * TkimgXpmGetData -- * * Given a file name or ASCII string, this procedure parses the * file or string contents to produce binary data for a pixmap. * * Results: * If the pixmap description was parsed successfully then the data * is read into an array of strings. This array will later be used * to create X Pixmaps for each instance. * * Side effects: * The masterPtr->data array is allocated when successful. Contents of * *masterPtr is changed only when successful. *---------------------------------------------------------------------- */ func _TkimgXpmGetData(tls *libc.TLS, interp uintptr, masterPtr uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var code, isAllocated int32 var data uintptr var _ /* cpp at bp+24 */ int32 var _ /* listArgc at bp+0 */ TTcl_Size var _ /* listArgv at bp+4 */ uintptr var _ /* ncolors at bp+28 */ int32 var _ /* numLines at bp+8 */ int32 var _ /* size at bp+16 */ [2]int32 _, _, _ = code, data, isAllocated data = libc.UintptrFromInt32(0) isAllocated = 0 *(*uintptr)(unsafe.Pointer(bp + 4)) = libc.UintptrFromInt32(0) code = TCL_OK if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FfileString != libc.UintptrFromInt32(0) { if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_IsSafe})))(tls, interp) != 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+48339, __ccgo_ts+48372, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } data = _TkimgXpmGetDataFromFile(tls, interp, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FfileString, bp+8) isAllocated = int32(1) } else { if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FdataString != libc.UintptrFromInt32(0) { data = _TkimgXpmGetDataFromString(tls, interp, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FdataString, bp+8) isAllocated = int32(1) } else { /* Should have been enforced by TkimgXpmConfigureMaster() */ (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Panic})))(tls, __ccgo_ts+48390, 0) } } if data == libc.UintptrFromInt32(0) { /* nothing has been allocated yet. Don't need to goto done */ return int32(TCL_ERROR) } /* Parse the first line of the data and get info about this pixmap */ if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SplitList})))(tls, interp, *(*uintptr)(unsafe.Pointer(data)), bp, bp+4) != TCL_OK { code = int32(TCL_ERROR) goto done } if *(*TTcl_Size)(unsafe.Pointer(bp)) < int32(4) { /* file format error */ code = int32(TCL_ERROR) goto done } if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetInt})))(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)))), bp+16) != TCL_OK { code = int32(TCL_ERROR) goto done } if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetInt})))(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + 1*4)), bp+16+1*4) != TCL_OK { code = int32(TCL_ERROR) goto done } if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetInt})))(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + 2*4)), bp+28) != TCL_OK { code = int32(TCL_ERROR) goto done } if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetInt})))(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + 3*4)), bp+24) != TCL_OK { code = int32(TCL_ERROR) goto done } if isAllocated != 0 { if *(*int32)(unsafe.Pointer(bp + 8)) != (*(*[2]int32)(unsafe.Pointer(bp + 16)))[int32(1)]+*(*int32)(unsafe.Pointer(bp + 28))+int32(1) { /* the number of lines read from the file/data * is not the same as specified in the data */ code = int32(TCL_ERROR) goto done } } goto done done: ; if code == TCL_OK { if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FisDataAlloced != 0 && (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata) } (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FisDataAlloced = isAllocated (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata = data *(*int32)(unsafe.Pointer(masterPtr + 20)) = (*(*[2]int32)(unsafe.Pointer(bp + 16)))[0] *(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4)) = (*(*[2]int32)(unsafe.Pointer(bp + 16)))[int32(1)] (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fcpp = *(*int32)(unsafe.Pointer(bp + 24)) (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fncolors = *(*int32)(unsafe.Pointer(bp + 28)) } else { if isAllocated != 0 && data != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, data) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ResetResult})))(tls, interp) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+48438, libc.UintptrFromInt32(0))) } if *(*uintptr)(unsafe.Pointer(bp + 4)) != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) } return code } func _TkimgXpmGetDataFromString(tls *libc.TLS, interp uintptr, string1 uintptr, numLines_return uintptr) (r uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var list, p, v5, v6, v7, v8, v9 uintptr var quoted, v1, v11, v12, v2 int32 var _ /* data at bp+4 */ uintptr var _ /* numLines at bp+0 */ TTcl_Size _, _, _, _, _, _, _, _, _, _, _, _ = list, p, quoted, v1, v11, v12, v2, v5, v6, v7, v8, v9 /* skip the leading blanks (leading blanks are not defined in the * the XPM definition, but skipping them shouldn't hurt. Also, the ability * to skip the leading blanks is good for using in-line XPM data in TCL * scripts */ for { v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(string1))) v2 = libc.BoolInt32(v1 == int32(' ') || libc.Uint32FromInt32(v1)-uint32('\t') < uint32(5)) goto _3 _3: if !(v2 != 0) { break } string1++ } /* parse the header */ if libc.Xstrncmp(tls, __ccgo_ts+48456, string1, uint32(6)) != 0 { goto error } /* strip the comments */ quoted = 0 p = string1 for { if !(*(*uint8)(unsafe.Pointer(p)) != 0) { break } if !(quoted != 0) { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('"') { quoted = int32(1) p++ goto _4 } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('/') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + libc.UintptrFromInt32(1)))) == int32('*') { v5 = p p++ *(*uint8)(unsafe.Pointer(v5)) = uint8(' ') v6 = p p++ *(*uint8)(unsafe.Pointer(v6)) = uint8(' ') for int32(1) != 0 { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == 0 { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('*') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + libc.UintptrFromInt32(1)))) == int32('/') { v7 = p p++ *(*uint8)(unsafe.Pointer(v7)) = uint8(' ') v8 = p p++ *(*uint8)(unsafe.Pointer(v8)) = uint8(' ') break } v9 = p p++ *(*uint8)(unsafe.Pointer(v9)) = uint8(' ') } goto _4 } p++ } else { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('"') { quoted = 0 } p++ } goto _4 _4: } /* Search for the opening brace */ p = string1 for { if !(*(*uint8)(unsafe.Pointer(p)) != 0) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('{') { p++ } else { p++ break } goto _10 _10: } /* Change the buffer in to a proper TCL list */ quoted = 0 list = p for *(*uint8)(unsafe.Pointer(p)) != 0 { if !(quoted != 0) { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('"') { quoted = int32(1) p++ continue } v11 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) v12 = libc.BoolInt32(v11 == int32(' ') || libc.Uint32FromInt32(v11)-uint32('\t') < uint32(5)) goto _13 _13: if v12 != 0 { *(*uint8)(unsafe.Pointer(p)) = uint8(' ') } else { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(',') { *(*uint8)(unsafe.Pointer(p)) = uint8(' ') } else { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('}') { *(*uint8)(unsafe.Pointer(p)) = uint8(0) break } } } p++ } else { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('"') { quoted = 0 } p++ } } /* The following code depends on the fact that Tcl_SplitList * strips away double quoates inside a list: ie: * if string == "\"1\" \"2\"" then * list[0] = "1" * list[1] = "2" * and NOT * * list[0] = "\"1\"" * list[1] = "\"2\"" */ if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SplitList})))(tls, interp, list, bp, bp+4) != TCL_OK { goto error } else { if *(*TTcl_Size)(unsafe.Pointer(bp)) == 0 { /* error: empty data? */ if *(*uintptr)(unsafe.Pointer(bp + 4)) != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, *(*uintptr)(unsafe.Pointer(bp + 4))) goto error } } *(*int32)(unsafe.Pointer(numLines_return)) = *(*TTcl_Size)(unsafe.Pointer(bp)) return *(*uintptr)(unsafe.Pointer(bp + 4)) } goto error error: ; (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+16, __ccgo_ts+48438, libc.UintptrFromInt32(0))) return libc.UintptrFromInt32(0) } func _TkimgXpmGetDataFromFile(tls *libc.TLS, interp uintptr, fileName uintptr, numLines_return uintptr) (r uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var cmdBuffer, data uintptr var size int32 _, _, _, _ = chan1, cmdBuffer, data, size data = libc.UintptrFromInt32(0) cmdBuffer = libc.UintptrFromInt32(0) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, fileName, __ccgo_ts+48463) if !(chan1 != 0) { return libc.UintptrFromInt32(0) } size = int32((*(*func(*libc.TLS, TTcl_Channel, int64, int32) int64)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Seek})))(tls, chan1, 0, int32(2))) if size > 0 { (*(*func(*libc.TLS, TTcl_Channel, int64, int32) int64)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Seek})))(tls, chan1, 0, 0) cmdBuffer = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(size+int32(1))) if cmdBuffer == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+48465, libc.UintptrFromInt32(0))) goto error } size = (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, chan1, cmdBuffer, size) } if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) != TCL_OK { goto error } if size < 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, fileName, __ccgo_ts+48511, (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_PosixError})))(tls, interp), libc.UintptrFromInt32(0))) goto error } *(*uint8)(unsafe.Pointer(cmdBuffer + uintptr(size))) = uint8(0) data = _TkimgXpmGetDataFromString(tls, interp, cmdBuffer, numLines_return) goto error error: ; if cmdBuffer != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, cmdBuffer) } return data } func _GetType(tls *libc.TLS, colorDefn uintptr, type_ret uintptr) (r uintptr) { var p uintptr var v1, v10, v13, v14, v17, v18, v2, v21, v22, v5, v6, v9 int32 var v12, v16, v20, v24, v4, v8 bool _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = p, v1, v10, v12, v13, v14, v16, v17, v18, v2, v20, v21, v22, v24, v4, v5, v6, v8, v9 p = colorDefn /* skip white spaces */ for { if v4 = *(*uint8)(unsafe.Pointer(p)) != 0; v4 { v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) v2 = libc.BoolInt32(v1 == int32(' ') || libc.Uint32FromInt32(v1)-uint32('\t') < uint32(5)) goto _3 _3: } if !(v4 && v2 != 0) { break } p++ } /* parse the type */ if v8 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('m') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) != int32('\000'); v8 { v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) v6 = libc.BoolInt32(v5 == int32(' ') || libc.Uint32FromInt32(v5)-uint32('\t') < uint32(5)) goto _7 _7: } if v8 && v6 != 0 { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_MONO) p += uintptr(2) } else { if v12 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('g') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32('4') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) != int32('\000'); v12 { v9 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) v10 = libc.BoolInt32(v9 == int32(' ') || libc.Uint32FromInt32(v9)-uint32('\t') < uint32(5)) goto _11 _11: } if v12 && v10 != 0 { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_GRAY_4) p += uintptr(3) } else { if v16 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('g') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) != int32('\000'); v16 { v13 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) v14 = libc.BoolInt32(v13 == int32(' ') || libc.Uint32FromInt32(v13)-uint32('\t') < uint32(5)) goto _15 _15: } if v16 && v14 != 0 { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_GRAY) p += uintptr(2) } else { if v20 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('c') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) != int32('\000'); v20 { v17 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) v18 = libc.BoolInt32(v17 == int32(' ') || libc.Uint32FromInt32(v17)-uint32('\t') < uint32(5)) goto _19 _19: } if v20 && v18 != 0 { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_COLOR) p += uintptr(2) } else { if v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('s') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) != int32('\000'); v24 { v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) v22 = libc.BoolInt32(v21 == int32(' ') || libc.Uint32FromInt32(v21)-uint32('\t') < uint32(5)) goto _23 _23: } if v24 && v22 != 0 { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_SYMBOLIC) p += uintptr(2) } else { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_UNKNOWN) return libc.UintptrFromInt32(0) } } } } } return p } /* * colorName is guaranteed to be big enough */ func _GetColor(tls *libc.TLS, colorDefn uintptr, colorName uintptr, type_ret uintptr) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var p, v1, v10, v11, v16, v17 uintptr var v12, v13, v2, v3, v6, v7 int32 var v15, v5, v9 bool var _ /* dummy at bp+4 */ int32 var _ /* type at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = p, v1, v10, v11, v12, v13, v15, v16, v17, v2, v3, v5, v6, v7, v9 if !(colorDefn != 0) { return libc.UintptrFromInt32(0) } v1 = _GetType(tls, colorDefn, bp) colorDefn = v1 if v1 == libc.UintptrFromInt32(0) { /* unknown type */ return libc.UintptrFromInt32(0) } else { *(*int32)(unsafe.Pointer(type_ret)) = *(*int32)(unsafe.Pointer(bp)) } /* skip white spaces */ for { if v5 = *(*uint8)(unsafe.Pointer(colorDefn)) != 0; v5 { v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(colorDefn))) v3 = libc.BoolInt32(v2 == int32(' ') || libc.Uint32FromInt32(v2)-uint32('\t') < uint32(5)) goto _4 _4: } if !(v5 && v3 != 0) { break } colorDefn++ } p = colorName for int32(1) != 0 { for { if v9 = *(*uint8)(unsafe.Pointer(colorDefn)) != 0; v9 { v6 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(colorDefn))) v7 = libc.BoolInt32(v6 == int32(' ') || libc.Uint32FromInt32(v6)-uint32('\t') < uint32(5)) goto _8 _8: } if !(v9 && !(v7 != 0)) { break } v10 = p p++ v11 = colorDefn colorDefn++ *(*uint8)(unsafe.Pointer(v10)) = *(*uint8)(unsafe.Pointer(v11)) } if !(*(*uint8)(unsafe.Pointer(colorDefn)) != 0) { break } if _GetType(tls, colorDefn, bp+4) == libc.UintptrFromInt32(0) { /* the next string should also be considered as a part of a color * name */ for { if v15 = *(*uint8)(unsafe.Pointer(colorDefn)) != 0; v15 { v12 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(colorDefn))) v13 = libc.BoolInt32(v12 == int32(' ') || libc.Uint32FromInt32(v12)-uint32('\t') < uint32(5)) goto _14 _14: } if !(v15 && v13 != 0) { break } v16 = p p++ v17 = colorDefn colorDefn++ *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(v17)) } } else { break } if !(*(*uint8)(unsafe.Pointer(colorDefn)) != 0) { break } } /* Mark the end of the colorName */ *(*uint8)(unsafe.Pointer(p)) = uint8('\000') return colorDefn } /*---------------------------------------------------------------------- * TkimgXpmGetPixmapFromData -- * * Creates a pixmap for an image instance. *---------------------------------------------------------------------- */ func _TkimgXpmGetPixmapFromData(tls *libc.TLS, interp uintptr, masterPtr uintptr, instancePtr uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var colorDefn, colorName, colors, p, useName, v3 uintptr var depth, found, i, isMono, j, k, lOffset int32 var _ /* image at bp+0 */ uintptr var _ /* isTransp at bp+8 */ int32 var _ /* mask at bp+4 */ uintptr var _ /* type at bp+12 */ int32 _, _, _, _, _, _, _, _, _, _, _, _, _ = colorDefn, colorName, colors, depth, found, i, isMono, j, k, lOffset, p, useName, v3 *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(bp + 4)) = libc.UintptrFromInt32(0) *(*int32)(unsafe.Pointer(bp + 8)) = 0 depth = (*TTk_FakeWin)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin)).Fdepth switch (*TVisual)(unsafe.Pointer((*TTk_FakeWin)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin)).Fvisual)).Fclass { case StaticGray: fallthrough case int32(GrayScale): isMono = int32(1) default: isMono = 0 } XTkimgXpmAllocTmpBuffer(tls, masterPtr, instancePtr, bp, bp+4) /* * Parse the colors */ lOffset = int32(1) colors = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, uint32(12)*libc.Uint32FromInt32((*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fncolors)) if colors == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+24, __ccgo_ts+48514, libc.UintptrFromInt32(0))) return } /* * Initialize the color structures */ i = 0 for { if !(i < (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fncolors) { break } (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).FcolorPtr = libc.UintptrFromInt32(0) if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fcpp == int32(1) { (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).Fc = uint8(0) } else { (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).Fcstring = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32((*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fcpp)) if (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).Fcstring == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+24, __ccgo_ts+48557, libc.UintptrFromInt32(0))) return } *(*uint8)(unsafe.Pointer((*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).Fcstring)) = uint8(0) } goto _1 _1: ; i++ } i = 0 for { if !(i < (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fncolors) { break } colorDefn = *(*uintptr)(unsafe.Pointer((*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata + uintptr(i+lOffset)*4)) + uintptr((*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fcpp) colorName = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Xstrlen(tls, colorDefn)) useName = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Xstrlen(tls, colorDefn)) if colorName == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+24, __ccgo_ts+48601, libc.UintptrFromInt32(0))) return } if useName == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+24, __ccgo_ts+48601, libc.UintptrFromInt32(0))) return } found = 0 for colorDefn != 0 && *(*uint8)(unsafe.Pointer(colorDefn)) != 0 { v3 = _GetColor(tls, colorDefn, colorName, bp+12) colorDefn = v3 if v3 == libc.UintptrFromInt32(0) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(colorName))) == int32('\000') { continue } switch *(*int32)(unsafe.Pointer(bp + 12)) { case int32(XPM_MONO): if isMono != 0 && depth == int32(1) { libc.Xstrcpy(tls, useName, colorName) found = int32(1) goto gotcolor } case int32(XPM_GRAY_4): if isMono != 0 && depth == int32(4) { libc.Xstrcpy(tls, useName, colorName) found = int32(1) goto gotcolor } case int32(XPM_GRAY): if isMono != 0 && depth > int32(4) { libc.Xstrcpy(tls, useName, colorName) found = int32(1) goto gotcolor } case int32(XPM_COLOR): if !(isMono != 0) { libc.Xstrcpy(tls, useName, colorName) found = int32(1) goto gotcolor } break } if *(*int32)(unsafe.Pointer(bp + 12)) != int32(XPM_SYMBOLIC) && *(*int32)(unsafe.Pointer(bp + 12)) != int32(XPM_UNKNOWN) { if !(found != 0) { /* use this color as default */ libc.Xstrcpy(tls, useName, colorName) found = int32(1) } } } goto gotcolor gotcolor: ; if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fcpp == int32(1) { (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).Fc = *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata + uintptr(i+lOffset)*4)))) } else { libc.Xstrncpy(tls, (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).Fcstring, *(*uintptr)(unsafe.Pointer((*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata + uintptr(i+lOffset)*4)), libc.Uint32FromInt32((*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fcpp)) } if found != 0 { if libc.Xstrncasecmp(tls, useName, __ccgo_ts+2169, uint32(5)) != 0 { (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).FcolorPtr = (*(*func(*libc.TLS, uintptr, TTk_Window, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetColor})))(tls, interp, (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin, (*(*func(*libc.TLS, uintptr) TTk_Uid)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetUid})))(tls, useName)) if (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).FcolorPtr == libc.UintptrFromInt32(0) { (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).FcolorPtr = (*(*func(*libc.TLS, uintptr, TTk_Window, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetColor})))(tls, interp, (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin, (*(*func(*libc.TLS, uintptr) TTk_Uid)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetUid})))(tls, __ccgo_ts+48643)) } } } else { (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(i)*12))).FcolorPtr = (*(*func(*libc.TLS, uintptr, TTk_Window, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetColor})))(tls, interp, (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin, (*(*func(*libc.TLS, uintptr) TTk_Uid)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetUid})))(tls, __ccgo_ts+48643)) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, colorName) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, useName) goto _2 _2: ; i++ } lOffset += (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fncolors /* * Parse the main body of the image */ i = 0 for { if !(i < *(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4))) { break } p = *(*uintptr)(unsafe.Pointer((*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata + uintptr(i+lOffset)*4)) j = 0 for { if !(j < *(*int32)(unsafe.Pointer(masterPtr + 20))) { break } if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fcpp == int32(1) { k = 0 for { if !(k < (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fncolors) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == libc.Int32FromUint8((*(*TColorStruct)(unsafe.Pointer(colors + uintptr(k)*12))).Fc) { XTkimgXpmSetPixel(tls, instancePtr, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)), j, i, (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(k)*12))).FcolorPtr, bp+8) break } goto _6 _6: ; k++ } if *(*uint8)(unsafe.Pointer(p)) != 0 { p++ } } else { k = 0 for { if !(k < (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fncolors) { break } if libc.Xstrncmp(tls, p, (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(k)*12))).Fcstring, libc.Uint32FromInt32((*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fcpp)) == 0 { XTkimgXpmSetPixel(tls, instancePtr, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)), j, i, (*(*TColorStruct)(unsafe.Pointer(colors + uintptr(k)*12))).FcolorPtr, bp+8) break } goto _7 _7: ; k++ } k = 0 for { if !(*(*uint8)(unsafe.Pointer(p)) != 0 && k < (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fcpp) { break } p++ goto _8 _8: ; k++ } } goto _5 _5: ; j++ } goto _4 _4: ; i++ } (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors = colors XTkimgXpmRealizePixmap(tls, masterPtr, instancePtr, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)), *(*int32)(unsafe.Pointer(bp + 8))) XTkimgXpmFreeTmpBuffer(tls, masterPtr, instancePtr, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4))) } /* *---------------------------------------------------------------------- * * TkimgXpmConfigureInstance -- * * This procedure is called to create displaying information for * a pixmap image instance based on the configuration information * in the master. It is invoked both when new instances are * created and when the master is reconfigured. * * Results: * None. * * Side effects: * Generates errors via Tk_BackgroundError if there are problems * in setting up the instance. * *---------------------------------------------------------------------- */ func _TkimgXpmConfigureInstance(tls *libc.TLS, instancePtr uintptr) { var i int32 var masterPtr uintptr _, _ = i, masterPtr masterPtr = (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FmasterPtr if (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fpixmap != uint32(0) { (*(*func(*libc.TLS, uintptr, TPixmap))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_FreePixmap})))(tls, (*TTk_FakeWin)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin)).Fdisplay, (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fpixmap) } XTkimgXpmFreeInstanceData(tls, instancePtr, 0) if (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors != libc.UintptrFromInt32(0) { i = 0 for { if !(i < (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fncolors) { break } if (*(*TColorStruct)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors + uintptr(i)*12))).FcolorPtr != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_FreeColor})))(tls, (*(*TColorStruct)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors + uintptr(i)*12))).FcolorPtr) } if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fcpp != int32(1) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*(*TColorStruct)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors + uintptr(i)*12))).Fcstring) } goto _1 _1: ; i++ } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors) } if (*TTk_FakeWin)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin)).Fwindow == uint32(0) { (*(*func(*libc.TLS, TTk_Window))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_MakeWindowExist})))(tls, (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin) } /* * Assumption: masterPtr->data is always non NULL (enforced by * TkimgXpmConfigureMaster()). Also, the data must be in a valid * format (partially enforced by TkimgXpmConfigureMaster(), see comments * inside that function). */ _TkimgXpmGetPixmapFromData(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Finterp, masterPtr, instancePtr) } /* *-------------------------------------------------------------- * * TkimgXpmObjCmd -- * * This procedure is invoked to process the Tcl command * that corresponds to an image managed by this module. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *-------------------------------------------------------------- */ func _TkimgXpmObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) (r int32) { bp := tls.Alloc(80) defer tls.Free(80) var c, code, count int32 var instancePtr, masterPtr uintptr var length Tsize_t var _ /* buff at bp+0 */ [30]uint8 _, _, _, _, _, _ = c, code, count, instancePtr, length, masterPtr masterPtr = clientData if objc < int32(2) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+48649, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv)), libc.UintptrFromInt32(0)), __ccgo_ts+48675, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } c = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), libc.UintptrFromInt32(0))))) length = libc.Xstrlen(tls, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), libc.UintptrFromInt32(0))) if c == int32('c') && libc.Xstrncmp(tls, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), libc.UintptrFromInt32(0)), __ccgo_ts+48698, length) == 0 && length >= uint32(2) { if objc != int32(3) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+48649, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv)), libc.UintptrFromInt32(0)), __ccgo_ts+48703, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } return (*(*func(*libc.TLS, uintptr, TTk_Window, uintptr, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_ConfigureValue})))(tls, interp, (*(*func(*libc.TLS, uintptr) TTk_Window)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_MainWindow})))(tls, interp), uintptr(unsafe.Pointer(&_configSpecs)), masterPtr, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), libc.UintptrFromInt32(0)), 0) } else { if c == int32('c') && libc.Xstrncmp(tls, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), libc.UintptrFromInt32(0)), __ccgo_ts+48717, length) == 0 && length >= uint32(2) { if objc == int32(2) { code = (*(*func(*libc.TLS, uintptr, TTk_Window, uintptr, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_ConfigureInfo})))(tls, interp, (*(*func(*libc.TLS, uintptr) TTk_Window)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_MainWindow})))(tls, interp), uintptr(unsafe.Pointer(&_configSpecs)), masterPtr, libc.UintptrFromInt32(0), 0) } else { if objc == int32(3) { code = (*(*func(*libc.TLS, uintptr, TTk_Window, uintptr, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_ConfigureInfo})))(tls, interp, (*(*func(*libc.TLS, uintptr) TTk_Window)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_MainWindow})))(tls, interp), uintptr(unsafe.Pointer(&_configSpecs)), masterPtr, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), libc.UintptrFromInt32(0)), 0) } else { code = _TkimgXpmConfigureMaster(tls, masterPtr, objc-int32(2), objv+uintptr(2)*4, int32(TK_CONFIG_ARGV_ONLY)) } } return code } else { if c == int32('r') && libc.Xstrncmp(tls, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), libc.UintptrFromInt32(0)), __ccgo_ts+48727, length) == 0 { count = 0 if objc != int32(1) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+48649, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv)), libc.UintptrFromInt32(0)), __ccgo_ts+3328, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } instancePtr = (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FinstancePtr for { if !(instancePtr != 0) { break } count += (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FrefCount goto _1 _1: ; instancePtr = (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FnextPtr } libc.X__builtin_snprintf(tls, bp, uint32(30), __ccgo_ts+999, libc.VaList(bp+40, count)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, bp, libc.UintptrFromInt32(0))) return TCL_OK } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+48736, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), libc.UintptrFromInt32(0)), __ccgo_ts+48749, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } } } return r } /* *---------------------------------------------------------------------- * * TkimgXpmGet -- * * This procedure is called for each use of a pixmap image in a * widget. * * Results: * The return value is a token for the instance, which is passed * back to us in calls to TkimgXpmDisplay and TkimgXpmFre. * * Side effects: * A data structure is set up for the instance (or, an existing * instance is re-used for the new one). * *---------------------------------------------------------------------- */ func _TkimgXpmGet(tls *libc.TLS, tkwin TTk_Window, masterData uintptr) (r TClientData) { bp := tls.Alloc(32) defer tls.Free(32) var instancePtr, masterPtr uintptr _, _ = instancePtr, masterPtr masterPtr = masterData /* * See if there is already an instance for this window. If so * then just re-use it. */ instancePtr = (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FinstancePtr for { if !(instancePtr != libc.UintptrFromInt32(0)) { break } if (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin == tkwin { (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FrefCount++ return instancePtr } goto _1 _1: ; instancePtr = (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FnextPtr } /* * The image isn't already in use in this window. Make a new * instance of the image. */ instancePtr = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, uint32(28)) if instancePtr == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Finterp, libc.VaList(bp+8, __ccgo_ts+48788, libc.UintptrFromInt32(0))) return libc.UintptrFromInt32(0) } (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FrefCount = int32(1) (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FmasterPtr = masterPtr (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin = tkwin (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fpixmap = uint32(0) (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FnextPtr = (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FinstancePtr (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors = libc.UintptrFromInt32(0) (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FinstancePtr = instancePtr XTkimgInitPixmapInstance(tls, masterPtr, instancePtr) _TkimgXpmConfigureInstance(tls, instancePtr) /* * If this is the first instance, must set the size of the image. */ if (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FnextPtr == libc.UintptrFromInt32(0) { if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata != 0 { (*(*func(*libc.TLS, TTk_ImageModel, int32, int32, int32, int32, int32, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_ImageChanged})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FtkMaster, 0, 0, *(*int32)(unsafe.Pointer(masterPtr + 20)), *(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4)), *(*int32)(unsafe.Pointer(masterPtr + 20)), *(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4))) } else { (*(*func(*libc.TLS, TTk_ImageModel, int32, int32, int32, int32, int32, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_ImageChanged})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FtkMaster, 0, 0, 0, 0, 0, 0) } } return instancePtr } /* *---------------------------------------------------------------------- * * TkimgXpmDisplay -- * * This procedure is invoked to draw a pixmap image. * * Results: * None. * * Side effects: * A portion of the image gets rendered in a pixmap or window. * *---------------------------------------------------------------------- */ func _TkimgXpmDisplay(tls *libc.TLS, clientData uintptr, display uintptr, drawable TDrawable, imageX int32, imageY int32, width int32, height int32, drawableX int32, drawableY int32) { XTkimgpXpmDisplay(tls, clientData, display, drawable, imageX, imageY, width, height, drawableX, drawableY) } /* *---------------------------------------------------------------------- * * TkimgXpmFree -- * * This procedure is called when a widget ceases to use a * particular instance of an image. * * Results: * None. * * Side effects: * Internal data structures get cleaned up. * *---------------------------------------------------------------------- */ func _TkimgXpmFree(tls *libc.TLS, clientData uintptr, display uintptr) { var i int32 var instancePtr, prevPtr uintptr _, _, _ = i, instancePtr, prevPtr instancePtr = clientData (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FrefCount-- if (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FrefCount > 0 { return } /* * There are no more uses of the image within this widget. Free * the instance structure. */ if (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fpixmap != uint32(0) { (*(*func(*libc.TLS, uintptr, TPixmap))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_FreePixmap})))(tls, display, (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fpixmap) } XTkimgXpmFreeInstanceData(tls, instancePtr, int32(1)) if (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors != libc.UintptrFromInt32(0) { i = 0 for { if !(i < (*TPixmapMaster)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).FmasterPtr)).Fncolors) { break } if (*(*TColorStruct)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors + uintptr(i)*12))).FcolorPtr != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_FreeColor})))(tls, (*(*TColorStruct)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors + uintptr(i)*12))).FcolorPtr) } if (*TPixmapMaster)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).FmasterPtr)).Fcpp != int32(1) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*(*TColorStruct)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors + uintptr(i)*12))).Fcstring) } goto _1 _1: ; i++ } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fcolors) } if (*TPixmapMaster)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).FmasterPtr)).FinstancePtr == instancePtr { (*TPixmapMaster)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).FmasterPtr)).FinstancePtr = (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FnextPtr } else { prevPtr = (*TPixmapMaster)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).FmasterPtr)).FinstancePtr for { if !((*TPixmapInstance)(unsafe.Pointer(prevPtr)).FnextPtr != instancePtr) { break } /* Empty loop body */ goto _2 _2: ; prevPtr = (*TPixmapInstance)(unsafe.Pointer(prevPtr)).FnextPtr } (*TPixmapInstance)(unsafe.Pointer(prevPtr)).FnextPtr = (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FnextPtr } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, instancePtr) } /* *---------------------------------------------------------------------- * * TkimgXpmDelete -- * * This procedure is called by the image code to delete the * master structure for an image. * * Results: * None. * * Side effects: * Resources associated with the image get freed. * *---------------------------------------------------------------------- */ func _TkimgXpmDelete(tls *libc.TLS, masterData uintptr) { var masterPtr uintptr _ = masterPtr masterPtr = masterData if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FinstancePtr != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Panic})))(tls, __ccgo_ts+48834, 0) } (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FtkMaster = libc.UintptrFromInt32(0) if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FimageCmd != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DeleteCommand})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Finterp, (*(*func(*libc.TLS, uintptr, TTcl_Command) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetCommandName})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Finterp, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FimageCmd)) } if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FisDataAlloced != 0 && (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata) (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Fdata = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_FreeOptions})))(tls, uintptr(unsafe.Pointer(&_configSpecs)), masterPtr, libc.UintptrFromInt32(0), 0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, masterPtr) } /* *---------------------------------------------------------------------- * * TkimgXpmCmdDeletedProc -- * * This procedure is invoked when the image command for an image * is deleted. It deletes the image. * * Results: * None. * * Side effects: * The image is deleted. * *---------------------------------------------------------------------- */ func _TkimgXpmCmdDeletedProc(tls *libc.TLS, clientData uintptr) { var masterPtr uintptr _ = masterPtr masterPtr = clientData (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FimageCmd = libc.UintptrFromInt32(0) if (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FtkMaster != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_DeleteImage})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).Finterp, (*(*func(*libc.TLS, TTk_ImageModel) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_NameOfImage})))(tls, (*TPixmapMaster)(unsafe.Pointer(masterPtr)).FtkMaster)) } } /* * Package management. Initialization of stub information. */ /* *---------------------------------------------------------------------------- * * Tkimgpixmap_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgpixmap_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)< int32(16) { pad = int32(32) } else { if depth > int32(8) { pad = int32(16) } else { pad = int32(8) } } /* * Create the XImage structures to store the temporary image */ image = libx11.XXCreateImage(tls, display, (*TTk_FakeWin)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin)).Fvisual, libc.Uint32FromInt32(depth), int32(ZPixmap), 0, uintptr(0), libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(masterPtr + 20))), libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4))), pad, 0) (*TXImage)(unsafe.Pointer(image)).Fdata = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Alloc})))(tls, libc.Uint32FromInt32((*TXImage)(unsafe.Pointer(image)).Fbytes_per_line**(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4)))) mask = libx11.XXCreateImage(tls, display, (*TTk_FakeWin)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin)).Fvisual, uint32(1), int32(XYPixmap), 0, uintptr(0), libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(masterPtr + 20))), libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4))), pad, 0) (*TXImage)(unsafe.Pointer(mask)).Fdata = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Alloc})))(tls, libc.Uint32FromInt32((*TXImage)(unsafe.Pointer(mask)).Fbytes_per_line**(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4)))) *(*uintptr)(unsafe.Pointer(imagePtr)) = image *(*uintptr)(unsafe.Pointer(maskPtr)) = mask } func XTkimgXpmFreeTmpBuffer(tls *libc.TLS, masterPtr uintptr, instancePtr uintptr, image uintptr, mask uintptr) { if image != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TXImage)(unsafe.Pointer(image)).Fdata) (*TXImage)(unsafe.Pointer(image)).Fdata = libc.UintptrFromInt32(0) (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXImage)(unsafe.Pointer(image)).Ff.Fdestroy_image})))(tls, image) } if mask != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TXImage)(unsafe.Pointer(mask)).Fdata) (*TXImage)(unsafe.Pointer(mask)).Fdata = libc.UintptrFromInt32(0) (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXImage)(unsafe.Pointer(mask)).Ff.Fdestroy_image})))(tls, mask) } } // C documentation // // /*---------------------------------------------------------------------- // * TkimgXpmSetPixel -- // * // * Sets the pixel at the given (x,y) coordinate to be the given // * color. // *---------------------------------------------------------------------- // */ func XTkimgXpmSetPixel(tls *libc.TLS, instancePtr uintptr, image uintptr, mask uintptr, x int32, y int32, colorPtr uintptr, isTranspPtr uintptr) { if colorPtr != libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, int32, int32, uint32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXImage)(unsafe.Pointer(image)).Ff.Fput_pixel})))(tls, image, x, y, (*TXColor)(unsafe.Pointer(colorPtr)).Fpixel) (*(*func(*libc.TLS, uintptr, int32, int32, uint32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXImage)(unsafe.Pointer(mask)).Ff.Fput_pixel})))(tls, mask, x, y, libc.Uint32FromInt32(libc.Int32FromInt32(1))) } else { (*(*func(*libc.TLS, uintptr, int32, int32, uint32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXImage)(unsafe.Pointer(mask)).Ff.Fput_pixel})))(tls, mask, x, y, libc.Uint32FromInt32(libc.Int32FromInt32(0))) *(*int32)(unsafe.Pointer(isTranspPtr)) = int32(1) } } /*---------------------------------------------------------------------- * TkimgXpmRealizePixmap -- * * On Unix: Create the pixmap from the buffer. * On Windows: Free the mask if there are no transparent pixels. *---------------------------------------------------------------------- */ func XTkimgXpmRealizePixmap(tls *libc.TLS, masterPtr uintptr, instancePtr uintptr, image uintptr, mask uintptr, isTransp int32) { bp := tls.Alloc(96) defer tls.Free(96) var dataPtr, display uintptr var depth int32 var gc TGC var gcMask uint32 var _ /* gcValues at bp+0 */ TXGCValues _, _, _, _, _ = dataPtr, depth, display, gc, gcMask display = (*TTk_FakeWin)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin)).Fdisplay depth = (*TTk_FakeWin)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin)).Fdepth dataPtr = (*TPixmapInstance)(unsafe.Pointer(instancePtr)).FclientData (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fpixmap = (*(*func(*libc.TLS, uintptr, TDrawable, int32, int32, int32) TPixmap)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetPixmap})))(tls, display, (*TTk_FakeWin)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin)).Fwindow, *(*int32)(unsafe.Pointer(masterPtr + 20)), *(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4)), depth) gc = (*(*func(*libc.TLS, TTk_Window, uint32, uintptr) TGC)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetGC})))(tls, (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin, uint32(0), libc.UintptrFromInt32(0)) libx11.XXPutImage(tls, display, (*TPixmapInstance)(unsafe.Pointer(instancePtr)).Fpixmap, gc, image, 0, 0, 0, 0, libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(masterPtr + 20))), libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4)))) (*(*func(*libc.TLS, uintptr, TGC))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_FreeGC})))(tls, display, gc) if isTransp != 0 { /* * There are transparent pixels. We need a mask. */ (*TPixmapData)(unsafe.Pointer(dataPtr)).Fmask = (*(*func(*libc.TLS, uintptr, TDrawable, int32, int32, int32) TPixmap)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetPixmap})))(tls, display, (*TTk_FakeWin)(unsafe.Pointer((*TPixmapInstance)(unsafe.Pointer(instancePtr)).Ftkwin)).Fwindow, *(*int32)(unsafe.Pointer(masterPtr + 20)), *(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4)), int32(1)) gc = libx11.XXCreateGC(tls, display, (*TPixmapData)(unsafe.Pointer(dataPtr)).Fmask, uint32(0), libc.UintptrFromInt32(0)) libx11.XXPutImage(tls, display, (*TPixmapData)(unsafe.Pointer(dataPtr)).Fmask, gc, mask, 0, 0, 0, 0, libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(masterPtr + 20))), libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(masterPtr + 20 + 1*4)))) libx11.XXFreeGC(tls, display, gc) } else { (*TPixmapData)(unsafe.Pointer(dataPtr)).Fmask = uint32(0) } /* * Allocate a GC for drawing this instance (mask is not used if there * is no transparent pixels inside the image). */ if (*TPixmapData)(unsafe.Pointer(dataPtr)).Fmask != uint32(0) { gcMask = libc.Uint32FromInt32(libc.Int32FromInt32(1)< 0 { libc.X__builtin_snprintf(tls, bp, uint32(256), __ccgo_ts+49039, 0) (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_WriteChars})))(tls, outChan, bp, -int32(1)) i = 0 for { if !(i < (*TFMTOPT7)(unsafe.Pointer(opts)).FnumTags) { break } libc.X__builtin_snprintf(tls, bp, uint32(256), __ccgo_ts+49047, libc.VaList(bp+264, (*(*Tpng_text)(unsafe.Pointer(opts + 32 + uintptr(i)*28))).Fkey, (*(*Tpng_text)(unsafe.Pointer(opts + 32 + uintptr(i)*28))).Ftext)) (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_WriteChars})))(tls, outChan, bp, -int32(1)) goto _1 _1: ; i++ } } (*(*func(*libc.TLS, TTcl_Channel) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Flush})))(tls, outChan) } func _ParseFormatOpts7(tls *libc.TLS, interp uintptr, format uintptr, opts uintptr, mode int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var i, v2, v3, v4 TTcl_Size var numTags int32 var optionStr uintptr var _ /* boolVal at bp+12 */ int32 var _ /* doubleVal at bp+16 */ float64 var _ /* index at bp+4 */ int32 var _ /* objc at bp+0 */ TTcl_Size var _ /* objv at bp+8 */ uintptr _, _, _, _, _, _ = i, numTags, optionStr, v2, v3, v4 numTags = 0 (*TFMTOPT7)(unsafe.Pointer(opts)).Fverbose = 0 (*TFMTOPT7)(unsafe.Pointer(opts)).Falpha = float32(-libc.Float64FromFloat64(1)) (*TFMTOPT7)(unsafe.Pointer(opts)).Fgamma = float32(1) (*TFMTOPT7)(unsafe.Pointer(opts)).Fwithalpha = int32(1) (*TFMTOPT7)(unsafe.Pointer(opts)).Fxres = libc.Float64FromInt32(IMG_DEFAULT_DPI) (*TFMTOPT7)(unsafe.Pointer(opts)).Fyres = libc.Float64FromInt32(IMG_DEFAULT_DPI) (*TFMTOPT7)(unsafe.Pointer(opts)).FnumTags = 0 if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ListObjGetElementsPtr})))(tls, interp, format, bp, bp+8) == int32(TCL_ERROR) { return int32(TCL_ERROR) } i = int32(1) for { if !(i < *(*TTcl_Size)(unsafe.Pointer(bp))) { break } if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+32, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)< float64(1) { (*TFMTOPT7)(unsafe.Pointer(opts)).Falpha = float32(1) } case 2: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) || *(*float64)(unsafe.Pointer(bp + 16)) < float64(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+1925, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 16)) >= float64(0) { (*TFMTOPT7)(unsafe.Pointer(opts)).Fgamma = float32(*(*float64)(unsafe.Pointer(bp + 16))) } case 3: fallthrough case 4: if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+12) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+49163, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT7)(unsafe.Pointer(opts)).Fwithalpha = *(*int32)(unsafe.Pointer(bp + 12)) break } } else { switch *(*int32)(unsafe.Pointer(bp + 4)) { case 0: if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+12) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+738, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT7)(unsafe.Pointer(opts)).Fverbose = *(*int32)(unsafe.Pointer(bp + 12)) case 1: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+32, __ccgo_ts+807, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT7)(unsafe.Pointer(opts)).Fxres = *(*float64)(unsafe.Pointer(bp + 16)) (*TFMTOPT7)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 16)) if i+int32(1) >= *(*TTcl_Size)(unsafe.Pointer(bp)) { /* No more parameters available. */ break } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i+int32(1))*4)), libc.UintptrFromInt32(0)) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(optionStr))) == int32('-') { /* Next parameter is an option. */ break } if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+32, __ccgo_ts+836, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT7)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 16)) i++ case 2: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+32, __ccgo_ts+807, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT7)(unsafe.Pointer(opts)).Fxres = *(*float64)(unsafe.Pointer(bp + 16)) case 3: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+32, __ccgo_ts+836, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT7)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 16)) case 4: if numTags >= int32(MAX_TAGS) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+49234, 0)) return int32(TCL_ERROR) } i++ v4 = i if v4 >= *(*TTcl_Size)(unsafe.Pointer(bp)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+49272, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } (*(*Tpng_text)(unsafe.Pointer(opts + 32 + uintptr(numTags)*28))).Fkey = optionStr (*(*Tpng_text)(unsafe.Pointer(opts + 32 + uintptr(numTags)*28))).Ftext = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) (*(*Tpng_text)(unsafe.Pointer(opts + 32 + uintptr(numTags)*28))).Ftext_length = libc.Xstrlen(tls, (*(*Tpng_text)(unsafe.Pointer(opts + 32 + uintptr(numTags)*28))).Ftext) if (*(*Tpng_text)(unsafe.Pointer(opts + 32 + uintptr(numTags)*28))).Ftext_length > uint32(COMPRESS_THRESHOLD) { (*(*Tpng_text)(unsafe.Pointer(opts + 32 + uintptr(numTags)*28))).Fcompression = PNG_TEXT_COMPRESSION_zTXt } else { (*(*Tpng_text)(unsafe.Pointer(opts + 32 + uintptr(numTags)*28))).Fcompression = -int32(1) } numTags++ case 5: fallthrough case 6: if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+12) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+49163, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT7)(unsafe.Pointer(opts)).Fwithalpha = *(*int32)(unsafe.Pointer(bp + 12)) break } } goto _1 _1: ; i++ } (*TFMTOPT7)(unsafe.Pointer(opts)).FnumTags = numTags return TCL_OK } var _readOptions7 = [6]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 49058, 2: __ccgo_ts + 1774, 3: __ccgo_ts + 49065, 4: __ccgo_ts + 49076, 5: libc.UintptrFromInt32(0), } var _writeOptions5 = [8]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 650, 2: __ccgo_ts + 662, 3: __ccgo_ts + 675, 4: __ccgo_ts + 49083, 5: __ccgo_ts + 49065, 6: __ccgo_ts + 49076, 7: libc.UintptrFromInt32(0), } /* * */ func _SetupPngLibrary(tls *libc.TLS, interp uintptr) (r int32) { if !(XPngtcl_InitStubs(tls, interp, __ccgo_ts+9793, 0) != 0) { return int32(TCL_ERROR) } return TCL_OK } func _tk_png_error(tls *libc.TLS, png_ptr Tpng_structp, error_msg Tpng_const_charp) { bp := tls.Alloc(32) defer tls.Free(32) var info uintptr _ = info info = (*(*func(*libc.TLS, Tpng_const_structrp) Tpng_voidp)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_error_ptrPtr})))(tls, png_ptr) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, (*Tcleanup_info)(unsafe.Pointer(info)).Finterp, libc.VaList(bp+8, error_msg, libc.UintptrFromInt32(0))) tls.Longjmp(info+8, libc.Int32FromInt32(1)) } func _tk_png_warning(tls *libc.TLS, png_ptr Tpng_structp, error_msg Tpng_const_charp) { return } func _tk_png_read(tls *libc.TLS, png_ptr Tpng_structp, data Tpng_bytep, length Tpng_size_t) { if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, (*(*func(*libc.TLS, Tpng_const_structrp) Tpng_voidp)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_progressive_ptrPtr})))(tls, png_ptr), data, libc.Int32FromUint32(length)) != libc.Int32FromUint32(length) { (*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_charp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_errorPtr})))(tls, png_ptr, __ccgo_ts+14944) } } func _tk_png_write(tls *libc.TLS, png_ptr Tpng_structp, data Tpng_bytep, length Tpng_size_t) { if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, (*(*func(*libc.TLS, Tpng_const_structrp) Tpng_voidp)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_progressive_ptrPtr})))(tls, png_ptr), data, libc.Int32FromUint32(length)) != libc.Int32FromUint32(length) { (*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_charp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_errorPtr})))(tls, png_ptr, __ccgo_ts+19081) } } func _tk_png_flush(tls *libc.TLS, png_ptr Tpng_structp) { } func _FileMatchVersion34(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(464) defer tls.Free(464) var png_ptr Tpng_structp var retVal int32 var _ /* cleanup at bp+0 */ Tcleanup_info var _ /* handle at bp+416 */ Ttkimg_Stream var _ /* xdpi at bp+400 */ float64 var _ /* ydpi at bp+408 */ float64 _, _ = png_ptr, retVal libc.Xmemset(tls, bp+416, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp+416, chan1) (*(*Tcleanup_info)(unsafe.Pointer(bp))).Finterp = interp png_ptr = (*(*func(*libc.TLS, Tpng_const_charp, Tpng_voidp, Tpng_error_ptr, Tpng_error_ptr) Tpng_structp)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_create_read_structPtr})))(tls, __ccgo_ts+9793, bp, __ccgo_fp(_tk_png_error), __ccgo_fp(_tk_png_warning)) if !(png_ptr != 0) { return 0 } (*(*func(*libc.TLS, Tpng_structrp, Tpng_voidp, Tpng_rw_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_read_fnPtr})))(tls, png_ptr, bp+416, __ccgo_fp(_tk_png_read)) retVal = _CommonMatch6(tls, png_ptr, bp+416, widthPtr, heightPtr, bp+400, bp+408) if retVal != 0 && *(*float64)(unsafe.Pointer(bp + 400)) >= float64(0) && *(*float64)(unsafe.Pointer(bp + 408)) >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, *(*float64)(unsafe.Pointer(bp + 400)), *(*float64)(unsafe.Pointer(bp + 408))) { return 0 } } return retVal } func _StringMatchVersion34(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(464) defer tls.Free(464) var retVal int32 var _ /* cleanup at bp+8 */ Tcleanup_info var _ /* handle at bp+424 */ Ttkimg_Stream var _ /* png_ptr at bp+0 */ Tpng_structp var _ /* xdpi at bp+408 */ float64 var _ /* ydpi at bp+416 */ float64 _ = retVal libc.Xmemset(tls, bp+424, 0, uint32(40)) (*(*Tcleanup_info)(unsafe.Pointer(bp + 8))).Finterp = interp *(*Tpng_structp)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, Tpng_const_charp, Tpng_voidp, Tpng_error_ptr, Tpng_error_ptr) Tpng_structp)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_create_read_structPtr})))(tls, __ccgo_ts+9793, bp+8, __ccgo_fp(_tk_png_error), __ccgo_fp(_tk_png_warning)) if !(*(*Tpng_structp)(unsafe.Pointer(bp)) != 0) { return 0 } if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp+424, dataObj) != 0) { (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_read_structPtr})))(tls, bp, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0)) return 0 } (*(*func(*libc.TLS, Tpng_structrp, Tpng_voidp, Tpng_rw_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_read_fnPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), bp+424, __ccgo_fp(_tk_png_read)) retVal = _CommonMatch6(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), bp+424, widthPtr, heightPtr, bp+408, bp+416) if retVal != 0 && *(*float64)(unsafe.Pointer(bp + 408)) >= float64(0) && *(*float64)(unsafe.Pointer(bp + 416)) >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, *(*float64)(unsafe.Pointer(bp + 408)), *(*float64)(unsafe.Pointer(bp + 416))) { return 0 } } return retVal } func _CommonMatch6(tls *libc.TLS, _png_ptr Tpng_structp, handle uintptr, widthPtr uintptr, heightPtr uintptr, xdpiPtr uintptr, ydpiPtr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) *(*Tpng_structp)(unsafe.Pointer(bp)) = _png_ptr var xdpi, ydpi float64 var v1 uintptr var _ /* info_height at bp+12 */ Tpng_uint_32 var _ /* info_ptr at bp+4 */ Tpng_infop var _ /* info_width at bp+8 */ Tpng_uint_32 var _ /* resUnit at bp+24 */ int32 var _ /* xres at bp+16 */ Tpng_uint_32 var _ /* yres at bp+20 */ Tpng_uint_32 _, _, _ = xdpi, ydpi, v1 *(*Tpng_uint_32)(unsafe.Pointer(bp + 16)) = uint32(0) *(*Tpng_uint_32)(unsafe.Pointer(bp + 20)) = uint32(0) xdpi = -libc.Float64FromFloat64(1) ydpi = -libc.Float64FromFloat64(1) *(*int32)(unsafe.Pointer(bp + 24)) = 0 *(*Tpng_infop)(unsafe.Pointer(bp + 4)) = (*(*func(*libc.TLS, Tpng_const_structrp) Tpng_infop)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_create_info_structPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp))) if !(*(*Tpng_infop)(unsafe.Pointer(bp + 4)) != 0) { (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_read_structPtr})))(tls, bp, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0)) return 0 } v1 = (*(*func(*libc.TLS, Tpng_const_structrp) Tpng_voidp)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_error_ptrPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp))) + 8 tls.PushJumpBuffer(v1) defer func() { switch recover().(type) { case libc.LongjmpRetval: (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_read_structPtr})))(tls, bp, bp+4, libc.UintptrFromInt32(0)) r = 0 return default: tls.PopJumpBuffer(v1) } }() (*(*func(*libc.TLS, Tpng_structrp, Tpng_inforp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_read_infoPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4))) if !((*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_inforp, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) Tpng_uint_32)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_IHDRPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)), bp+8, bp+12, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0), libc.UintptrFromInt32(0)) != 0) { (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_read_structPtr})))(tls, bp, bp+4, libc.UintptrFromInt32(0)) return 0 } *(*int32)(unsafe.Pointer(widthPtr)) = libc.Int32FromUint32(*(*Tpng_uint_32)(unsafe.Pointer(bp + 8))) *(*int32)(unsafe.Pointer(heightPtr)) = libc.Int32FromUint32(*(*Tpng_uint_32)(unsafe.Pointer(bp + 12))) if uint32(0x0080) == (*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_inforp, uintptr, uintptr, uintptr) Tpng_uint_32)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_pHYsPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)), bp+16, bp+20, bp+24) { xdpi = float64(*(*Tpng_uint_32)(unsafe.Pointer(bp + 16))) ydpi = float64(*(*Tpng_uint_32)(unsafe.Pointer(bp + 20))) if *(*int32)(unsafe.Pointer(bp + 24)) == int32(PNG_RESOLUTION_METER) { xdpi = float64(int32(float64(*(*Tpng_uint_32)(unsafe.Pointer(bp + 16)))*libc.Float64FromFloat64(0.0254) + libc.Float64FromFloat64(0.5))) ydpi = float64(int32(float64(*(*Tpng_uint_32)(unsafe.Pointer(bp + 20)))*libc.Float64FromFloat64(0.0254) + libc.Float64FromFloat64(0.5))) } } if xdpi == float64(0) { xdpi = -libc.Float64FromFloat64(1) } if ydpi == float64(0) { ydpi = -libc.Float64FromFloat64(1) } *(*float64)(unsafe.Pointer(xdpiPtr)) = xdpi *(*float64)(unsafe.Pointer(ydpiPtr)) = ydpi (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_read_structPtr})))(tls, bp, bp+4, libc.UintptrFromInt32(0)) return int32(1) } func _FileReadVersion34(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(448) defer tls.Free(448) var png_ptr Tpng_structp var _ /* cleanup at bp+0 */ Tcleanup_info var _ /* handle at bp+400 */ Ttkimg_Stream _ = png_ptr libc.Xmemset(tls, bp+400, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp+400, chan1) (*(*Tcleanup_info)(unsafe.Pointer(bp))).Finterp = interp png_ptr = (*(*func(*libc.TLS, Tpng_const_charp, Tpng_voidp, Tpng_error_ptr, Tpng_error_ptr) Tpng_structp)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_create_read_structPtr})))(tls, __ccgo_ts+9793, bp, __ccgo_fp(_tk_png_error), __ccgo_fp(_tk_png_warning)) if !(png_ptr != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, Tpng_structrp, Tpng_voidp, Tpng_rw_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_read_fnPtr})))(tls, png_ptr, bp+400, __ccgo_fp(_tk_png_read)) return _CommonRead7(tls, png_ptr, interp, fileName, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) } func _StringReadVersion34(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(448) defer tls.Free(448) var png_ptr Tpng_structp var _ /* cleanup at bp+0 */ Tcleanup_info var _ /* handle at bp+400 */ Ttkimg_Stream _ = png_ptr libc.Xmemset(tls, bp+400, 0, uint32(40)) (*(*Tcleanup_info)(unsafe.Pointer(bp))).Finterp = interp png_ptr = (*(*func(*libc.TLS, Tpng_const_charp, Tpng_voidp, Tpng_error_ptr, Tpng_error_ptr) Tpng_structp)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_create_read_structPtr})))(tls, __ccgo_ts+9793, bp, __ccgo_fp(_tk_png_error), __ccgo_fp(_tk_png_warning)) if !(png_ptr != 0) { return int32(TCL_ERROR) } if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp+400, dataObj) != 0) { return 0 } (*(*func(*libc.TLS, Tpng_structrp, Tpng_voidp, Tpng_rw_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_read_fnPtr})))(tls, png_ptr, bp+400, __ccgo_fp(_tk_png_read)) return _CommonRead7(tls, png_ptr, interp, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) } func _CommonRead7(tls *libc.TLS, _png_ptr Tpng_structp, interp uintptr, fileName uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(448) defer tls.Free(448) *(*Tpng_structp)(unsafe.Pointer(bp)) = _png_ptr var addAlpha, result, useAlpha, v4 int32 var alphaPtr, png_data, v1 uintptr var i uint32 var xdpi, ydpi float64 var _ /* bit_depth at bp+68 */ int32 var _ /* block at bp+12 */ TTk_PhotoImageBlock var _ /* color_type at bp+72 */ int32 var _ /* end_info at bp+8 */ Tpng_infop var _ /* fileGamma at bp+88 */ float64 var _ /* info_height at bp+52 */ Tpng_uint_32 var _ /* info_ptr at bp+4 */ Tpng_infop var _ /* info_width at bp+48 */ Tpng_uint_32 var _ /* intent at bp+80 */ int32 var _ /* interlace_type at bp+76 */ int32 var _ /* opts at bp+96 */ TFMTOPT7 var _ /* resUnit at bp+64 */ int32 var _ /* xres at bp+56 */ Tpng_uint_32 var _ /* yres at bp+60 */ Tpng_uint_32 _, _, _, _, _, _, _, _, _, _ = addAlpha, alphaPtr, i, png_data, result, useAlpha, xdpi, ydpi, v1, v4 png_data = libc.UintptrFromInt32(0) *(*Tpng_uint_32)(unsafe.Pointer(bp + 56)) = uint32(0) *(*Tpng_uint_32)(unsafe.Pointer(bp + 60)) = uint32(0) xdpi = -libc.Float64FromFloat64(1) ydpi = -libc.Float64FromFloat64(1) *(*int32)(unsafe.Pointer(bp + 64)) = 0 result = TCL_OK *(*float64)(unsafe.Pointer(bp + 88)) = -libc.Float64FromFloat64(1) useAlpha = 0 addAlpha = 0 if _ParseFormatOpts7(tls, interp, format, bp+96, libc.Int32FromInt32(1)< libc.Int32FromUint32(*(*Tpng_uint_32)(unsafe.Pointer(bp + 48))) { width = libc.Int32FromUint32(*(*Tpng_uint_32)(unsafe.Pointer(bp + 48)) - libc.Uint32FromInt32(srcX)) } if srcY+height > libc.Int32FromUint32(*(*Tpng_uint_32)(unsafe.Pointer(bp + 52))) { height = libc.Int32FromUint32(*(*Tpng_uint_32)(unsafe.Pointer(bp + 52)) - libc.Uint32FromInt32(srcY)) } if width <= 0 || height <= 0 || srcX >= libc.Int32FromUint32(*(*Tpng_uint_32)(unsafe.Pointer(bp + 48))) || srcY >= libc.Int32FromUint32(*(*Tpng_uint_32)(unsafe.Pointer(bp + 52))) { (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_read_structPtr})))(tls, bp, bp+4, bp+8) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+424, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+width, destY+height) == int32(TCL_ERROR) { (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_read_structPtr})))(tls, bp, bp+4, bp+8) return int32(TCL_ERROR) } (*(*func(*libc.TLS, TTk_PhotoHandle, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoGetImage})))(tls, imageHandle, bp+12) (*(*func(*libc.TLS, Tpng_structrp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_scale_16Ptr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp))) (*(*func(*libc.TLS, Tpng_structrp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_expandPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp))) if (*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_inforp, uintptr) Tpng_uint_32)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_sRGBPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)), bp+80) != 0 { (*(*func(*libc.TLS, Tpng_const_structrp, Tpng_inforp, int32))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_sRGBPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)), *(*int32)(unsafe.Pointer(bp + 80))) } else { if float64((*(*TFMTOPT7)(unsafe.Pointer(bp + 96))).Fgamma) < float64(0) { /* No gamma specified on the command line. * Check, if a gamma value is specified in the file. */ if (*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_inforp, uintptr) Tpng_uint_32)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_gAMAPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)), bp+88) != 0 { (*(*func(*libc.TLS, Tpng_structrp, float64, float64))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_gammaPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), float64(1), *(*float64)(unsafe.Pointer(bp + 88))) } } else { (*(*func(*libc.TLS, Tpng_structrp, float64, float64))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_gammaPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), float64(1), float64((*(*TFMTOPT7)(unsafe.Pointer(bp + 96))).Fgamma)) } } if *(*int32)(unsafe.Pointer(bp + 72))&int32(PNG_COLOR_MASK_ALPHA) != 0 || (*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_inforp, Tpng_uint_32) Tpng_uint_32)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_validPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)), uint32(0x0010)) != 0 { /* Image has an alpha channel. Check, if we don't want to use the alpha channel (withalpha == false) */ if !((*(*TFMTOPT7)(unsafe.Pointer(bp + 96))).Fwithalpha != 0) { (*(*func(*libc.TLS, Tpng_structrp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_strip_alphaPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp))) } } else { /* Image has no alpha channel. If a valid alpha multiply has been specified, add an alpha channel to the image. The withalpha flag is ignored. */ if float64((*(*TFMTOPT7)(unsafe.Pointer(bp + 96))).Falpha) >= float64(0) { (*(*func(*libc.TLS, Tpng_structrp, Tpng_uint_32, int32))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_add_alphaPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), uint32((*(*TFMTOPT7)(unsafe.Pointer(bp + 96))).Falpha*libc.Float32FromInt32(255)), int32(PNG_FILLER_AFTER)) } } if uint32(0x0080) == (*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_inforp, uintptr, uintptr, uintptr) Tpng_uint_32)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_pHYsPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)), bp+56, bp+60, bp+64) { xdpi = float64(*(*Tpng_uint_32)(unsafe.Pointer(bp + 56))) ydpi = float64(*(*Tpng_uint_32)(unsafe.Pointer(bp + 60))) if *(*int32)(unsafe.Pointer(bp + 64)) == int32(PNG_RESOLUTION_METER) { xdpi = float64(int32(float64(*(*Tpng_uint_32)(unsafe.Pointer(bp + 56)))*libc.Float64FromFloat64(0.0254) + libc.Float64FromFloat64(0.5))) ydpi = float64(int32(float64(*(*Tpng_uint_32)(unsafe.Pointer(bp + 60)))*libc.Float64FromFloat64(0.0254) + libc.Float64FromFloat64(0.5))) } } if xdpi == float64(0) { xdpi = -libc.Float64FromFloat64(1) } if ydpi == float64(0) { ydpi = -libc.Float64FromFloat64(1) } if xdpi >= float64(0) && ydpi >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, xdpi, ydpi) { return int32(TCL_ERROR) } } if (*(*TFMTOPT7)(unsafe.Pointer(bp + 96))).Fverbose != 0 { _PrintReadInfo(tls, libc.Int32FromUint32(*(*Tpng_uint_32)(unsafe.Pointer(bp + 48))), libc.Int32FromUint32(*(*Tpng_uint_32)(unsafe.Pointer(bp + 52))), xdpi, ydpi, libc.Int32FromUint8((*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_inforp) Tpng_byte)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_channelsPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)))), *(*int32)(unsafe.Pointer(bp + 68)), *(*float64)(unsafe.Pointer(bp + 88)), fileName, __ccgo_ts+881) } /* Note: png_read_update_info may only be called once per info_ptr !! */ (*(*func(*libc.TLS, Tpng_structrp, Tpng_inforp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_read_update_infoPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4))) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize = libc.Int32FromUint8((*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_inforp) Tpng_byte)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_channelsPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)))) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).Fpitch = libc.Int32FromUint32((*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_inforp) Tsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_rowbytesPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)))) if *(*int32)(unsafe.Pointer(bp + 72))&int32(PNG_COLOR_MASK_COLOR) == 0 { /* grayscale image */ *(*int32)(unsafe.Pointer(bp + 12 + 20 + 1*4)) = 0 *(*int32)(unsafe.Pointer(bp + 12 + 20 + 2*4)) = 0 } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).Fwidth = width (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).Fheight = height if *(*int32)(unsafe.Pointer(bp + 72))&int32(PNG_COLOR_MASK_ALPHA) != 0 || (*(*func(*libc.TLS, Tpng_const_structrp, Tpng_const_inforp, Tpng_uint_32) Tpng_uint_32)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_get_validPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), *(*Tpng_infop)(unsafe.Pointer(bp + 4)), uint32(0x0010)) != 0 { /* Image has an alpha channel. Check, if we don't want to use the alpha channel (withalpha == false) */ if !((*(*TFMTOPT7)(unsafe.Pointer(bp + 96))).Fwithalpha != 0) { *(*int32)(unsafe.Pointer(bp + 12 + 20 + 3*4)) = 0 } else { *(*int32)(unsafe.Pointer(bp + 12 + 20 + 3*4)) = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize - int32(1) if float64((*(*TFMTOPT7)(unsafe.Pointer(bp + 96))).Falpha) >= float64(0) { useAlpha = int32(1) } } } else { /* Image has no alpha channel. If a valid alpha multiply has been specified, add an alpha channel to the image. The withalpha flag is ignored. */ if float64((*(*TFMTOPT7)(unsafe.Pointer(bp + 96))).Falpha) >= float64(0) { addAlpha = int32(1) } else { *(*int32)(unsafe.Pointer(bp + 12 + 20 + 3*4)) = 0 } } if addAlpha != 0 { *(*int32)(unsafe.Pointer(bp + 12 + 20 + 3*4)) = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize - int32(1) } png_data = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, uint32(4)**(*Tpng_uint_32)(unsafe.Pointer(bp + 52))+*(*Tpng_uint_32)(unsafe.Pointer(bp + 52))*libc.Uint32FromInt32((*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).Fpitch)) if png_data == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_read_structPtr})))(tls, bp, bp+4, bp+8) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+424, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } i = uint32(0) for { if !(i < *(*Tpng_uint_32)(unsafe.Pointer(bp + 52))) { break } *(*uintptr)(unsafe.Pointer(png_data + uintptr(i)*4)) = png_data + uintptr(libc.Uint32FromInt64(4)**(*Tpng_uint_32)(unsafe.Pointer(bp + 52))+i*libc.Uint32FromInt32((*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).Fpitch)) goto _2 _2: ; i++ } (*(*func(*libc.TLS, Tpng_structrp, Tpng_bytepp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_read_imagePtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), png_data) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelPtr = *(*uintptr)(unsafe.Pointer(png_data + uintptr(srcY)*4)) + uintptr(srcX*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize) if useAlpha != 0 { alphaPtr = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelPtr + uintptr(*(*int32)(unsafe.Pointer(bp + 12 + 20 + 3*4))) i = uint32(0) for { if !(i < libc.Uint32FromInt32(height*width)) { break } *(*uint8)(unsafe.Pointer(alphaPtr)) = uint8((*(*TFMTOPT7)(unsafe.Pointer(bp + 96))).Falpha * float32(*(*uint8)(unsafe.Pointer(alphaPtr)))) alphaPtr += uintptr(*(*int32)(unsafe.Pointer(bp + 12 + 20 + 3*4)) + int32(1)) goto _3 _3: ; i++ } } if *(*int32)(unsafe.Pointer(bp + 12 + 20 + 3*4)) != 0 { v4 = TK_PHOTO_COMPOSITE_OVERLAY } else { v4 = int32(TK_PHOTO_COMPOSITE_SET) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp+12, destX, destY, width, height, v4) == int32(TCL_ERROR) { result = int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, png_data) (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_read_structPtr})))(tls, bp, bp+4, bp+8) return result } func _FileWriteVersion34(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(448) defer tls.Free(448) var chan1 TTcl_Channel var info_ptr Tpng_infop var result int32 var _ /* cleanup at bp+8 */ Tcleanup_info var _ /* handle at bp+408 */ Ttkimg_Stream var _ /* png_ptr at bp+0 */ Tpng_structp _, _, _ = chan1, info_ptr, result chan1 = libc.UintptrFromInt32(0) libc.Xmemset(tls, bp+408, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, fileName, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp+408, chan1) (*(*Tcleanup_info)(unsafe.Pointer(bp + 8))).Finterp = interp *(*Tpng_structp)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, Tpng_const_charp, Tpng_voidp, Tpng_error_ptr, Tpng_error_ptr) Tpng_structp)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_create_write_structPtr})))(tls, __ccgo_ts+9793, bp+8, __ccgo_fp(_tk_png_error), __ccgo_fp(_tk_png_warning)) if !(*(*Tpng_structp)(unsafe.Pointer(bp)) != 0) { (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, libc.UintptrFromInt32(0), chan1, 0) return int32(TCL_ERROR) } info_ptr = (*(*func(*libc.TLS, Tpng_const_structrp) Tpng_infop)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_create_info_structPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp))) if !(info_ptr != 0) { (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_write_structPtr})))(tls, bp, libc.UintptrFromInt32(0)) (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, libc.UintptrFromInt32(0), chan1, 0) return int32(TCL_ERROR) } (*(*func(*libc.TLS, Tpng_structrp, Tpng_voidp, Tpng_rw_ptr, Tpng_flush_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_write_fnPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), bp+408, __ccgo_fp(_tk_png_write), __ccgo_fp(_tk_png_flush)) result = _CommonWrite5(tls, interp, fileName, *(*Tpng_structp)(unsafe.Pointer(bp)), info_ptr, format, blockPtr, metadataIn) (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, libc.UintptrFromInt32(0), chan1, 0) return result } func _StringWriteVersion34(tls *libc.TLS, interp uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(448) defer tls.Free(448) var info_ptr Tpng_infop var result int32 var _ /* cleanup at bp+8 */ Tcleanup_info var _ /* handle at bp+408 */ Ttkimg_Stream var _ /* png_ptr at bp+0 */ Tpng_structp _, _ = info_ptr, result libc.Xmemset(tls, bp+408, 0, uint32(40)) (*(*Tcleanup_info)(unsafe.Pointer(bp + 8))).Finterp = interp *(*Tpng_structp)(unsafe.Pointer(bp)) = (*(*func(*libc.TLS, Tpng_const_charp, Tpng_voidp, Tpng_error_ptr, Tpng_error_ptr) Tpng_structp)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_create_write_structPtr})))(tls, __ccgo_ts+9793, bp+8, __ccgo_fp(_tk_png_error), __ccgo_fp(_tk_png_warning)) if !(*(*Tpng_structp)(unsafe.Pointer(bp)) != 0) { return int32(TCL_ERROR) } info_ptr = (*(*func(*libc.TLS, Tpng_const_structrp) Tpng_infop)(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_create_info_structPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp))) if !(info_ptr != 0) { (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_write_structPtr})))(tls, bp, libc.UintptrFromInt32(0)) return int32(TCL_ERROR) } (*(*func(*libc.TLS, Tpng_structrp, Tpng_voidp, Tpng_rw_ptr, Tpng_flush_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_set_write_fnPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), bp+408, __ccgo_fp(_tk_png_write), __ccgo_fp(_tk_png_flush)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp+408) result = _CommonWrite5(tls, interp, __ccgo_ts+865, *(*Tpng_structp)(unsafe.Pointer(bp)), info_ptr, format, blockPtr, metadataIn) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp + 408))).FbyteObj) } return result } func _CommonWrite5(tls *libc.TLS, interp uintptr, fileName uintptr, _png_ptr Tpng_structp, _info_ptr Tpng_infop, format uintptr, blockPtr uintptr, metadataIn uintptr) (r int32) { bp := tls.Alloc(368) defer tls.Free(368) *(*Tpng_structp)(unsafe.Pointer(bp)) = _png_ptr *(*Tpng_infop)(unsafe.Pointer(bp + 4)) = _info_ptr var alphaOffset, blueOffset, color_type, greenOffset, i, j, newPixelSize, number_passes, oldPixelSize, pass, v2 int32 var dst, row_pointers, src Tpng_bytep var xres, yres uint32 var v1 uintptr var _ /* opts at bp+8 */ TFMTOPT7 var _ /* xdpi at bp+328 */ float64 var _ /* ydpi at bp+336 */ float64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, color_type, dst, greenOffset, i, j, newPixelSize, number_passes, oldPixelSize, pass, row_pointers, src, xres, yres, v1, v2 row_pointers = libc.UintptrFromInt32(0) *(*float64)(unsafe.Pointer(bp + 328)) = float64(0) *(*float64)(unsafe.Pointer(bp + 336)) = float64(0) if _ParseFormatOpts7(tls, interp, format, bp+8, libc.Int32FromInt32(1)< 0) { break } libc.Xmemcpy(tls, dst, src, libc.Uint32FromInt32(newPixelSize)) src += uintptr(oldPixelSize) dst += uintptr(newPixelSize) goto _5 _5: ; j-- } (*(*func(*libc.TLS, Tpng_structrp, Tpng_const_bytep))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_write_rowPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), row_pointers) goto _4 _4: ; i++ } goto _3 _3: ; pass++ } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, row_pointers) row_pointers = libc.UintptrFromInt32(0) } else { pass = 0 for { if !(pass < number_passes) { break } i = 0 for { if !(i < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) { break } (*(*func(*libc.TLS, Tpng_structrp, Tpng_const_bytep))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_write_rowPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr+uintptr(i*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch)+uintptr(*(*int32)(unsafe.Pointer(blockPtr + 20)))) goto _7 _7: ; i++ } goto _6 _6: ; pass++ } } (*(*func(*libc.TLS, Tpng_structrp, Tpng_inforp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_write_endPtr})))(tls, *(*Tpng_structp)(unsafe.Pointer(bp)), libc.UintptrFromInt32(0)) (*(*func(*libc.TLS, Tpng_structpp, Tpng_infopp))(unsafe.Pointer(&struct{ uintptr }{(*TPngtclStubs)(unsafe.Pointer(XpngtclStubsPtr)).Fpng_destroy_write_structPtr})))(tls, bp, bp+4) if (*(*TFMTOPT7)(unsafe.Pointer(bp + 8))).Fverbose != 0 { _PrintSaveInfo(tls, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight, uint32(*(*float64)(unsafe.Pointer(bp + 328))), uint32(*(*float64)(unsafe.Pointer(bp + 336))), bp+8, fileName, __ccgo_ts+1132) } return TCL_OK } const BOTTOM_UP = 0 const BUFFER_SIZE = 1000 const DBL_MAX4 = 1.7976931348623157e+308 const M_LN22 = 0.69314718055994530942 const M_PI2 = 3.14159265358979323846 const PACKAGE_NAME13 = "tkimgppm" const PACKAGE_STRING13 = "tkimgppm 2.0.1" const PACKAGE_TARNAME13 = "tkimgppm" const PACKAGE_TCLNAME10 = "img::ppm" const PGM = 1 const PPM = 2 const TOP_DOWN = 1 const strBottomUp = "BottomUp" const strTopDown = "TopDown" var _sImageFormat3 = TTk_PhotoImageFormat{ Fname: __ccgo_ts + 49305, } func init() { p := unsafe.Pointer(&_sImageFormat3) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatch3) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatch3) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileRead3) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringRead3) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWrite3) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWrite3) } /* *---------------------------------------------------------------------------- * * Tkimgppm_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgppm_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)< *(*TDouble)(unsafe.Pointer(maxVals + uintptr(c)*8)) { *(*TDouble)(unsafe.Pointer(maxVals + uintptr(c)*8)) = float64(*(*TUShort)(unsafe.Pointer(bufPtr))) } if float64(*(*TUShort)(unsafe.Pointer(bufPtr))) < *(*TDouble)(unsafe.Pointer(minVals + uintptr(c)*8)) { *(*TDouble)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(*(*TUShort)(unsafe.Pointer(bufPtr))) } bufPtr += 2 goto _4 _4: ; c++ } goto _3 _3: ; x++ } goto _2 _2: ; y++ } if verbose != 0 { libc.Xprintf(tls, __ccgo_ts+137, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+161, libc.VaList(bp+8, libc.Int32FromUint16(uint16(*(*TDouble)(unsafe.Pointer(minVals + uintptr(c)*8)))))) goto _5 _5: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xprintf(tls, __ccgo_ts+167, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+161, libc.VaList(bp+8, libc.Int32FromUint16(uint16(*(*TDouble)(unsafe.Pointer(maxVals + uintptr(c)*8)))))) goto _6 _6: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xfflush(tls, libc.Xstdout) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) return uint8(TRUE) } func _readUByteFile(tls *libc.TLS, interp uintptr, handle uintptr, buf uintptr, width TInt, height TInt, nchan TInt, swapBytes TBoln, isAscii TBoln, verbose TBoln, minVals uintptr, maxVals uintptr) (r TBoln) { bp := tls.Alloc(32) defer tls.Free(32) var bufPtr, line uintptr var c, x, y TInt _, _, _, _, _ = bufPtr, c, line, x, y bufPtr = buf c = 0 for { if !(c < nchan) { break } *(*TDouble)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(1.7976931348623157e+308) *(*TDouble)(unsafe.Pointer(maxVals + uintptr(c)*8)) = -libc.Float64FromFloat64(1.7976931348623157e+308) goto _1 _1: ; c++ } line = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, uint32(1)*libc.Uint32FromInt32(nchan)*libc.Uint32FromInt32(width)) if line == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+896, libc.UintptrFromInt32(0))) return uint8(FALSE) } y = 0 for { if !(y < height) { break } if !(_readUByteRow(tls, interp, handle, bufPtr, nchan*width, line, swapBytes, isAscii) != 0) { return uint8(FALSE) } x = 0 for { if !(x < width) { break } c = 0 for { if !(c < nchan) { break } if float64(*(*TUByte)(unsafe.Pointer(bufPtr))) > *(*TDouble)(unsafe.Pointer(maxVals + uintptr(c)*8)) { *(*TDouble)(unsafe.Pointer(maxVals + uintptr(c)*8)) = float64(*(*TUByte)(unsafe.Pointer(bufPtr))) } if float64(*(*TUByte)(unsafe.Pointer(bufPtr))) < *(*TDouble)(unsafe.Pointer(minVals + uintptr(c)*8)) { *(*TDouble)(unsafe.Pointer(minVals + uintptr(c)*8)) = float64(*(*TUByte)(unsafe.Pointer(bufPtr))) } bufPtr++ goto _4 _4: ; c++ } goto _3 _3: ; x++ } goto _2 _2: ; y++ } if verbose != 0 { libc.Xprintf(tls, __ccgo_ts+137, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+161, libc.VaList(bp+8, libc.Int32FromUint8(uint8(*(*TDouble)(unsafe.Pointer(minVals + uintptr(c)*8)))))) goto _5 _5: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xprintf(tls, __ccgo_ts+167, 0) c = 0 for { if !(c < nchan) { break } libc.Xprintf(tls, __ccgo_ts+161, libc.VaList(bp+8, libc.Int32FromUint8(uint8(*(*TDouble)(unsafe.Pointer(maxVals + uintptr(c)*8)))))) goto _6 _6: ; c++ } libc.Xprintf(tls, __ccgo_ts+165, 0) libc.Xfflush(tls, libc.Xstdout) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) return uint8(TRUE) } func _ParseFormatOpts8(tls *libc.TLS, interp uintptr, format uintptr, opts uintptr, mode int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var i, v2, v3 TTcl_Size var optionStr uintptr var _ /* boolVal at bp+12 */ int32 var _ /* doubleVal at bp+16 */ float64 var _ /* index at bp+4 */ int32 var _ /* objc at bp+0 */ TTcl_Size var _ /* objv at bp+8 */ uintptr _, _, _, _ = i, optionStr, v2, v3 /* Initialize options with default values. */ (*TFMTOPT8)(unsafe.Pointer(opts)).Fverbose = uint8(0) (*TFMTOPT8)(unsafe.Pointer(opts)).FminVal = -libc.Float64FromFloat64(1) (*TFMTOPT8)(unsafe.Pointer(opts)).FmaxVal = -libc.Float64FromFloat64(1) (*TFMTOPT8)(unsafe.Pointer(opts)).Fgamma = float64(1) (*TFMTOPT8)(unsafe.Pointer(opts)).FscanOrder = int32(TOP_DOWN) (*TFMTOPT8)(unsafe.Pointer(opts)).FwriteAscii = uint8(0) if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ListObjGetElementsPtr})))(tls, interp, format, bp, bp+8) == int32(TCL_ERROR) { return int32(TCL_ERROR) } i = int32(1) for { if !(i < *(*TTcl_Size)(unsafe.Pointer(bp))) { break } if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+32, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)<= float64(0) { (*TFMTOPT8)(unsafe.Pointer(opts)).FminVal = *(*float64)(unsafe.Pointer(bp + 16)) } case 3: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2687, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 16)) >= float64(0) { (*TFMTOPT8)(unsafe.Pointer(opts)).FmaxVal = *(*float64)(unsafe.Pointer(bp + 16)) } case 4: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) || *(*float64)(unsafe.Pointer(bp + 16)) < float64(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+1925, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT8)(unsafe.Pointer(opts)).Fgamma = *(*float64)(unsafe.Pointer(bp + 16)) break } } else { switch *(*int32)(unsafe.Pointer(bp + 4)) { case 0: if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+12) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+738, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT8)(unsafe.Pointer(opts)).Fverbose = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 12))) case 1: if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+12) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+49621, libc.VaList(bp+32, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT8)(unsafe.Pointer(opts)).FwriteAscii = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 12))) break } } goto _1 _1: ; i++ } return TCL_OK } var _readOptions8 = [6]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 49546, 2: __ccgo_ts + 1764, 3: __ccgo_ts + 1769, 4: __ccgo_ts + 1774, 5: libc.UintptrFromInt32(0), } var _writeOptions6 = [3]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 49557, 2: libc.UintptrFromInt32(0), } /* *---------------------------------------------------------------------- * * FileMatch -- * * This procedure is invoked by the photo image type to see if * a file contains image data in PPM format. * * Results: * The return value is >0 if the first characters in file "f" look * like PPM data, and 0 otherwise. * * Side effects: * The access position in f may change. * *---------------------------------------------------------------------- */ func _FileMatch3(tls *libc.TLS, chan1 TTcl_Channel, filename uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* dummy at bp+0 */ int32 var _ /* handle at bp+4 */ Ttkimg_Stream libc.Xmemset(tls, bp+4, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp+4, chan1) return _CommonMatch7(tls, bp+4, widthPtr, heightPtr, bp) } func _StringMatch3(tls *libc.TLS, dataObj uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* dummy at bp+0 */ int32 var _ /* handle at bp+4 */ Ttkimg_Stream libc.Xmemset(tls, bp+4, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp+4, dataObj) != 0) { return 0 } return _CommonMatch7(tls, bp+4, widthPtr, heightPtr, bp) } func _CommonMatch7(tls *libc.TLS, handle uintptr, widthPtr uintptr, heightPtr uintptr, maxIntensityPtr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* dummy at bp+0 */ TBoln return _ReadPPMFileHeader(tls, handle, widthPtr, heightPtr, maxIntensityPtr, bp) } /* *---------------------------------------------------------------------- * * FileRead -- * * This procedure is called by the photo image type to read * PPM format data from a file and write it into a given * photo image. * * Results: * A standard TCL completion code. If TCL_ERROR is returned * then an error message is left in the interp's result. * * Side effects: * The access position in file f is changed, and new data is * added to the image given by imageHandle. * *---------------------------------------------------------------------- */ func _FileRead3(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, filename uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonRead8(tls, interp, bp, filename, format, imageHandle, destX, destY, width, height, srcX, srcY) } func _StringRead3(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonRead8(tls, interp, bp, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY) } func _CommonRead8(tls *libc.TLS, interp uintptr, handle uintptr, filename uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(2304) defer tls.Free(2304) var bytesPerPixel, outY, stopY, type1, v1, v2, v3, v9 int32 var c, x, y TInt var pixbufPtr, ubyteBufPtr, ushortBufPtr, v7 uintptr var swapBytes TBoln var _ /* block at bp+12 */ TTk_PhotoImageBlock var _ /* buffer at bp+2232 */ [24]uint8 var _ /* fileHeight at bp+4 */ TInt var _ /* fileWidth at bp+0 */ TInt var _ /* gtable at bp+176 */ [257]TDouble var _ /* isAscii at bp+108 */ TBoln var _ /* maxIntensity at bp+8 */ TInt var _ /* maxVals at bp+144 */ [4]TDouble var _ /* minVals at bp+112 */ [4]TDouble var _ /* opts at bp+48 */ TFMTOPT8 var _ /* tf at bp+80 */ TPPMFILE _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bytesPerPixel, c, outY, pixbufPtr, stopY, swapBytes, type1, ubyteBufPtr, ushortBufPtr, x, y, v1, v2, v3, v7, v9 libc.Xmemset(tls, bp+80, 0, uint32(28)) swapBytes = libc.Uint8FromInt32((*(*func(*libc.TLS) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_IsIntelPtr})))(tls)) if _ParseFormatOpts8(tls, interp, format, bp+48, libc.Int32FromInt32(1)<= int32(65536) { libc.X__builtin_snprintf(tls, bp+2232, libc.Uint32FromInt32(libc.Int32FromInt32(3)*libc.Int32FromInt64(8)), __ccgo_ts+999, libc.VaList(bp+2264, *(*TInt)(unsafe.Pointer(bp + 8)))) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2264, __ccgo_ts+49725, filename, __ccgo_ts+49742, bp+2232, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if *(*TInt)(unsafe.Pointer(bp + 8)) >= int32(256) { v1 = int32(2) } else { v1 = int32(1) } bytesPerPixel = v1 (*(*func(*libc.TLS, float64, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_CreateGammaTablePtr})))(tls, (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).Fgamma, bp+176) if (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).Fverbose != 0 { if type1 == int32(PGM) { v2 = int32(1) } else { v2 = int32(3) } _printImgInfo7(tls, *(*TInt)(unsafe.Pointer(bp)), *(*TInt)(unsafe.Pointer(bp + 4)), *(*TInt)(unsafe.Pointer(bp + 8)), libc.Int32FromUint8(*(*TBoln)(unsafe.Pointer(bp + 108))), v2, bp+48, filename, __ccgo_ts+881) } if srcX+width > *(*TInt)(unsafe.Pointer(bp)) { width = *(*TInt)(unsafe.Pointer(bp)) - srcX } if srcY+height > *(*TInt)(unsafe.Pointer(bp + 4)) { height = *(*TInt)(unsafe.Pointer(bp + 4)) - srcY } if width <= 0 || height <= 0 || srcX >= *(*TInt)(unsafe.Pointer(bp)) || srcY >= *(*TInt)(unsafe.Pointer(bp + 4)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2264, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if type1 == int32(PGM) { (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize = int32(1) *(*int32)(unsafe.Pointer(bp + 12 + 20 + 1*4)) = 0 *(*int32)(unsafe.Pointer(bp + 12 + 20 + 2*4)) = 0 } else { (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize = int32(3) *(*int32)(unsafe.Pointer(bp + 12 + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 12 + 20 + 2*4)) = int32(2) } v3 = libc.Int32FromInt32(0) *(*int32)(unsafe.Pointer(bp + 12 + 20)) = v3 *(*int32)(unsafe.Pointer(bp + 12 + 20 + 3*4)) = v3 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).Fwidth = width (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).Fheight = int32(1) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).Fpitch = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize * *(*TInt)(unsafe.Pointer(bp)) (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).Fpixbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp))*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize)) if (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).Fpixbuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2264, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelPtr = (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).Fpixbuf + uintptr(srcX*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize) switch bytesPerPixel { case int32(2): (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FushortBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp))**(*TInt)(unsafe.Pointer(bp + 4))*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize)*uint32(2)) if (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FushortBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2264, __ccgo_ts+896, libc.UintptrFromInt32(0))) _ppmClose(tls, bp+80) return int32(TCL_ERROR) } if !(_readUShortFile(tls, interp, handle, (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FushortBuf, *(*TInt)(unsafe.Pointer(bp)), *(*TInt)(unsafe.Pointer(bp + 4)), (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize, swapBytes, *(*TBoln)(unsafe.Pointer(bp + 108)), (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).Fverbose, bp+112, bp+144) != 0) { _ppmClose(tls, bp+80) return int32(TCL_ERROR) } case int32(1): (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FubyteBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp))**(*TInt)(unsafe.Pointer(bp + 4))*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize)*uint32(1)) if (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FubyteBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2264, __ccgo_ts+896, libc.UintptrFromInt32(0))) _ppmClose(tls, bp+80) return int32(TCL_ERROR) } if !(_readUByteFile(tls, interp, handle, (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FubyteBuf, *(*TInt)(unsafe.Pointer(bp)), *(*TInt)(unsafe.Pointer(bp + 4)), (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize, swapBytes, *(*TBoln)(unsafe.Pointer(bp + 108)), (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).Fverbose, bp+112, bp+144) != 0) { _ppmClose(tls, bp+80) return int32(TCL_ERROR) } break } if (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).FminVal >= float64(0) { c = 0 for { if !(c < (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize) { break } (*(*[4]TDouble)(unsafe.Pointer(bp + 112)))[c] = (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).FminVal goto _4 _4: ; c++ } } if (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).FmaxVal >= float64(0) { c = 0 for { if !(c < (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize) { break } (*(*[4]TDouble)(unsafe.Pointer(bp + 144)))[c] = (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).FmaxVal goto _5 _5: ; c++ } } switch bytesPerPixel { case int32(2): (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr, uintptr, float64, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_RemapUShortValuesPtr})))(tls, (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FushortBuf, *(*TInt)(unsafe.Pointer(bp)), *(*TInt)(unsafe.Pointer(bp + 4)), (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize, bp+112, bp+144, float64(-libc.Float32FromFloat32(1)), 0) break } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+width, destY+height) == int32(TCL_ERROR) { _ppmClose(tls, bp+80) return int32(TCL_ERROR) } stopY = srcY + height outY = destY y = 0 for { if !(y < stopY) { break } pixbufPtr = (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).Fpixbuf switch bytesPerPixel { case int32(2): if (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).FscanOrder == BOTTOM_UP { ushortBufPtr = (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FushortBuf + uintptr((*(*TInt)(unsafe.Pointer(bp + 4))-int32(1)-y)**(*TInt)(unsafe.Pointer(bp))*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize)*2 } else { ushortBufPtr = (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FushortBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp))*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize)*2 } if (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).Fgamma != float64(1) { v7 = bp + 176 } else { v7 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, int32, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_UShortToUBytePtr})))(tls, *(*TInt)(unsafe.Pointer(bp))*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize, ushortBufPtr, v7, pixbufPtr) ushortBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp))*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize) * 2 case int32(1): if (*(*TFMTOPT8)(unsafe.Pointer(bp + 48))).FscanOrder == BOTTOM_UP { ubyteBufPtr = (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FubyteBuf + uintptr((*(*TInt)(unsafe.Pointer(bp + 4))-int32(1)-y)**(*TInt)(unsafe.Pointer(bp))*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize) } else { ubyteBufPtr = (*(*TPPMFILE)(unsafe.Pointer(bp + 80))).FubyteBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp))*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize) } x = 0 for { if !(x < *(*TInt)(unsafe.Pointer(bp))*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize) { break } *(*TUByte)(unsafe.Pointer(pixbufPtr + uintptr(x))) = *(*TUByte)(unsafe.Pointer(ubyteBufPtr + uintptr(x))) goto _8 _8: ; x++ } ubyteBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp)) * (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 12))).FpixelSize) break } if y >= srcY { if *(*int32)(unsafe.Pointer(bp + 12 + 20 + 3*4)) != 0 { v9 = int32(TK_PHOTO_COMPOSITE_SET) } else { v9 = TK_PHOTO_COMPOSITE_OVERLAY } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp+12, destX, outY, width, int32(1), v9) == int32(TCL_ERROR) { _ppmClose(tls, bp+80) return int32(TCL_ERROR) } outY++ } goto _6 _6: ; y++ } _ppmClose(tls, bp+80) return TCL_OK } /* *---------------------------------------------------------------------- * * FileWrite -- * * This procedure is invoked to write image data to a file in PPM * format. * * Results: * A standard TCL completion code. If TCL_ERROR is returned * then an error message is left in the interp's result. * * Side effects: * Data is written to the file given by "filename". * *---------------------------------------------------------------------- */ func _FileWrite3(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, filename, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite6(tls, interp, filename, format, bp, blockPtr) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } func _StringWrite3(tls *libc.TLS, interp uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = result libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp) result = _CommonWrite6(tls, interp, __ccgo_ts+865, format, bp, blockPtr) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp))).FbyteObj) } return result } func _writeAsciiRow(tls *libc.TLS, handle uintptr, scanline uintptr, nBytes int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var i int32 var _ /* buf at bp+0 */ [24]uint8 _ = i i = 0 for { if !(i < nBytes) { break } libc.X__builtin_snprintf(tls, bp, libc.Uint32FromInt32(libc.Int32FromInt32(3)*libc.Int32FromInt64(8)), __ccgo_ts+49777, libc.VaList(bp+32, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(scanline + uintptr(i)))))) if libc.Uint32FromInt32((*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, libc.Int32FromUint32(libc.Xstrlen(tls, bp)))) != libc.Xstrlen(tls, bp) { return i } goto _1 _1: ; i++ } return nBytes } func _CommonWrite6(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, handle uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(144) defer tls.Free(144) var blueOff, greenOff, h, nBytes, redOff, w, v1 int32 var pixLinePtr, pixelPtr, scanline, scanlinePtr, v4, v5, v6 uintptr var _ /* header at bp+0 */ [64]uint8 var _ /* opts at bp+64 */ TFMTOPT8 _, _, _, _, _, _, _, _, _, _, _, _, _, _ = blueOff, greenOff, h, nBytes, pixLinePtr, pixelPtr, redOff, scanline, scanlinePtr, w, v1, v4, v5, v6 if _ParseFormatOpts8(tls, interp, format, bp+64, libc.Int32FromInt32(1)< 0) { break } pixelPtr = pixLinePtr scanlinePtr = scanline w = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth for { if !(w > 0) { break } v4 = scanlinePtr scanlinePtr++ *(*uint8)(unsafe.Pointer(v4)) = *(*uint8)(unsafe.Pointer(pixelPtr + uintptr(redOff))) v5 = scanlinePtr scanlinePtr++ *(*uint8)(unsafe.Pointer(v5)) = *(*uint8)(unsafe.Pointer(pixelPtr + uintptr(greenOff))) v6 = scanlinePtr scanlinePtr++ *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(pixelPtr + uintptr(blueOff))) pixelPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) goto _3 _3: ; w-- } if (*(*TFMTOPT8)(unsafe.Pointer(bp + 64))).FwriteAscii != 0 { if _writeAsciiRow(tls, handle, scanline, nBytes) != nBytes { goto writeerror } } else { if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, scanline, nBytes) != nBytes { goto writeerror } } pixLinePtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) goto _2 _2: ; h-- } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, scanline) return TCL_OK goto writeerror writeerror: ; (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+104, __ccgo_ts+49796, filename, __ccgo_ts+4666, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } /* *---------------------------------------------------------------------- * * ReadPPMFileHeader -- * * This procedure reads the PPM header from the beginning of a * PPM file and returns information from the header. * * Results: * The return value is PGM if file "f" appears to start with * a valid PGM header, PPM if "f" appears to start with a valid * PPM header, and 0 otherwise. If the header is valid, * then *widthPtr and *heightPtr are modified to hold the * dimensions of the image and *maxIntensityPtr is modified to * hold the value of a "fully on" intensity value. * * Side effects: * The access position in f advances. * *---------------------------------------------------------------------- */ func _ReadPPMFileHeader(tls *libc.TLS, handle uintptr, widthPtr uintptr, heightPtr uintptr, maxIntensityPtr uintptr, isAsciiPtr uintptr) (r int32) { bp := tls.Alloc(1040) defer tls.Free(1040) var i, numFields, type1, v2, v3, v5, v6 int32 var _ /* buffer at bp+0 */ [1000]uint8 var _ /* c at bp+1000 */ uint8 _, _, _, _, _, _, _ = i, numFields, type1, v2, v3, v5, v6 type1 = 0 /* * Read 4 space-separated fields from the file, ignoring * comments (any line that starts with "#"). */ if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+1000, int32(1)) != int32(1) { return 0 } i = 0 numFields = 0 for { if !(numFields < int32(4)) { break } /* * Skip comments and white space. */ for int32(1) != 0 { for { v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 1000))) v3 = libc.BoolInt32(v2 == int32(' ') || libc.Uint32FromInt32(v2)-uint32('\t') < uint32(5)) goto _4 _4: if !(v3 != 0) { break } if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+1000, int32(1)) != int32(1) { return 0 } } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 1000))) != int32('#') { break } for cond := true; cond; cond = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 1000))) != int32('\n') { if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+1000, int32(1)) != int32(1) { return 0 } } } /* * Read a field (everything up to the next white space). */ for { v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp + 1000))) v6 = libc.BoolInt32(v5 == int32(' ') || libc.Uint32FromInt32(v5)-uint32('\t') < uint32(5)) goto _7 _7: if !!(v6 != 0) { break } if i < libc.Int32FromInt32(BUFFER_SIZE)-libc.Int32FromInt32(2) { (*(*[1000]uint8)(unsafe.Pointer(bp)))[i] = *(*uint8)(unsafe.Pointer(bp + 1000)) i++ } if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+1000, int32(1)) != int32(1) { goto done } } if i < libc.Int32FromInt32(BUFFER_SIZE)-libc.Int32FromInt32(1) { (*(*[1000]uint8)(unsafe.Pointer(bp)))[i] = uint8(' ') i++ } goto _1 _1: ; numFields++ } goto done done: ; (*(*[1000]uint8)(unsafe.Pointer(bp)))[i] = uint8(0) /* * Parse the fields, which are: id, width, height, maxIntensity. */ *(*TBoln)(unsafe.Pointer(isAsciiPtr)) = uint8(0) if libc.Xstrncmp(tls, bp, __ccgo_ts+49812, uint32(3)) == 0 { type1 = int32(PPM) } else { if libc.Xstrncmp(tls, bp, __ccgo_ts+49816, uint32(3)) == 0 { type1 = int32(PPM) *(*TBoln)(unsafe.Pointer(isAsciiPtr)) = uint8(1) } else { if libc.Xstrncmp(tls, bp, __ccgo_ts+49820, uint32(3)) == 0 { type1 = int32(PGM) } else { if libc.Xstrncmp(tls, bp, __ccgo_ts+49824, uint32(3)) == 0 { type1 = int32(PGM) *(*TBoln)(unsafe.Pointer(isAsciiPtr)) = uint8(1) } else { return 0 } } } } if libc.Xsscanf(tls, bp+uintptr(3), __ccgo_ts+49828, libc.VaList(bp+1016, widthPtr, heightPtr, maxIntensityPtr)) != int32(3) { return 0 } return type1 } const NUM_PARAMS = 9 const PACKAGE_NAME14 = "tkimgps" const PACKAGE_STRING14 = "tkimgps 2.0.1" const PACKAGE_TARNAME14 = "tkimgps" const PACKAGE_TCLNAME11 = "img::ps" const SECOND_FILEMATCH = "FileMatchBeta" const SECOND_FILEREAD = "FileRead" const SECOND_FILEWRITE = "FileWriteBeta" const SECOND_STRINGMATCH = "StringMatchBeta" const SECOND_STRINGREAD = "StringRead" const SECOND_STRINGWRITE = "StringWriteBeta" var _sImageFormat4 = TTk_PhotoImageFormat{ Fname: __ccgo_ts + 49837, } func init() { p := unsafe.Pointer(&_sImageFormat4) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatch4) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatch4) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileRead4) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringRead4) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWrite4) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWrite4) } var _sImageFormatBeta = TTk_PhotoImageFormat{ Fname: __ccgo_ts + 49840, } func init() { p := unsafe.Pointer(&_sImageFormatBeta) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatchBeta) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatchBeta) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileRead4) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringRead4) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWriteBeta) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWriteBeta) } /* *---------------------------------------------------------------------------- * * Tkimgps_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgps_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+40, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { /* No more parameters available. */ break } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i+int32(1))*4)), libc.UintptrFromInt32(0)) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(optionStr))) == int32('-') { /* Next parameter is an option. */ break } if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+24) == int32(TCL_ERROR) || *(*float64)(unsafe.Pointer(bp + 24)) <= float64(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+50044, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT9)(unsafe.Pointer(opts)).Fyzoom = *(*float64)(unsafe.Pointer(bp + 24)) (*TFMTOPT9)(unsafe.Pointer(opts)).FyzoomDpi = float64(72)**(*float64)(unsafe.Pointer(bp + 24)) + float64(0.5) i++ case 3: libc.X__builtin_snprintf(tls, opts+40, uint32(1024), __ccgo_ts+39133, libc.VaList(bp+40, optionStr)) break } } else { /* No write functionality. */ } goto _1 _1: ; i++ } return TCL_OK } var _readOptions9 = [5]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 3206, 2: __ccgo_ts + 49962, 3: __ccgo_ts + 49968, 4: libc.UintptrFromInt32(0), } func _FileMatch4(tls *libc.TLS, chan1 TTcl_Channel, fileName uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonMatchPS(tls, interp, bp, format, widthPtr, heightPtr) } func _StringMatch4(tls *libc.TLS, dataObj uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonMatchPS(tls, interp, bp, format, widthPtr, heightPtr) } func _CommonMatchPS(tls *libc.TLS, interp uintptr, handle uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr) (r int32) { bp := tls.Alloc(1120) defer tls.Free(1120) var h, w int32 var _ /* buf at bp+0 */ [41]uint8 var _ /* opts at bp+48 */ TFMTOPT9 var _ /* p at bp+1112 */ uintptr _, _ = h, w if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(11)) != int32(11) || libc.Xstrncmp(tls, __ccgo_ts+50113, bp, uint32(11)) != 0 { return 0 } for (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(1)) == int32(1) { if libc.Int32FromUint8((*(*[41]uint8)(unsafe.Pointer(bp)))[0]) == int32('%') && (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(2)) == int32(2) && (!(libc.Xmemcmp(tls, bp, __ccgo_ts+50125, uint32(2)) != 0) && (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(11)) == int32(11) && !(libc.Xmemcmp(tls, bp, __ccgo_ts+50128, uint32(11)) != 0) && (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(40)) == int32(40)) { *(*uintptr)(unsafe.Pointer(bp + 1112)) = bp (*(*[41]uint8)(unsafe.Pointer(bp)))[int32(40)] = uint8(0) w = -libc.Int32FromUint32(libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 1112)), bp+1112, 0)) h = -libc.Int32FromUint32(libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 1112)), bp+1112, 0)) w = int32(uint32(w) + libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 1112)), bp+1112, 0)) h = int32(uint32(h) + libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 1112)), bp+1112, 0)) if _ParseFormatOpts9(tls, interp, format, bp+48, libc.Int32FromInt32(1)< 0 { (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Write})))(tls, chan1, bp+44, int32(1024)) len1 = (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+44, int32(1024)) } (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Write})))(tls, chan1, __ccgo_ts+50245, int32(6)) (*(*func(*libc.TLS, TTcl_Channel) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Flush})))(tls, chan1) (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, (*TTcl_DString)(unsafe.Pointer(bp+1072)).Fstring1, __ccgo_ts+48463) if !(chan1 != 0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1284) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1072) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringInit})))(tls, bp+1688) len1 = (*(*func(*libc.TLS, TTcl_Channel, uintptr) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Gets})))(tls, chan1, bp+1688) *(*uintptr)(unsafe.Pointer(bp + 40)) = (*TTcl_DString)(unsafe.Pointer(bp + 1688)).Fstring1 type1 = *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40)) + 1)) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40))))) != int32('P') || libc.Int32FromUint8(type1) < int32('4') || libc.Int32FromUint8(type1) > int32('6') { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+3008, __ccgo_ts+50252, *(*uintptr)(unsafe.Pointer(bp + 40)), __ccgo_ts+3328, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_DeleteFilePtr})))(tls, (*TTcl_DString)(unsafe.Pointer(bp+1072)).Fstring1) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1284) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1072) return int32(TCL_ERROR) } for cond := true; cond; cond = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40))))) == int32('#') { (*(*func(*libc.TLS, uintptr, TTcl_Size))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringSetLength})))(tls, bp+1688, 0) (*(*func(*libc.TLS, TTcl_Channel, uintptr) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Gets})))(tls, chan1, bp+1688) *(*uintptr)(unsafe.Pointer(bp + 40)) = (*TTcl_DString)(unsafe.Pointer(bp + 1688)).Fstring1 } fileWidth = libc.Int32FromUint32(libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 40)), bp+40, 0)) v1 = libc.Int32FromUint32(libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 40)), bp+40, 0)) fileHeight = v1 srcY += v1 if srcX+width > fileWidth { width = fileWidth - srcX } if srcY+height > fileHeight { height = fileHeight - srcY } if width <= 0 || height <= 0 { (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_DeleteFilePtr})))(tls, (*TTcl_DString)(unsafe.Pointer(bp+1072)).Fstring1) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1284) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1072) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1688) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+3008, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*TFMTOPT9)(unsafe.Pointer(bp + 1936))).Fverbose != 0 { _printImgInfo8(tls, width, height, (*(*TFMTOPT9)(unsafe.Pointer(bp + 1936))).FpageIndex, (*(*TFMTOPT9)(unsafe.Pointer(bp + 1936))).Fxzoom, (*(*TFMTOPT9)(unsafe.Pointer(bp + 1936))).Fyzoom, bp, int32(NUM_PARAMS), fileName, __ccgo_ts+881) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+width, destY+height) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_DeleteFilePtr})))(tls, (*TTcl_DString)(unsafe.Pointer(bp+1072)).Fstring1) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1284) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1072) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1688) return int32(TCL_ERROR) } maxintensity = libc.Int32FromUint32(libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 40)), bp+40, 0)) if libc.Int32FromUint8(type1) != int32('4') && !(maxintensity != 0) { (*(*func(*libc.TLS, uintptr, TTcl_Size))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringSetLength})))(tls, bp+1688, 0) (*(*func(*libc.TLS, TTcl_Channel, uintptr) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Gets})))(tls, chan1, bp+1688) *(*uintptr)(unsafe.Pointer(bp + 40)) = (*TTcl_DString)(unsafe.Pointer(bp + 1688)).Fstring1 maxintensity = libc.Int32FromUint32(libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 40)), bp+40, 0)) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1688) line3 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Alloc})))(tls, libc.Uint32FromInt32(int32(3)*fileWidth)) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 1900))).FpixelSize = int32(1) v2 = width (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 1900))).Fwidth = v2 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 1900))).Fpitch = v2 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 1900))).Fheight = int32(1) *(*int32)(unsafe.Pointer(bp + 1900 + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 1900 + 20 + 1*4)) = 0 *(*int32)(unsafe.Pointer(bp + 1900 + 20 + 2*4)) = 0 *(*int32)(unsafe.Pointer(bp + 1900 + 20 + 3*4)) = 0 switch libc.Int32FromUint8(type1) { case int32('4'): i = (fileWidth + int32(7)) / int32(8) line = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Alloc})))(tls, libc.Uint32FromInt32(i)) for { v3 = srcY srcY-- if !(v3 > 0) { break } (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, chan1, line, i) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 1900))).FpixelPtr = line3 for { v4 = height height-- if !(v4 != 0) { break } (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, chan1, line, i) j = 0 for { if !(j < width) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(line + uintptr((j+srcX)/int32(8)))))>>(int32(7)-(j+srcX)%int32(8))&int32(1) != 0 { v6 = 0 } else { v6 = int32(255) } *(*uint8)(unsafe.Pointer(line3 + uintptr(j))) = libc.Uint8FromInt32(v6) goto _5 _5: ; j++ } v7 = destY destY++ if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp+1900, destX, v7, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = int32(TCL_ERROR) break } } case int32('5'): line = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Alloc})))(tls, libc.Uint32FromInt32(fileWidth)) for { v8 = srcY srcY-- if !(v8 > 0) { break } (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, chan1, line, fileWidth) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 1900))).FpixelPtr = line + uintptr(srcX) for { v9 = height height-- if !(v9 != 0) { break } c = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 1900))).FpixelPtr (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, chan1, line, fileWidth) if maxintensity != int32(255) { j = width for { if !(j > 0) { break } *(*uint8)(unsafe.Pointer(c)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(c))) * maxintensity / int32(255)) c++ goto _10 _10: ; j-- } } v11 = destY destY++ if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp+1900, destX, v11, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = int32(TCL_ERROR) break } } case int32('6'): i = int32(3) * fileWidth line = libc.UintptrFromInt32(0) for { v12 = srcY srcY-- if !(v12 > 0) { break } (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, chan1, line3, i) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 1900))).FpixelPtr = line3 + uintptr(libc.Int32FromInt32(3)*srcX) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 1900))).FpixelSize = int32(3) *(*int32)(unsafe.Pointer(bp + 1900 + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 1900 + 20 + 2*4)) = int32(2) for { v13 = height height-- if !(v13 != 0) { break } c1 = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 1900))).FpixelPtr (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, chan1, line3, i) if maxintensity != int32(255) { j = int32(3)*width - int32(1) for { if !(j >= 0) { break } *(*uint8)(unsafe.Pointer(c1)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(c1))) * maxintensity / int32(255)) c1++ goto _14 _14: ; j-- } } v15 = destY destY++ if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp+1900, destX, v15, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = int32(TCL_ERROR) break } } break } if line != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line) } if line3 != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, line3) } (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_DeleteFilePtr})))(tls, (*TTcl_DString)(unsafe.Pointer(bp+1072)).Fstring1) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1284) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+1072) return result } func _FileWrite4(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2034, libc.VaList(bp+8, _sImageFormat4.Fname))) return int32(TCL_ERROR) } func _StringWrite4(tls *libc.TLS, interp uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2034, libc.VaList(bp+8, _sImageFormat4.Fname))) return int32(TCL_ERROR) } func _FileMatchBeta(tls *libc.TLS, chan1 TTcl_Channel, fileName uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonMatchPDF(tls, interp, bp, format, widthPtr, heightPtr) } func _StringMatchBeta(tls *libc.TLS, dataObj uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonMatchPDF(tls, interp, bp, format, widthPtr, heightPtr) } func _CommonMatchPDF(tls *libc.TLS, interp uintptr, handle uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr) (r int32) { bp := tls.Alloc(1120) defer tls.Free(1120) var h, w int32 var _ /* buf at bp+0 */ [41]uint8 var _ /* opts at bp+48 */ TFMTOPT9 _, _ = h, w if (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(5)) != int32(5) || libc.Xstrncmp(tls, __ccgo_ts+50264, bp, uint32(5)) != 0 { return 0 } /* Here w and h should be set to the bounding box of the pdf * data. But I don't know how to extract that from the file. * For now I just assume A4-size with 72 pixels/inch. If anyone * has a better idea, please mail to . */ /* A4 size is 21.0 x 29.7 cm */ w = int32(libc.X__builtin_round(tls, libc.Float64FromFloat64(21)/libc.Float64FromFloat64(2.54)*float64(72))) h = int32(libc.X__builtin_round(tls, libc.Float64FromFloat64(29.7)/libc.Float64FromFloat64(2.54)*float64(72))) if _ParseFormatOpts9(tls, interp, format, bp+48, libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v4 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+40, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v4)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)< int32(4) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+51477, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT10)(unsafe.Pointer(opts)).Fnchan = *(*int32)(unsafe.Pointer(bp + 16)) case 5: if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+1549, libc.Xstrlen(tls, __ccgo_ts+1549)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FbyteOrder = INTEL } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+1555, libc.Xstrlen(tls, __ccgo_ts+1555)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FbyteOrder = int32(MOTOROLA) } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+51532, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } } case 6: if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+49418, libc.Xstrlen(tls, __ccgo_ts+49418)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FscanOrder = int32(TOP_DOWN) } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+49426, libc.Xstrlen(tls, __ccgo_ts+49426)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FscanOrder = BOTTOM_UP } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+51588, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } } case 7: if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+2114, libc.Xstrlen(tls, __ccgo_ts+2114)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FpixelType = TYPE_DOUBLE1 } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+2121, libc.Xstrlen(tls, __ccgo_ts+2121)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FpixelType = int32(TYPE_FLOAT1) } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+2127, libc.Xstrlen(tls, __ccgo_ts+2127)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FpixelType = int32(TYPE_UINT) } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+2131, libc.Xstrlen(tls, __ccgo_ts+2131)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FpixelType = int32(TYPE_USHORT) } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+50283, libc.Xstrlen(tls, __ccgo_ts+50283)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FpixelType = int32(TYPE_UBYTE) } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+51646, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } } } } } case 10: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+24) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2631, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 24)) >= float64(0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FminVal = *(*float64)(unsafe.Pointer(bp + 24)) } case 11: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+24) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2687, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 24)) >= float64(0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FmaxVal = *(*float64)(unsafe.Pointer(bp + 24)) } case 12: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+24) == int32(TCL_ERROR) || *(*float64)(unsafe.Pointer(bp + 24)) < float64(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+1925, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 24)) >= float64(0) { (*TFMTOPT10)(unsafe.Pointer(opts)).Fgamma = *(*float64)(unsafe.Pointer(bp + 24)) } case 9: if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+2169, libc.Xstrlen(tls, __ccgo_ts+2169)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FmapMode = IMG_MAP_NONE } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+2174, libc.Xstrlen(tls, __ccgo_ts+2174)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FmapMode = int32(IMG_MAP_MINMAX) } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+2181, libc.Xstrlen(tls, __ccgo_ts+2181)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FmapMode = int32(IMG_MAP_AGC) } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2743, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } } } case 16: /* -uuencode is obsolete. */ case 13: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+24) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2799, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 24)) >= float64(0) { (*TFMTOPT10)(unsafe.Pointer(opts)).Fsaturation = *(*float64)(unsafe.Pointer(bp + 24)) } case 14: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetDouble})))(tls, interp, optionStr, bp+24) == int32(TCL_ERROR) || *(*float64)(unsafe.Pointer(bp + 24)) < float64(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2854, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } if *(*float64)(unsafe.Pointer(bp + 24)) >= float64(0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FcutOff = *(*float64)(unsafe.Pointer(bp + 24)) } case 17: /* Option "-nomap" for backward compatibility. */ if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+12) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+51718, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } if *(*int32)(unsafe.Pointer(bp + 12)) != 0 { (*TFMTOPT10)(unsafe.Pointer(opts)).FmapMode = IMG_MAP_NONE } case 15: if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+12) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+2930, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT10)(unsafe.Pointer(opts)).FprintAgc = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 12))) case 8: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetInt})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) || *(*int32)(unsafe.Pointer(bp + 16)) < 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+51785, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT10)(unsafe.Pointer(opts)).FskipBytes = *(*int32)(unsafe.Pointer(bp + 16)) break } } else { switch *(*int32)(unsafe.Pointer(bp + 4)) { case 0: if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+12) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+738, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT10)(unsafe.Pointer(opts)).Fverbose = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 12))) case 1: if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+12) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+51253, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT10)(unsafe.Pointer(opts)).FuseHeader = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 12))) case 2: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetInt})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) || *(*int32)(unsafe.Pointer(bp + 16)) <= 0 || *(*int32)(unsafe.Pointer(bp + 16)) > int32(4) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+51477, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT10)(unsafe.Pointer(opts)).Fnchan = *(*int32)(unsafe.Pointer(bp + 16)) case 3: if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+49418, libc.Xstrlen(tls, __ccgo_ts+49418)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FscanOrder = int32(TOP_DOWN) } else { if !(libc.Xstrncmp(tls, optionStr, __ccgo_ts+49426, libc.Xstrlen(tls, __ccgo_ts+49426)) != 0) { (*TFMTOPT10)(unsafe.Pointer(opts)).FscanOrder = BOTTOM_UP } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+51588, libc.VaList(bp+40, optionStr))) return int32(TCL_ERROR) } } break } } goto _2 _2: ; i++ } /* Convert minimum and maximum range values. */ if (*TFMTOPT10)(unsafe.Pointer(opts)).FminVal >= float64(0) && (*TFMTOPT10)(unsafe.Pointer(opts)).FmaxVal >= float64(0) && (*TFMTOPT10)(unsafe.Pointer(opts)).FminVal >= (*TFMTOPT10)(unsafe.Pointer(opts)).FmaxVal { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+3000, 0)) return int32(TCL_ERROR) } return TCL_OK } var _readOptions10 = [19]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 51160, 2: __ccgo_ts + 51171, 3: __ccgo_ts + 51178, 4: __ccgo_ts + 51186, 5: __ccgo_ts + 51193, 6: __ccgo_ts + 49546, 7: __ccgo_ts + 51204, 8: __ccgo_ts + 51215, 9: __ccgo_ts + 2596, 10: __ccgo_ts + 1764, 11: __ccgo_ts + 1769, 12: __ccgo_ts + 1774, 13: __ccgo_ts + 2601, 14: __ccgo_ts + 2613, 15: __ccgo_ts + 2621, 16: __ccgo_ts + 51226, 17: __ccgo_ts + 51236, 18: libc.UintptrFromInt32(0), } var _writeOptions7 = [5]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 51160, 2: __ccgo_ts + 51186, 3: __ccgo_ts + 51243, 4: libc.UintptrFromInt32(0), } func _FileMatch5(tls *libc.TLS, chan1 TTcl_Channel, filename uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonMatch8(tls, interp, bp, format, widthPtr, heightPtr, libc.UintptrFromInt32(0)) } func _StringMatch5(tls *libc.TLS, dataObj uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return FALSE } return _CommonMatch8(tls, interp, bp, format, widthPtr, heightPtr, libc.UintptrFromInt32(0)) } func _CommonMatch8(tls *libc.TLS, interp uintptr, handle uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, rawHeaderPtr uintptr) (r int32) { bp := tls.Alloc(144) defer tls.Free(144) var buf uintptr var _ /* opts at bp+32 */ TFMTOPT10 var _ /* th at bp+0 */ TRAWHEADER _ = buf _initHeader(tls, bp) if _ParseFormatOpts10(tls, interp, format, bp+32, libc.Int32FromInt32(1)< 0 { buf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32((*(*TFMTOPT10)(unsafe.Pointer(bp + 32))).FskipBytes)) if buf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+120, __ccgo_ts+896, libc.UintptrFromInt32(0))) return FALSE } if (*(*TFMTOPT10)(unsafe.Pointer(bp + 32))).FskipBytes != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, buf, (*(*TFMTOPT10)(unsafe.Pointer(bp + 32))).FskipBytes) { return FALSE } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buf) } } *(*int32)(unsafe.Pointer(widthPtr)) = (*(*TRAWHEADER)(unsafe.Pointer(bp))).Fwidth *(*int32)(unsafe.Pointer(heightPtr)) = (*(*TRAWHEADER)(unsafe.Pointer(bp))).Fheight if rawHeaderPtr != 0 { *(*TRAWHEADER)(unsafe.Pointer(rawHeaderPtr)) = *(*TRAWHEADER)(unsafe.Pointer(bp)) } return int32(TRUE) } func _FileRead5(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, filename uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonRead10(tls, interp, bp, filename, format, imageHandle, destX, destY, width, height, srcX, srcY) } func _StringRead5(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return int32(TCL_ERROR) } return _CommonRead10(tls, interp, bp, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY) } func _CommonRead10(tls *libc.TLS, interp uintptr, handle uintptr, filename uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(2336) defer tls.Free(2336) var byteOrder, c, pixelType, scanOrder, x, y TInt var doubleBufPtr, floatBufPtr, pixbufPtr, ubyteBufPtr, uintBufPtr, ushortBufPtr, v17, v18, v19, v20 uintptr var fastMode, swapBytes TBoln var outHeight, outWidth, outY, result, stopY, v1, v11, v12, v13, v14, v15, v2, v22, v3 int32 var v10, v7, v8, v9 TDouble var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* fileHeight at bp+40 */ TInt var _ /* fileWidth at bp+36 */ TInt var _ /* gtable at bp+248 */ [257]TDouble var _ /* maxVals at bp+80 */ [4]TDouble var _ /* minVals at bp+48 */ [4]TDouble var _ /* opts at bp+168 */ TFMTOPT10 var _ /* tf at bp+112 */ TRAWFILE _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = byteOrder, c, doubleBufPtr, fastMode, floatBufPtr, outHeight, outWidth, outY, pixbufPtr, pixelType, result, scanOrder, stopY, swapBytes, ubyteBufPtr, uintBufPtr, ushortBufPtr, x, y, v1, v10, v11, v12, v13, v14, v15, v17, v18, v19, v2, v20, v22, v3, v7, v8, v9 *(*TInt)(unsafe.Pointer(bp + 36)) = 0 *(*TInt)(unsafe.Pointer(bp + 40)) = 0 result = TCL_OK libc.Xmemset(tls, bp+112, 0, uint32(52)) _initHeader(tls, bp+112) if !(_CommonMatch8(tls, interp, handle, format, bp+36, bp+40, bp+112) != 0) { return int32(TCL_ERROR) } if _ParseFormatOpts10(tls, interp, format, bp+168, libc.Int32FromInt32(1)< *(*TInt)(unsafe.Pointer(bp + 36)) { outWidth = *(*TInt)(unsafe.Pointer(bp + 36)) - srcX } else { outWidth = width } if srcY+height > *(*TInt)(unsafe.Pointer(bp + 40)) { outHeight = *(*TInt)(unsafe.Pointer(bp + 40)) - srcY } else { outHeight = height } if outWidth <= 0 || outHeight <= 0 || srcX >= *(*TInt)(unsafe.Pointer(bp + 36)) || srcY >= *(*TInt)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2312, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FuseHeader != 0 { v1 = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FbyteOrder } else { v1 = (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FbyteOrder } byteOrder = v1 if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FuseHeader != 0 { v2 = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FscanOrder } else { v2 = (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FscanOrder } scanOrder = v2 if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FuseHeader != 0 { v3 = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FpixelType } else { v3 = (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FpixelType } pixelType = v3 swapBytes = libc.BoolUint8((*(*func(*libc.TLS) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_IsIntelPtr})))(tls) != 0 && byteOrder != INTEL || !((*(*func(*libc.TLS) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_IsIntelPtr})))(tls) != 0) && byteOrder == INTEL) fastMode = libc.BoolUint8((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode == IMG_MAP_NONE && pixelType == int32(TYPE_UBYTE) && scanOrder == int32(TOP_DOWN) && *(*TInt)(unsafe.Pointer(bp + 36)) == width && *(*TInt)(unsafe.Pointer(bp + 40)) == height) if !(fastMode != 0) { (*(*func(*libc.TLS, float64, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_CreateGammaTablePtr})))(tls, (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fgamma, bp+248) } switch pixelType { case TYPE_DOUBLE1: (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FdoubleBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))**(*TInt)(unsafe.Pointer(bp + 40))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*uint32(8)) if (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FdoubleBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2312, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, uintptr, int32, int32, int32, int32, int32, int32, uintptr, uintptr, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadDoubleFilePtr})))(tls, handle, (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FdoubleBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, libc.Int32FromUint8(swapBytes), libc.Int32FromUint8((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fverbose), libc.BoolInt32((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode != IMG_MAP_NONE), bp+48, bp+80, (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fsaturation) case int32(TYPE_FLOAT1): (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FfloatBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))**(*TInt)(unsafe.Pointer(bp + 40))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*uint32(4)) if (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FfloatBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2312, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, uintptr, int32, int32, int32, int32, int32, int32, uintptr, uintptr, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadFloatFilePtr})))(tls, handle, (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FfloatBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, libc.Int32FromUint8(swapBytes), libc.Int32FromUint8((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fverbose), libc.BoolInt32((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode != IMG_MAP_NONE), bp+48, bp+80, (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fsaturation) case int32(TYPE_UINT): (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FuintBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))**(*TInt)(unsafe.Pointer(bp + 40))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*uint32(4)) if (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FuintBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2312, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, uintptr, int32, int32, int32, int32, int32, int32, uintptr, uintptr, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadUIntFilePtr})))(tls, handle, (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FuintBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, libc.Int32FromUint8(swapBytes), libc.Int32FromUint8((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fverbose), libc.BoolInt32((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode != IMG_MAP_NONE), bp+48, bp+80, (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fsaturation) case int32(TYPE_USHORT): (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FushortBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))**(*TInt)(unsafe.Pointer(bp + 40))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*uint32(2)) if (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FushortBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2312, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, uintptr, int32, int32, int32, int32, int32, int32, uintptr, uintptr, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadUShortFilePtr})))(tls, handle, (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FushortBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, libc.Int32FromUint8(swapBytes), libc.Int32FromUint8((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fverbose), libc.BoolInt32((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode != IMG_MAP_NONE), bp+48, bp+80, (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fsaturation) case int32(TYPE_UBYTE): (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FubyteBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))**(*TInt)(unsafe.Pointer(bp + 40))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*uint32(1)) if (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FubyteBuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2312, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, uintptr, int32, int32, int32, int32, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadUByteFilePtr})))(tls, handle, (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FubyteBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, libc.Int32FromUint8((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fverbose), libc.BoolInt32((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode != IMG_MAP_NONE), bp+48, bp+80) break } switch (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode { case IMG_MAP_NONE: c = 0 for { if !(c < (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) { break } (*(*[4]TDouble)(unsafe.Pointer(bp + 48)))[c] = float64(0) (*(*[4]TDouble)(unsafe.Pointer(bp + 80)))[c] = float64(255) goto _4 _4: ; c++ } case int32(IMG_MAP_MINMAX): if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FminVal >= float64(0) { c = 0 for { if !(c < (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) { break } (*(*[4]TDouble)(unsafe.Pointer(bp + 48)))[c] = (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FminVal goto _5 _5: ; c++ } } if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmaxVal >= float64(0) { c = 0 for { if !(c < (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) { break } (*(*[4]TDouble)(unsafe.Pointer(bp + 80)))[c] = (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmaxVal goto _6 _6: ; c++ } } case int32(IMG_MAP_AGC): /* Nothing to do. Saturation is considered in tkimg_ReadFloatFile. */ break } switch pixelType { case TYPE_DOUBLE1: if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode == int32(IMG_MAP_AGC) { v7 = (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FcutOff } else { v7 = -libc.Float64FromFloat64(1) } (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr, uintptr, float64, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_RemapDoubleValuesPtr})))(tls, (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FdoubleBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, bp+48, bp+80, v7, libc.Int32FromUint8((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FprintAgc)) case int32(TYPE_FLOAT1): if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode == int32(IMG_MAP_AGC) { v8 = (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FcutOff } else { v8 = -libc.Float64FromFloat64(1) } (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr, uintptr, float64, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_RemapFloatValuesPtr})))(tls, (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FfloatBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, bp+48, bp+80, v8, libc.Int32FromUint8((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FprintAgc)) case int32(TYPE_UINT): if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode == int32(IMG_MAP_AGC) { v9 = (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FcutOff } else { v9 = -libc.Float64FromFloat64(1) } (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr, uintptr, float64, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_RemapUIntValuesPtr})))(tls, (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FuintBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, bp+48, bp+80, v9, libc.Int32FromUint8((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FprintAgc)) case int32(TYPE_USHORT): if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FmapMode == int32(IMG_MAP_AGC) { v10 = (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FcutOff } else { v10 = -libc.Float64FromFloat64(1) } (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr, uintptr, float64, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_RemapUShortValuesPtr})))(tls, (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FushortBuf, *(*TInt)(unsafe.Pointer(bp + 36)), *(*TInt)(unsafe.Pointer(bp + 40)), (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, bp+48, bp+80, v10, libc.Int32FromUint8((*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).FprintAgc)) break } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+outWidth, destY+outHeight) == int32(TCL_ERROR) { _rawClose(tls, bp+112, fastMode) return int32(TCL_ERROR) } if fastMode != 0 { (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fpixbuf = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FubyteBuf } else { (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fpixbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)) if (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fpixbuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2312, __ccgo_ts+896, libc.UintptrFromInt32(0))) _rawClose(tls, bp+112, fastMode) return int32(TCL_ERROR) } } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = *(*TInt)(unsafe.Pointer(bp + 36)) * (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = outWidth if fastMode != 0 { v11 = outHeight } else { v11 = int32(1) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = v11 *(*int32)(unsafe.Pointer(bp + 20)) = 0 if (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans > int32(1) { v12 = int32(1) } else { v12 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = v12 if (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans > int32(2) { v13 = int32(2) } else { v13 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = v13 if (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans > int32(3) { v14 = int32(3) } else { v14 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = v14 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fpixbuf + uintptr(srcX*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) stopY = srcY + outHeight outY = destY if fastMode != 0 { if *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) != 0 { v15 = int32(TK_PHOTO_COMPOSITE_SET) } else { v15 = TK_PHOTO_COMPOSITE_OVERLAY } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, width, height, v15) == int32(TCL_ERROR) { result = int32(TCL_ERROR) } } else { y = 0 for { if !(y < stopY) { break } pixbufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fpixbuf switch pixelType { case TYPE_DOUBLE1: if scanOrder == BOTTOM_UP { doubleBufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FdoubleBuf + uintptr((*(*TInt)(unsafe.Pointer(bp + 40))-int32(1)-y)**(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*8 } else { doubleBufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FdoubleBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*8 } if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fgamma != float64(1) { v17 = bp + 248 } else { v17 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, int32, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_DoubleToUBytePtr})))(tls, *(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, doubleBufPtr, v17, pixbufPtr) doubleBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) * 8 case int32(TYPE_FLOAT1): if scanOrder == BOTTOM_UP { floatBufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FfloatBuf + uintptr((*(*TInt)(unsafe.Pointer(bp + 40))-int32(1)-y)**(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*4 } else { floatBufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FfloatBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*4 } if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fgamma != float64(1) { v18 = bp + 248 } else { v18 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, int32, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_FloatToUBytePtr})))(tls, *(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, floatBufPtr, v18, pixbufPtr) floatBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) * 4 case int32(TYPE_UINT): if scanOrder == BOTTOM_UP { uintBufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FuintBuf + uintptr((*(*TInt)(unsafe.Pointer(bp + 40))-int32(1)-y)**(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*4 } else { uintBufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FuintBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*4 } if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fgamma != float64(1) { v19 = bp + 248 } else { v19 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, int32, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_UIntToUBytePtr})))(tls, *(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, uintBufPtr, v19, pixbufPtr) uintBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) * 4 case int32(TYPE_USHORT): if scanOrder == BOTTOM_UP { ushortBufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FushortBuf + uintptr((*(*TInt)(unsafe.Pointer(bp + 40))-int32(1)-y)**(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*2 } else { ushortBufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FushortBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans)*2 } if (*(*TFMTOPT10)(unsafe.Pointer(bp + 168))).Fgamma != float64(1) { v20 = bp + 248 } else { v20 = libc.UintptrFromInt32(0) } (*(*func(*libc.TLS, int32, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_UShortToUBytePtr})))(tls, *(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans, ushortBufPtr, v20, pixbufPtr) ushortBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) * 2 case int32(TYPE_UBYTE): if scanOrder == BOTTOM_UP { ubyteBufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FubyteBuf + uintptr((*(*TInt)(unsafe.Pointer(bp + 40))-int32(1)-y)**(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) } else { ubyteBufPtr = (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).FubyteBuf + uintptr(y**(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) } x = 0 for { if !(x < *(*TInt)(unsafe.Pointer(bp + 36))*(*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) { break } *(*TUByte)(unsafe.Pointer(pixbufPtr + uintptr(x))) = *(*TUByte)(unsafe.Pointer(ubyteBufPtr + uintptr(x))) goto _21 _21: ; x++ } ubyteBufPtr += uintptr(*(*TInt)(unsafe.Pointer(bp + 36)) * (*(*TRAWFILE)(unsafe.Pointer(bp + 112))).Fth.FnChans) break } if y >= srcY { if *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) != 0 { v22 = int32(TK_PHOTO_COMPOSITE_SET) } else { v22 = TK_PHOTO_COMPOSITE_OVERLAY } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, width, int32(1), v22) == int32(TCL_ERROR) { result = int32(TCL_ERROR) break } outY++ } goto _16 _16: ; y++ } } _rawClose(tls, bp+112, fastMode) return result } func _FileWrite5(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, filename, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite7(tls, interp, filename, format, bp, blockPtr) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } func _StringWrite5(tls *libc.TLS, interp uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = result libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp) result = _CommonWrite7(tls, interp, __ccgo_ts+865, format, bp, blockPtr) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp))).FbyteObj) } return result } func _CommonWrite7(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, handle uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(160) defer tls.Free(160) var alphaOffset, blueOffset, bytesPerLine, greenOffset, redOffset, x, y, v1 TInt var pixelPtr, rowPixPtr, ubyteBufPtr, v5, v6, v7, v8 uintptr var _ /* opts at bp+56 */ TFMTOPT10 var _ /* tf at bp+0 */ TRAWFILE _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, bytesPerLine, greenOffset, pixelPtr, redOffset, rowPixPtr, ubyteBufPtr, x, y, v1, v5, v6, v7, v8 libc.Xmemset(tls, bp, 0, uint32(52)) if _ParseFormatOpts10(tls, interp, format, bp+56, libc.Int32FromInt32(1)<> int32(1) i = 0 for { if !(int32(i) < nshorts) { break } swrd = *(*uint16)(unsafe.Pointer(buffer)) v2 = buffer buffer += 2 *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint16(swrd)>>int32(8) | libc.Int32FromUint16(swrd)<> int32(2) bytePtr = buffer i = 0 for { if !(int32(i) < nlongs) { break } lwrd = *(*int32)(unsafe.Pointer(buffer + uintptr(i)*4)) *(*TByte)(unsafe.Pointer(bytePtr)) = libc.Uint8FromInt32(lwrd >> libc.Int32FromInt32(24)) bytePtr++ *(*TByte)(unsafe.Pointer(bytePtr)) = libc.Uint8FromInt32(lwrd >> libc.Int32FromInt32(16)) bytePtr++ *(*TByte)(unsafe.Pointer(bytePtr)) = libc.Uint8FromInt32(lwrd >> libc.Int32FromInt32(8)) bytePtr++ *(*TByte)(unsafe.Pointer(bytePtr)) = libc.Uint8FromInt32(lwrd) bytePtr++ goto _1 _1: ; i++ } } func _cvtimage(tls *libc.TLS, buffer uintptr) { _cvtshorts(tls, buffer, int32(12)) _cvtlongs(tls, buffer+uintptr(3)*4, int32(12)) } func _ibufalloc(tls *libc.TLS, image uintptr) (r uintptr) { return libc.Xmalloc(tls, libc.Uint32FromInt32((libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize)+libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize)>>libc.Int32FromInt32(6))< uint32(1) { (*TIMAGE)(unsafe.Pointer(image)).Fysize = uint16(ysize) } if dim > uint32(2) { (*TIMAGE)(unsafe.Pointer(image)).Fzsize = uint16(zsize) } if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fzsize) == int32(1) { (*TIMAGE)(unsafe.Pointer(image)).Fdim = uint16(2) if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fysize) == int32(1) { (*TIMAGE)(unsafe.Pointer(image)).Fdim = uint16(1) } } else { (*TIMAGE)(unsafe.Pointer(image)).Fdim = uint16(3) } (*TIMAGE)(unsafe.Pointer(image)).Fmin = uint32(10000000) (*TIMAGE)(unsafe.Pointer(image)).Fmax = uint32(0) _isetname(tls, image, __ccgo_ts+51910) (*TIMAGE)(unsafe.Pointer(image)).Fwastebytes = uint32(0) if int32(512) != (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Write})))(tls, file, image, int32(512)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+51918, libc.UintptrFromInt32(0))) return 0 } } else { if int32(512) != (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, file, image, int32(512)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+51946, libc.UintptrFromInt32(0))) return 0 } if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fimagic)>>int32(8)|libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fimagic)&int32(0xff)< 0 { if _putrow(tls, interp, image, base, libc.Uint32FromInt16((*TIMAGE)(unsafe.Pointer(image)).Fy), libc.Uint32FromInt16((*TIMAGE)(unsafe.Pointer(image)).Fz)) != libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) { p3 = image + 112 *(*TUShort)(unsafe.Pointer(p3)) = TUShort(int32(*(*TUShort)(unsafe.Pointer(p3))) | libc.Int32FromInt32(_IOERR)) return -int32(1) } } return 0 } func _img_seek(tls *libc.TLS, interp uintptr, image uintptr, y uint32, z uint32) (r uint32) { bp := tls.Alloc(32) defer tls.Free(32) if _img_badrow(tls, image, y, z) != 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52120, libc.UintptrFromInt32(0))) return libc.Uint32FromInt32(-libc.Int32FromInt32(1)) } (*TIMAGE)(unsafe.Pointer(image)).Fx = 0 (*TIMAGE)(unsafe.Pointer(image)).Fy = libc.Int16FromUint32(y) (*TIMAGE)(unsafe.Pointer(image)).Fz = libc.Int16FromUint32(z) if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1)&int32(0xff00) == ITYPE_UNCOMPRESSED { switch libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fdim) { case int32(1): return _img_optseek(tls, image, uint32(512)) case int32(2): return _img_optseek(tls, image, uint32(512)+y*uint32((*TIMAGE)(unsafe.Pointer(image)).Fxsize)*libc.Uint32FromInt32(libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1)&libc.Int32FromInt32(BPPMASK))) case int32(3): return _img_optseek(tls, image, uint32(512)+(y*uint32((*TIMAGE)(unsafe.Pointer(image)).Fxsize)+z*uint32((*TIMAGE)(unsafe.Pointer(image)).Fxsize)*uint32((*TIMAGE)(unsafe.Pointer(image)).Fysize))*libc.Uint32FromInt32(libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1)&libc.Int32FromInt32(BPPMASK))) default: (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52144, libc.UintptrFromInt32(0))) break } } else { if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1)&int32(0xff00) == int32(ITYPE_RLE) { switch libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fdim) { case int32(1): return _img_optseek(tls, image, *(*TUInt3)(unsafe.Pointer((*TIMAGE)(unsafe.Pointer(image)).Frowstart))) case int32(2): return _img_optseek(tls, image, *(*TUInt3)(unsafe.Pointer((*TIMAGE)(unsafe.Pointer(image)).Frowstart + uintptr(y)*4))) case int32(3): return _img_optseek(tls, image, *(*TUInt3)(unsafe.Pointer((*TIMAGE)(unsafe.Pointer(image)).Frowstart + uintptr(y+z*uint32((*TIMAGE)(unsafe.Pointer(image)).Fysize))*4))) default: (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52144, libc.UintptrFromInt32(0))) break } } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52169, libc.UintptrFromInt32(0))) } } return libc.Uint32FromInt32(-libc.Int32FromInt32(1)) } func _img_badrow(tls *libc.TLS, image uintptr, y uint32, z uint32) (r int32) { if y >= uint32((*TIMAGE)(unsafe.Pointer(image)).Fysize) || z >= uint32((*TIMAGE)(unsafe.Pointer(image)).Fzsize) { return int32(1) } else { return 0 } return r } func _img_write(tls *libc.TLS, image uintptr, buffer uintptr, count int32) (r int32) { var retval int32 _ = retval retval = (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Write})))(tls, (*TIMAGE)(unsafe.Pointer(image)).Ffile, buffer, count) if retval == count { *(*TUInt3)(unsafe.Pointer(image + 136)) += libc.Uint32FromInt32(count) } else { (*TIMAGE)(unsafe.Pointer(image)).Foffset = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) } return retval } func _img_writeheader(tls *libc.TLS, image uintptr) (r int32) { var retval int32 _ = retval retval = (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Write})))(tls, (*TIMAGE)(unsafe.Pointer(image)).Ffile, image, int32(RELEVANT_HEADER_BYTES)) if retval == int32(RELEVANT_HEADER_BYTES) { *(*TUInt3)(unsafe.Pointer(image + 136)) += uint32(520) } else { (*TIMAGE)(unsafe.Pointer(image)).Foffset = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) } return retval } func _img_read(tls *libc.TLS, image uintptr, buffer uintptr, count int32) (r int32) { var retval int32 _ = retval retval = (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, (*TIMAGE)(unsafe.Pointer(image)).Ffile, buffer, count) if retval == count { *(*TUInt3)(unsafe.Pointer(image + 136)) += libc.Uint32FromInt32(count) } else { (*TIMAGE)(unsafe.Pointer(image)).Foffset = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) } return retval } func _img_optseek(tls *libc.TLS, image uintptr, offset uint32) (r uint32) { if (*TIMAGE)(unsafe.Pointer(image)).Foffset != offset { (*TIMAGE)(unsafe.Pointer(image)).Foffset = offset return libc.Uint32FromInt64((*(*func(*libc.TLS, TTcl_Channel, int64, int32) int64)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Seek})))(tls, (*TIMAGE)(unsafe.Pointer(image)).Ffile, libc.Int64FromUint32(offset), 0)) } return offset } func _img_getrowsize(tls *libc.TLS, image uintptr) (r int32) { switch libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fdim) { case int32(1): return *(*TInt)(unsafe.Pointer((*TIMAGE)(unsafe.Pointer(image)).Frowsize)) case int32(2): return *(*TInt)(unsafe.Pointer((*TIMAGE)(unsafe.Pointer(image)).Frowsize + uintptr((*TIMAGE)(unsafe.Pointer(image)).Fy)*4)) case int32(3): return *(*TInt)(unsafe.Pointer((*TIMAGE)(unsafe.Pointer(image)).Frowsize + uintptr(int32((*TIMAGE)(unsafe.Pointer(image)).Fy)+int32((*TIMAGE)(unsafe.Pointer(image)).Fz)*libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fysize))*4)) } return -int32(1) } func _img_setrowsize(tls *libc.TLS, interp uintptr, image uintptr, cnt int32, y int32, z int32) { bp := tls.Alloc(32) defer tls.Free(32) var sizeptr uintptr _ = sizeptr if _img_badrow(tls, image, libc.Uint32FromInt32(y), libc.Uint32FromInt32(z)) != 0 { return } switch libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fdim) { case int32(1): sizeptr = (*TIMAGE)(unsafe.Pointer(image)).Frowsize *(*TUInt3)(unsafe.Pointer((*TIMAGE)(unsafe.Pointer(image)).Frowstart)) = (*TIMAGE)(unsafe.Pointer(image)).Frleend case int32(2): sizeptr = (*TIMAGE)(unsafe.Pointer(image)).Frowsize + uintptr(y)*4 *(*TUInt3)(unsafe.Pointer((*TIMAGE)(unsafe.Pointer(image)).Frowstart + uintptr(y)*4)) = (*TIMAGE)(unsafe.Pointer(image)).Frleend case int32(3): sizeptr = (*TIMAGE)(unsafe.Pointer(image)).Frowsize + uintptr(y+z*libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fysize))*4 *(*TUInt3)(unsafe.Pointer((*TIMAGE)(unsafe.Pointer(image)).Frowstart + uintptr(y+z*libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fysize))*4)) = (*TIMAGE)(unsafe.Pointer(image)).Frleend default: (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52144, libc.UintptrFromInt32(0))) return } if *(*int32)(unsafe.Pointer(sizeptr)) != -int32(1) { *(*TUInt3)(unsafe.Pointer(image + 20)) += libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(sizeptr))) } *(*int32)(unsafe.Pointer(sizeptr)) = cnt *(*TUInt3)(unsafe.Pointer(image + 140)) += libc.Uint32FromInt32(cnt) } func _img_rle_compact(tls *libc.TLS, interp uintptr, expbuf uintptr, ibpp int32, rlebuf uintptr, obpp int32, cnt int32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var cc, cc1, cc2, cc3, todo, todo1, todo2, todo3, v13, v23, v3, v33 int16 var count, count1, count2, count3, v1, v11, v17, v21, v27, v31, v37, v7 int32 var ibufend, ibufend1, ibufend2, ibufend3, iptr, iptr1, iptr2, iptr3, optr, optr1, optr2, optr3, sptr, sptr1, sptr2, sptr3, v10, v12, v14, v15, v16, v18, v19, v2, v20, v22, v24, v25, v26, v28, v29, v30, v32, v34, v35, v36, v38, v39, v4, v40, v5, v6, v8, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cc, cc1, cc2, cc3, count, count1, count2, count3, ibufend, ibufend1, ibufend2, ibufend3, iptr, iptr1, iptr2, iptr3, optr, optr1, optr2, optr3, sptr, sptr1, sptr2, sptr3, todo, todo1, todo2, todo3, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v5, v6, v7, v8, v9 if ibpp == int32(1) && obpp == int32(1) { iptr = expbuf ibufend = iptr + uintptr(cnt) optr = rlebuf for iptr < ibufend { sptr = iptr iptr += uintptr(2) for iptr < ibufend && (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(iptr + uintptr(-libc.Int32FromInt32(2))))) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(iptr + uintptr(-libc.Int32FromInt32(1))))) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(iptr + uintptr(-libc.Int32FromInt32(1))))) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(iptr)))) { iptr++ } iptr -= uintptr(2) count = int32(iptr) - int32(sptr) for count != 0 { if count > int32(126) { v1 = int32(126) } else { v1 = count } todo = int16(v1) count -= int32(todo) v2 = optr optr++ *(*uint8)(unsafe.Pointer(v2)) = libc.Uint8FromInt32(int32(0x80) | int32(todo)) for { v3 = todo todo-- if !(v3 != 0) { break } v4 = optr optr++ v5 = sptr sptr++ *(*uint8)(unsafe.Pointer(v4)) = *(*uint8)(unsafe.Pointer(v5)) } } sptr = iptr v6 = iptr iptr++ cc = libc.Int16FromUint8(*(*uint8)(unsafe.Pointer(v6))) for iptr < ibufend && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(iptr))) == int32(cc) { iptr++ } count = int32(iptr) - int32(sptr) for count != 0 { if count > int32(126) { v7 = int32(126) } else { v7 = count } todo = int16(v7) count -= int32(todo) v8 = optr optr++ *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt16(todo) v9 = optr optr++ *(*uint8)(unsafe.Pointer(v9)) = libc.Uint8FromInt16(cc) } } v10 = optr optr++ *(*uint8)(unsafe.Pointer(v10)) = uint8(0) return int32(optr) - int32(rlebuf) } else { if ibpp == int32(1) && obpp == int32(2) { iptr1 = expbuf ibufend1 = iptr1 + uintptr(cnt) optr1 = rlebuf for iptr1 < ibufend1 { sptr1 = iptr1 iptr1 += uintptr(2) for iptr1 < ibufend1 && (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(iptr1 + uintptr(-libc.Int32FromInt32(2))))) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(iptr1 + uintptr(-libc.Int32FromInt32(1))))) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(iptr1 + uintptr(-libc.Int32FromInt32(1))))) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(iptr1)))) { iptr1++ } iptr1 -= uintptr(2) count1 = int32(iptr1) - int32(sptr1) for count1 != 0 { if count1 > int32(126) { v11 = int32(126) } else { v11 = count1 } todo1 = int16(v11) count1 -= int32(todo1) v12 = optr1 optr1 += 2 *(*uint16)(unsafe.Pointer(v12)) = libc.Uint16FromInt32(int32(0x80) | int32(todo1)) for { v13 = todo1 todo1-- if !(v13 != 0) { break } v14 = optr1 optr1 += 2 v15 = sptr1 sptr1++ *(*uint16)(unsafe.Pointer(v14)) = uint16(*(*uint8)(unsafe.Pointer(v15))) } } sptr1 = iptr1 v16 = iptr1 iptr1++ cc1 = libc.Int16FromUint8(*(*uint8)(unsafe.Pointer(v16))) for iptr1 < ibufend1 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(iptr1))) == int32(cc1) { iptr1++ } count1 = int32(iptr1) - int32(sptr1) for count1 != 0 { if count1 > int32(126) { v17 = int32(126) } else { v17 = count1 } todo1 = int16(v17) count1 -= int32(todo1) v18 = optr1 optr1 += 2 *(*uint16)(unsafe.Pointer(v18)) = libc.Uint16FromInt16(todo1) v19 = optr1 optr1 += 2 *(*uint16)(unsafe.Pointer(v19)) = libc.Uint16FromInt16(cc1) } } v20 = optr1 optr1 += 2 *(*uint16)(unsafe.Pointer(v20)) = uint16(0) return (int32(optr1) - int32(rlebuf)) / 2 } else { if ibpp == int32(2) && obpp == int32(1) { iptr2 = expbuf ibufend2 = iptr2 + uintptr(cnt)*2 optr2 = rlebuf for iptr2 < ibufend2 { sptr2 = iptr2 iptr2 += uintptr(2) * 2 for iptr2 < ibufend2 && (libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(iptr2 + uintptr(-libc.Int32FromInt32(2))*2))) != libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(iptr2 + uintptr(-libc.Int32FromInt32(1))*2))) || libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(iptr2 + uintptr(-libc.Int32FromInt32(1))*2))) != libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(iptr2)))) { iptr2 += 2 } iptr2 -= uintptr(2) * 2 count2 = (int32(iptr2) - int32(sptr2)) / 2 for count2 != 0 { if count2 > int32(126) { v21 = int32(126) } else { v21 = count2 } todo2 = int16(v21) count2 -= int32(todo2) v22 = optr2 optr2++ *(*uint8)(unsafe.Pointer(v22)) = libc.Uint8FromInt32(int32(0x80) | int32(todo2)) for { v23 = todo2 todo2-- if !(v23 != 0) { break } v24 = optr2 optr2++ v25 = sptr2 sptr2 += 2 *(*uint8)(unsafe.Pointer(v24)) = uint8(*(*uint16)(unsafe.Pointer(v25))) } } sptr2 = iptr2 v26 = iptr2 iptr2 += 2 cc2 = libc.Int16FromUint16(*(*uint16)(unsafe.Pointer(v26))) for iptr2 < ibufend2 && libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(iptr2))) == int32(cc2) { iptr2 += 2 } count2 = (int32(iptr2) - int32(sptr2)) / 2 for count2 != 0 { if count2 > int32(126) { v27 = int32(126) } else { v27 = count2 } todo2 = int16(v27) count2 -= int32(todo2) v28 = optr2 optr2++ *(*uint8)(unsafe.Pointer(v28)) = libc.Uint8FromInt16(todo2) v29 = optr2 optr2++ *(*uint8)(unsafe.Pointer(v29)) = libc.Uint8FromInt16(cc2) } } v30 = optr2 optr2++ *(*uint8)(unsafe.Pointer(v30)) = uint8(0) return int32(optr2) - int32(rlebuf) } else { if ibpp == int32(2) && obpp == int32(2) { iptr3 = expbuf ibufend3 = iptr3 + uintptr(cnt)*2 optr3 = rlebuf for iptr3 < ibufend3 { sptr3 = iptr3 iptr3 += uintptr(2) * 2 for iptr3 < ibufend3 && (libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(iptr3 + uintptr(-libc.Int32FromInt32(2))*2))) != libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(iptr3 + uintptr(-libc.Int32FromInt32(1))*2))) || libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(iptr3 + uintptr(-libc.Int32FromInt32(1))*2))) != libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(iptr3)))) { iptr3 += 2 } iptr3 -= uintptr(2) * 2 count3 = (int32(iptr3) - int32(sptr3)) / 2 for count3 != 0 { if count3 > int32(126) { v31 = int32(126) } else { v31 = count3 } todo3 = int16(v31) count3 -= int32(todo3) v32 = optr3 optr3 += 2 *(*uint16)(unsafe.Pointer(v32)) = libc.Uint16FromInt32(int32(0x80) | int32(todo3)) for { v33 = todo3 todo3-- if !(v33 != 0) { break } v34 = optr3 optr3 += 2 v35 = sptr3 sptr3 += 2 *(*uint16)(unsafe.Pointer(v34)) = *(*uint16)(unsafe.Pointer(v35)) } } sptr3 = iptr3 v36 = iptr3 iptr3 += 2 cc3 = libc.Int16FromUint16(*(*uint16)(unsafe.Pointer(v36))) for iptr3 < ibufend3 && libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(iptr3))) == int32(cc3) { iptr3 += 2 } count3 = (int32(iptr3) - int32(sptr3)) / 2 for count3 != 0 { if count3 > int32(126) { v37 = int32(126) } else { v37 = count3 } todo3 = int16(v37) count3 -= int32(todo3) v38 = optr3 optr3 += 2 *(*uint16)(unsafe.Pointer(v38)) = libc.Uint16FromInt16(todo3) v39 = optr3 optr3 += 2 *(*uint16)(unsafe.Pointer(v39)) = libc.Uint16FromInt16(cc3) } } v40 = optr3 optr3 += 2 *(*uint16)(unsafe.Pointer(v40)) = uint16(0) return (int32(optr3) - int32(rlebuf)) / 2 } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52189, libc.UintptrFromInt32(0))) return 0 } } } } return r } func _img_rle_expand(tls *libc.TLS, interp uintptr, rlebuf uintptr, ibpp int32, expbuf uintptr, obpp int32) { bp := tls.Alloc(32) defer tls.Free(32) var count, count1, count2, count3, pixel, pixel1, pixel2, pixel3, v10, v11, v15, v18, v19, v2, v23, v26, v27, v3, v31, v7 uint16 var iptr, iptr1, iptr2, iptr3, optr, optr1, optr2, optr3, v1, v12, v13, v14, v16, v17, v20, v21, v22, v24, v25, v28, v29, v30, v32, v4, v5, v6, v8, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = count, count1, count2, count3, iptr, iptr1, iptr2, iptr3, optr, optr1, optr2, optr3, pixel, pixel1, pixel2, pixel3, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v4, v5, v6, v7, v8, v9 if ibpp == int32(1) && obpp == int32(1) { iptr = rlebuf optr = expbuf for int32(1) != 0 { v1 = iptr iptr++ pixel = uint16(*(*uint8)(unsafe.Pointer(v1))) v2 = libc.Uint16FromInt32(libc.Int32FromUint16(pixel) & libc.Int32FromInt32(0x7f)) count = v2 if !(v2 != 0) { return } if libc.Int32FromUint16(pixel)&int32(0x80) != 0 { for { v3 = count count-- if !(v3 != 0) { break } v4 = optr optr++ v5 = iptr iptr++ *(*uint8)(unsafe.Pointer(v4)) = *(*uint8)(unsafe.Pointer(v5)) } } else { v6 = iptr iptr++ pixel = uint16(*(*uint8)(unsafe.Pointer(v6))) for { v7 = count count-- if !(v7 != 0) { break } v8 = optr optr++ *(*uint8)(unsafe.Pointer(v8)) = uint8(pixel) } } } } else { if ibpp == int32(1) && obpp == int32(2) { iptr1 = rlebuf optr1 = expbuf for int32(1) != 0 { v9 = iptr1 iptr1++ pixel1 = uint16(*(*uint8)(unsafe.Pointer(v9))) v10 = libc.Uint16FromInt32(libc.Int32FromUint16(pixel1) & libc.Int32FromInt32(0x7f)) count1 = v10 if !(v10 != 0) { return } if libc.Int32FromUint16(pixel1)&int32(0x80) != 0 { for { v11 = count1 count1-- if !(v11 != 0) { break } v12 = optr1 optr1 += 2 v13 = iptr1 iptr1++ *(*uint16)(unsafe.Pointer(v12)) = uint16(*(*uint8)(unsafe.Pointer(v13))) } } else { v14 = iptr1 iptr1++ pixel1 = uint16(*(*uint8)(unsafe.Pointer(v14))) for { v15 = count1 count1-- if !(v15 != 0) { break } v16 = optr1 optr1 += 2 *(*uint16)(unsafe.Pointer(v16)) = pixel1 } } } } else { if ibpp == int32(2) && obpp == int32(1) { iptr2 = rlebuf optr2 = expbuf for int32(1) != 0 { v17 = iptr2 iptr2 += 2 pixel2 = *(*uint16)(unsafe.Pointer(v17)) v18 = libc.Uint16FromInt32(libc.Int32FromUint16(pixel2) & libc.Int32FromInt32(0x7f)) count2 = v18 if !(v18 != 0) { return } if libc.Int32FromUint16(pixel2)&int32(0x80) != 0 { for { v19 = count2 count2-- if !(v19 != 0) { break } v20 = optr2 optr2++ v21 = iptr2 iptr2 += 2 *(*uint8)(unsafe.Pointer(v20)) = uint8(*(*uint16)(unsafe.Pointer(v21))) } } else { v22 = iptr2 iptr2 += 2 pixel2 = *(*uint16)(unsafe.Pointer(v22)) for { v23 = count2 count2-- if !(v23 != 0) { break } v24 = optr2 optr2++ *(*uint8)(unsafe.Pointer(v24)) = uint8(pixel2) } } } } else { if ibpp == int32(2) && obpp == int32(2) { iptr3 = rlebuf optr3 = expbuf for int32(1) != 0 { v25 = iptr3 iptr3 += 2 pixel3 = *(*uint16)(unsafe.Pointer(v25)) v26 = libc.Uint16FromInt32(libc.Int32FromUint16(pixel3) & libc.Int32FromInt32(0x7f)) count3 = v26 if !(v26 != 0) { return } if libc.Int32FromUint16(pixel3)&int32(0x80) != 0 { for { v27 = count3 count3-- if !(v27 != 0) { break } v28 = optr3 optr3 += 2 v29 = iptr3 iptr3 += 2 *(*uint16)(unsafe.Pointer(v28)) = *(*uint16)(unsafe.Pointer(v29)) } } else { v30 = iptr3 iptr3 += 2 pixel3 = *(*uint16)(unsafe.Pointer(v30)) for { v31 = count3 count3-- if !(v31 != 0) { break } v32 = optr3 optr3 += 2 *(*uint16)(unsafe.Pointer(v32)) = pixel3 } } } } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52189, libc.UintptrFromInt32(0))) } } } } } func _putrow(tls *libc.TLS, interp uintptr, image uintptr, buffer uintptr, y uint32, z uint32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var cnt int32 var cptr, sptr, v3 uintptr var max, min, x, v2, v5, v7, v9 uint32 _, _, _, _, _, _, _, _, _, _, _ = cnt, cptr, max, min, sptr, x, v2, v3, v5, v7, v9 if !(libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fflags)&(libc.Int32FromInt32(_IORW)|libc.Int32FromInt32(_IOWRT)) != 0) { return -int32(1) } if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fdim) < int32(3) { z = uint32(0) } if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fdim) < int32(2) { y = uint32(0) } if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1)&int32(0xff00) == ITYPE_UNCOMPRESSED { switch libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1) & libc.Int32FromInt32(BPPMASK) { case int32(1): min = (*TIMAGE)(unsafe.Pointer(image)).Fmin max = (*TIMAGE)(unsafe.Pointer(image)).Fmax cptr = (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf sptr = buffer x = uint32((*TIMAGE)(unsafe.Pointer(image)).Fxsize) for { v2 = x x-- if !(v2 != 0) { break } v3 = sptr sptr += 2 *(*uint8)(unsafe.Pointer(cptr)) = uint8(*(*uint16)(unsafe.Pointer(v3))) if uint32(*(*uint8)(unsafe.Pointer(cptr))) > max { max = uint32(*(*uint8)(unsafe.Pointer(cptr))) } if uint32(*(*uint8)(unsafe.Pointer(cptr))) < min { min = uint32(*(*uint8)(unsafe.Pointer(cptr))) } cptr++ goto _1 _1: } (*TIMAGE)(unsafe.Pointer(image)).Fmin = min (*TIMAGE)(unsafe.Pointer(image)).Fmax = max _img_seek(tls, interp, image, y, z) cnt = libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) if _img_write(tls, image, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, cnt) != cnt { return -int32(1) } else { return cnt } /* NOTREACHED */ fallthrough case int32(2): min = (*TIMAGE)(unsafe.Pointer(image)).Fmin max = (*TIMAGE)(unsafe.Pointer(image)).Fmax sptr = buffer x = uint32((*TIMAGE)(unsafe.Pointer(image)).Fxsize) for { v5 = x x-- if !(v5 != 0) { break } if uint32(*(*uint16)(unsafe.Pointer(sptr))) > max { max = uint32(*(*uint16)(unsafe.Pointer(sptr))) } if uint32(*(*uint16)(unsafe.Pointer(sptr))) < min { min = uint32(*(*uint16)(unsafe.Pointer(sptr))) } sptr += 2 goto _4 _4: } (*TIMAGE)(unsafe.Pointer(image)).Fmin = min (*TIMAGE)(unsafe.Pointer(image)).Fmax = max _img_seek(tls, interp, image, y, z) cnt = libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) << int32(1) if (*TIMAGE)(unsafe.Pointer(image)).Fdorev != 0 { _cvtshorts(tls, buffer, cnt) } if _img_write(tls, image, buffer, cnt) != cnt { if (*TIMAGE)(unsafe.Pointer(image)).Fdorev != 0 { _cvtshorts(tls, buffer, cnt) } return -int32(1) } else { if (*TIMAGE)(unsafe.Pointer(image)).Fdorev != 0 { _cvtshorts(tls, buffer, cnt) } return libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) } /* NOTREACHED */ fallthrough default: (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52189, libc.UintptrFromInt32(0))) } } else { if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1)&int32(0xff00) == int32(ITYPE_RLE) { switch libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1) & libc.Int32FromInt32(BPPMASK) { case int32(1): min = (*TIMAGE)(unsafe.Pointer(image)).Fmin max = (*TIMAGE)(unsafe.Pointer(image)).Fmax sptr = buffer x = uint32((*TIMAGE)(unsafe.Pointer(image)).Fxsize) for { v7 = x x-- if !(v7 != 0) { break } if uint32(*(*uint16)(unsafe.Pointer(sptr))) > max { max = uint32(*(*uint16)(unsafe.Pointer(sptr))) } if uint32(*(*uint16)(unsafe.Pointer(sptr))) < min { min = uint32(*(*uint16)(unsafe.Pointer(sptr))) } sptr += 2 goto _6 _6: } (*TIMAGE)(unsafe.Pointer(image)).Fmin = min (*TIMAGE)(unsafe.Pointer(image)).Fmax = max cnt = _img_rle_compact(tls, interp, buffer, int32(2), (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, int32(1), libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize)) _img_setrowsize(tls, interp, image, cnt, libc.Int32FromUint32(y), libc.Int32FromUint32(z)) _img_seek(tls, interp, image, y, z) if _img_write(tls, image, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, cnt) != cnt { return -int32(1) } else { return libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) } /* NOTREACHED */ fallthrough case int32(2): min = (*TIMAGE)(unsafe.Pointer(image)).Fmin max = (*TIMAGE)(unsafe.Pointer(image)).Fmax sptr = buffer x = uint32((*TIMAGE)(unsafe.Pointer(image)).Fxsize) for { v9 = x x-- if !(v9 != 0) { break } if uint32(*(*uint16)(unsafe.Pointer(sptr))) > max { max = uint32(*(*uint16)(unsafe.Pointer(sptr))) } if uint32(*(*uint16)(unsafe.Pointer(sptr))) < min { min = uint32(*(*uint16)(unsafe.Pointer(sptr))) } sptr += 2 goto _8 _8: } (*TIMAGE)(unsafe.Pointer(image)).Fmin = min (*TIMAGE)(unsafe.Pointer(image)).Fmax = max cnt = _img_rle_compact(tls, interp, buffer, int32(2), (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, int32(2), libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize)) cnt <<= int32(1) _img_setrowsize(tls, interp, image, cnt, libc.Int32FromUint32(y), libc.Int32FromUint32(z)) _img_seek(tls, interp, image, y, z) if (*TIMAGE)(unsafe.Pointer(image)).Fdorev != 0 { _cvtshorts(tls, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, cnt) } if _img_write(tls, image, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, cnt) != cnt { if (*TIMAGE)(unsafe.Pointer(image)).Fdorev != 0 { _cvtshorts(tls, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, cnt) } return -int32(1) } else { if (*TIMAGE)(unsafe.Pointer(image)).Fdorev != 0 { _cvtshorts(tls, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, cnt) } return libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) } /* NOTREACHED */ fallthrough default: (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52189, libc.UintptrFromInt32(0))) } } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52169, libc.UintptrFromInt32(0))) } } return -int32(1) } func _getrow(tls *libc.TLS, interp uintptr, image uintptr, buffer uintptr, y uint32, z uint32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var cnt, i, v2, v5, v6 int16 var cptr, sptr, v3, v4 uintptr _, _, _, _, _, _, _, _, _ = cnt, cptr, i, sptr, v2, v3, v4, v5, v6 if !(libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fflags)&(libc.Int32FromInt32(_IORW)|libc.Int32FromInt32(_IOREAD)) != 0) { return -int32(1) } if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fdim) < int32(3) { z = uint32(0) } if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fdim) < int32(2) { y = uint32(0) } _img_seek(tls, interp, image, y, z) if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1)&int32(0xff00) == ITYPE_UNCOMPRESSED { switch libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1) & libc.Int32FromInt32(BPPMASK) { case int32(1): if _img_read(tls, image, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize)) != libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) { return -int32(1) } else { cptr = (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf sptr = buffer i = libc.Int16FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) for { v2 = i i-- if !(v2 != 0) { break } v3 = sptr sptr += 2 v4 = cptr cptr++ *(*uint16)(unsafe.Pointer(v3)) = uint16(*(*uint8)(unsafe.Pointer(v4))) goto _1 _1: } } return libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) /* NOTREACHED */ fallthrough case int32(2): cnt = int16(libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) << int32(1)) if _img_read(tls, image, buffer, int32(cnt)) != int32(cnt) { return -int32(1) } else { if (*TIMAGE)(unsafe.Pointer(image)).Fdorev != 0 { _cvtshorts(tls, buffer, int32(cnt)) } return libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) } /* NOTREACHED */ fallthrough default: (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52189, libc.UintptrFromInt32(0))) break } } else { if libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1)&int32(0xff00) == int32(ITYPE_RLE) { switch libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Ftype1) & libc.Int32FromInt32(BPPMASK) { case int32(1): v5 = int16(_img_getrowsize(tls, image)) cnt = v5 if int32(v5) == -int32(1) { return -int32(1) } if _img_read(tls, image, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, int32(cnt)) != int32(cnt) { return -int32(1) } else { _img_rle_expand(tls, interp, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, int32(1), buffer, int32(2)) return libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) } /* NOTREACHED */ fallthrough case int32(2): v6 = int16(_img_getrowsize(tls, image)) cnt = v6 if int32(v6) == -int32(1) { return -int32(1) } if int32(cnt) != _img_read(tls, image, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, int32(cnt)) { return -int32(1) } else { if (*TIMAGE)(unsafe.Pointer(image)).Fdorev != 0 { _cvtshorts(tls, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, int32(cnt)) } _img_rle_expand(tls, interp, (*TIMAGE)(unsafe.Pointer(image)).Ftmpbuf, int32(2), buffer, int32(2)) return libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(image)).Fxsize) } /* NOTREACHED */ fallthrough default: (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52189, libc.UintptrFromInt32(0))) break } } else { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+8, __ccgo_ts+52169, libc.UintptrFromInt32(0))) } } return -int32(1) } /* End of original SGI image code */ // C documentation // // /* Structure to hold information about the SGI file being processed. */ type TSGIFILE = struct { Fth TIMAGE Fred uintptr Fgreen uintptr Fblue uintptr Falpha uintptr FredScan uintptr FgreenScan uintptr FblueScan uintptr FalphaScan uintptr Fscanline uintptr Fpixbuf uintptr } // C documentation // // /* Format options structure for use with ParseFormatOpts */ type TFMTOPT11 = struct { Fcompression TInt Fverbose TBoln Fwithalpha TBoln } func _sgiClose(tls *libc.TLS, interp uintptr, tf uintptr) { if (*TSGIFILE)(unsafe.Pointer(tf)).FredScan != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TSGIFILE)(unsafe.Pointer(tf)).FredScan) } if (*TSGIFILE)(unsafe.Pointer(tf)).FgreenScan != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TSGIFILE)(unsafe.Pointer(tf)).FgreenScan) } if (*TSGIFILE)(unsafe.Pointer(tf)).FblueScan != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TSGIFILE)(unsafe.Pointer(tf)).FblueScan) } if (*TSGIFILE)(unsafe.Pointer(tf)).FalphaScan != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TSGIFILE)(unsafe.Pointer(tf)).FalphaScan) } if (*TSGIFILE)(unsafe.Pointer(tf)).Fpixbuf != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TSGIFILE)(unsafe.Pointer(tf)).Fpixbuf) } if (*TSGIFILE)(unsafe.Pointer(tf)).Fscanline != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*TSGIFILE)(unsafe.Pointer(tf)).Fscanline) } _iclose(tls, interp, tf) return } func _printImgInfo10(tls *libc.TLS, th uintptr, filename uintptr, msg uintptr) { bp := tls.Alloc(288) defer tls.Free(288) var outChan TTcl_Channel var v1 uintptr var _ /* str at bp+0 */ [256]uint8 _, _ = outChan, v1 outChan = (*(*func(*libc.TLS, int32) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStdChannel})))(tls, libc.Int32FromInt32(1)<>int32(8)|libc.Int32FromUint16((*TIMAGE)(unsafe.Pointer(th)).Fimagic)&int32(0xff)<> int32(8)) dest += uintptr(nchan) } break } return uint8(TRUE) } func _sgiReadScan(tls *libc.TLS, interp uintptr, handle uintptr, tf uintptr, y TInt) (r TBoln) { var nchan TInt var v1 int32 _, _ = nchan, v1 nchan = libc.Int32FromUint16((*TSGIFILE)(unsafe.Pointer(tf)).Fth.Fzsize) /* Read 1. channel: This is either the red or brightness channel. */ if !(_readChannel(tls, interp, tf, (*TSGIFILE)(unsafe.Pointer(tf)).Fscanline, 0, nchan, y, libc.Int32FromUint16((*TSGIFILE)(unsafe.Pointer(tf)).Fth.Fxsize)) != 0) { return uint8(FALSE) } if nchan >= int32(3) { /* This is either a RGB or RGBA image. Read green and blue channels. */ if !(_readChannel(tls, interp, tf, (*TSGIFILE)(unsafe.Pointer(tf)).Fscanline, int32(1), nchan, y, libc.Int32FromUint16((*TSGIFILE)(unsafe.Pointer(tf)).Fth.Fxsize)) != 0) || !(_readChannel(tls, interp, tf, (*TSGIFILE)(unsafe.Pointer(tf)).Fscanline, int32(2), nchan, y, libc.Int32FromUint16((*TSGIFILE)(unsafe.Pointer(tf)).Fth.Fxsize)) != 0) { return uint8(FALSE) } } if nchan > int32(3) || nchan == int32(2) { /* If nchan is 2, we have a brightness-alpha image, if nchan is 4, we have RGBA. */ if nchan == int32(2) { v1 = int32(1) } else { v1 = int32(3) } if !(_readChannel(tls, interp, tf, (*TSGIFILE)(unsafe.Pointer(tf)).Fscanline, v1, nchan, y, libc.Int32FromUint16((*TSGIFILE)(unsafe.Pointer(tf)).Fth.Fxsize)) != 0) { return uint8(FALSE) } } return uint8(TRUE) } func _writeChannel(tls *libc.TLS, interp uintptr, tf uintptr, src uintptr, sgichn TInt, y TInt, n TInt) (r TBoln) { var dest, stop, v1, v2 uintptr _, _, _, _ = dest, stop, v1, v2 dest = (*TSGIFILE)(unsafe.Pointer(tf)).Fpixbuf stop = src + uintptr(n) for src < stop { v1 = dest dest += 2 v2 = src src++ *(*uint16)(unsafe.Pointer(v1)) = uint16(*(*TUByte)(unsafe.Pointer(v2))) } if -int32(1) == _putrow(tls, interp, tf, (*TSGIFILE)(unsafe.Pointer(tf)).Fpixbuf, libc.Uint32FromInt32(y), libc.Uint32FromInt32(sgichn)) { return uint8(FALSE) } return uint8(TRUE) } func _sgiWriteScan(tls *libc.TLS, interp uintptr, handle uintptr, tf uintptr, y TInt, nchan TInt) (r TBoln) { if !(_writeChannel(tls, interp, tf, (*TSGIFILE)(unsafe.Pointer(tf)).FredScan, 0, y, libc.Int32FromUint16((*TSGIFILE)(unsafe.Pointer(tf)).Fth.Fxsize)) != 0) || !(_writeChannel(tls, interp, tf, (*TSGIFILE)(unsafe.Pointer(tf)).FgreenScan, int32(1), y, libc.Int32FromUint16((*TSGIFILE)(unsafe.Pointer(tf)).Fth.Fxsize)) != 0) || !(_writeChannel(tls, interp, tf, (*TSGIFILE)(unsafe.Pointer(tf)).FblueScan, int32(2), y, libc.Int32FromUint16((*TSGIFILE)(unsafe.Pointer(tf)).Fth.Fxsize)) != 0) { return uint8(FALSE) } if nchan == int32(4) { if !(_writeChannel(tls, interp, tf, (*TSGIFILE)(unsafe.Pointer(tf)).FalphaScan, int32(3), y, libc.Int32FromUint16((*TSGIFILE)(unsafe.Pointer(tf)).Fth.Fxsize)) != 0) { return uint8(FALSE) } } return uint8(TRUE) } func _ParseFormatOpts11(tls *libc.TLS, interp uintptr, format uintptr, opts uintptr, mode int32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var i, v2, v3 TTcl_Size var optionStr uintptr var _ /* boolVal at bp+12 */ int32 var _ /* index at bp+4 */ int32 var _ /* objc at bp+0 */ TTcl_Size var _ /* objv at bp+8 */ uintptr _, _, _, _ = i, optionStr, v2, v3 /* Initialize options with default values. */ (*TFMTOPT11)(unsafe.Pointer(opts)).Fverbose = uint8(0) (*TFMTOPT11)(unsafe.Pointer(opts)).Fcompression = int32(1) (*TFMTOPT11)(unsafe.Pointer(opts)).Fwithalpha = uint8(1) if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ListObjGetElementsPtr})))(tls, interp, format, bp, bp+8) == int32(TCL_ERROR) { return int32(TCL_ERROR) } i = int32(1) for { if !(i < *(*TTcl_Size)(unsafe.Pointer(bp))) { break } if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+24, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)< 0 { libc.Xfwrite(tls, bp+424, uint32(1), libc.Uint32FromInt32(count), outfile) } libc.Xfclose(tls, outfile) (*(*func(*libc.TLS, TTcl_Encoding, uintptr, TTcl_Size, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ExternalToUtfDString})))(tls, libc.UintptrFromInt32(0), (*TTcl_DString)(unsafe.Pointer(bp)).Fstring1, -int32(1), bp+212) inchan = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, (*TTcl_DString)(unsafe.Pointer(bp+212)).Fstring1, __ccgo_ts+48463) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+212) if !(inchan != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp+4520, inchan) retVal = _CommonRead11(tls, interp, bp+4520, (*TTcl_DString)(unsafe.Pointer(bp)).Fstring1, format, imageHandle, destX, destY, width, height, srcX, srcY) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, inchan, 0) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_DeleteFilePtr})))(tls, (*TTcl_DString)(unsafe.Pointer(bp)).Fstring1) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_DeleteFilePtr})))(tls, (*TTcl_DString)(unsafe.Pointer(bp)).Fstring1) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp) return retVal } func _CommonRead11(tls *libc.TLS, interp uintptr, handle uintptr, filename uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(1664) defer tls.Free(1664) var nchan, y TInt var outHeight, outWidth, outY, result, stopY, v1, v2, v4 int32 var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* fileHeight at bp+40 */ int32 var _ /* fileWidth at bp+36 */ int32 var _ /* msgStr at bp+616 */ [1024]uint8 var _ /* opts at bp+608 */ TFMTOPT11 var _ /* tf at bp+44 */ TSGIFILE _, _, _, _, _, _, _, _, _, _ = nchan, outHeight, outWidth, outY, result, stopY, y, v1, v2, v4 result = TCL_OK libc.Xmemset(tls, bp+44, 0, uint32(560)) if _ParseFormatOpts11(tls, interp, format, bp+608, libc.Int32FromInt32(1)< *(*int32)(unsafe.Pointer(bp + 36)) { outWidth = *(*int32)(unsafe.Pointer(bp + 36)) - srcX } else { outWidth = width } if srcY+height > *(*int32)(unsafe.Pointer(bp + 40)) { outHeight = *(*int32)(unsafe.Pointer(bp + 40)) - srcY } else { outHeight = height } if outWidth <= 0 || outHeight <= 0 || srcX >= *(*int32)(unsafe.Pointer(bp + 36)) || srcY >= *(*int32)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1648, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+outWidth, destY+outHeight) == int32(TCL_ERROR) { return int32(TCL_ERROR) } nchan = libc.Int32FromUint16((*(*TSGIFILE)(unsafe.Pointer(bp + 44))).Fth.Fzsize) (*(*TSGIFILE)(unsafe.Pointer(bp + 44))).Fpixbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(bp + 36))*nchan)*uint32(2)) if (*(*TSGIFILE)(unsafe.Pointer(bp + 44))).Fpixbuf == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1648, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*TSGIFILE)(unsafe.Pointer(bp + 44))).Fscanline = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(bp + 36))*nchan)) if (*(*TSGIFILE)(unsafe.Pointer(bp + 44))).Fscanline == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*(*TSGIFILE)(unsafe.Pointer(bp + 44))).Fpixbuf) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1648, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = nchan (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = *(*int32)(unsafe.Pointer(bp + 36)) * nchan (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = outWidth (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) switch nchan { case int32(1): /* Brightness */ fallthrough case int32(2): /* Brightness + Matte */ *(*int32)(unsafe.Pointer(bp + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = 0 if (*(*TFMTOPT11)(unsafe.Pointer(bp + 608))).Fwithalpha != 0 { v1 = int32(1) } else { v1 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = v1 case int32(3): /* RGB */ fallthrough case int32(4): /* RGB + Matte */ *(*int32)(unsafe.Pointer(bp + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = int32(2) if (*(*TFMTOPT11)(unsafe.Pointer(bp + 608))).Fwithalpha != 0 { v2 = int32(3) } else { v2 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = v2 default: libc.X__builtin_snprintf(tls, bp+616, uint32(1024), __ccgo_ts+52287, libc.VaList(bp+1648, nchan)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+1648, bp+616, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) break } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = (*(*TSGIFILE)(unsafe.Pointer(bp + 44))).Fscanline + uintptr(srcX*nchan) stopY = srcY + outHeight outY = destY y = 0 for { if !(y < stopY) { break } _sgiReadScan(tls, interp, handle, bp+44, *(*int32)(unsafe.Pointer(bp + 40))-int32(1)-y) if y >= srcY { if (*(*TFMTOPT11)(unsafe.Pointer(bp + 608))).Fwithalpha != 0 { v4 = TK_PHOTO_COMPOSITE_OVERLAY } else { v4 = int32(TK_PHOTO_COMPOSITE_SET) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, outWidth, int32(1), v4) == int32(TCL_ERROR) { result = int32(TCL_ERROR) break } outY++ } goto _3 _3: ; y++ } _sgiClose(tls, interp, bp+44) return result } func _FileWrite6(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, filename, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite8(tls, interp, filename, format, bp, blockPtr) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } func _StringWrite6(tls *libc.TLS, interp uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(4560) defer tls.Free(4560) var count, result int32 var inchan, outchan TTcl_Channel var _ /* buffer at bp+424 */ [4096]uint8 var _ /* ds at bp+0 */ TTcl_DString var _ /* handle at bp+4520 */ Ttkimg_Stream var _ /* tempFileName at bp+212 */ TTcl_DString _, _, _, _ = count, inchan, outchan, result libc.Xmemset(tls, bp+4520, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringInit})))(tls, bp+212) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetTemporaryFileNamePtr})))(tls, bp+212) (*(*func(*libc.TLS, TTcl_Encoding, uintptr, TTcl_Size, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ExternalToUtfDString})))(tls, libc.UintptrFromInt32(0), (*TTcl_DString)(unsafe.Pointer(bp+212)).Fstring1, -int32(1), bp) outchan = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, (*TTcl_DString)(unsafe.Pointer(bp)).Fstring1, __ccgo_ts+876) if !(outchan != 0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+212) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp+4520, outchan) result = _CommonWrite8(tls, interp, (*TTcl_DString)(unsafe.Pointer(bp)).Fstring1, format, bp+4520, blockPtr) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, outchan, 0) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+212) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp+4520) (*(*func(*libc.TLS, TTcl_Encoding, uintptr, TTcl_Size, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ExternalToUtfDString})))(tls, libc.UintptrFromInt32(0), (*TTcl_DString)(unsafe.Pointer(bp+212)).Fstring1, -int32(1), bp) inchan = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, (*TTcl_DString)(unsafe.Pointer(bp)).Fstring1, __ccgo_ts+48463) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp) if !(inchan != 0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+212) return int32(TCL_ERROR) } count = (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, inchan, bp+424, int32(BUFLEN)) for count == int32(BUFLEN) { (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, bp+4520, bp+424, count) count = (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Read})))(tls, inchan, bp+424, int32(BUFLEN)) } if count > 0 { (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, bp+4520, bp+424, count) } if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, inchan, 0) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_DeleteFilePtr})))(tls, (*TTcl_DString)(unsafe.Pointer(bp+212)).Fstring1) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+212) return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_DeleteFilePtr})))(tls, (*TTcl_DString)(unsafe.Pointer(bp+212)).Fstring1) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DStringFree})))(tls, bp+212) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp + 4520))).FbyteObj) } return result } func _CommonWrite8(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, handle uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(592) defer tls.Free(592) var alphaOffset, blueOffset, bpp, greenOffset, nchan, redOffset, x, y, v1 TInt var pixelPtr, rowPixPtr, v10, v11, v12, v13, v6, v7, v8, v9 uintptr var v2, v3 int32 var _ /* opts at bp+560 */ TFMTOPT11 var _ /* tf at bp+0 */ TSGIFILE _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, bpp, greenOffset, nchan, pixelPtr, redOffset, rowPixPtr, x, y, v1, v10, v11, v12, v13, v2, v3, v6, v7, v8, v9 libc.Xmemset(tls, bp, 0, uint32(560)) if _ParseFormatOpts11(tls, interp, format, bp+560, libc.Int32FromInt32(1)<= 0) { break } (*(*TSGIFILE)(unsafe.Pointer(bp))).Fred = (*(*TSGIFILE)(unsafe.Pointer(bp))).FredScan (*(*TSGIFILE)(unsafe.Pointer(bp))).Fgreen = (*(*TSGIFILE)(unsafe.Pointer(bp))).FgreenScan (*(*TSGIFILE)(unsafe.Pointer(bp))).Fblue = (*(*TSGIFILE)(unsafe.Pointer(bp))).FblueScan (*(*TSGIFILE)(unsafe.Pointer(bp))).Falpha = (*(*TSGIFILE)(unsafe.Pointer(bp))).FalphaScan pixelPtr = rowPixPtr x = 0 for { if !(x < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) { break } v7 = bp + 520 v6 = *(*uintptr)(unsafe.Pointer(v7)) *(*uintptr)(unsafe.Pointer(v7))++ *(*TUByte)(unsafe.Pointer(v6)) = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(redOffset))) v9 = bp + 524 v8 = *(*uintptr)(unsafe.Pointer(v9)) *(*uintptr)(unsafe.Pointer(v9))++ *(*TUByte)(unsafe.Pointer(v8)) = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(greenOffset))) v11 = bp + 528 v10 = *(*uintptr)(unsafe.Pointer(v11)) *(*uintptr)(unsafe.Pointer(v11))++ *(*TUByte)(unsafe.Pointer(v10)) = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(blueOffset))) if nchan == int32(4) { /* Have a alpha channel and write it. */ v13 = bp + 532 v12 = *(*uintptr)(unsafe.Pointer(v13)) *(*uintptr)(unsafe.Pointer(v13))++ *(*TUByte)(unsafe.Pointer(v12)) = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(alphaOffset))) } pixelPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) goto _5 _5: ; x++ } if !(_sgiWriteScan(tls, interp, handle, bp, y, nchan) != 0) { _sgiClose(tls, interp, bp) return int32(TCL_ERROR) } rowPixPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) goto _4 _4: ; y-- } if (*(*TFMTOPT11)(unsafe.Pointer(bp + 560))).Fverbose != 0 { _printImgInfo10(tls, bp, filename, __ccgo_ts+1132) } _sgiClose(tls, interp, bp) return TCL_OK } const PACKAGE_NAME17 = "tkimgsun" const PACKAGE_STRING17 = "tkimgsun 2.0.1" const PACKAGE_TARNAME17 = "tkimgsun" const PACKAGE_TCLNAME14 = "img::sun" const RAS_MAGIC = 1504078485 const RAS_TYPE_RLE = 2 const RAS_TYPE_STD = 1 var _sImageFormat7 = TTk_PhotoImageFormat{ Fname: __ccgo_ts + 52318, } func init() { p := unsafe.Pointer(&_sImageFormat7) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatch7) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatch7) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileRead7) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringRead7) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWrite7) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWrite7) } /* *---------------------------------------------------------------------------- * * Tkimgsun_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgsun_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<> libc.Int32FromInt32(24) & uint32(0xff)) (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(1)] = uint8(c >> libc.Int32FromInt32(16) & uint32(0xff)) (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(2)] = uint8(c >> libc.Int32FromInt32(8) & uint32(0xff)) (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(3)] = uint8(c & uint32(0xff)) if int32(4) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, ofp, bp, int32(4)) { return uint8(FALSE) } return uint8(TRUE) } // C documentation // // /* Start reading Runlength Encoded Data */ func _rle_startread(tls *libc.TLS, ifp uintptr) { var v1 int32 _ = v1 _ = ifp v1 = libc.Int32FromInt32(0) _rlebuf.Fn = v1 _rlebuf.Fval = v1 } // C documentation // // /* Read pixels from RLE-stream */ func _rle_fread(tls *libc.TLS, ptr uintptr, sz int32, nelem int32, ifp uintptr) (r int32) { var cnt, elem_read, err, val, v3 int32 var v4 uintptr _, _, _, _, _, _ = cnt, elem_read, err, val, v3, v4 err = 0 elem_read = 0 for { if !(elem_read < nelem) { break } cnt = 0 for { if !(cnt < sz) { break } if _rlebuf.Fn > 0 { _rlebuf.Fn-- v3 = _rlebuf.Fval } else { v3 = _rle_fgetc(tls, ifp) } val = v3 if val < 0 { err = int32(1) break } v4 = ptr ptr++ *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(val) goto _2 _2: ; cnt++ } if err != 0 { break } goto _1 _1: ; elem_read++ } return elem_read } // C documentation // // /* Read uncompressed pixels from input stream "ifp" */ func _sun_fread(tls *libc.TLS, ptr uintptr, sz int32, nelem int32, ifp uintptr) (r int32) { if nelem*sz != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, ifp, ptr, nelem*sz) { return -int32(1) } return nelem } // C documentation // // /* Get one pixel from RLE-stream */ func _rle_fgetc(tls *libc.TLS, ifp uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* flag at bp+0 */ TUByte var _ /* runcnt at bp+1 */ TUByte var _ /* runval at bp+2 */ TUByte if _rlebuf.Fn > 0 { /* Something in the buffer ? */ _rlebuf.Fn-- return _rlebuf.Fval } /* Nothing in the buffer. We have to read something */ if !(libc.Int32FromInt32(1) == (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, ifp, bp, int32(1))) { return -int32(1) } if libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(bp))) != int32(0x80) { return libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(bp))) } /* Single byte run ? */ if !(libc.Int32FromInt32(1) == (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, ifp, bp+1, int32(1))) { return -int32(1) } if libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(bp + 1))) == 0 { return int32(0x80) } /* Single 0x80 ? */ /* The run */ if !(libc.Int32FromInt32(1) == (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, ifp, bp+2, int32(1))) { return -int32(1) } _rlebuf.Fn = libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(bp + 1))) _rlebuf.Fval = libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(bp + 2))) return libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(bp + 2))) } // C documentation // // /* Read one byte from input stream "ifp" */ func _sun_getc(tls *libc.TLS, ifp uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* val at bp+0 */ TUByte if !(libc.Int32FromInt32(1) == (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, ifp, bp, int32(1))) { return -int32(1) } return libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(bp))) } // C documentation // // /* Start writing Runlength Encoded Data */ func _rle_startwrite(tls *libc.TLS, ofp uintptr) { _ = ofp _rlebuf.Fval = 0 _rlebuf.Fn = 0 } // C documentation // // /* Write uncompressed character to RLE-stream */ func _rle_fputc(tls *libc.TLS, val int32, ofp uintptr) (r int32) { var retval, v1 int32 _, _ = retval, v1 if _rlebuf.Fn == 0 { /* Nothing in the buffer ? Save the value */ _rlebuf.Fn = int32(1) _rlebuf.Fval = val return val } /* Something in the buffer */ if _rlebuf.Fval == val { /* Same value in the buffer ? */ _rlebuf.Fn++ if _rlebuf.Fn == int32(257) { /* Can not be encoded in a single run ? */ retval = _rle_putrun(tls, int32(256), _rlebuf.Fval, ofp) if retval < 0 { return retval } _rlebuf.Fn -= int32(256) } return val } /* Something different in the buffer ? Write out the run */ retval = _rle_putrun(tls, _rlebuf.Fn, _rlebuf.Fval, ofp) if retval < 0 { return retval } /* Save the new value */ _rlebuf.Fn = int32(1) v1 = val _rlebuf.Fval = v1 return v1 } // C documentation // // /* Write out a run with 0 < n < 257 */ func _rle_putrun(tls *libc.TLS, n int32, val int32, ofp uintptr) (r int32) { var flag, retval, v1 int32 _, _, _ = flag, retval, v1 retval = int32(1) flag = int32(0x80) /* Useful to write a 3 byte run ? */ if n > int32(2) || n == int32(2) && val == flag { if !(_writeUByte2(tls, ofp, libc.Uint8FromInt32(flag)) != 0) || !(_writeUByte2(tls, ofp, libc.Uint8FromInt32(n-int32(1))) != 0) || !(_writeUByte2(tls, ofp, libc.Uint8FromInt32(val)) != 0) { retval = -int32(1) } } else { if n == int32(2) { /* Write two single runs (could not be value 0x80) */ if !(_writeUByte2(tls, ofp, libc.Uint8FromInt32(val)) != 0) { retval = -int32(1) } } else { /* Write a single run */ if val == flag { if !(_writeUByte2(tls, ofp, libc.Uint8FromInt32(flag)) != 0) || !(_writeUByte2(tls, ofp, uint8(0)) != 0) { retval = -int32(1) } } else { if !(_writeUByte2(tls, ofp, libc.Uint8FromInt32(val)) != 0) { retval = -int32(1) } } } } if retval < 0 { v1 = retval } else { v1 = val } return v1 } // C documentation // // /* End writing Runlength Encoded Data */ func _rle_endwrite(tls *libc.TLS, ofp uintptr) { var v1 int32 _ = v1 if _rlebuf.Fn > 0 { _rle_putrun(tls, _rlebuf.Fn, _rlebuf.Fval, ofp) v1 = libc.Int32FromInt32(0) _rlebuf.Fn = v1 _rlebuf.Fval = v1 /* Clear RLE-buffer */ } } func _printImgInfo11(tls *libc.TLS, sh uintptr, filename uintptr, msg uintptr) { bp := tls.Alloc(288) defer tls.Free(288) var outChan TTcl_Channel var type1 TUInt3 var v1, v2 uintptr var _ /* str at bp+0 */ [256]uint8 _, _, _, _ = outChan, type1, v1, v2 type1 = (*TSUNHEADER)(unsafe.Pointer(sh)).Fras_type outChan = (*(*func(*libc.TLS, int32) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStdChannel})))(tls, libc.Int32FromInt32(1)<= 0) { break } v3 = dest dest++ *(*TUByte)(unsafe.Pointer(v3)) = libc.Uint8FromInt32(libc.BoolInt32(j&(int32(1)<= int32(8) { if rle != 0 { if _rlebuf.Fn > 0 { _rlebuf.Fn-- v6 = _rlebuf.Fval } else { v6 = _rle_fgetc(tls, ifp) } v5 = v6 } else { v5 = _sun_getc(tls, ifp) } pix8 = v5 if pix8 < 0 { err = int32(1) pix8 = 0 } libc.Xmemcpy(tls, dest, bp+uintptr(pix8*int32(8)), uint32(8)) dest += uintptr(8) x -= int32(8) } if x > 0 { if rle != 0 { if _rlebuf.Fn > 0 { _rlebuf.Fn-- v8 = _rlebuf.Fval } else { v8 = _rle_fgetc(tls, ifp) } v7 = v8 } else { v7 = _sun_getc(tls, ifp) } pix8 = v7 if pix8 < 0 { err = int32(1) pix8 = 0 } libc.Xmemcpy(tls, dest, bp+uintptr(pix8*int32(8)), libc.Uint32FromInt32(x)) dest += uintptr(x) } if linepad != 0 { if rle != 0 { if _rlebuf.Fn > 0 { _rlebuf.Fn-- v10 = _rlebuf.Fval } else { v10 = _rle_fgetc(tls, ifp) } v9 = v10 } else { v9 = _sun_getc(tls, ifp) } err |= libc.BoolInt32(v9 < 0) } if err != 0 { libc.X__builtin_snprintf(tls, bp+2084, uint32(256), __ccgo_ts+52437, libc.VaList(bp+2352, y)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+2352, bp+2084, libc.UintptrFromInt32(0))) return uint8(FALSE) } if y >= srcY { if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp+2048, destX, outY, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = uint8(FALSE) break } outY++ } goto _4 _4: ; y++ } return result } // C documentation // // /* Load SUN Raster file with depth 8 */ func _load_sun_d8(tls *libc.TLS, interp uintptr, ifp uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, fileWidth int32, fileHeight int32, type1 int32, suncolmap uintptr, maplength int32) (r TBoln) { bp := tls.Alloc(320) defer tls.Free(320) var dest, indData, pixbuf, src, v10, v11, v3, v9 uintptr var err, grayscale, linepad, nchan, ncols, outY, rle, stopY, x, y, v1, v2, v5, v6, v7 int32 var result TBoln var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* errMsg at bp+36 */ [256]uint8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dest, err, grayscale, indData, linepad, nchan, ncols, outY, pixbuf, result, rle, src, stopY, x, y, v1, v10, v11, v2, v3, v5, v6, v7, v9 indData = libc.UintptrFromInt32(0) pixbuf = libc.UintptrFromInt32(0) result = uint8(TRUE) rle = libc.BoolInt32(type1 == int32(RAS_TYPE_RLE)) linepad = fileWidth % int32(2) ncols = maplength / int32(3) /* Check, if it's a grayscale or color indexed image. */ grayscale = int32(1) nchan = int32(1) if ncols > 0 && suncolmap != libc.UintptrFromInt32(0) { grayscale = 0 nchan = int32(3) } if !(grayscale != 0) { pixbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(fileWidth*nchan)) if !(pixbuf != 0) { libc.X__builtin_snprintf(tls, bp+36, uint32(256), __ccgo_ts+52404, libc.VaList(bp+304, fileWidth*nchan)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+304, bp+36, libc.UintptrFromInt32(0))) if suncolmap != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, suncolmap) } return uint8(TCL_ERROR) } } /* This buffer contains either the color indices or the grayscale value. */ indData = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(fileWidth)*uint32(1)) if !(indData != 0) { libc.X__builtin_snprintf(tls, bp+36, uint32(256), __ccgo_ts+52404, libc.VaList(bp+304, libc.Int32FromUint32(libc.Uint32FromInt32(fileWidth)*libc.Uint32FromInt64(1)))) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+304, bp+36, libc.UintptrFromInt32(0))) return uint8(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = nchan (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = fileWidth * nchan (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = width (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) *(*int32)(unsafe.Pointer(bp + 20)) = 0 if grayscale != 0 { v1 = 0 } else { v1 = int32(1) } *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = v1 if grayscale != 0 { v2 = 0 } else { v2 = int32(2) } *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = v2 *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = 0 if grayscale != 0 { v3 = indData + uintptr(srcX*nchan) } else { v3 = pixbuf + uintptr(srcX*nchan) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = v3 if rle != 0 { _rle_startread(tls, ifp) /* Initialize RLE-buffer */ } stopY = srcY + height outY = destY y = 0 for { if !(y < stopY) { break } src = indData libc.Xmemset(tls, src, 0, libc.Uint32FromInt32(fileWidth)) if rle != 0 { v5 = _rle_fread(tls, src, int32(1), fileWidth, ifp) } else { v5 = _sun_fread(tls, src, int32(1), fileWidth, ifp) } err = libc.BoolInt32(v5 != fileWidth) if err != 0 && y != height-int32(1) { libc.X__builtin_snprintf(tls, bp+36, uint32(256), __ccgo_ts+52437, libc.VaList(bp+304, y)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+304, bp+36, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, indData) return uint8(FALSE) } if linepad != 0 { if rle != 0 { if _rlebuf.Fn > 0 { _rlebuf.Fn-- v7 = _rlebuf.Fval } else { v7 = _rle_fgetc(tls, ifp) } v6 = v7 } else { v6 = _sun_getc(tls, ifp) } err = libc.BoolInt32(v6 < 0) if err != 0 { libc.X__builtin_snprintf(tls, bp+36, uint32(256), __ccgo_ts+52437, libc.VaList(bp+304, y)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+304, bp+36, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, indData) return uint8(FALSE) } } if !(grayscale != 0) { src = indData dest = pixbuf x = 0 for { if !(x < width) { break } v9 = dest dest++ *(*TUByte)(unsafe.Pointer(v9)) = *(*TUByte)(unsafe.Pointer(suncolmap + uintptr(*(*TUByte)(unsafe.Pointer(src))))) v10 = dest dest++ *(*TUByte)(unsafe.Pointer(v10)) = *(*TUByte)(unsafe.Pointer(suncolmap + uintptr(libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(src)))+ncols))) v11 = dest dest++ *(*TUByte)(unsafe.Pointer(v11)) = *(*TUByte)(unsafe.Pointer(suncolmap + uintptr(libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(src)))+int32(2)*ncols))) src++ goto _8 _8: ; x++ } } if y >= srcY { if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = uint8(FALSE) break } outY++ } goto _4 _4: ; y++ } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, indData) return result } /* Load SUN Raster file with true color image: depth = 24 or 32 */ func _load_rgb(tls *libc.TLS, interp uintptr, ifp uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, fileWidth int32, fileHeight int32, nchan int32, type1 int32, withalpha int32) (r TBoln) { bp := tls.Alloc(320) defer tls.Free(320) var dest, pixbuf uintptr var err, linepad, outY, rle, stopY, x, y, v1, v3, v4, v5, v8 int32 var result TBoln var tmp TUByte var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* errMsg at bp+36 */ [256]uint8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dest, err, linepad, outY, pixbuf, result, rle, stopY, tmp, x, y, v1, v3, v4, v5, v8 result = uint8(TRUE) pixbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(fileWidth*nchan)) if !(pixbuf != 0) { libc.X__builtin_snprintf(tls, bp+36, uint32(256), __ccgo_ts+52404, libc.VaList(bp+304, fileWidth*nchan)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+304, bp+36, libc.UintptrFromInt32(0))) return uint8(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = nchan (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = fileWidth * nchan (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = width (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) *(*int32)(unsafe.Pointer(bp + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = int32(2) if nchan < int32(4) { withalpha = 0 } if withalpha != 0 { v1 = int32(3) } else { v1 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = v1 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = pixbuf + uintptr(srcX*nchan) rle = libc.BoolInt32(type1 == int32(RAS_TYPE_RLE)) linepad = fileWidth * nchan % int32(2) if rle != 0 { _rle_startread(tls, ifp) /* Initialize RLE-buffer */ } stopY = srcY + height outY = destY y = 0 for { if !(y < stopY) { break } dest = pixbuf libc.Xmemset(tls, dest, 0, libc.Uint32FromInt32(nchan*fileWidth)) if rle != 0 { v3 = _rle_fread(tls, dest, nchan, fileWidth, ifp) } else { v3 = _sun_fread(tls, dest, nchan, fileWidth, ifp) } err = libc.BoolInt32(v3 != fileWidth) if err != 0 && y != height-int32(1) { libc.X__builtin_snprintf(tls, bp+36, uint32(256), __ccgo_ts+52437, libc.VaList(bp+304, y)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+304, bp+36, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, pixbuf) return uint8(FALSE) } if linepad != 0 { if rle != 0 { if _rlebuf.Fn > 0 { _rlebuf.Fn-- v5 = _rlebuf.Fval } else { v5 = _rle_fgetc(tls, ifp) } v4 = v5 } else { v4 = _sun_getc(tls, ifp) } err = libc.BoolInt32(v4 < 0) if err != 0 { libc.X__builtin_snprintf(tls, bp+36, uint32(256), __ccgo_ts+52437, libc.VaList(bp+304, y)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+304, bp+36, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, pixbuf) return uint8(FALSE) } } if y >= srcY { dest = pixbuf + uintptr(srcX*nchan) if type1 != int32(3) { if nchan == int32(3) { /* GBR Format. Swap to RGB. */ x = 0 for { if !(x < width) { break } tmp = *(*TUByte)(unsafe.Pointer(dest)) *(*TUByte)(unsafe.Pointer(dest)) = *(*TUByte)(unsafe.Pointer(dest + 2)) *(*TUByte)(unsafe.Pointer(dest + 2)) = tmp dest += uintptr(3) goto _6 _6: ; x++ } } else { /* AGBR Format. Swap to RGBA. */ x = 0 for { if !(x < width) { break } tmp = *(*TUByte)(unsafe.Pointer(dest)) *(*TUByte)(unsafe.Pointer(dest)) = *(*TUByte)(unsafe.Pointer(dest + 3)) *(*TUByte)(unsafe.Pointer(dest + 3)) = tmp tmp = *(*TUByte)(unsafe.Pointer(dest + 1)) *(*TUByte)(unsafe.Pointer(dest + 1)) = *(*TUByte)(unsafe.Pointer(dest + 2)) *(*TUByte)(unsafe.Pointer(dest + 2)) = tmp dest += uintptr(4) goto _7 _7: ; x++ } } } if withalpha != 0 { v8 = TK_PHOTO_COMPOSITE_OVERLAY } else { v8 = int32(TK_PHOTO_COMPOSITE_SET) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, width, int32(1), v8) == int32(TCL_ERROR) { result = uint8(FALSE) break } outY++ } goto _2 _2: ; y++ } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, pixbuf) return result } func _ParseFormatOpts12(tls *libc.TLS, interp uintptr, format uintptr, opts uintptr, mode int32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var i, v2, v3 TTcl_Size var optionStr uintptr var _ /* boolVal at bp+12 */ int32 var _ /* index at bp+4 */ int32 var _ /* objc at bp+0 */ TTcl_Size var _ /* objv at bp+8 */ uintptr _, _, _, _ = i, optionStr, v2, v3 /* Initialize options with default values. */ (*TFMTOPT11)(unsafe.Pointer(opts)).Fverbose = uint8(0) (*TFMTOPT11)(unsafe.Pointer(opts)).Fcompression = int32(1) (*TFMTOPT11)(unsafe.Pointer(opts)).Fwithalpha = uint8(1) if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ListObjGetElementsPtr})))(tls, interp, format, bp, bp+8) == int32(TCL_ERROR) { return int32(TCL_ERROR) } i = int32(1) for { if !(i < *(*TTcl_Size)(unsafe.Pointer(bp))) { break } if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+24, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)< *(*int32)(unsafe.Pointer(bp)) { outWidth = *(*int32)(unsafe.Pointer(bp)) - srcX } else { outWidth = width } if srcY+height > *(*int32)(unsafe.Pointer(bp + 4)) { outHeight = *(*int32)(unsafe.Pointer(bp + 4)) - srcY } else { outHeight = height } if outWidth <= 0 || outHeight <= 0 || srcX >= *(*int32)(unsafe.Pointer(bp)) || srcY >= *(*int32)(unsafe.Pointer(bp + 4)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+320, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_type > uint32(5) { libc.X__builtin_snprintf(tls, bp+48, uint32(256), __ccgo_ts+52501, libc.VaList(bp+320, (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_type)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+320, bp+48, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_type == uint32(RAS_TYPE_RLE) { (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, int32(1)) } /* Is there a RGB colourmap ? */ if (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_maptype == uint32(1) && (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_maplength > uint32(0) { suncolmap = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_maplength) if !(suncolmap != 0) { libc.X__builtin_snprintf(tls, bp+48, uint32(256), __ccgo_ts+52404, libc.VaList(bp+320, (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_maplength)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+320, bp+48, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, 0) return int32(TCL_ERROR) } if !(_read_sun_cols(tls, handle, bp+8, suncolmap) != 0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+320, __ccgo_ts+52529, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, suncolmap) (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, 0) return int32(TCL_ERROR) } } else { if (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_maplength > uint32(0) { /* This type of colourmap is not supported. Ignore it. */ length = libc.Int32FromUint32(libc.Uint32FromInt64(32)/libc.Uint32FromInt64(4)*libc.Uint32FromInt32(4) + (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_maplength) d = 0 for { if !(d < length) { break } _ = libc.Int32FromInt32(1) == (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+304, int32(1)) goto _1 _1: ; d++ } } } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+outWidth, destY+outHeight) == int32(TCL_ERROR) { if suncolmap != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, suncolmap) } (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, 0) return int32(TCL_ERROR) } if (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_depth == uint32(32) { v2 = int32(4) } else { v2 = int32(3) } nchan = v2 switch (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_depth { case uint32(1): /* 2 colors B/W */ if !(_load_sun_d1(tls, interp, handle, imageHandle, destX, destY, outWidth, outHeight, srcX, srcY, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), libc.Int32FromUint32((*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_type)) != 0) { retCode = int32(TCL_ERROR) } case uint32(8): /* 256 colours */ if !(_load_sun_d8(tls, interp, handle, imageHandle, destX, destY, outWidth, outHeight, srcX, srcY, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), libc.Int32FromUint32((*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_type), suncolmap, libc.Int32FromUint32((*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_maplength)) != 0) { retCode = int32(TCL_ERROR) } case uint32(24): /* True color */ fallthrough case uint32(32): /* True color with alpha channel */ if !(_load_rgb(tls, interp, handle, imageHandle, destX, destY, outWidth, outHeight, srcX, srcY, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), nchan, libc.Int32FromUint32((*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_type), libc.Int32FromUint8((*(*TFMTOPT11)(unsafe.Pointer(bp + 40))).Fwithalpha)) != 0) { retCode = int32(TCL_ERROR) } default: libc.X__builtin_snprintf(tls, bp+48, uint32(256), __ccgo_ts+52554, libc.VaList(bp+320, (*(*TSUNHEADER)(unsafe.Pointer(bp + 8))).Fras_depth)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+320, bp+48, libc.UintptrFromInt32(0))) retCode = int32(TCL_ERROR) break } if suncolmap != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, suncolmap) } (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, 0) return retCode } func _FileWrite7(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, filename, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite9(tls, interp, filename, format, bp, blockPtr) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } func _StringWrite7(tls *libc.TLS, interp uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = result libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp) result = _CommonWrite9(tls, interp, __ccgo_ts+865, format, bp, blockPtr) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp))).FbyteObj) } return result } func _CommonWrite9(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, handle uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(320) defer tls.Free(320) var alphaOffset, blueOffset, greenOffset, linepad, nBytes, nchan, redOffset, x, y, v1, v2, v3 int32 var pixRowPtr, pixelPtr, row, rowPtr, v6, v7, v8, v9 uintptr var _ /* errMsg at bp+40 */ [256]uint8 var _ /* opts at bp+32 */ TFMTOPT11 var _ /* sh at bp+0 */ TSUNHEADER _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, greenOffset, linepad, nBytes, nchan, pixRowPtr, pixelPtr, redOffset, row, rowPtr, x, y, v1, v2, v3, v6, v7, v8, v9 if _ParseFormatOpts12(tls, interp, format, bp+32, libc.Int32FromInt32(1)<, from a file and convert them into the current machine's format. */ func _readShort1(tls *libc.TLS, handle uintptr, s uintptr) (r TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [2]uint8 if int32(2) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, int32(2)) { return uint8(FALSE) } *(*TShort)(unsafe.Pointer(s)) = int16(libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp)))[0]) | libc.Int32FromUint8((*(*[2]uint8)(unsafe.Pointer(bp)))[int32(1)])< (an array of 2 bytes) and write the array to a file. */ func _writeShort(tls *libc.TLS, handle uintptr, s TShort) (r TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [2]TByte (*(*[2]TByte)(unsafe.Pointer(bp)))[0] = libc.Uint8FromInt16(s) (*(*[2]TByte)(unsafe.Pointer(bp)))[int32(1)] = libc.Uint8FromInt32(int32(s) >> int32(8)) if int32(2) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, int32(2)) { return uint8(FALSE) } return uint8(TRUE) } func _printImgInfo12(tls *libc.TLS, th uintptr, filename uintptr, msg uintptr) { bp := tls.Alloc(288) defer tls.Free(288) var outChan TTcl_Channel var v1, v3, v5, v7 int32 var v2, v4, v6 uintptr var _ /* str at bp+0 */ [256]uint8 _, _, _, _, _, _, _, _ = outChan, v1, v2, v3, v4, v5, v6, v7 outChan = (*(*func(*libc.TLS, int32) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStdChannel})))(tls, libc.Int32FromInt32(1)<>int32(5)&int32(0x1) != 0 { v5 = int32(TRUE) } else { v5 = FALSE } if v5 != 0 { v4 = __ccgo_ts + 52742 } else { v4 = __ccgo_ts + 52752 } libc.X__builtin_snprintf(tls, bp, uint32(256), __ccgo_ts+50313, libc.VaList(bp+264, v4)) (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_WriteChars})))(tls, outChan, bp, -int32(1)) if libc.Int32FromUint8((*TTGAHEADER)(unsafe.Pointer(th)).Fimgdes)>>int32(4)&int32(0x1) != 0 { v7 = FALSE } else { v7 = int32(TRUE) } if v7 != 0 { v6 = __ccgo_ts + 52762 } else { v6 = __ccgo_ts + 52772 } libc.X__builtin_snprintf(tls, bp, uint32(256), __ccgo_ts+52782, libc.VaList(bp+264, v6)) (*(*func(*libc.TLS, TTcl_Channel, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_WriteChars})))(tls, outChan, bp, -int32(1)) (*(*func(*libc.TLS, TTcl_Channel) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Flush})))(tls, outChan) } func _readHeader4(tls *libc.TLS, handle uintptr, th uintptr) (r TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var i, mapbytes, v2 TInt var _ /* dummy at bp+0 */ TUByte _, _, _ = i, mapbytes, v2 if !(_readUByte1(tls, handle, th) != 0) || !(_readUByte1(tls, handle, th+1) != 0) || !(_readUByte1(tls, handle, th+2) != 0) || !(_readShort1(tls, handle, th+4) != 0) || !(_readShort1(tls, handle, th+6) != 0) || !(_readUByte1(tls, handle, th+8) != 0) || !(_readShort1(tls, handle, th+10) != 0) || !(_readShort1(tls, handle, th+12) != 0) || !(_readShort1(tls, handle, th+14) != 0) || !(_readShort1(tls, handle, th+16) != 0) || !(_readUByte1(tls, handle, th+18) != 0) || !(_readUByte1(tls, handle, th+19) != 0) { return uint8(FALSE) } /* Try to find out if this file can possibly be a TARGA pixel file. */ if !((libc.Int32FromUint8((*TTGAHEADER)(unsafe.Pointer(th)).Fimgtyp) == int32(TGA_RGB_UNCOMP) || libc.Int32FromUint8((*TTGAHEADER)(unsafe.Pointer(th)).Fimgtyp) == int32(TGA_RGB_COMP)) && (libc.Int32FromUint8((*TTGAHEADER)(unsafe.Pointer(th)).Fpixsize) == int32(24) || libc.Int32FromUint8((*TTGAHEADER)(unsafe.Pointer(th)).Fpixsize) == int32(32))) { return uint8(FALSE) } i = 0 for { if !(i < libc.Int32FromUint8((*TTGAHEADER)(unsafe.Pointer(th)).Fnumid)) { break } if !(_readUByte1(tls, handle, bp) != 0) { return uint8(FALSE) } goto _1 _1: ; i++ } if int32((*TTGAHEADER)(unsafe.Pointer(th)).Fxsize) < int32(1) || int32((*TTGAHEADER)(unsafe.Pointer(th)).Fysize) < int32(1) { return uint8(FALSE) } /* Skip colormap data, if present. */ if int32((*TTGAHEADER)(unsafe.Pointer(th)).Fmapsize) > 0 { switch libc.Int32FromUint8((*TTGAHEADER)(unsafe.Pointer(th)).Fmapbits) { case int32(15): fallthrough case int32(16): mapbytes = int32(2) * int32((*TTGAHEADER)(unsafe.Pointer(th)).Fmapsize) case int32(24): mapbytes = int32(3) * int32((*TTGAHEADER)(unsafe.Pointer(th)).Fmapsize) case int32(32): mapbytes = int32(4) * int32((*TTGAHEADER)(unsafe.Pointer(th)).Fmapsize) default: return uint8(FALSE) } for { v2 = mapbytes mapbytes-- if !(v2 != 0) { break } if !(_readUByte1(tls, handle, bp) != 0) { return uint8(FALSE) } } } return uint8(TRUE) } func _writeHeader2(tls *libc.TLS, handle uintptr, th uintptr) (r TBoln) { if !(_writeUByte3(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fnumid) != 0) || !(_writeUByte3(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fmaptyp) != 0) || !(_writeUByte3(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fimgtyp) != 0) || !(_writeShort(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fmaporig) != 0) || !(_writeShort(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fmapsize) != 0) || !(_writeUByte3(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fmapbits) != 0) || !(_writeShort(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fxorig) != 0) || !(_writeShort(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fyorig) != 0) || !(_writeShort(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fxsize) != 0) || !(_writeShort(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fysize) != 0) || !(_writeUByte3(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fpixsize) != 0) || !(_writeUByte3(tls, handle, (*TTGAHEADER)(unsafe.Pointer(th)).Fimgdes) != 0) { return uint8(FALSE) } return uint8(TRUE) } /* A pixel is represented by 3 or 4 bytes in the order Blue/Green/Red/Alpha. We are converting the order into standard RGBA order. Note that TARGA allows pixel values to be compressed across scanline boundaries. */ /* Read the value of a pixel from "handle" and assume it must be repeated "n" times. */ func _readRlePixel(tls *libc.TLS, interp uintptr, handle uintptr, pixBufPtr uintptr, countPtr uintptr, stop TInt, n TInt, tf uintptr) (r TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var count, i, nchan TInt var v1 int32 var _ /* localBuf at bp+0 */ [4]TUByte _, _, _, _ = count, i, nchan, v1 if libc.Int32FromUint8((*TTGAFILE)(unsafe.Pointer(tf)).Fth.Fpixsize) == int32(24) { v1 = int32(3) } else { v1 = int32(4) } nchan = v1 if nchan != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp, nchan) { return _readError(tls, interp) } count = *(*TInt)(unsafe.Pointer(countPtr)) i = 0 for { if !(i < n) { break } *(*TUByte)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pixBufPtr)))) = (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(2)] *(*TUByte)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pixBufPtr)) + 1)) = (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(1)] *(*TUByte)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pixBufPtr)) + 2)) = (*(*[4]TUByte)(unsafe.Pointer(bp)))[0] if nchan == int32(4) { *(*TUByte)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pixBufPtr)) + 3)) = (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(3)] } *(*uintptr)(unsafe.Pointer(pixBufPtr)) += uintptr(nchan) count++ if count == stop { /* Scanline is filled with pixel values. Determine the number of pixels to keep for next scanline. */ (*TTGAFILE)(unsafe.Pointer(tf)).Fscanrest = n - i - int32(1) *(*TInt)(unsafe.Pointer(countPtr)) = count return uint8(TRUE) } goto _2 _2: ; i++ } *(*TInt)(unsafe.Pointer(countPtr)) = count return uint8(TRUE) } /* The channels of scan line number "y" are read. */ func _tgaReadScan(tls *libc.TLS, interp uintptr, handle uintptr, tf uintptr, y TInt) (r TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var bytesPerLine, i, nchan, numpix, pix, stop TInt var curPix TUByte var v1, v2 int32 var v3, v4, v5, v6 uintptr var _ /* cbuf at bp+12 */ [1]TByte var _ /* count at bp+0 */ TInt var _ /* localBuf at bp+4 */ [4]TUByte var _ /* pixBufPtr at bp+8 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _ = bytesPerLine, curPix, i, nchan, numpix, pix, stop, v1, v2, v3, v4, v5, v6 *(*TInt)(unsafe.Pointer(bp)) = 0 stop = int32((*TTGAFILE)(unsafe.Pointer(tf)).Fth.Fxsize) if libc.Int32FromUint8((*TTGAFILE)(unsafe.Pointer(tf)).Fth.Fpixsize) == int32(24) { v1 = int32(3) } else { v1 = int32(4) } nchan = v1 *(*uintptr)(unsafe.Pointer(bp + 8)) = (*TTGAFILE)(unsafe.Pointer(tf)).Fpixbuf if libc.Int32FromUint8((*TTGAFILE)(unsafe.Pointer(tf)).Fth.Fimgtyp) == int32(TGA_RGB_COMP) { v2 = int32(TRUE) } else { v2 = FALSE } if v2 != 0 { /* While there are pixels left from the previous scanline, either fill the current scanline with the pixel value still stored in "pixbuf" (TGA_MODE_SAME) or read in the appropriate number of pixel values (TGA_MODE_DIFF). */ for (*TTGAFILE)(unsafe.Pointer(tf)).Fscanrest != 0 { if (*TTGAFILE)(unsafe.Pointer(tf)).Fscanmode == int32(TGA_MODE_DIFF) { if nchan != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+4, nchan) { return _readError(tls, interp) } } v3 = *(*uintptr)(unsafe.Pointer(bp + 8)) *(*uintptr)(unsafe.Pointer(bp + 8))++ *(*TUByte)(unsafe.Pointer(v3)) = (*(*[4]TUByte)(unsafe.Pointer(bp + 4)))[int32(2)] v4 = *(*uintptr)(unsafe.Pointer(bp + 8)) *(*uintptr)(unsafe.Pointer(bp + 8))++ *(*TUByte)(unsafe.Pointer(v4)) = (*(*[4]TUByte)(unsafe.Pointer(bp + 4)))[int32(1)] v5 = *(*uintptr)(unsafe.Pointer(bp + 8)) *(*uintptr)(unsafe.Pointer(bp + 8))++ *(*TUByte)(unsafe.Pointer(v5)) = (*(*[4]TUByte)(unsafe.Pointer(bp + 4)))[0] if nchan == int32(4) { v6 = *(*uintptr)(unsafe.Pointer(bp + 8)) *(*uintptr)(unsafe.Pointer(bp + 8))++ *(*TUByte)(unsafe.Pointer(v6)) = (*(*[4]TUByte)(unsafe.Pointer(bp + 4)))[int32(3)] } *(*TInt)(unsafe.Pointer(bp))++ (*TTGAFILE)(unsafe.Pointer(tf)).Fscanrest-- /* If the image is small, the compression might go over several scanlines. */ if *(*TInt)(unsafe.Pointer(bp)) == stop { return uint8(TRUE) } } /* Read the byte telling us the compression mode and the compression count. Then read the pixel values till a scanline is filled. */ for cond := true; cond; cond = *(*TInt)(unsafe.Pointer(bp)) < stop { if int32(1) != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, bp+12, int32(1)) { return _readError(tls, interp) } numpix = libc.Int32FromUint8((*(*[1]TByte)(unsafe.Pointer(bp + 12)))[0])&int32(0x7F) + int32(1) if libc.Int32FromUint8((*(*[1]TByte)(unsafe.Pointer(bp + 12)))[0])&int32(0x80) != int32(0x80) { (*TTGAFILE)(unsafe.Pointer(tf)).Fscanmode = int32(TGA_MODE_DIFF) pix = 0 for { if !(pix < numpix) { break } if !(_readRlePixel(tls, interp, handle, bp+8, bp, stop, int32(1), tf) != 0) { return uint8(FALSE) } if *(*TInt)(unsafe.Pointer(bp)) == stop { (*TTGAFILE)(unsafe.Pointer(tf)).Fscanrest = numpix - pix - int32(1) break } goto _7 _7: ; pix++ } } else { (*TTGAFILE)(unsafe.Pointer(tf)).Fscanmode = TGA_MODE_SAME if !(_readRlePixel(tls, interp, handle, bp+8, bp, stop, numpix, tf) != 0) { return uint8(FALSE) } } } } else { bytesPerLine = nchan * int32((*TTGAFILE)(unsafe.Pointer(tf)).Fth.Fxsize) if bytesPerLine != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, (*TTGAFILE)(unsafe.Pointer(tf)).Fpixbuf, bytesPerLine) { return _readError(tls, interp) } i = 0 for { if !(i < stop) { break } curPix = *(*TUByte)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + 2)) *(*TUByte)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + 2)) = *(*TUByte)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) *(*TUByte)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))) = curPix *(*uintptr)(unsafe.Pointer(bp + 8)) += uintptr(nchan) goto _8 _8: ; i++ } } return uint8(TRUE) } func _writePixel(tls *libc.TLS, handle uintptr, b TUByte, g TUByte, r TUByte, a TUByte, nchan TInt) (r1 TBoln) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* buf at bp+0 */ [4]TUByte (*(*[4]TUByte)(unsafe.Pointer(bp)))[0] = b (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(1)] = g (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(2)] = r (*(*[4]TUByte)(unsafe.Pointer(bp)))[int32(3)] = a if nchan != (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, nchan) { return uint8(FALSE) } return uint8(TRUE) } func _tgaWriteScan(tls *libc.TLS, interp uintptr, handle uintptr, tf uintptr, y TInt, nchan TInt) (r TBoln) { var alpha_end, alpha_stop, blue_end, blue_stop, green_end, green_stop, red_end, red_stop uintptr var v1 int32 _, _, _, _, _, _, _, _, _ = alpha_end, alpha_stop, blue_end, blue_stop, green_end, green_stop, red_end, red_stop, v1 (*TTGAFILE)(unsafe.Pointer(tf)).Fred = (*TTGAFILE)(unsafe.Pointer(tf)).FredScan (*TTGAFILE)(unsafe.Pointer(tf)).Fgreen = (*TTGAFILE)(unsafe.Pointer(tf)).FgreenScan (*TTGAFILE)(unsafe.Pointer(tf)).Fblue = (*TTGAFILE)(unsafe.Pointer(tf)).FblueScan (*TTGAFILE)(unsafe.Pointer(tf)).Falpha = (*TTGAFILE)(unsafe.Pointer(tf)).FalphaScan red_stop = (*TTGAFILE)(unsafe.Pointer(tf)).Fred + uintptr((*TTGAFILE)(unsafe.Pointer(tf)).Fth.Fxsize) green_stop = (*TTGAFILE)(unsafe.Pointer(tf)).Fgreen + uintptr((*TTGAFILE)(unsafe.Pointer(tf)).Fth.Fxsize) blue_stop = (*TTGAFILE)(unsafe.Pointer(tf)).Fblue + uintptr((*TTGAFILE)(unsafe.Pointer(tf)).Fth.Fxsize) alpha_stop = (*TTGAFILE)(unsafe.Pointer(tf)).Falpha + uintptr((*TTGAFILE)(unsafe.Pointer(tf)).Fth.Fxsize) /* Write the scanline data to the file. */ if libc.Int32FromUint8((*TTGAFILE)(unsafe.Pointer(tf)).Fth.Fimgtyp) == int32(TGA_RGB_COMP) { v1 = int32(TRUE) } else { v1 = FALSE } if !(v1 != 0) { for (*TTGAFILE)(unsafe.Pointer(tf)).Fred < red_stop { if !(_writePixel(tls, handle, *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fblue)), *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fgreen)), *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fred)), *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Falpha)), nchan) != 0) { return uint8(FALSE) } (*TTGAFILE)(unsafe.Pointer(tf)).Fblue++ (*TTGAFILE)(unsafe.Pointer(tf)).Fgreen++ (*TTGAFILE)(unsafe.Pointer(tf)).Fred++ (*TTGAFILE)(unsafe.Pointer(tf)).Falpha++ } } else { /* Run-length Compression */ red_end = (*TTGAFILE)(unsafe.Pointer(tf)).Fred + uintptr(1) green_end = (*TTGAFILE)(unsafe.Pointer(tf)).Fgreen + uintptr(1) blue_end = (*TTGAFILE)(unsafe.Pointer(tf)).Fblue + uintptr(1) alpha_end = (*TTGAFILE)(unsafe.Pointer(tf)).Falpha + uintptr(1) for (*TTGAFILE)(unsafe.Pointer(tf)).Fred < red_stop { for red_end < red_stop && libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fred))) == libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(red_end))) && libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fgreen))) == libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(green_end))) && libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fblue))) == libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(blue_end))) && int32(red_end)-int32((*TTGAFILE)(unsafe.Pointer(tf)).Fred)-int32(1) < int32(MAXRUN) { if nchan == int32(4) { if libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Falpha))) != libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(alpha_end))) { break } } red_end++ green_end++ blue_end++ alpha_end++ } if int32(red_end)-int32((*TTGAFILE)(unsafe.Pointer(tf)).Fred) >= int32(MINRUN1) { /* Found a run of compressable data */ if !(_writeByte(tls, handle, libc.Uint8FromInt32(int32(red_end)-int32((*TTGAFILE)(unsafe.Pointer(tf)).Fred)-libc.Int32FromInt32(1)|libc.Int32FromInt32(0x80))) != 0) || !(_writePixel(tls, handle, *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fblue)), *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fgreen)), *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fred)), *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Falpha)), nchan) != 0) { return uint8(FALSE) } (*TTGAFILE)(unsafe.Pointer(tf)).Fred = red_end (*TTGAFILE)(unsafe.Pointer(tf)).Fgreen = green_end (*TTGAFILE)(unsafe.Pointer(tf)).Fblue = blue_end (*TTGAFILE)(unsafe.Pointer(tf)).Falpha = alpha_end } else { /* Found a run of uncompressable data */ for red_end < red_stop && (red_end+uintptr(1) >= red_stop || libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(red_end))) != libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(red_end + libc.UintptrFromInt32(1)))) || (red_end+uintptr(2) >= red_stop || libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(red_end + libc.UintptrFromInt32(1)))) != libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(red_end + libc.UintptrFromInt32(2)))))) && (green_end+uintptr(1) >= green_stop || libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(green_end))) != libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(green_end + libc.UintptrFromInt32(1)))) || (green_end+uintptr(2) >= green_stop || libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(green_end + libc.UintptrFromInt32(1)))) != libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(green_end + libc.UintptrFromInt32(2)))))) && (blue_end+uintptr(1) >= blue_stop || libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(blue_end))) != libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(blue_end + libc.UintptrFromInt32(1)))) || (blue_end+uintptr(2) >= blue_stop || libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(blue_end + libc.UintptrFromInt32(1)))) != libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(blue_end + libc.UintptrFromInt32(2)))))) && int32(red_end)-int32((*TTGAFILE)(unsafe.Pointer(tf)).Fred) < int32(MAXRUN) { if nchan == int32(4) { if !(alpha_end+uintptr(1) >= alpha_stop || libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(alpha_end))) != libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(alpha_end + libc.UintptrFromInt32(1)))) || (alpha_end+uintptr(2) >= alpha_stop || libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(alpha_end + libc.UintptrFromInt32(1)))) != libc.Int32FromUint8(*(*TUByte)(unsafe.Pointer(alpha_end + libc.UintptrFromInt32(2)))))) { break } } red_end++ green_end++ blue_end++ alpha_end++ } if !(_writeByte(tls, handle, libc.Uint8FromInt32(int32(red_end)-int32((*TTGAFILE)(unsafe.Pointer(tf)).Fred)-libc.Int32FromInt32(1))) != 0) { return uint8(FALSE) } for (*TTGAFILE)(unsafe.Pointer(tf)).Fred < red_end { if !(_writePixel(tls, handle, *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fblue)), *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fgreen)), *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Fred)), *(*TUByte)(unsafe.Pointer((*TTGAFILE)(unsafe.Pointer(tf)).Falpha)), nchan) != 0) { return uint8(FALSE) } (*TTGAFILE)(unsafe.Pointer(tf)).Fred++ (*TTGAFILE)(unsafe.Pointer(tf)).Fgreen++ (*TTGAFILE)(unsafe.Pointer(tf)).Fblue++ (*TTGAFILE)(unsafe.Pointer(tf)).Falpha++ } } red_end++ green_end++ blue_end++ alpha_end++ } } return uint8(TRUE) } func _ParseFormatOpts13(tls *libc.TLS, interp uintptr, format uintptr, opts uintptr, mode int32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var i, v2, v3 TTcl_Size var optionStr uintptr var _ /* boolVal at bp+12 */ int32 var _ /* index at bp+4 */ int32 var _ /* objc at bp+0 */ TTcl_Size var _ /* objv at bp+8 */ uintptr _, _, _, _ = i, optionStr, v2, v3 /* Initialize options with default values. */ (*TFMTOPT11)(unsafe.Pointer(opts)).Fverbose = uint8(0) (*TFMTOPT11)(unsafe.Pointer(opts)).Fcompression = int32(TGA_RGB_COMP) (*TFMTOPT11)(unsafe.Pointer(opts)).Fwithalpha = uint8(1) if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ListObjGetElementsPtr})))(tls, interp, format, bp, bp+8) == int32(TCL_ERROR) { return int32(TCL_ERROR) } i = int32(1) for { if !(i < *(*TTcl_Size)(unsafe.Pointer(bp))) { break } if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+24, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)< *(*int32)(unsafe.Pointer(bp + 36)) { outWidth = *(*int32)(unsafe.Pointer(bp + 36)) - srcX } else { outWidth = width } if srcY+height > *(*int32)(unsafe.Pointer(bp + 40)) { outHeight = *(*int32)(unsafe.Pointer(bp + 40)) - srcY } else { outHeight = height } if outWidth <= 0 || outHeight <= 0 || srcX >= *(*int32)(unsafe.Pointer(bp + 36)) || srcY >= *(*int32)(unsafe.Pointer(bp + 40)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+384, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+outWidth, destY+outHeight) == int32(TCL_ERROR) { return int32(TCL_ERROR) } if libc.Int32FromUint8((*(*TTGAFILE)(unsafe.Pointer(bp + 44))).Fth.Fimgtyp) == int32(TGA_RGB_COMP) { v1 = int32(TRUE) } else { v1 = FALSE } if v1 != 0 { (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, int32(1)) } (*(*TTGAFILE)(unsafe.Pointer(bp + 44))).Fscanmode = int32(TGA_MODE_DIFF) if libc.Int32FromUint8((*(*TTGAFILE)(unsafe.Pointer(bp + 44))).Fth.Fpixsize) == int32(24) { v2 = int32(3) } else { v2 = int32(4) } nchan = v2 (*(*TTGAFILE)(unsafe.Pointer(bp + 44))).Fpixbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(bp + 36))*nchan)) if !((*(*TTGAFILE)(unsafe.Pointer(bp + 44))).Fpixbuf != 0) { libc.X__builtin_snprintf(tls, bp+120, uint32(256), __ccgo_ts+52404, libc.VaList(bp+384, *(*int32)(unsafe.Pointer(bp + 36))*nchan)) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+384, bp+120, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, 0) return int32(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = nchan (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = *(*int32)(unsafe.Pointer(bp + 36)) * nchan (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = outWidth (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) *(*int32)(unsafe.Pointer(bp + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = int32(2) if nchan < int32(4) { (*(*TFMTOPT11)(unsafe.Pointer(bp + 112))).Fwithalpha = uint8(0) } if (*(*TFMTOPT11)(unsafe.Pointer(bp + 112))).Fwithalpha != 0 { v3 = int32(3) } else { v3 = 0 } *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = v3 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = (*(*TTGAFILE)(unsafe.Pointer(bp + 44))).Fpixbuf + uintptr(srcX*nchan) stopY = srcY + outHeight if libc.Int32FromUint8((*(*TTGAFILE)(unsafe.Pointer(bp + 44))).Fth.Fimgdes)>>int32(5)&int32(0x1) != 0 { v4 = int32(TRUE) } else { v4 = FALSE } if v4 != 0 { outY = destY y = 0 for { if !(y < stopY) { break } _tgaReadScan(tls, interp, handle, bp+44, y) if y >= srcY { if (*(*TFMTOPT11)(unsafe.Pointer(bp + 112))).Fwithalpha != 0 { v6 = TK_PHOTO_COMPOSITE_OVERLAY } else { v6 = int32(TK_PHOTO_COMPOSITE_SET) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, width, int32(1), v6) == int32(TCL_ERROR) { result = int32(TCL_ERROR) break } outY++ } goto _5 _5: ; y++ } } else { outY = destY + outHeight - int32(1) y = *(*int32)(unsafe.Pointer(bp + 40)) - int32(1) for { if !(y >= 0) { break } _tgaReadScan(tls, interp, handle, bp+44, y) if y >= srcY && y < stopY { if (*(*TFMTOPT11)(unsafe.Pointer(bp + 112))).Fwithalpha != 0 { v8 = TK_PHOTO_COMPOSITE_OVERLAY } else { v8 = int32(TK_PHOTO_COMPOSITE_SET) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, outY, width, int32(1), v8) == int32(TCL_ERROR) { result = int32(TCL_ERROR) break } outY-- } goto _7 _7: ; y-- } } _tgaClose(tls, bp+44) (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, handle, 0) return result } func _FileWrite8(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, filename, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite10(tls, interp, filename, format, bp, blockPtr) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } func _StringWrite8(tls *libc.TLS, interp uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = result libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp) result = _CommonWrite10(tls, interp, __ccgo_ts+865, format, bp, blockPtr) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp))).FbyteObj) } return result } func _CommonWrite10(tls *libc.TLS, interp uintptr, filename uintptr, format uintptr, handle uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(352) defer tls.Free(352) var alphaOffset, blueOffset, greenOffset, nchan, redOffset, x, y, v1 TInt var pixelPtr, rowPixPtr, v10, v11, v12, v5, v6, v7, v8, v9 uintptr var v2 int32 var _ /* errMsg at bp+72 */ [256]uint8 var _ /* opts at bp+64 */ TFMTOPT11 var _ /* tf at bp+0 */ TTGAFILE _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, greenOffset, nchan, pixelPtr, redOffset, rowPixPtr, x, y, v1, v10, v11, v12, v2, v5, v6, v7, v8, v9 libc.Xmemset(tls, bp, 0, uint32(64)) if _ParseFormatOpts13(tls, interp, format, bp+64, libc.Int32FromInt32(1)<Bottom, Left->Right encoding */ (*(*TTGAFILE)(unsafe.Pointer(bp))).Fth.Fimgtyp = libc.Uint8FromInt32((*(*TFMTOPT11)(unsafe.Pointer(bp + 64))).Fcompression) /* Uncompressed or RLE-compressed */ if !(_writeHeader2(tls, handle, bp) != 0) { return int32(TCL_ERROR) } rowPixPtr = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr + uintptr(*(*int32)(unsafe.Pointer(blockPtr + 20))) y = 0 for { if !(y < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) { break } (*(*TTGAFILE)(unsafe.Pointer(bp))).Fred = (*(*TTGAFILE)(unsafe.Pointer(bp))).FredScan (*(*TTGAFILE)(unsafe.Pointer(bp))).Fgreen = (*(*TTGAFILE)(unsafe.Pointer(bp))).FgreenScan (*(*TTGAFILE)(unsafe.Pointer(bp))).Fblue = (*(*TTGAFILE)(unsafe.Pointer(bp))).FblueScan (*(*TTGAFILE)(unsafe.Pointer(bp))).Falpha = (*(*TTGAFILE)(unsafe.Pointer(bp))).FalphaScan pixelPtr = rowPixPtr x = 0 for { if !(x < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) { break } v6 = bp + 28 v5 = *(*uintptr)(unsafe.Pointer(v6)) *(*uintptr)(unsafe.Pointer(v6))++ *(*TUByte)(unsafe.Pointer(v5)) = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(redOffset))) v8 = bp + 32 v7 = *(*uintptr)(unsafe.Pointer(v8)) *(*uintptr)(unsafe.Pointer(v8))++ *(*TUByte)(unsafe.Pointer(v7)) = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(greenOffset))) v10 = bp + 36 v9 = *(*uintptr)(unsafe.Pointer(v10)) *(*uintptr)(unsafe.Pointer(v10))++ *(*TUByte)(unsafe.Pointer(v9)) = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(blueOffset))) if nchan == int32(4) { /* Have a alpha channel and write it. */ v12 = bp + 40 v11 = *(*uintptr)(unsafe.Pointer(v12)) *(*uintptr)(unsafe.Pointer(v12))++ *(*TUByte)(unsafe.Pointer(v11)) = *(*TUByte)(unsafe.Pointer(pixelPtr + uintptr(alphaOffset))) } pixelPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) goto _4 _4: ; x++ } if !(_tgaWriteScan(tls, interp, handle, bp, y, nchan) != 0) { _tgaClose(tls, bp) return int32(TCL_ERROR) } rowPixPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) goto _3 _3: ; y++ } if (*(*TFMTOPT11)(unsafe.Pointer(bp + 64))).Fverbose != 0 { _printImgInfo12(tls, bp, filename, __ccgo_ts+1132) } _tgaClose(tls, bp) return TCL_OK } const JMP_BUF = "jmp_buf" const JPEGCOLORMODE_RAW1 = 0 const JPEGCOLORMODE_RGB3 = 1 const JPEGTABLESMODE_HUFF1 = 2 const JPEGTABLESMODE_QUANT1 = 1 const JPEGTCLAPI2 = "extern" const JPEG_EOI4 = 217 const JPEG_MARKER_APP0 = 224 const JPEG_MARKER_COM = 254 const JPEG_MARKER_DHT = 196 const JPEG_MARKER_DQT = 219 const JPEG_MARKER_DRI = 221 const JPEG_MARKER_SOF0 = 192 const JPEG_MARKER_SOF1 = 193 const JPEG_MARKER_SOF10 = 202 const JPEG_MARKER_SOF2 = 194 const JPEG_MARKER_SOF9 = 201 const JPEG_MARKER_SOI = 216 const JPEG_MARKER_SOS = 218 const O_RDONLY10 = 00 const PACKAGE_STRING19 = "tkimgtiff 2.0.1" const PACKAGE_TCLNAME16 = "img::tiff" const TIFFTCLAPI1 = "extern" const TIFF_ANY5 = 0 const TIFF_BEENWRITING6 = 0x00040 const TIFF_BIGTIFF6 = 0x80000 const TIFF_BUF4WRITE6 = 0x100000 const TIFF_BUFFERSETUP6 = 0x00010 const TIFF_CODERSETUP6 = 0x00020 const TIFF_DIRTYSTRIP6 = 0x200000 const TIFF_MYBUFFER12 = 0x00200 const TIFF_POSTENCODE8 = 0x01000 const TIFF_UPSAMPLED9 = 16384 const UINT32_MAX11 = "0xffffffffu" const ZLIB_INTERNAL = 1 /* * TIFF Library * * JPEG Compression support per TIFF Technical Note #2 * (*not* per the original TIFF 6.0 spec). * * This file is simply an interface to the libjpeg library written by * the Independent JPEG Group. You need release 5 or later of the IJG * code, which you can find on the Internet at ftp.uu.net:/graphics/jpeg/. * * Contributed by Tom Lane . */ // C documentation // // /* Settings that are independent of libjpeg ABI. Used when reinitializing the */ // /* JPEGState from libjpegs 8 bit to libjpeg 12 bits, which have potentially */ // /* different ABI */ type TJPEGOtherSettings = struct { Fvgetparent TTIFFVGetMethod Fvsetparent TTIFFVSetMethod Fprintdir TTIFFPrintMethod Fdefsparent TTIFFStripMethod Fdeftparent TTIFFTileMethod Fjpegtables uintptr Fjpegtables_length Tuint32_t Fjpegquality int32 Fjpegcolormode int32 Fjpegtablesmode int32 Fycbcrsampling_fetched int32 Fmax_allowed_scan_number int32 Fhas_warned_about_progressive_mode int32 } /* * Inline function declarations: */ /* !END!: Do not edit above this line. */ /* * Redirect the jpeg definitions through the stub definitions of the * binding. A wrapper for a support library using jpeg has to use this * header to ensure usage of the stub macros during the compilation of * the support library itself. In this way we avoid the need for * changing the original sources. * * This header has to be avoided when building the jpeg wrapper itself. */ /* * jpegtclDecls.h -- * * Declarations of functions in the platform independent public JPEGTCL API. * */ /* * Do we want to do special processing suitable for when JSAMPLE is a * 16bit value? */ /* * We are using width_in_blocks which is supposed to be private to * libjpeg. Unfortunately, the libjpeg delivered with Cygwin has * renamed this member to width_in_data_units. Since the header has * also renamed a define, use that unique define name in order to * detect the problem header and adjust to suit. */ /* * On some machines it may be worthwhile to use _setjmp or sigsetjmp * in place of plain setjmp. These macros will make it easier. */ type Tjpeg_destination_mgr1 = struct { Fnext_output_byte uintptr Ffree_in_buffer Tsize_t Finit_destination uintptr Fempty_output_buffer uintptr Fterm_destination uintptr } type Tjpeg_source_mgr1 = struct { Fnext_input_byte uintptr Fbytes_in_buffer Tsize_t Finit_source uintptr Ffill_input_buffer uintptr Fskip_input_data uintptr Fresync_to_restart uintptr Fterm_source uintptr } type Tjpeg_error_mgr1 = struct { Ferror_exit uintptr Femit_message uintptr Foutput_message uintptr Fformat_message uintptr Freset_error_mgr uintptr Fmsg_code int32 Fmsg_parm struct { Fs [0][80]uint8 Fi [8]int32 F__ccgo_pad2 [48]byte } Ftrace_level int32 Fnum_warnings int32 Fjpeg_message_table uintptr Flast_jpeg_message int32 Faddon_message_table uintptr Ffirst_addon_message int32 Flast_addon_message int32 } // C documentation // // /* // * State block for each open TIFF file using // * libjpeg to do JPEG compression/decompression. // * // * libjpeg's visible state is either a jpeg_compress_struct // * or jpeg_decompress_struct depending on which way we // * are going. comm can be used to refer to the fields // * which are common to both. // * // * NB: cinfo is required to be the first member of JPEGState, // * so we can safely cast JPEGState* -> jpeg_xxx_struct* // * and vice versa! // */ type TJPEGState = struct { F__ccgo_align [0]uint32 Fcinfo struct { F__ccgo_align [0]uint32 Fd [0]Tjpeg_decompress_struct Fcomm [0]Tjpeg_common_struct Fc Tjpeg_compress_struct F__ccgo_pad3 [48]byte } Fcinfo_initialized int32 Ferr Tjpeg_error_mgr1 Fexit_jmpbuf Tjmp_buf Fprogress Tjpeg_progress_mgr Fdest Tjpeg_destination_mgr1 Fsrc Tjpeg_source_mgr1 Ftif uintptr Fphotometric Tuint16_t Fh_sampling Tuint16_t Fv_sampling Tuint16_t Fbytesperline Ttmsize_t Fds_buffer [10]TJSAMPARRAY Fscancount int32 Fsamplesperclump int32 FotherSettings TJPEGOtherSettings } var _jpegFields = [4]TTIFFField{ 0: { Ffield_tag: uint32(TIFFTAG_JPEGTABLES), Ffield_readcount: int16(-int32(3)), Ffield_writecount: int16(-int32(3)), Ffield_type: int32(TIFF_UNDEFINED), Fset_field_type: int32(TIFF_SETGET_C32_UINT8), Fget_field_type: int32(TIFF_SETGET_C32_UINT8), Ffield_bit: libc.Uint16FromInt32(libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(0)), Ffield_passcount: uint8(TRUE), Ffield_name: __ccgo_ts + 52808, }, 1: { Ffield_tag: uint32(TIFFTAG_JPEGQUALITY), Fset_field_type: int32(TIFF_SETGET_INT), Ffield_oktochange: uint8(TRUE), Ffield_name: __ccgo_ts + 9405, }, 2: { Ffield_tag: uint32(TIFFTAG_JPEGCOLORMODE), Fset_field_type: int32(TIFF_SETGET_INT), Ffield_name: __ccgo_ts + 9405, }, 3: { Ffield_tag: uint32(TIFFTAG_JPEGTABLESMODE), Fset_field_type: int32(TIFF_SETGET_INT), Ffield_name: __ccgo_ts + 9405, }, } /* * libjpeg interface layer. * * We use setjmp/longjmp to return control to libtiff * when a fatal error is encountered within the JPEG * library. We also direct libjpeg error and warning * messages through the appropriate libtiff handlers. */ // C documentation // // /* // * Error handling routines (these replace corresponding // * IJG routines from jerror.c). These are used for both // * compression and decompression. // */ func _TIFFjpeg_error_exit(tls *libc.TLS, cinfo Tj_common_ptr) { bp := tls.Alloc(224) defer tls.Free(224) var sp uintptr var _ /* buffer at bp+0 */ [200]uint8 _ = sp sp = cinfo (*(*func(*libc.TLS, Tj_common_ptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fformat_message})))(tls, cinfo, bp) (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Ftif)).Ftif_clientdata, __ccgo_ts+52819, __ccgo_ts+39133, libc.VaList(bp+208, bp)) /* display the error message */ (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_abortPtr})))(tls, cinfo) /* clean up libjpeg state */ tls.Longjmp(sp+624, libc.Int32FromInt32(1)) /* return to libtiff caller */ } // C documentation // // /* // * This routine is invoked only for warning messages, // * since error_exit does its own thing and trace_level // * is never set > 0. // */ func _TIFFjpeg_output_message(tls *libc.TLS, cinfo Tj_common_ptr) { bp := tls.Alloc(224) defer tls.Free(224) var _ /* buffer at bp+0 */ [200]uint8 (*(*func(*libc.TLS, Tj_common_ptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Ferr)).Fformat_message})))(tls, cinfo, bp) (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(cinfo)).Ftif)).Ftif_clientdata, __ccgo_ts+52819, __ccgo_ts+39133, libc.VaList(bp+208, bp)) } // C documentation // // /* Avoid the risk of denial-of-service on crafted JPEGs with an insane */ // /* number of scans. */ // /* See // * http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf // */ func _TIFFjpeg_progress_monitor(tls *libc.TLS, cinfo Tj_common_ptr) { bp := tls.Alloc(32) defer tls.Free(32) var scan_no int32 var sp uintptr _, _ = scan_no, sp sp = cinfo /* NB: cinfo assumed first */ if (*Tjpeg_common_struct)(unsafe.Pointer(cinfo)).Fis_decompressor != 0 { scan_no = (*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Finput_scan_number if scan_no >= (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fmax_allowed_scan_number { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(cinfo)).Ftif)).Ftif_clientdata, __ccgo_ts+52827, __ccgo_ts+52853, libc.VaList(bp+8, scan_no, (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fmax_allowed_scan_number)) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_abortPtr})))(tls, cinfo) /* clean up libjpeg state */ tls.Longjmp(sp+624, libc.Int32FromInt32(1)) /* return to libtiff caller */ } } } /* * Interface routines. This layer of routines exists * primarily to limit side-effects from using setjmp. * Also, normal/error returns are converted into return * values per libtiff practice. */ func _TIFFjpeg_create_compress(tls *libc.TLS, sp uintptr) (r int32) { var v1 int32 _ = v1 /* initialize JPEG error handling */ (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Ferr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_errorPtr})))(tls, sp+492) (*TJPEGState)(unsafe.Pointer(sp)).Ferr.Ferror_exit = __ccgo_fp(_TIFFjpeg_error_exit) (*TJPEGState)(unsafe.Pointer(sp)).Ferr.Foutput_message = __ccgo_fp(_TIFFjpeg_output_message) /* set client_data to avoid UMR warning from tools like Purify */ (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fclient_data = libc.UintptrFromInt32(0) if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_compress_ptr, int32, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_CreateCompressPtr})))(tls, sp, int32(JPEG_LIB_VERSION), libc.Uint32FromInt64(440)) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_create_decompress(tls *libc.TLS, sp uintptr) (r int32) { var v1 int32 _ = v1 /* initialize JPEG error handling */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Ferr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_errorPtr})))(tls, sp+492) (*TJPEGState)(unsafe.Pointer(sp)).Ferr.Ferror_exit = __ccgo_fp(_TIFFjpeg_error_exit) (*TJPEGState)(unsafe.Pointer(sp)).Ferr.Foutput_message = __ccgo_fp(_TIFFjpeg_output_message) /* set client_data to avoid UMR warning from tools like Purify */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fclient_data = libc.UintptrFromInt32(0) if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_decompress_ptr, int32, Tsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_CreateDecompressPtr})))(tls, sp, int32(JPEG_LIB_VERSION), libc.Uint32FromInt64(488)) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_set_defaults(tls *libc.TLS, sp uintptr) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_set_defaultsPtr})))(tls, sp) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_set_colorspace(tls *libc.TLS, sp uintptr, colorspace TJ_COLOR_SPACE) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_compress_ptr, TJ_COLOR_SPACE))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_set_colorspacePtr})))(tls, sp, colorspace) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_set_quality(tls *libc.TLS, sp uintptr, quality int32, force_baseline Tboolean) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_compress_ptr, int32, Tboolean))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_set_qualityPtr})))(tls, sp, quality, force_baseline) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_suppress_tables(tls *libc.TLS, sp uintptr, suppress Tboolean) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_compress_ptr, Tboolean))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_suppress_tablesPtr})))(tls, sp, suppress) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_start_compress(tls *libc.TLS, sp uintptr, write_all_tables Tboolean) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_compress_ptr, Tboolean))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_start_compressPtr})))(tls, sp, write_all_tables) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_write_scanlines(tls *libc.TLS, sp uintptr, scanlines TJSAMPARRAY, num_lines int32) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = -int32(1) } else { v1 = libc.Int32FromUint32((*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPARRAY, TJDIMENSION) TJDIMENSION)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_write_scanlinesPtr})))(tls, sp, scanlines, libc.Uint32FromInt32(num_lines))) } return v1 } func _TIFFjpeg_write_raw_data(tls *libc.TLS, sp uintptr, data TJSAMPIMAGE, num_lines int32) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = -int32(1) } else { v1 = libc.Int32FromUint32((*(*func(*libc.TLS, Tj_compress_ptr, TJSAMPIMAGE, TJDIMENSION) TJDIMENSION)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_write_raw_dataPtr})))(tls, sp, data, libc.Uint32FromInt32(num_lines))) } return v1 } func _TIFFjpeg_finish_compress(tls *libc.TLS, sp uintptr) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_finish_compressPtr})))(tls, sp) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_write_tables(tls *libc.TLS, sp uintptr) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_compress_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_write_tablesPtr})))(tls, sp) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_read_header(tls *libc.TLS, sp uintptr, require_image Tboolean) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = -int32(1) } else { v1 = (*(*func(*libc.TLS, Tj_decompress_ptr, Tboolean) int32)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_read_headerPtr})))(tls, sp, require_image) } return v1 } func _TIFFjpeg_has_multiple_scans(tls *libc.TLS, sp uintptr) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { v1 = (*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_has_multiple_scansPtr})))(tls, sp) } return v1 } func _TIFFjpeg_start_decompress(tls *libc.TLS, sp uintptr) (r int32) { var sz_max_allowed_scan_number uintptr var v1 int32 _, _ = sz_max_allowed_scan_number, v1 /* progress monitor */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fprogress = sp + 1016 (*TJPEGState)(unsafe.Pointer(sp)).Fprogress.Fprogress_monitor = __ccgo_fp(_TIFFjpeg_progress_monitor) (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fmax_allowed_scan_number = int32(100) sz_max_allowed_scan_number = libc.Xgetenv(tls, __ccgo_ts+52992) if sz_max_allowed_scan_number != 0 { (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fmax_allowed_scan_number = libc.Xatoi(tls, sz_max_allowed_scan_number) } if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_start_decompressPtr})))(tls, sp) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_read_scanlines(tls *libc.TLS, sp uintptr, scanlines TJSAMPARRAY, max_lines int32) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = -int32(1) } else { v1 = libc.Int32FromUint32((*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPARRAY, TJDIMENSION) TJDIMENSION)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_read_scanlinesPtr})))(tls, sp, scanlines, libc.Uint32FromInt32(max_lines))) } return v1 } func _TIFFjpeg_read_raw_data(tls *libc.TLS, sp uintptr, data TJSAMPIMAGE, max_lines int32) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = -int32(1) } else { v1 = libc.Int32FromUint32((*(*func(*libc.TLS, Tj_decompress_ptr, TJSAMPIMAGE, TJDIMENSION) TJDIMENSION)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_read_raw_dataPtr})))(tls, sp, data, libc.Uint32FromInt32(max_lines))) } return v1 } func _TIFFjpeg_finish_decompress(tls *libc.TLS, sp uintptr) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = -int32(1) } else { v1 = (*(*func(*libc.TLS, Tj_decompress_ptr) Tboolean)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_finish_decompressPtr})))(tls, sp) } return v1 } func _TIFFjpeg_abort(tls *libc.TLS, sp uintptr) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_abortPtr})))(tls, sp) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_destroy(tls *libc.TLS, sp uintptr) (r int32) { var v1 int32 _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = 0 } else { (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_destroyPtr})))(tls, sp) v1 = libc.Int32FromInt32(1) } return v1 } func _TIFFjpeg_alloc_sarray(tls *libc.TLS, sp uintptr, pool_id int32, samplesperrow TJDIMENSION, numrows TJDIMENSION) (r TJSAMPARRAY) { var v1 TJSAMPARRAY _ = v1 if libc.Xsetjmp(tls, sp+624) != 0 { v1 = libc.UintptrFromInt32(0) } else { v1 = (*(*func(*libc.TLS, Tj_common_ptr, int32, TJDIMENSION, TJDIMENSION) TJSAMPARRAY)(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_memory_mgr)(unsafe.Pointer((*(*Tjpeg_common_struct)(unsafe.Pointer(&(*TJPEGState)(unsafe.Pointer(sp)).Fcinfo))).Fmem)).Falloc_sarray})))(tls, sp, pool_id, samplesperrow, numrows) } return v1 } /* * JPEG library destination data manager. * These routines direct compressed data from libjpeg into the * libtiff output buffer. */ func _std_init_destination(tls *libc.TLS, cinfo Tj_compress_ptr) { var sp, tif uintptr _, _ = sp, tif sp = cinfo tif = (*TJPEGState)(unsafe.Pointer(sp)).Ftif (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Fnext_output_byte = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Ffree_in_buffer = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) } func _std_empty_output_buffer(tls *libc.TLS, cinfo Tj_compress_ptr) (r Tboolean) { var sp, tif uintptr _, _ = sp, tif sp = cinfo tif = (*TJPEGState)(unsafe.Pointer(sp)).Ftif /* the entire buffer has been filled */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFFlushData1})))(tls, tif) != 0) { return FALSE } (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Fnext_output_byte = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Ffree_in_buffer = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) return libc.Int32FromInt32(TRUE) } func _std_term_destination(tls *libc.TLS, cinfo Tj_compress_ptr) { var sp, tif uintptr _, _ = sp, tif sp = cinfo tif = (*TJPEGState)(unsafe.Pointer(sp)).Ftif (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Fnext_output_byte (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize - libc.Int32FromUint32((*TJPEGState)(unsafe.Pointer(sp)).Fdest.Ffree_in_buffer) /* NB: libtiff does the final buffer flush */ } func _TIFFjpeg_data_dest(tls *libc.TLS, sp uintptr, tif uintptr) { _ = tif (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fdest = sp + 1036 (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Finit_destination = __ccgo_fp(_std_init_destination) (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Fempty_output_buffer = __ccgo_fp(_std_empty_output_buffer) (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Fterm_destination = __ccgo_fp(_std_term_destination) } /* * Alternate destination manager for outputting to JPEGTables field. */ func _tables_init_destination(tls *libc.TLS, cinfo Tj_compress_ptr) { var sp uintptr _ = sp sp = cinfo /* while building, otherSettings.jpegtables_length is allocated buffer size */ (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Fnext_output_byte = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Ffree_in_buffer = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length } func _tables_empty_output_buffer(tls *libc.TLS, cinfo Tj_compress_ptr) (r Tboolean) { var newbuf, sp uintptr _, _ = newbuf, sp sp = cinfo /* the entire buffer has been filled; enlarge it by 1000 bytes */ newbuf = (*(*func(*libc.TLS, Ttdata_t, Ttsize_t) Ttdata_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFreallocPtr})))(tls, (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables, libc.Int32FromUint32((*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length+libc.Uint32FromInt32(1000))) if newbuf == libc.UintptrFromInt32(0) { (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JERR_OUT_OF_MEMORY) *(*int32)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr + 24)) = int32(100) (*(*func(*libc.TLS, Tj_common_ptr))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_compress_struct)(unsafe.Pointer(cinfo)).Ferr)).Ferror_exit})))(tls, cinfo) } (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Fnext_output_byte = newbuf + uintptr((*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length) (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Ffree_in_buffer = libc.Uint32FromInt32(1000) (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables = newbuf (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length += uint32(1000) return libc.Int32FromInt32(TRUE) } func _tables_term_destination(tls *libc.TLS, cinfo Tj_compress_ptr) { var sp uintptr _ = sp sp = cinfo /* set tables length to number of bytes actually emitted */ (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length -= (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Ffree_in_buffer } func _TIFFjpeg_tables_dest(tls *libc.TLS, sp uintptr, tif uintptr) (r int32) { _ = tif /* * Allocate a working buffer for building tables. * Initial size is 1000 bytes, which is usually adequate. */ if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables != 0 { XTkimgTIFFfree(tls, (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables) } (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length = uint32(1000) (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables = XTkimgTIFFmalloc(tls, libc.Int32FromUint32((*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length)) if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables == libc.UintptrFromInt32(0) { (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length = uint32(0) (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Ftif)).Ftif_clientdata, __ccgo_ts+53029, __ccgo_ts+53050, 0) return 0 } (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fdest = sp + 1036 (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Finit_destination = __ccgo_fp(_tables_init_destination) (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Fempty_output_buffer = __ccgo_fp(_tables_empty_output_buffer) (*TJPEGState)(unsafe.Pointer(sp)).Fdest.Fterm_destination = __ccgo_fp(_tables_term_destination) return int32(1) } /* * JPEG library source data manager. * These routines supply compressed data to libjpeg. */ func _std_init_source(tls *libc.TLS, cinfo Tj_decompress_ptr) { var sp, tif uintptr _, _ = sp, tif sp = cinfo tif = (*TJPEGState)(unsafe.Pointer(sp)).Ftif (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fnext_input_byte = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fbytes_in_buffer = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) } func _std_fill_input_buffer(tls *libc.TLS, cinfo Tj_decompress_ptr) (r Tboolean) { var sp uintptr _ = sp sp = cinfo /* * Normally the whole strip/tile is read and so we don't need to do * a fill. In the case of CHUNKY_STRIP_READ_SUPPORT we might not have * all the data, but the rawdata is refreshed between scanlines and * we push this into the io machinery in JPEGDecode(). * http://trac.osgeo.org/gdal/ticket/3894 */ (*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Fmsg_code = int32(JWRN_JPEG_EOF) (*(*func(*libc.TLS, Tj_common_ptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*Tjpeg_error_mgr)(unsafe.Pointer((*Tjpeg_decompress_struct)(unsafe.Pointer(cinfo)).Ferr)).Femit_message})))(tls, cinfo, -int32(1)) /* insert a fake EOI marker */ (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fnext_input_byte = uintptr(unsafe.Pointer(&_dummy_EOI)) (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fbytes_in_buffer = uint32(2) return libc.Int32FromInt32(TRUE) } var _dummy_EOI = [2]TJOCTET{ 0: uint8(0xFF), 1: uint8(JPEG_EOI4), } func _std_skip_input_data(tls *libc.TLS, cinfo Tj_decompress_ptr, num_bytes int32) { var sp uintptr _ = sp sp = cinfo if num_bytes > 0 { if libc.Uint32FromInt32(num_bytes) > (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fbytes_in_buffer { /* oops, buffer overrun */ _std_fill_input_buffer(tls, cinfo) } else { (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fnext_input_byte += uintptr(libc.Uint32FromInt32(num_bytes)) (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fbytes_in_buffer -= libc.Uint32FromInt32(num_bytes) } } } func _std_term_source(tls *libc.TLS, cinfo Tj_decompress_ptr) { /* No work necessary here */ _ = cinfo } func _TIFFjpeg_data_src(tls *libc.TLS, sp uintptr) { (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fsrc = sp + 1056 (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Finit_source = __ccgo_fp(_std_init_source) (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Ffill_input_buffer = __ccgo_fp(_std_fill_input_buffer) (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fskip_input_data = __ccgo_fp(_std_skip_input_data) (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fresync_to_restart = (*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_resync_to_restartPtr (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fterm_source = __ccgo_fp(_std_term_source) (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fbytes_in_buffer = uint32(0) /* for safety */ (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fnext_input_byte = libc.UintptrFromInt32(0) } /* * Alternate source manager for reading from JPEGTables. * We can share all the code except for the init routine. */ func _tables_init_source(tls *libc.TLS, cinfo Tj_decompress_ptr) { var sp uintptr _ = sp sp = cinfo (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fnext_input_byte = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fbytes_in_buffer = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length } func _TIFFjpeg_tables_src(tls *libc.TLS, sp uintptr) { _TIFFjpeg_data_src(tls, sp) (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Finit_source = __ccgo_fp(_tables_init_source) } // C documentation // // /* // * Allocate downsampled-data buffers needed for downsampled I/O. // * We use values computed in jpeg_start_compress or jpeg_start_decompress. // * We use libjpeg's allocator so that buffers will be released automatically // * when done with strip/tile. // * This is also a handy place to compute samplesperclump, bytesperline. // */ func _alloc_downsampled_buffers(tls *libc.TLS, tif uintptr, comp_info uintptr, num_components int32) (r int32) { var buf TJSAMPARRAY var ci, samples_per_clump int32 var compptr, sp uintptr _, _, _, _, _ = buf, ci, compptr, samples_per_clump, sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data samples_per_clump = 0 ci = 0 compptr = comp_info for { if !(ci < num_components) { break } samples_per_clump += (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor * (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor buf = _TIFFjpeg_alloc_sarray(tls, sp, int32(JPOOL_IMAGE), (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks*uint32(DCTSIZE), libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor*libc.Int32FromInt32(DCTSIZE))) if buf == libc.UintptrFromInt32(0) { return 0 } *(*TJSAMPARRAY)(unsafe.Pointer(sp + 1100 + uintptr(ci)*4)) = buf goto _1 _1: ; ci++ compptr += 88 } (*TJPEGState)(unsafe.Pointer(sp)).Fsamplesperclump = samples_per_clump return int32(1) } /* * JPEG Decoding. */ type TJPEGFixupTagsSubsamplingData = struct { F__ccgo_align [0]uint32 Ftif uintptr Fbuffer uintptr Fbuffersize Tuint32_t Fbuffercurrentbyte uintptr Fbufferbytesleft Tuint32_t F__ccgo_align5 [4]byte Ffileoffset Tuint64_t Ffilebytesleft Tuint64_t Ffilepositioned Tuint8_t F__ccgo_pad8 [7]byte } func _JPEGFixupTags(tls *libc.TLS, tif uintptr) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data if libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_photometric) == int32(PHOTOMETRIC_YCBCR) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) && libc.Int32FromUint16((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_samplesperpixel) == int32(3) && !((*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fycbcrsampling_fetched != 0) { _JPEGFixupTagsSubsampling(tls, tif) } return int32(1) } func _JPEGFixupTagsSubsampling(tls *libc.TLS, tif uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var fileoffset Tuint64_t var _ /* m at bp+0 */ TJPEGFixupTagsSubsamplingData _ = fileoffset fileoffset = (*(*func(*libc.TLS, uintptr, Tuint32_t) Tuint64_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFGetStrileOffset})))(tls, tif, uint32(0)) if fileoffset == uint64(0) { /* Do not even try to check if the first strip/tile does not yet exist, as occurs when GDAL has created a new NULL file for instance. */ return } (*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Ftif = tif (*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Fbuffersize = uint32(2048) (*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Fbuffer = XTkimgTIFFmalloc(tls, libc.Int32FromUint32((*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Fbuffersize)) if (*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Fbuffer == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module113)), __ccgo_ts+53074, 0) return } (*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Fbuffercurrentbyte = libc.UintptrFromInt32(0) (*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Fbufferbytesleft = uint32(0) (*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Ffileoffset = fileoffset (*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Ffilepositioned = uint8(0) (*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Ffilebytesleft = (*(*func(*libc.TLS, uintptr, Tuint32_t) Tuint64_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFGetStrileByteCount})))(tls, tif, uint32(0)) if !(_JPEGFixupTagsSubsamplingSec(tls, bp) != 0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module113)), __ccgo_ts+53167, 0) } XTkimgTIFFfree(tls, (*(*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(bp))).Fbuffer) } /* * Some JPEG-in-TIFF produces do not emit the YCBCRSUBSAMPLING values in * the TIFF tags, but still use non-default (2,2) values within the jpeg * data stream itself. In order for TIFF applications to work properly * - for instance to get the strip buffer size right - it is imperative * that the subsampling be available before we start reading the image * data normally. This function will attempt to analyze the first strip in * order to get the sampling values from the jpeg data stream. * * Note that JPEGPreDeocode() will produce a fairly loud warning when the * discovered sampling does not match the default sampling (2,2) or whatever * was actually in the tiff tags. * * See the bug in bugzilla for details: * * http://bugzilla.remotesensing.org/show_bug.cgi?id=168 * * Frank Warmerdam, July 2002 * Joris Van Damme, May 2007 */ var _module113 = [25]uint8{'J', 'P', 'E', 'G', 'F', 'i', 'x', 'u', 'p', 'T', 'a', 'g', 's', 'S', 'u', 'b', 's', 'a', 'm', 'p', 'l', 'i', 'n', 'g'} func _JPEGFixupTagsSubsamplingSec(tls *libc.TLS, data uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var o Tuint16_t var ph, pv Tuint8_t var _ /* m at bp+0 */ Tuint8_t var _ /* n at bp+2 */ Tuint16_t var _ /* n at bp+4 */ Tuint16_t var _ /* p at bp+6 */ Tuint8_t _, _, _ = o, ph, pv for int32(1) != 0 { for int32(1) != 0 { if !(_JPEGFixupTagsSubsamplingReadByte(tls, data, bp) != 0) { return 0 } if libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp))) == int32(255) { break } } for int32(1) != 0 { if !(_JPEGFixupTagsSubsamplingReadByte(tls, data, bp) != 0) { return 0 } if libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp))) != int32(255) { break } } switch libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp))) { case int32(JPEG_MARKER_SOI): /* this type of marker has no data and should be skipped */ case int32(JPEG_MARKER_COM): fallthrough case int32(JPEG_MARKER_APP0): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(1): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(2): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(3): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(4): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(5): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(6): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(7): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(8): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(9): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(10): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(11): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(12): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(13): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(14): fallthrough case libc.Int32FromInt32(JPEG_MARKER_APP0) + libc.Int32FromInt32(15): fallthrough case int32(JPEG_MARKER_DQT): fallthrough case int32(JPEG_MARKER_SOS): fallthrough case int32(JPEG_MARKER_DHT): fallthrough case int32(JPEG_MARKER_DRI): /* this type of marker has data, but it has no use to us and should be * skipped */ if !(_JPEGFixupTagsSubsamplingReadWord(tls, data, bp+2) != 0) { return 0 } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) < int32(2) { return 0 } *(*Tuint16_t)(unsafe.Pointer(bp + 2)) = Tuint16_t(int32(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) - libc.Int32FromInt32(2)) if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 2))) > 0 { _JPEGFixupTagsSubsamplingSkip(tls, data, *(*Tuint16_t)(unsafe.Pointer(bp + 2))) } case int32(JPEG_MARKER_SOF0): /* Baseline sequential Huffman */ fallthrough case int32(JPEG_MARKER_SOF1): /* Extended sequential Huffman */ fallthrough case int32(JPEG_MARKER_SOF2): /* Progressive Huffman: normally not allowed by TechNote, but that doesn't hurt supporting it */ fallthrough case int32(JPEG_MARKER_SOF9): /* Extended sequential arithmetic */ fallthrough case int32(JPEG_MARKER_SOF10): /* Progressive arithmetic: normally not allowed by TechNote, but that doesn't hurt supporting it */ /* this marker contains the subsampling factors we're scanning for */ if !(_JPEGFixupTagsSubsamplingReadWord(tls, data, bp+4) != 0) { return 0 } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 4))) != int32(8)+libc.Int32FromUint16((*TTIFF)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif)).Ftif_dir.Ftd_samplesperpixel)*int32(3) { return 0 } _JPEGFixupTagsSubsamplingSkip(tls, data, uint16(7)) if !(_JPEGFixupTagsSubsamplingReadByte(tls, data, bp+6) != 0) { return 0 } ph = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp + 6))) >> libc.Int32FromInt32(4)) pv = libc.Uint8FromInt32(libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp + 6))) & libc.Int32FromInt32(15)) _JPEGFixupTagsSubsamplingSkip(tls, data, uint16(1)) o = uint16(1) for { if !(libc.Int32FromUint16(o) < libc.Int32FromUint16((*TTIFF)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif)).Ftif_dir.Ftd_samplesperpixel)) { break } _JPEGFixupTagsSubsamplingSkip(tls, data, uint16(1)) if !(_JPEGFixupTagsSubsamplingReadByte(tls, data, bp+6) != 0) { return 0 } if libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp + 6))) != int32(0x11) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module114)), __ccgo_ts+53291, 0) return int32(1) } _JPEGFixupTagsSubsamplingSkip(tls, data, uint16(1)) goto _1 _1: ; o++ } if libc.Int32FromUint8(ph) != int32(1) && libc.Int32FromUint8(ph) != int32(2) && libc.Int32FromUint8(ph) != int32(4) || libc.Int32FromUint8(pv) != int32(1) && libc.Int32FromUint8(pv) != int32(2) && libc.Int32FromUint8(pv) != int32(4) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module114)), __ccgo_ts+53291, 0) return int32(1) } if libc.Int32FromUint8(ph) != libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif + 56 + 216))) || libc.Int32FromUint8(pv) != libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif + 56 + 216 + 1*2))) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module114)), __ccgo_ts+53413, libc.VaList(bp+16, libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif + 56 + 216))), libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif + 56 + 216 + 1*2))), libc.Int32FromUint8(ph), libc.Int32FromUint8(pv))) *(*Tuint16_t)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif + 56 + 216)) = uint16(ph) *(*Tuint16_t)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif + 56 + 216 + 1*2)) = uint16(pv) } return int32(1) default: return 0 } } return r } var _module114 = [28]uint8{'J', 'P', 'E', 'G', 'F', 'i', 'x', 'u', 'p', 'T', 'a', 'g', 's', 'S', 'u', 'b', 's', 'a', 'm', 'p', 'l', 'i', 'n', 'g', 'S', 'e', 'c'} func _JPEGFixupTagsSubsamplingReadByte(tls *libc.TLS, data uintptr, result uintptr) (r int32) { var m Tuint32_t _ = m if (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Fbufferbytesleft == uint32(0) { if (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ffilebytesleft == uint64(0) { return 0 } if !((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ffilepositioned != 0) { if (*(*func(*libc.TLS, Tthandle_t, Ttoff_t, int32) Ttoff_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif)).Ftif_seekproc})))(tls, (*TTIFF)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif)).Ftif_clientdata, (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ffileoffset, 0) == libc.Uint64FromInt32(-libc.Int32FromInt32(1)) { return 0 } (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ffilepositioned = uint8(1) } m = (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Fbuffersize if uint64(m) > (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ffilebytesleft { m = uint32((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ffilebytesleft) } if (*(*func(*libc.TLS, Tthandle_t, uintptr, Ttmsize_t) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif)).Ftif_readproc})))(tls, (*TTIFF)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Ftif)).Ftif_clientdata, (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Fbuffer, libc.Int32FromUint32(m)) != libc.Int32FromUint32(m) { return 0 } (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Fbuffercurrentbyte = (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Fbuffer (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Fbufferbytesleft = m *(*Tuint64_t)(unsafe.Pointer(data + 24)) += uint64(m) *(*Tuint64_t)(unsafe.Pointer(data + 32)) -= uint64(m) } *(*Tuint8_t)(unsafe.Pointer(result)) = *(*Tuint8_t)(unsafe.Pointer((*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Fbuffercurrentbyte)) (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Fbuffercurrentbyte++ (*TJPEGFixupTagsSubsamplingData)(unsafe.Pointer(data)).Fbufferbytesleft-- return int32(1) } func _JPEGFixupTagsSubsamplingReadWord(tls *libc.TLS, data uintptr, result uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* ma at bp+0 */ Tuint8_t var _ /* mb at bp+1 */ Tuint8_t if !(_JPEGFixupTagsSubsamplingReadByte(tls, data, bp) != 0) { return 0 } if !(_JPEGFixupTagsSubsamplingReadByte(tls, data, bp+1) != 0) { return 0 } *(*Tuint16_t)(unsafe.Pointer(result)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*Tuint8_t)(unsafe.Pointer(bp)))<tif_dir.td_bitspersample, tif->tif_rawdata and */ // /* tif->tif_rawcc members. */ // /* Can be called independently of the usual setup/predecode/decode states */ func XTIFFJPEGIsFullStripRequired(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(1200) defer tls.Free(1200) var ret int32 var _ /* state at bp+0 */ TJPEGState _ = ret libc.Xmemset(tls, bp, 0, uint32(1200)) (*(*TJPEGState)(unsafe.Pointer(bp))).Ftif = tif _TIFFjpeg_create_decompress(tls, bp) _TIFFjpeg_data_src(tls, bp) if _TIFFjpeg_read_header(tls, bp, int32(TRUE)) != int32(JPEG_HEADER_OK) { _TIFFjpeg_destroy(tls, bp) return 0 } ret = _TIFFjpeg_has_multiple_scans(tls, bp) _TIFFjpeg_destroy(tls, bp) return ret } // C documentation // // /* // * Set up for decoding a strip or tile. // */ // /*ARGSUSED*/ func _JPEGPreDecode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var ci, downsampled_output, v3 int32 var compptr, sp, td uintptr var nRequiredMemory Ttoff_t var segment_height, segment_width Tuint32_t var v1, v2 uint32 _, _, _, _, _, _, _, _, _, _, _ = ci, compptr, downsampled_output, nRequiredMemory, segment_height, segment_width, sp, td, v1, v2, v3 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 if (*(*Tjpeg_common_struct)(unsafe.Pointer(&(*TJPEGState)(unsafe.Pointer(sp)).Fcinfo))).Fis_decompressor == 0 { (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode})))(tls, tif) } /* * Reset decoder state from any previous strip/tile, * in case application didn't read the whole strip. */ if !(_TIFFjpeg_abort(tls, sp) != 0) { return 0 } /* * Read the header for this strip/tile. */ if _TIFFjpeg_read_header(tls, sp, int32(TRUE)) != int32(JPEG_HEADER_OK) { return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fnext_input_byte (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = libc.Int32FromUint32((*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fbytes_in_buffer) /* * Check image parameters and set decompression parameters. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { segment_width = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth segment_height = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline = (*(*func(*libc.TLS, uintptr) Ttsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFTileRowSize})))(tls, tif) } else { segment_width = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth segment_height = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength - (*TTIFF)(unsafe.Pointer(tif)).Ftif_row if segment_height > (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip { segment_height = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip } (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline = (*(*func(*libc.TLS, uintptr) Ttsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFScanlineSize})))(tls, tif) } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) && libc.Int32FromUint16(s) > 0 { /* * For PC 2, scale down the expected strip/tile size * to match a downsampled component */ if segment_width < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling)-libc.Int32FromInt32(1)) { v1 = (segment_width + (uint32((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling) - uint32(1))) / uint32((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling) } else { v1 = 0 } segment_width = v1 if segment_height < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling)-libc.Int32FromInt32(1)) { v2 = (segment_height + (uint32((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) - uint32(1))) / uint32((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) } else { v2 = 0 } segment_height = v2 } if (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_width < segment_width || (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_height < segment_height { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module115)), __ccgo_ts+53570, libc.VaList(bp+8, segment_width, segment_height, (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_width, (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_height)) } if (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_width == segment_width && (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_height > segment_height && (*TTIFF)(unsafe.Pointer(tif)).Ftif_row+segment_height == (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00400) != libc.Uint32FromInt32(0)) { /* Some files have a last strip, that should be truncated, */ /* but their JPEG codestream has still the maximum strip */ /* height. Warn about this as this is non compliant, but */ /* we can safely recover from that. */ (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module115)), __ccgo_ts+53627, libc.VaList(bp+8, segment_width, segment_height, (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_width, (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_height)) } else { if (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_width > segment_width || (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_height > segment_height { /* * This case could be dangerous, if the strip or tile size has * been reported as less than the amount of data jpeg will * return, some potential security issues arise. Catch this * case and error out. */ (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module115)), __ccgo_ts+53698, libc.VaList(bp+8, segment_width, segment_height, (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_width, (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_height)) return 0 } } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { v3 = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { v3 = int32(1) } if (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fnum_components != v3 { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module115)), __ccgo_ts+53774, 0) return 0 } if (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fdata_precision != libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module115)), __ccgo_ts+53804, 0) return 0 } if (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fprogressive_mode != 0 && !((*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fhas_warned_about_progressive_mode != 0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module115)), __ccgo_ts+53833, 0) (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fhas_warned_about_progressive_mode = int32(TRUE) } /* In some cases, libjpeg needs to allocate a lot of memory */ /* http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf */ if _TIFFjpeg_has_multiple_scans(tls, sp) != 0 { /* In this case libjpeg will need to allocate memory or backing */ /* store for all coefficients */ /* See call to jinit_d_coef_controller() from master_selection() */ /* in libjpeg */ /* 1 MB for regular libjpeg usage */ nRequiredMemory = libc.Uint64FromInt32(libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024)) ci = 0 for { if !(ci < (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fnum_components) { break } compptr = (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info + uintptr(ci)*88 if (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor > 0 && (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor > 0 { nRequiredMemory += uint64(((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks+libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor)-libc.Uint32FromInt32(1))/libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor)) * uint64(((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fheight_in_blocks+libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor)-libc.Uint32FromInt32(1))/libc.Uint32FromInt32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor)) * uint64(128) } goto _4 _4: ; ci++ } if (*Tjpeg_memory_mgr)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fmem)).Fmax_memory_to_use > 0 && nRequiredMemory > libc.Uint64FromInt32((*Tjpeg_memory_mgr)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fmem)).Fmax_memory_to_use) && libc.Xgetenv(tls, __ccgo_ts+54029) == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module115)), __ccgo_ts+54067, libc.VaList(bp+8, nRequiredMemory, (*Tjpeg_memory_mgr)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fmem)).Fmax_memory_to_use, (nRequiredMemory+uint64(1000000)-uint64(1))/uint64(1000000))) return 0 } } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { /* Component 0 should have expected sampling factors */ if (*(*Tjpeg_component_info)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info))).Fh_samp_factor != libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling) || (*(*Tjpeg_component_info)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info))).Fv_samp_factor != libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module115)), __ccgo_ts+54382, libc.VaList(bp+8, (*(*Tjpeg_component_info)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info))).Fh_samp_factor, (*(*Tjpeg_component_info)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info))).Fv_samp_factor, libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling), libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling))) return 0 } /* Rest should have sampling factors 1,1 */ ci = int32(1) for { if !(ci < (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fnum_components) { break } if (*(*Tjpeg_component_info)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info + uintptr(ci)*88))).Fh_samp_factor != int32(1) || (*(*Tjpeg_component_info)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info + uintptr(ci)*88))).Fv_samp_factor != int32(1) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module115)), __ccgo_ts+54447, 0) return 0 } goto _5 _5: ; ci++ } } else { /* PC 2's single component should have sampling factors 1,1 */ if (*(*Tjpeg_component_info)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info))).Fh_samp_factor != int32(1) || (*(*Tjpeg_component_info)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info))).Fv_samp_factor != int32(1) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module115)), __ccgo_ts+54447, 0) return 0 } } downsampled_output = FALSE if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) && libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fphotometric) == int32(PHOTOMETRIC_YCBCR) && (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegcolormode == int32(JPEGCOLORMODE_RGB3) { /* Convert YCbCr to RGB */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fjpeg_color_space = int32(JCS_YCbCr) (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fout_color_space = int32(JCS_RGB) } else { /* Suppress colorspace handling */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fjpeg_color_space = int32(JCS_UNKNOWN) (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fout_color_space = int32(JCS_UNKNOWN) if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) && (libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling) != int32(1) || libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) != int32(1)) { downsampled_output = int32(TRUE) } /* XXX what about up-sampling? */ } if downsampled_output != 0 { /* Need to use raw-data interface to libjpeg */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fraw_data_out = int32(TRUE) (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fdo_fancy_upsampling = FALSE (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_DecodeRowError) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_JPEGDecodeRaw) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_JPEGDecodeRaw) } else { /* Use normal interface to libjpeg */ (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fraw_data_out = FALSE (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_JPEGDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_JPEGDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_JPEGDecode) } /* Start JPEG decompressor */ if !(_TIFFjpeg_start_decompress(tls, sp) != 0) { return 0 } /* Allocate downsampled-data buffers if needed */ if downsampled_output != 0 { if !(_alloc_downsampled_buffers(tls, tif, (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info, (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fnum_components) != 0) { return 0 } (*TJPEGState)(unsafe.Pointer(sp)).Fscancount = int32(DCTSIZE) /* mark buffer empty */ } return int32(1) } var _module115 = [14]uint8{'J', 'P', 'E', 'G', 'P', 'r', 'e', 'D', 'e', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Decode a chunk of pixels. // * "Standard" case: returned data is not downsampled. // */ func _JPEGDecode(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var nrows, v1 Ttmsize_t var sp uintptr var _ /* bufptr at bp+0 */ TJSAMPROW _, _, _ = nrows, sp, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s /* ** Update available information, buffer may have been refilled ** between decode requests */ (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fnext_input_byte = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fbytes_in_buffer = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) if (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline == 0 { return 0 } nrows = cc / (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline if cc%(*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline != 0 { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+54478, 0) } if nrows > libc.Int32FromUint32((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_height) { nrows = libc.Int32FromUint32((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_height) } /* data is expected to be read in multiples of a scanline */ if nrows != 0 { for { /* * In the libjpeg6b-9a 8bit case. We read directly into * the TIFF buffer. */ *(*TJSAMPROW)(unsafe.Pointer(bp)) = buf if _TIFFjpeg_read_scanlines(tls, sp, bp, int32(1)) != int32(1) { return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_row++ buf += uintptr((*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline) cc -= (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline goto _2 _2: ; nrows-- v1 = nrows if !(v1 > 0) { break } } } /* Update information on consumed data */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fnext_input_byte (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = libc.Int32FromUint32((*TJPEGState)(unsafe.Pointer(sp)).Fsrc.Fbytes_in_buffer) /* Close down the decompressor if we've finished the strip or tile. */ return libc.BoolInt32((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Foutput_scanline < (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Foutput_height || _TIFFjpeg_finish_decompress(tls, sp) != 0) } // C documentation // // /*ARGSUSED*/ func _DecodeRowError(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { _ = buf _ = cc _ = s (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, __ccgo_ts+54507, __ccgo_ts+54524, 0) return 0 } // C documentation // // /* // * Decode a chunk of pixels. // * Returned data is downsampled per sampling factors. // */ // /*ARGSUSED*/ func _JPEGDecodeRaw(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var ci, clumpoffset, hsamp, n, samples_per_clump, vsamp, xpos, ypos int32 var clumps_per_line, nclump, v4, v7 TJDIMENSION var compptr, inptr, outptr, sp, td, v5, v9 uintptr var nrows Ttmsize_t _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ci, clumpoffset, clumps_per_line, compptr, hsamp, inptr, n, nclump, nrows, outptr, samples_per_clump, sp, td, vsamp, xpos, ypos, v4, v5, v7, v9 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 _ = s nrows = libc.Int32FromUint32((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fimage_height) /* For last strip, limit number of rows to its truncated height */ /* even if the codestream height is larger (which is not compliant, */ /* but that we tolerate) */ if libc.Uint32FromInt32(nrows) > (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength-(*TTIFF)(unsafe.Pointer(tif)).Ftif_row && !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00400) != libc.Uint32FromInt32(0)) { nrows = libc.Int32FromUint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength - (*TTIFF)(unsafe.Pointer(tif)).Ftif_row) } /* data is expected to be read in multiples of a scanline */ if nrows != 0 { /* Cb,Cr both have sampling factors 1, so this is correct */ clumps_per_line = (*(*Tjpeg_component_info)(unsafe.Pointer((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info + 1*88))).Fdownsampled_width samples_per_clump = (*TJPEGState)(unsafe.Pointer(sp)).Fsamplesperclump for cond := true; cond; cond = nrows > 0 { if cc < (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, __ccgo_ts+54665, __ccgo_ts+54679, 0) goto error } /* Reload downsampled-data buffer if needed */ if (*TJPEGState)(unsafe.Pointer(sp)).Fscancount >= int32(DCTSIZE) { n = (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fmax_v_samp_factor * int32(DCTSIZE) if _TIFFjpeg_read_raw_data(tls, sp, sp+1100, n) != n { goto error } (*TJPEGState)(unsafe.Pointer(sp)).Fscancount = 0 } /* * Fastest way to unseparate data is to make one pass * over the scanline for each row of each component. */ clumpoffset = 0 /* first sample in clump */ ci = 0 compptr = (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fcomp_info for { if !(ci < (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Fnum_components) { break } hsamp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor vsamp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor ypos = 0 for { if !(ypos < vsamp) { break } inptr = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(sp + 1100 + uintptr(ci)*4)) + uintptr((*TJPEGState)(unsafe.Pointer(sp)).Fscancount*vsamp+ypos)*4)) outptr = buf + uintptr(clumpoffset) if cc < libc.Int32FromUint32(libc.Uint32FromInt32(clumpoffset)+libc.Uint32FromInt32(samples_per_clump)*(clumps_per_line-libc.Uint32FromInt32(1))+libc.Uint32FromInt32(hsamp)) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, __ccgo_ts+54665, __ccgo_ts+54729, 0) goto error } if hsamp == int32(1) { /* fast path for at least Cb and Cr */ nclump = clumps_per_line for { v4 = nclump nclump-- if !(v4 > uint32(0)) { break } v5 = inptr inptr++ *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(v5)) outptr += uintptr(samples_per_clump) goto _3 _3: } } else { /* general case */ nclump = clumps_per_line for { v7 = nclump nclump-- if !(v7 > uint32(0)) { break } xpos = 0 for { if !(xpos < hsamp) { break } v9 = inptr inptr++ *(*TJSAMPLE)(unsafe.Pointer(outptr + uintptr(xpos))) = *(*TJSAMPLE)(unsafe.Pointer(v9)) goto _8 _8: ; xpos++ } outptr += uintptr(samples_per_clump) goto _6 _6: } } clumpoffset += hsamp goto _2 _2: ; ypos++ } goto _1 _1: ; ci++ compptr += 88 } (*TJPEGState)(unsafe.Pointer(sp)).Fscancount++ *(*Tuint32_t)(unsafe.Pointer(tif + 652)) += uint32((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) buf += uintptr((*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline) cc -= (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline nrows -= libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) } } /* Close down the decompressor if done. */ return libc.BoolInt32((*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Foutput_scanline < (*(*Tjpeg_decompress_struct)(unsafe.Pointer(sp))).Foutput_height || _TIFFjpeg_finish_decompress(tls, sp) != 0) goto error error: ; return 0 return r } /* * JPEG Encoding. */ func _unsuppress_quant_table(tls *libc.TLS, sp uintptr, tblno int32) { var qtbl, v1 uintptr _, _ = qtbl, v1 v1 = *(*uintptr)(unsafe.Pointer(sp + 88 + uintptr(tblno)*4)) qtbl = v1 if v1 != libc.UintptrFromInt32(0) { (*TJQUANT_TBL)(unsafe.Pointer(qtbl)).Fsent_table = FALSE } } func _suppress_quant_table(tls *libc.TLS, sp uintptr, tblno int32) { var qtbl, v1 uintptr _, _ = qtbl, v1 v1 = *(*uintptr)(unsafe.Pointer(sp + 88 + uintptr(tblno)*4)) qtbl = v1 if v1 != libc.UintptrFromInt32(0) { (*TJQUANT_TBL)(unsafe.Pointer(qtbl)).Fsent_table = int32(TRUE) } } func _unsuppress_huff_table(tls *libc.TLS, sp uintptr, tblno int32) { var htbl, v1, v2 uintptr _, _, _ = htbl, v1, v2 v1 = *(*uintptr)(unsafe.Pointer(sp + 120 + uintptr(tblno)*4)) htbl = v1 if v1 != libc.UintptrFromInt32(0) { (*TJHUFF_TBL)(unsafe.Pointer(htbl)).Fsent_table = FALSE } v2 = *(*uintptr)(unsafe.Pointer(sp + 136 + uintptr(tblno)*4)) htbl = v2 if v2 != libc.UintptrFromInt32(0) { (*TJHUFF_TBL)(unsafe.Pointer(htbl)).Fsent_table = FALSE } } func _suppress_huff_table(tls *libc.TLS, sp uintptr, tblno int32) { var htbl, v1, v2 uintptr _, _, _ = htbl, v1, v2 v1 = *(*uintptr)(unsafe.Pointer(sp + 120 + uintptr(tblno)*4)) htbl = v1 if v1 != libc.UintptrFromInt32(0) { (*TJHUFF_TBL)(unsafe.Pointer(htbl)).Fsent_table = int32(TRUE) } v2 = *(*uintptr)(unsafe.Pointer(sp + 136 + uintptr(tblno)*4)) htbl = v2 if v2 != libc.UintptrFromInt32(0) { (*TJHUFF_TBL)(unsafe.Pointer(htbl)).Fsent_table = int32(TRUE) } } func _prepare_JPEGTables(tls *libc.TLS, tif uintptr) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* Initialize quant tables for current quality setting */ if !(_TIFFjpeg_set_quality(tls, sp, (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegquality, FALSE) != 0) { return 0 } /* Mark only the tables we want for output */ /* NB: chrominance tables are currently used only with YCbCr */ if !(_TIFFjpeg_suppress_tables(tls, sp, int32(TRUE)) != 0) { return 0 } if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode&int32(JPEGTABLESMODE_QUANT1) != 0 { _unsuppress_quant_table(tls, sp, 0) if libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fphotometric) == int32(PHOTOMETRIC_YCBCR) { _unsuppress_quant_table(tls, sp, int32(1)) } } if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode&int32(JPEGTABLESMODE_HUFF1) != 0 { _unsuppress_huff_table(tls, sp, 0) if libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fphotometric) == int32(PHOTOMETRIC_YCBCR) { _unsuppress_huff_table(tls, sp, int32(1)) } } /* Direct libjpeg output into otherSettings.jpegtables */ if !(_TIFFjpeg_tables_dest(tls, sp, tif) != 0) { return 0 } /* Emit tables-only datastream */ if !(_TIFFjpeg_write_tables(tls, sp) != 0) { return 0 } return int32(1) } // C documentation // // /* This is a modified version of std_huff_tables() from jcparam.c // * in libjpeg-9d because it no longer initializes default Huffman // * tables in jpeg_set_defaults(). */ func _TIFF_std_huff_tables(tls *libc.TLS, cinfo Tj_compress_ptr) { if *(*uintptr)(unsafe.Pointer(cinfo + 120)) == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tj_common_ptr, Tboolean, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_huff_tablePtr})))(tls, cinfo, int32(TRUE), 0) } if *(*uintptr)(unsafe.Pointer(cinfo + 136)) == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tj_common_ptr, Tboolean, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_huff_tablePtr})))(tls, cinfo, FALSE, 0) } if *(*uintptr)(unsafe.Pointer(cinfo + 120 + 1*4)) == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tj_common_ptr, Tboolean, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_huff_tablePtr})))(tls, cinfo, int32(TRUE), int32(1)) } if *(*uintptr)(unsafe.Pointer(cinfo + 136 + 1*4)) == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tj_common_ptr, Tboolean, int32) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TJpegtclStubs)(unsafe.Pointer(XjpegtclStubsPtr)).Fjpeg_std_huff_tablePtr})))(tls, cinfo, FALSE, int32(1)) } } func _JPEGSetupEncode(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var sp, td uintptr var top int32 var _ /* ref at bp+0 */ uintptr var _ /* refbw at bp+4 */ [6]float32 _, _, _ = sp, td, top sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 _JPEGInitializeLibJPEG(tls, tif, FALSE) (*TJPEGState)(unsafe.Pointer(sp)).Fphotometric = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric /* * Initialize all JPEG parameters to default values. * Note that jpeg_set_defaults needs legal values for * in_color_space and input_components. */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Finput_components = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) if libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fphotometric) == int32(PHOTOMETRIC_YCBCR) { if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegcolormode == int32(JPEGCOLORMODE_RGB3) { (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fin_color_space = int32(JCS_RGB) } else { (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fin_color_space = int32(JCS_YCbCr) } } else { if (libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == PHOTOMETRIC_MINISWHITE || libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == int32(PHOTOMETRIC_MINISBLACK)) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) == int32(1) { (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fin_color_space = int32(JCS_GRAYSCALE) } else { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == int32(PHOTOMETRIC_RGB) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) == int32(3) { (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fin_color_space = int32(JCS_RGB) } else { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == int32(PHOTOMETRIC_SEPARATED) && libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) == int32(4) { (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fin_color_space = int32(JCS_CMYK) } else { (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fin_color_space = int32(JCS_UNKNOWN) } } } } } else { (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Finput_components = int32(1) (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fin_color_space = int32(JCS_UNKNOWN) } if !(_TIFFjpeg_set_defaults(tls, sp) != 0) { return 0 } /* mozjpeg by default enables progressive JPEG, which is illegal in * JPEG-in-TIFF */ /* So explicitly disable it. */ if (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fnum_scans != 0 && (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode&int32(JPEGTABLESMODE_HUFF1) != 0 { /* it has been found that mozjpeg could create corrupt strips/tiles */ /* in non optimize_coding mode. */ (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module116)), __ccgo_ts+54806, 0) (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode &= ^libc.Int32FromInt32(JPEGTABLESMODE_HUFF1) } (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fnum_scans = 0 (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fscan_info = libc.UintptrFromInt32(0) /* Set per-file parameters */ switch libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fphotometric) { case int32(PHOTOMETRIC_YCBCR): (*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling = *(*Tuint16_t)(unsafe.Pointer(td + 216)) (*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling = *(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)) if libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling) == 0 || libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) == 0 { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module116)), __ccgo_ts+54943, 0) return 0 } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) > int32(16) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module116)), __ccgo_ts+54986, libc.VaList(bp+40, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } /* * A ReferenceBlackWhite field *must* be present since the * default value is inappropriate for YCbCr. Fill in the * proper value if application didn't set it. */ if !((*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFGetField})))(tls, tif, uint32(TIFFTAG_REFERENCEBLACKWHITE), libc.VaList(bp+40, bp)) != 0) { top = int32(1) << (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample (*(*[6]float32)(unsafe.Pointer(bp + 4)))[0] = libc.Float32FromInt32(0) (*(*[6]float32)(unsafe.Pointer(bp + 4)))[int32(1)] = float32(top - libc.Int32FromInt32(1)) (*(*[6]float32)(unsafe.Pointer(bp + 4)))[int32(2)] = float32(top >> libc.Int32FromInt32(1)) (*(*[6]float32)(unsafe.Pointer(bp + 4)))[int32(3)] = (*(*[6]float32)(unsafe.Pointer(bp + 4)))[int32(1)] (*(*[6]float32)(unsafe.Pointer(bp + 4)))[int32(4)] = (*(*[6]float32)(unsafe.Pointer(bp + 4)))[int32(2)] (*(*[6]float32)(unsafe.Pointer(bp + 4)))[int32(5)] = (*(*[6]float32)(unsafe.Pointer(bp + 4)))[int32(1)] (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_REFERENCEBLACKWHITE), libc.VaList(bp+40, bp+4)) } case int32(PHOTOMETRIC_PALETTE): /* disallowed by Tech Note */ fallthrough case int32(PHOTOMETRIC_MASK): (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module116)), __ccgo_ts+55024, libc.VaList(bp+40, libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fphotometric))) return 0 default: /* TIFF 6.0 forbids subsampling of all other color spaces */ (*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling = uint16(1) (*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling = uint16(1) break } /* Verify miscellaneous parameters */ /* * This would need work if libtiff ever supports different * depths for different components, or if libjpeg ever supports * run-time selection of depth. Neither is imminent. */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) != int32(BITS_IN_JSAMPLE) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module116)), __ccgo_ts+54986, libc.VaList(bp+40, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fdata_precision = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength%libc.Uint32FromInt32(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling)*libc.Int32FromInt32(DCTSIZE)) != uint32(0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module116)), __ccgo_ts+55074, libc.VaList(bp+40, libc.Uint32FromInt32(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling)*libc.Int32FromInt32(DCTSIZE)))) return 0 } if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth%libc.Uint32FromInt32(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling)*libc.Int32FromInt32(DCTSIZE)) != uint32(0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module116)), __ccgo_ts+55114, libc.VaList(bp+40, libc.Uint32FromInt32(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling)*libc.Int32FromInt32(DCTSIZE)))) return 0 } } else { if (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength && (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip%libc.Uint32FromInt32(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling)*libc.Int32FromInt32(DCTSIZE)) != uint32(0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module116)), __ccgo_ts+55153, libc.VaList(bp+40, libc.Uint32FromInt32(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling)*libc.Int32FromInt32(DCTSIZE)))) return 0 } } /* Create a JPEGTables field if appropriate */ if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode&(libc.Int32FromInt32(JPEGTABLESMODE_QUANT1)|libc.Int32FromInt32(JPEGTABLESMODE_HUFF1)) != 0 { if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables == libc.UintptrFromInt32(0) || libc.Xmemcmp(tls, (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables, __ccgo_ts+55198, uint32(8)) == 0 { if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode&int32(JPEGTABLESMODE_HUFF1) != 0 && (*(*uintptr)(unsafe.Pointer(sp + 120)) == libc.UintptrFromInt32(0) || *(*uintptr)(unsafe.Pointer(sp + 120 + 1*4)) == libc.UintptrFromInt32(0) || *(*uintptr)(unsafe.Pointer(sp + 136)) == libc.UintptrFromInt32(0) || *(*uintptr)(unsafe.Pointer(sp + 136 + 1*4)) == libc.UintptrFromInt32(0)) { /* libjpeg-9d no longer initializes default Huffman tables in */ /* jpeg_set_defaults() */ _TIFF_std_huff_tables(tls, sp) } if !(_prepare_JPEGTables(tls, tif) != 0) { return 0 } /* Mark the field present */ /* Can't use TIFFSetField since BEENWRITING is already set! */ *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00008) *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(0))/libc.Int32FromInt32(32))*4)) |= libc.Uint32FromInt32(1) << ((libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(0)) & libc.Int32FromInt32(0x1f)) } } else { /* We do not support application-supplied JPEGTables, */ /* so mark the field not present */ *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(0))/libc.Int32FromInt32(32))*4)) &= ^(libc.Uint32FromInt32(1) << ((libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(0)) & libc.Int32FromInt32(0x1f))) } /* Direct libjpeg output to libtiff's output buffer */ _TIFFjpeg_data_dest(tls, sp, tif) return int32(1) } var _module116 = [16]uint8{'J', 'P', 'E', 'G', 'S', 'e', 't', 'u', 'p', 'E', 'n', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Set encoding state at the start of a strip or tile. // */ func _JPEGPreEncode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { var downsampled_input int32 var segment_height, segment_width Tuint32_t var sp, td uintptr var v1, v2 uint32 _, _, _, _, _, _, _ = downsampled_input, segment_height, segment_width, sp, td, v1, v2 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 if (*(*Tjpeg_common_struct)(unsafe.Pointer(&(*TJPEGState)(unsafe.Pointer(sp)).Fcinfo))).Fis_decompressor == int32(1) { (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode})))(tls, tif) } /* * Set encoding parameters for this strip/tile. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { segment_width = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilewidth segment_height = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_tilelength (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline = (*(*func(*libc.TLS, uintptr) Ttsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFTileRowSize})))(tls, tif) } else { segment_width = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth segment_height = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength - (*TTIFF)(unsafe.Pointer(tif)).Ftif_row if segment_height > (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip { segment_height = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip } (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline = (*(*func(*libc.TLS, uintptr) Ttsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFScanlineSize})))(tls, tif) } if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_SEPARATE) && libc.Int32FromUint16(s) > 0 { /* for PC 2, scale down the strip/tile size * to match a downsampled component */ if segment_width < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling)-libc.Int32FromInt32(1)) { v1 = (segment_width + (uint32((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling) - uint32(1))) / uint32((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling) } else { v1 = 0 } segment_width = v1 if segment_height < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling)-libc.Int32FromInt32(1)) { v2 = (segment_height + (uint32((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) - uint32(1))) / uint32((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) } else { v2 = 0 } segment_height = v2 } if segment_width > uint32(65535) || segment_height > uint32(65535) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module117)), __ccgo_ts+55208, 0) return 0 } (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fimage_width = segment_width (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fimage_height = segment_height downsampled_input = FALSE if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Finput_components = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) if libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fphotometric) == int32(PHOTOMETRIC_YCBCR) { if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegcolormode != int32(JPEGCOLORMODE_RGB3) { if libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling) != int32(1) || libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) != int32(1) { downsampled_input = int32(TRUE) } } if !(_TIFFjpeg_set_colorspace(tls, sp, int32(JCS_YCbCr)) != 0) { return 0 } /* * Set Y sampling factors; * we assume jpeg_set_colorspace() set the rest to 1 */ (*(*Tjpeg_component_info)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fcomp_info))).Fh_samp_factor = libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling) (*(*Tjpeg_component_info)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fcomp_info))).Fv_samp_factor = libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) } else { if !(_TIFFjpeg_set_colorspace(tls, sp, (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fin_color_space) != 0) { return 0 } /* jpeg_set_colorspace set all sampling factors to 1 */ } } else { if !(_TIFFjpeg_set_colorspace(tls, sp, int32(JCS_UNKNOWN)) != 0) { return 0 } (*(*Tjpeg_component_info)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fcomp_info))).Fcomponent_id = libc.Int32FromUint16(s) /* jpeg_set_colorspace() set sampling factors to 1 */ if libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fphotometric) == int32(PHOTOMETRIC_YCBCR) && libc.Int32FromUint16(s) > 0 { (*(*Tjpeg_component_info)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fcomp_info))).Fquant_tbl_no = int32(1) (*(*Tjpeg_component_info)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fcomp_info))).Fdc_tbl_no = int32(1) (*(*Tjpeg_component_info)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fcomp_info))).Fac_tbl_no = int32(1) } } /* ensure libjpeg won't write any extraneous markers */ (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fwrite_JFIF_header = FALSE (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fwrite_Adobe_marker = FALSE /* set up table handling correctly */ /* calling TIFFjpeg_set_quality() causes quantization tables to be flagged */ /* as being to be emitted, which we don't want in the JPEGTABLESMODE_QUANT */ /* mode, so we must manually suppress them. However TIFFjpeg_set_quality() */ /* should really be called when dealing with files with directories with */ /* mixed qualities. see http://trac.osgeo.org/gdal/ticket/3539 */ if !(_TIFFjpeg_set_quality(tls, sp, (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegquality, FALSE) != 0) { return 0 } if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode&int32(JPEGTABLESMODE_QUANT1) != 0 { _suppress_quant_table(tls, sp, 0) _suppress_quant_table(tls, sp, int32(1)) } else { _unsuppress_quant_table(tls, sp, 0) _unsuppress_quant_table(tls, sp, int32(1)) } if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode&int32(JPEGTABLESMODE_HUFF1) != 0 { /* Explicit suppression is only needed if we did not go through the */ /* prepare_JPEGTables() code path, which may be the case if updating */ /* an existing file */ _suppress_huff_table(tls, sp, 0) _suppress_huff_table(tls, sp, int32(1)) (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Foptimize_coding = FALSE } else { (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Foptimize_coding = int32(TRUE) } if downsampled_input != 0 { /* Need to use raw-data interface to libjpeg */ (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fraw_data_in = int32(TRUE) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_JPEGEncodeRaw) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_JPEGEncodeRaw) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_JPEGEncodeRaw) } else { /* Use normal interface to libjpeg */ (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fraw_data_in = FALSE (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_JPEGEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_JPEGEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_JPEGEncode) } /* Start JPEG compressor */ if !(_TIFFjpeg_start_compress(tls, sp, FALSE) != 0) { return 0 } /* Allocate downsampled-data buffers if needed */ if downsampled_input != 0 { if !(_alloc_downsampled_buffers(tls, tif, (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fcomp_info, (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fnum_components) != 0) { return 0 } } (*TJPEGState)(unsafe.Pointer(sp)).Fscancount = 0 return int32(1) } var _module117 = [14]uint8{'J', 'P', 'E', 'G', 'P', 'r', 'e', 'E', 'n', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Encode a chunk of pixels. // * "Standard" case: incoming data is not downsampled. // */ func _JPEGEncode(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var iPair, line16_count, value_pairs int32 var in_ptr, line16, out_ptr, sp uintptr var nrows, v1 Ttmsize_t var _ /* bufptr at bp+0 */ [1]TJSAMPROW _, _, _, _, _, _, _, _, _ = iPair, in_ptr, line16, line16_count, nrows, out_ptr, sp, value_pairs, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data line16 = libc.UintptrFromInt32(0) line16_count = 0 _ = s /* data is expected to be supplied in multiples of a scanline */ nrows = cc / (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline if cc%(*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline != 0 { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+55238, 0) } /* The last strip will be limited to image size */ if !((*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&libc.Uint32FromUint32(0x00400) != libc.Uint32FromInt32(0)) && (*TTIFF)(unsafe.Pointer(tif)).Ftif_row+libc.Uint32FromInt32(nrows) > (*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagelength { nrows = libc.Int32FromUint32((*TTIFF)(unsafe.Pointer(tif)).Ftif_dir.Ftd_imagelength - (*TTIFF)(unsafe.Pointer(tif)).Ftif_row) } if (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fdata_precision == int32(12) { line16_count = (*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline * libc.Int32FromInt32(2) / libc.Int32FromInt32(3) line16 = XTkimgTIFFmalloc(tls, libc.Int32FromUint32(uint32(2)*libc.Uint32FromInt32(line16_count))) if !(line16 != 0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, __ccgo_ts+55268, __ccgo_ts+55279, 0) return 0 } } for { v1 = nrows nrows-- if !(v1 > 0) { break } if (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fdata_precision == int32(12) { value_pairs = line16_count / int32(2) (*(*[1]TJSAMPROW)(unsafe.Pointer(bp)))[0] = line16 iPair = 0 for { if !(iPair < value_pairs) { break } in_ptr = buf + uintptr(iPair*int32(3)) out_ptr = line16 + uintptr(iPair*libc.Int32FromInt32(2))*2 *(*TJSAMPLE)(unsafe.Pointer(out_ptr)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(in_ptr)))<>int32(4)) *(*TJSAMPLE)(unsafe.Pointer(out_ptr + 1)) = libc.Uint8FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(in_ptr + 1)))&int32(0x0f)< 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_row++ } buf += uintptr((*TJPEGState)(unsafe.Pointer(sp)).Fbytesperline) } if (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fdata_precision == int32(12) { XTkimgTIFFfree(tls, line16) } return int32(1) } // C documentation // // /* // * Encode a chunk of pixels. // * Incoming data is expected to be downsampled per sampling factors. // */ func _JPEGEncodeRaw(tls *libc.TLS, tif uintptr, buf uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { var bytesperclumpline, nrows Ttmsize_t var ci, clumpoffset, hsamp, n, padding, samples_per_clump, vsamp, xpos, ypos int32 var clumps_per_line, nclump, v4, v7 TJDIMENSION var compptr, inptr, outptr, sp, v5, v9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bytesperclumpline, ci, clumpoffset, clumps_per_line, compptr, hsamp, inptr, n, nclump, nrows, outptr, padding, samples_per_clump, sp, vsamp, xpos, ypos, v4, v5, v7, v9 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data samples_per_clump = (*TJPEGState)(unsafe.Pointer(sp)).Fsamplesperclump _ = s /* data is expected to be supplied in multiples of a clumpline */ /* a clumpline is equivalent to v_sampling desubsampled scanlines */ /* TODO: the following calculation of bytesperclumpline, should substitute * calculation of sp->bytesperline, except that it is per v_sampling lines */ bytesperclumpline = ((libc.Int32FromUint32((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fimage_width)+libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling)-int32(1))/libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling)*(libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fh_sampling)*libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling)+int32(2))*(*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fdata_precision + int32(7)) / int32(8) nrows = cc / bytesperclumpline * libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) if cc%bytesperclumpline != 0 { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, (*TTIFF)(unsafe.Pointer(tif)).Ftif_name, __ccgo_ts+55238, 0) } /* Cb,Cr both have sampling factors 1, so this is correct */ clumps_per_line = (*(*Tjpeg_component_info)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fcomp_info + 1*88))).Fdownsampled_width for nrows > 0 { /* * Fastest way to separate the data is to make one pass * over the scanline for each row of each component. */ clumpoffset = 0 /* first sample in clump */ ci = 0 compptr = (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fcomp_info for { if !(ci < (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fnum_components) { break } hsamp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fh_samp_factor vsamp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor padding = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks*libc.Uint32FromInt32(DCTSIZE) - clumps_per_line*libc.Uint32FromInt32(hsamp)) ypos = 0 for { if !(ypos < vsamp) { break } inptr = buf + uintptr(clumpoffset) outptr = *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(sp + 1100 + uintptr(ci)*4)) + uintptr((*TJPEGState)(unsafe.Pointer(sp)).Fscancount*vsamp+ypos)*4)) if hsamp == int32(1) { /* fast path for at least Cb and Cr */ nclump = clumps_per_line for { v4 = nclump nclump-- if !(v4 > uint32(0)) { break } v5 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v5)) = *(*TJSAMPLE)(unsafe.Pointer(inptr)) inptr += uintptr(samples_per_clump) goto _3 _3: } } else { /* general case */ nclump = clumps_per_line for { v7 = nclump nclump-- if !(v7 > uint32(0)) { break } xpos = 0 for { if !(xpos < hsamp) { break } v9 = outptr outptr++ *(*TJSAMPLE)(unsafe.Pointer(v9)) = *(*TJSAMPLE)(unsafe.Pointer(inptr + uintptr(xpos))) goto _8 _8: ; xpos++ } inptr += uintptr(samples_per_clump) goto _6 _6: } } /* pad each scanline as needed */ xpos = 0 for { if !(xpos < padding) { break } *(*TJSAMPLE)(unsafe.Pointer(outptr)) = *(*TJSAMPLE)(unsafe.Pointer(outptr + uintptr(-libc.Int32FromInt32(1)))) outptr++ goto _10 _10: ; xpos++ } clumpoffset += hsamp goto _2 _2: ; ypos++ } goto _1 _1: ; ci++ compptr += 88 } (*TJPEGState)(unsafe.Pointer(sp)).Fscancount++ if (*TJPEGState)(unsafe.Pointer(sp)).Fscancount >= int32(DCTSIZE) { n = (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fmax_v_samp_factor * int32(DCTSIZE) if _TIFFjpeg_write_raw_data(tls, sp, sp+1100, n) != n { return 0 } (*TJPEGState)(unsafe.Pointer(sp)).Fscancount = 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 652)) += uint32((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) buf += uintptr(bytesperclumpline) nrows -= libc.Int32FromUint16((*TJPEGState)(unsafe.Pointer(sp)).Fv_sampling) } return int32(1) } // C documentation // // /* // * Finish up at the end of a strip or tile. // */ func _JPEGPostEncode(tls *libc.TLS, tif uintptr) (r int32) { var ci, n, vsamp, ypos int32 var compptr, sp uintptr var row_width Ttmsize_t _, _, _, _, _, _, _ = ci, compptr, n, row_width, sp, vsamp, ypos sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data if (*TJPEGState)(unsafe.Pointer(sp)).Fscancount > 0 { ci = 0 compptr = (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fcomp_info for { if !(ci < (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fnum_components) { break } vsamp = (*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fv_samp_factor row_width = libc.Int32FromUint32((*Tjpeg_component_info)(unsafe.Pointer(compptr)).Fwidth_in_blocks * uint32(DCTSIZE) * uint32(1)) ypos = (*TJPEGState)(unsafe.Pointer(sp)).Fscancount * vsamp for { if !(ypos < int32(DCTSIZE)*vsamp) { break } (*(*func(*libc.TLS, uintptr, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFmemcpyPtr})))(tls, *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(sp + 1100 + uintptr(ci)*4)) + uintptr(ypos)*4)), *(*TJSAMPROW)(unsafe.Pointer(*(*TJSAMPARRAY)(unsafe.Pointer(sp + 1100 + uintptr(ci)*4)) + uintptr(ypos-int32(1))*4)), row_width) goto _2 _2: ; ypos++ } goto _1 _1: ; ci++ compptr += 88 } n = (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fmax_v_samp_factor * int32(DCTSIZE) if _TIFFjpeg_write_raw_data(tls, sp, sp+1100, n) != n { return 0 } } return _TIFFjpeg_finish_compress(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_data) } func _JPEGCleanup(tls *libc.TLS, tif uintptr) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fvgetparent (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fvsetparent (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fprintdir if (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo_initialized != 0 { _TIFFjpeg_destroy(tls, sp) } /* release libjpeg resources */ if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables != 0 { /* tag value */ XTkimgTIFFfree(tls, (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables) } XTkimgTIFFfree(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_data) /* release local state */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_data = libc.UintptrFromInt32(0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFSetDefaultCompressionStatePtr})))(tls, tif) } func _JPEGResetUpsampled(tls *libc.TLS, tif uintptr) { var sp, td uintptr var v1 int32 _, _, _ = sp, td, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 /* * Mark whether returned data is up-sampled or not so TIFFStripSize * and TIFFTileSize return values that reflect the true amount of * data. */ *(*Tuint32_t)(unsafe.Pointer(tif + 12)) &= ^libc.Uint32FromUint32(0x04000) if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_photometric) == int32(PHOTOMETRIC_YCBCR) && (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegcolormode == int32(JPEGCOLORMODE_RGB3) { *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x04000) } else { } } /* * Must recalculate cached tile size in case sampling state changed. * Should we really be doing this now if image size isn't set? */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize > 0 { if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00400) != uint32(0) { v1 = (*(*func(*libc.TLS, uintptr) Ttsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFTileSize})))(tls, tif) } else { v1 = -libc.Int32FromInt32(1) } (*TTIFF)(unsafe.Pointer(tif)).Ftif_tilesize = v1 } if (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize > 0 { (*TTIFF)(unsafe.Pointer(tif)).Ftif_scanlinesize = (*(*func(*libc.TLS, uintptr) Ttsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFScanlineSize})))(tls, tif) } } func _JPEGVSetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { var fip, sp, v1 uintptr var ret_value int32 var v32 Tuint32_t _, _, _, _, _ = fip, ret_value, sp, v32, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data switch tag { case uint32(TIFFTAG_JPEGTABLES): v32 = libc.VaUint32(&ap) if v32 == uint32(0) { /* XXX */ return 0 } (*(*func(*libc.TLS, uintptr, uintptr, Tuint32_t))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFsetByteArrayPtr})))(tls, sp+1148+20, libc.VaUintptr(&ap), v32) (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length = v32 *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(0))/libc.Int32FromInt32(32))*4)) |= libc.Uint32FromInt32(1) << ((libc.Int32FromInt32(FIELD_CODEC) + libc.Int32FromInt32(0)) & libc.Int32FromInt32(0x1f)) case uint32(TIFFTAG_JPEGQUALITY): (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegquality = libc.VaInt32(&ap) return int32(1) /* pseudo tag */ case uint32(TIFFTAG_JPEGCOLORMODE): (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegcolormode = libc.VaInt32(&ap) _JPEGResetUpsampled(tls, tif) return int32(1) /* pseudo tag */ case uint32(TIFFTAG_PHOTOMETRIC): ret_value = (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fvsetparent})))(tls, tif, tag, ap) _JPEGResetUpsampled(tls, tif) return ret_value case uint32(TIFFTAG_JPEGTABLESMODE): (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode = libc.VaInt32(&ap) return int32(1) /* pseudo tag */ case uint32(TIFFTAG_YCBCRSUBSAMPLING): /* mark the fact that we have a real ycbcrsubsampling! */ (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fycbcrsampling_fetched = int32(1) /* should we be recomputing upsampling info here? */ return (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fvsetparent})))(tls, tif, tag, ap) default: return (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fvsetparent})))(tls, tif, tag, ap) } v1 = (*(*func(*libc.TLS, uintptr, Tuint32_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFFieldWithTag})))(tls, tif, tag) fip = v1 if v1 != libc.UintptrFromInt32(0) { *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr(libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit)/int32(32))*4)) |= libc.Uint32FromInt32(1) << (libc.Int32FromUint16((*TTIFFField)(unsafe.Pointer(fip)).Ffield_bit) & libc.Int32FromInt32(0x1f)) } else { return 0 } *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00008) return int32(1) } func _JPEGVGetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data switch tag { case uint32(TIFFTAG_JPEGTABLES): *(*Tuint32_t)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length *(*uintptr)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables case uint32(TIFFTAG_JPEGQUALITY): *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegquality case uint32(TIFFTAG_JPEGCOLORMODE): *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegcolormode case uint32(TIFFTAG_JPEGTABLESMODE): *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode default: return (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fvgetparent})))(tls, tif, tag, ap) } return int32(1) } func _JPEGPrintDir(tls *libc.TLS, tif uintptr, fd uintptr, flags int32) { bp := tls.Alloc(16) defer tls.Free(16) var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = flags if sp != libc.UintptrFromInt32(0) { if *(*Tuint32_t)(unsafe.Pointer(tif + 56 + uintptr((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(0))/libc.Int32FromInt32(32))*4))&(libc.Uint32FromInt32(1)<<((libc.Int32FromInt32(FIELD_CODEC)+libc.Int32FromInt32(0))&libc.Int32FromInt32(0x1f))) != 0 { libc.Xfprintf(tls, fd, __ccgo_ts+55305, libc.VaList(bp+8, (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length)) } if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fprintdir != 0 { (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fprintdir})))(tls, tif, fd, flags) } } } func _JPEGDefaultStripSize(tls *libc.TLS, tif uintptr, s Tuint32_t) (r Tuint32_t) { var sp, td uintptr var v1 uint32 _, _, _ = sp, td, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 s = (*(*func(*libc.TLS, uintptr, Tuint32_t) Tuint32_t)(unsafe.Pointer(&struct{ uintptr }{(*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fdefsparent})))(tls, tif, s) if s < (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength { if s < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)))*libc.Int32FromInt32(DCTSIZE)-libc.Int32FromInt32(1)) { v1 = (s + (libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)))*libc.Int32FromInt32(DCTSIZE)) - uint32(1))) / libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)))*libc.Int32FromInt32(DCTSIZE)) } else { v1 = 0 } s = v1 * libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)))*libc.Int32FromInt32(DCTSIZE)) } return s } func _JPEGDefaultTileSize(tls *libc.TLS, tif uintptr, tw uintptr, th uintptr) { var sp, td uintptr var v1, v2 uint32 _, _, _, _ = sp, td, v1, v2 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fdeftparent})))(tls, tif, tw, th) if *(*Tuint32_t)(unsafe.Pointer(tw)) < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216)))*libc.Int32FromInt32(DCTSIZE)-libc.Int32FromInt32(1)) { v1 = (*(*Tuint32_t)(unsafe.Pointer(tw)) + (libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216)))*libc.Int32FromInt32(DCTSIZE)) - uint32(1))) / libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216)))*libc.Int32FromInt32(DCTSIZE)) } else { v1 = 0 } *(*Tuint32_t)(unsafe.Pointer(tw)) = v1 * libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216)))*libc.Int32FromInt32(DCTSIZE)) if *(*Tuint32_t)(unsafe.Pointer(th)) < uint32(0xffffffff)-libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)))*libc.Int32FromInt32(DCTSIZE)-libc.Int32FromInt32(1)) { v2 = (*(*Tuint32_t)(unsafe.Pointer(th)) + (libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)))*libc.Int32FromInt32(DCTSIZE)) - uint32(1))) / libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)))*libc.Int32FromInt32(DCTSIZE)) } else { v2 = 0 } *(*Tuint32_t)(unsafe.Pointer(th)) = v2 * libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(td + 216 + 1*2)))*libc.Int32FromInt32(DCTSIZE)) } /* * The JPEG library initialized used to be done in TIFFInitJPEG(), but * now that we allow a TIFF file to be opened in update mode it is necessary * to have some way of deciding whether compression or decompression is * desired other than looking at tif->tif_mode. We accomplish this by * examining {TILE/STRIP}BYTECOUNTS to see if there is a non-zero entry. * If so, we assume decompression is desired. * * This is tricky, because TIFFInitJPEG() is called while the directory is * being read, and generally speaking the BYTECOUNTS tag won't have been read * at that point. So we try to defer jpeg library initialization till we * do have that tag ... basically any access that might require the compressor * or decompressor that occurs after the reading of the directory. * * In an ideal world compressors or decompressors would be setup * at the point where a single tile or strip was accessed (for read or write) * so that stuff like update of missing tiles, or replacement of tiles could * be done. However, we aren't trying to crack that nut just yet ... * * NFW, Feb 3rd, 2003. */ func _JPEGInitializeLibJPEG(tls *libc.TLS, tif uintptr, decompress int32) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data if (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo_initialized != 0 { if !(decompress != 0) && (*(*Tjpeg_common_struct)(unsafe.Pointer(&(*TJPEGState)(unsafe.Pointer(sp)).Fcinfo))).Fis_decompressor != 0 { _TIFFjpeg_destroy(tls, sp) } else { if decompress != 0 && !((*(*Tjpeg_common_struct)(unsafe.Pointer(&(*TJPEGState)(unsafe.Pointer(sp)).Fcinfo))).Fis_decompressor != 0) { _TIFFjpeg_destroy(tls, sp) } else { return int32(1) } } (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo_initialized = 0 } /* * Initialize libjpeg. */ if decompress != 0 { if !(_TIFFjpeg_create_decompress(tls, sp) != 0) { return 0 } } else { if !(_TIFFjpeg_create_compress(tls, sp) != 0) { return 0 } /* libjpeg turbo 1.5.2 honours max_memory_to_use, but has no backing */ /* store implementation, so better not set max_memory_to_use ourselves. */ /* See https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162 */ if (*Tjpeg_memory_mgr)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fmem)).Fmax_memory_to_use > 0 { /* This is to address bug related in ticket GDAL #1795. */ if libc.Xgetenv(tls, __ccgo_ts+9406) == libc.UintptrFromInt32(0) { /* Increase the max memory usable. This helps when creating files */ /* with "big" tile, without using libjpeg temporary files. */ /* For example a 512x512 tile with 3 bands */ /* requires 1.5 MB which is above libjpeg 1MB default */ if (*Tjpeg_memory_mgr)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fmem)).Fmax_memory_to_use < libc.Int32FromInt32(10)*libc.Int32FromInt32(1024)*libc.Int32FromInt32(1024) { (*Tjpeg_memory_mgr)(unsafe.Pointer((*TJPEGState)(unsafe.Pointer(sp)).Fcinfo.Fc.Fmem)).Fmax_memory_to_use = libc.Int32FromInt32(10) * libc.Int32FromInt32(1024) * libc.Int32FromInt32(1024) } } } } (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo_initialized = int32(TRUE) return int32(1) } // C documentation // // /* Common to tif_jpeg.c and tif_jpeg_12.c */ func _TIFFInitJPEGCommon(tls *libc.TLS, tif uintptr) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data (*TJPEGState)(unsafe.Pointer(sp)).Ftif = tif /* back link */ /* Default values for codec-specific fields */ (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables = libc.UintptrFromInt32(0) (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length = uint32(0) (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegquality = int32(75) /* Default IJG quality */ (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegcolormode = JPEGCOLORMODE_RAW1 (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtablesmode = libc.Int32FromInt32(JPEGTABLESMODE_QUANT1) | libc.Int32FromInt32(JPEGTABLESMODE_HUFF1) (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fycbcrsampling_fetched = 0 (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield = __ccgo_fp(_JPEGVGetField) /* hook for codec tags */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield = __ccgo_fp(_JPEGVSetField) /* hook for codec tags */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir = __ccgo_fp(_JPEGPrintDir) /* hook for codec tags */ /* * Install codec methods. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_fixuptags = __ccgo_fp(_JPEGFixupTags) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode = __ccgo_fp(_JPEGSetupDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_predecode = __ccgo_fp(_JPEGPreDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_JPEGDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_JPEGDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_JPEGDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode = __ccgo_fp(_JPEGSetupEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_preencode = __ccgo_fp(_JPEGPreEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode = __ccgo_fp(_JPEGPostEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_JPEGEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_JPEGEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_JPEGEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup = __ccgo_fp(_JPEGCleanup) (*TTIFF)(unsafe.Pointer(tif)).Ftif_defstripsize = __ccgo_fp(_JPEGDefaultStripSize) (*TTIFF)(unsafe.Pointer(tif)).Ftif_deftilesize = __ccgo_fp(_JPEGDefaultTileSize) *(*Tuint32_t)(unsafe.Pointer(tif + 12)) |= uint32(0x00100) /* no bit reversal, please */ (*TJPEGState)(unsafe.Pointer(sp)).Fcinfo_initialized = FALSE } func XTkimgTIFFInitJpeg(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { var sp uintptr _ = sp _ = scheme /* * Merge codec-specific tag information. */ if !((*(*func(*libc.TLS, uintptr, uintptr, Tuint32_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFMergeFieldsPtr})))(tls, tif, uintptr(unsafe.Pointer(&_jpegFields)), libc.Uint32FromInt64(144)/libc.Uint32FromInt64(36)) != 0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, __ccgo_ts+55332, __ccgo_ts+55345, 0) return 0 } /* * Allocate state block so tag methods have storage to record values. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_data = XTkimgTIFFmalloc(tls, int32(1200)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_data == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, __ccgo_ts+55332, __ccgo_ts+55385, 0) return 0 } (*(*func(*libc.TLS, Ttdata_t, int32, Ttsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFmemsetPtr})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_data, 0, int32(1200)) sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* * Override parent get/set field methods. */ (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fvgetparent = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fvsetparent = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fprintdir = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fprintdir (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fdefsparent = (*TTIFF)(unsafe.Pointer(tif)).Ftif_defstripsize (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fdeftparent = (*TTIFF)(unsafe.Pointer(tif)).Ftif_deftilesize _TIFFInitJPEGCommon(tls, tif) /* ** Create a JPEGTables field if no directory has yet been created. ** We do this just to ensure that sufficient space is reserved for ** the JPEGTables field. It will be properly created the right ** size later. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_diroff == uint64(0) { /* The following line assumes incorrectly that all JPEG-in-TIFF files will have a JPEGTABLES tag generated and causes null-filled JPEGTABLES tags to be written when the JPEG data is placed with TIFFWriteRawStrip. The field bit should be set, anyway, later when actual JPEGTABLES header is generated, so removing it here hopefully is harmless. TIFFSetFieldBit(tif, FIELD_JPEGTABLES); */ (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length = uint32(2000) (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables = XTkimgTIFFmalloc(tls, libc.Int32FromUint32((*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables_length)) if (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables != 0 { (*(*func(*libc.TLS, Ttdata_t, int32, Ttsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFmemsetPtr})))(tls, (*TJPEGState)(unsafe.Pointer(sp)).FotherSettings.Fjpegtables, 0, int32(2000)) } else { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, __ccgo_ts+55332, __ccgo_ts+55415, 0) return 0 } } return int32(1) } const JPEGCOLORMODE_RAW2 = 0x0000 const JPEGCOLORMODE_RGB4 = 0x0001 const JPEGTABLESMODE_HUFF2 = 0x0002 const JPEGTABLESMODE_QUANT2 = 0x0001 const JPEG_EOI5 = 0xD9 const TIFF_ANY6 = "TIFF_NOTYPE" const TIFF_DIRTYDIRECT8 = 0x00008 const TIFF_ISTILED10 = 0x00400 const TIFF_NOBITREV8 = 0x00100 const TIFF_UPSAMPLED10 = 0x04000 const UINT_MAX7 = 4294967295 var _sImageFormatVersion35 = TTk_PhotoImageFormatVersion3{ Fname: __ccgo_ts + 55457, } func init() { p := unsafe.Pointer(&_sImageFormatVersion35) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatchVersion35) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatchVersion35) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileReadVersion35) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringReadVersion35) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWriteVersion35) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWriteVersion35) } /* *---------------------------------------------------------------------------- * * Tkimgtiff_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgtiff_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)< (*Ttkimg_Stream)(unsafe.Pointer(handle)).Flength { /* Avoid unsigned underflow. */ if (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition > (*Ttkimg_Stream)(unsafe.Pointer(handle)).Flength { size = 0 } else { size = (*Ttkimg_Stream)(unsafe.Pointer(handle)).Flength - (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition } } if size != 0 { libc.Xmemcpy(tls, data, (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fdata+uintptr((*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition), libc.Uint32FromInt32(size)) *(*TTcl_Size)(unsafe.Pointer(handle + 16)) += size } return size } func _writeString(tls *libc.TLS, fd Tthandle_t, data Ttdata_t, size Ttsize_t) (r Ttsize_t) { var destPtr, handle uintptr _, _ = destPtr, handle handle = fd destPtr = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBytesFromObj})))(tls, libc.UintptrFromInt32(0), (*Ttkimg_Stream)(unsafe.Pointer(handle)).FbyteObj, libc.UintptrFromInt32(0)) if (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition+size > (*Ttkimg_Stream)(unsafe.Pointer(handle)).Flength { (*Ttkimg_Stream)(unsafe.Pointer(handle)).Flength = (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition + size destPtr = (*(*func(*libc.TLS, uintptr, TTcl_Size) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetByteArrayLength})))(tls, (*Ttkimg_Stream)(unsafe.Pointer(handle)).FbyteObj, (*Ttkimg_Stream)(unsafe.Pointer(handle)).Flength) } libc.Xmemcpy(tls, destPtr+uintptr((*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition), data, libc.Uint32FromInt32(size)) *(*TTcl_Size)(unsafe.Pointer(handle + 16)) += size return size } func _seekString(tls *libc.TLS, fd Tthandle_t, off Ttoff_t, whence int32) (r Ttoff_t) { var handle uintptr _ = handle handle = fd switch whence { case 0: (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition = libc.Int32FromUint64(off) case int32(1): *(*TTcl_Size)(unsafe.Pointer(handle + 16)) += libc.Int32FromUint64(off) case int32(2): (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition = (*Ttkimg_Stream)(unsafe.Pointer(handle)).Flength + libc.Int32FromUint64(off) break } if (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition < 0 { (*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition = 0 return libc.Uint64FromInt32(-libc.Int32FromInt32(1)) } return libc.Uint64FromInt32((*Ttkimg_Stream)(unsafe.Pointer(handle)).Fposition) } func _sizeString(tls *libc.TLS, fd Tthandle_t) (r Ttoff_t) { return libc.Uint64FromInt32((*Ttkimg_Stream)(unsafe.Pointer(fd)).Flength) } func _FileMatchVersion35(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(96) defer tls.Free(96) var pageIndex, retVal int32 var tif uintptr var _ /* handle at bp+52 */ Ttkimg_Stream var _ /* numPages at bp+48 */ int32 var _ /* opts at bp+0 */ TFMTOPT12 var _ /* xdpi at bp+32 */ float64 var _ /* ydpi at bp+40 */ float64 _, _, _ = pageIndex, retVal, tif retVal = int32(1) pageIndex = 0 libc.Xmemset(tls, bp+52, 0, uint32(40)) if _ParseFormatOpts14(tls, interp, format, bp, libc.Int32FromInt32(1)<= float64(0) && *(*float64)(unsafe.Pointer(bp + 40)) >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, *(*float64)(unsafe.Pointer(bp + 32)), *(*float64)(unsafe.Pointer(bp + 40))) { retVal = 0 } } if retVal != 0 && *(*int32)(unsafe.Pointer(bp + 48)) >= int32(1) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetNumPagesPtr})))(tls, metadataOut, *(*int32)(unsafe.Pointer(bp + 48))) { retVal = 0 } } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFClose})))(tls, tif) } else { retVal = 0 } if _errorMessage != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, _errorMessage) _errorMessage = libc.UintptrFromInt32(0) } return retVal } func _StringMatchVersion35(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, widthPtr uintptr, heightPtr uintptr, metadataOut uintptr) (r int32) { bp := tls.Alloc(96) defer tls.Free(96) var pageIndex, retVal int32 var tif uintptr var _ /* handle at bp+52 */ Ttkimg_Stream var _ /* numPages at bp+48 */ int32 var _ /* opts at bp+0 */ TFMTOPT12 var _ /* xdpi at bp+32 */ float64 var _ /* ydpi at bp+40 */ float64 _, _, _ = pageIndex, retVal, tif retVal = int32(1) pageIndex = 0 libc.Xmemset(tls, bp+52, 0, uint32(40)) if _ParseFormatOpts14(tls, interp, format, bp, libc.Int32FromInt32(1)<= float64(0) && *(*float64)(unsafe.Pointer(bp + 40)) >= float64(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, *(*float64)(unsafe.Pointer(bp + 32)), *(*float64)(unsafe.Pointer(bp + 40))) { return 0 } } if retVal != 0 && *(*int32)(unsafe.Pointer(bp + 48)) >= int32(1) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetNumPagesPtr})))(tls, metadataOut, *(*int32)(unsafe.Pointer(bp + 48))) { retVal = 0 } } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFClose})))(tls, tif) } else { retVal = 0 } if _errorMessage != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, _errorMessage) _errorMessage = libc.UintptrFromInt32(0) } return retVal } func _CommonMatch12(tls *libc.TLS, tif uintptr, handle uintptr, widthPtr uintptr, heightPtr uintptr, xdpiPtr uintptr, ydpiPtr uintptr, numPagesPtr uintptr, pageIndex int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var curIndex, v1 int32 var numPages Tuint16_t var _ /* h at bp+4 */ Tuint32_t var _ /* resUnit at bp+16 */ Tuint16_t var _ /* w at bp+0 */ Tuint32_t var _ /* xres at bp+8 */ float32 var _ /* yres at bp+12 */ float32 _, _, _ = curIndex, numPages, v1 *(*float32)(unsafe.Pointer(bp + 8)) = libc.Float32FromFloat32(0) *(*float32)(unsafe.Pointer(bp + 12)) = libc.Float32FromFloat32(0) numPages = uint16(0) curIndex = pageIndex for { v1 = curIndex curIndex-- if !(v1 != 0) { break } if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFReadDirectory})))(tls, tif) != int32(1) { return 0 } numPages++ } if int32(1) != (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFGetField})))(tls, tif, uint32(TIFFTAG_IMAGEWIDTH), libc.VaList(bp+32, bp)) || int32(1) != (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFGetField})))(tls, tif, uint32(TIFFTAG_IMAGELENGTH), libc.VaList(bp+32, bp+4)) { return 0 } if int32(1) != (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFGetField})))(tls, tif, uint32(TIFFTAG_RESOLUTIONUNIT), libc.VaList(bp+32, bp+16)) { *(*Tuint16_t)(unsafe.Pointer(bp + 16)) = uint16(RESUNIT_INCH) } if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 16))) == int32(RESUNIT_INCH) || libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 16))) == int32(RESUNIT_CENTIMETER) { if int32(1) != (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFGetField})))(tls, tif, uint32(TIFFTAG_XRESOLUTION), libc.VaList(bp+32, bp+8)) || int32(1) != (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFGetField})))(tls, tif, uint32(TIFFTAG_YRESOLUTION), libc.VaList(bp+32, bp+12)) { *(*float32)(unsafe.Pointer(bp + 8)) = -libc.Float32FromFloat32(1) *(*float32)(unsafe.Pointer(bp + 12)) = -libc.Float32FromFloat32(1) } else { if libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(bp + 16))) == int32(RESUNIT_CENTIMETER) { *(*float32)(unsafe.Pointer(bp + 8)) *= libc.Float32FromFloat32(2.54) *(*float32)(unsafe.Pointer(bp + 12)) *= libc.Float32FromFloat32(2.54) } } } if *(*float32)(unsafe.Pointer(bp + 8)) == libc.Float32FromFloat32(0) { *(*float32)(unsafe.Pointer(bp + 8)) = -libc.Float32FromFloat32(1) } if *(*float32)(unsafe.Pointer(bp + 12)) == libc.Float32FromFloat32(0) { *(*float32)(unsafe.Pointer(bp + 12)) = -libc.Float32FromFloat32(1) } for cond := true; cond; cond = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFReadDirectory})))(tls, tif) != 0 { numPages++ } *(*int32)(unsafe.Pointer(widthPtr)) = libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp))) *(*int32)(unsafe.Pointer(heightPtr)) = libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp + 4))) *(*float64)(unsafe.Pointer(xdpiPtr)) = float64(*(*float32)(unsafe.Pointer(bp + 8))) *(*float64)(unsafe.Pointer(ydpiPtr)) = float64(*(*float32)(unsafe.Pointer(bp + 12))) *(*int32)(unsafe.Pointer(numPagesPtr)) = libc.Int32FromUint16(numPages) return int32(1) } func _FileReadVersion35(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var retVal int32 var tif uintptr var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = retVal, tif libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) tif = (*(*func(*libc.TLS, uintptr, uintptr, Tthandle_t, TTIFFReadWriteProc, TTIFFReadWriteProc, TTIFFSeekProc, TTIFFCloseProc, TTIFFSizeProc, TTIFFMapFileProc, TTIFFUnmapFileProc) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFClientOpen})))(tls, fileName, __ccgo_ts+48463, bp, __ccgo_fp(_readMFile), __ccgo_fp(_writeDummy), __ccgo_fp(_seekMFile), __ccgo_fp(_closeDummy), __ccgo_fp(_sizeMFile), __ccgo_fp(_mapDummy), __ccgo_fp(_unMapDummy)) if tif != 0 { retVal = _CommonRead14(tls, interp, tif, fileName, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFClose})))(tls, tif) } else { retVal = int32(TCL_ERROR) } if retVal == int32(TCL_ERROR) { if libc.Xstrlen(tls, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetObjResult})))(tls, interp), libc.UintptrFromInt32(0))) == uint32(0) && _errorMessage != 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+48, _errorMessage, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, _errorMessage) _errorMessage = libc.UintptrFromInt32(0) } } return retVal } func _StringReadVersion35(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, metadataIn uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var retVal int32 var tif uintptr var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = retVal, tif libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } tif = (*(*func(*libc.TLS, uintptr, uintptr, Tthandle_t, TTIFFReadWriteProc, TTIFFReadWriteProc, TTIFFSeekProc, TTIFFCloseProc, TTIFFSizeProc, TTIFFMapFileProc, TTIFFUnmapFileProc) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFClientOpen})))(tls, __ccgo_ts+3612, __ccgo_ts+48463, bp, __ccgo_fp(_readString), __ccgo_fp(_writeDummy), __ccgo_fp(_seekString), __ccgo_fp(_closeDummy), __ccgo_fp(_sizeString), __ccgo_fp(_mapDummy), __ccgo_fp(_unMapDummy)) if tif != 0 { retVal = _CommonRead14(tls, interp, tif, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY, metadataOut) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFClose})))(tls, tif) } else { retVal = int32(TCL_ERROR) } if retVal == int32(TCL_ERROR) { if libc.Xstrlen(tls, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetObjResult})))(tls, interp), libc.UintptrFromInt32(0))) == uint32(0) && _errorMessage != 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+48, _errorMessage, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, _errorMessage) _errorMessage = libc.UintptrFromInt32(0) } } return retVal } func _CommonRead14(tls *libc.TLS, interp uintptr, tif uintptr, fileName uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32, metadataOut uintptr) (r int32) { bp := tls.Alloc(112) defer tls.Free(112) var npixels Tsize_t var pageIndex, v1 int32 var raster uintptr var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* h at bp+40 */ Tuint32_t var _ /* opts at bp+56 */ TFMTOPT12 var _ /* resUnit at bp+52 */ Tuint16_t var _ /* w at bp+36 */ Tuint32_t var _ /* xres at bp+44 */ float32 var _ /* yres at bp+48 */ float32 _, _, _, _ = npixels, pageIndex, raster, v1 *(*float32)(unsafe.Pointer(bp + 44)) = libc.Float32FromFloat32(0) *(*float32)(unsafe.Pointer(bp + 48)) = libc.Float32FromFloat32(0) pageIndex = 0 if _ParseFormatOpts14(tls, interp, format, bp+56, libc.Int32FromInt32(1)<= libc.Float32FromFloat32(0) && *(*float32)(unsafe.Pointer(bp + 48)) >= libc.Float32FromFloat32(0) { if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, float64, float64) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_SetResolutionPtr})))(tls, metadataOut, float64(*(*float32)(unsafe.Pointer(bp + 44))), float64(*(*float32)(unsafe.Pointer(bp + 48)))) { return int32(TCL_ERROR) } } if (*(*TFMTOPT12)(unsafe.Pointer(bp + 56))).Fverbose != 0 { _printImgInfo13(tls, (*(*TFMTOPT12)(unsafe.Pointer(bp + 56))).FpageIndex, *(*Tuint32_t)(unsafe.Pointer(bp + 36)), *(*Tuint32_t)(unsafe.Pointer(bp + 40)), *(*float32)(unsafe.Pointer(bp + 44)), *(*float32)(unsafe.Pointer(bp + 48)), fileName, __ccgo_ts+881) } if npixels*uint32(4) >= uint32(0xffffffff) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+96, __ccgo_ts+55545, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } raster = XTkimgTIFFmalloc(tls, libc.Int32FromUint32(npixels*uint32(4))) if raster == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+96, __ccgo_ts+55566, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = width (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = height (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch = -((*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize * libc.Int32FromUint32(*(*Tuint32_t)(unsafe.Pointer(bp + 36)))) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = raster + uintptr((libc.Uint32FromInt32(1)-*(*Tuint32_t)(unsafe.Pointer(bp + 40)))*libc.Uint32FromInt32((*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch)) if !((*(*func(*libc.TLS, uintptr, Tuint32_t, Tuint32_t, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFReadRGBAImage})))(tls, tif, *(*Tuint32_t)(unsafe.Pointer(bp + 36)), *(*Tuint32_t)(unsafe.Pointer(bp + 40)), raster, 0) != 0) || _errorMessage != 0 { if _errorMessage != 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+96, _errorMessage, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, _errorMessage) _errorMessage = libc.UintptrFromInt32(0) } XTkimgTIFFfree(tls, raster) return int32(TCL_ERROR) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, width, height) == int32(TCL_ERROR) { XTkimgTIFFfree(tls, raster) return int32(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr += uintptr(srcY*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fpitch + srcX*(*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize) *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = *(*int32)(unsafe.Pointer(bp + 20)) /* don't use transparency */ if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, destY, width, height, int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { XTkimgTIFFfree(tls, raster) return int32(TCL_ERROR) } XTkimgTIFFfree(tls, raster) return TCL_OK } func _FileWriteVersion35(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, metadataIn uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(288) defer tls.Free(288) var fullname, tif, v1, v2 uintptr var result int32 var _ /* nameBuffer at bp+0 */ TTcl_DString var _ /* opts at bp+216 */ TFMTOPT12 _, _, _, _, _ = fullname, result, tif, v1, v2 v1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_TranslateFileName})))(tls, interp, fileName, bp) fullname = v1 if !(v1 != 0) { return int32(TCL_ERROR) } if _ParseFormatOpts14(tls, interp, format, bp+216, libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+40, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { /* No more parameters available. */ break } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)) + uintptr(i+int32(1))*4)), libc.UintptrFromInt32(0)) if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(optionStr))) == int32('-') { /* Next parameter is an option. */ break } if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+836, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT12)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 16)) i++ case 4: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+807, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT12)(unsafe.Pointer(opts)).Fxres = *(*float64)(unsafe.Pointer(bp + 16)) case 5: if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetDistanceValuePtr})))(tls, interp, optionStr, bp+16) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+40, __ccgo_ts+836, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*TFMTOPT12)(unsafe.Pointer(opts)).Fyres = *(*float64)(unsafe.Pointer(bp + 16)) break } } goto _1 _1: ; i++ } return TCL_OK } var _readOptions14 = [3]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 3206, 2: libc.UintptrFromInt32(0), } var _writeOptions11 = [7]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 47998, 2: __ccgo_ts + 51193, 3: __ccgo_ts + 650, 4: __ccgo_ts + 662, 5: __ccgo_ts + 675, 6: libc.UintptrFromInt32(0), } func _CommonWrite11(tls *libc.TLS, interp uintptr, tif uintptr, fileName uintptr, opts uintptr, blockPtr uintptr, metadataIn uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var alphaOffset, blueOffset, greenOffset, numsamples, x, y, v2 int32 var data, dstPtr, rowPtr, srcPtr, v1, v10, v13, v5, v6, v7, v8, v9 uintptr var xres, yres float32 var _ /* xdpi at bp+0 */ float64 var _ /* ydpi at bp+8 */ float64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, data, dstPtr, greenOffset, numsamples, rowPtr, srcPtr, x, xres, y, yres, v1, v10, v13, v2, v5, v6, v7, v8, v9 data = libc.UintptrFromInt32(0) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_IMAGEWIDTH), libc.VaList(bp+24, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth)) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_IMAGELENGTH), libc.VaList(bp+24, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight)) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_COMPRESSION), libc.VaList(bp+24, (*TFMTOPT12)(unsafe.Pointer(opts)).Fcompression)) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_PLANARCONFIG), libc.VaList(bp+24, int32(PLANARCONFIG_CONTIG))) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_SAMPLESPERPIXEL), libc.VaList(bp+24, int32(1))) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_ORIENTATION), libc.VaList(bp+24, int32(ORIENTATION_TOPLEFT))) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_ROWSPERSTRIP), libc.VaList(bp+24, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight)) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_RESOLUTIONUNIT), libc.VaList(bp+24, int32(RESUNIT_INCH))) if int32(TCL_ERROR) == (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_GetResolutionPtr})))(tls, interp, metadataIn, bp, bp+8) { return int32(TCL_ERROR) } if (*TFMTOPT12)(unsafe.Pointer(opts)).Fxres != libc.Float64FromInt32(IMG_DEFAULT_DPI) && (*TFMTOPT12)(unsafe.Pointer(opts)).Fyres != libc.Float64FromInt32(IMG_DEFAULT_DPI) { /* Resolution values specified in the format string (-xresolution, -yresolution) overwrite the values specified with option -metadata. */ *(*float64)(unsafe.Pointer(bp)) = float64(float32((*TFMTOPT12)(unsafe.Pointer(opts)).Fxres)) *(*float64)(unsafe.Pointer(bp + 8)) = float64(float32((*TFMTOPT12)(unsafe.Pointer(opts)).Fyres)) } xres = float32(*(*float64)(unsafe.Pointer(bp))) yres = float32(*(*float64)(unsafe.Pointer(bp + 8))) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_XRESOLUTION), libc.VaList(bp+24, float64(xres))) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_YRESOLUTION), libc.VaList(bp+24, float64(yres))) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_BITSPERSAMPLE), libc.VaList(bp+24, int32(8))) if *(*int32)(unsafe.Pointer(blockPtr + 20)) == *(*int32)(unsafe.Pointer(blockPtr + 20 + 1*4)) && *(*int32)(unsafe.Pointer(blockPtr + 20)) == *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) { numsamples = int32(1) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_SAMPLESPERPIXEL), libc.VaList(bp+24, int32(1))) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_PHOTOMETRIC), libc.VaList(bp+24, int32(PHOTOMETRIC_MINISBLACK))) } else { numsamples = int32(3) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_SAMPLESPERPIXEL), libc.VaList(bp+24, int32(3))) (*(*func(*libc.TLS, uintptr, Tttag_t, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSetField})))(tls, tif, uint32(TIFFTAG_PHOTOMETRIC), libc.VaList(bp+24, int32(PHOTOMETRIC_RGB))) } if (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch == numsamples*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth && (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize == numsamples { data = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr } else { v1 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(numsamples*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight)) data = v1 dstPtr = v1 if dstPtr == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+24, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } rowPtr = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr + uintptr(*(*int32)(unsafe.Pointer(blockPtr + 20))) greenOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 1*4)) - *(*int32)(unsafe.Pointer(blockPtr + 20)) blueOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) - *(*int32)(unsafe.Pointer(blockPtr + 20)) alphaOffset = *(*int32)(unsafe.Pointer(blockPtr + 20)) if alphaOffset < *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) { alphaOffset = *(*int32)(unsafe.Pointer(blockPtr + 20 + 2*4)) } alphaOffset++ v2 = alphaOffset if v2 < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize { alphaOffset -= *(*int32)(unsafe.Pointer(blockPtr + 20)) } else { alphaOffset = 0 } if blueOffset != 0 || greenOffset != 0 { y = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight for { if !(y > 0) { break } srcPtr = rowPtr x = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth for { if !(x > 0) { break } if alphaOffset != 0 && !(*(*uint8)(unsafe.Pointer(srcPtr + uintptr(alphaOffset))) != 0) { v5 = dstPtr dstPtr++ *(*uint8)(unsafe.Pointer(v5)) = uint8(0xd9) v6 = dstPtr dstPtr++ *(*uint8)(unsafe.Pointer(v6)) = uint8(0xd9) v7 = dstPtr dstPtr++ *(*uint8)(unsafe.Pointer(v7)) = uint8(0xd9) } else { v8 = dstPtr dstPtr++ *(*uint8)(unsafe.Pointer(v8)) = *(*uint8)(unsafe.Pointer(srcPtr)) v9 = dstPtr dstPtr++ *(*uint8)(unsafe.Pointer(v9)) = *(*uint8)(unsafe.Pointer(srcPtr + uintptr(greenOffset))) v10 = dstPtr dstPtr++ *(*uint8)(unsafe.Pointer(v10)) = *(*uint8)(unsafe.Pointer(srcPtr + uintptr(blueOffset))) } srcPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) goto _4 _4: ; x-- } rowPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) goto _3 _3: ; y-- } } else { y = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight for { if !(y > 0) { break } srcPtr = rowPtr x = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth for { if !(x > 0) { break } v13 = dstPtr dstPtr++ *(*uint8)(unsafe.Pointer(v13)) = *(*uint8)(unsafe.Pointer(srcPtr)) srcPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) goto _12 _12: ; x-- } rowPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) goto _11 _11: ; y-- } } } (*(*func(*libc.TLS, uintptr, Ttstrip_t, Ttdata_t, Ttsize_t) Ttsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWriteEncodedStrip})))(tls, tif, uint32(0), data, numsamples*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth*(*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) if data != (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, data) } if (*TFMTOPT12)(unsafe.Pointer(opts)).Fverbose != 0 { _printImgInfo13(tls, -int32(1), libc.Uint32FromInt32((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth), libc.Uint32FromInt32((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight), xres, yres, fileName, __ccgo_ts+1132) } return TCL_OK } func XTkimgTIFFfree(tls *libc.TLS, data Ttdata_t) { if (*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFfreePtr != 0 { (*(*func(*libc.TLS, Ttdata_t))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFfreePtr})))(tls, data) } else { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, data) } } func XTkimgTIFFmalloc(tls *libc.TLS, size Ttsize_t) (r Ttdata_t) { if (*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFmallocPtr != 0 { return (*(*func(*libc.TLS, Ttsize_t) Ttdata_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFmallocPtr})))(tls, size) } else { return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(size)) } return r } func XTkimgTIFFrealloc(tls *libc.TLS, data Ttdata_t, size Ttsize_t) (r Ttdata_t) { if (*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFreallocPtr != 0 { return (*(*func(*libc.TLS, Ttdata_t, Ttsize_t) Ttdata_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFreallocPtr})))(tls, data, size) } else { return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptRealloc})))(tls, data, libc.Uint32FromInt32(size)) } return r } const CODE_MASK = 2047 const ONE = 1250 const O_RDONLY11 = 0 const PLSTATE_INIT = 1 const RATIO = 1.004 const SCALE12 = 2048 const TIFF_ANY7 = 0 const TIFF_ISTILED11 = 1024 const TIFF_SWAB7 = 128 const TSIZE = 2048 const TSIZEP1 = 2049 const UINT32_MAX12 = 4294967295 const UINT_MAX8 = 0xffffffff /* Tables for converting to/from 11 bit coded values */ var _Fltsize float32 var _LogK1 float32 var _LogK2 float32 func _horizontalAccumulateF(tls *libc.TLS, wp uintptr, n int32, stride int32, op uintptr, ToLinearF uintptr) { var ca, cb, cg, cr, mask, v1, v2, v3, v4, v5, v6, v7 uint32 var i, i1 int32 var t0, t1, t2, t3 float32 var p8 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ca, cb, cg, cr, i, i1, mask, t0, t1, t2, t3, v1, v2, v3, v4, v5, v6, v7, p8 if n >= stride { mask = uint32(CODE_MASK) if stride == int32(3) { v1 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask cr = v1 t0 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v1)*4)) v2 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) & mask cg = v2 t1 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v2)*4)) v3 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) & mask cb = v3 t2 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v3)*4)) *(*float32)(unsafe.Pointer(op)) = t0 *(*float32)(unsafe.Pointer(op + 1*4)) = t1 *(*float32)(unsafe.Pointer(op + 2*4)) = t2 n -= int32(3) for n > 0 { wp += uintptr(3) * 2 op += uintptr(3) * 4 n -= int32(3) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) t0 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cr&mask)*4)) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) t1 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cg&mask)*4)) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) t2 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cb&mask)*4)) *(*float32)(unsafe.Pointer(op)) = t0 *(*float32)(unsafe.Pointer(op + 1*4)) = t1 *(*float32)(unsafe.Pointer(op + 2*4)) = t2 } } else { if stride == int32(4) { v4 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask cr = v4 t0 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v4)*4)) v5 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) & mask cg = v5 t1 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v5)*4)) v6 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) & mask cb = v6 t2 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v6)*4)) v7 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) & mask ca = v7 t3 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v7)*4)) *(*float32)(unsafe.Pointer(op)) = t0 *(*float32)(unsafe.Pointer(op + 1*4)) = t1 *(*float32)(unsafe.Pointer(op + 2*4)) = t2 *(*float32)(unsafe.Pointer(op + 3*4)) = t3 n -= int32(4) for n > 0 { wp += uintptr(4) * 2 op += uintptr(4) * 4 n -= int32(4) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) t0 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cr&mask)*4)) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) t1 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cg&mask)*4)) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) t2 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cb&mask)*4)) ca += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) t3 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(ca&mask)*4)) *(*float32)(unsafe.Pointer(op)) = t0 *(*float32)(unsafe.Pointer(op + 1*4)) = t1 *(*float32)(unsafe.Pointer(op + 2*4)) = t2 *(*float32)(unsafe.Pointer(op + 3*4)) = t3 } } else { i = stride for cond := true; cond; cond = i > 0 { i-- *(*float32)(unsafe.Pointer(op)) = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))&mask)*4)) wp += 2 op += 4 } n -= stride for n > 0 { i1 = stride for cond := true; cond; cond = i1 > 0 { i1-- p8 = wp + uintptr(stride)*2 *(*Tuint16_t)(unsafe.Pointer(p8)) = Tuint16_t(int32(*(*Tuint16_t)(unsafe.Pointer(p8))) + libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(wp)))) *(*float32)(unsafe.Pointer(op)) = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))&mask)*4)) wp += 2 op += 4 } n -= stride } } } } } func _horizontalAccumulate12(tls *libc.TLS, wp uintptr, n int32, stride int32, op uintptr, ToLinearF uintptr) { var ca, cb, cg, cr, mask, v1, v10, v11, v12, v13, v2, v3 uint32 var i, i1, v14, v15, v16, v17, v18, v19, v20, v21, v22, v24, v4, v5, v6, v7, v8, v9 int32 var t0, t1, t2, t3 float32 var p23 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ca, cb, cg, cr, i, i1, mask, t0, t1, t2, t3, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v24, v3, v4, v5, v6, v7, v8, v9, p23 if n >= stride { mask = uint32(CODE_MASK) if stride == int32(3) { v1 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask cr = v1 t0 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v1)*4)) * libc.Float32FromFloat32(2048) v2 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) & mask cg = v2 t1 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v2)*4)) * libc.Float32FromFloat32(2048) v3 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) & mask cb = v3 t2 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v3)*4)) * libc.Float32FromFloat32(2048) if t0 < libc.Float32FromInt32(3071) { v4 = libc.Int32FromUint16(uint16(t0)) } else { v4 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op)) = int16(v4) if t1 < libc.Float32FromInt32(3071) { v5 = libc.Int32FromUint16(uint16(t1)) } else { v5 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op + 1*2)) = int16(v5) if t2 < libc.Float32FromInt32(3071) { v6 = libc.Int32FromUint16(uint16(t2)) } else { v6 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op + 2*2)) = int16(v6) n -= int32(3) for n > 0 { wp += uintptr(3) * 2 op += uintptr(3) * 2 n -= int32(3) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) t0 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cr&mask)*4)) * libc.Float32FromFloat32(2048) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) t1 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cg&mask)*4)) * libc.Float32FromFloat32(2048) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) t2 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cb&mask)*4)) * libc.Float32FromFloat32(2048) if t0 < libc.Float32FromInt32(3071) { v7 = libc.Int32FromUint16(uint16(t0)) } else { v7 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op)) = int16(v7) if t1 < libc.Float32FromInt32(3071) { v8 = libc.Int32FromUint16(uint16(t1)) } else { v8 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op + 1*2)) = int16(v8) if t2 < libc.Float32FromInt32(3071) { v9 = libc.Int32FromUint16(uint16(t2)) } else { v9 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op + 2*2)) = int16(v9) } } else { if stride == int32(4) { v10 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask cr = v10 t0 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v10)*4)) * libc.Float32FromFloat32(2048) v11 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) & mask cg = v11 t1 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v11)*4)) * libc.Float32FromFloat32(2048) v12 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) & mask cb = v12 t2 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v12)*4)) * libc.Float32FromFloat32(2048) v13 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) & mask ca = v13 t3 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v13)*4)) * libc.Float32FromFloat32(2048) if t0 < libc.Float32FromInt32(3071) { v14 = libc.Int32FromUint16(uint16(t0)) } else { v14 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op)) = int16(v14) if t1 < libc.Float32FromInt32(3071) { v15 = libc.Int32FromUint16(uint16(t1)) } else { v15 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op + 1*2)) = int16(v15) if t2 < libc.Float32FromInt32(3071) { v16 = libc.Int32FromUint16(uint16(t2)) } else { v16 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op + 2*2)) = int16(v16) if t3 < libc.Float32FromInt32(3071) { v17 = libc.Int32FromUint16(uint16(t3)) } else { v17 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op + 3*2)) = int16(v17) n -= int32(4) for n > 0 { wp += uintptr(4) * 2 op += uintptr(4) * 2 n -= int32(4) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) t0 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cr&mask)*4)) * libc.Float32FromFloat32(2048) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) t1 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cg&mask)*4)) * libc.Float32FromFloat32(2048) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) t2 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(cb&mask)*4)) * libc.Float32FromFloat32(2048) ca += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) t3 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(ca&mask)*4)) * libc.Float32FromFloat32(2048) if t0 < libc.Float32FromInt32(3071) { v18 = libc.Int32FromUint16(uint16(t0)) } else { v18 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op)) = int16(v18) if t1 < libc.Float32FromInt32(3071) { v19 = libc.Int32FromUint16(uint16(t1)) } else { v19 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op + 1*2)) = int16(v19) if t2 < libc.Float32FromInt32(3071) { v20 = libc.Int32FromUint16(uint16(t2)) } else { v20 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op + 2*2)) = int16(v20) if t3 < libc.Float32FromInt32(3071) { v21 = libc.Int32FromUint16(uint16(t3)) } else { v21 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op + 3*2)) = int16(v21) } } else { i = stride for cond := true; cond; cond = i > 0 { i-- t0 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))&mask)*4)) * libc.Float32FromFloat32(2048) if t0 < libc.Float32FromInt32(3071) { v22 = libc.Int32FromUint16(uint16(t0)) } else { v22 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op)) = int16(v22) wp += 2 op += 2 } n -= stride for n > 0 { i1 = stride for cond := true; cond; cond = i1 > 0 { i1-- p23 = wp + uintptr(stride)*2 *(*Tuint16_t)(unsafe.Pointer(p23)) = Tuint16_t(int32(*(*Tuint16_t)(unsafe.Pointer(p23))) + libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(wp)))) t0 = *(*float32)(unsafe.Pointer(ToLinearF + uintptr(uint32(*(*Tuint16_t)(unsafe.Pointer(wp + uintptr(stride)*2)))&mask)*4)) * libc.Float32FromFloat32(2048) if t0 < libc.Float32FromInt32(3071) { v24 = libc.Int32FromUint16(uint16(t0)) } else { v24 = int32(3071) } *(*Tint16_t)(unsafe.Pointer(op)) = int16(v24) wp += 2 op += 2 } n -= stride } } } } } func _horizontalAccumulate16(tls *libc.TLS, wp uintptr, n int32, stride int32, op uintptr, ToLinear16 uintptr) { var ca, cb, cg, cr, mask, v1, v2, v3, v4, v5, v6, v7 uint32 var i, i1 int32 var p8 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ca, cb, cg, cr, i, i1, mask, v1, v2, v3, v4, v5, v6, v7, p8 if n >= stride { mask = uint32(CODE_MASK) if stride == int32(3) { v1 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask cr = v1 *(*Tuint16_t)(unsafe.Pointer(op)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(v1)*2)) v2 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) & mask cg = v2 *(*Tuint16_t)(unsafe.Pointer(op + 1*2)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(v2)*2)) v3 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) & mask cb = v3 *(*Tuint16_t)(unsafe.Pointer(op + 2*2)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(v3)*2)) n -= int32(3) for n > 0 { wp += uintptr(3) * 2 op += uintptr(3) * 2 n -= int32(3) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) *(*Tuint16_t)(unsafe.Pointer(op)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(cr&mask)*2)) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) *(*Tuint16_t)(unsafe.Pointer(op + 1*2)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(cg&mask)*2)) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) *(*Tuint16_t)(unsafe.Pointer(op + 2*2)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(cb&mask)*2)) } } else { if stride == int32(4) { v4 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask cr = v4 *(*Tuint16_t)(unsafe.Pointer(op)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(v4)*2)) v5 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) & mask cg = v5 *(*Tuint16_t)(unsafe.Pointer(op + 1*2)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(v5)*2)) v6 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) & mask cb = v6 *(*Tuint16_t)(unsafe.Pointer(op + 2*2)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(v6)*2)) v7 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) & mask ca = v7 *(*Tuint16_t)(unsafe.Pointer(op + 3*2)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(v7)*2)) n -= int32(4) for n > 0 { wp += uintptr(4) * 2 op += uintptr(4) * 2 n -= int32(4) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) *(*Tuint16_t)(unsafe.Pointer(op)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(cr&mask)*2)) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) *(*Tuint16_t)(unsafe.Pointer(op + 1*2)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(cg&mask)*2)) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) *(*Tuint16_t)(unsafe.Pointer(op + 2*2)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(cb&mask)*2)) ca += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) *(*Tuint16_t)(unsafe.Pointer(op + 3*2)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(ca&mask)*2)) } } else { i = stride for cond := true; cond; cond = i > 0 { i-- *(*Tuint16_t)(unsafe.Pointer(op)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))&mask)*2)) wp += 2 op += 2 } n -= stride for n > 0 { i1 = stride for cond := true; cond; cond = i1 > 0 { i1-- p8 = wp + uintptr(stride)*2 *(*Tuint16_t)(unsafe.Pointer(p8)) = Tuint16_t(int32(*(*Tuint16_t)(unsafe.Pointer(p8))) + libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(wp)))) *(*Tuint16_t)(unsafe.Pointer(op)) = *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))&mask)*2)) wp += 2 op += 2 } n -= stride } } } } } // C documentation // // /* // * Returns the log encoded 11-bit values with the horizontal // * differencing undone. // */ func _horizontalAccumulate11(tls *libc.TLS, wp uintptr, n int32, stride int32, op uintptr) { var ca, cb, cg, cr, mask uint32 var i, i1 int32 var p1 uintptr _, _, _, _, _, _, _, _ = ca, cb, cg, cr, i, i1, mask, p1 if n >= stride { mask = uint32(CODE_MASK) if stride == int32(3) { *(*Tuint16_t)(unsafe.Pointer(op)) = *(*Tuint16_t)(unsafe.Pointer(wp)) *(*Tuint16_t)(unsafe.Pointer(op + 1*2)) = *(*Tuint16_t)(unsafe.Pointer(wp + 1*2)) *(*Tuint16_t)(unsafe.Pointer(op + 2*2)) = *(*Tuint16_t)(unsafe.Pointer(wp + 2*2)) cr = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) cg = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) cb = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) n -= int32(3) for n > 0 { wp += uintptr(3) * 2 op += uintptr(3) * 2 n -= int32(3) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) *(*Tuint16_t)(unsafe.Pointer(op)) = uint16(cr & mask) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) *(*Tuint16_t)(unsafe.Pointer(op + 1*2)) = uint16(cg & mask) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) *(*Tuint16_t)(unsafe.Pointer(op + 2*2)) = uint16(cb & mask) } } else { if stride == int32(4) { *(*Tuint16_t)(unsafe.Pointer(op)) = *(*Tuint16_t)(unsafe.Pointer(wp)) *(*Tuint16_t)(unsafe.Pointer(op + 1*2)) = *(*Tuint16_t)(unsafe.Pointer(wp + 1*2)) *(*Tuint16_t)(unsafe.Pointer(op + 2*2)) = *(*Tuint16_t)(unsafe.Pointer(wp + 2*2)) *(*Tuint16_t)(unsafe.Pointer(op + 3*2)) = *(*Tuint16_t)(unsafe.Pointer(wp + 3*2)) cr = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) cg = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) cb = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) ca = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) n -= int32(4) for n > 0 { wp += uintptr(4) * 2 op += uintptr(4) * 2 n -= int32(4) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) *(*Tuint16_t)(unsafe.Pointer(op)) = uint16(cr & mask) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) *(*Tuint16_t)(unsafe.Pointer(op + 1*2)) = uint16(cg & mask) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) *(*Tuint16_t)(unsafe.Pointer(op + 2*2)) = uint16(cb & mask) ca += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) *(*Tuint16_t)(unsafe.Pointer(op + 3*2)) = uint16(ca & mask) } } else { i = stride for cond := true; cond; cond = i > 0 { i-- *(*Tuint16_t)(unsafe.Pointer(op)) = uint16(uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask) wp += 2 op += 2 } n -= stride for n > 0 { i1 = stride for cond := true; cond; cond = i1 > 0 { i1-- p1 = wp + uintptr(stride)*2 *(*Tuint16_t)(unsafe.Pointer(p1)) = Tuint16_t(int32(*(*Tuint16_t)(unsafe.Pointer(p1))) + libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(wp)))) *(*Tuint16_t)(unsafe.Pointer(op)) = uint16(uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask) wp += 2 op += 2 } n -= stride } } } } } func _horizontalAccumulate8(tls *libc.TLS, wp uintptr, n int32, stride int32, op uintptr, ToLinear8 uintptr) { var ca, cb, cg, cr, mask, v1, v2, v3, v4, v5, v6, v7 uint32 var i, i1 int32 var p8 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ca, cb, cg, cr, i, i1, mask, v1, v2, v3, v4, v5, v6, v7, p8 if n >= stride { mask = uint32(CODE_MASK) if stride == int32(3) { v1 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask cr = v1 *(*uint8)(unsafe.Pointer(op)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v1))) v2 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) & mask cg = v2 *(*uint8)(unsafe.Pointer(op + 1)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v2))) v3 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) & mask cb = v3 *(*uint8)(unsafe.Pointer(op + 2)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v3))) n -= int32(3) for n > 0 { n -= int32(3) wp += uintptr(3) * 2 op += uintptr(3) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) *(*uint8)(unsafe.Pointer(op)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cr&mask))) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) *(*uint8)(unsafe.Pointer(op + 1)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cg&mask))) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) *(*uint8)(unsafe.Pointer(op + 2)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cb&mask))) } } else { if stride == int32(4) { v4 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask cr = v4 *(*uint8)(unsafe.Pointer(op)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v4))) v5 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) & mask cg = v5 *(*uint8)(unsafe.Pointer(op + 1)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v5))) v6 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) & mask cb = v6 *(*uint8)(unsafe.Pointer(op + 2)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v6))) v7 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) & mask ca = v7 *(*uint8)(unsafe.Pointer(op + 3)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v7))) n -= int32(4) for n > 0 { n -= int32(4) wp += uintptr(4) * 2 op += uintptr(4) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) *(*uint8)(unsafe.Pointer(op)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cr&mask))) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) *(*uint8)(unsafe.Pointer(op + 1)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cg&mask))) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) *(*uint8)(unsafe.Pointer(op + 2)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cb&mask))) ca += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) *(*uint8)(unsafe.Pointer(op + 3)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(ca&mask))) } } else { i = stride for cond := true; cond; cond = i > 0 { i-- *(*uint8)(unsafe.Pointer(op)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))&mask))) wp += 2 op++ } n -= stride for n > 0 { i1 = stride for cond := true; cond; cond = i1 > 0 { i1-- p8 = wp + uintptr(stride)*2 *(*Tuint16_t)(unsafe.Pointer(p8)) = Tuint16_t(int32(*(*Tuint16_t)(unsafe.Pointer(p8))) + libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(wp)))) *(*uint8)(unsafe.Pointer(op)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))&mask))) wp += 2 op++ } n -= stride } } } } } func _horizontalAccumulate8abgr(tls *libc.TLS, wp uintptr, n int32, stride int32, op uintptr, ToLinear8 uintptr) { var ca, cb, cg, cr, mask, v1, v2, v3, v4, v5, v6, v7 uint32 var i, i1 int32 var t0, t1, t2, t3 uint8 var p8 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ca, cb, cg, cr, i, i1, mask, t0, t1, t2, t3, v1, v2, v3, v4, v5, v6, v7, p8 if n >= stride { mask = uint32(CODE_MASK) if stride == int32(3) { *(*uint8)(unsafe.Pointer(op)) = uint8(0) v1 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) & mask cb = v1 t1 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v1))) v2 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) & mask cg = v2 t2 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v2))) v3 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask cr = v3 t3 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v3))) *(*uint8)(unsafe.Pointer(op + 1)) = t1 *(*uint8)(unsafe.Pointer(op + 2)) = t2 *(*uint8)(unsafe.Pointer(op + 3)) = t3 n -= int32(3) for n > 0 { n -= int32(3) wp += uintptr(3) * 2 op += uintptr(4) *(*uint8)(unsafe.Pointer(op)) = uint8(0) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) t1 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cb&mask))) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) t2 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cg&mask))) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) t3 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cr&mask))) *(*uint8)(unsafe.Pointer(op + 1)) = t1 *(*uint8)(unsafe.Pointer(op + 2)) = t2 *(*uint8)(unsafe.Pointer(op + 3)) = t3 } } else { if stride == int32(4) { v4 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) & mask ca = v4 t0 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v4))) v5 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) & mask cb = v5 t1 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v5))) v6 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) & mask cg = v6 t2 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v6))) v7 = uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) & mask cr = v7 t3 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(v7))) *(*uint8)(unsafe.Pointer(op)) = t0 *(*uint8)(unsafe.Pointer(op + 1)) = t1 *(*uint8)(unsafe.Pointer(op + 2)) = t2 *(*uint8)(unsafe.Pointer(op + 3)) = t3 n -= int32(4) for n > 0 { n -= int32(4) wp += uintptr(4) * 2 op += uintptr(4) ca += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 3*2))) t0 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(ca&mask))) cb += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 2*2))) t1 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cb&mask))) cg += uint32(*(*Tuint16_t)(unsafe.Pointer(wp + 1*2))) t2 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cg&mask))) cr += uint32(*(*Tuint16_t)(unsafe.Pointer(wp))) t3 = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(cr&mask))) *(*uint8)(unsafe.Pointer(op)) = t0 *(*uint8)(unsafe.Pointer(op + 1)) = t1 *(*uint8)(unsafe.Pointer(op + 2)) = t2 *(*uint8)(unsafe.Pointer(op + 3)) = t3 } } else { i = stride for cond := true; cond; cond = i > 0 { i-- *(*uint8)(unsafe.Pointer(op)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))&mask))) wp += 2 op++ } n -= stride for n > 0 { i1 = stride for cond := true; cond; cond = i1 > 0 { i1-- p8 = wp + uintptr(stride)*2 *(*Tuint16_t)(unsafe.Pointer(p8)) = Tuint16_t(int32(*(*Tuint16_t)(unsafe.Pointer(p8))) + libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(wp)))) *(*uint8)(unsafe.Pointer(op)) = *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(uint32(*(*Tuint16_t)(unsafe.Pointer(wp)))&mask))) wp += 2 op++ } n -= stride } } } } } // C documentation // // /* // * State block for each open TIFF // * file using PixarLog compression/decompression. // */ type TPixarLogState = struct { Fpredict TTIFFPredictorState Fstream Tz_stream Ftbuf_size Ttmsize_t Ftbuf uintptr Fstride Tuint16_t Fstate int32 Fuser_datafmt int32 Fquality int32 Fvgetparent TTIFFVSetMethod Fvsetparent TTIFFVSetMethod FToLinearF uintptr FToLinear16 uintptr FToLinear8 uintptr FFromLT2 uintptr FFrom14 uintptr FFrom8 uintptr } func _PixarLogMakeTables(tls *libc.TLS, sp uintptr) (r int32) { var From14, From8, FromLT2, ToLinear16, ToLinear8, ToLinearF uintptr var b, c, linstep, v float64 var i, j, lt2size, nlin, v2, v4, v6, v7 int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = From14, From8, FromLT2, ToLinear16, ToLinear8, ToLinearF, b, c, i, j, linstep, lt2size, nlin, v, v2, v4, v6, v7 c = libc.Xlog(tls, float64(RATIO)) nlin = int32(libc.Float64FromFloat64(1) / c) /* nlin must be an integer */ c = float64(1) / float64(nlin) b = libc.Xexp(tls, -c*libc.Float64FromInt32(ONE)) /* multiplicative scale factor [b*exp(c*ONE) = 1] */ linstep = b * c * libc.Xexp(tls, float64(1)) _LogK1 = float32(libc.Float64FromFloat64(1) / c) /* if (v >= 2) token = k1*log(v*k2) */ _LogK2 = float32(libc.Float64FromFloat64(1) / b) lt2size = int32(libc.Float64FromFloat64(2)/linstep) + int32(1) FromLT2 = XTkimgTIFFmalloc(tls, libc.Int32FromUint32(libc.Uint32FromInt32(lt2size)*uint32(2))) From14 = XTkimgTIFFmalloc(tls, libc.Int32FromUint32(libc.Uint32FromInt32(16384)*libc.Uint32FromInt64(2))) From8 = XTkimgTIFFmalloc(tls, libc.Int32FromUint32(libc.Uint32FromInt32(256)*libc.Uint32FromInt64(2))) ToLinearF = XTkimgTIFFmalloc(tls, libc.Int32FromUint32(libc.Uint32FromInt32(TSIZEP1)*libc.Uint32FromInt64(4))) ToLinear16 = XTkimgTIFFmalloc(tls, libc.Int32FromUint32(libc.Uint32FromInt32(TSIZEP1)*libc.Uint32FromInt64(2))) ToLinear8 = XTkimgTIFFmalloc(tls, libc.Int32FromUint32(libc.Uint32FromInt32(TSIZEP1)*libc.Uint32FromInt64(1))) if FromLT2 == libc.UintptrFromInt32(0) || From14 == libc.UintptrFromInt32(0) || From8 == libc.UintptrFromInt32(0) || ToLinearF == libc.UintptrFromInt32(0) || ToLinear16 == libc.UintptrFromInt32(0) || ToLinear8 == libc.UintptrFromInt32(0) { if FromLT2 != 0 { XTkimgTIFFfree(tls, FromLT2) } if From14 != 0 { XTkimgTIFFfree(tls, From14) } if From8 != 0 { XTkimgTIFFfree(tls, From8) } if ToLinearF != 0 { XTkimgTIFFfree(tls, ToLinearF) } if ToLinear16 != 0 { XTkimgTIFFfree(tls, ToLinear16) } if ToLinear8 != 0 { XTkimgTIFFfree(tls, ToLinear8) } (*TPixarLogState)(unsafe.Pointer(sp)).FFromLT2 = libc.UintptrFromInt32(0) (*TPixarLogState)(unsafe.Pointer(sp)).FFrom14 = libc.UintptrFromInt32(0) (*TPixarLogState)(unsafe.Pointer(sp)).FFrom8 = libc.UintptrFromInt32(0) (*TPixarLogState)(unsafe.Pointer(sp)).FToLinearF = libc.UintptrFromInt32(0) (*TPixarLogState)(unsafe.Pointer(sp)).FToLinear16 = libc.UintptrFromInt32(0) (*TPixarLogState)(unsafe.Pointer(sp)).FToLinear8 = libc.UintptrFromInt32(0) return 0 } j = 0 i = 0 for { if !(i < nlin) { break } v = float64(i) * linstep v2 = j j++ *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v2)*4)) = float32(v) goto _1 _1: ; i++ } i = nlin for { if !(i < int32(TSIZE)) { break } v4 = j j++ *(*float32)(unsafe.Pointer(ToLinearF + uintptr(v4)*4)) = float32(b * libc.Xexp(tls, c*float64(i))) goto _3 _3: ; i++ } *(*float32)(unsafe.Pointer(ToLinearF + 2048*4)) = *(*float32)(unsafe.Pointer(ToLinearF + 2047*4)) i = 0 for { if !(i < int32(TSIZEP1)) { break } v = float64(*(*float32)(unsafe.Pointer(ToLinearF + uintptr(i)*4)))*float64(65535) + float64(0.5) if v > float64(65535) { v6 = int32(65535) } else { v6 = libc.Int32FromUint16(uint16(v)) } *(*Tuint16_t)(unsafe.Pointer(ToLinear16 + uintptr(i)*2)) = libc.Uint16FromInt32(v6) v = float64(*(*float32)(unsafe.Pointer(ToLinearF + uintptr(i)*4)))*float64(255) + float64(0.5) if v > float64(255) { v7 = int32(255) } else { v7 = libc.Int32FromUint8(uint8(v)) } *(*uint8)(unsafe.Pointer(ToLinear8 + uintptr(i))) = libc.Uint8FromInt32(v7) goto _5 _5: ; i++ } j = 0 i = 0 for { if !(i < lt2size) { break } if float64(i)*linstep*(float64(i)*linstep) > float64(*(*float32)(unsafe.Pointer(ToLinearF + uintptr(j)*4))**(*float32)(unsafe.Pointer(ToLinearF + uintptr(j+int32(1))*4))) { j++ } *(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(i)*2)) = libc.Uint16FromInt32(j) goto _8 _8: ; i++ } /* * Since we lose info anyway on 16-bit data, we set up a 14-bit * table and shift 16-bit values down two bits on input. * saves a little table space. */ j = 0 i = 0 for { if !(i < int32(16384)) { break } for float64(i)/float64(16383)*(float64(i)/float64(16383)) > float64(*(*float32)(unsafe.Pointer(ToLinearF + uintptr(j)*4))**(*float32)(unsafe.Pointer(ToLinearF + uintptr(j+int32(1))*4))) { j++ } *(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(i)*2)) = libc.Uint16FromInt32(j) goto _9 _9: ; i++ } j = 0 i = 0 for { if !(i < int32(256)) { break } for float64(i)/float64(255)*(float64(i)/float64(255)) > float64(*(*float32)(unsafe.Pointer(ToLinearF + uintptr(j)*4))**(*float32)(unsafe.Pointer(ToLinearF + uintptr(j+int32(1))*4))) { j++ } *(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(i)*2)) = libc.Uint16FromInt32(j) goto _10 _10: ; i++ } _Fltsize = float32(lt2size / libc.Int32FromInt32(2)) (*TPixarLogState)(unsafe.Pointer(sp)).FToLinearF = ToLinearF (*TPixarLogState)(unsafe.Pointer(sp)).FToLinear16 = ToLinear16 (*TPixarLogState)(unsafe.Pointer(sp)).FToLinear8 = ToLinear8 (*TPixarLogState)(unsafe.Pointer(sp)).FFromLT2 = FromLT2 (*TPixarLogState)(unsafe.Pointer(sp)).FFrom14 = From14 (*TPixarLogState)(unsafe.Pointer(sp)).FFrom8 = From8 return int32(1) } func _PixarLogGuessDataFmt(tls *libc.TLS, td uintptr) (r int32) { var format, guess int32 _, _ = format, guess guess = -int32(1) format = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_sampleformat) /* If the user didn't tell us his datafmt, * take our best guess from the bitspersample. */ switch libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample) { case int32(32): if format == int32(SAMPLEFORMAT_IEEEFP) { guess = int32(PIXARLOGDATAFMT_FLOAT) } case int32(16): if format == int32(SAMPLEFORMAT_VOID) || format == int32(SAMPLEFORMAT_UINT) { guess = int32(PIXARLOGDATAFMT_16BIT) } case int32(12): if format == int32(SAMPLEFORMAT_VOID) || format == int32(SAMPLEFORMAT_INT) { guess = int32(PIXARLOGDATAFMT_12BITPICIO) } case int32(11): if format == int32(SAMPLEFORMAT_VOID) || format == int32(SAMPLEFORMAT_UINT) { guess = int32(PIXARLOGDATAFMT_11BITLOG) } case int32(8): if format == int32(SAMPLEFORMAT_VOID) || format == int32(SAMPLEFORMAT_UINT) { guess = PIXARLOGDATAFMT_8BIT } break } return guess } func _multiply_ms1(tls *libc.TLS, m1 Ttmsize_t, m2 Ttmsize_t) (r Ttmsize_t) { return (*(*func(*libc.TLS, uintptr, Ttmsize_t, Ttmsize_t, uintptr) Ttmsize_t)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFMultiplySSizePtr})))(tls, libc.UintptrFromInt32(0), m1, m2, libc.UintptrFromInt32(0)) } func _add_ms(tls *libc.TLS, m1 Ttmsize_t, m2 Ttmsize_t) (r Ttmsize_t) { /* if either input is zero, assume overflow already occurred */ if m1 == 0 || m2 == 0 { return 0 } else { if m1 > libc.Int32FromUint32(libc.Uint32FromUint32(0xffffffff)>>libc.Int32FromInt32(1))-m2 { return 0 } } return m1 + m2 } func _PixarLogFixupTags(tls *libc.TLS, tif uintptr) (r int32) { _ = tif return int32(1) } func _PixarLogSetupDecode(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var sp, td, v2 uintptr var strip_height Tuint32_t var tbuf_size Ttmsize_t var v1 int32 _, _, _, _, _, _ = sp, strip_height, tbuf_size, td, v1, v2 td = tif + 56 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* This function can possibly be called several times by */ /* PredictorSetupDecode() if this function succeeds but */ /* PredictorSetup() fails */ if (*TPixarLogState)(unsafe.Pointer(sp)).Fstate&int32(PLSTATE_INIT) != 0 { return int32(1) } strip_height = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip if strip_height > (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength { strip_height = (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagelength } /* Make sure no byte swapping happens on the data * after decompression. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_postdecode = (*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFNoPostDecodePtr /* for some reason, we can't do this in TIFFInitPixarLog */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { v1 = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { v1 = int32(1) } (*TPixarLogState)(unsafe.Pointer(sp)).Fstride = libc.Uint16FromInt32(v1) tbuf_size = _multiply_ms1(tls, _multiply_ms1(tls, _multiply_ms1(tls, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), libc.Int32FromUint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth)), libc.Int32FromUint32(strip_height)), int32(2)) /* add one more stride in case input ends mid-stride */ tbuf_size = _add_ms(tls, tbuf_size, libc.Int32FromUint32(uint32(2)*uint32((*TPixarLogState)(unsafe.Pointer(sp)).Fstride))) if tbuf_size == 0 { return 0 } /* TODO: this is an error return without error report through TIFFErrorExt */ (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf = XTkimgTIFFmalloc(tls, tbuf_size) if (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf == libc.UintptrFromInt32(0) { return 0 } (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf_size = tbuf_size if (*TPixarLogState)(unsafe.Pointer(sp)).Fuser_datafmt == -int32(1) { (*TPixarLogState)(unsafe.Pointer(sp)).Fuser_datafmt = _PixarLogGuessDataFmt(tls, td) } if (*TPixarLogState)(unsafe.Pointer(sp)).Fuser_datafmt == -int32(1) { XTkimgTIFFfree(tls, (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf) (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf = libc.UintptrFromInt32(0) (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf_size = 0 (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module118)), __ccgo_ts+55861, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } if (*(*func(*libc.TLS, Tz_streamp, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflateInit_Ptr})))(tls, sp+64, __ccgo_ts+15959, libc.Int32FromInt64(56)) != Z_OK { XTkimgTIFFfree(tls, (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf) (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf = libc.UintptrFromInt32(0) (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf_size = 0 if (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg != 0 { v2 = (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg } else { v2 = __ccgo_ts + 55942 } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module118)), __ccgo_ts+39133, libc.VaList(bp+8, v2)) return 0 } else { *(*int32)(unsafe.Pointer(sp + 132)) |= int32(PLSTATE_INIT) return int32(1) } return r } var _module118 = [20]uint8{'P', 'i', 'x', 'a', 'r', 'L', 'o', 'g', 'S', 'e', 't', 'u', 'p', 'D', 'e', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Setup state for decoding a strip. // */ func _PixarLogPreDecode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fnext_in = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata /* if this assert gets raised, we need to simplify this code to reflect a ZLib that is likely updated to deal with 8byte memory sizes, though this code will respond appropriately even before we simplify it */ (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_in = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) if libc.Int32FromUint32((*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_in) != (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module119)), __ccgo_ts+55949, 0) return 0 } return libc.BoolInt32((*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflateResetPtr})))(tls, sp+64) == Z_OK) } var _module119 = [18]uint8{'P', 'i', 'x', 'a', 'r', 'L', 'o', 'g', 'P', 'r', 'e', 'D', 'e', 'c', 'o', 'd', 'e'} func _PixarLogDecode(tls *libc.TLS, tif uintptr, op uintptr, occ Ttmsize_t, s Tuint16_t) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var i, nsamples Ttmsize_t var llen, state int32 var sp, td, up, v1, v2 uintptr _, _, _, _, _, _, _, _, _ = i, llen, nsamples, sp, state, td, up, v1, v2 td = tif + 56 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data switch (*TPixarLogState)(unsafe.Pointer(sp)).Fuser_datafmt { case int32(PIXARLOGDATAFMT_FLOAT): nsamples = libc.Int32FromUint32(libc.Uint32FromInt32(occ) / uint32(4)) /* XXX float == 32 bits */ case int32(PIXARLOGDATAFMT_16BIT): fallthrough case int32(PIXARLOGDATAFMT_12BITPICIO): fallthrough case int32(PIXARLOGDATAFMT_11BITLOG): nsamples = libc.Int32FromUint32(libc.Uint32FromInt32(occ) / uint32(2)) /* XXX uint16_t == 16 bits */ case PIXARLOGDATAFMT_8BIT: fallthrough case int32(PIXARLOGDATAFMT_8BITABGR): nsamples = occ default: (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module120)), __ccgo_ts+55989, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } llen = libc.Int32FromUint32(uint32((*TPixarLogState)(unsafe.Pointer(sp)).Fstride) * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth) _ = s (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fnext_in = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_in = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fnext_out = (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf /* if this assert gets raised, we need to simplify this code to reflect a ZLib that is likely updated to deal with 8byte memory sizes, though this code will respond appropriately even before we simplify it */ (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out = libc.Uint32FromInt32(nsamples) * libc.Uint32FromInt64(2) if (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out != libc.Uint32FromInt32(nsamples)*uint32(2) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module120)), __ccgo_ts+55949, 0) return 0 } /* Check that we will not fill more than what was allocated */ if libc.Int32FromUint32((*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out) > (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf_size { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module120)), __ccgo_ts+56028, 0) return 0 } for cond := true; cond; cond = (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out > uint32(0) { state = (*(*func(*libc.TLS, Tz_streamp, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflatePtr})))(tls, sp+64, int32(Z_PARTIAL_FLUSH)) if state == int32(Z_STREAM_END) { break /* XXX */ } if state == -int32(3) { if (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg != 0 { v1 = (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg } else { v1 = __ccgo_ts + 55942 } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module120)), __ccgo_ts+56065, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, v1)) return 0 } if state != Z_OK { if (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg != 0 { v2 = (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg } else { v2 = __ccgo_ts + 55942 } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module120)), __ccgo_ts+56099, libc.VaList(bp+8, v2)) return 0 } } /* hopefully, we got all the bytes we needed */ if (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out != uint32(0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module120)), __ccgo_ts+56114, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out)) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fnext_in (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = libc.Int32FromUint32((*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_in) up = (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf /* Swap bytes in the data if from a different endian machine. */ if (*TTIFF)(unsafe.Pointer(tif)).Ftif_flags&uint32(0x00080) != 0 { (*(*func(*libc.TLS, uintptr, Ttmsize_t))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFSwabArrayOfShort})))(tls, up, nsamples) } /* * if llen is not an exact multiple of nsamples, the decode operation * may overflow the output buffer, so truncate it enough to prevent * that but still salvage as much data as possible. */ if nsamples%llen != 0 { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFWarningExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module120)), __ccgo_ts+56162, libc.VaList(bp+8, llen, nsamples)) nsamples -= nsamples % llen } i = 0 for { if !(i < nsamples) { break } switch (*TPixarLogState)(unsafe.Pointer(sp)).Fuser_datafmt { case int32(PIXARLOGDATAFMT_FLOAT): _horizontalAccumulateF(tls, up, llen, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), op, (*TPixarLogState)(unsafe.Pointer(sp)).FToLinearF) op += uintptr(libc.Uint32FromInt32(llen) * uint32(4)) case int32(PIXARLOGDATAFMT_16BIT): _horizontalAccumulate16(tls, up, llen, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), op, (*TPixarLogState)(unsafe.Pointer(sp)).FToLinear16) op += uintptr(libc.Uint32FromInt32(llen) * uint32(2)) case int32(PIXARLOGDATAFMT_12BITPICIO): _horizontalAccumulate12(tls, up, llen, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), op, (*TPixarLogState)(unsafe.Pointer(sp)).FToLinearF) op += uintptr(libc.Uint32FromInt32(llen) * uint32(2)) case int32(PIXARLOGDATAFMT_11BITLOG): _horizontalAccumulate11(tls, up, llen, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), op) op += uintptr(libc.Uint32FromInt32(llen) * uint32(2)) case PIXARLOGDATAFMT_8BIT: _horizontalAccumulate8(tls, up, llen, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), op, (*TPixarLogState)(unsafe.Pointer(sp)).FToLinear8) op += uintptr(libc.Uint32FromInt32(llen) * uint32(1)) case int32(PIXARLOGDATAFMT_8BITABGR): _horizontalAccumulate8abgr(tls, up, llen, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), op, (*TPixarLogState)(unsafe.Pointer(sp)).FToLinear8) op += uintptr(libc.Uint32FromInt32(llen) * uint32(1)) default: (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module120)), __ccgo_ts+56227, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } goto _3 _3: ; i += llen up += uintptr(llen) * 2 } return int32(1) } var _module120 = [15]uint8{'P', 'i', 'x', 'a', 'r', 'L', 'o', 'g', 'D', 'e', 'c', 'o', 'd', 'e'} func _PixarLogSetupEncode(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var sp, td, v2 uintptr var tbuf_size Ttmsize_t var v1 int32 _, _, _, _, _ = sp, tbuf_size, td, v1, v2 td = tif + 56 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data /* for some reason, we can't do this in TIFFInitPixarLog */ if libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_planarconfig) == int32(PLANARCONFIG_CONTIG) { v1 = libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_samplesperpixel) } else { v1 = int32(1) } (*TPixarLogState)(unsafe.Pointer(sp)).Fstride = libc.Uint16FromInt32(v1) tbuf_size = _multiply_ms1(tls, _multiply_ms1(tls, _multiply_ms1(tls, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), libc.Int32FromUint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth)), libc.Int32FromUint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip)), int32(2)) if tbuf_size == 0 { return 0 } /* TODO: this is an error return without error report through TIFFErrorExt */ (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf = XTkimgTIFFmalloc(tls, tbuf_size) if (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf == libc.UintptrFromInt32(0) { return 0 } if (*TPixarLogState)(unsafe.Pointer(sp)).Fuser_datafmt == -int32(1) { (*TPixarLogState)(unsafe.Pointer(sp)).Fuser_datafmt = _PixarLogGuessDataFmt(tls, td) } if (*TPixarLogState)(unsafe.Pointer(sp)).Fuser_datafmt == -int32(1) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module121)), __ccgo_ts+56255, libc.VaList(bp+8, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } if (*(*func(*libc.TLS, Tz_streamp, int32, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflateInit_Ptr})))(tls, sp+64, (*TPixarLogState)(unsafe.Pointer(sp)).Fquality, __ccgo_ts+15959, libc.Int32FromInt64(56)) != Z_OK { if (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg != 0 { v2 = (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg } else { v2 = __ccgo_ts + 55942 } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module121)), __ccgo_ts+39133, libc.VaList(bp+8, v2)) return 0 } else { *(*int32)(unsafe.Pointer(sp + 132)) |= int32(PLSTATE_INIT) return int32(1) } return r } var _module121 = [20]uint8{'P', 'i', 'x', 'a', 'r', 'L', 'o', 'g', 'S', 'e', 't', 'u', 'p', 'E', 'n', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Reset encoding state at the start of a strip. // */ func _PixarLogPreEncode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fnext_out = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata /* if this assert gets raised, we need to simplify this code to reflect a ZLib that is likely updated to deal with 8byte memory sizes, though this code will respond appropriately even before we simplify it */ (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) if libc.Int32FromUint32((*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out) != (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module122)), __ccgo_ts+55949, 0) return 0 } return libc.BoolInt32((*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflateResetPtr})))(tls, sp+64) == Z_OK) } var _module122 = [18]uint8{'P', 'i', 'x', 'a', 'r', 'L', 'o', 'g', 'P', 'r', 'e', 'E', 'n', 'c', 'o', 'd', 'e'} func _horizontalDifferenceF(tls *libc.TLS, ip uintptr, n int32, stride int32, wp uintptr, FromLT2 uintptr) { var a1, a2, b1, b2, g1, g2, mask, r1, r2 Tint32_t var fltsize float32 var i, i1 int32 var v1, v22, v26, v30, v34, v5, v9 Tuint16_t var v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v23, v24, v25, v27, v28, v29, v3, v31, v32, v33, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v6, v7, v8 float64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a2, b1, b2, fltsize, g1, g2, i, i1, mask, r1, r2, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v5, v50, v51, v52, v53, v54, v55, v56, v57, v58, v6, v7, v8, v9 fltsize = _Fltsize mask = int32(CODE_MASK) if n >= stride { if stride == int32(3) { if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(0) { v2 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(2) { v3 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip)) > libc.Float32FromFloat64(24.2) { v4 = libc.Float64FromInt32(2047) } else { v4 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip))*_LogK2)) + float64(0.5) } v3 = v4 } v2 = v3 } v1 = uint16(v2) *(*Tuint16_t)(unsafe.Pointer(wp)) = v1 r2 = libc.Int32FromUint16(v1) if *(*float32)(unsafe.Pointer(ip + 1*4)) < libc.Float32FromFloat64(0) { v6 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + 1*4)) < libc.Float32FromFloat64(2) { v7 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + 1*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + 1*4)) > libc.Float32FromFloat64(24.2) { v8 = libc.Float64FromInt32(2047) } else { v8 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + 1*4))*_LogK2)) + float64(0.5) } v7 = v8 } v6 = v7 } v5 = uint16(v6) *(*Tuint16_t)(unsafe.Pointer(wp + 1*2)) = v5 g2 = libc.Int32FromUint16(v5) if *(*float32)(unsafe.Pointer(ip + 2*4)) < libc.Float32FromFloat64(0) { v10 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + 2*4)) < libc.Float32FromFloat64(2) { v11 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + 2*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + 2*4)) > libc.Float32FromFloat64(24.2) { v12 = libc.Float64FromInt32(2047) } else { v12 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + 2*4))*_LogK2)) + float64(0.5) } v11 = v12 } v10 = v11 } v9 = uint16(v10) *(*Tuint16_t)(unsafe.Pointer(wp + 2*2)) = v9 b2 = libc.Int32FromUint16(v9) n -= int32(3) for n > 0 { n -= int32(3) wp += uintptr(3) * 2 ip += uintptr(3) * 4 if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(0) { v13 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(2) { v14 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip)) > libc.Float32FromFloat64(24.2) { v15 = libc.Float64FromInt32(2047) } else { v15 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip))*_LogK2)) + float64(0.5) } v14 = v15 } v13 = v14 } r1 = int32(v13) *(*Tuint16_t)(unsafe.Pointer(wp)) = libc.Uint16FromInt32((r1 - r2) & mask) r2 = r1 if *(*float32)(unsafe.Pointer(ip + 1*4)) < libc.Float32FromFloat64(0) { v16 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + 1*4)) < libc.Float32FromFloat64(2) { v17 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + 1*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + 1*4)) > libc.Float32FromFloat64(24.2) { v18 = libc.Float64FromInt32(2047) } else { v18 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + 1*4))*_LogK2)) + float64(0.5) } v17 = v18 } v16 = v17 } g1 = int32(v16) *(*Tuint16_t)(unsafe.Pointer(wp + 1*2)) = libc.Uint16FromInt32((g1 - g2) & mask) g2 = g1 if *(*float32)(unsafe.Pointer(ip + 2*4)) < libc.Float32FromFloat64(0) { v19 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + 2*4)) < libc.Float32FromFloat64(2) { v20 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + 2*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + 2*4)) > libc.Float32FromFloat64(24.2) { v21 = libc.Float64FromInt32(2047) } else { v21 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + 2*4))*_LogK2)) + float64(0.5) } v20 = v21 } v19 = v20 } b1 = int32(v19) *(*Tuint16_t)(unsafe.Pointer(wp + 2*2)) = libc.Uint16FromInt32((b1 - b2) & mask) b2 = b1 } } else { if stride == int32(4) { if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(0) { v23 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(2) { v24 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip)) > libc.Float32FromFloat64(24.2) { v25 = libc.Float64FromInt32(2047) } else { v25 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip))*_LogK2)) + float64(0.5) } v24 = v25 } v23 = v24 } v22 = uint16(v23) *(*Tuint16_t)(unsafe.Pointer(wp)) = v22 r2 = libc.Int32FromUint16(v22) if *(*float32)(unsafe.Pointer(ip + 1*4)) < libc.Float32FromFloat64(0) { v27 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + 1*4)) < libc.Float32FromFloat64(2) { v28 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + 1*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + 1*4)) > libc.Float32FromFloat64(24.2) { v29 = libc.Float64FromInt32(2047) } else { v29 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + 1*4))*_LogK2)) + float64(0.5) } v28 = v29 } v27 = v28 } v26 = uint16(v27) *(*Tuint16_t)(unsafe.Pointer(wp + 1*2)) = v26 g2 = libc.Int32FromUint16(v26) if *(*float32)(unsafe.Pointer(ip + 2*4)) < libc.Float32FromFloat64(0) { v31 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + 2*4)) < libc.Float32FromFloat64(2) { v32 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + 2*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + 2*4)) > libc.Float32FromFloat64(24.2) { v33 = libc.Float64FromInt32(2047) } else { v33 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + 2*4))*_LogK2)) + float64(0.5) } v32 = v33 } v31 = v32 } v30 = uint16(v31) *(*Tuint16_t)(unsafe.Pointer(wp + 2*2)) = v30 b2 = libc.Int32FromUint16(v30) if *(*float32)(unsafe.Pointer(ip + 3*4)) < libc.Float32FromFloat64(0) { v35 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + 3*4)) < libc.Float32FromFloat64(2) { v36 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + 3*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + 3*4)) > libc.Float32FromFloat64(24.2) { v37 = libc.Float64FromInt32(2047) } else { v37 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + 3*4))*_LogK2)) + float64(0.5) } v36 = v37 } v35 = v36 } v34 = uint16(v35) *(*Tuint16_t)(unsafe.Pointer(wp + 3*2)) = v34 a2 = libc.Int32FromUint16(v34) n -= int32(4) for n > 0 { n -= int32(4) wp += uintptr(4) * 2 ip += uintptr(4) * 4 if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(0) { v38 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(2) { v39 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip)) > libc.Float32FromFloat64(24.2) { v40 = libc.Float64FromInt32(2047) } else { v40 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip))*_LogK2)) + float64(0.5) } v39 = v40 } v38 = v39 } r1 = int32(v38) *(*Tuint16_t)(unsafe.Pointer(wp)) = libc.Uint16FromInt32((r1 - r2) & mask) r2 = r1 if *(*float32)(unsafe.Pointer(ip + 1*4)) < libc.Float32FromFloat64(0) { v41 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + 1*4)) < libc.Float32FromFloat64(2) { v42 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + 1*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + 1*4)) > libc.Float32FromFloat64(24.2) { v43 = libc.Float64FromInt32(2047) } else { v43 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + 1*4))*_LogK2)) + float64(0.5) } v42 = v43 } v41 = v42 } g1 = int32(v41) *(*Tuint16_t)(unsafe.Pointer(wp + 1*2)) = libc.Uint16FromInt32((g1 - g2) & mask) g2 = g1 if *(*float32)(unsafe.Pointer(ip + 2*4)) < libc.Float32FromFloat64(0) { v44 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + 2*4)) < libc.Float32FromFloat64(2) { v45 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + 2*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + 2*4)) > libc.Float32FromFloat64(24.2) { v46 = libc.Float64FromInt32(2047) } else { v46 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + 2*4))*_LogK2)) + float64(0.5) } v45 = v46 } v44 = v45 } b1 = int32(v44) *(*Tuint16_t)(unsafe.Pointer(wp + 2*2)) = libc.Uint16FromInt32((b1 - b2) & mask) b2 = b1 if *(*float32)(unsafe.Pointer(ip + 3*4)) < libc.Float32FromFloat64(0) { v47 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + 3*4)) < libc.Float32FromFloat64(2) { v48 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + 3*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + 3*4)) > libc.Float32FromFloat64(24.2) { v49 = libc.Float64FromInt32(2047) } else { v49 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + 3*4))*_LogK2)) + float64(0.5) } v48 = v49 } v47 = v48 } a1 = int32(v47) *(*Tuint16_t)(unsafe.Pointer(wp + 3*2)) = libc.Uint16FromInt32((a1 - a2) & mask) a2 = a1 } } else { i = stride for cond := true; cond; cond = i > 0 { i-- if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(0) { v50 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(2) { v51 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip)) > libc.Float32FromFloat64(24.2) { v52 = libc.Float64FromInt32(2047) } else { v52 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip))*_LogK2)) + float64(0.5) } v51 = v52 } v50 = v51 } *(*Tuint16_t)(unsafe.Pointer(wp)) = uint16(v50) wp += 2 ip += 4 } n -= stride for n > 0 { i1 = stride for cond := true; cond; cond = i1 > 0 { i1-- if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(0) { v53 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip)) < libc.Float32FromFloat64(2) { v54 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip)) > libc.Float32FromFloat64(24.2) { v55 = libc.Float64FromInt32(2047) } else { v55 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip))*_LogK2)) + float64(0.5) } v54 = v55 } v53 = v54 } if *(*float32)(unsafe.Pointer(ip + uintptr(-stride)*4)) < libc.Float32FromFloat64(0) { v56 = libc.Float64FromInt32(0) } else { if *(*float32)(unsafe.Pointer(ip + uintptr(-stride)*4)) < libc.Float32FromFloat64(2) { v57 = float64(*(*Tuint16_t)(unsafe.Pointer(FromLT2 + uintptr(int32(*(*float32)(unsafe.Pointer(ip + uintptr(-stride)*4))*fltsize))*2))) } else { if *(*float32)(unsafe.Pointer(ip + uintptr(-stride)*4)) > libc.Float32FromFloat64(24.2) { v58 = libc.Float64FromInt32(2047) } else { v58 = float64(_LogK1)*libc.Xlog(tls, float64(*(*float32)(unsafe.Pointer(ip + uintptr(-stride)*4))*_LogK2)) + float64(0.5) } v57 = v58 } v56 = v57 } *(*Tuint16_t)(unsafe.Pointer(wp)) = libc.Uint16FromInt32((int32(v53) - int32(v56)) & mask) wp += 2 ip += 4 } n -= stride } } } } } func _horizontalDifference16(tls *libc.TLS, ip uintptr, n int32, stride int32, wp uintptr, From14 uintptr) { var a1, a2, b1, b2, g1, g2, i, i1, mask, r1, r2 int32 var v1, v2, v3, v4, v5, v6, v7 uint16 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a2, b1, b2, g1, g2, i, i1, mask, r1, r2, v1, v2, v3, v4, v5, v6, v7 /* assumption is unsigned pixel values */ mask = int32(CODE_MASK) if n >= stride { if stride == int32(3) { v1 = *(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip)))>>int32(2))*2)) *(*uint16)(unsafe.Pointer(wp)) = v1 r2 = libc.Int32FromUint16(v1) v2 = *(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + 1*2)))>>int32(2))*2)) *(*uint16)(unsafe.Pointer(wp + 1*2)) = v2 g2 = libc.Int32FromUint16(v2) v3 = *(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + 2*2)))>>int32(2))*2)) *(*uint16)(unsafe.Pointer(wp + 2*2)) = v3 b2 = libc.Int32FromUint16(v3) n -= int32(3) for n > 0 { n -= int32(3) wp += uintptr(3) * 2 ip += uintptr(3) * 2 r1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip)))>>int32(2))*2))) *(*uint16)(unsafe.Pointer(wp)) = libc.Uint16FromInt32((r1 - r2) & mask) r2 = r1 g1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + 1*2)))>>int32(2))*2))) *(*uint16)(unsafe.Pointer(wp + 1*2)) = libc.Uint16FromInt32((g1 - g2) & mask) g2 = g1 b1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + 2*2)))>>int32(2))*2))) *(*uint16)(unsafe.Pointer(wp + 2*2)) = libc.Uint16FromInt32((b1 - b2) & mask) b2 = b1 } } else { if stride == int32(4) { v4 = *(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip)))>>int32(2))*2)) *(*uint16)(unsafe.Pointer(wp)) = v4 r2 = libc.Int32FromUint16(v4) v5 = *(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + 1*2)))>>int32(2))*2)) *(*uint16)(unsafe.Pointer(wp + 1*2)) = v5 g2 = libc.Int32FromUint16(v5) v6 = *(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + 2*2)))>>int32(2))*2)) *(*uint16)(unsafe.Pointer(wp + 2*2)) = v6 b2 = libc.Int32FromUint16(v6) v7 = *(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + 3*2)))>>int32(2))*2)) *(*uint16)(unsafe.Pointer(wp + 3*2)) = v7 a2 = libc.Int32FromUint16(v7) n -= int32(4) for n > 0 { n -= int32(4) wp += uintptr(4) * 2 ip += uintptr(4) * 2 r1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip)))>>int32(2))*2))) *(*uint16)(unsafe.Pointer(wp)) = libc.Uint16FromInt32((r1 - r2) & mask) r2 = r1 g1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + 1*2)))>>int32(2))*2))) *(*uint16)(unsafe.Pointer(wp + 1*2)) = libc.Uint16FromInt32((g1 - g2) & mask) g2 = g1 b1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + 2*2)))>>int32(2))*2))) *(*uint16)(unsafe.Pointer(wp + 2*2)) = libc.Uint16FromInt32((b1 - b2) & mask) b2 = b1 a1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + 3*2)))>>int32(2))*2))) *(*uint16)(unsafe.Pointer(wp + 3*2)) = libc.Uint16FromInt32((a1 - a2) & mask) a2 = a1 } } else { i = stride for cond := true; cond; cond = i > 0 { i-- *(*uint16)(unsafe.Pointer(wp)) = *(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip)))>>int32(2))*2)) wp += 2 ip += 2 } n -= stride for n > 0 { i1 = stride for cond := true; cond; cond = i1 > 0 { i1-- *(*uint16)(unsafe.Pointer(wp)) = libc.Uint16FromInt32((libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip)))>>int32(2))*2))) - libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From14 + uintptr(libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(ip + uintptr(-stride)*2)))>>int32(2))*2)))) & mask) wp += 2 ip += 2 } n -= stride } } } } } func _horizontalDifference8(tls *libc.TLS, ip uintptr, n int32, stride int32, wp uintptr, From8 uintptr) { var a1, a2, b1, b2, g1, g2, i, i1, mask, r1, r2 int32 var v1, v2, v3, v4, v5, v6, v7 uint16 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = a1, a2, b1, b2, g1, g2, i, i1, mask, r1, r2, v1, v2, v3, v4, v5, v6, v7 mask = int32(CODE_MASK) if n >= stride { if stride == int32(3) { v1 = *(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip)))*2)) *(*uint16)(unsafe.Pointer(wp)) = v1 r2 = libc.Int32FromUint16(v1) v2 = *(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 1)))*2)) *(*uint16)(unsafe.Pointer(wp + 1*2)) = v2 g2 = libc.Int32FromUint16(v2) v3 = *(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 2)))*2)) *(*uint16)(unsafe.Pointer(wp + 2*2)) = v3 b2 = libc.Int32FromUint16(v3) n -= int32(3) for n > 0 { n -= int32(3) r1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 3)))*2))) *(*uint16)(unsafe.Pointer(wp + 3*2)) = libc.Uint16FromInt32((r1 - r2) & mask) r2 = r1 g1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 4)))*2))) *(*uint16)(unsafe.Pointer(wp + 4*2)) = libc.Uint16FromInt32((g1 - g2) & mask) g2 = g1 b1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 5)))*2))) *(*uint16)(unsafe.Pointer(wp + 5*2)) = libc.Uint16FromInt32((b1 - b2) & mask) b2 = b1 wp += uintptr(3) * 2 ip += uintptr(3) } } else { if stride == int32(4) { v4 = *(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip)))*2)) *(*uint16)(unsafe.Pointer(wp)) = v4 r2 = libc.Int32FromUint16(v4) v5 = *(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 1)))*2)) *(*uint16)(unsafe.Pointer(wp + 1*2)) = v5 g2 = libc.Int32FromUint16(v5) v6 = *(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 2)))*2)) *(*uint16)(unsafe.Pointer(wp + 2*2)) = v6 b2 = libc.Int32FromUint16(v6) v7 = *(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 3)))*2)) *(*uint16)(unsafe.Pointer(wp + 3*2)) = v7 a2 = libc.Int32FromUint16(v7) n -= int32(4) for n > 0 { n -= int32(4) r1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 4)))*2))) *(*uint16)(unsafe.Pointer(wp + 4*2)) = libc.Uint16FromInt32((r1 - r2) & mask) r2 = r1 g1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 5)))*2))) *(*uint16)(unsafe.Pointer(wp + 5*2)) = libc.Uint16FromInt32((g1 - g2) & mask) g2 = g1 b1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 6)))*2))) *(*uint16)(unsafe.Pointer(wp + 6*2)) = libc.Uint16FromInt32((b1 - b2) & mask) b2 = b1 a1 = libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + 7)))*2))) *(*uint16)(unsafe.Pointer(wp + 7*2)) = libc.Uint16FromInt32((a1 - a2) & mask) a2 = a1 wp += uintptr(4) * 2 ip += uintptr(4) } } else { i = stride for cond := true; cond; cond = i > 0 { i-- *(*uint16)(unsafe.Pointer(wp)) = *(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip)))*2)) wp += 2 ip++ } n -= stride for n > 0 { i1 = stride for cond := true; cond; cond = i1 > 0 { i1-- *(*uint16)(unsafe.Pointer(wp)) = libc.Uint16FromInt32((libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip)))*2))) - libc.Int32FromUint16(*(*Tuint16_t)(unsafe.Pointer(From8 + uintptr(*(*uint8)(unsafe.Pointer(ip + uintptr(-stride))))*2)))) & mask) wp += 2 ip++ } n -= stride } } } } } // C documentation // // /* // * Encode a chunk of pixels. // */ func _PixarLogEncode(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { bp1 := tls.Alloc(16) defer tls.Free(16) var i, n Ttmsize_t var llen int32 var sp, td, up, v2 uintptr _, _, _, _, _, _, _ = i, llen, n, sp, td, up, v2 td = tif + 56 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s switch (*TPixarLogState)(unsafe.Pointer(sp)).Fuser_datafmt { case int32(PIXARLOGDATAFMT_FLOAT): n = libc.Int32FromUint32(libc.Uint32FromInt32(cc) / uint32(4)) /* XXX float == 32 bits */ case int32(PIXARLOGDATAFMT_16BIT): fallthrough case int32(PIXARLOGDATAFMT_12BITPICIO): fallthrough case int32(PIXARLOGDATAFMT_11BITLOG): n = libc.Int32FromUint32(libc.Uint32FromInt32(cc) / uint32(2)) /* XXX uint16_t == 16 bits */ case PIXARLOGDATAFMT_8BIT: fallthrough case int32(PIXARLOGDATAFMT_8BITABGR): n = cc default: (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module123)), __ccgo_ts+55989, libc.VaList(bp1+8, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } llen = libc.Int32FromUint32(uint32((*TPixarLogState)(unsafe.Pointer(sp)).Fstride) * (*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_imagewidth) /* Check against the number of elements (of size uint16_t) of sp->tbuf */ if n > libc.Int32FromUint32((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_rowsperstrip)*llen { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module123)), __ccgo_ts+56313, 0) return 0 } i = 0 up = (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf for { if !(i < n) { break } switch (*TPixarLogState)(unsafe.Pointer(sp)).Fuser_datafmt { case int32(PIXARLOGDATAFMT_FLOAT): _horizontalDifferenceF(tls, bp, llen, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), up, (*TPixarLogState)(unsafe.Pointer(sp)).FFromLT2) bp += uintptr(libc.Uint32FromInt32(llen) * uint32(4)) case int32(PIXARLOGDATAFMT_16BIT): _horizontalDifference16(tls, bp, llen, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), up, (*TPixarLogState)(unsafe.Pointer(sp)).FFrom14) bp += uintptr(libc.Uint32FromInt32(llen) * uint32(2)) case PIXARLOGDATAFMT_8BIT: _horizontalDifference8(tls, bp, llen, libc.Int32FromUint16((*TPixarLogState)(unsafe.Pointer(sp)).Fstride), up, (*TPixarLogState)(unsafe.Pointer(sp)).FFrom8) bp += uintptr(libc.Uint32FromInt32(llen) * uint32(1)) default: (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module123)), __ccgo_ts+55989, libc.VaList(bp1+8, libc.Int32FromUint16((*TTIFFDirectory)(unsafe.Pointer(td)).Ftd_bitspersample))) return 0 } goto _1 _1: ; i += llen up += uintptr(llen) * 2 } (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fnext_in = (*TPixarLogState)(unsafe.Pointer(sp)).Ftbuf /* if this assert gets raised, we need to simplify this code to reflect a ZLib that is likely updated to deal with 8byte memory sizes, though this code will respond appropriately even before we simplify it */ (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_in = libc.Uint32FromInt32(n) * libc.Uint32FromInt64(2) if (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_in/uint32(2) != libc.Uint32FromInt32(n) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module123)), __ccgo_ts+55949, 0) return 0 } for cond := true; cond; cond = (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_in > uint32(0) { if (*(*func(*libc.TLS, Tz_streamp, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflatePtr})))(tls, sp+64, Z_NO_FLUSH) != Z_OK { if (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg != 0 { v2 = (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg } else { v2 = __ccgo_ts + 55942 } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module123)), __ccgo_ts+56343, libc.VaList(bp1+8, v2)) return 0 } if (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out == uint32(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFFlushData1})))(tls, tif) != 0) { return 0 } (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fnext_out = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) /* this is a safe typecast, as check is made already in PixarLogPreEncode */ } } return int32(1) } var _module123 = [15]uint8{'P', 'i', 'x', 'a', 'r', 'L', 'o', 'g', 'E', 'n', 'c', 'o', 'd', 'e'} /* * Finish off an encoded strip by flushing the last * string and tacking on an End Of Information code. */ func _PixarLogPostEncode(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var sp, v1 uintptr var state int32 _, _, _ = sp, state, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_in = uint32(0) for cond := true; cond; cond = state != int32(Z_STREAM_END) { state = (*(*func(*libc.TLS, Tz_streamp, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflatePtr})))(tls, sp+64, int32(Z_FINISH)) switch state { case int32(Z_STREAM_END): fallthrough case Z_OK: if libc.Int32FromUint32((*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out) != (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = libc.Int32FromUint32(libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) - (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out) if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFFlushData1})))(tls, tif) != 0) { return 0 } (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fnext_out = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Favail_out = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) /* this is a safe typecast, as check is made already in PixarLogPreEncode */ } default: if (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg != 0 { v1 = (*TPixarLogState)(unsafe.Pointer(sp)).Fstream.Fmsg } else { v1 = __ccgo_ts + 55942 } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module124)), __ccgo_ts+56099, libc.VaList(bp+8, v1)) return 0 } } return int32(1) } var _module124 = [19]uint8{'P', 'i', 'x', 'a', 'r', 'L', 'o', 'g', 'P', 'o', 's', 't', 'E', 'n', 'c', 'o', 'd', 'e'} func _PixarLogClose(tls *libc.TLS, tif uintptr) { var sp, td uintptr _, _ = sp, td sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data td = tif + 56 /* In a really sneaky (and really incorrect, and untruthful, and * troublesome, and error-prone) maneuver that completely goes against * the spirit of TIFF, and breaks TIFF, on close, we covertly * modify both bitspersample and sampleformat in the directory to * indicate 8-bit linear. This way, the decode "just works" even for * readers that don't know about PixarLog, or how to set * the PIXARLOGDATFMT pseudo-tag. */ if (*TPixarLogState)(unsafe.Pointer(sp)).Fstate&int32(PLSTATE_INIT) != 0 { /* We test the state to avoid an issue such as in * http://bugzilla.maptools.org/show_bug.cgi?id=2604 * What appends in that case is that the bitspersample is 1 and * a TransferFunction is set. The size of the TransferFunction * depends on 1< 0 { if libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) <= uint64(0xFFFFFFFF) { v1 = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc) } else { v1 = uint32(0xFFFFFFFF) } avail_in_before = v1 if libc.Uint64FromInt32(occ) < uint64(0xFFFFFFFF) { v2 = libc.Uint32FromInt32(occ) } else { v2 = uint32(0xFFFFFFFF) } avail_out_before = v2 (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_in = avail_in_before (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_out = avail_out_before state = (*(*func(*libc.TLS, Tz_streamp, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflatePtr})))(tls, sp+64, int32(Z_PARTIAL_FLUSH)) p3 = tif + 832 *(*Ttmsize_t)(unsafe.Pointer(p3)) = Ttmsize_t(uint32(*(*Ttmsize_t)(unsafe.Pointer(p3))) - (avail_in_before - (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_in)) occ = Ttmsize_t(uint32(occ) - (avail_out_before - (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_out)) if state == int32(Z_STREAM_END) { break } if state == -int32(3) { if (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg == libc.UintptrFromInt32(0) { v4 = __ccgo_ts + 9405 } else { v4 = (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module128)), __ccgo_ts+56439, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, v4)) return 0 } if state != Z_OK { if (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg == libc.UintptrFromInt32(0) { v5 = __ccgo_ts + 9405 } else { v5 = (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module128)), __ccgo_ts+56099, libc.VaList(bp+8, v5)) return 0 } } if occ != 0 { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module128)), __ccgo_ts+56474, libc.VaList(bp+8, (*TTIFF)(unsafe.Pointer(tif)).Ftif_row, libc.Uint64FromInt32(occ))) return 0 } (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcp = (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fnext_in return int32(1) } var _module128 = [10]uint8{'Z', 'I', 'P', 'D', 'e', 'c', 'o', 'd', 'e'} func _ZIPSetupEncode(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var cappedQuality int32 var sp, v1 uintptr _, _, _ = cappedQuality, sp, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data if (*TZIPState)(unsafe.Pointer(sp)).Fstate&int32(ZSTATE_INIT_DECODE) != 0 { (*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflateEndPtr})))(tls, sp+64) (*TZIPState)(unsafe.Pointer(sp)).Fstate = 0 } cappedQuality = (*TZIPState)(unsafe.Pointer(sp)).Fzipquality if cappedQuality > int32(Z_BEST_COMPRESSION) { cappedQuality = int32(Z_BEST_COMPRESSION) } if (*(*func(*libc.TLS, Tz_streamp, int32, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflateInit_Ptr})))(tls, sp+64, cappedQuality, __ccgo_ts+15959, libc.Int32FromInt64(56)) != Z_OK { if (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg == libc.UintptrFromInt32(0) { v1 = __ccgo_ts + 9405 } else { v1 = (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module129)), __ccgo_ts+39133, libc.VaList(bp+8, v1)) return 0 } else { *(*int32)(unsafe.Pointer(sp + 124)) |= int32(ZSTATE_INIT_ENCODE) return int32(1) } return r } var _module129 = [15]uint8{'Z', 'I', 'P', 'S', 'e', 't', 'u', 'p', 'E', 'n', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Reset encoding state at the start of a strip. // */ func _ZIPPreEncode(tls *libc.TLS, tif uintptr, s Tuint16_t) (r int32) { var sp uintptr var v1 uint32 _, _ = sp, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s if (*TZIPState)(unsafe.Pointer(sp)).Fstate != int32(ZSTATE_INIT_ENCODE) { (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode})))(tls, tif) } (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fnext_out = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata /* if this assert gets raised, we need to simplify this code to reflect a ZLib that is likely updated to deal with 8byte memory sizes, though this code will respond appropriately even before we simplify it */ if libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) <= uint64(0xFFFFFFFF) { v1 = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) } else { v1 = uint32(0xFFFFFFFF) } (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_out = v1 return libc.BoolInt32((*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflateResetPtr})))(tls, sp+64) == Z_OK) } // C documentation // // /* // * Encode a chunk of pixels. // */ func _ZIPEncode(tls *libc.TLS, tif uintptr, bp uintptr, cc Ttmsize_t, s Tuint16_t) (r int32) { bp1 := tls.Alloc(16) defer tls.Free(16) var avail_in_before TuInt var sp, v2 uintptr var v1, v3 uint32 _, _, _, _, _ = avail_in_before, sp, v1, v2, v3 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data _ = s (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fnext_in = bp /* if this assert gets raised, we need to simplify this code to reflect a ZLib that is likely updated to deal with 8byte memory sizes, though this code will respond appropriately even before we simplify it */ for cond := true; cond; cond = cc > 0 { if libc.Uint64FromInt32(cc) <= uint64(0xFFFFFFFF) { v1 = libc.Uint32FromInt32(cc) } else { v1 = uint32(0xFFFFFFFF) } avail_in_before = v1 (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_in = avail_in_before if (*(*func(*libc.TLS, Tz_streamp, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflatePtr})))(tls, sp+64, Z_NO_FLUSH) != Z_OK { if (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg == libc.UintptrFromInt32(0) { v2 = __ccgo_ts + 9405 } else { v2 = (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module130)), __ccgo_ts+56343, libc.VaList(bp1+8, v2)) return 0 } if (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_out == uint32(0) { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFFlushData1})))(tls, tif) != 0) { return 0 } (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fnext_out = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata if libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) <= uint64(0xFFFFFFFF) { v3 = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) } else { v3 = uint32(0xFFFFFFFF) } (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_out = v3 } cc = Ttmsize_t(uint32(cc) - (avail_in_before - (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_in)) } return int32(1) } var _module130 = [10]uint8{'Z', 'I', 'P', 'E', 'n', 'c', 'o', 'd', 'e'} // C documentation // // /* // * Finish off an encoded strip by flushing the last // * string and tacking on an End Of Information code. // */ func _ZIPPostEncode(tls *libc.TLS, tif uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var sp, v2 uintptr var state int32 var v1 uint32 _, _, _, _ = sp, state, v1, v2 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_in = uint32(0) for cond := true; cond; cond = state != int32(Z_STREAM_END) { state = (*(*func(*libc.TLS, Tz_streamp, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflatePtr})))(tls, sp+64, int32(Z_FINISH)) switch state { case int32(Z_STREAM_END): fallthrough case Z_OK: if libc.Int32FromUint32((*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_out) != (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize { (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawcc = libc.Int32FromUint32(libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) - (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_out) if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFFlushData1})))(tls, tif) != 0) { return 0 } (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fnext_out = (*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdata if libc.Uint64FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) <= uint64(0xFFFFFFFF) { v1 = libc.Uint32FromInt32((*TTIFF)(unsafe.Pointer(tif)).Ftif_rawdatasize) } else { v1 = uint32(0xFFFFFFFF) } (*TZIPState)(unsafe.Pointer(sp)).Fstream.Favail_out = v1 } default: if (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg == libc.UintptrFromInt32(0) { v2 = __ccgo_ts + 9405 } else { v2 = (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module131)), __ccgo_ts+56099, libc.VaList(bp+8, v2)) return 0 } } return int32(1) } var _module131 = [14]uint8{'Z', 'I', 'P', 'P', 'o', 's', 't', 'E', 'n', 'c', 'o', 'd', 'e'} func _ZIPCleanup(tls *libc.TLS, tif uintptr) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFPredictorCleanup})))(tls, tif) (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield = (*TZIPState)(unsafe.Pointer(sp)).Fvgetparent (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield = (*TZIPState)(unsafe.Pointer(sp)).Fvsetparent if (*TZIPState)(unsafe.Pointer(sp)).Fstate&int32(ZSTATE_INIT_ENCODE) != 0 { (*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflateEndPtr})))(tls, sp+64) (*TZIPState)(unsafe.Pointer(sp)).Fstate = 0 } else { if (*TZIPState)(unsafe.Pointer(sp)).Fstate&int32(ZSTATE_INIT_DECODE) != 0 { (*(*func(*libc.TLS, Tz_streamp) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FinflateEndPtr})))(tls, sp+64) (*TZIPState)(unsafe.Pointer(sp)).Fstate = 0 } } XTkimgTIFFfree(tls, sp) (*TTIFF)(unsafe.Pointer(tif)).Ftif_data = libc.UintptrFromInt32(0) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFSetDefaultCompressionStatePtr})))(tls, tif) } func _ZIPVSetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var cappedQuality int32 var sp, v1 uintptr _, _, _ = cappedQuality, sp, v1 sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data switch tag { case uint32(TIFFTAG_ZIPQUALITY): (*TZIPState)(unsafe.Pointer(sp)).Fzipquality = libc.VaInt32(&ap) if (*TZIPState)(unsafe.Pointer(sp)).Fzipquality < -int32(1) || (*TZIPState)(unsafe.Pointer(sp)).Fzipquality > int32(LIBDEFLATE_MAX_COMPRESSION_LEVEL) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module132)), __ccgo_ts+56525, libc.VaList(bp+8, int32(LIBDEFLATE_MAX_COMPRESSION_LEVEL))) return 0 } if (*TZIPState)(unsafe.Pointer(sp)).Fstate&int32(ZSTATE_INIT_ENCODE) != 0 { cappedQuality = (*TZIPState)(unsafe.Pointer(sp)).Fzipquality if cappedQuality > int32(Z_BEST_COMPRESSION) { cappedQuality = int32(Z_BEST_COMPRESSION) } if (*(*func(*libc.TLS, Tz_streamp, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZlibtclStubs)(unsafe.Pointer(XzlibtclStubsPtr)).FdeflateParamsPtr})))(tls, sp+64, cappedQuality, Z_DEFAULT_STRATEGY) != Z_OK { if (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg == libc.UintptrFromInt32(0) { v1 = __ccgo_ts + 9405 } else { v1 = (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fmsg } (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module132)), __ccgo_ts+56099, libc.VaList(bp+8, v1)) return 0 } } return int32(1) case uint32(TIFFTAG_DEFLATE_SUBCODEC): (*TZIPState)(unsafe.Pointer(sp)).Fsubcodec = libc.VaInt32(&ap) if (*TZIPState)(unsafe.Pointer(sp)).Fsubcodec != DEFLATE_SUBCODEC_ZLIB && (*TZIPState)(unsafe.Pointer(sp)).Fsubcodec != int32(DEFLATE_SUBCODEC_LIBDEFLATE) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module132)), __ccgo_ts+56578, 0) return 0 } if (*TZIPState)(unsafe.Pointer(sp)).Fsubcodec == int32(DEFLATE_SUBCODEC_LIBDEFLATE) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module132)), __ccgo_ts+56606, 0) return 0 } return int32(1) default: return (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZIPState)(unsafe.Pointer(sp)).Fvsetparent})))(tls, tif, tag, ap) } /*NOTREACHED*/ return r } var _module132 = [13]uint8{'Z', 'I', 'P', 'V', 'S', 'e', 't', 'F', 'i', 'e', 'l', 'd'} func _ZIPVGetField(tls *libc.TLS, tif uintptr, tag Tuint32_t, ap Tva_list) (r int32) { var sp uintptr _ = sp sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data switch tag { case uint32(TIFFTAG_ZIPQUALITY): *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TZIPState)(unsafe.Pointer(sp)).Fzipquality case uint32(TIFFTAG_DEFLATE_SUBCODEC): *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = (*TZIPState)(unsafe.Pointer(sp)).Fsubcodec default: return (*(*func(*libc.TLS, uintptr, Tuint32_t, Tva_list) int32)(unsafe.Pointer(&struct{ uintptr }{(*TZIPState)(unsafe.Pointer(sp)).Fvgetparent})))(tls, tif, tag, ap) } return int32(1) } func _ZipAlloc(tls *libc.TLS, opaque Tvoidpf, items TuInt, size TuInt) (r Tvoidpf) { return XTkimgTIFFmalloc(tls, libc.Int32FromUint32(items*size)) } func _ZipFree(tls *libc.TLS, opaque Tvoidpf, address Tvoidpf) { XTkimgTIFFfree(tls, address) } var _zipFields = [1]TTIFFField{ 0: { Ffield_tag: uint32(TIFFTAG_ZIPQUALITY), Fset_field_type: int32(TIFF_SETGET_INT), Ffield_oktochange: uint8(TRUE), Ffield_name: __ccgo_ts + 9405, }, } func XTkimgTIFFInitZip(tls *libc.TLS, tif uintptr, scheme int32) (r int32) { var sp uintptr _ = sp _ = scheme /* * Merge codec-specific tag information. */ if !((*(*func(*libc.TLS, uintptr, uintptr, Tuint32_t) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).F_TIFFMergeFieldsPtr})))(tls, tif, uintptr(unsafe.Pointer(&_zipFields)), libc.Uint32FromInt64(36)/libc.Uint32FromInt64(36)) != 0) { (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module133)), __ccgo_ts+56675, 0) return 0 } /* * Allocate state block so tag methods have storage to record values. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_data = XTkimgTIFFmalloc(tls, int32(140)) if (*TTIFF)(unsafe.Pointer(tif)).Ftif_data == libc.UintptrFromInt32(0) { goto bad } sp = (*TTIFF)(unsafe.Pointer(tif)).Ftif_data (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fzalloc = __ccgo_fp(_ZipAlloc) (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fzfree = __ccgo_fp(_ZipFree) (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fopaque = libc.UintptrFromInt32(0) (*TZIPState)(unsafe.Pointer(sp)).Fstream.Fdata_type = Z_BINARY /* * Override parent get/set field methods. */ (*TZIPState)(unsafe.Pointer(sp)).Fvgetparent = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvgetfield = __ccgo_fp(_ZIPVGetField) /* hook for codec tags */ (*TZIPState)(unsafe.Pointer(sp)).Fvsetparent = (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield (*TTIFF)(unsafe.Pointer(tif)).Ftif_tagmethods.Fvsetfield = __ccgo_fp(_ZIPVSetField) /* hook for codec tags */ /* Default values for codec-specific fields */ (*TZIPState)(unsafe.Pointer(sp)).Fzipquality = -int32(1) /* default comp. level */ (*TZIPState)(unsafe.Pointer(sp)).Fstate = 0 (*TZIPState)(unsafe.Pointer(sp)).Fsubcodec = DEFLATE_SUBCODEC_ZLIB /* * Install codec methods. */ (*TTIFF)(unsafe.Pointer(tif)).Ftif_fixuptags = __ccgo_fp(_ZIPFixupTags) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupdecode = __ccgo_fp(_ZIPSetupDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_predecode = __ccgo_fp(_ZIPPreDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decoderow = __ccgo_fp(_ZIPDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodestrip = __ccgo_fp(_ZIPDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_decodetile = __ccgo_fp(_ZIPDecode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_setupencode = __ccgo_fp(_ZIPSetupEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_preencode = __ccgo_fp(_ZIPPreEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_postencode = __ccgo_fp(_ZIPPostEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encoderow = __ccgo_fp(_ZIPEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodestrip = __ccgo_fp(_ZIPEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_encodetile = __ccgo_fp(_ZIPEncode) (*TTIFF)(unsafe.Pointer(tif)).Ftif_cleanup = __ccgo_fp(_ZIPCleanup) /* * Setup predictor setup. */ (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFPredictorInit})))(tls, tif) return int32(1) goto bad bad: ; (*(*func(*libc.TLS, Tthandle_t, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTifftclStubs)(unsafe.Pointer(XtifftclStubsPtr)).FtIFFErrorExt})))(tls, (*TTIFF)(unsafe.Pointer(tif)).Ftif_clientdata, uintptr(unsafe.Pointer(&_module133)), __ccgo_ts+56718, 0) return 0 } var _module133 = [12]uint8{'T', 'I', 'F', 'F', 'I', 'n', 'i', 't', 'Z', 'I', 'P'} const PACKAGE_NAME19 = "tkimgwindow" const PACKAGE_STRING20 = "tkimgwindow 2.0.1" const PACKAGE_TARNAME19 = "tkimgwindow" const PACKAGE_TCLNAME17 = "img::window" const XMD_H = 1 const X_AllocColor = 84 const X_AllocColorCells = 86 const X_AllocColorPlanes = 87 const X_AllocNamedColor = 85 const X_AllowEvents = 35 const X_Bell = 104 const X_ChangeActivePointerGrab = 30 const X_ChangeGC = 56 const X_ChangeHosts = 109 const X_ChangeKeyboardControl = 102 const X_ChangeKeyboardMapping = 100 const X_ChangePointerControl = 105 const X_ChangeProperty = 18 const X_ChangeSaveSet = 6 const X_ChangeWindowAttributes = 2 const X_CirculateWindow = 13 const X_ClearArea = 61 const X_CloseFont = 46 const X_ConfigureWindow = 12 const X_ConvertSelection = 24 const X_CopyArea = 62 const X_CopyColormapAndFree = 80 const X_CopyGC = 57 const X_CopyPlane = 63 const X_CreateColormap = 78 const X_CreateCursor = 93 const X_CreateGC = 55 const X_CreateGlyphCursor = 94 const X_CreatePixmap = 53 const X_CreateWindow = 1 const X_DeleteProperty = 19 const X_DestroySubwindows = 5 const X_DestroyWindow = 4 const X_Error = 0 const X_FillPoly = 69 const X_ForceScreenSaver = 115 const X_FreeColormap = 79 const X_FreeColors = 88 const X_FreeCursor = 95 const X_FreeGC = 60 const X_FreePixmap = 54 const X_GetAtomName = 17 const X_GetFontPath = 52 const X_GetGeometry = 14 const X_GetImage = 73 const X_GetInputFocus = 43 const X_GetKeyboardControl = 103 const X_GetKeyboardMapping = 101 const X_GetModifierMapping = 119 const X_GetMotionEvents = 39 const X_GetPointerControl = 106 const X_GetPointerMapping = 117 const X_GetProperty = 20 const X_GetScreenSaver = 108 const X_GetSelectionOwner = 23 const X_GetWindowAttributes = 3 const X_GrabButton = 28 const X_GrabKey = 33 const X_GrabKeyboard = 31 const X_GrabPointer = 26 const X_GrabServer = 36 const X_ImageText16 = 77 const X_ImageText8 = 76 const X_InstallColormap = 81 const X_InternAtom = 16 const X_KillClient = 113 const X_ListExtensions = 99 const X_ListFonts = 49 const X_ListFontsWithInfo = 50 const X_ListHosts = 110 const X_ListInstalledColormaps = 83 const X_ListProperties = 21 const X_LookupColor = 92 const X_MapSubwindows = 9 const X_MapWindow = 8 const X_NoOperation = 127 const X_OpenFont = 45 const X_PolyArc = 68 const X_PolyFillArc = 71 const X_PolyFillRectangle = 70 const X_PolyLine = 65 const X_PolyPoint = 64 const X_PolyRectangle = 67 const X_PolySegment = 66 const X_PolyText16 = 75 const X_PolyText8 = 74 const X_PutImage = 72 const X_QueryBestSize = 97 const X_QueryColors = 91 const X_QueryExtension = 98 const X_QueryFont = 47 const X_QueryKeymap = 44 const X_QueryPointer = 38 const X_QueryTextExtents = 48 const X_QueryTree = 15 const X_RecolorCursor = 96 const X_ReparentWindow = 7 const X_Reply = 1 const X_RotateProperties = 114 const X_SendEvent = 25 const X_SetAccessControl = 111 const X_SetClipRectangles = 59 const X_SetCloseDownMode = 112 const X_SetDashes = 58 const X_SetFontPath = 51 const X_SetInputFocus = 42 const X_SetModifierMapping = 118 const X_SetPointerMapping = 116 const X_SetScreenSaver = 107 const X_SetSelectionOwner = 22 const X_StoreColors = 89 const X_StoreNamedColor = 90 const X_TCP_PORT = 6000 const X_TranslateCoords = 40 const X_UngrabButton = 29 const X_UngrabKey = 34 const X_UngrabKeyboard = 32 const X_UngrabPointer = 27 const X_UngrabServer = 37 const X_UninstallColormap = 82 const X_UnmapSubwindows = 11 const X_UnmapWindow = 10 const X_WarpPointer = 41 const sz_xAllocColorCellsReply = 32 const sz_xAllocColorCellsReq = 12 const sz_xAllocColorPlanesReply = 32 const sz_xAllocColorPlanesReq = 16 const sz_xAllocColorReply = 32 const sz_xAllocColorReq = 16 const sz_xAllocNamedColorReply = 32 const sz_xAllocNamedColorReq = 12 const sz_xAllowEventsReq = 8 const sz_xArc = 12 const sz_xBellReq = 4 const sz_xChangeActivePointerGrabReq = 16 const sz_xChangeGCReq = 12 const sz_xChangeHostsReq = 8 const sz_xChangeKeyboardControlReq = 8 const sz_xChangeKeyboardMappingReq = 8 const sz_xChangeModeReq = 4 const sz_xChangePointerControlReq = 12 const sz_xChangePropertyReq = 24 const sz_xChangeSaveSetReq = 8 const sz_xChangeWindowAttributesReq = 12 const sz_xCharInfo = 12 const sz_xCirculateWindowReq = 8 const sz_xClearAreaReq = 16 const sz_xColorItem = 12 const sz_xConfigureWindowReq = 12 const sz_xConnClientPrefix = 12 const sz_xConnSetup = 32 const sz_xConnSetupPrefix = 8 const sz_xConvertSelectionReq = 24 const sz_xCopyAreaReq = 28 const sz_xCopyColormapAndFreeReq = 12 const sz_xCopyGCReq = 16 const sz_xCopyPlaneReq = 32 const sz_xCreateColormapReq = 16 const sz_xCreateCursorReq = 32 const sz_xCreateGCReq = 16 const sz_xCreateGlyphCursorReq = 32 const sz_xCreatePixmapReq = 16 const sz_xCreateWindowReq = 32 const sz_xDeletePropertyReq = 12 const sz_xDepth = 8 const sz_xError = 32 const sz_xEvent = 32 const sz_xFillPolyReq = 16 const sz_xFontProp = 8 const sz_xForceScreenSaverReq = 4 const sz_xFreeColorsReq = 12 const sz_xGenericReply = 32 const sz_xGetAtomNameReply = 32 const sz_xGetFontPathReply = 32 const sz_xGetGeometryReply = 32 const sz_xGetImageReply = 32 const sz_xGetImageReq = 20 const sz_xGetInputFocusReply = 32 const sz_xGetKeyboardControlReply = 52 const sz_xGetKeyboardMappingReply = 32 const sz_xGetKeyboardMappingReq = 8 const sz_xGetModifierMappingReply = 32 const sz_xGetMotionEventsReply = 32 const sz_xGetMotionEventsReq = 16 const sz_xGetPointerControlReply = 32 const sz_xGetPointerMappingReply = 32 const sz_xGetPropertyReply = 32 const sz_xGetPropertyReq = 24 const sz_xGetScreenSaverReply = 32 const sz_xGetSelectionOwnerReply = 32 const sz_xGetWindowAttributesReply = 44 const sz_xGrabButtonReq = 24 const sz_xGrabKeyReq = 16 const sz_xGrabKeyboardReply = 32 const sz_xGrabKeyboardReq = 16 const sz_xGrabPointerReply = 32 const sz_xGrabPointerReq = 24 const sz_xHostEntry = 4 const sz_xImageText16Req = 16 const sz_xImageText8Req = 16 const sz_xImageTextReq = 16 const sz_xInternAtomReply = 32 const sz_xInternAtomReq = 8 const sz_xKeymapEvent = 32 const sz_xListExtensionsReply = 32 const sz_xListFontsReply = 32 const sz_xListFontsReq = 8 const sz_xListFontsWithInfoReply = 60 const sz_xListFontsWithInfoReq = 8 const sz_xListHostsReply = 32 const sz_xListHostsReq = 4 const sz_xListInstalledColormapsReply = 32 const sz_xListPropertiesReply = 32 const sz_xLookupColorReply = 32 const sz_xLookupColorReq = 12 const sz_xOpenFontReq = 12 const sz_xPixmapFormat = 8 const sz_xPoint = 4 const sz_xPolyArcReq = 12 const sz_xPolyFillArcReq = 12 const sz_xPolyFillRectangleReq = 12 const sz_xPolyLineReq = 12 const sz_xPolyPointReq = 12 const sz_xPolyRectangleReq = 12 const sz_xPolySegmentReq = 12 const sz_xPolyText16Req = 16 const sz_xPolyText8Req = 16 const sz_xPolyTextReq = 16 const sz_xPropIconSize = 24 const sz_xPutImageReq = 24 const sz_xQueryBestSizeReply = 32 const sz_xQueryBestSizeReq = 12 const sz_xQueryColorsReply = 32 const sz_xQueryColorsReq = 8 const sz_xQueryExtensionReply = 32 const sz_xQueryExtensionReq = 8 const sz_xQueryFontReply = 60 const sz_xQueryKeymapReply = 40 const sz_xQueryPointerReply = 32 const sz_xQueryTextExtentsReply = 32 const sz_xQueryTextExtentsReq = 8 const sz_xQueryTreeReply = 32 const sz_xRecolorCursorReq = 20 const sz_xRectangle = 8 const sz_xReparentWindowReq = 16 const sz_xReply = 32 const sz_xReq = 4 const sz_xResourceReq = 8 const sz_xRotatePropertiesReq = 12 const sz_xSegment = 8 const sz_xSendEventReq = 44 const sz_xSetAccessControlReq = 4 const sz_xSetClipRectanglesReq = 12 const sz_xSetCloseDownModeReq = 4 const sz_xSetDashesReq = 12 const sz_xSetFontPathReq = 8 const sz_xSetInputFocusReq = 12 const sz_xSetMappingReply = 32 const sz_xSetModifierMappingReply = 32 const sz_xSetModifierMappingReq = 4 const sz_xSetPointerMappingReply = 32 const sz_xSetPointerMappingReq = 4 const sz_xSetScreenSaverReq = 12 const sz_xSetSelectionOwnerReq = 16 const sz_xStoreColorsReq = 8 const sz_xStoreNamedColorReq = 16 const sz_xTextElt = 2 const sz_xTimecoord = 8 const sz_xTranslateCoordsReply = 32 const sz_xTranslateCoordsReq = 16 const sz_xUngrabButtonReq = 12 const sz_xUngrabKeyReq = 12 const sz_xVisualType = 24 const sz_xWarpPointerReq = 24 const sz_xWindowRoot = 40 const sz_xrgb = 8 const xFalse = 0 const xTrue = 1 var _sImageFormat9 = TTk_PhotoImageFormat{ Fname: __ccgo_ts + 56747, } func init() { p := unsafe.Pointer(&_sImageFormat9) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatch9) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatch9) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileRead9) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringRead9) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWrite9) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWrite9) } /* *---------------------------------------------------------------------------- * * Tkimgwindow_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgwindow_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<result. // * // * Side effects: // * new data is added to the image given by imageHandle. // * // *---------------------------------------------------------------------- // */ func _StringRead9(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r1 int32) { bp := tls.Alloc(80) defer tls.Free(80) var b, blue, fileHeight, fileWidth, g, green, i, nBytes, ncolors, r, result, x, y, v3, v4, v5, v6 int32 var cdata TColormapData var cmap TColormap var handle TTk_ErrorHandler var name, p, visual, ximage uintptr var pixel uint32 var tkwin TTk_Window var _ /* block at bp+0 */ TTk_PhotoImageBlock _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, blue, cdata, cmap, fileHeight, fileWidth, g, green, handle, i, nBytes, name, ncolors, p, pixel, r, result, tkwin, visual, x, ximage, y, v3, v4, v5, v6 result = TCL_OK name = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, dataObj, libc.UintptrFromInt32(0)) tkwin = (*(*func(*libc.TLS, uintptr, uintptr, TTk_Window) TTk_Window)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_NameToWindow})))(tls, interp, name, (*(*func(*libc.TLS, uintptr) TTk_Window)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_MainWindow})))(tls, interp)) if !(tkwin != 0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+48, __ccgo_ts+56766, name, __ccgo_ts+56776, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if !((*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fwindow != 0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+48, __ccgo_ts+56766, name, __ccgo_ts+56794, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } fileWidth = (*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fchanges.Fwidth fileHeight = (*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fchanges.Fheight if srcX+width > fileWidth { width = fileWidth - srcX } if srcY+height > fileHeight { height = fileHeight - srcY } if width <= 0 || height <= 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+48, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } /* * If the window is off the screen it will generate an BadMatch/XError * We catch any BadMatch errors here */ handle = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr, uintptr) TTk_ErrorHandler)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_CreateErrorHandler})))(tls, (*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fdisplay, int32(BadMatch), int32(X_GetImage), -int32(1), __ccgo_fp(_xerrorhandler), tkwin) /* * Generate an XImage from the window. We can then read pixel * values out of the XImage. */ ximage = libx11.XXGetImage(tls, (*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fdisplay, (*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fwindow, srcX, srcY, libc.Uint32FromInt32(width), libc.Uint32FromInt32(height), libc.Uint32FromInt32(^libc.Int32FromInt32(0)), int32(ZPixmap)) (*(*func(*libc.TLS, TTk_ErrorHandler))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_DeleteErrorHandler})))(tls, handle) if ximage == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+48, __ccgo_ts+56811, name, __ccgo_ts+56820, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+width, destY+height) == int32(TCL_ERROR) { return int32(TCL_ERROR) } visual = (*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fvisual cmap = (*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fatts.Fcolormap /* * Obtain information about the colormap, ie the mapping between * pixel values and RGB values. The code below should work * for all Visual types. */ ncolors = (*TVisual)(unsafe.Pointer(visual)).Fmap_entries cdata.Fcolors = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, uint32(12)*libc.Uint32FromInt32(ncolors)) if cdata.Fcolors == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+48, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } cdata.Fncolors = ncolors if (*TVisual)(unsafe.Pointer(visual)).Fclass == int32(DirectColor) || (*TVisual)(unsafe.Pointer(visual)).Fclass == int32(TrueColor) { cdata.Fseparated = int32(1) cdata.Fred_mask = libc.Int32FromUint32((*TVisual)(unsafe.Pointer(visual)).Fred_mask) cdata.Fgreen_mask = libc.Int32FromUint32((*TVisual)(unsafe.Pointer(visual)).Fgreen_mask) cdata.Fblue_mask = libc.Int32FromUint32((*TVisual)(unsafe.Pointer(visual)).Fblue_mask) cdata.Fred_shift = 0 cdata.Fgreen_shift = 0 cdata.Fblue_shift = 0 for int32(0x0001)&(cdata.Fred_mask>>cdata.Fred_shift) == 0 { cdata.Fred_shift++ } for int32(0x0001)&(cdata.Fgreen_mask>>cdata.Fgreen_shift) == 0 { cdata.Fgreen_shift++ } for int32(0x0001)&(cdata.Fblue_mask>>cdata.Fblue_shift) == 0 { cdata.Fblue_shift++ } i = 0 for { if !(i < ncolors) { break } (*(*TXColor)(unsafe.Pointer(cdata.Fcolors + uintptr(i)*12))).Fpixel = libc.Uint32FromInt32(i<> cdata.Fred_shift) *(*uint8)(unsafe.Pointer(p)) = libc.Uint8FromInt32(libc.Int32FromUint16((*(*TXColor)(unsafe.Pointer(cdata.Fcolors + uintptr(r)*12))).Fred) >> int32(8)) if cdata.Fcolor != 0 { g = libc.Int32FromUint32(pixel & libc.Uint32FromInt32(cdata.Fgreen_mask) >> cdata.Fgreen_shift) b = libc.Int32FromUint32(pixel & libc.Uint32FromInt32(cdata.Fblue_mask) >> cdata.Fblue_shift) *(*uint8)(unsafe.Pointer(p + 1)) = libc.Uint8FromInt32(libc.Int32FromUint16((*(*TXColor)(unsafe.Pointer(cdata.Fcolors + uintptr(g)*12))).Fgreen) >> int32(8)) *(*uint8)(unsafe.Pointer(p + 2)) = libc.Uint8FromInt32(libc.Int32FromUint16((*(*TXColor)(unsafe.Pointer(cdata.Fcolors + uintptr(b)*12))).Fblue) >> int32(8)) } } else { *(*uint8)(unsafe.Pointer(p)) = libc.Uint8FromInt32(libc.Int32FromUint16((*(*TXColor)(unsafe.Pointer(cdata.Fcolors + uintptr(pixel)*12))).Fred) >> int32(8)) if cdata.Fcolor != 0 { *(*uint8)(unsafe.Pointer(p + 1)) = libc.Uint8FromInt32(libc.Int32FromUint16((*(*TXColor)(unsafe.Pointer(cdata.Fcolors + uintptr(pixel)*12))).Fgreen) >> int32(8)) *(*uint8)(unsafe.Pointer(p + 2)) = libc.Uint8FromInt32(libc.Int32FromUint16((*(*TXColor)(unsafe.Pointer(cdata.Fcolors + uintptr(pixel)*12))).Fblue) >> int32(8)) } } p += uintptr((*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize) goto _8 _8: ; x++ } goto _7 _7: ; y++ } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, destY, width, height, int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXImage)(unsafe.Pointer(ximage)).Ff.Fdestroy_image})))(tls, ximage) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, cdata.Fcolors) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr) return result } const BG = 0 const FG = 1 const MAX_BUFFER = 4096 const MAX_WORD_LENGTH = 100 const PACKAGE_NAME20 = "tkimgxbm" const PACKAGE_STRING21 = "tkimgxbm 2.0.1" const PACKAGE_TARNAME20 = "tkimgxbm" const PACKAGE_TCLNAME18 = "img::xbm" var _sImageFormat10 = TTk_PhotoImageFormat{ Fname: __ccgo_ts + 56879, } func init() { p := unsafe.Pointer(&_sImageFormat10) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatch10) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatch10) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileRead10) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringRead10) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWrite10) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWrite10) } /* *---------------------------------------------------------------------------- * * Tkimgxbm_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgxbm_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+24, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 12)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 12)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) color = libc.UintptrFromInt32(0) if mode == libc.Int32FromInt32(1)< uint32(0) { color = (*(*func(*libc.TLS, uintptr, TTk_Window, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetColor})))(tls, interp, tkwin, optionStr) if color != 0 { *(*int32)(unsafe.Pointer(opts + 4)) = libc.Int32FromUint16((*TXColor)(unsafe.Pointer(color)).Fred) >> int32(8) *(*int32)(unsafe.Pointer(opts + 12)) = libc.Int32FromUint16((*TXColor)(unsafe.Pointer(color)).Fgreen) >> int32(8) *(*int32)(unsafe.Pointer(opts + 20)) = libc.Int32FromUint16((*TXColor)(unsafe.Pointer(color)).Fblue) >> int32(8) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_FreeColor})))(tls, color) } else { return int32(TCL_ERROR) } } case 2: if libc.Xstrlen(tls, optionStr) > uint32(0) { color = (*(*func(*libc.TLS, uintptr, TTk_Window, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_GetColor})))(tls, interp, tkwin, optionStr) if color != 0 { *(*int32)(unsafe.Pointer(opts + 4 + 1*4)) = libc.Int32FromUint16((*TXColor)(unsafe.Pointer(color)).Fred) >> int32(8) *(*int32)(unsafe.Pointer(opts + 12 + 1*4)) = libc.Int32FromUint16((*TXColor)(unsafe.Pointer(color)).Fgreen) >> int32(8) *(*int32)(unsafe.Pointer(opts + 20 + 1*4)) = libc.Int32FromUint16((*TXColor)(unsafe.Pointer(color)).Fblue) >> int32(8) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_FreeColor})))(tls, color) } else { return int32(TCL_ERROR) } } break } } else { switch *(*int32)(unsafe.Pointer(bp + 4)) { case 0: if (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetBool})))(tls, interp, optionStr, (libc.Int32FromInt32(TCL_NULL_OK)-libc.Int32FromInt32(2))&libc.Int32FromInt64(4), bp+8) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+738, libc.VaList(bp+24, optionStr))) return int32(TCL_ERROR) } (*TFMTOPT13)(unsafe.Pointer(opts)).Fverbose = *(*int32)(unsafe.Pointer(bp + 8)) break } } goto _1 _1: ; i++ } return TCL_OK } var _readOptions15 = [4]uintptr{ 0: __ccgo_ts + 641, 1: __ccgo_ts + 56892, 2: __ccgo_ts + 56904, 3: libc.UintptrFromInt32(0), } var _writeOptions12 = [2]uintptr{ 0: __ccgo_ts + 641, 1: libc.UintptrFromInt32(0), } // C documentation // // /* // *---------------------------------------------------------------------- // * // * StringMatch -- // * // * This procedure is invoked by the photo image type to see if // * a datastring contains image data in XBM format. // * // * Results: // * The return value is >0 if the first characters in data look // * like XBM data, and 0 otherwise. // * // * Side effects: // * none // * // *---------------------------------------------------------------------- // */ func _StringMatch10(tls *libc.TLS, dataObj uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(160) defer tls.Free(160) var _ /* parseInfo at bp+0 */ TParseInfo libc.Xmemset(tls, bp, 0, uint32(148)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _ReadXBMFileHeader(tls, interp, bp, widthPtr, heightPtr) } /* *---------------------------------------------------------------------- * * FileMatch -- * * This procedure is invoked by the photo image type to see if * a channel contains image data in XBM format. * * Results: * The return value is >0 if the first characters in channel "chan" * look like XBM data, and 0 otherwise. * * Side effects: * The access position in chan may change. * *---------------------------------------------------------------------- */ func _FileMatch10(tls *libc.TLS, chan1 TTcl_Channel, fileName uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(160) defer tls.Free(160) var _ /* parseInfo at bp+0 */ TParseInfo libc.Xmemset(tls, bp, 0, uint32(148)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _ReadXBMFileHeader(tls, interp, bp, widthPtr, heightPtr) } // C documentation // // /* // *---------------------------------------------------------------------- // * // * CommonRead -- // * // * This procedure is called by the photo image type to read // * XBM format data from a file or string and write it into a // * given photo image. // * // * Results: // * A standard TCL completion code. If TCL_ERROR is returned // * then an error message is left in interp->result. // * // * Side effects: // * The access position in file f is changed (if read from file) // * and new data is added to the image given by imageHandle. // * // *---------------------------------------------------------------------- // */ func _CommonRead15(tls *libc.TLS, interp uintptr, parseInfo uintptr, fileName uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(112) defer tls.Free(112) var col, i, numBytes, result, row, value, v13 int32 var data, pixelPtr, v10, v11, v12, v4, v5, v6, v7, v8, v9 uintptr var _ /* block at bp+0 */ TTk_PhotoImageBlock var _ /* end at bp+72 */ uintptr var _ /* fileHeight at bp+68 */ int32 var _ /* fileWidth at bp+64 */ int32 var _ /* opts at bp+36 */ TFMTOPT13 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = col, data, i, numBytes, pixelPtr, result, row, value, v10, v11, v12, v13, v4, v5, v6, v7, v8, v9 result = TCL_OK if _ParseFormatOpts15(tls, interp, format, bp+36, libc.Int32FromInt32(1)< *(*int32)(unsafe.Pointer(bp + 64)) { width = *(*int32)(unsafe.Pointer(bp + 64)) - srcX } if srcY+height > *(*int32)(unsafe.Pointer(bp + 68)) { height = *(*int32)(unsafe.Pointer(bp + 68)) - srcY } if width <= 0 || height <= 0 || srcX >= *(*int32)(unsafe.Pointer(bp + 64)) || srcY >= *(*int32)(unsafe.Pointer(bp + 68)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+88, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+width, destY+height) == int32(TCL_ERROR) { return int32(TCL_ERROR) } numBytes = (*(*int32)(unsafe.Pointer(bp + 64)) + int32(7)) / int32(8) * int32(32) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fwidth = *(*int32)(unsafe.Pointer(bp + 64)) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).Fheight = int32(1) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelSize = int32(4) *(*int32)(unsafe.Pointer(bp + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 20 + 2*4)) = int32(2) *(*int32)(unsafe.Pointer(bp + 20 + 3*4)) = int32(3) data = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(numBytes)) if data == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+88, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp))).FpixelPtr = data + uintptr(srcX*int32(4)) row = 0 for { if !(row < srcY+height) { break } pixelPtr = data col = 0 for { if !(col < numBytes/int32(32)) { break } if _NextBitmapWord(tls, interp, parseInfo) != TCL_OK { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, data) return int32(TCL_ERROR) } value = libc.Xstrtol(tls, parseInfo+40, bp+72, 0) if *(*uintptr)(unsafe.Pointer(bp + 72)) == parseInfo+40 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, data) return int32(TCL_ERROR) } i = 0 for { if !(i < int32(8)) { break } if value&int32(0x1) != 0 { v4 = pixelPtr pixelPtr++ *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 36 + 4 + 1*4))) v5 = pixelPtr pixelPtr++ *(*uint8)(unsafe.Pointer(v5)) = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 36 + 12 + 1*4))) v6 = pixelPtr pixelPtr++ *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 36 + 20 + 1*4))) v7 = pixelPtr pixelPtr++ *(*uint8)(unsafe.Pointer(v7)) = uint8(255) } else { v8 = pixelPtr pixelPtr++ *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 36 + 4))) v9 = pixelPtr pixelPtr++ *(*uint8)(unsafe.Pointer(v9)) = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 36 + 12))) v10 = pixelPtr pixelPtr++ *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(*(*int32)(unsafe.Pointer(bp + 36 + 20))) if *(*int32)(unsafe.Pointer(bp + 36 + 4)) < 0 { v11 = pixelPtr pixelPtr++ *(*uint8)(unsafe.Pointer(v11)) = uint8(0) } else { v12 = pixelPtr pixelPtr++ *(*uint8)(unsafe.Pointer(v12)) = uint8(255) } } value >>= int32(1) goto _3 _3: ; i++ } goto _2 _2: ; col++ } if row >= srcY { v13 = destY destY++ if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp, destX, v13, width, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = int32(TCL_ERROR) break } } goto _1 _1: ; row++ } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, data) return result } /* *---------------------------------------------------------------------- * * FileRead -- * * This procedure is called by the photo image type to read * XBM format data from a channel and write it into a given * photo image. * * Results: * A standard TCL completion code. If TCL_ERROR is returned * then an error message is left in interp->result. * * Side effects: * The access position in channel chan is changed, and new data is * added to the image given by imageHandle. * *---------------------------------------------------------------------- */ func _FileRead10(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(160) defer tls.Free(160) var _ /* parseInfo at bp+0 */ TParseInfo libc.Xmemset(tls, bp, 0, uint32(148)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) return _CommonRead15(tls, interp, bp, fileName, format, imageHandle, destX, destY, width, height, srcX, srcY) } /* *---------------------------------------------------------------------- * * StringRead -- * * This procedure is called by the photo image type to read * XBM format data from a string and write it into a given * photo image. * * Results: * A standard TCL completion code. If TCL_ERROR is returned * then an error message is left in interp->result. * * Side effects: * New data is added to the image given by imageHandle. * *---------------------------------------------------------------------- */ func _StringRead10(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(160) defer tls.Free(160) var _ /* parseInfo at bp+0 */ TParseInfo libc.Xmemset(tls, bp, 0, uint32(148)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonRead15(tls, interp, bp, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY) } /* *---------------------------------------------------------------------- * * ReadXBMFileHeader -- * * This procedure reads the XBM header from the beginning of a * XBM file and returns information from the header. * * Results: * The return value is 1 if file "f" appears to start with a valid * XBM header, and 0 otherwise. If the header is valid, * then *widthPtr and *heightPtr are modified to hold the * dimensions of the image and *numColors holds the number of * colors and byteSize the number of bytes used for 1 pixel. * * Side effects: * The access position in f advances. * *---------------------------------------------------------------------- */ /* *---------------------------------------------------------------------- * * NextBitmapWord -- * * This procedure retrieves the next word of information (stuff * between commas or white space) from a bitmap description. * * Results: * Returns TCL_OK if all went well. In this case the next word, * and its length, will be availble in *parseInfoPtr. If the end * of the bitmap description was reached then TCL_ERROR is returned. * * Side effects: * None. * *---------------------------------------------------------------------- */ func _NextBitmapWord(tls *libc.TLS, interp uintptr, parseInfoPtr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var dst uintptr var num, v2, v3, v6, v7 int32 var _ /* buf at bp+0 */ uint8 _, _, _, _, _, _ = dst, num, v2, v3, v6, v7 *(*uint8)(unsafe.Pointer(bp)) = uint8('\000') (*TParseInfo)(unsafe.Pointer(parseInfoPtr)).FwordLength = 0 dst = parseInfoPtr + 40 num = (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, parseInfoPtr, bp, int32(1)) for { v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) v3 = libc.BoolInt32(v2 == int32(' ') || libc.Uint32FromInt32(v2)-uint32('\t') < uint32(5)) goto _4 _4: ; if !(v3 != 0 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) == int32(',')) { break } if num == 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+56916, 0)) return int32(TCL_ERROR) } goto _1 _1: ; num = (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, parseInfoPtr, bp, int32(1)) } for { v6 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) v7 = libc.BoolInt32(v6 == int32(' ') || libc.Uint32FromInt32(v6)-uint32('\t') < uint32(5)) goto _8 _8: ; if !(!(v7 != 0) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(bp))) != int32(',') && num != 0) { break } *(*uint8)(unsafe.Pointer(dst)) = *(*uint8)(unsafe.Pointer(bp)) dst++ (*TParseInfo)(unsafe.Pointer(parseInfoPtr)).FwordLength++ if num == 0 || (*TParseInfo)(unsafe.Pointer(parseInfoPtr)).FwordLength > int32(MAX_WORD_LENGTH) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+56916, 0)) return int32(TCL_ERROR) } goto _5 _5: ; num = (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, parseInfoPtr, bp, int32(1)) } if (*TParseInfo)(unsafe.Pointer(parseInfoPtr)).FwordLength == 0 { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+56916, 0)) return int32(TCL_ERROR) } *(*uint8)(unsafe.Pointer(parseInfoPtr + 40 + uintptr((*TParseInfo)(unsafe.Pointer(parseInfoPtr)).FwordLength))) = uint8(0) return TCL_OK } func _ReadXBMFileHeader(tls *libc.TLS, interp uintptr, pi uintptr, widthPtr uintptr, heightPtr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var height, width int32 var _ /* end at bp+0 */ uintptr _, _ = height, width /* * Parse the lines that define the dimensions of the bitmap, * plus the first line that defines the bitmap data (it declares * the name of a data variable but doesn't include any actual * data). These lines look something like the following: * * #define foo_width 16 * #define foo_height 16 * #define foo_x_hot 3 * #define foo_y_hot 3 * static char foo_bits[] = { * * The x_hot and y_hot lines may or may not be present. It's * important to check for "char" in the last line, in order to * reject old X10-style bitmaps that used shorts. */ width = 0 height = 0 for int32(1) != 0 { if _NextBitmapWord(tls, interp, pi) != TCL_OK { return 0 } if (*TParseInfo)(unsafe.Pointer(pi)).FwordLength >= int32(6) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pi + 40 + uintptr((*TParseInfo)(unsafe.Pointer(pi)).FwordLength-int32(6))))) == int32('_') && libc.Xstrcmp(tls, pi+40+uintptr((*TParseInfo)(unsafe.Pointer(pi)).FwordLength)-uintptr(6), __ccgo_ts+56939) == 0 { if _NextBitmapWord(tls, interp, pi) != TCL_OK { return 0 } width = libc.Xstrtol(tls, pi+40, bp, 0) if *(*uintptr)(unsafe.Pointer(bp)) == pi+40 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0 { return 0 } } else { if (*TParseInfo)(unsafe.Pointer(pi)).FwordLength >= int32(7) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pi + 40 + uintptr((*TParseInfo)(unsafe.Pointer(pi)).FwordLength-int32(7))))) == int32('_') && libc.Xstrcmp(tls, pi+40+uintptr((*TParseInfo)(unsafe.Pointer(pi)).FwordLength)-uintptr(7), __ccgo_ts+56946) == 0 { if _NextBitmapWord(tls, interp, pi) != TCL_OK { return 0 } height = libc.Xstrtol(tls, pi+40, bp, 0) if *(*uintptr)(unsafe.Pointer(bp)) == pi+40 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0 { return 0 } } else { if (*TParseInfo)(unsafe.Pointer(pi)).FwordLength >= int32(6) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pi + 40 + uintptr((*TParseInfo)(unsafe.Pointer(pi)).FwordLength-int32(6))))) == int32('_') && libc.Xstrcmp(tls, pi+40+uintptr((*TParseInfo)(unsafe.Pointer(pi)).FwordLength)-uintptr(6), __ccgo_ts+56954) == 0 { if _NextBitmapWord(tls, interp, pi) != TCL_OK { return 0 } libc.Xstrtol(tls, pi+40, bp, 0) if *(*uintptr)(unsafe.Pointer(bp)) == pi+40 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0 { return 0 } } else { if (*TParseInfo)(unsafe.Pointer(pi)).FwordLength >= int32(6) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pi + 40 + uintptr((*TParseInfo)(unsafe.Pointer(pi)).FwordLength-int32(6))))) == int32('_') && libc.Xstrcmp(tls, pi+40+uintptr((*TParseInfo)(unsafe.Pointer(pi)).FwordLength)-uintptr(6), __ccgo_ts+56961) == 0 { if _NextBitmapWord(tls, interp, pi) != TCL_OK { return 0 } libc.Xstrtol(tls, pi+40, bp, 0) if *(*uintptr)(unsafe.Pointer(bp)) == pi+40 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0 { return 0 } } else { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pi + 40))) == int32('c') && libc.Xstrcmp(tls, pi+40, __ccgo_ts+56968) == 0 { for int32(1) != 0 { if _NextBitmapWord(tls, interp, pi) != TCL_OK { return 0 } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pi + 40))) == int32('{') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pi + 40 + 1))) == 0 { goto getData } } } else { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pi + 40))) == int32('{') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pi + 40 + 1))) == 0 { return 0 } } } } } } } goto getData getData: ; if width == 0 || height == 0 { return 0 } *(*int32)(unsafe.Pointer(widthPtr)) = width *(*int32)(unsafe.Pointer(heightPtr)) = height return int32(1) } // C documentation // // /* // *---------------------------------------------------------------------- // * // * FileWrite // * // * Writes a XBM image to a file. Just calls CommonWrite // * with appropriate arguments. // * // * Results: // * Returns the return value of CommonWrite // * // * Side effects: // * A file is (hopefully) created on success. // * // *---------------------------------------------------------------------- // */ func _FileWrite10(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, fileName, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite12(tls, interp, fileName, format, bp, blockPtr) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } // C documentation // // /* // *---------------------------------------------------------------------- // * // * StringWrite // * // * Writes a XBM image to a string. Just calls CommonWrite // * with appropriate arguments. // * // * Results: // * Returns the return value of CommonWrite // * // * Side effects: // * TODO dataPtr is modified on success. // * // *---------------------------------------------------------------------- // */ func _StringWrite10(tls *libc.TLS, interp uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = result libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp) result = _CommonWrite12(tls, interp, __ccgo_ts+865, format, bp, blockPtr) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp))).FbyteObj) } return result } // C documentation // // /* // *---------------------------------------------------------------------- // * // * CommonWrite // * // * This procedure writes a XBM image to the file fileName // * (if fileName != NULL) or to dataPtr. // * // * Results: // * Returns TCL_OK on success, or TCL_ERROR on error. // * // * Side effects: // * varies (see StringWrite and FileWrite) // * // *---------------------------------------------------------------------- // */ func _CommonWrite12(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, handle uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(336) defer tls.Free(336) var alphaOffset, mask, sep, value, x, y, v1 int32 var imgName, p, pp uintptr var _ /* buffer at bp+0 */ [256]uint8 var _ /* opts at bp+256 */ TFMTOPT13 _, _, _, _, _, _, _, _, _, _ = alphaOffset, imgName, mask, p, pp, sep, value, x, y, v1 sep = int32(' ') p = libc.UintptrFromInt32(0) if _ParseFormatOpts15(tls, interp, format, bp+256, libc.Int32FromInt32(1)<= int32(256) { libc.X__builtin_snprintf(tls, bp, uint32(256), __ccgo_ts+56973, libc.VaList(bp+296, sep, value)) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, libc.Int32FromUint32(libc.Xstrlen(tls, bp))) value = 0 mask = int32(1) sep = int32(',') } goto _3 _3: ; x++ } if mask != int32(1) { libc.X__builtin_snprintf(tls, bp, uint32(256), __ccgo_ts+56973, libc.VaList(bp+296, sep, value)) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp, libc.Int32FromUint32(libc.Xstrlen(tls, bp))) } if y == (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight-int32(1) { (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, __ccgo_ts+56983, int32(2)) } else { (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, __ccgo_ts+56986, int32(2)) sep = int32(' ') } goto _2 _2: ; y++ } return TCL_OK } var _header = [68]uint8{'#', 'd', 'e', 'f', 'i', 'n', 'e', ' ', '%', 's', '_', 'w', 'i', 'd', 't', 'h', ' ', '%', 'd', 10, '#', 'd', 'e', 'f', 'i', 'n', 'e', ' ', '%', 's', '_', 'h', 'e', 'i', 'g', 'h', 't', ' ', '%', 'd', 10, 's', 't', 'a', 't', 'i', 'c', ' ', 'c', 'h', 'a', 'r', ' ', '%', 's', '_', 'b', 'i', 't', 's', '[', ']', ' ', '=', ' ', '{', 10} const PACKAGE_NAME21 = "tkimgxpm" const PACKAGE_STRING22 = "tkimgxpm 2.0.1" const PACKAGE_TARNAME21 = "tkimgxpm" const PACKAGE_TCLNAME19 = "img::xpm" var _sImageFormat11 = TTk_PhotoImageFormat{ Fname: __ccgo_ts + 56989, } func init() { p := unsafe.Pointer(&_sImageFormat11) *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_FileMatch11) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_StringMatch11) *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_FileRead11) *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_StringRead11) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_FileWrite11) *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_StringWrite11) } /* *---------------------------------------------------------------------------- * * Tkimgxpm_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, loads package. * *---------------------------------------------------------------------------- */ func XTkimgxpm_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)<p is changed * *---------------------------------------------------------------------- */ func _Gets(tls *libc.TLS, handle uintptr, buffer uintptr, size int32) (r uintptr) { var p, v2, v3 uintptr var v1 int32 _, _, _, _ = p, v1, v2, v3 /* read data from tkimg_Stream */ p = buffer for (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadPtr})))(tls, handle, p, int32(1)) == int32(1) { size-- v1 = size if v1 <= 0 { *(*uint8)(unsafe.Pointer(p)) = uint8(0) return buffer } v2 = p p++ if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v2))) == int32('\n') { *(*uint8)(unsafe.Pointer(p)) = uint8(0) return buffer } } *(*uint8)(unsafe.Pointer(p)) = uint8(0) if p != buffer { v3 = buffer } else { v3 = libc.UintptrFromInt32(0) } return v3 } func _printImgInfo15(tls *libc.TLS, width int32, height int32, numColors int32, byteSize int32, fileName uintptr, msg uintptr) { bp := tls.Alloc(288) defer tls.Free(288) var outChan TTcl_Channel var _ /* str at bp+0 */ [256]uint8 _ = outChan outChan = (*(*func(*libc.TLS, int32) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStdChannel})))(tls, libc.Int32FromInt32(1)<= *(*TTcl_Size)(unsafe.Pointer(bp)) { i-- v3 = i (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ObjPrintf})))(tls, __ccgo_ts+702, libc.VaList(bp+24, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + uintptr(v3)*4)), libc.UintptrFromInt32(0))))) return int32(TCL_ERROR) } optionStr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_GetStringFromObj})))(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)) + uintptr(i)*4)), libc.UintptrFromInt32(0)) if mode == libc.Int32FromInt32(1)<0 if the first characters in data look // * like XPM data, and 0 otherwise. // * // * Side effects: // * none // * // *---------------------------------------------------------------------- // */ func _StringMatch11(tls *libc.TLS, dataObj uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* byteSize at bp+4 */ int32 var _ /* handle at bp+8 */ Ttkimg_Stream var _ /* numColors at bp+0 */ int32 libc.Xmemset(tls, bp+8, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp+8, dataObj) != 0) { return 0 } return _ReadXPMFileHeader(tls, bp+8, widthPtr, heightPtr, bp, bp+4) } /* *---------------------------------------------------------------------- * * FileMatch -- * * This procedure is invoked by the photo image type to see if * a file contains image data in XPM format. * * Results: * The return value is >0 if the first characters in channel "chan" * look like XPM data, and 0 otherwise. * * Side effects: * The access position in chan may change. * *---------------------------------------------------------------------- */ func _FileMatch11(tls *libc.TLS, chan1 TTcl_Channel, fileName uintptr, format uintptr, widthPtr uintptr, heightPtr uintptr, interp uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* byteSize at bp+4 */ int32 var _ /* handle at bp+8 */ Ttkimg_Stream var _ /* numColors at bp+0 */ int32 libc.Xmemset(tls, bp+8, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp+8, chan1) return _ReadXPMFileHeader(tls, bp+8, widthPtr, heightPtr, bp, bp+4) } // C documentation // // /* // *---------------------------------------------------------------------- // * // * CommonRead -- // * // * This procedure is called by the photo image type to read // * XPM format data from a file or string and write it into a // * given photo image. // * // * Results: // * A standard TCL completion code. If TCL_ERROR is returned // * then an error message is left in interp->result. // * // * Side effects: // * The access position in file f is changed (if read from file) // * and new data is added to the image given by imageHandle. // * // *---------------------------------------------------------------------- // */ func _CommonRead16(tls *libc.TLS, interp uintptr, handle uintptr, fileName uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(176) defer tls.Free(176) var buffer, colorDefn, colorName, display, hPtr, p, pixelPtr, useName, v10, v2, v3, v8 uintptr var colormap TColormap var depth, h, i, isMono, j, len1, maxBuffer, nchan, result, retVal, v6, v7 int32 var tkwin TTk_Window var v4, v5 uint16 var _ /* block at bp+16 */ TTk_PhotoImageBlock var _ /* byteSize at bp+12 */ int32 var _ /* col at bp+140 */ uint32 var _ /* color at bp+120 */ TXColor var _ /* color1 at bp+108 */ int32 var _ /* colorTable at bp+52 */ TTcl_HashTable var _ /* data at bp+112 */ uint32 var _ /* fileHeight at bp+4 */ int32 var _ /* fileWidth at bp+0 */ int32 var _ /* found at bp+132 */ int32 var _ /* numColors at bp+8 */ int32 var _ /* opts at bp+116 */ TFMTOPT14 var _ /* type at bp+136 */ int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = buffer, colorDefn, colorName, colormap, depth, display, h, hPtr, i, isMono, j, len1, maxBuffer, nchan, p, pixelPtr, result, retVal, tkwin, useName, v10, v2, v3, v4, v5, v6, v7, v8 *(*int32)(unsafe.Pointer(bp)) = 0 *(*int32)(unsafe.Pointer(bp + 4)) = 0 *(*int32)(unsafe.Pointer(bp + 8)) = 0 *(*int32)(unsafe.Pointer(bp + 12)) = 0 tkwin = (*(*func(*libc.TLS, uintptr) TTk_Window)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_MainWindow})))(tls, interp) display = (*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fdisplay colormap = (*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fatts.Fcolormap depth = (*TTk_FakeWin)(unsafe.Pointer(tkwin)).Fdepth result = TCL_OK if _ParseFormatOpts16(tls, interp, format, bp+116, libc.Int32FromInt32(1)< int32(4) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+57133, __ccgo_ts+57171, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if srcX+width > *(*int32)(unsafe.Pointer(bp)) { width = *(*int32)(unsafe.Pointer(bp)) - srcX } if srcY+height > *(*int32)(unsafe.Pointer(bp + 4)) { height = *(*int32)(unsafe.Pointer(bp + 4)) - srcY } if width <= 0 || height <= 0 || srcX >= *(*int32)(unsafe.Pointer(bp)) || srcY >= *(*int32)(unsafe.Pointer(bp + 4)) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+2005, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } /* buffer must be large enough to hold either the color definitions * as well as the row data. For images with little number of columns, * the calculation done below does not give enough space for the * color descriptions, ex. " s None c None", */ maxBuffer = *(*int32)(unsafe.Pointer(bp + 12))**(*int32)(unsafe.Pointer(bp)) + int32(2) if maxBuffer < int32(30) { maxBuffer = int32(30) } buffer = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(maxBuffer)) if buffer == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+57196, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } i = 0 for { if !(i < *(*int32)(unsafe.Pointer(bp + 8))) { break } p = _Gets(tls, handle, buffer, maxBuffer) if p == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+57236, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } for { v2 = libc.Xstrchr(tls, p, int32('"')) p = v2 if !(v2 == libc.UintptrFromInt32(0)) { break } p = _Gets(tls, handle, buffer, maxBuffer) if p == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+57236, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } p = buffer } colorDefn = p + uintptr(*(*int32)(unsafe.Pointer(bp + 12))) + uintptr(1) colorName = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Xstrlen(tls, colorDefn)+uint32(1)) useName = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Xstrlen(tls, colorDefn)+uint32(1)) if colorDefn == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } if useName == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, colorDefn) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+896, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } *(*int32)(unsafe.Pointer(bp + 132)) = 0 *(*int32)(unsafe.Pointer(bp + 108)) = 0 *(*uint32)(unsafe.Pointer(bp + 112)) = uint32(0) for colorDefn != 0 && *(*uint8)(unsafe.Pointer(colorDefn)) != 0 { v3 = _GetColor1(tls, colorDefn, colorName, bp+136) colorDefn = v3 if v3 == libc.UintptrFromInt32(0) { break } if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(colorName))) == int32('\000') { continue } switch *(*int32)(unsafe.Pointer(bp + 136)) { case int32(XPM_MONO): if isMono != 0 && depth == int32(1) { libc.Xstrcpy(tls, useName, colorName) *(*int32)(unsafe.Pointer(bp + 132)) = int32(1) goto gotcolor } case int32(XPM_GRAY_4): if isMono != 0 && depth == int32(4) { libc.Xstrcpy(tls, useName, colorName) *(*int32)(unsafe.Pointer(bp + 132)) = int32(1) goto gotcolor } case int32(XPM_GRAY): if isMono != 0 && depth > int32(4) { libc.Xstrcpy(tls, useName, colorName) *(*int32)(unsafe.Pointer(bp + 132)) = int32(1) goto gotcolor } case int32(XPM_COLOR): if !(isMono != 0) { libc.Xstrcpy(tls, useName, colorName) *(*int32)(unsafe.Pointer(bp + 132)) = int32(1) goto gotcolor } break } if *(*int32)(unsafe.Pointer(bp + 136)) != int32(XPM_SYMBOLIC) && *(*int32)(unsafe.Pointer(bp + 136)) != int32(XPM_UNKNOWN) { if !(*(*int32)(unsafe.Pointer(bp + 132)) != 0) { /* use this color as default */ libc.Xstrcpy(tls, useName, colorName) *(*int32)(unsafe.Pointer(bp + 132)) = int32(1) } } } goto gotcolor gotcolor: ; libc.Xmemcpy(tls, bp+108, p+uintptr(1), libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(bp + 12)))) p = useName for libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('"') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\t') { p++ } *(*uint8)(unsafe.Pointer(p)) = uint8(0) *(*uint32)(unsafe.Pointer(bp + 112)) = uint32(0) if libc.Xstrncasecmp(tls, useName, __ccgo_ts+2169, uint32(4)) != 0 { if libx11.XXParseColor(tls, display, colormap, useName, bp+120) == 0 { v5 = libc.Uint16FromInt32(0) (*(*TXColor)(unsafe.Pointer(bp + 120))).Fblue = v5 v4 = v5 (*(*TXColor)(unsafe.Pointer(bp + 120))).Fgreen = v4 (*(*TXColor)(unsafe.Pointer(bp + 120))).Fred = v4 } *(*uint8)(unsafe.Pointer(bp + 112)) = libc.Uint8FromInt32(libc.Int32FromUint16((*(*TXColor)(unsafe.Pointer(bp + 120))).Fred) >> int32(8)) *(*uint8)(unsafe.Pointer(bp + 112 + 1)) = libc.Uint8FromInt32(libc.Int32FromUint16((*(*TXColor)(unsafe.Pointer(bp + 120))).Fgreen) >> int32(8)) *(*uint8)(unsafe.Pointer(bp + 112 + 2)) = libc.Uint8FromInt32(libc.Int32FromUint16((*(*TXColor)(unsafe.Pointer(bp + 120))).Fblue) >> int32(8)) *(*uint8)(unsafe.Pointer(bp + 112 + 3)) = uint8(255) } hPtr = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTcl_HashTable)(unsafe.Pointer(bp + 52)).FcreateProc})))(tls, bp+52, uintptr(*(*int32)(unsafe.Pointer(bp + 108))), bp+132) (*TTcl_HashEntry)(unsafe.Pointer(hPtr)).FclientData = uintptr(libc.Int32FromUint32(*(*uint32)(unsafe.Pointer(bp + 112)))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, colorName) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, useName) goto _1 _1: ; i++ } if (*(*TFMTOPT14)(unsafe.Pointer(bp + 116))).Fverbose != 0 { _printImgInfo15(tls, *(*int32)(unsafe.Pointer(bp)), *(*int32)(unsafe.Pointer(bp + 4)), *(*int32)(unsafe.Pointer(bp + 8)), *(*int32)(unsafe.Pointer(bp + 12)), fileName, __ccgo_ts+881) } (*(*func(*libc.TLS, TTk_PhotoHandle, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoGetImage})))(tls, imageHandle, bp+16) if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoExpand})))(tls, interp, imageHandle, destX+width, destY+height) == int32(TCL_ERROR) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) return int32(TCL_ERROR) } nchan = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).FpixelSize (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).Fpitch = nchan * *(*int32)(unsafe.Pointer(bp)) (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).Fwidth = width (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).Fheight = int32(1) *(*int32)(unsafe.Pointer(bp + 16 + 20)) = 0 *(*int32)(unsafe.Pointer(bp + 16 + 20 + 1*4)) = int32(1) *(*int32)(unsafe.Pointer(bp + 16 + 20 + 2*4)) = int32(2) if nchan == int32(4) { v6 = int32(3) } else { v6 = 0 } *(*int32)(unsafe.Pointer(bp + 16 + 20 + 3*4)) = v6 (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).FpixelPtr = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AttemptAlloc})))(tls, libc.Uint32FromInt32(nchan)*libc.Uint32FromInt32(width)) if (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).FpixelPtr == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+896, libc.UintptrFromInt32(0))) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) return int32(TCL_ERROR) } i = srcY for { v7 = i i-- if !(v7 > 0) { break } p = _Gets(tls, handle, buffer, maxBuffer) if p == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+57262, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } for { v8 = libc.Xstrchr(tls, p, int32('"')) p = v8 if !(v8 == libc.UintptrFromInt32(0)) { break } p = _Gets(tls, handle, buffer, maxBuffer) if p == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+57262, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } p = buffer } } h = height for { if !(h > 0) { break } p = _Gets(tls, handle, buffer, maxBuffer) if p == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+57262, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } for { v10 = libc.Xstrchr(tls, p, int32('"')) p = v10 if !(v10 == libc.UintptrFromInt32(0)) { break } p = _Gets(tls, handle, buffer, maxBuffer) if p == libc.UintptrFromInt32(0) { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+152, __ccgo_ts+57262, libc.UintptrFromInt32(0))) return int32(TCL_ERROR) } p = buffer } p += uintptr(*(*int32)(unsafe.Pointer(bp + 12))*srcX + int32(1)) pixelPtr = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).FpixelPtr i = 0 for { if !(i < width) { break } libc.Xmemcpy(tls, bp+108, p, libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(bp + 12)))) hPtr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTcl_HashTable)(unsafe.Pointer(bp + 52)).FfindProc})))(tls, bp+52, uintptr(*(*int32)(unsafe.Pointer(bp + 108)))) /* * if hPtr == NULL, we have an invalid color entry in the XPM * file. We use transparant as default color */ if hPtr != libc.UintptrFromInt32(0) { *(*uint32)(unsafe.Pointer(bp + 140)) = libc.Uint32FromInt32(int32((*TTcl_HashEntry)(unsafe.Pointer(hPtr)).FclientData)) } else { *(*uint32)(unsafe.Pointer(bp + 140)) = libc.Uint32FromInt32(0) } /* * we've found a non-transparent pixel, let's search the next * transparent pixel and copy this block to the image */ if *(*uint32)(unsafe.Pointer(bp + 140)) != 0 { len1 = 0 j = i pixelPtr = (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).FpixelPtr for cond := true; cond; cond = i < width && *(*uint32)(unsafe.Pointer(bp + 140)) != 0 { libc.Xmemcpy(tls, pixelPtr, bp+140, libc.Uint32FromInt32((*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).FpixelSize)) pixelPtr += uintptr((*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).FpixelSize) i++ len1++ p += uintptr(*(*int32)(unsafe.Pointer(bp + 12))) if i < width { libc.Xmemcpy(tls, bp+108, p, libc.Uint32FromInt32(*(*int32)(unsafe.Pointer(bp + 12)))) hPtr = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTcl_HashTable)(unsafe.Pointer(bp + 52)).FfindProc})))(tls, bp+52, uintptr(*(*int32)(unsafe.Pointer(bp + 108)))) if hPtr != libc.UintptrFromInt32(0) { *(*uint32)(unsafe.Pointer(bp + 140)) = libc.Uint32FromInt32(int32((*TTcl_HashEntry)(unsafe.Pointer(hPtr)).FclientData)) } else { *(*uint32)(unsafe.Pointer(bp + 140)) = libc.Uint32FromInt32(0) } } } if (*(*func(*libc.TLS, uintptr, TTk_PhotoHandle, uintptr, int32, int32, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Ftk_PhotoPutBlock})))(tls, interp, imageHandle, bp+16, destX+j, destY, len1, int32(1), int32(TK_PHOTO_COMPOSITE_SET)) == int32(TCL_ERROR) { result = int32(TCL_ERROR) break } } else { p += uintptr(*(*int32)(unsafe.Pointer(bp + 12))) i++ } goto _11 _11: } destY++ goto _9 _9: ; h-- } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DeleteHashTable})))(tls, bp+52) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, buffer) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_Free})))(tls, (*(*TTk_PhotoImageBlock)(unsafe.Pointer(bp + 16))).FpixelPtr) return result } /* *---------------------------------------------------------------------- * * FileRead -- * * This procedure is called by the photo image type to read * XPM format data from a channel and write it into a given * photo image. * * Results: * A standard TCL completion code. If TCL_ERROR is returned * then an error message is left in interp->result. * * Side effects: * The access position in channel chan is changed, and new * data is added to the image given by imageHandle. * *---------------------------------------------------------------------- */ func _FileRead11(tls *libc.TLS, interp uintptr, chan1 TTcl_Channel, fileName uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var retVal int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = retVal libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitFilePtr})))(tls, bp, chan1) (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, bp, int32(1)) retVal = _CommonRead16(tls, interp, bp, fileName, format, imageHandle, destX, destY, width, height, srcX, srcY) (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_EnableReadBufferPtr})))(tls, bp, 0) return retVal } /* *---------------------------------------------------------------------- * * StringRead -- * * This procedure is called by the photo image type to read * XPM format data from a string and write it into a given * photo image. * * Results: * A standard TCL completion code. If TCL_ERROR is returned * then an error message is left in interp->result. * * Side effects: * New data is added to the image given by imageHandle. * *---------------------------------------------------------------------- */ func _StringRead11(tls *libc.TLS, interp uintptr, dataObj uintptr, format uintptr, imageHandle TTk_PhotoHandle, destX int32, destY int32, width int32, height int32, srcX int32, srcY int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* handle at bp+0 */ Ttkimg_Stream libc.Xmemset(tls, bp, 0, uint32(40)) if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_ReadInitStringPtr})))(tls, bp, dataObj) != 0) { return 0 } return _CommonRead16(tls, interp, bp, __ccgo_ts+865, format, imageHandle, destX, destY, width, height, srcX, srcY) } /* *---------------------------------------------------------------------- * * ReadXPMFileHeader -- * * This procedure reads the XPM header from the beginning of a * XPM file and returns information from the header. * * Results: * The return value is 1 if file "f" appears to start with a valid * XPM header, and 0 otherwise. If the header is valid, * then *widthPtr and *heightPtr are modified to hold the * dimensions of the image and *numColors holds the number of * colors and byteSize the number of bytes used for 1 pixel. * * Side effects: * The access position in f advances. * *---------------------------------------------------------------------- */ func _ReadXPMFileHeader(tls *libc.TLS, handle uintptr, widthPtr uintptr, heightPtr uintptr, numColors uintptr, byteSize uintptr) (r int32) { bp := tls.Alloc(4112) defer tls.Free(4112) var v1, v11, v12, v15, v16, v19, v2, v20, v7, v8 int32 var v10, v14, v18, v22, v4 bool var v5, v6 uintptr var _ /* buffer at bp+0 */ [4096]uint8 var _ /* p at bp+4096 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = v1, v10, v11, v12, v14, v15, v16, v18, v19, v2, v20, v22, v4, v5, v6, v7, v8 *(*uintptr)(unsafe.Pointer(bp + 4096)) = _Gets(tls, handle, bp, int32(MAX_BUFFER)) if *(*uintptr)(unsafe.Pointer(bp + 4096)) == libc.UintptrFromInt32(0) { return 0 } *(*uintptr)(unsafe.Pointer(bp + 4096)) = bp for { if v4 = *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4096)))) != 0; v4 { v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4096))))) v2 = libc.BoolInt32(v1 == int32(' ') || libc.Uint32FromInt32(v1)-uint32('\t') < uint32(5)) goto _3 _3: } if !(v4 && v2 != 0) { break } *(*uintptr)(unsafe.Pointer(bp + 4096))++ } if libc.Xstrncmp(tls, __ccgo_ts+48456, *(*uintptr)(unsafe.Pointer(bp + 4096)), uint32(6)) != 0 { return 0 } for { v5 = libc.Xstrchr(tls, *(*uintptr)(unsafe.Pointer(bp + 4096)), int32('{')) *(*uintptr)(unsafe.Pointer(bp + 4096)) = v5 if !(v5 == libc.UintptrFromInt32(0)) { break } *(*uintptr)(unsafe.Pointer(bp + 4096)) = _Gets(tls, handle, bp, int32(MAX_BUFFER)) if *(*uintptr)(unsafe.Pointer(bp + 4096)) == libc.UintptrFromInt32(0) { return 0 } *(*uintptr)(unsafe.Pointer(bp + 4096)) = bp } for { v6 = libc.Xstrchr(tls, *(*uintptr)(unsafe.Pointer(bp + 4096)), int32('"')) *(*uintptr)(unsafe.Pointer(bp + 4096)) = v6 if !(v6 == libc.UintptrFromInt32(0)) { break } *(*uintptr)(unsafe.Pointer(bp + 4096)) = _Gets(tls, handle, bp, int32(MAX_BUFFER)) if *(*uintptr)(unsafe.Pointer(bp + 4096)) == libc.UintptrFromInt32(0) { return 0 } *(*uintptr)(unsafe.Pointer(bp + 4096)) = bp } *(*uintptr)(unsafe.Pointer(bp + 4096))++ for { if v10 = *(*uintptr)(unsafe.Pointer(bp + 4096)) != 0 && *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4096)))) != 0; v10 { v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4096))))) v8 = libc.BoolInt32(v7 == int32(' ') || libc.Uint32FromInt32(v7)-uint32('\t') < uint32(5)) goto _9 _9: } if !(v10 && v8 != 0) { break } *(*uintptr)(unsafe.Pointer(bp + 4096))++ } *(*int32)(unsafe.Pointer(widthPtr)) = libc.Int32FromUint32(libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 4096)), bp+4096, 0)) if *(*uintptr)(unsafe.Pointer(bp + 4096)) == libc.UintptrFromInt32(0) || *(*int32)(unsafe.Pointer(widthPtr)) <= 0 { return 0 } for { if v14 = *(*uintptr)(unsafe.Pointer(bp + 4096)) != 0 && *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4096)))) != 0; v14 { v11 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4096))))) v12 = libc.BoolInt32(v11 == int32(' ') || libc.Uint32FromInt32(v11)-uint32('\t') < uint32(5)) goto _13 _13: } if !(v14 && v12 != 0) { break } *(*uintptr)(unsafe.Pointer(bp + 4096))++ } *(*int32)(unsafe.Pointer(heightPtr)) = libc.Int32FromUint32(libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 4096)), bp+4096, 0)) if *(*uintptr)(unsafe.Pointer(bp + 4096)) == libc.UintptrFromInt32(0) || *(*int32)(unsafe.Pointer(heightPtr)) <= 0 { return 0 } for { if v18 = *(*uintptr)(unsafe.Pointer(bp + 4096)) != 0 && *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4096)))) != 0; v18 { v15 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4096))))) v16 = libc.BoolInt32(v15 == int32(' ') || libc.Uint32FromInt32(v15)-uint32('\t') < uint32(5)) goto _17 _17: } if !(v18 && v16 != 0) { break } *(*uintptr)(unsafe.Pointer(bp + 4096))++ } *(*int32)(unsafe.Pointer(numColors)) = libc.Int32FromUint32(libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 4096)), bp+4096, 0)) if *(*uintptr)(unsafe.Pointer(bp + 4096)) == libc.UintptrFromInt32(0) { return 0 } for { if v22 = *(*uintptr)(unsafe.Pointer(bp + 4096)) != 0 && *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4096)))) != 0; v22 { v19 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4096))))) v20 = libc.BoolInt32(v19 == int32(' ') || libc.Uint32FromInt32(v19)-uint32('\t') < uint32(5)) goto _21 _21: } if !(v22 && v20 != 0) { break } *(*uintptr)(unsafe.Pointer(bp + 4096))++ } *(*int32)(unsafe.Pointer(byteSize)) = libc.Int32FromUint32(libc.Xstrtoul(tls, *(*uintptr)(unsafe.Pointer(bp + 4096)), bp+4096, 0)) if *(*uintptr)(unsafe.Pointer(bp + 4096)) == libc.UintptrFromInt32(0) { return 0 } return int32(1) } func _GetType1(tls *libc.TLS, colorDefn uintptr, type_ret uintptr) (r uintptr) { var p uintptr var v1, v10, v13, v14, v17, v18, v2, v21, v22, v5, v6, v9 int32 var v12, v16, v20, v24, v4, v8 bool _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = p, v1, v10, v12, v13, v14, v16, v17, v18, v2, v20, v21, v22, v24, v4, v5, v6, v8, v9 p = colorDefn /* skip white spaces */ for { if v4 = *(*uint8)(unsafe.Pointer(p)) != 0; v4 { v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) v2 = libc.BoolInt32(v1 == int32(' ') || libc.Uint32FromInt32(v1)-uint32('\t') < uint32(5)) goto _3 _3: } if !(v4 && v2 != 0) { break } p++ } /* parse the type */ if v8 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('m') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) != int32('\000'); v8 { v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) v6 = libc.BoolInt32(v5 == int32(' ') || libc.Uint32FromInt32(v5)-uint32('\t') < uint32(5)) goto _7 _7: } if v8 && v6 != 0 { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_MONO) p += uintptr(2) } else { if v12 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('g') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32('4') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) != int32('\000'); v12 { v9 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) v10 = libc.BoolInt32(v9 == int32(' ') || libc.Uint32FromInt32(v9)-uint32('\t') < uint32(5)) goto _11 _11: } if v12 && v10 != 0 { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_GRAY_4) p += uintptr(3) } else { if v16 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('g') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) != int32('\000'); v16 { v13 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) v14 = libc.BoolInt32(v13 == int32(' ') || libc.Uint32FromInt32(v13)-uint32('\t') < uint32(5)) goto _15 _15: } if v16 && v14 != 0 { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_GRAY) p += uintptr(2) } else { if v20 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('c') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) != int32('\000'); v20 { v17 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) v18 = libc.BoolInt32(v17 == int32(' ') || libc.Uint32FromInt32(v17)-uint32('\t') < uint32(5)) goto _19 _19: } if v20 && v18 != 0 { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_COLOR) p += uintptr(2) } else { if v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) != int32('\000') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32('s') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) != int32('\000'); v24 { v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) v22 = libc.BoolInt32(v21 == int32(' ') || libc.Uint32FromInt32(v21)-uint32('\t') < uint32(5)) goto _23 _23: } if v24 && v22 != 0 { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_SYMBOLIC) p += uintptr(2) } else { *(*int32)(unsafe.Pointer(type_ret)) = int32(XPM_UNKNOWN) return libc.UintptrFromInt32(0) } } } } } return p } // C documentation // // /* colorName is guaranteed to be big enough */ func _GetColor1(tls *libc.TLS, colorDefn uintptr, colorName uintptr, type_ret uintptr) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var p, v1, v10, v11, v16, v17 uintptr var v12, v13, v2, v3, v6, v7 int32 var v15, v5, v9 bool var _ /* dummy at bp+4 */ int32 var _ /* type at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = p, v1, v10, v11, v12, v13, v15, v16, v17, v2, v3, v5, v6, v7, v9 if !(colorDefn != 0) { return libc.UintptrFromInt32(0) } v1 = _GetType1(tls, colorDefn, bp) colorDefn = v1 if v1 == libc.UintptrFromInt32(0) { /* unknown type */ return libc.UintptrFromInt32(0) } else { *(*int32)(unsafe.Pointer(type_ret)) = *(*int32)(unsafe.Pointer(bp)) } /* skip white spaces */ for { if v5 = *(*uint8)(unsafe.Pointer(colorDefn)) != 0; v5 { v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(colorDefn))) v3 = libc.BoolInt32(v2 == int32(' ') || libc.Uint32FromInt32(v2)-uint32('\t') < uint32(5)) goto _4 _4: } if !(v5 && v3 != 0) { break } colorDefn++ } p = colorName for int32(1) != 0 { for { if v9 = *(*uint8)(unsafe.Pointer(colorDefn)) != 0; v9 { v6 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(colorDefn))) v7 = libc.BoolInt32(v6 == int32(' ') || libc.Uint32FromInt32(v6)-uint32('\t') < uint32(5)) goto _8 _8: } if !(v9 && !(v7 != 0)) { break } v10 = p p++ v11 = colorDefn colorDefn++ *(*uint8)(unsafe.Pointer(v10)) = *(*uint8)(unsafe.Pointer(v11)) } if !(*(*uint8)(unsafe.Pointer(colorDefn)) != 0) { break } if _GetType1(tls, colorDefn, bp+4) == libc.UintptrFromInt32(0) { /* the next string should also be considered as a part of a color * name */ for { if v15 = *(*uint8)(unsafe.Pointer(colorDefn)) != 0; v15 { v12 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(colorDefn))) v13 = libc.BoolInt32(v12 == int32(' ') || libc.Uint32FromInt32(v12)-uint32('\t') < uint32(5)) goto _14 _14: } if !(v15 && v13 != 0) { break } v16 = p p++ v17 = colorDefn colorDefn++ *(*uint8)(unsafe.Pointer(v16)) = *(*uint8)(unsafe.Pointer(v17)) } } else { break } if !(*(*uint8)(unsafe.Pointer(colorDefn)) != 0) { break } } /* Mark the end of the colorName */ *(*uint8)(unsafe.Pointer(p)) = uint8('\000') return colorDefn } // C documentation // // /* // *---------------------------------------------------------------------- // * // * FileWrite // * // * Writes a XPM image to a file. Just calls CommonWrite // * with appropriate arguments. // * // * Results: // * Returns the return value of CommonWrite // * // * Side effects: // * A file is (hopefully) created on success. // * // *---------------------------------------------------------------------- // */ func _FileWrite11(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var chan1 TTcl_Channel var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _, _ = chan1, result libc.Xmemset(tls, bp, 0, uint32(40)) chan1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) TTcl_Channel)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_OpenFileChannelPtr})))(tls, interp, fileName, __ccgo_ts+876) if !(chan1 != 0) { return int32(TCL_ERROR) } (*(*func(*libc.TLS, uintptr, TTcl_Channel))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitFilePtr})))(tls, bp, chan1) result = _CommonWrite13(tls, interp, fileName, format, bp, blockPtr) if (*(*func(*libc.TLS, uintptr, TTcl_Channel, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_CloseEx})))(tls, interp, chan1, 0) == int32(TCL_ERROR) { return int32(TCL_ERROR) } return result } // C documentation // // /* // *---------------------------------------------------------------------- // * // * StringWrite // * // * Writes a XPM image to a string. Just calls CommonWrite // * with appropriate arguments. // * // * Results: // * Returns the return value of CommonWrite // * // * Side effects: // * The byte array containing the image is modified on success. // * // *---------------------------------------------------------------------- // */ func _StringWrite11(tls *libc.TLS, interp uintptr, format uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var result int32 var _ /* handle at bp+0 */ Ttkimg_Stream _ = result libc.Xmemset(tls, bp, 0, uint32(40)) (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WriteInitStringPtr})))(tls, bp) result = _CommonWrite13(tls, interp, __ccgo_ts+865, format, bp, blockPtr) if result == TCL_OK { (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_SetObjResult})))(tls, interp, (*(*Ttkimg_Stream)(unsafe.Pointer(bp))).FbyteObj) } return result } // C documentation // // /* // *---------------------------------------------------------------------- // * // * CommonWrite // * // * This procedure writes a XPM image to the file filename // * (if filename != NULL) or to dataPtr. // * // * Results: // * Returns TCL_OK on success, or TCL_ERROR on error. // * Possible failures are: // * 1. cannot access file (permissions or path not found) // * 2. TkPhotoGetMask fails to retrieve the region mask // * for the image (should not happen) // * // * Side effects: // * varies (see StringWrite and FileWrite) // * // *---------------------------------------------------------------------- // */ func _CommonWrite13(tls *libc.TLS, interp uintptr, fileName uintptr, format uintptr, handle uintptr, blockPtr uintptr) (r int32) { bp := tls.Alloc(400) defer tls.Free(400) var alphaOffset, blueOffset, chars_per_pixel, greenOffset, i, ncolors, x, y, v1, v5 int32 var entry, imgName, p, pixelPtr, pp, rowPixPtr uintptr var _ /* buffer at bp+88 */ [256]uint8 var _ /* col at bp+72 */ struct { Fcomponent [0][3]uint8 Fvalue TClientData } var _ /* colors at bp+4 */ TTcl_HashTable var _ /* found at bp+0 */ int32 var _ /* opts at bp+344 */ TFMTOPT14 var _ /* search at bp+60 */ TTcl_HashSearch var _ /* temp at bp+80 */ struct { Fcomponent [0][5]uint8 Fvalue TClientData F__ccgo_pad2 [4]byte } _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alphaOffset, blueOffset, chars_per_pixel, entry, greenOffset, i, imgName, ncolors, p, pixelPtr, pp, rowPixPtr, x, y, v1, v5 if _ParseFormatOpts16(tls, interp, format, bp+344, libc.Int32FromInt32(1)<= 0) { break } if !(alphaOffset != 0) || *(*uint8)(unsafe.Pointer(pp + uintptr(alphaOffset))) != 0 { *(*uint8)(unsafe.Pointer(bp + 72)) = *(*uint8)(unsafe.Pointer(pp)) *(*uint8)(unsafe.Pointer(bp + 72 + 1)) = *(*uint8)(unsafe.Pointer(pp + uintptr(greenOffset))) *(*uint8)(unsafe.Pointer(bp + 72 + 2)) = *(*uint8)(unsafe.Pointer(pp + uintptr(blueOffset))) if (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTcl_HashTable)(unsafe.Pointer(bp + 4)).FfindProc})))(tls, bp+4, *(*TClientData)(unsafe.Pointer(bp + 72))) == libc.UintptrFromInt32(0) { ncolors++ entry = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTcl_HashTable)(unsafe.Pointer(bp + 4)).FcreateProc})))(tls, bp+4, *(*TClientData)(unsafe.Pointer(bp + 72)), bp) } } pp += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) goto _3 _3: ; x-- } goto _2 _2: ; y++ } /* compute number of characters per pixel */ chars_per_pixel = int32(1) i = ncolors for i > int32(64) { chars_per_pixel++ i /= int32(64) } /* write image info into XPM */ libc.X__builtin_snprintf(tls, bp+88, uint32(256), __ccgo_ts+57329, libc.VaList(bp+360, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight, ncolors+libc.BoolInt32(alphaOffset != 0), chars_per_pixel)) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp+88, libc.Int32FromUint32(libc.Xstrlen(tls, bp+88))) if (*(*TFMTOPT14)(unsafe.Pointer(bp + 344))).Fverbose != 0 { _printImgInfo15(tls, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth, (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight, ncolors+libc.BoolInt32(alphaOffset != 0), chars_per_pixel, fileName, __ccgo_ts+1132) } /* write transparent color id if transparency is available*/ if alphaOffset != 0 { libc.Xstrcpy(tls, bp+80, __ccgo_ts+57345) *(*uint8)(unsafe.Pointer(bp + 80 + uintptr(chars_per_pixel))) = uint8(0) libc.X__builtin_snprintf(tls, bp+88, uint32(256), __ccgo_ts+57350, libc.VaList(bp+360, bp+80)) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp+88, libc.Int32FromUint32(libc.Xstrlen(tls, bp+88))) } /* write colormap strings */ entry = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_FirstHashEntry})))(tls, bp+4, bp+60) y = 0 *(*uint8)(unsafe.Pointer(bp + 80 + uintptr(chars_per_pixel))) = uint8(0) for entry != 0 { /* compute a color identifier for color #y */ i = 0 v5 = y y++ x = v5 for { if !(i < chars_per_pixel) { break } *(*uint8)(unsafe.Pointer(bp + 80 + uintptr(i))) = _xpm_chars[x&int32(63)] goto _4 _4: ; i++ x /= int32(64) } /* * and put it in the hashtable * this is a little bit tricky */ (*TTcl_HashEntry)(unsafe.Pointer(entry)).FclientData = (*(*struct { Fcomponent [0][5]uint8 Fvalue TClientData F__ccgo_pad2 [4]byte })(unsafe.Pointer(bp + 80))).Fvalue pp = entry + 16 libc.X__builtin_snprintf(tls, bp+88, uint32(256), __ccgo_ts+57371, libc.VaList(bp+360, bp+80, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp))), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 1))), libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(pp + 2))))) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp+88, libc.Int32FromUint32(libc.Xstrlen(tls, bp+88))) entry = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_NextHashEntry})))(tls, bp+60) } /* write image itself */ rowPixPtr = (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelPtr + uintptr(*(*int32)(unsafe.Pointer(blockPtr + 20))) (*(*[256]uint8)(unsafe.Pointer(bp + 88)))[chars_per_pixel] = uint8(0) y = 0 for { if !(y < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight) { break } (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, __ccgo_ts+3328, int32(1)) pixelPtr = rowPixPtr x = 0 for { if !(x < (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fwidth) { break } if !(alphaOffset != 0) || *(*uint8)(unsafe.Pointer(pixelPtr + uintptr(alphaOffset))) != 0 { *(*uint8)(unsafe.Pointer(bp + 72)) = *(*uint8)(unsafe.Pointer(pixelPtr)) *(*uint8)(unsafe.Pointer(bp + 72 + 1)) = *(*uint8)(unsafe.Pointer(pixelPtr + uintptr(greenOffset))) *(*uint8)(unsafe.Pointer(bp + 72 + 2)) = *(*uint8)(unsafe.Pointer(pixelPtr + uintptr(blueOffset))) entry = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTcl_HashTable)(unsafe.Pointer(bp + 4)).FfindProc})))(tls, bp+4, *(*TClientData)(unsafe.Pointer(bp + 72))) (*(*struct { Fcomponent [0][5]uint8 Fvalue TClientData F__ccgo_pad2 [4]byte })(unsafe.Pointer(bp + 80))).Fvalue = (*TTcl_HashEntry)(unsafe.Pointer(entry)).FclientData libc.Xmemcpy(tls, bp+88, bp+80, libc.Uint32FromInt32(chars_per_pixel)) } else { /* make transparent pixel */ libc.Xmemcpy(tls, bp+88, __ccgo_ts+57345, libc.Uint32FromInt32(chars_per_pixel)) } pixelPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).FpixelSize) (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, bp+88, libc.Int32FromUint32(libc.Xstrlen(tls, bp+88))) goto _7 _7: ; x++ } if y == (*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fheight-int32(1) { (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, __ccgo_ts+57394, int32(3)) } else { (*(*func(*libc.TLS, uintptr, uintptr, TTcl_Size) TTcl_Size)(unsafe.Pointer(&struct{ uintptr }{(*TTkimgStubs)(unsafe.Pointer(XtkimgStubsPtr)).Ftkimg_WritePtr})))(tls, handle, __ccgo_ts+57398, int32(3)) } rowPixPtr += uintptr((*TTk_PhotoImageBlock)(unsafe.Pointer(blockPtr)).Fpitch) goto _6 _6: ; y++ } /* Delete the hash table */ (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_DeleteHashTable})))(tls, bp+4) return TCL_OK } /* * xpm_chars[] must be 64 chars long */ var _xpm_chars = [65]uint8{'.', '#', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} const BASE = 65521 const DEF_MEM_LEVEL = 8 const DEF_WBITS = "MAX_WBITS" const DYN_TREES = 2 const MAX_MATCH = 258 const MIN_MATCH = 3 const NMAX = 5552 const OS_CODE = 3 const PACKAGE_NAME22 = "zlibtcl" const PACKAGE_STRING23 = "zlibtcl 1.3.1" const PACKAGE_TARNAME22 = "zlibtcl" const PACKAGE_VERSION5 = "1.3.1" const PRESET_DICT = 0x20 const SEEK_CUR = 1 const SEEK_END = 2 const SEEK_SET = 0 const STATIC_TREES = 1 const STORED_BLOCK = 0 const ZEXTERN1 = "MODULE_SCOPE" const ZLIB_CONST = 1 const local = "static" const zmemcmp = "memcmp" const zmemcpy = "memcpy" type Tuch = uint8 type Tuchf = uint8 type Tush = uint16 type Tushf = uint16 type Tulg = uint32 /* Reverse the bytes in a 32-bit value */ /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ /* use NO_DIVIDE if your processor does not do division in hardware -- try it both ways to see which is faster */ // C documentation // // /* ========================================================================= */ func Xadler32_z(tls *libc.TLS, adler TuLong, buf uintptr, len1 Tz_size_t) (r TuLong) { var n, sum2, v3 uint32 var v1, v5 Tz_size_t var v2, v6 uintptr _, _, _, _, _, _, _ = n, sum2, v1, v2, v3, v5, v6 /* split Adler-32 into component sums */ sum2 = adler >> libc.Int32FromInt32(16) & uint32(0xffff) adler &= uint32(0xffff) /* in case user likes doing a byte at a time, keep it fast */ if len1 == uint32(1) { adler += uint32(*(*TBytef)(unsafe.Pointer(buf))) if adler >= uint32(65521) { adler -= uint32(65521) } sum2 += adler if sum2 >= uint32(65521) { sum2 -= uint32(65521) } return adler | sum2<= uint32(65521) { adler -= uint32(65521) } sum2 %= uint32(65521) /* only added so many BASE's */ return adler | sum2<= uint32(NMAX) { len1 -= uint32(NMAX) n = libc.Uint32FromInt32(libc.Int32FromInt32(NMAX) / libc.Int32FromInt32(16)) /* NMAX is divisible by 16 */ for { adler += uint32(*(*TBytef)(unsafe.Pointer(buf))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(2))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(2)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(4))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(4)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(4)+libc.Int32FromInt32(2))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(4)+libc.Int32FromInt32(2)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + 8))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(2))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(2)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(4))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(4)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(4)+libc.Int32FromInt32(2))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(4)+libc.Int32FromInt32(2)+libc.Int32FromInt32(1))))) sum2 += adler /* 16 sums unrolled */ buf += uintptr(16) goto _4 _4: ; n-- v3 = n if !(v3 != 0) { break } } adler %= uint32(65521) sum2 %= uint32(65521) } /* do remaining bytes (less than NMAX, still just one modulo) */ if len1 != 0 { /* avoid modulos if none remaining */ for len1 >= uint32(16) { len1 -= uint32(16) adler += uint32(*(*TBytef)(unsafe.Pointer(buf))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(2))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(2)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(4))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(4)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(4)+libc.Int32FromInt32(2))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(0)+libc.Int32FromInt32(4)+libc.Int32FromInt32(2)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + 8))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(2))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(2)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(4))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(4)+libc.Int32FromInt32(1))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(4)+libc.Int32FromInt32(2))))) sum2 += adler adler += uint32(*(*TBytef)(unsafe.Pointer(buf + uintptr(libc.Int32FromInt32(8)+libc.Int32FromInt32(4)+libc.Int32FromInt32(2)+libc.Int32FromInt32(1))))) sum2 += adler buf += uintptr(16) } for { v5 = len1 len1-- if !(v5 != 0) { break } v6 = buf buf++ adler += uint32(*(*TBytef)(unsafe.Pointer(v6))) sum2 += adler } adler %= uint32(65521) sum2 %= uint32(65521) } /* return recombined sums */ return adler | sum2<= 0 */ rem = libc.Uint32FromInt64(len2) sum1 = adler1 & uint32(0xffff) sum2 = rem * sum1 sum2 %= uint32(65521) sum1 += adler2&uint32(0xffff) + uint32(65521) - uint32(1) sum2 += adler1>>libc.Int32FromInt32(16)&uint32(0xffff) + adler2>>libc.Int32FromInt32(16)&uint32(0xffff) + uint32(65521) - rem if sum1 >= uint32(65521) { sum1 -= uint32(65521) } if sum1 >= uint32(65521) { sum1 -= uint32(65521) } if sum2 >= libc.Uint32FromUint32(65521)<= uint32(65521) { sum2 -= uint32(65521) } return sum1 | sum2< max { v1 = max } else { v1 = left } (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_out = v1 left -= (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_out } if (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_in == uint32(0) { if sourceLen > max { v2 = max } else { v2 = sourceLen } (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_in = v2 sourceLen -= (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_in } if sourceLen != 0 { v3 = Z_NO_FLUSH } else { v3 = int32(Z_FINISH) } err = Xdeflate(tls, bp, v3) } *(*TuLongf)(unsafe.Pointer(destLen)) = (*(*Tz_stream)(unsafe.Pointer(bp))).Ftotal_out XdeflateEnd(tls, bp) if err == int32(Z_STREAM_END) { v4 = Z_OK } else { v4 = err } return v4 } // C documentation // // /* =========================================================================== // */ func Xcompress(tls *libc.TLS, dest uintptr, destLen uintptr, source uintptr, sourceLen TuLong) (r int32) { return Xcompress2(tls, dest, destLen, source, sourceLen, -int32(1)) } // C documentation // // /* =========================================================================== // If the default memLevel or windowBits for deflateInit() is changed, then // this function needs to be updated. // */ func XcompressBound(tls *libc.TLS, sourceLen TuLong) (r TuLong) { return sourceLen + sourceLen>>libc.Int32FromInt32(12) + sourceLen>>libc.Int32FromInt32(14) + sourceLen>>libc.Int32FromInt32(25) + uint32(13) } const N = 5 const POLY = 3988292384 /* Reverse the bytes in a 32-bit value */ /* A CRC of a message is computed on N braids of words in the message, where each word consists of W bytes (4 or 8). If N is 3, for example, then three running sparse CRCs are calculated respectively on each braid, at these indices in the array of words: 0, 3, 6, ..., 1, 4, 7, ..., and 2, 5, 8, ... This is done starting at a word boundary, and continues until as many blocks of N * W bytes as are available have been processed. The results are combined into a single CRC at the end. For this code, N must be in the range 1..6 and W must be 4 or 8. The upper limit on N can be increased if desired by adding more #if blocks, extending the patterns apparent in the code. In addition, crc32.h would need to be regenerated, if the maximum N value is increased. N and W are chosen empirically by benchmarking the execution time on a given processor. The choices for N and W below were based on testing on Intel Kaby Lake i7, AMD Ryzen 7, ARM Cortex-A57, Sparc64-VII, PowerPC POWER9, and MIPS64 Octeon II processors. The Intel, AMD, and ARM processors were all fastest with N=5, W=8. The Sparc, PowerPC, and MIPS64 were all fastest at N=5, W=4. They were all tested with either gcc or clang, all using the -O3 optimization level. Your mileage may vary. */ /* Define N */ /* z_crc_t must be at least 32 bits. z_word_t must be at least as long as z_crc_t. It is assumed here that z_word_t is either 32 bits or 64 bits, and that bytes are eight bits. */ // C documentation // // /* // Define W and the associated z_word_t type. If W is not defined, then a // braided calculation is not used, and the associated tables and code are not // compiled. // */ type Tz_word_t = uint32 /* If available, use the ARM processor CRC32 instruction. */ // C documentation // // /* // Swap the bytes in a z_word_t to convert between little and big endian. Any // self-respecting compiler will optimize this to a single machine byte-swap // instruction, if one is available. This assumes that word_t is either 32 bits // or 64 bits. // */ func _byte_swap(tls *libc.TLS, word Tz_word_t) (r Tz_word_t) { return word&uint32(0xff000000)>>int32(24) | word&uint32(0xff0000)>>int32(8) | word&uint32(0xff00)<>= uint32(1) if b&uint32(1) != 0 { v2 = b>>libc.Int32FromInt32(1) ^ uint32(POLY) } else { v2 = b >> int32(1) } b = v2 goto _1 _1: } return p } // C documentation // // /* // Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been // initialized. // */ func _x2nmodp(tls *libc.TLS, n Toff_t, k uint32) (r Tz_crc_t) { var p Tz_crc_t _ = p p = libc.Uint32FromInt32(1) << libc.Int32FromInt32(31) /* x^0 == 1 */ for n != 0 { if n&int64(1) != 0 { p = _multmodp(tls, _x2n_table[k&uint32(31)], p) } n >>= int64(1) k++ } return p } // C documentation // // /* ========================================================================= // * This function can be used by asm versions of crc32(), and to force the // * generation of the CRC tables in a threaded application. // */ func Xget_crc_table(tls *libc.TLS) (r uintptr) { return uintptr(unsafe.Pointer(&_crc_table)) } /* ========================================================================= * Use ARM machine instructions if available. This will compute the CRC about * ten times faster than the braided calculation. This code does not check for * the presence of the CRC instruction at run time. __ARM_FEATURE_CRC32 will * only be defined if the compilation specifies an ARM processor architecture * that has the instructions. For example, compiling with -march=armv8.1-a or * -march=armv8-a+crc, or -march=native if the compile machine has the crc32 * instructions. */ // C documentation // // /* // Return the CRC of the W bytes in the word_t data, taking the // least-significant byte of the word as the first byte of data, without any pre // or post conditioning. This is used to combine the CRCs of each braid. // */ func _crc_word(tls *libc.TLS, data Tz_word_t) (r Tz_crc_t) { var k int32 _ = k k = 0 for { if !(k < int32(4)) { break } data = data>>libc.Int32FromInt32(8) ^ _crc_table[data&uint32(0xff)] goto _1 _1: ; k++ } return data } func _crc_word_big(tls *libc.TLS, data Tz_word_t) (r Tz_word_t) { var k int32 _ = k k = 0 for { if !(k < int32(4)) { break } data = data<>((libc.Int32FromInt32(4)-libc.Int32FromInt32(1))<= libc.Uint32FromInt32(libc.Int32FromInt32(N)*libc.Int32FromInt32(4)+libc.Int32FromInt32(4)-libc.Int32FromInt32(1)) { /* Compute the CRC up to a z_word_t boundary. */ for len1 != 0 && uint32(buf)&libc.Uint32FromInt32(libc.Int32FromInt32(4)-libc.Int32FromInt32(1)) != uint32(0) { len1-- v1 = buf buf++ crc = crc>>int32(8) ^ _crc_table[(crc^uint32(*(*uint8)(unsafe.Pointer(v1))))&uint32(0xff)] } /* Compute the CRC on as many N z_word_t blocks as are available. */ blks = len1 / libc.Uint32FromInt32(libc.Int32FromInt32(N)*libc.Int32FromInt32(4)) len1 -= blks * uint32(N) * uint32(4) words = buf /* Do endian check at execution time instead of compile time, since ARM processors can change the endianness at execution time. If the compiler knows what the endianness will be, it can optimize out the check and the unused branch. */ *(*uint32)(unsafe.Pointer(bp)) = uint32(1) if *(*uint8)(unsafe.Pointer(bp)) != 0 { /* Initialize the CRC for each braid. */ crc0 = crc crc1 = uint32(0) crc2 = uint32(0) crc3 = uint32(0) crc4 = uint32(0) /* Process the first blks-1 blocks, computing the CRCs on each braid independently. */ for { blks-- v2 = blks if !(v2 != 0) { break } /* Load the word for each braid into registers. */ word0 = crc0 ^ *(*Tz_word_t)(unsafe.Pointer(words)) word1 = crc1 ^ *(*Tz_word_t)(unsafe.Pointer(words + 1*4)) word2 = crc2 ^ *(*Tz_word_t)(unsafe.Pointer(words + 2*4)) word3 = crc3 ^ *(*Tz_word_t)(unsafe.Pointer(words + 3*4)) word4 = crc4 ^ *(*Tz_word_t)(unsafe.Pointer(words + 4*4)) words += uintptr(N) * 4 /* Compute and update the CRC for each word. The loop should get unrolled. */ crc0 = *(*Tz_crc_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_crc_braid_table)) + uintptr(word0&uint32(0xff))*4)) crc1 = *(*Tz_crc_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_crc_braid_table)) + uintptr(word1&uint32(0xff))*4)) crc2 = *(*Tz_crc_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_crc_braid_table)) + uintptr(word2&uint32(0xff))*4)) crc3 = *(*Tz_crc_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_crc_braid_table)) + uintptr(word3&uint32(0xff))*4)) crc4 = *(*Tz_crc_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_crc_braid_table)) + uintptr(word4&uint32(0xff))*4)) k = int32(1) for { if !(k < int32(4)) { break } crc0 ^= *(*Tz_crc_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&_crc_braid_table)) + uintptr(k)*1024 + uintptr(word0>>(k<>(k<>(k<>(k<>(k<>(k<>(k<>(k<>(k<>(k<= uint32(8) { len1 -= uint32(8) v6 = buf buf++ crc = crc>>int32(8) ^ _crc_table[(crc^uint32(*(*uint8)(unsafe.Pointer(v6))))&uint32(0xff)] v7 = buf buf++ crc = crc>>int32(8) ^ _crc_table[(crc^uint32(*(*uint8)(unsafe.Pointer(v7))))&uint32(0xff)] v8 = buf buf++ crc = crc>>int32(8) ^ _crc_table[(crc^uint32(*(*uint8)(unsafe.Pointer(v8))))&uint32(0xff)] v9 = buf buf++ crc = crc>>int32(8) ^ _crc_table[(crc^uint32(*(*uint8)(unsafe.Pointer(v9))))&uint32(0xff)] v10 = buf buf++ crc = crc>>int32(8) ^ _crc_table[(crc^uint32(*(*uint8)(unsafe.Pointer(v10))))&uint32(0xff)] v11 = buf buf++ crc = crc>>int32(8) ^ _crc_table[(crc^uint32(*(*uint8)(unsafe.Pointer(v11))))&uint32(0xff)] v12 = buf buf++ crc = crc>>int32(8) ^ _crc_table[(crc^uint32(*(*uint8)(unsafe.Pointer(v12))))&uint32(0xff)] v13 = buf buf++ crc = crc>>int32(8) ^ _crc_table[(crc^uint32(*(*uint8)(unsafe.Pointer(v13))))&uint32(0xff)] } for len1 != 0 { len1-- v14 = buf buf++ crc = crc>>int32(8) ^ _crc_table[(crc^uint32(*(*uint8)(unsafe.Pointer(v14))))&uint32(0xff)] } /* Return the CRC, post-conditioned. */ return crc ^ uint32(0xffffffff) } // C documentation // // /* ========================================================================= */ func Xcrc32(tls *libc.TLS, crc uint32, buf uintptr, len1 TuInt) (r uint32) { return Xcrc32_z(tls, crc, buf, len1) } // C documentation // // /* ========================================================================= */ func Xcrc32_combine64(tls *libc.TLS, crc1 TuLong, crc2 TuLong, len2 Toff_t) (r TuLong) { return _multmodp(tls, _x2nmodp(tls, len2, uint32(3)), crc1) ^ crc2&uint32(0xffffffff) } // C documentation // // /* ========================================================================= */ func Xcrc32_combine(tls *libc.TLS, crc1 TuLong, crc2 TuLong, len2 Toff_t) (r TuLong) { return Xcrc32_combine64(tls, crc1, crc2, len2) } // C documentation // // /* ========================================================================= */ func Xcrc32_combine_gen64(tls *libc.TLS, len2 Toff_t) (r TuLong) { return _x2nmodp(tls, len2, uint32(3)) } // C documentation // // /* ========================================================================= */ func Xcrc32_combine_gen(tls *libc.TLS, len2 Toff_t) (r TuLong) { return Xcrc32_combine_gen64(tls, len2) } // C documentation // // /* ========================================================================= */ func Xcrc32_combine_op(tls *libc.TLS, crc1 TuLong, crc2 TuLong, op TuLong) (r TuLong) { return _multmodp(tls, op, crc1) ^ crc2&uint32(0xffffffff) } const BL_CODES = 19 const BUSY_STATE = 113 const Buf_size = 16 const COMMENT_STATE = 91 const D_CODES = 30 const EXTRA_STATE = 69 const FINISH_STATE = 666 const GZIP_STATE = 57 const HCRC_STATE = 103 const INIT_STATE = 42 const LENGTH_CODES = 29 const LITERALS = 256 const LIT_BUFS = 4 const MAX_BITS = 15 const MAX_STORED = 65535 const NAME_STATE = 73 const NIL = 0 const PRESET_DICT1 = 32 const TOO_FAR = 4096 const WIN_INIT = "MAX_MATCH" const max_insert_length = "max_lazy_match" type Tinternal_state = struct { Fstrm Tz_streamp Fstatus int32 Fpending_buf uintptr Fpending_buf_size Tulg Fpending_out uintptr Fpending Tulg Fwrap int32 Fgzhead Tgz_headerp Fgzindex Tulg Fmethod TByte Flast_flush int32 Fw_size TuInt Fw_bits TuInt Fw_mask TuInt Fwindow uintptr Fwindow_size Tulg Fprev uintptr Fhead uintptr Fins_h TuInt Fhash_size TuInt Fhash_bits TuInt Fhash_mask TuInt Fhash_shift TuInt Fblock_start int32 Fmatch_length TuInt Fprev_match TIPos Fmatch_available int32 Fstrstart TuInt Fmatch_start TuInt Flookahead TuInt Fprev_length TuInt Fmax_chain_length TuInt Fmax_lazy_match TuInt Flevel int32 Fstrategy int32 Fgood_match TuInt Fnice_match int32 Fdyn_ltree [573]Tct_data_s Fdyn_dtree [61]Tct_data_s Fbl_tree [39]Tct_data_s Fl_desc Ttree_desc_s Fd_desc Ttree_desc_s Fbl_desc Ttree_desc_s Fbl_count [16]Tush Fheap [573]int32 Fheap_len int32 Fheap_max int32 Fdepth [573]Tuch Fsym_buf uintptr Flit_bufsize TuInt Fsym_next TuInt Fsym_end TuInt Fopt_len Tulg Fstatic_len Tulg Fmatches TuInt Finsert TuInt Fbi_buf Tush Fbi_valid int32 Fhigh_water Tulg } type Tct_data = struct { Ffc struct { Fcode [0]Tush Ffreq Tush } Fdl struct { Flen1 [0]Tush Fdad Tush } } type Tct_data_s = Tct_data type Ttree_desc = struct { Fdyn_tree uintptr Fmax_code int32 Fstat_desc uintptr } type Ttree_desc_s = Ttree_desc type TPos = uint16 type TPosf = uint16 type TIPos = uint32 type Tdeflate_state = struct { Fstrm Tz_streamp Fstatus int32 Fpending_buf uintptr Fpending_buf_size Tulg Fpending_out uintptr Fpending Tulg Fwrap int32 Fgzhead Tgz_headerp Fgzindex Tulg Fmethod TByte Flast_flush int32 Fw_size TuInt Fw_bits TuInt Fw_mask TuInt Fwindow uintptr Fwindow_size Tulg Fprev uintptr Fhead uintptr Fins_h TuInt Fhash_size TuInt Fhash_bits TuInt Fhash_mask TuInt Fhash_shift TuInt Fblock_start int32 Fmatch_length TuInt Fprev_match TIPos Fmatch_available int32 Fstrstart TuInt Fmatch_start TuInt Flookahead TuInt Fprev_length TuInt Fmax_chain_length TuInt Fmax_lazy_match TuInt Flevel int32 Fstrategy int32 Fgood_match TuInt Fnice_match int32 Fdyn_ltree [573]Tct_data_s Fdyn_dtree [61]Tct_data_s Fbl_tree [39]Tct_data_s Fl_desc Ttree_desc_s Fd_desc Ttree_desc_s Fbl_desc Ttree_desc_s Fbl_count [16]Tush Fheap [573]int32 Fheap_len int32 Fheap_max int32 Fdepth [573]Tuch Fsym_buf uintptr Flit_bufsize TuInt Fsym_next TuInt Fsym_end TuInt Fopt_len Tulg Fstatic_len Tulg Fmatches TuInt Finsert TuInt Fbi_buf Tush Fbi_valid int32 Fhigh_water Tulg } /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. */ type Tblock_state = int32 const need_more = 0 const /* block not completed, need more input or more output */ block_done = 1 const /* block flush performed */ finish_started = 2 const /* finish started, need only more output at next deflate */ finish_done = 3 type Tcompress_func = uintptr /* =========================================================================== * Local data */ /* Tail of hash chains */ /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ // C documentation // // /* Values for max_lazy_match, good_match and max_chain_length, depending on // * the desired pack level (0..9). The values given below have been tuned to // * exclude worst case performance for pathological files. Better values may be // * found for specific files. // */ type Tconfig = struct { Fgood_length Tush Fmax_lazy Tush Fnice_length Tush Fmax_chain Tush Ffunc1 Tcompress_func } /* =========================================================================== * Local data */ /* Tail of hash chains */ /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ // C documentation // // /* Values for max_lazy_match, good_match and max_chain_length, depending on // * the desired pack level (0..9). The values given below have been tuned to // * exclude worst case performance for pathological files. Better values may be // * found for specific files. // */ type Tconfig_s = Tconfig var _configuration_table = [10]Tconfig{ 0: {}, 1: { Fgood_length: uint16(4), Fmax_lazy: uint16(4), Fnice_length: uint16(8), Fmax_chain: uint16(4), }, 2: { Fgood_length: uint16(4), Fmax_lazy: uint16(5), Fnice_length: uint16(16), Fmax_chain: uint16(8), }, 3: { Fgood_length: uint16(4), Fmax_lazy: uint16(6), Fnice_length: uint16(32), Fmax_chain: uint16(32), }, 4: { Fgood_length: uint16(4), Fmax_lazy: uint16(4), Fnice_length: uint16(16), Fmax_chain: uint16(16), }, 5: { Fgood_length: uint16(8), Fmax_lazy: uint16(16), Fnice_length: uint16(32), Fmax_chain: uint16(32), }, 6: { Fgood_length: uint16(8), Fmax_lazy: uint16(16), Fnice_length: uint16(128), Fmax_chain: uint16(128), }, 7: { Fgood_length: uint16(8), Fmax_lazy: uint16(32), Fnice_length: uint16(128), Fmax_chain: uint16(256), }, 8: { Fgood_length: uint16(32), Fmax_lazy: uint16(128), Fnice_length: uint16(258), Fmax_chain: uint16(1024), }, 9: { Fgood_length: uint16(32), Fmax_lazy: uint16(258), Fnice_length: uint16(258), Fmax_chain: uint16(4096), }, } func init() { p := unsafe.Pointer(&_configuration_table) *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_deflate_stored) *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_deflate_fast) *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_deflate_fast) *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_deflate_fast) *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_deflate_slow) *(*uintptr)(unsafe.Add(p, 68)) = __ccgo_fp(_deflate_slow) *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_deflate_slow) *(*uintptr)(unsafe.Add(p, 92)) = __ccgo_fp(_deflate_slow) *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_deflate_slow) *(*uintptr)(unsafe.Add(p, 116)) = __ccgo_fp(_deflate_slow) } /* max compression */ /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 * For deflate_fast() (levels <= 3) good is ignored and lazy has a different * meaning. */ /* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ /* =========================================================================== * Update a hash value with the given input byte * IN assertion: all calls to UPDATE_HASH are made with consecutive input * characters, so that a running hash key can be computed from the previous * key instead of complete recalculation each time. */ /* =========================================================================== * Insert string str in the dictionary and set match_head to the previous head * of the hash chain (the most recent string with same hash key). Return * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. * IN assertion: all calls to INSERT_STRING are made with consecutive input * characters and the first MIN_MATCH bytes of str are valid (except for * the last MIN_MATCH-1 bytes of the input file). */ /* =========================================================================== * Initialize the hash table (avoiding 64K overflow for 16 bit systems). * prev[] will be initialized on the fly. */ // C documentation // // /* =========================================================================== // * Slide the hash table when sliding the window down (could be avoided with 32 // * bit values at the expense of memory usage). We slide even when level == 0 to // * keep the hash table consistent if we switch back to level > 0 later. // */ func _slide_hash(tls *libc.TLS, s uintptr) { var m, n, v1, v4, v5, v8 uint32 var p, v3, v7 uintptr var wsize TuInt _, _, _, _, _, _, _, _, _, _ = m, n, p, wsize, v1, v3, v4, v5, v7, v8 wsize = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size n = (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size p = (*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr(n)*2 for { p -= 2 v3 = p m = uint32(*(*TPosf)(unsafe.Pointer(v3))) if m >= wsize { v4 = m - wsize } else { v4 = uint32(NIL) } *(*TPosf)(unsafe.Pointer(p)) = uint16(v4) goto _2 _2: ; n-- v1 = n if !(v1 != 0) { break } } n = wsize p = (*Tdeflate_state)(unsafe.Pointer(s)).Fprev + uintptr(n)*2 for { p -= 2 v7 = p m = uint32(*(*TPosf)(unsafe.Pointer(v7))) if m >= wsize { v8 = m - wsize } else { v8 = uint32(NIL) } *(*TPosf)(unsafe.Pointer(p)) = uint16(v8) /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ goto _6 _6: ; n-- v5 = n if !(v5 != 0) { break } } } // C documentation // // /* =========================================================================== // * Read a new buffer from the current input stream, update the adler32 // * and total number of bytes read. All deflate() input goes through // * this function so some applications may wish to modify it to avoid // * allocating a large strm->next_in buffer and copying from it. // * (See also flush_pending()). // */ func _read_buf(tls *libc.TLS, strm Tz_streamp, buf uintptr, size uint32) (r uint32) { var len1 uint32 _ = len1 len1 = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in if len1 > size { len1 = size } if len1 == uint32(0) { return uint32(0) } *(*TuInt)(unsafe.Pointer(strm + 4)) -= len1 libc.Xmemcpy(tls, buf, (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in, len1) if (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fwrap == int32(1) { (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xadler32(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fadler, buf, len1) } else { if (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fwrap == int32(2) { (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xcrc32(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fadler, buf, len1) } } *(*uintptr)(unsafe.Pointer(strm)) += uintptr(len1) *(*TuLong)(unsafe.Pointer(strm + 8)) += len1 return len1 } // C documentation // // /* =========================================================================== // * Fill the window when the lookahead becomes insufficient. // * Updates strstart and lookahead. // * // * IN assertion: lookahead < MIN_LOOKAHEAD // * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD // * At least one byte has been read, or avail_in == 0; reads are // * performed for at least two bytes (required for the zip translate_eol // * option -- not supported here). // */ func _fill_window(tls *libc.TLS, s uintptr) { var curr, init1 Tulg var more, n uint32 var str, wsize TuInt _, _, _, _, _, _ = curr, init1, more, n, str, wsize /* Amount of free space at the end of the window. */ wsize = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size for cond := true; cond; cond = (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead < libc.Uint32FromInt32(libc.Int32FromInt32(MAX_MATCH)+libc.Int32FromInt32(MIN_MATCH)+libc.Int32FromInt32(1)) && (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in != uint32(0) { more = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow_size - (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead - (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart /* Deal with !@#$% 64K limit: */ if uint32(4) <= uint32(2) { if more == uint32(0) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart == uint32(0) && (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead == uint32(0) { more = wsize } else { if more == libc.Uint32FromInt32(-libc.Int32FromInt32(1)) { /* Very unlikely, but possible on 16 bit machine if * strstart == 0 && lookahead == 1 (input done a byte at time) */ more-- } } } /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart >= wsize+((*Tdeflate_state)(unsafe.Pointer(s)).Fw_size-libc.Uint32FromInt32(libc.Int32FromInt32(MAX_MATCH)+libc.Int32FromInt32(MIN_MATCH)+libc.Int32FromInt32(1))) { libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr(wsize), wsize-more) *(*TuInt)(unsafe.Pointer(s + 112)) -= wsize *(*TuInt)(unsafe.Pointer(s + 108)) -= wsize /* we now have strstart >= MAX_DIST */ *(*int32)(unsafe.Pointer(s + 92)) -= libc.Int32FromUint32(wsize) if (*Tdeflate_state)(unsafe.Pointer(s)).Finsert > (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart { (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart } _slide_hash(tls, s) more += wsize } if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in == uint32(0) { break } /* If there was no sliding: * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && * more == window_size - lookahead - strstart * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) * => more >= window_size - 2*WSIZE + 2 * In the BIG_MEM or MMAP case (not yet supported), * window_size == input_size + MIN_LOOKAHEAD && * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. * Otherwise, window_size == 2*WSIZE so more >= 2. * If there was sliding, more >= WSIZE. So in all cases, more >= 2. */ n = _read_buf(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Flookahead), more) *(*TuInt)(unsafe.Pointer(s + 116)) += n /* Initialize the hash value now that we have some input: */ if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead+(*Tdeflate_state)(unsafe.Pointer(s)).Finsert >= uint32(MIN_MATCH) { str = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart - (*Tdeflate_state)(unsafe.Pointer(s)).Finsert (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = uint32(*(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(str)))) (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = ((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h<<(*Tdeflate_state)(unsafe.Pointer(s)).Fhash_shift ^ uint32(*(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(str+uint32(1)))))) & (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_mask for (*Tdeflate_state)(unsafe.Pointer(s)).Finsert != 0 { (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = ((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h<<(*Tdeflate_state)(unsafe.Pointer(s)).Fhash_shift ^ uint32(*(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(str+uint32(MIN_MATCH)-uint32(1)))))) & (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_mask *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fprev + uintptr(str&(*Tdeflate_state)(unsafe.Pointer(s)).Fw_mask)*2)) = *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) = uint16(str) str++ (*Tdeflate_state)(unsafe.Pointer(s)).Finsert-- if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead+(*Tdeflate_state)(unsafe.Pointer(s)).Finsert < uint32(MIN_MATCH) { break } } } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, * but this is not important since only literal bytes will be emitted. */ } /* If the WIN_INIT bytes after the end of the current data have never been * written, then zero those bytes in order to avoid memory check reports of * the use of uninitialized (or uninitialised as Julian writes) bytes by * the longest match routines. Update the high water mark for the next * time through here. WIN_INIT is set to MAX_MATCH since the longest match * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water < (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow_size { curr = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart + (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead if (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water < curr { /* Previous high water mark below current data -- zero WIN_INIT * bytes or up to end of window, whichever is less. */ init1 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow_size - curr if init1 > uint32(MAX_MATCH) { init1 = uint32(MAX_MATCH) } libc.Xmemset(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr(curr), 0, init1) (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water = curr + init1 } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water < curr+uint32(MAX_MATCH) { /* High water mark at or above current data, but below current data * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up * to end of window, whichever is less. */ init1 = curr + uint32(MAX_MATCH) - (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water if init1 > (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow_size-(*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water { init1 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow_size - (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water } libc.Xmemset(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water), 0, init1) *(*Tulg)(unsafe.Pointer(s + 5824)) += init1 } } } } // C documentation // // /* ========================================================================= */ func XdeflateInit_(tls *libc.TLS, strm Tz_streamp, level int32, version uintptr, stream_size int32) (r int32) { return XdeflateInit2_(tls, strm, level, int32(Z_DEFLATED), int32(MAX_WBITS), int32(DEF_MEM_LEVEL), Z_DEFAULT_STRATEGY, version, stream_size) /* To do: ignore strm->next_in if we use it as window */ } // C documentation // // /* ========================================================================= */ func XdeflateInit2_(tls *libc.TLS, strm Tz_streamp, level int32, method int32, windowBits int32, memLevel int32, strategy int32, version uintptr, stream_size int32) (r int32) { var s uintptr var wrap int32 _, _ = s, wrap wrap = int32(1) if version == uintptr(Z_NULL) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(version))) != libc.Int32FromUint8(_my_version[0]) || libc.Uint32FromInt32(stream_size) != uint32(56) { return -int32(6) } if strm == uintptr(Z_NULL) { return -int32(2) } (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = uintptr(Z_NULL) if (*Tz_stream)(unsafe.Pointer(strm)).Fzalloc == libc.UintptrFromInt32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fzalloc = __ccgo_fp(Xzcalloc) (*Tz_stream)(unsafe.Pointer(strm)).Fopaque = libc.UintptrFromInt32(0) } if (*Tz_stream)(unsafe.Pointer(strm)).Fzfree == libc.UintptrFromInt32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fzfree = __ccgo_fp(Xzcfree) } if level == -int32(1) { level = int32(6) } if windowBits < 0 { /* suppress zlib wrapper */ wrap = 0 if windowBits < -int32(15) { return -int32(2) } windowBits = -windowBits } else { if windowBits > int32(15) { wrap = int32(2) /* write gzip wrapper instead */ windowBits -= int32(16) } } if memLevel < int32(1) || memLevel > int32(MAX_MEM_LEVEL) || method != int32(Z_DEFLATED) || windowBits < int32(8) || windowBits > int32(15) || level < 0 || level > int32(9) || strategy < 0 || strategy > int32(Z_FIXED) || windowBits == int32(8) && wrap != int32(1) { return -int32(2) } if windowBits == int32(8) { windowBits = int32(9) } /* until 256-byte window bug fixed */ s = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, libc.Uint32FromInt32(libc.Int32FromInt32(1)), libc.Uint32FromInt64(5828)) if s == uintptr(Z_NULL) { return -int32(4) } (*Tz_stream)(unsafe.Pointer(strm)).Fstate = s (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm = strm (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(INIT_STATE) /* to pass state test in deflateReset() */ (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap = wrap (*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead = uintptr(Z_NULL) (*Tdeflate_state)(unsafe.Pointer(s)).Fw_bits = libc.Uint32FromInt32(windowBits) (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size = libc.Uint32FromInt32(int32(1) << (*Tdeflate_state)(unsafe.Pointer(s)).Fw_bits) (*Tdeflate_state)(unsafe.Pointer(s)).Fw_mask = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size - uint32(1) (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_bits = libc.Uint32FromInt32(memLevel) + uint32(7) (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size = libc.Uint32FromInt32(int32(1) << (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_bits) (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_mask = (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size - uint32(1) (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_shift = ((*Tdeflate_state)(unsafe.Pointer(s)).Fhash_bits + libc.Uint32FromInt32(MIN_MATCH) - libc.Uint32FromInt32(1)) / libc.Uint32FromInt32(MIN_MATCH) (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size, libc.Uint32FromInt32(2)*libc.Uint32FromInt64(1)) (*Tdeflate_state)(unsafe.Pointer(s)).Fprev = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size, libc.Uint32FromInt64(2)) (*Tdeflate_state)(unsafe.Pointer(s)).Fhead = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size, libc.Uint32FromInt64(2)) (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water = uint32(0) /* nothing written to s->window yet */ (*Tdeflate_state)(unsafe.Pointer(s)).Flit_bufsize = libc.Uint32FromInt32(int32(1) << (memLevel + int32(6))) /* 16K elements by default */ /* We overlay pending_buf and sym_buf. This works since the average size * for length/distance pairs over any compressed block is assured to be 31 * bits or less. * * Analysis: The longest fixed codes are a length code of 8 bits plus 5 * extra bits, for lengths 131 to 257. The longest fixed distance codes are * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest * possible fixed-codes length/distance pair is then 31 bits total. * * sym_buf starts one-fourth of the way into pending_buf. So there are * three bytes in sym_buf for every four bytes in pending_buf. Each symbol * in sym_buf is three bytes -- two for the distance and one for the * literal/length. As each symbol is consumed, the pointer to the next * sym_buf value to read moves forward three bytes. From that symbol, up to * 31 bits are written to pending_buf. The closest the written pending_buf * bits gets to the next sym_buf symbol to read is just before the last * code is written. At that time, 31*(n - 2) bits have been written, just * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1 * symbols are written.) The closest the writing gets to what is unread is * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and * can range from 128 to 32768. * * Therefore, at a minimum, there are 142 bits of space between what is * written and what is read in the overlain buffers, so the symbols cannot * be overwritten by the compressed data. That space is actually 139 bits, * due to the three-bit fixed-code block header. * * That covers the case where either Z_FIXED is specified, forcing fixed * codes, or when the use of fixed codes is chosen, because that choice * results in a smaller compressed block than dynamic codes. That latter * condition then assures that the above analysis also covers all dynamic * blocks. A dynamic-code block will only be chosen to be emitted if it has * fewer bits than a fixed-code block would for the same set of symbols. * Therefore its average symbol length is assured to be less than 31. So * the compressed data for a dynamic block also cannot overwrite the * symbols from which it is being constructed. */ (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tdeflate_state)(unsafe.Pointer(s)).Flit_bufsize, libc.Uint32FromInt32(libc.Int32FromInt32(LIT_BUFS))) (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size = (*Tdeflate_state)(unsafe.Pointer(s)).Flit_bufsize * uint32(4) if (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow == uintptr(Z_NULL) || (*Tdeflate_state)(unsafe.Pointer(s)).Fprev == uintptr(Z_NULL) || (*Tdeflate_state)(unsafe.Pointer(s)).Fhead == uintptr(Z_NULL) || (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf == uintptr(Z_NULL) { (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(FINISH_STATE) (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = Xz_errmsg[libc.Int32FromInt32(2) - -libc.Int32FromInt32(4)] XdeflateEnd(tls, strm) return -int32(4) } (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Flit_bufsize) (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_end = ((*Tdeflate_state)(unsafe.Pointer(s)).Flit_bufsize - uint32(1)) * uint32(3) /* We avoid equality with lit_bufsize*3 because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. */ (*Tdeflate_state)(unsafe.Pointer(s)).Flevel = level (*Tdeflate_state)(unsafe.Pointer(s)).Fstrategy = strategy (*Tdeflate_state)(unsafe.Pointer(s)).Fmethod = libc.Uint8FromInt32(method) return XdeflateReset(tls, strm) } var _my_version = [6]uint8{'1', '.', '3', '.', '1'} // C documentation // // /* ========================================================================= // * Check for a valid deflate stream state. Return 0 if ok, 1 if not. // */ func _deflateStateCheck(tls *libc.TLS, strm Tz_streamp) (r int32) { var s uintptr _ = s if strm == uintptr(Z_NULL) || (*Tz_stream)(unsafe.Pointer(strm)).Fzalloc == libc.UintptrFromInt32(0) || (*Tz_stream)(unsafe.Pointer(strm)).Fzfree == libc.UintptrFromInt32(0) { return int32(1) } s = (*Tz_stream)(unsafe.Pointer(strm)).Fstate if s == uintptr(Z_NULL) || (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm != strm || (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus != int32(INIT_STATE) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus != int32(GZIP_STATE) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus != int32(EXTRA_STATE) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus != int32(NAME_STATE) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus != int32(COMMENT_STATE) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus != int32(HCRC_STATE) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus != int32(BUSY_STATE) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus != int32(FINISH_STATE) { return int32(1) } return 0 } // C documentation // // /* ========================================================================= */ func XdeflateSetDictionary(tls *libc.TLS, strm Tz_streamp, dictionary uintptr, dictLength TuInt) (r int32) { var avail uint32 var n, str, v1, v3 TuInt var next, s uintptr var wrap int32 _, _, _, _, _, _, _, _ = avail, n, next, s, str, wrap, v1, v3 if _deflateStateCheck(tls, strm) != 0 || dictionary == uintptr(Z_NULL) { return -int32(2) } s = (*Tz_stream)(unsafe.Pointer(strm)).Fstate wrap = (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap if wrap == int32(2) || wrap == int32(1) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus != int32(INIT_STATE) || (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead != 0 { return -int32(2) } /* when using zlib wrappers, compute Adler-32 for provided dictionary */ if wrap == int32(1) { (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xadler32(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fadler, dictionary, dictLength) } (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap = 0 /* avoid computing Adler-32 in read_buf */ /* if dictionary would fill window, just replace the history */ if dictLength >= (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size { if wrap == 0 { /* already empty otherwise */ *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size-uint32(1))*2)) = uint16(NIL) libc.Xmemset(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fhead, 0, ((*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size-libc.Uint32FromInt32(1))*uint32(2)) (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart = uint32(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = 0 (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = uint32(0) } dictionary += uintptr(dictLength - (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size) /* use the tail */ dictLength = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size } /* insert dictionary into window and hash */ avail = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in next = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in (*Tz_stream)(unsafe.Pointer(strm)).Favail_in = dictLength (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in = dictionary _fill_window(tls, s) for (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead >= uint32(MIN_MATCH) { str = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart n = (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead - libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH)-libc.Int32FromInt32(1)) for { (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = ((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h<<(*Tdeflate_state)(unsafe.Pointer(s)).Fhash_shift ^ uint32(*(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(str+uint32(MIN_MATCH)-uint32(1)))))) & (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_mask *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fprev + uintptr(str&(*Tdeflate_state)(unsafe.Pointer(s)).Fw_mask)*2)) = *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) = uint16(str) str++ goto _2 _2: ; n-- v1 = n if !(v1 != 0) { break } } (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart = str (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead = libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH) - libc.Int32FromInt32(1)) _fill_window(tls, s) } *(*TuInt)(unsafe.Pointer(s + 108)) += (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead = uint32(0) v3 = libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH) - libc.Int32FromInt32(1)) (*Tdeflate_state)(unsafe.Pointer(s)).Fprev_length = v3 (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = v3 (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_available = 0 (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in = next (*Tz_stream)(unsafe.Pointer(strm)).Favail_in = avail (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap = wrap return Z_OK } // C documentation // // /* ========================================================================= */ func XdeflateGetDictionary(tls *libc.TLS, strm Tz_streamp, dictionary uintptr, dictLength uintptr) (r int32) { var len1 TuInt var s uintptr _, _ = len1, s if _deflateStateCheck(tls, strm) != 0 { return -int32(2) } s = (*Tz_stream)(unsafe.Pointer(strm)).Fstate len1 = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart + (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead if len1 > (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size { len1 = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size } if dictionary != uintptr(Z_NULL) && len1 != 0 { libc.Xmemcpy(tls, dictionary, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Flookahead)-uintptr(len1), len1) } if dictLength != uintptr(Z_NULL) { *(*TuInt)(unsafe.Pointer(dictLength)) = len1 } return Z_OK } // C documentation // // /* ========================================================================= */ func XdeflateResetKeep(tls *libc.TLS, strm Tz_streamp) (r int32) { var s uintptr var v1 TuLong var v2 int32 var v3 uint32 _, _, _, _ = s, v1, v2, v3 if _deflateStateCheck(tls, strm) != 0 { return -int32(2) } v1 = libc.Uint32FromInt32(0) (*Tz_stream)(unsafe.Pointer(strm)).Ftotal_out = v1 (*Tz_stream)(unsafe.Pointer(strm)).Ftotal_in = v1 (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = uintptr(Z_NULL) /* use zfree if we ever allocate msg dynamically */ (*Tz_stream)(unsafe.Pointer(strm)).Fdata_type = int32(Z_UNKNOWN) s = (*Tz_stream)(unsafe.Pointer(strm)).Fstate (*Tdeflate_state)(unsafe.Pointer(s)).Fpending = uint32(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_out = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf if (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap < 0 { (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap = -(*Tdeflate_state)(unsafe.Pointer(s)).Fwrap /* was made negative by deflate(..., Z_FINISH); */ } if (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap == int32(2) { v2 = int32(GZIP_STATE) } else { v2 = int32(INIT_STATE) } (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = v2 if (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap == int32(2) { v3 = Xcrc32(tls, uint32(0), uintptr(Z_NULL), uint32(0)) } else { v3 = Xadler32(tls, uint32(0), uintptr(Z_NULL), uint32(0)) } (*Tz_stream)(unsafe.Pointer(strm)).Fadler = v3 (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(2) X_tr_init(tls, s) return Z_OK } // C documentation // // /* =========================================================================== // * Initialize the "longest match" routines for a new zlib stream // */ func _lm_init(tls *libc.TLS, s uintptr) { var v1 TuInt _ = v1 (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow_size = libc.Uint32FromInt32(2) * (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size-uint32(1))*2)) = uint16(NIL) libc.Xmemset(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fhead, 0, ((*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size-libc.Uint32FromInt32(1))*uint32(2)) /* Set the default configuration parameters: */ (*Tdeflate_state)(unsafe.Pointer(s)).Fmax_lazy_match = uint32(_configuration_table[(*Tdeflate_state)(unsafe.Pointer(s)).Flevel].Fmax_lazy) (*Tdeflate_state)(unsafe.Pointer(s)).Fgood_match = uint32(_configuration_table[(*Tdeflate_state)(unsafe.Pointer(s)).Flevel].Fgood_length) (*Tdeflate_state)(unsafe.Pointer(s)).Fnice_match = libc.Int32FromUint16(_configuration_table[(*Tdeflate_state)(unsafe.Pointer(s)).Flevel].Fnice_length) (*Tdeflate_state)(unsafe.Pointer(s)).Fmax_chain_length = uint32(_configuration_table[(*Tdeflate_state)(unsafe.Pointer(s)).Flevel].Fmax_chain) (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart = uint32(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = 0 (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead = uint32(0) (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = uint32(0) v1 = libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH) - libc.Int32FromInt32(1)) (*Tdeflate_state)(unsafe.Pointer(s)).Fprev_length = v1 (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = v1 (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_available = 0 (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = uint32(0) } // C documentation // // /* ========================================================================= */ func XdeflateReset(tls *libc.TLS, strm Tz_streamp) (r int32) { var ret int32 _ = ret ret = XdeflateResetKeep(tls, strm) if ret == Z_OK { _lm_init(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fstate) } return ret } // C documentation // // /* ========================================================================= */ func XdeflateSetHeader(tls *libc.TLS, strm Tz_streamp, head Tgz_headerp) (r int32) { if _deflateStateCheck(tls, strm) != 0 || (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fwrap != int32(2) { return -int32(2) } (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fgzhead = head return Z_OK } // C documentation // // /* ========================================================================= */ func XdeflatePending(tls *libc.TLS, strm Tz_streamp, pending uintptr, bits uintptr) (r int32) { if _deflateStateCheck(tls, strm) != 0 { return -int32(2) } if pending != uintptr(Z_NULL) { *(*uint32)(unsafe.Pointer(pending)) = (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fpending } if bits != uintptr(Z_NULL) { *(*int32)(unsafe.Pointer(bits)) = (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fbi_valid } return Z_OK } // C documentation // // /* ========================================================================= */ func XdeflatePrime(tls *libc.TLS, strm Tz_streamp, bits int32, value int32) (r int32) { var put int32 var s, p1 uintptr _, _, _ = put, s, p1 if _deflateStateCheck(tls, strm) != 0 { return -int32(2) } s = (*Tz_stream)(unsafe.Pointer(strm)).Fstate if bits < 0 || bits > int32(16) || (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf < (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_out+uintptr((libc.Int32FromInt32(Buf_size)+libc.Int32FromInt32(7))>>libc.Int32FromInt32(3)) { return -int32(5) } for cond := true; cond; cond = bits != 0 { put = int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid if put > bits { put = bits } p1 = s + 5816 *(*Tush)(unsafe.Pointer(p1)) = Tush(int32(*(*Tush)(unsafe.Pointer(p1))) | libc.Int32FromUint16(libc.Uint16FromInt32(value&(libc.Int32FromInt32(1)<>= put bits -= put } return Z_OK } // C documentation // // /* ========================================================================= */ func XdeflateParams(tls *libc.TLS, strm Tz_streamp, level int32, strategy int32) (r int32) { var err int32 var func1 Tcompress_func var s uintptr _, _, _ = err, func1, s if _deflateStateCheck(tls, strm) != 0 { return -int32(2) } s = (*Tz_stream)(unsafe.Pointer(strm)).Fstate if level == -int32(1) { level = int32(6) } if level < 0 || level > int32(9) || strategy < 0 || strategy > int32(Z_FIXED) { return -int32(2) } func1 = _configuration_table[(*Tdeflate_state)(unsafe.Pointer(s)).Flevel].Ffunc1 if (strategy != (*Tdeflate_state)(unsafe.Pointer(s)).Fstrategy || func1 != _configuration_table[level].Ffunc1) && (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush != -int32(2) { /* Flush the last buffer: */ err = Xdeflate(tls, strm, int32(Z_BLOCK)) if err == -int32(2) { return err } if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in != 0 || (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart-libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)+(*Tdeflate_state)(unsafe.Pointer(s)).Flookahead != 0 { return -int32(5) } } if (*Tdeflate_state)(unsafe.Pointer(s)).Flevel != level { if (*Tdeflate_state)(unsafe.Pointer(s)).Flevel == 0 && (*Tdeflate_state)(unsafe.Pointer(s)).Fmatches != uint32(0) { if (*Tdeflate_state)(unsafe.Pointer(s)).Fmatches == uint32(1) { _slide_hash(tls, s) } else { *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size-uint32(1))*2)) = uint16(NIL) libc.Xmemset(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fhead, 0, ((*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size-libc.Uint32FromInt32(1))*uint32(2)) } (*Tdeflate_state)(unsafe.Pointer(s)).Fmatches = uint32(0) } (*Tdeflate_state)(unsafe.Pointer(s)).Flevel = level (*Tdeflate_state)(unsafe.Pointer(s)).Fmax_lazy_match = uint32(_configuration_table[level].Fmax_lazy) (*Tdeflate_state)(unsafe.Pointer(s)).Fgood_match = uint32(_configuration_table[level].Fgood_length) (*Tdeflate_state)(unsafe.Pointer(s)).Fnice_match = libc.Int32FromUint16(_configuration_table[level].Fnice_length) (*Tdeflate_state)(unsafe.Pointer(s)).Fmax_chain_length = uint32(_configuration_table[level].Fmax_chain) } (*Tdeflate_state)(unsafe.Pointer(s)).Fstrategy = strategy return Z_OK } // C documentation // // /* ========================================================================= */ func XdeflateTune(tls *libc.TLS, strm Tz_streamp, good_length int32, max_lazy int32, nice_length int32, max_chain int32) (r int32) { var s uintptr _ = s if _deflateStateCheck(tls, strm) != 0 { return -int32(2) } s = (*Tz_stream)(unsafe.Pointer(strm)).Fstate (*Tdeflate_state)(unsafe.Pointer(s)).Fgood_match = libc.Uint32FromInt32(good_length) (*Tdeflate_state)(unsafe.Pointer(s)).Fmax_lazy_match = libc.Uint32FromInt32(max_lazy) (*Tdeflate_state)(unsafe.Pointer(s)).Fnice_match = nice_length (*Tdeflate_state)(unsafe.Pointer(s)).Fmax_chain_length = libc.Uint32FromInt32(max_chain) return Z_OK } // C documentation // // /* ========================================================================= // * For the default windowBits of 15 and memLevel of 8, this function returns a // * close to exact, as well as small, upper bound on the compressed size. This // * is an expansion of ~0.03%, plus a small constant. // * // * For any setting other than those defaults for windowBits and memLevel, one // * of two worst case bounds is returned. This is at most an expansion of ~4% or // * ~13%, plus a small constant. // * // * Both the 0.03% and 4% derive from the overhead of stored blocks. The first // * one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second // * is for stored blocks of 127 bytes (the worst case memLevel == 1). The // * expansion results from five bytes of header for each stored block. // * // * The larger expansion of 13% results from a window size less than or equal to // * the symbols buffer size (windowBits <= memLevel + 7). In that case some of // * the data being compressed may have slid out of the sliding window, impeding // * a stored block from being emitted. Then the only choice is a fixed or // * dynamic block, where a fixed block limits the maximum expansion to 9 bits // * per 8-bit byte, plus 10 bits for every block. The smallest block size for // * which this can occur is 255 (memLevel == 2). // * // * Shifts are used to approximate divisions, for speed. // */ func XdeflateBound(tls *libc.TLS, strm Tz_streamp, sourceLen TuLong) (r TuLong) { var fixedlen, storelen, wraplen TuLong var s, str, v3, v5 uintptr var v1, v7 uint32 var v2 int32 _, _, _, _, _, _, _, _, _, _ = fixedlen, s, storelen, str, wraplen, v1, v2, v3, v5, v7 /* upper bound for fixed blocks with 9-bit literals and length 255 (memLevel == 2, which is the lowest that may not use stored blocks) -- ~13% overhead plus a small constant */ fixedlen = sourceLen + sourceLen>>libc.Int32FromInt32(3) + sourceLen>>libc.Int32FromInt32(8) + sourceLen>>libc.Int32FromInt32(9) + uint32(4) /* upper bound for stored blocks with length 127 (memLevel == 1) -- ~4% overhead plus a small constant */ storelen = sourceLen + sourceLen>>libc.Int32FromInt32(5) + sourceLen>>libc.Int32FromInt32(7) + sourceLen>>libc.Int32FromInt32(11) + uint32(7) /* if can't get parameters, return larger bound plus a zlib wrapper */ if _deflateStateCheck(tls, strm) != 0 { if fixedlen > storelen { v1 = fixedlen } else { v1 = storelen } return v1 + uint32(6) } /* compute wrapper length */ s = (*Tz_stream)(unsafe.Pointer(strm)).Fstate switch (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap { case 0: /* raw deflate */ wraplen = uint32(0) case int32(1): /* zlib wrapper */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart != 0 { v2 = int32(4) } else { v2 = 0 } wraplen = libc.Uint32FromInt32(int32(6) + v2) case int32(2): /* gzip wrapper */ wraplen = uint32(18) if (*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead != uintptr(Z_NULL) { if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fextra != uintptr(Z_NULL) { wraplen += uint32(2) + (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fextra_len } str = (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fname if str != uintptr(Z_NULL) { for { wraplen++ goto _4 _4: ; v3 = str str++ if !(*(*TBytef)(unsafe.Pointer(v3)) != 0) { break } } } str = (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fcomment if str != uintptr(Z_NULL) { for { wraplen++ goto _6 _6: ; v5 = str str++ if !(*(*TBytef)(unsafe.Pointer(v5)) != 0) { break } } } if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fhcrc != 0 { wraplen += uint32(2) } } default: /* for compiler happiness */ wraplen = uint32(6) } /* if not default parameters, return one of the conservative bounds */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fw_bits != uint32(15) || (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_bits != libc.Uint32FromInt32(libc.Int32FromInt32(8)+libc.Int32FromInt32(7)) { if (*Tdeflate_state)(unsafe.Pointer(s)).Fw_bits <= (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_bits && (*Tdeflate_state)(unsafe.Pointer(s)).Flevel != 0 { v7 = fixedlen } else { v7 = storelen } return v7 + wraplen } /* default settings: return tight bound for that case -- ~0.03% overhead plus a small constant */ return sourceLen + sourceLen>>libc.Int32FromInt32(12) + sourceLen>>libc.Int32FromInt32(14) + sourceLen>>libc.Int32FromInt32(25) + uint32(13) - uint32(6) + wraplen } // C documentation // // /* ========================================================================= // * Put a short in the pending buffer. The 16-bit value is put in MSB order. // * IN assertion: the stream state is correct and there is enough room in // * pending_buf. // */ func _putShortMSB(tls *libc.TLS, s uintptr, b TuInt) { var v1, v3 Tulg var v2, v4 uintptr _, _, _, _ = v1, v2, v3, v4 v2 = s + 20 v1 = *(*Tulg)(unsafe.Pointer(v2)) *(*Tulg)(unsafe.Pointer(v2))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v1))) = uint8(b >> libc.Int32FromInt32(8)) v4 = s + 20 v3 = *(*Tulg)(unsafe.Pointer(v4)) *(*Tulg)(unsafe.Pointer(v4))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v3))) = uint8(b & libc.Uint32FromInt32(0xff)) } // C documentation // // /* ========================================================================= // * Flush as much pending output as possible. All deflate() output, except for // * some deflate_stored() output, goes through this function so some // * applications may wish to modify it to avoid allocating a large // * strm->next_out buffer and copying into it. (See also read_buf()). // */ func _flush_pending(tls *libc.TLS, strm Tz_streamp) { var len1 uint32 var s uintptr _, _ = len1, s s = (*Tz_stream)(unsafe.Pointer(strm)).Fstate X_tr_flush_bits(tls, s) len1 = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending if len1 > (*Tz_stream)(unsafe.Pointer(strm)).Favail_out { len1 = (*Tz_stream)(unsafe.Pointer(strm)).Favail_out } if len1 == uint32(0) { return } libc.Xmemcpy(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_out, len1) *(*uintptr)(unsafe.Pointer(strm + 12)) += uintptr(len1) *(*uintptr)(unsafe.Pointer(s + 16)) += uintptr(len1) *(*TuLong)(unsafe.Pointer(strm + 20)) += len1 *(*TuInt)(unsafe.Pointer(strm + 16)) -= len1 *(*Tulg)(unsafe.Pointer(s + 20)) -= len1 if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending == uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_out = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf } } /* =========================================================================== * Update the header CRC with the bytes s->pending_buf[beg..s->pending - 1]. */ // C documentation // // /* ========================================================================= */ func Xdeflate(tls *libc.TLS, strm Tz_streamp, flush int32) (r int32) { var beg, beg1, beg2, v10, v12, v14, v16, v18, v20, v24, v26, v33, v35, v37, v39, v4, v41, v45, v47, v49, v51, v53, v55, v57, v59, v6, v61, v66, v68, v70, v72, v74, v76, v78, v8, v80 Tulg var bstate Tblock_state var copy1, header, left, level_flags TuInt var old_flush, val, val1, v1, v2, v22, v23, v28, v29, v30, v31, v32, v43, v44, v63, v64, v65, v82 int32 var s, v11, v13, v15, v17, v19, v21, v25, v27, v34, v36, v38, v40, v42, v46, v48, v5, v50, v52, v54, v56, v58, v60, v62, v67, v69, v7, v71, v73, v75, v77, v79, v81, v9 uintptr var v3 bool _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = beg, beg1, beg2, bstate, copy1, header, left, level_flags, old_flush, s, val, val1, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v5, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v6, v60, v61, v62, v63, v64, v65, v66, v67, v68, v69, v7, v70, v71, v72, v73, v74, v75, v76, v77, v78, v79, v8, v80, v81, v82, v9 if _deflateStateCheck(tls, strm) != 0 || flush > int32(Z_BLOCK) || flush < 0 { return -int32(2) } s = (*Tz_stream)(unsafe.Pointer(strm)).Fstate if (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out == uintptr(Z_NULL) || (*Tz_stream)(unsafe.Pointer(strm)).Favail_in != uint32(0) && (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in == uintptr(Z_NULL) || (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus == int32(FINISH_STATE) && flush != int32(Z_FINISH) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = Xz_errmsg[libc.Int32FromInt32(2) - -libc.Int32FromInt32(2)] return -libc.Int32FromInt32(2) } if (*Tz_stream)(unsafe.Pointer(strm)).Favail_out == uint32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = Xz_errmsg[libc.Int32FromInt32(2) - -libc.Int32FromInt32(5)] return -libc.Int32FromInt32(5) } old_flush = (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = flush /* Flush as much pending output as possible */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending != uint32(0) { _flush_pending(tls, strm) if (*Tz_stream)(unsafe.Pointer(strm)).Favail_out == uint32(0) { /* Since avail_out is 0, deflate will be called again with * more output space, but possibly with both pending and * avail_in equal to zero. There won't be anything to do, * but this is not an error situation so make sure we * return OK instead of BUF_ERROR at next call of deflate: */ (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(1) return Z_OK } /* Make sure there is something to do and avoid duplicate consecutive * flushes. For repeated and useless calls with Z_FINISH, we keep * returning Z_STREAM_END instead of Z_BUF_ERROR. */ } else { if v3 = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in == uint32(0); v3 { if flush > int32(4) { v1 = int32(9) } else { v1 = 0 } if old_flush > int32(4) { v2 = int32(9) } else { v2 = 0 } } if v3 && flush*int32(2)-v1 <= old_flush*int32(2)-v2 && flush != int32(Z_FINISH) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = Xz_errmsg[libc.Int32FromInt32(2) - -libc.Int32FromInt32(5)] return -libc.Int32FromInt32(5) } } /* User must not provide more input after the first FINISH: */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus == int32(FINISH_STATE) && (*Tz_stream)(unsafe.Pointer(strm)).Favail_in != uint32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = Xz_errmsg[libc.Int32FromInt32(2) - -libc.Int32FromInt32(5)] return -libc.Int32FromInt32(5) } /* Write the header */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus == int32(INIT_STATE) && (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap == 0 { (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(BUSY_STATE) } if (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus == int32(INIT_STATE) { /* zlib header */ header = (uint32(Z_DEFLATED) + ((*Tdeflate_state)(unsafe.Pointer(s)).Fw_bits-uint32(8))<= int32(Z_HUFFMAN_ONLY) || (*Tdeflate_state)(unsafe.Pointer(s)).Flevel < int32(2) { level_flags = uint32(0) } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Flevel < int32(6) { level_flags = uint32(1) } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Flevel == int32(6) { level_flags = uint32(2) } else { level_flags = uint32(3) } } } header |= level_flags << libc.Int32FromInt32(6) if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart != uint32(0) { header |= uint32(PRESET_DICT1) } header += uint32(31) - header%uint32(31) _putShortMSB(tls, s, header) /* Save the adler32 of the preset dictionary: */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart != uint32(0) { _putShortMSB(tls, s, (*Tz_stream)(unsafe.Pointer(strm)).Fadler>>libc.Int32FromInt32(16)) _putShortMSB(tls, s, (*Tz_stream)(unsafe.Pointer(strm)).Fadler&libc.Uint32FromInt32(0xffff)) } (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xadler32(tls, uint32(0), uintptr(Z_NULL), uint32(0)) (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(BUSY_STATE) /* Compression must start with an empty pending buffer */ _flush_pending(tls, strm) if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending != uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(1) return Z_OK } } if (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus == int32(GZIP_STATE) { /* gzip header */ (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xcrc32(tls, uint32(0), uintptr(Z_NULL), uint32(0)) v5 = s + 20 v4 = *(*Tulg)(unsafe.Pointer(v5)) *(*Tulg)(unsafe.Pointer(v5))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v4))) = libc.Uint8FromInt32(libc.Int32FromInt32(31)) v7 = s + 20 v6 = *(*Tulg)(unsafe.Pointer(v7)) *(*Tulg)(unsafe.Pointer(v7))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v6))) = libc.Uint8FromInt32(libc.Int32FromInt32(139)) v9 = s + 20 v8 = *(*Tulg)(unsafe.Pointer(v9)) *(*Tulg)(unsafe.Pointer(v9))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v8))) = libc.Uint8FromInt32(libc.Int32FromInt32(8)) if (*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead == uintptr(Z_NULL) { v11 = s + 20 v10 = *(*Tulg)(unsafe.Pointer(v11)) *(*Tulg)(unsafe.Pointer(v11))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v10))) = libc.Uint8FromInt32(libc.Int32FromInt32(0)) v13 = s + 20 v12 = *(*Tulg)(unsafe.Pointer(v13)) *(*Tulg)(unsafe.Pointer(v13))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v12))) = libc.Uint8FromInt32(libc.Int32FromInt32(0)) v15 = s + 20 v14 = *(*Tulg)(unsafe.Pointer(v15)) *(*Tulg)(unsafe.Pointer(v15))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v14))) = libc.Uint8FromInt32(libc.Int32FromInt32(0)) v17 = s + 20 v16 = *(*Tulg)(unsafe.Pointer(v17)) *(*Tulg)(unsafe.Pointer(v17))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v16))) = libc.Uint8FromInt32(libc.Int32FromInt32(0)) v19 = s + 20 v18 = *(*Tulg)(unsafe.Pointer(v19)) *(*Tulg)(unsafe.Pointer(v19))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v18))) = libc.Uint8FromInt32(libc.Int32FromInt32(0)) v21 = s + 20 v20 = *(*Tulg)(unsafe.Pointer(v21)) *(*Tulg)(unsafe.Pointer(v21))++ if (*Tdeflate_state)(unsafe.Pointer(s)).Flevel == int32(9) { v22 = int32(2) } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrategy >= int32(Z_HUFFMAN_ONLY) || (*Tdeflate_state)(unsafe.Pointer(s)).Flevel < int32(2) { v23 = int32(4) } else { v23 = 0 } v22 = v23 } *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v20))) = libc.Uint8FromInt32(v22) v25 = s + 20 v24 = *(*Tulg)(unsafe.Pointer(v25)) *(*Tulg)(unsafe.Pointer(v25))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v24))) = libc.Uint8FromInt32(libc.Int32FromInt32(OS_CODE)) (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(BUSY_STATE) /* Compression must start with an empty pending buffer */ _flush_pending(tls, strm) if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending != uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(1) return Z_OK } } else { v27 = s + 20 v26 = *(*Tulg)(unsafe.Pointer(v27)) *(*Tulg)(unsafe.Pointer(v27))++ if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Ftext != 0 { v28 = int32(1) } else { v28 = 0 } if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fhcrc != 0 { v29 = int32(2) } else { v29 = 0 } if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fextra == uintptr(Z_NULL) { v30 = 0 } else { v30 = int32(4) } if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fname == uintptr(Z_NULL) { v31 = 0 } else { v31 = int32(8) } if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fcomment == uintptr(Z_NULL) { v32 = 0 } else { v32 = int32(16) } *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v26))) = libc.Uint8FromInt32(v28 + v29 + v30 + v31 + v32) v34 = s + 20 v33 = *(*Tulg)(unsafe.Pointer(v34)) *(*Tulg)(unsafe.Pointer(v34))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v33))) = uint8((*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Ftime & libc.Uint32FromInt32(0xff)) v36 = s + 20 v35 = *(*Tulg)(unsafe.Pointer(v36)) *(*Tulg)(unsafe.Pointer(v36))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v35))) = uint8((*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Ftime >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) v38 = s + 20 v37 = *(*Tulg)(unsafe.Pointer(v38)) *(*Tulg)(unsafe.Pointer(v38))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v37))) = uint8((*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Ftime >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xff)) v40 = s + 20 v39 = *(*Tulg)(unsafe.Pointer(v40)) *(*Tulg)(unsafe.Pointer(v40))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v39))) = uint8((*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Ftime >> libc.Int32FromInt32(24) & libc.Uint32FromInt32(0xff)) v42 = s + 20 v41 = *(*Tulg)(unsafe.Pointer(v42)) *(*Tulg)(unsafe.Pointer(v42))++ if (*Tdeflate_state)(unsafe.Pointer(s)).Flevel == int32(9) { v43 = int32(2) } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrategy >= int32(Z_HUFFMAN_ONLY) || (*Tdeflate_state)(unsafe.Pointer(s)).Flevel < int32(2) { v44 = int32(4) } else { v44 = 0 } v43 = v44 } *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v41))) = libc.Uint8FromInt32(v43) v46 = s + 20 v45 = *(*Tulg)(unsafe.Pointer(v46)) *(*Tulg)(unsafe.Pointer(v46))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v45))) = libc.Uint8FromInt32((*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fos & libc.Int32FromInt32(0xff)) if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fextra != uintptr(Z_NULL) { v48 = s + 20 v47 = *(*Tulg)(unsafe.Pointer(v48)) *(*Tulg)(unsafe.Pointer(v48))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v47))) = uint8((*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fextra_len & libc.Uint32FromInt32(0xff)) v50 = s + 20 v49 = *(*Tulg)(unsafe.Pointer(v50)) *(*Tulg)(unsafe.Pointer(v50))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v49))) = uint8((*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fextra_len >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) } if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fhcrc != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xcrc32(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fadler, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending) } (*Tdeflate_state)(unsafe.Pointer(s)).Fgzindex = uint32(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(EXTRA_STATE) } } if (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus == int32(EXTRA_STATE) { if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fextra != uintptr(Z_NULL) { beg = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending /* start of bytes to update crc */ left = (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fextra_len&libc.Uint32FromInt32(0xffff) - (*Tdeflate_state)(unsafe.Pointer(s)).Fgzindex for (*Tdeflate_state)(unsafe.Pointer(s)).Fpending+left > (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size { copy1 = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size - (*Tdeflate_state)(unsafe.Pointer(s)).Fpending libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fpending), (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fextra+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fgzindex), copy1) (*Tdeflate_state)(unsafe.Pointer(s)).Fpending = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fhcrc != 0 && (*Tdeflate_state)(unsafe.Pointer(s)).Fpending > beg { (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xcrc32(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fadler, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf+uintptr(beg), (*Tdeflate_state)(unsafe.Pointer(s)).Fpending-beg) } *(*Tulg)(unsafe.Pointer(s + 32)) += copy1 _flush_pending(tls, strm) if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending != uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(1) return Z_OK } beg = uint32(0) left -= copy1 } libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fpending), (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fextra+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fgzindex), left) *(*Tulg)(unsafe.Pointer(s + 20)) += left if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fhcrc != 0 && (*Tdeflate_state)(unsafe.Pointer(s)).Fpending > beg { (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xcrc32(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fadler, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf+uintptr(beg), (*Tdeflate_state)(unsafe.Pointer(s)).Fpending-beg) } (*Tdeflate_state)(unsafe.Pointer(s)).Fgzindex = uint32(0) } (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(NAME_STATE) } if (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus == int32(NAME_STATE) { if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fname != uintptr(Z_NULL) { beg1 = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending for cond := true; cond; cond = val != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending == (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size { if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fhcrc != 0 && (*Tdeflate_state)(unsafe.Pointer(s)).Fpending > beg1 { (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xcrc32(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fadler, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf+uintptr(beg1), (*Tdeflate_state)(unsafe.Pointer(s)).Fpending-beg1) } _flush_pending(tls, strm) if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending != uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(1) return Z_OK } beg1 = uint32(0) } v52 = s + 32 v51 = *(*Tulg)(unsafe.Pointer(v52)) *(*Tulg)(unsafe.Pointer(v52))++ val = libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer((*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fname + uintptr(v51)))) v54 = s + 20 v53 = *(*Tulg)(unsafe.Pointer(v54)) *(*Tulg)(unsafe.Pointer(v54))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v53))) = libc.Uint8FromInt32(val) } if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fhcrc != 0 && (*Tdeflate_state)(unsafe.Pointer(s)).Fpending > beg1 { (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xcrc32(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fadler, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf+uintptr(beg1), (*Tdeflate_state)(unsafe.Pointer(s)).Fpending-beg1) } (*Tdeflate_state)(unsafe.Pointer(s)).Fgzindex = uint32(0) } (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(COMMENT_STATE) } if (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus == int32(COMMENT_STATE) { if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fcomment != uintptr(Z_NULL) { beg2 = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending for cond := true; cond; cond = val1 != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending == (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size { if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fhcrc != 0 && (*Tdeflate_state)(unsafe.Pointer(s)).Fpending > beg2 { (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xcrc32(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fadler, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf+uintptr(beg2), (*Tdeflate_state)(unsafe.Pointer(s)).Fpending-beg2) } _flush_pending(tls, strm) if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending != uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(1) return Z_OK } beg2 = uint32(0) } v56 = s + 32 v55 = *(*Tulg)(unsafe.Pointer(v56)) *(*Tulg)(unsafe.Pointer(v56))++ val1 = libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer((*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fcomment + uintptr(v55)))) v58 = s + 20 v57 = *(*Tulg)(unsafe.Pointer(v58)) *(*Tulg)(unsafe.Pointer(v58))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v57))) = libc.Uint8FromInt32(val1) } if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fhcrc != 0 && (*Tdeflate_state)(unsafe.Pointer(s)).Fpending > beg2 { (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xcrc32(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fadler, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf+uintptr(beg2), (*Tdeflate_state)(unsafe.Pointer(s)).Fpending-beg2) } } (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(HCRC_STATE) } if (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus == int32(HCRC_STATE) { if (*Tgz_header)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fgzhead)).Fhcrc != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending+uint32(2) > (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size { _flush_pending(tls, strm) if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending != uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(1) return Z_OK } } v60 = s + 20 v59 = *(*Tulg)(unsafe.Pointer(v60)) *(*Tulg)(unsafe.Pointer(v60))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v59))) = uint8((*Tz_stream)(unsafe.Pointer(strm)).Fadler & libc.Uint32FromInt32(0xff)) v62 = s + 20 v61 = *(*Tulg)(unsafe.Pointer(v62)) *(*Tulg)(unsafe.Pointer(v62))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v61))) = uint8((*Tz_stream)(unsafe.Pointer(strm)).Fadler >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) (*Tz_stream)(unsafe.Pointer(strm)).Fadler = Xcrc32(tls, uint32(0), uintptr(Z_NULL), uint32(0)) } (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(BUSY_STATE) /* Compression must start with an empty pending buffer */ _flush_pending(tls, strm) if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending != uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(1) return Z_OK } } /* Start a new block or continue the current one. */ if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in != uint32(0) || (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead != uint32(0) || flush != Z_NO_FLUSH && (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus != int32(FINISH_STATE) { if (*Tdeflate_state)(unsafe.Pointer(s)).Flevel == 0 { v63 = _deflate_stored(tls, s, flush) } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrategy == int32(Z_HUFFMAN_ONLY) { v64 = _deflate_huff(tls, s, flush) } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrategy == int32(Z_RLE) { v65 = _deflate_rle(tls, s, flush) } else { v65 = (*(*func(*libc.TLS, uintptr, int32) Tblock_state)(unsafe.Pointer(&struct{ uintptr }{_configuration_table[(*Tdeflate_state)(unsafe.Pointer(s)).Flevel].Ffunc1})))(tls, s, flush) } v64 = v65 } v63 = v64 } bstate = v63 if bstate == int32(finish_started) || bstate == int32(finish_done) { (*Tdeflate_state)(unsafe.Pointer(s)).Fstatus = int32(FINISH_STATE) } if bstate == int32(need_more) || bstate == int32(finish_started) { if (*Tz_stream)(unsafe.Pointer(strm)).Favail_out == uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(1) /* avoid BUF_ERROR next call, see above */ } return Z_OK /* If flush != Z_NO_FLUSH && avail_out == 0, the next call * of deflate should use the same flush parameter to make sure * that the flush is complete. So we don't have to output an * empty block here, this will be done at next call. This also * ensures that for a very small output buffer, we emit at most * one empty block. */ } if bstate == int32(block_done) { if flush == int32(Z_PARTIAL_FLUSH) { X_tr_align(tls, s) } else { if flush != int32(Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ X_tr_stored_block(tls, s, libc.UintptrFromInt32(0), uint32(0), 0) /* For a full flush, this empty block will be recognized * as a special marker by inflate_sync(). */ if flush == int32(Z_FULL_FLUSH) { *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size-uint32(1))*2)) = uint16(NIL) libc.Xmemset(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fhead, 0, ((*Tdeflate_state)(unsafe.Pointer(s)).Fhash_size-libc.Uint32FromInt32(1))*uint32(2)) /* forget history */ if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead == uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart = uint32(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = 0 (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = uint32(0) } } } } _flush_pending(tls, strm) if (*Tz_stream)(unsafe.Pointer(strm)).Favail_out == uint32(0) { (*Tdeflate_state)(unsafe.Pointer(s)).Flast_flush = -int32(1) /* avoid BUF_ERROR at next call, see above */ return Z_OK } } } if flush != int32(Z_FINISH) { return Z_OK } if (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap <= 0 { return int32(Z_STREAM_END) } /* Write the trailer */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap == int32(2) { v67 = s + 20 v66 = *(*Tulg)(unsafe.Pointer(v67)) *(*Tulg)(unsafe.Pointer(v67))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v66))) = uint8((*Tz_stream)(unsafe.Pointer(strm)).Fadler & libc.Uint32FromInt32(0xff)) v69 = s + 20 v68 = *(*Tulg)(unsafe.Pointer(v69)) *(*Tulg)(unsafe.Pointer(v69))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v68))) = uint8((*Tz_stream)(unsafe.Pointer(strm)).Fadler >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) v71 = s + 20 v70 = *(*Tulg)(unsafe.Pointer(v71)) *(*Tulg)(unsafe.Pointer(v71))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v70))) = uint8((*Tz_stream)(unsafe.Pointer(strm)).Fadler >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xff)) v73 = s + 20 v72 = *(*Tulg)(unsafe.Pointer(v73)) *(*Tulg)(unsafe.Pointer(v73))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v72))) = uint8((*Tz_stream)(unsafe.Pointer(strm)).Fadler >> libc.Int32FromInt32(24) & libc.Uint32FromInt32(0xff)) v75 = s + 20 v74 = *(*Tulg)(unsafe.Pointer(v75)) *(*Tulg)(unsafe.Pointer(v75))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v74))) = uint8((*Tz_stream)(unsafe.Pointer(strm)).Ftotal_in & libc.Uint32FromInt32(0xff)) v77 = s + 20 v76 = *(*Tulg)(unsafe.Pointer(v77)) *(*Tulg)(unsafe.Pointer(v77))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v76))) = uint8((*Tz_stream)(unsafe.Pointer(strm)).Ftotal_in >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(0xff)) v79 = s + 20 v78 = *(*Tulg)(unsafe.Pointer(v79)) *(*Tulg)(unsafe.Pointer(v79))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v78))) = uint8((*Tz_stream)(unsafe.Pointer(strm)).Ftotal_in >> libc.Int32FromInt32(16) & libc.Uint32FromInt32(0xff)) v81 = s + 20 v80 = *(*Tulg)(unsafe.Pointer(v81)) *(*Tulg)(unsafe.Pointer(v81))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v80))) = uint8((*Tz_stream)(unsafe.Pointer(strm)).Ftotal_in >> libc.Int32FromInt32(24) & libc.Uint32FromInt32(0xff)) } else { _putShortMSB(tls, s, (*Tz_stream)(unsafe.Pointer(strm)).Fadler>>libc.Int32FromInt32(16)) _putShortMSB(tls, s, (*Tz_stream)(unsafe.Pointer(strm)).Fadler&libc.Uint32FromInt32(0xffff)) } _flush_pending(tls, strm) /* If avail_out is zero, the application will call deflate again * to flush the rest. */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap > 0 { (*Tdeflate_state)(unsafe.Pointer(s)).Fwrap = -(*Tdeflate_state)(unsafe.Pointer(s)).Fwrap } /* write the trailer only once! */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending != uint32(0) { v82 = Z_OK } else { v82 = int32(Z_STREAM_END) } return v82 } // C documentation // // /* ========================================================================= */ func XdeflateEnd(tls *libc.TLS, strm Tz_streamp) (r int32) { var status, v1 int32 _, _ = status, v1 if _deflateStateCheck(tls, strm) != 0 { return -int32(2) } status = (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fstatus /* Deallocate in reverse order of allocations: */ if (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fpending_buf != 0 { (*(*func(*libc.TLS, Tvoidpf, Tvoidpf))(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzfree})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fpending_buf) } if (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fhead != 0 { (*(*func(*libc.TLS, Tvoidpf, Tvoidpf))(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzfree})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fhead) } if (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fprev != 0 { (*(*func(*libc.TLS, Tvoidpf, Tvoidpf))(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzfree})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fprev) } if (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fwindow != 0 { (*(*func(*libc.TLS, Tvoidpf, Tvoidpf))(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzfree})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tinternal_state)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fstate)).Fwindow) } (*(*func(*libc.TLS, Tvoidpf, Tvoidpf))(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzfree})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tz_stream)(unsafe.Pointer(strm)).Fstate) (*Tz_stream)(unsafe.Pointer(strm)).Fstate = uintptr(Z_NULL) if status == int32(BUSY_STATE) { v1 = -int32(3) } else { v1 = Z_OK } return v1 } // C documentation // // /* ========================================================================= // * Copy the source state to the destination state. // * To simplify the source, this is not supported for 16-bit MSDOS (which // * doesn't have enough memory anyway to duplicate compression states). // */ func XdeflateCopy(tls *libc.TLS, dest Tz_streamp, source Tz_streamp) (r int32) { var ds, ss uintptr _, _ = ds, ss if _deflateStateCheck(tls, source) != 0 || dest == uintptr(Z_NULL) { return -int32(2) } ss = (*Tz_stream)(unsafe.Pointer(source)).Fstate libc.Xmemcpy(tls, dest, source, uint32(56)) ds = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(dest)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(dest)).Fopaque, libc.Uint32FromInt32(libc.Int32FromInt32(1)), libc.Uint32FromInt64(5828)) if ds == uintptr(Z_NULL) { return -int32(4) } (*Tz_stream)(unsafe.Pointer(dest)).Fstate = ds libc.Xmemcpy(tls, ds, ss, uint32(5828)) (*Tdeflate_state)(unsafe.Pointer(ds)).Fstrm = dest (*Tdeflate_state)(unsafe.Pointer(ds)).Fwindow = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(dest)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(dest)).Fopaque, (*Tdeflate_state)(unsafe.Pointer(ds)).Fw_size, libc.Uint32FromInt32(2)*libc.Uint32FromInt64(1)) (*Tdeflate_state)(unsafe.Pointer(ds)).Fprev = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(dest)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(dest)).Fopaque, (*Tdeflate_state)(unsafe.Pointer(ds)).Fw_size, libc.Uint32FromInt64(2)) (*Tdeflate_state)(unsafe.Pointer(ds)).Fhead = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(dest)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(dest)).Fopaque, (*Tdeflate_state)(unsafe.Pointer(ds)).Fhash_size, libc.Uint32FromInt64(2)) (*Tdeflate_state)(unsafe.Pointer(ds)).Fpending_buf = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(dest)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(dest)).Fopaque, (*Tdeflate_state)(unsafe.Pointer(ds)).Flit_bufsize, libc.Uint32FromInt32(libc.Int32FromInt32(LIT_BUFS))) if (*Tdeflate_state)(unsafe.Pointer(ds)).Fwindow == uintptr(Z_NULL) || (*Tdeflate_state)(unsafe.Pointer(ds)).Fprev == uintptr(Z_NULL) || (*Tdeflate_state)(unsafe.Pointer(ds)).Fhead == uintptr(Z_NULL) || (*Tdeflate_state)(unsafe.Pointer(ds)).Fpending_buf == uintptr(Z_NULL) { XdeflateEnd(tls, dest) return -int32(4) } /* following zmemcpy do not work for 16-bit MSDOS */ libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(ds)).Fwindow, (*Tdeflate_state)(unsafe.Pointer(ss)).Fwindow, (*Tdeflate_state)(unsafe.Pointer(ds)).Fw_size*uint32(2)*uint32(1)) libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(ds)).Fprev, (*Tdeflate_state)(unsafe.Pointer(ss)).Fprev, (*Tdeflate_state)(unsafe.Pointer(ds)).Fw_size*uint32(2)) libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(ds)).Fhead, (*Tdeflate_state)(unsafe.Pointer(ss)).Fhead, (*Tdeflate_state)(unsafe.Pointer(ds)).Fhash_size*uint32(2)) libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(ds)).Fpending_buf, (*Tdeflate_state)(unsafe.Pointer(ss)).Fpending_buf, (*Tdeflate_state)(unsafe.Pointer(ds)).Flit_bufsize*uint32(LIT_BUFS)) (*Tdeflate_state)(unsafe.Pointer(ds)).Fpending_out = (*Tdeflate_state)(unsafe.Pointer(ds)).Fpending_buf + uintptr(int32((*Tdeflate_state)(unsafe.Pointer(ss)).Fpending_out)-int32((*Tdeflate_state)(unsafe.Pointer(ss)).Fpending_buf)) (*Tdeflate_state)(unsafe.Pointer(ds)).Fsym_buf = (*Tdeflate_state)(unsafe.Pointer(ds)).Fpending_buf + uintptr((*Tdeflate_state)(unsafe.Pointer(ds)).Flit_bufsize) (*Tdeflate_state)(unsafe.Pointer(ds)).Fl_desc.Fdyn_tree = ds + 148 (*Tdeflate_state)(unsafe.Pointer(ds)).Fd_desc.Fdyn_tree = ds + 2440 (*Tdeflate_state)(unsafe.Pointer(ds)).Fbl_desc.Fdyn_tree = ds + 2684 return Z_OK } // C documentation // // /* =========================================================================== // * Set match_start to the longest match starting at the given string and // * return its length. Matches shorter or equal to prev_length are discarded, // * in which case the result is equal to prev_length and match_start is // * garbage. // * IN assertions: cur_match is the head of the hash chain for the current // * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 // * OUT assertion: the match length is not greater than s->lookahead. // */ func _longest_match(tls *libc.TLS, s uintptr, cur_match TIPos) (r TuInt) { var best_len, len1, nice_match int32 var chain_length, v1, v3 uint32 var limit, v2 TIPos var match, prev, scan, strend, v10, v11, v13, v14, v16, v17, v19, v20, v22, v23, v25, v26, v28, v29, v6, v8, v9 uintptr var scan_end, scan_end1 TByte var wmask TuInt var v12, v15, v18, v21, v24, v27, v30, v4, v7 bool _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = best_len, chain_length, len1, limit, match, nice_match, prev, scan, scan_end, scan_end1, strend, wmask, v1, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v4, v6, v7, v8, v9 chain_length = (*Tdeflate_state)(unsafe.Pointer(s)).Fmax_chain_length /* max hash chain length */ scan = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) /* length of current match */ best_len = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fprev_length) /* best match length so far */ nice_match = (*Tdeflate_state)(unsafe.Pointer(s)).Fnice_match if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart > (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size-libc.Uint32FromInt32(libc.Int32FromInt32(MAX_MATCH)+libc.Int32FromInt32(MIN_MATCH)+libc.Int32FromInt32(1)) { v1 = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart - ((*Tdeflate_state)(unsafe.Pointer(s)).Fw_size - libc.Uint32FromInt32(libc.Int32FromInt32(MAX_MATCH)+libc.Int32FromInt32(MIN_MATCH)+libc.Int32FromInt32(1))) } else { v1 = uint32(NIL) } /* stop if match long enough */ limit = v1 /* Stop when cur_match becomes <= limit. To simplify the code, * we prevent matches with the string of window index 0. */ prev = (*Tdeflate_state)(unsafe.Pointer(s)).Fprev wmask = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_mask strend = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) + uintptr(MAX_MATCH) scan_end1 = *(*TBytef)(unsafe.Pointer(scan + uintptr(best_len-int32(1)))) scan_end = *(*TBytef)(unsafe.Pointer(scan + uintptr(best_len))) /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ /* Do not waste too much time if we already have a good match: */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fprev_length >= (*Tdeflate_state)(unsafe.Pointer(s)).Fgood_match { chain_length >>= uint32(2) } /* Do not look for matches beyond the end of the input. This is necessary * to make deflate deterministic. */ if libc.Uint32FromInt32(nice_match) > (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead { nice_match = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Flookahead) } for { match = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(cur_match) /* Skip to next match if the match length cannot increase * or if the match length is less than 2. Note that the checks below * for insufficient lookahead only occur occasionally for performance * reasons. Therefore uninitialized memory will be accessed, and * conditional jumps will be made that depend on those values. * However the length of the match is limited to the lookahead, so * the output of deflate is not affected by the uninitialized values. */ if v7 = libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(match + uintptr(best_len)))) != libc.Int32FromUint8(scan_end) || libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(match + uintptr(best_len-int32(1))))) != libc.Int32FromUint8(scan_end1) || libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(match))) != libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(scan))); !v7 { match++ v6 = match } if v7 || libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v6))) != libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(scan + 1))) { goto _5 } /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += uintptr(2) /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ match++ /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart + 258. */ for { goto _31 _31: ; scan++ v8 = scan match++ v9 = match if v12 = libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v8))) == libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v9))); v12 { scan++ v10 = scan match++ v11 = match } if v15 = v12 && libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v10))) == libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v11))); v15 { scan++ v13 = scan match++ v14 = match } if v18 = v15 && libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v13))) == libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v14))); v18 { scan++ v16 = scan match++ v17 = match } if v21 = v18 && libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v16))) == libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v17))); v21 { scan++ v19 = scan match++ v20 = match } if v24 = v21 && libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v19))) == libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v20))); v24 { scan++ v22 = scan match++ v23 = match } if v27 = v24 && libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v22))) == libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v23))); v27 { scan++ v25 = scan match++ v26 = match } if v30 = v27 && libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v25))) == libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v26))); v30 { scan++ v28 = scan match++ v29 = match } if !(v30 && libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v28))) == libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer(v29))) && scan < strend) { break } } len1 = int32(MAX_MATCH) - (int32(strend) - int32(scan)) scan = strend - uintptr(MAX_MATCH) if len1 > best_len { (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_start = cur_match best_len = len1 if len1 >= nice_match { break } scan_end1 = *(*TBytef)(unsafe.Pointer(scan + uintptr(best_len-int32(1)))) scan_end = *(*TBytef)(unsafe.Pointer(scan + uintptr(best_len))) } goto _5 _5: ; v2 = uint32(*(*TPosf)(unsafe.Pointer(prev + uintptr(cur_match&wmask)*2))) cur_match = v2 if v4 = v2 > limit; v4 { chain_length-- v3 = chain_length } if !(v4 && v3 != uint32(0)) { break } } if libc.Uint32FromInt32(best_len) <= (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead { return libc.Uint32FromInt32(best_len) } return (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead } /* =========================================================================== * Flush the current block, with given end-of-file flag. * IN assertion: strstart is set to the end of the current match. */ /* Same but force premature exit if necessary. */ /* Maximum stored block length in deflate format (not including header). */ /* Minimum of a and b. */ // C documentation // // /* =========================================================================== // * Copy without compression as much as possible from the input stream, return // * the current block state. // * // * In case deflateParams() is used to later switch to a non-zero compression // * level, s->matches (otherwise unused when storing) keeps track of the number // * of hash table slides to perform. If s->matches is 1, then one hash table // * slide will be done when switching. If s->matches is 2, the maximum value // * allowed here, then the hash table will be cleared, since two or more slides // * is the same as a clear. // * // * deflate_stored() is written to minimize the number of times an input byte is // * copied. It is most efficient with large input and output buffers, which // * maximizes the opportunities to have a single copy from next_in to next_out. // */ func _deflate_stored(tls *libc.TLS, s uintptr, flush int32) (r Tblock_state) { var have, last, left, len1, min_block, used, v1, v4, v6, v7, v8, v9 uint32 var v10, v12, v2 int32 var p11, p3, p5 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = have, last, left, len1, min_block, used, v1, v10, v12, v2, v4, v6, v7, v8, v9, p11, p3, p5 if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size-uint32(5) > (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size { v1 = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size } else { v1 = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size - uint32(5) } /* Smallest worthy block size when not flushing or finishing. By default * this is 32K. This can be as small as 507 bytes for memLevel == 1. For * large input and output buffers, the stored block size will be larger. */ min_block = v1 last = uint32(0) used = (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in for cond := true; cond; cond = last == uint32(0) { /* Set len to the maximum size block that we can copy directly with the * available input data and output space. Set left to how much of that * would be copied from what's left in the window. */ len1 = uint32(MAX_STORED) /* maximum deflate stored block length */ have = libc.Uint32FromInt32(((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid + int32(42)) >> int32(3)) /* number of header bytes */ if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out < have { /* need room for header */ break } /* maximum stored block length that will fit in avail_out: */ have = (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out - have left = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart - libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start) /* bytes left in window */ if len1 > left+(*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in { len1 = left + (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in } /* limit len to the input */ if len1 > have { len1 = have } /* limit len to the output */ /* If the stored block would be less than min_block in length, or if * unable to copy all of the available input when flushing, then try * copying to the window and the pending buffer instead. Also don't * write an empty block when flushing -- deflate() does that. */ if len1 < min_block && (len1 == uint32(0) && flush != int32(Z_FINISH) || flush == Z_NO_FLUSH || len1 != left+(*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in) { break } /* Make a dummy stored block in pending to get the header bytes, * including any pending bits. This also updates the debugging counts. */ if flush == int32(Z_FINISH) && len1 == left+(*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in { v2 = int32(1) } else { v2 = 0 } last = libc.Uint32FromInt32(v2) X_tr_stored_block(tls, s, libc.UintptrFromInt32(0), uint32(0), libc.Int32FromUint32(last)) /* Replace the lengths in the dummy stored block with len. */ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fpending-uint32(4)))) = uint8(len1) *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fpending-uint32(3)))) = uint8(len1 >> int32(8)) *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fpending-uint32(2)))) = uint8(^len1) *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fpending-uint32(1)))) = uint8(^len1 >> int32(8)) /* Write the stored block header bytes. */ _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) /* Copy uncompressed bytes from the window to next_out. */ if left != 0 { if left > len1 { left = len1 } libc.Xmemcpy(tls, (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Fnext_out, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), left) *(*uintptr)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm + 12)) += uintptr(left) *(*TuInt)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm + 16)) -= left *(*TuLong)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm + 20)) += left p3 = s + 92 *(*int32)(unsafe.Pointer(p3)) = int32(uint32(*(*int32)(unsafe.Pointer(p3))) + left) len1 -= left } /* Copy uncompressed bytes directly from next_in to next_out, updating * the check value. */ if len1 != 0 { _read_buf(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm, (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Fnext_out, len1) *(*uintptr)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm + 12)) += uintptr(len1) *(*TuInt)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm + 16)) -= len1 *(*TuLong)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm + 20)) += len1 } } /* Update the sliding window with the last s->w_size bytes of the copied * data, or append all of the copied data to the existing window if less * than s->w_size bytes were copied. Also update the number of bytes to * insert in the hash tables, in the event that deflateParams() switches to * a non-zero compression level. */ used -= (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in /* number of input bytes directly copied */ if used != 0 { /* If any input was used, then no unused input remains in the window, * therefore s->block_start == s->strstart. */ if used >= (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size { /* supplant the previous history */ (*Tdeflate_state)(unsafe.Pointer(s)).Fmatches = uint32(2) /* clear hash */ libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow, (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Fnext_in-uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fw_size), (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size) (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow_size-(*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart <= used { /* Slide the window down. */ *(*TuInt)(unsafe.Pointer(s + 108)) -= (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fw_size), (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) if (*Tdeflate_state)(unsafe.Pointer(s)).Fmatches < uint32(2) { (*Tdeflate_state)(unsafe.Pointer(s)).Fmatches++ } /* add a pending slide_hash() */ if (*Tdeflate_state)(unsafe.Pointer(s)).Finsert > (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart { (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart } } libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart), (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Fnext_in-uintptr(used), used) *(*TuInt)(unsafe.Pointer(s + 108)) += used if used > (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size-(*Tdeflate_state)(unsafe.Pointer(s)).Finsert { v4 = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size - (*Tdeflate_state)(unsafe.Pointer(s)).Finsert } else { v4 = used } *(*TuInt)(unsafe.Pointer(s + 5812)) += v4 } (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) } if (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water < (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart { (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart } /* If the last block was written to next_out, then done. */ if last != 0 { return int32(finish_done) } /* If flushing and all input has been consumed, then done. */ if flush != Z_NO_FLUSH && flush != int32(Z_FINISH) && (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in == uint32(0) && libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) == (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start { return int32(block_done) } /* Fill the window with any remaining input. */ have = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow_size - (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in > have && (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fw_size) { /* Slide the window down. */ p5 = s + 92 *(*int32)(unsafe.Pointer(p5)) = int32(uint32(*(*int32)(unsafe.Pointer(p5))) - (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size) *(*TuInt)(unsafe.Pointer(s + 108)) -= (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fw_size), (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) if (*Tdeflate_state)(unsafe.Pointer(s)).Fmatches < uint32(2) { (*Tdeflate_state)(unsafe.Pointer(s)).Fmatches++ } /* add a pending slide_hash() */ have += (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size /* more space now */ if (*Tdeflate_state)(unsafe.Pointer(s)).Finsert > (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart { (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart } } if have > (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in { have = (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in } if have != 0 { _read_buf(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart), have) *(*TuInt)(unsafe.Pointer(s + 108)) += have if have > (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size-(*Tdeflate_state)(unsafe.Pointer(s)).Finsert { v6 = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size - (*Tdeflate_state)(unsafe.Pointer(s)).Finsert } else { v6 = have } *(*TuInt)(unsafe.Pointer(s + 5812)) += v6 } if (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water < (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart { (*Tdeflate_state)(unsafe.Pointer(s)).Fhigh_water = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart } /* There was not enough avail_out to write a complete worthy or flushed * stored block to next_out. Write a stored block to pending instead, if we * have enough input for a worthy block, or if flushing and there is enough * room for the remaining input as a stored block in the pending buffer. */ have = libc.Uint32FromInt32(((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid + int32(42)) >> int32(3)) /* number of header bytes */ /* maximum stored block length that will fit in pending: */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size-have > libc.Uint32FromInt32(libc.Int32FromInt32(MAX_STORED)) { v7 = libc.Uint32FromInt32(libc.Int32FromInt32(MAX_STORED)) } else { v7 = (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf_size - have } have = v7 if have > (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size { v8 = (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size } else { v8 = have } min_block = v8 left = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart - libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start) if left >= min_block || (left != 0 || flush == int32(Z_FINISH)) && flush != Z_NO_FLUSH && (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in == uint32(0) && left <= have { if left > have { v9 = have } else { v9 = left } len1 = v9 if flush == int32(Z_FINISH) && (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_in == uint32(0) && len1 == left { v10 = int32(1) } else { v10 = 0 } last = libc.Uint32FromInt32(v10) X_tr_stored_block(tls, s, (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), len1, libc.Int32FromUint32(last)) p11 = s + 92 *(*int32)(unsafe.Pointer(p11)) = int32(uint32(*(*int32)(unsafe.Pointer(p11))) + len1) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) } /* We've done all we can with the available input and output. */ if last != 0 { v12 = int32(finish_started) } else { v12 = int32(need_more) } return v12 } // C documentation // // /* =========================================================================== // * Compress as much as possible from the input stream, return the current // * block state. // * This function does not perform lazy evaluation of matches and inserts // * new strings in the dictionary only for unmatched strings or for short // * matches. It is used only for the fast compression options. // */ func _deflate_fast(tls *libc.TLS, s uintptr, flush int32) (r Tblock_state) { var bflush, v9 int32 var cc, len1 Tuch var dist Tush var hash_head TIPos var v10, v14, v16, v18, v3, v5, v7 TuInt var v11, v15, v17, v19, v20, v22, v23, v4, v6, v8 uintptr var v13, v2 TPosf var v21 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bflush, cc, dist, hash_head, len1, v10, v11, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v3, v4, v5, v6, v7, v8, v9 /* set if current block must be flushed */ for { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead < libc.Uint32FromInt32(libc.Int32FromInt32(MAX_MATCH)+libc.Int32FromInt32(MIN_MATCH)+libc.Int32FromInt32(1)) { _fill_window(tls, s) if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead < libc.Uint32FromInt32(libc.Int32FromInt32(MAX_MATCH)+libc.Int32FromInt32(MIN_MATCH)+libc.Int32FromInt32(1)) && flush == Z_NO_FLUSH { return int32(need_more) } if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead == uint32(0) { break } /* flush the current block */ } /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = uint32(NIL) if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead >= uint32(MIN_MATCH) { (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = ((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h<<(*Tdeflate_state)(unsafe.Pointer(s)).Fhash_shift ^ uint32(*(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart+libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH)-libc.Int32FromInt32(1))))))) & (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_mask v2 = *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fprev + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart&(*Tdeflate_state)(unsafe.Pointer(s)).Fw_mask)*2)) = v2 hash_head = uint32(v2) *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) = uint16((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) } /* Find the longest match, discarding those <= prev_length. * At this point we have always match_length < MIN_MATCH */ if hash_head != uint32(NIL) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart-hash_head <= (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size-libc.Uint32FromInt32(libc.Int32FromInt32(MAX_MATCH)+libc.Int32FromInt32(MIN_MATCH)+libc.Int32FromInt32(1)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = _longest_match(tls, s, hash_head) /* longest_match() sets match_start */ } if (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length >= uint32(MIN_MATCH) { len1 = uint8((*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length - libc.Uint32FromInt32(MIN_MATCH)) dist = uint16((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart - (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_start) v4 = s + 5792 v3 = *(*TuInt)(unsafe.Pointer(v4)) *(*TuInt)(unsafe.Pointer(v4))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v3))) = uint8(dist) v6 = s + 5792 v5 = *(*TuInt)(unsafe.Pointer(v6)) *(*TuInt)(unsafe.Pointer(v6))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v5))) = libc.Uint8FromInt32(libc.Int32FromUint16(dist) >> libc.Int32FromInt32(8)) v8 = s + 5792 v7 = *(*TuInt)(unsafe.Pointer(v8)) *(*TuInt)(unsafe.Pointer(v8))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v7))) = len1 dist-- *(*Tush)(unsafe.Pointer(s + 148 + uintptr(libc.Int32FromUint8(X_length_code[len1])+int32(LITERALS)+int32(1))*4))++ if libc.Int32FromUint16(dist) < int32(256) { v9 = libc.Int32FromUint8(X_dist_code[dist]) } else { v9 = libc.Int32FromUint8(X_dist_code[int32(256)+libc.Int32FromUint16(dist)>>int32(7)]) } *(*Tush)(unsafe.Pointer(s + 2440 + uintptr(v9)*4))++ bflush = libc.BoolInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next == (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_end) *(*TuInt)(unsafe.Pointer(s + 116)) -= (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length /* Insert new strings in the hash table only if the match length * is not too large. This saves time but degrades compression. */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length <= (*Tdeflate_state)(unsafe.Pointer(s)).Fmax_lazy_match && (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead >= uint32(MIN_MATCH) { (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length-- /* string at strstart already in table */ for { (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart++ (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = ((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h<<(*Tdeflate_state)(unsafe.Pointer(s)).Fhash_shift ^ uint32(*(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart+libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH)-libc.Int32FromInt32(1))))))) & (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_mask v13 = *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fprev + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart&(*Tdeflate_state)(unsafe.Pointer(s)).Fw_mask)*2)) = v13 hash_head = uint32(v13) *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) = uint16((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. */ goto _12 _12: ; v11 = s + 96 *(*TuInt)(unsafe.Pointer(v11))-- v10 = *(*TuInt)(unsafe.Pointer(v11)) if !(v10 != uint32(0)) { break } } (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart++ } else { *(*TuInt)(unsafe.Pointer(s + 108)) += (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = uint32(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = uint32(*(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)))) (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = ((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h<<(*Tdeflate_state)(unsafe.Pointer(s)).Fhash_shift ^ uint32(*(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart+uint32(1)))))) & (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_mask /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. */ } } else { /* No match, output a literal byte */ cc = *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart))) v15 = s + 5792 v14 = *(*TuInt)(unsafe.Pointer(v15)) *(*TuInt)(unsafe.Pointer(v15))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v14))) = uint8(0) v17 = s + 5792 v16 = *(*TuInt)(unsafe.Pointer(v17)) *(*TuInt)(unsafe.Pointer(v17))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v16))) = uint8(0) v19 = s + 5792 v18 = *(*TuInt)(unsafe.Pointer(v19)) *(*TuInt)(unsafe.Pointer(v19))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v18))) = cc *(*Tush)(unsafe.Pointer(s + 148 + uintptr(cc)*4))++ bflush = libc.BoolInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next == (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_end) (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead-- (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart++ } if bflush != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v20 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v20 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v20, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), 0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(need_more) } } goto _1 _1: } if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart < libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH)-libc.Int32FromInt32(1)) { v21 = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart } else { v21 = libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH) - libc.Int32FromInt32(1)) } (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = v21 if flush == int32(Z_FINISH) { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v22 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v22 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v22, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), int32(1)) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(finish_started) } return int32(finish_done) } if (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v23 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v23 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v23, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), 0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(need_more) } } return int32(block_done) } // C documentation // // /* =========================================================================== // * Same as above, but achieves better compression. We use a lazy // * evaluation for matches: a match is finally adopted only if there is // * no better match at the next window position. // */ func _deflate_slow(tls *libc.TLS, s uintptr, flush int32) (r Tblock_state) { var bflush, v9 int32 var cc, cc1, len1 Tuch var dist Tush var hash_head TIPos var max_insert, v10, v13, v17, v19, v21, v24, v26, v28, v3, v5, v7 TuInt var v11, v14, v16, v18, v20, v22, v23, v25, v27, v29, v31, v32, v4, v6, v8 uintptr var v15, v2 TPosf var v30 uint32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bflush, cc, cc1, dist, hash_head, len1, max_insert, v10, v11, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v4, v5, v6, v7, v8, v9 /* set if current block must be flushed */ /* Process the input block. */ for { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead < libc.Uint32FromInt32(libc.Int32FromInt32(MAX_MATCH)+libc.Int32FromInt32(MIN_MATCH)+libc.Int32FromInt32(1)) { _fill_window(tls, s) if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead < libc.Uint32FromInt32(libc.Int32FromInt32(MAX_MATCH)+libc.Int32FromInt32(MIN_MATCH)+libc.Int32FromInt32(1)) && flush == Z_NO_FLUSH { return int32(need_more) } if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead == uint32(0) { break } /* flush the current block */ } /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = uint32(NIL) if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead >= uint32(MIN_MATCH) { (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = ((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h<<(*Tdeflate_state)(unsafe.Pointer(s)).Fhash_shift ^ uint32(*(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart+libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH)-libc.Int32FromInt32(1))))))) & (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_mask v2 = *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fprev + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart&(*Tdeflate_state)(unsafe.Pointer(s)).Fw_mask)*2)) = v2 hash_head = uint32(v2) *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) = uint16((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) } /* Find the longest match, discarding those <= prev_length. */ (*Tdeflate_state)(unsafe.Pointer(s)).Fprev_length = (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length /* Find the longest match, discarding those <= prev_length. */ (*Tdeflate_state)(unsafe.Pointer(s)).Fprev_match = (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_start (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH) - libc.Int32FromInt32(1)) if hash_head != uint32(NIL) && (*Tdeflate_state)(unsafe.Pointer(s)).Fprev_length < (*Tdeflate_state)(unsafe.Pointer(s)).Fmax_lazy_match && (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart-hash_head <= (*Tdeflate_state)(unsafe.Pointer(s)).Fw_size-libc.Uint32FromInt32(libc.Int32FromInt32(MAX_MATCH)+libc.Int32FromInt32(MIN_MATCH)+libc.Int32FromInt32(1)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = _longest_match(tls, s, hash_head) /* longest_match() sets match_start */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length <= uint32(5) && ((*Tdeflate_state)(unsafe.Pointer(s)).Fstrategy == int32(Z_FILTERED) || (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length == uint32(MIN_MATCH) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart-(*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_start > uint32(TOO_FAR)) { /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. */ (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH) - libc.Int32FromInt32(1)) } } /* If there was a match at the previous step and the current * match is not better, output the previous match: */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fprev_length >= uint32(MIN_MATCH) && (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length <= (*Tdeflate_state)(unsafe.Pointer(s)).Fprev_length { max_insert = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart + (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead - uint32(MIN_MATCH) /* Do not insert strings in hash table beyond this. */ len1 = uint8((*Tdeflate_state)(unsafe.Pointer(s)).Fprev_length - libc.Uint32FromInt32(MIN_MATCH)) dist = uint16((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart - libc.Uint32FromInt32(1) - (*Tdeflate_state)(unsafe.Pointer(s)).Fprev_match) v4 = s + 5792 v3 = *(*TuInt)(unsafe.Pointer(v4)) *(*TuInt)(unsafe.Pointer(v4))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v3))) = uint8(dist) v6 = s + 5792 v5 = *(*TuInt)(unsafe.Pointer(v6)) *(*TuInt)(unsafe.Pointer(v6))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v5))) = libc.Uint8FromInt32(libc.Int32FromUint16(dist) >> libc.Int32FromInt32(8)) v8 = s + 5792 v7 = *(*TuInt)(unsafe.Pointer(v8)) *(*TuInt)(unsafe.Pointer(v8))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v7))) = len1 dist-- *(*Tush)(unsafe.Pointer(s + 148 + uintptr(libc.Int32FromUint8(X_length_code[len1])+int32(LITERALS)+int32(1))*4))++ if libc.Int32FromUint16(dist) < int32(256) { v9 = libc.Int32FromUint8(X_dist_code[dist]) } else { v9 = libc.Int32FromUint8(X_dist_code[int32(256)+libc.Int32FromUint16(dist)>>int32(7)]) } *(*Tush)(unsafe.Pointer(s + 2440 + uintptr(v9)*4))++ bflush = libc.BoolInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next == (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_end) /* Insert in hash table all strings up to the end of the match. * strstart - 1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ *(*TuInt)(unsafe.Pointer(s + 116)) -= (*Tdeflate_state)(unsafe.Pointer(s)).Fprev_length - uint32(1) *(*TuInt)(unsafe.Pointer(s + 120)) -= uint32(2) for { v14 = s + 108 *(*TuInt)(unsafe.Pointer(v14))++ v13 = *(*TuInt)(unsafe.Pointer(v14)) if v13 <= max_insert { (*Tdeflate_state)(unsafe.Pointer(s)).Fins_h = ((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h<<(*Tdeflate_state)(unsafe.Pointer(s)).Fhash_shift ^ uint32(*(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart+libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH)-libc.Int32FromInt32(1))))))) & (*Tdeflate_state)(unsafe.Pointer(s)).Fhash_mask v15 = *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fprev + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart&(*Tdeflate_state)(unsafe.Pointer(s)).Fw_mask)*2)) = v15 hash_head = uint32(v15) *(*TPosf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fhead + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fins_h)*2)) = uint16((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) } goto _12 _12: ; v11 = s + 120 *(*TuInt)(unsafe.Pointer(v11))-- v10 = *(*TuInt)(unsafe.Pointer(v11)) if !(v10 != uint32(0)) { break } } (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_available = 0 (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH) - libc.Int32FromInt32(1)) (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart++ if bflush != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v16 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v16 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v16, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), 0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(need_more) } } } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_available != 0 { /* If there was no match at the previous position, output a * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ cc = *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart-uint32(1)))) v18 = s + 5792 v17 = *(*TuInt)(unsafe.Pointer(v18)) *(*TuInt)(unsafe.Pointer(v18))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v17))) = uint8(0) v20 = s + 5792 v19 = *(*TuInt)(unsafe.Pointer(v20)) *(*TuInt)(unsafe.Pointer(v20))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v19))) = uint8(0) v22 = s + 5792 v21 = *(*TuInt)(unsafe.Pointer(v22)) *(*TuInt)(unsafe.Pointer(v22))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v21))) = cc *(*Tush)(unsafe.Pointer(s + 148 + uintptr(cc)*4))++ bflush = libc.BoolInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next == (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_end) if bflush != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v23 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v23 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v23, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), 0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) } (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart++ (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead-- if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(need_more) } } else { /* There is no previous match to compare with, wait for * the next step to decide. */ (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_available = int32(1) (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart++ (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead-- } } goto _1 _1: } if (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_available != 0 { cc1 = *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart-uint32(1)))) v25 = s + 5792 v24 = *(*TuInt)(unsafe.Pointer(v25)) *(*TuInt)(unsafe.Pointer(v25))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v24))) = uint8(0) v27 = s + 5792 v26 = *(*TuInt)(unsafe.Pointer(v27)) *(*TuInt)(unsafe.Pointer(v27))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v26))) = uint8(0) v29 = s + 5792 v28 = *(*TuInt)(unsafe.Pointer(v29)) *(*TuInt)(unsafe.Pointer(v29))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v28))) = cc1 *(*Tush)(unsafe.Pointer(s + 148 + uintptr(cc1)*4))++ bflush = libc.BoolInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next == (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_end) (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_available = 0 } if (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart < libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH)-libc.Int32FromInt32(1)) { v30 = (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart } else { v30 = libc.Uint32FromInt32(libc.Int32FromInt32(MIN_MATCH) - libc.Int32FromInt32(1)) } (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = v30 if flush == int32(Z_FINISH) { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v31 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v31 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v31, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), int32(1)) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(finish_started) } return int32(finish_done) } if (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v32 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v32 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v32, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), 0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(need_more) } } return int32(block_done) } // C documentation // // /* =========================================================================== // * For Z_RLE, simply look for runs of bytes, generate matches only of distance // * one. Do not maintain a hash table. (It will be regenerated if this run of // * deflate switches away from Z_RLE.) // */ func _deflate_rle(tls *libc.TLS, s uintptr, flush int32) (r Tblock_state) { var bflush, v29 int32 var cc, len1 Tuch var dist Tush var prev, v23, v25, v27, v30, v32, v34 TuInt var scan, strend, v10, v12, v14, v16, v18, v2, v20, v24, v26, v28, v3, v31, v33, v35, v36, v37, v38, v5, v7, v8 uintptr var v11, v13, v15, v17, v19, v21, v4, v6, v9 bool _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bflush, cc, dist, len1, prev, scan, strend, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v4, v5, v6, v7, v8, v9 /* scan goes up to strend for length of run */ for { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the longest run, plus one for the unrolled loop. */ if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead <= uint32(MAX_MATCH) { _fill_window(tls, s) if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead <= uint32(MAX_MATCH) && flush == Z_NO_FLUSH { return int32(need_more) } if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead == uint32(0) { break } /* flush the current block */ } /* See how many times the previous byte repeats */ (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = uint32(0) if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead >= uint32(MIN_MATCH) && (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart > uint32(0) { scan = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) - uintptr(1) prev = uint32(*(*TBytef)(unsafe.Pointer(scan))) scan++ v2 = scan if v4 = prev == uint32(*(*TBytef)(unsafe.Pointer(v2))); v4 { scan++ v3 = scan } if v6 = v4 && prev == uint32(*(*TBytef)(unsafe.Pointer(v3))); v6 { scan++ v5 = scan } if v6 && prev == uint32(*(*TBytef)(unsafe.Pointer(v5))) { strend = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) + uintptr(MAX_MATCH) for { goto _22 _22: ; scan++ v7 = scan if v9 = prev == uint32(*(*TBytef)(unsafe.Pointer(v7))); v9 { scan++ v8 = scan } if v11 = v9 && prev == uint32(*(*TBytef)(unsafe.Pointer(v8))); v11 { scan++ v10 = scan } if v13 = v11 && prev == uint32(*(*TBytef)(unsafe.Pointer(v10))); v13 { scan++ v12 = scan } if v15 = v13 && prev == uint32(*(*TBytef)(unsafe.Pointer(v12))); v15 { scan++ v14 = scan } if v17 = v15 && prev == uint32(*(*TBytef)(unsafe.Pointer(v14))); v17 { scan++ v16 = scan } if v19 = v17 && prev == uint32(*(*TBytef)(unsafe.Pointer(v16))); v19 { scan++ v18 = scan } if v21 = v19 && prev == uint32(*(*TBytef)(unsafe.Pointer(v18))); v21 { scan++ v20 = scan } if !(v21 && prev == uint32(*(*TBytef)(unsafe.Pointer(v20))) && scan < strend) { break } } (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = uint32(MAX_MATCH) - libc.Uint32FromInt32(int32(strend)-int32(scan)) if (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length > (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead { (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead } } } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length >= uint32(MIN_MATCH) { len1 = uint8((*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length - libc.Uint32FromInt32(MIN_MATCH)) dist = libc.Uint16FromInt32(libc.Int32FromInt32(1)) v24 = s + 5792 v23 = *(*TuInt)(unsafe.Pointer(v24)) *(*TuInt)(unsafe.Pointer(v24))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v23))) = uint8(dist) v26 = s + 5792 v25 = *(*TuInt)(unsafe.Pointer(v26)) *(*TuInt)(unsafe.Pointer(v26))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v25))) = libc.Uint8FromInt32(libc.Int32FromUint16(dist) >> libc.Int32FromInt32(8)) v28 = s + 5792 v27 = *(*TuInt)(unsafe.Pointer(v28)) *(*TuInt)(unsafe.Pointer(v28))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v27))) = len1 dist-- *(*Tush)(unsafe.Pointer(s + 148 + uintptr(libc.Int32FromUint8(X_length_code[len1])+int32(LITERALS)+int32(1))*4))++ if libc.Int32FromUint16(dist) < int32(256) { v29 = libc.Int32FromUint8(X_dist_code[dist]) } else { v29 = libc.Int32FromUint8(X_dist_code[int32(256)+libc.Int32FromUint16(dist)>>int32(7)]) } *(*Tush)(unsafe.Pointer(s + 2440 + uintptr(v29)*4))++ bflush = libc.BoolInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next == (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_end) *(*TuInt)(unsafe.Pointer(s + 116)) -= (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length *(*TuInt)(unsafe.Pointer(s + 108)) += (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = uint32(0) } else { /* No match, output a literal byte */ cc = *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart))) v31 = s + 5792 v30 = *(*TuInt)(unsafe.Pointer(v31)) *(*TuInt)(unsafe.Pointer(v31))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v30))) = uint8(0) v33 = s + 5792 v32 = *(*TuInt)(unsafe.Pointer(v33)) *(*TuInt)(unsafe.Pointer(v33))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v32))) = uint8(0) v35 = s + 5792 v34 = *(*TuInt)(unsafe.Pointer(v35)) *(*TuInt)(unsafe.Pointer(v35))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v34))) = cc *(*Tush)(unsafe.Pointer(s + 148 + uintptr(cc)*4))++ bflush = libc.BoolInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next == (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_end) (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead-- (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart++ } if bflush != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v36 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v36 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v36, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), 0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(need_more) } } goto _1 _1: } (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = uint32(0) if flush == int32(Z_FINISH) { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v37 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v37 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v37, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), int32(1)) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(finish_started) } return int32(finish_done) } if (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v38 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v38 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v38, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), 0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(need_more) } } return int32(block_done) } // C documentation // // /* =========================================================================== // * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. // * (It will be regenerated if this run of deflate switches away from Huffman.) // */ func _deflate_huff(tls *libc.TLS, s uintptr, flush int32) (r Tblock_state) { var bflush int32 var cc Tuch var v10, v3, v5, v7, v8, v9 uintptr var v2, v4, v6 TuInt _, _, _, _, _, _, _, _, _, _, _ = bflush, cc, v10, v2, v3, v4, v5, v6, v7, v8, v9 /* set if current block must be flushed */ for { /* Make sure that we have a literal to write. */ if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead == uint32(0) { _fill_window(tls, s) if (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead == uint32(0) { if flush == Z_NO_FLUSH { return int32(need_more) } break /* flush the current block */ } } /* Output a literal byte */ (*Tdeflate_state)(unsafe.Pointer(s)).Fmatch_length = uint32(0) cc = *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart))) v3 = s + 5792 v2 = *(*TuInt)(unsafe.Pointer(v3)) *(*TuInt)(unsafe.Pointer(v3))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v2))) = uint8(0) v5 = s + 5792 v4 = *(*TuInt)(unsafe.Pointer(v5)) *(*TuInt)(unsafe.Pointer(v5))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v4))) = uint8(0) v7 = s + 5792 v6 = *(*TuInt)(unsafe.Pointer(v7)) *(*TuInt)(unsafe.Pointer(v7))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v6))) = cc *(*Tush)(unsafe.Pointer(s + 148 + uintptr(cc)*4))++ bflush = libc.BoolInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next == (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_end) (*Tdeflate_state)(unsafe.Pointer(s)).Flookahead-- (*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart++ if bflush != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v8 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v8 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v8, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), 0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(need_more) } } goto _1 _1: } (*Tdeflate_state)(unsafe.Pointer(s)).Finsert = uint32(0) if flush == int32(Z_FINISH) { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v9 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v9 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v9, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), int32(1)) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(finish_started) } return int32(finish_done) } if (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next != 0 { if (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start >= 0 { v10 = (*Tdeflate_state)(unsafe.Pointer(s)).Fwindow + uintptr(libc.Uint32FromInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start)) } else { v10 = libc.UintptrFromInt32(Z_NULL) } X_tr_flush_block(tls, s, v10, libc.Uint32FromInt32(libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart)-(*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start), 0) (*Tdeflate_state)(unsafe.Pointer(s)).Fblock_start = libc.Int32FromUint32((*Tdeflate_state)(unsafe.Pointer(s)).Fstrstart) _flush_pending(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fstrm) if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Favail_out == uint32(0) { return int32(need_more) } } return int32(block_done) } const COPY = 1 const GZBUFSIZE = 8192 const GZIP = 2 const GZ_APPEND = 1 const GZ_NONE = 0 const GZ_READ = 7247 const GZ_WRITE = 31153 const LOOK = 0 type Tgz_state = struct { F__ccgo_align [0]uint32 Fx TgzFile_s Fmode int32 Ffd int32 Fpath uintptr Fsize uint32 Fwant uint32 Fin uintptr Fout uintptr Fdirect int32 Fhow int32 F__ccgo_align10 [4]byte Fstart Toff_t Feof int32 Fpast int32 Flevel int32 Fstrategy int32 Freset int32 F__ccgo_align16 [4]byte Fskip Toff_t Fseek int32 Ferr int32 Fmsg uintptr Fstrm Tz_stream F__ccgo_pad21 [4]byte } type Tgz_statep = uintptr // C documentation // // /* gzclose() is in a separate file so that it is linked in only if it is used. // That way the other gzclose functions can be used instead to avoid linking in // unneeded compression or decompression routines. */ func Xgzclose(tls *libc.TLS, file TgzFile) (r int32) { var state Tgz_statep var v1 int32 _, _ = state, v1 if file == libc.UintptrFromInt32(0) { return -int32(2) } state = file if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) { v1 = Xgzclose_r(tls, file) } else { v1 = Xgzclose_w(tls, file) } return v1 } const INT_MAX7 = 2147483647 const LSEEK = "lseek" const O_APPEND1 = 1024 const O_CLOEXEC1 = 524288 const O_CREAT3 = 64 const O_EXCL1 = 128 const O_LARGEFILE1 = 131072 const O_RDONLY13 = 0 const O_TRUNC3 = 512 const O_WRONLY3 = 1 // C documentation // // /* Reset gzip file state */ func _gz_reset(tls *libc.TLS, state Tgz_statep) { (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave = uint32(0) /* no output data available */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) { /* for reading ... */ (*Tgz_state)(unsafe.Pointer(state)).Feof = 0 /* not at end of file */ (*Tgz_state)(unsafe.Pointer(state)).Fpast = 0 /* have not read past end yet */ (*Tgz_state)(unsafe.Pointer(state)).Fhow = LOOK /* look for gzip header */ } else { /* for writing ... */ (*Tgz_state)(unsafe.Pointer(state)).Freset = 0 } /* no deflateReset pending */ (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 /* no seek request pending */ Xgz_error(tls, state, Z_OK, libc.UintptrFromInt32(0)) /* clear error */ (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos = 0 /* no uncompressed data yet */ (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_in = uint32(0) /* no input data yet */ } // C documentation // // /* Open a gzip file either by name or file descriptor. */ func _gz_open(tls *libc.TLS, path uintptr, fd int32, mode uintptr) (r TgzFile) { bp := tls.Alloc(16) defer tls.Free(16) var cloexec, exclusive, oflag, v1, v2, v3, v4, v5 int32 var len1 Tz_size_t var state Tgz_statep _, _, _, _, _, _, _, _, _, _ = cloexec, exclusive, len1, oflag, state, v1, v2, v3, v4, v5 cloexec = 0 exclusive = 0 /* check input */ if path == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } /* allocate gzFile structure to return */ state = libc.Xmalloc(tls, uint32(168)) if state == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } (*Tgz_state)(unsafe.Pointer(state)).Fsize = uint32(0) /* no buffers allocated yet */ (*Tgz_state)(unsafe.Pointer(state)).Fwant = uint32(GZBUFSIZE) /* requested buffer size */ (*Tgz_state)(unsafe.Pointer(state)).Fmsg = libc.UintptrFromInt32(0) /* no error message yet */ /* interpret mode */ (*Tgz_state)(unsafe.Pointer(state)).Fmode = GZ_NONE (*Tgz_state)(unsafe.Pointer(state)).Flevel = -int32(1) (*Tgz_state)(unsafe.Pointer(state)).Fstrategy = Z_DEFAULT_STRATEGY (*Tgz_state)(unsafe.Pointer(state)).Fdirect = 0 for *(*uint8)(unsafe.Pointer(mode)) != 0 { if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(mode))) >= int32('0') && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(mode))) <= int32('9') { (*Tgz_state)(unsafe.Pointer(state)).Flevel = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(mode))) - int32('0') } else { switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(mode))) { case int32('r'): (*Tgz_state)(unsafe.Pointer(state)).Fmode = int32(GZ_READ) case int32('w'): (*Tgz_state)(unsafe.Pointer(state)).Fmode = int32(GZ_WRITE) case int32('a'): (*Tgz_state)(unsafe.Pointer(state)).Fmode = int32(GZ_APPEND) case int32('+'): /* can't read and write at the same time */ libc.Xfree(tls, state) return libc.UintptrFromInt32(0) case int32('b'): /* ignore -- will request binary anyway */ case int32('e'): cloexec = int32(1) case int32('x'): exclusive = int32(1) case int32('f'): (*Tgz_state)(unsafe.Pointer(state)).Fstrategy = int32(Z_FILTERED) case int32('h'): (*Tgz_state)(unsafe.Pointer(state)).Fstrategy = int32(Z_HUFFMAN_ONLY) case int32('R'): (*Tgz_state)(unsafe.Pointer(state)).Fstrategy = int32(Z_RLE) case int32('F'): (*Tgz_state)(unsafe.Pointer(state)).Fstrategy = int32(Z_FIXED) case int32('T'): (*Tgz_state)(unsafe.Pointer(state)).Fdirect = int32(1) default: /* could consider as an error, but just ignore */ } } mode++ } /* must provide an "r", "w", or "a" */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode == GZ_NONE { libc.Xfree(tls, state) return libc.UintptrFromInt32(0) } /* can't force transparent read */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) { if (*Tgz_state)(unsafe.Pointer(state)).Fdirect != 0 { libc.Xfree(tls, state) return libc.UintptrFromInt32(0) } (*Tgz_state)(unsafe.Pointer(state)).Fdirect = int32(1) /* for empty file */ } /* save the path name for error messages */ len1 = libc.Xstrlen(tls, path) (*Tgz_state)(unsafe.Pointer(state)).Fpath = libc.Xmalloc(tls, len1+uint32(1)) if (*Tgz_state)(unsafe.Pointer(state)).Fpath == libc.UintptrFromInt32(0) { libc.Xfree(tls, state) return libc.UintptrFromInt32(0) } libc.X__builtin_snprintf(tls, (*Tgz_state)(unsafe.Pointer(state)).Fpath, len1+uint32(1), __ccgo_ts+39133, libc.VaList(bp+8, path)) /* compute the flags for open() */ if cloexec != 0 { v1 = int32(O_CLOEXEC1) } else { v1 = 0 } if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) { v2 = O_RDONLY13 } else { if exclusive != 0 { v3 = int32(O_EXCL1) } else { v3 = 0 } if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_WRITE) { v4 = int32(O_TRUNC3) } else { v4 = int32(O_APPEND1) } v2 = libc.Int32FromInt32(O_WRONLY3) | libc.Int32FromInt32(O_CREAT3) | v3 | v4 } oflag = int32(O_LARGEFILE1) | v1 | v2 /* open the file with the appropriate flags (or just use fd) */ if fd > -int32(1) { v5 = fd } else { v5 = libc.Xopen(tls, path, oflag, libc.VaList(bp+8, int32(0666))) } (*Tgz_state)(unsafe.Pointer(state)).Ffd = v5 if (*Tgz_state)(unsafe.Pointer(state)).Ffd == -int32(1) { libc.Xfree(tls, (*Tgz_state)(unsafe.Pointer(state)).Fpath) libc.Xfree(tls, state) return libc.UintptrFromInt32(0) } if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_APPEND) { libc.Xlseek(tls, (*Tgz_state)(unsafe.Pointer(state)).Ffd, 0, int32(2)) /* so gzoffset() is correct */ (*Tgz_state)(unsafe.Pointer(state)).Fmode = int32(GZ_WRITE) /* simplify later checks */ } /* save the current position for rewinding (only if reading) */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) { (*Tgz_state)(unsafe.Pointer(state)).Fstart = libc.Xlseek(tls, (*Tgz_state)(unsafe.Pointer(state)).Ffd, 0, int32(1)) if (*Tgz_state)(unsafe.Pointer(state)).Fstart == int64(-int32(1)) { (*Tgz_state)(unsafe.Pointer(state)).Fstart = 0 } } /* initialize stream */ _gz_reset(tls, state) /* return stream */ return state } // C documentation // // /* -- see zlib.h -- */ func Xgzopen(tls *libc.TLS, path uintptr, mode uintptr) (r TgzFile) { return _gz_open(tls, path, -int32(1), mode) } // C documentation // // /* -- see zlib.h -- */ func Xgzopen64(tls *libc.TLS, path uintptr, mode uintptr) (r TgzFile) { return _gz_open(tls, path, -int32(1), mode) } // C documentation // // /* -- see zlib.h -- */ func Xgzdopen(tls *libc.TLS, fd int32, mode uintptr) (r TgzFile) { bp := tls.Alloc(16) defer tls.Free(16) var gz TgzFile var path, v1 uintptr var v2 bool _, _, _, _ = gz, path, v1, v2 if v2 = fd == -int32(1); !v2 { v1 = libc.Xmalloc(tls, libc.Uint32FromInt32(7)+libc.Uint32FromInt32(3)*libc.Uint32FromInt64(4)) path = v1 } if v2 || v1 == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } libc.X__builtin_snprintf(tls, path, libc.Uint32FromInt32(7)+libc.Uint32FromInt32(3)*libc.Uint32FromInt64(4), __ccgo_ts+57402, libc.VaList(bp+8, fd)) gz = _gz_open(tls, path, fd, mode) libc.Xfree(tls, path) return gz } /* -- see zlib.h -- */ // C documentation // // /* -- see zlib.h -- */ func Xgzbuffer(tls *libc.TLS, file TgzFile, size uint32) (r int32) { var state Tgz_statep _ = state /* get internal structure and check integrity */ if file == libc.UintptrFromInt32(0) { return -int32(1) } state = file if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) && (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) { return -int32(1) } /* make sure we haven't already allocated memory */ if (*Tgz_state)(unsafe.Pointer(state)).Fsize != uint32(0) { return -int32(1) } /* check and set requested size */ if size<= 0 { ret = libc.Xlseek(tls, (*Tgz_state)(unsafe.Pointer(state)).Ffd, offset-libc.Int64FromUint32((*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave), int32(1)) if ret == int64(-int32(1)) { return int64(-int32(1)) } (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave = uint32(0) (*Tgz_state)(unsafe.Pointer(state)).Feof = 0 (*Tgz_state)(unsafe.Pointer(state)).Fpast = 0 (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 Xgz_error(tls, state, Z_OK, libc.UintptrFromInt32(0)) (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_in = uint32(0) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos += offset return (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos } /* calculate skip amount, rewinding if needed for back seek when reading */ if offset < 0 { if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) { /* writing -- can't go backwards */ return int64(-int32(1)) } offset += (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos if offset < 0 { /* before start of file! */ return int64(-int32(1)) } if Xgzrewind(tls, file) == -int32(1) { /* rewind, then skip to offset */ return int64(-int32(1)) } } /* if reading, skip what's in output buffer (one less gzgetc() check) */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) { if libc.Bool(libc.Bool(uint32(4) == uint32(8)) && (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave > Xgz_intmax(tls)) || libc.Int64FromUint32((*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave) > offset { v1 = libc.Uint32FromInt64(offset) } else { v1 = (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave } n = v1 (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave -= n (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext += uintptr(n) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos += libc.Int64FromUint32(n) offset -= libc.Int64FromUint32(n) } /* request skip (if not zero) */ if offset != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fseek = int32(1) (*Tgz_state)(unsafe.Pointer(state)).Fskip = offset } return (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos + offset } // C documentation // // /* -- see zlib.h -- */ func Xgzseek(tls *libc.TLS, file TgzFile, offset Toff_t, whence int32) (r Toff_t) { var ret Toff_t var v1 int64 _, _ = ret, v1 ret = Xgzseek64(tls, file, offset, whence) if ret == ret { v1 = ret } else { v1 = int64(-int32(1)) } return v1 } // C documentation // // /* -- see zlib.h -- */ func Xgztell64(tls *libc.TLS, file TgzFile) (r Toff_t) { var state Tgz_statep var v1 int64 _, _ = state, v1 /* get internal structure and check integrity */ if file == libc.UintptrFromInt32(0) { return int64(-int32(1)) } state = file if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) && (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) { return int64(-int32(1)) } /* return position */ if (*Tgz_state)(unsafe.Pointer(state)).Fseek != 0 { v1 = (*Tgz_state)(unsafe.Pointer(state)).Fskip } else { v1 = 0 } return (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos + v1 } // C documentation // // /* -- see zlib.h -- */ func Xgztell(tls *libc.TLS, file TgzFile) (r Toff_t) { var ret Toff_t var v1 int64 _, _ = ret, v1 ret = Xgztell64(tls, file) if ret == ret { v1 = ret } else { v1 = int64(-int32(1)) } return v1 } // C documentation // // /* -- see zlib.h -- */ func Xgzoffset64(tls *libc.TLS, file TgzFile) (r Toff_t) { var offset Toff_t var state Tgz_statep _, _ = offset, state /* get internal structure and check integrity */ if file == libc.UintptrFromInt32(0) { return int64(-int32(1)) } state = file if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) && (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) { return int64(-int32(1)) } /* compute and return effective offset in file */ offset = libc.Xlseek(tls, (*Tgz_state)(unsafe.Pointer(state)).Ffd, 0, int32(1)) if offset == int64(-int32(1)) { return int64(-int32(1)) } if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) { /* reading */ offset -= libc.Int64FromUint32((*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_in) } /* don't count buffered input */ return offset } // C documentation // // /* -- see zlib.h -- */ func Xgzoffset(tls *libc.TLS, file TgzFile) (r Toff_t) { var ret Toff_t var v1 int64 _, _ = ret, v1 ret = Xgzoffset64(tls, file) if ret == ret { v1 = ret } else { v1 = int64(-int32(1)) } return v1 } // C documentation // // /* -- see zlib.h -- */ func Xgzeof(tls *libc.TLS, file TgzFile) (r int32) { var state Tgz_statep var v1 int32 _, _ = state, v1 /* get internal structure and check integrity */ if file == libc.UintptrFromInt32(0) { return 0 } state = file if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) && (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) { return 0 } /* return end-of-file state */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) { v1 = (*Tgz_state)(unsafe.Pointer(state)).Fpast } else { v1 = 0 } return v1 } // C documentation // // /* -- see zlib.h -- */ func Xgzerror(tls *libc.TLS, file TgzFile, errnum uintptr) (r uintptr) { var state Tgz_statep var v1, v2 uintptr _, _, _ = state, v1, v2 /* get internal structure and check integrity */ if file == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } state = file if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) && (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) { return libc.UintptrFromInt32(0) } /* return error information */ if errnum != libc.UintptrFromInt32(0) { *(*int32)(unsafe.Pointer(errnum)) = (*Tgz_state)(unsafe.Pointer(state)).Ferr } if (*Tgz_state)(unsafe.Pointer(state)).Ferr == -int32(4) { v1 = __ccgo_ts + 16183 } else { if (*Tgz_state)(unsafe.Pointer(state)).Fmsg == libc.UintptrFromInt32(0) { v2 = __ccgo_ts + 9405 } else { v2 = (*Tgz_state)(unsafe.Pointer(state)).Fmsg } v1 = v2 } return v1 } // C documentation // // /* -- see zlib.h -- */ func Xgzclearerr(tls *libc.TLS, file TgzFile) { var state Tgz_statep _ = state /* get internal structure and check integrity */ if file == libc.UintptrFromInt32(0) { return } state = file if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) && (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) { return } /* clear error and end-of-file */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) { (*Tgz_state)(unsafe.Pointer(state)).Feof = 0 (*Tgz_state)(unsafe.Pointer(state)).Fpast = 0 } Xgz_error(tls, state, Z_OK, libc.UintptrFromInt32(0)) } // C documentation // // /* Create an error message in allocated memory and set state->err and // state->msg accordingly. Free any previous error message already there. Do // not try to free or allocate space if the error is Z_MEM_ERROR (out of // memory). Simply save the error message as a static string. If there is an // allocation failure constructing the error message, then convert the error to // out of memory. */ func Xgz_error(tls *libc.TLS, state Tgz_statep, err int32, msg uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var v1 uintptr _ = v1 /* free previously allocated message and clear */ if (*Tgz_state)(unsafe.Pointer(state)).Fmsg != libc.UintptrFromInt32(0) { if (*Tgz_state)(unsafe.Pointer(state)).Ferr != -int32(4) { libc.Xfree(tls, (*Tgz_state)(unsafe.Pointer(state)).Fmsg) } (*Tgz_state)(unsafe.Pointer(state)).Fmsg = libc.UintptrFromInt32(0) } /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */ if err != Z_OK && err != -int32(5) { (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave = uint32(0) } /* set error code, and if no message, then done */ (*Tgz_state)(unsafe.Pointer(state)).Ferr = err if msg == libc.UintptrFromInt32(0) { return } /* for an out of memory error, return literal string when requested */ if err == -int32(4) { return } /* construct error message with path */ v1 = libc.Xmalloc(tls, libc.Xstrlen(tls, (*Tgz_state)(unsafe.Pointer(state)).Fpath)+libc.Xstrlen(tls, msg)+uint32(3)) (*Tgz_state)(unsafe.Pointer(state)).Fmsg = v1 if v1 == libc.UintptrFromInt32(0) { (*Tgz_state)(unsafe.Pointer(state)).Ferr = -int32(4) return } libc.X__builtin_snprintf(tls, (*Tgz_state)(unsafe.Pointer(state)).Fmsg, libc.Xstrlen(tls, (*Tgz_state)(unsafe.Pointer(state)).Fpath)+libc.Xstrlen(tls, msg)+uint32(3), __ccgo_ts+57410, libc.VaList(bp+8, (*Tgz_state)(unsafe.Pointer(state)).Fpath, __ccgo_ts+48511, msg)) } // C documentation // // /* portably return maximum value for an int (when limits.h presumed not // available) -- we need to do this to cover cases where 2's complement not // used, since C standard permits 1's complement and sign-bit representations, // otherwise we could just use ((unsigned)-1) >> 1 */ func Xgz_intmax(tls *libc.TLS) (r uint32) { return uint32(INT_MAX7) } const INT_MAX8 = 0x7fffffff const O_APPEND2 = 02000 const O_CLOEXEC2 = 02000000 const O_CREAT4 = 0100 const O_EXCL2 = 0200 const O_LARGEFILE2 = 0400000 const O_RDONLY14 = 00 const O_TRUNC4 = 01000 const O_WRONLY4 = 01 // C documentation // // /* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from // state->fd, and update state->eof, state->err, and state->msg as appropriate. // This function needs to loop on read(), since read() is not guaranteed to // read the number of bytes requested, depending on the type of descriptor. */ func _gz_load(tls *libc.TLS, state Tgz_statep, buf uintptr, len1 uint32, have uintptr) (r int32) { var get, max uint32 var ret int32 _, _, _ = get, max, ret max = libc.Uint32FromInt32(-libc.Int32FromInt32(1))>>libc.Int32FromInt32(2) + libc.Uint32FromInt32(1) *(*uint32)(unsafe.Pointer(have)) = uint32(0) for cond := true; cond; cond = *(*uint32)(unsafe.Pointer(have)) < len1 { get = len1 - *(*uint32)(unsafe.Pointer(have)) if get > max { get = max } ret = libc.Xread(tls, (*Tgz_state)(unsafe.Pointer(state)).Ffd, buf+uintptr(*(*uint32)(unsafe.Pointer(have))), get) if ret <= 0 { break } *(*uint32)(unsafe.Pointer(have)) += libc.Uint32FromInt32(ret) } if ret < 0 { Xgz_error(tls, state, -int32(1), libc.Xstrerror(tls, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))))) return -int32(1) } if ret == 0 { (*Tgz_state)(unsafe.Pointer(state)).Feof = int32(1) } return 0 } // C documentation // // /* Load up input buffer and set eof flag if last data loaded -- return -1 on // error, 0 otherwise. Note that the eof flag is set when the end of the input // file is reached, even though there may be unused data in the buffer. Once // that data has been used, no more attempts will be made to read the file. // If strm->avail_in != 0, then the current data is moved to the beginning of // the input buffer, and then the remainder of the buffer is loaded with the // available data from the input file. */ func _gz_avail(tls *libc.TLS, state Tgz_statep) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var n, v1 uint32 var p, q, v3, v4 uintptr var strm Tz_streamp var _ /* got at bp+0 */ uint32 _, _, _, _, _, _, _ = n, p, q, strm, v1, v3, v4 strm = state + 108 if (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK && (*Tgz_state)(unsafe.Pointer(state)).Ferr != -int32(5) { return -int32(1) } if (*Tgz_state)(unsafe.Pointer(state)).Feof == 0 { if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in != 0 { /* copy what's there to the start */ p = (*Tgz_state)(unsafe.Pointer(state)).Fin q = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in n = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in for { v3 = p p++ v4 = q q++ *(*uint8)(unsafe.Pointer(v3)) = *(*uint8)(unsafe.Pointer(v4)) goto _2 _2: ; n-- v1 = n if !(v1 != 0) { break } } } if _gz_load(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fin+uintptr((*Tz_stream)(unsafe.Pointer(strm)).Favail_in), (*Tgz_state)(unsafe.Pointer(state)).Fsize-(*Tz_stream)(unsafe.Pointer(strm)).Favail_in, bp) == -int32(1) { return -int32(1) } *(*TuInt)(unsafe.Pointer(strm + 4)) += *(*uint32)(unsafe.Pointer(bp)) (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in = (*Tgz_state)(unsafe.Pointer(state)).Fin } return 0 } // C documentation // // /* Look for gzip header, set up for inflate or copy. state->x.have must be 0. // If this is the first time in, allocate required memory. state->how will be // left unchanged if there is no more input data available, will be set to COPY // if there is no gzip header and direct copying will be performed, or it will // be set to GZIP for decompression. If direct copying, then leftover input // data from the input buffer will be copied to the output buffer. In that // case, all further file reads will be directly to either the output buffer or // a user buffer. If decompressing, the inflate state will be initialized. // gz_look() will return 0 on success or -1 on failure. */ func _gz_look(tls *libc.TLS, state Tgz_statep) (r int32) { var strm Tz_streamp _ = strm strm = state + 108 /* allocate read buffers and inflate memory */ if (*Tgz_state)(unsafe.Pointer(state)).Fsize == uint32(0) { /* allocate buffers */ (*Tgz_state)(unsafe.Pointer(state)).Fin = libc.Xmalloc(tls, (*Tgz_state)(unsafe.Pointer(state)).Fwant) (*Tgz_state)(unsafe.Pointer(state)).Fout = libc.Xmalloc(tls, (*Tgz_state)(unsafe.Pointer(state)).Fwant< uint32(1) && libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fnext_in))) == int32(31) && libc.Int32FromUint8(*(*TBytef)(unsafe.Pointer((*Tz_stream)(unsafe.Pointer(strm)).Fnext_in + 1))) == int32(139) { XinflateReset(tls, strm) (*Tgz_state)(unsafe.Pointer(state)).Fhow = int32(GZIP) (*Tgz_state)(unsafe.Pointer(state)).Fdirect = 0 return 0 } /* no gzip header -- if we were decoding gzip before, then this is trailing garbage. Ignore the trailing garbage and finish. */ if (*Tgz_state)(unsafe.Pointer(state)).Fdirect == 0 { (*Tz_stream)(unsafe.Pointer(strm)).Favail_in = uint32(0) (*Tgz_state)(unsafe.Pointer(state)).Feof = int32(1) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave = uint32(0) return 0 } /* doing raw i/o, copy any leftover input to output -- this assumes that the output buffer is larger than the input buffer, which also assures space for gzungetc() */ (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext = (*Tgz_state)(unsafe.Pointer(state)).Fout libc.Xmemcpy(tls, (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext, (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in, (*Tz_stream)(unsafe.Pointer(strm)).Favail_in) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in (*Tz_stream)(unsafe.Pointer(strm)).Favail_in = uint32(0) (*Tgz_state)(unsafe.Pointer(state)).Fhow = int32(COPY) (*Tgz_state)(unsafe.Pointer(state)).Fdirect = int32(1) return 0 } // C documentation // // /* Decompress from input to the provided next_out and avail_out in the state. // On return, state->x.have and state->x.next point to the just decompressed // data. If the gzip stream completes, state->how is reset to LOOK to look for // the next gzip stream or raw data, once state->x.have is depleted. Returns 0 // on success, -1 on failure. */ func _gz_decomp(tls *libc.TLS, state Tgz_statep) (r int32) { var had uint32 var ret int32 var strm Tz_streamp var v1 uintptr _, _, _, _ = had, ret, strm, v1 ret = Z_OK strm = state + 108 /* fill output buffer up to end of deflate stream */ had = (*Tz_stream)(unsafe.Pointer(strm)).Favail_out for cond := true; cond; cond = (*Tz_stream)(unsafe.Pointer(strm)).Favail_out != 0 && ret != int32(Z_STREAM_END) { /* get more input for inflate() */ if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in == uint32(0) && _gz_avail(tls, state) == -int32(1) { return -int32(1) } if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in == uint32(0) { Xgz_error(tls, state, -int32(5), __ccgo_ts+57417) break } /* decompress and handle errors */ ret = Xinflate(tls, strm, Z_NO_FLUSH) if ret == -int32(2) || ret == int32(Z_NEED_DICT) { Xgz_error(tls, state, -int32(2), __ccgo_ts+57440) return -int32(1) } if ret == -int32(4) { Xgz_error(tls, state, -int32(4), __ccgo_ts+16183) return -int32(1) } if ret == -int32(3) { /* deflate stream invalid */ if (*Tz_stream)(unsafe.Pointer(strm)).Fmsg == libc.UintptrFromInt32(0) { v1 = __ccgo_ts + 57479 } else { v1 = (*Tz_stream)(unsafe.Pointer(strm)).Fmsg } Xgz_error(tls, state, -int32(3), v1) return -int32(1) } } /* update available output */ (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave = had - (*Tz_stream)(unsafe.Pointer(strm)).Favail_out (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out - uintptr((*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave) /* if the gzip stream completed successfully, look for another */ if ret == int32(Z_STREAM_END) { (*Tgz_state)(unsafe.Pointer(state)).Fhow = LOOK } /* good decompression */ return 0 } // C documentation // // /* Fetch data and put it in the output buffer. Assumes state->x.have is 0. // Data is either copied from the input file or decompressed from the input // file depending on state->how. If state->how is LOOK, then a gzip header is // looked for to determine whether to copy or decompress. Returns -1 on error, // otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the // end of the input file has been reached and all data has been processed. */ func _gz_fetch(tls *libc.TLS, state Tgz_statep) (r int32) { var strm Tz_streamp _ = strm strm = state + 108 for cond := true; cond; cond = (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave == uint32(0) && (!((*Tgz_state)(unsafe.Pointer(state)).Feof != 0) || (*Tz_stream)(unsafe.Pointer(strm)).Favail_in != 0) { switch (*Tgz_state)(unsafe.Pointer(state)).Fhow { case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */ if _gz_look(tls, state) == -int32(1) { return -int32(1) } if (*Tgz_state)(unsafe.Pointer(state)).Fhow == LOOK { return 0 } case int32(COPY): /* -> COPY */ if _gz_load(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fout, (*Tgz_state)(unsafe.Pointer(state)).Fsize< GZIP or LOOK (if end of gzip stream) */ (*Tz_stream)(unsafe.Pointer(strm)).Favail_out = (*Tgz_state)(unsafe.Pointer(state)).Fsize << int32(1) (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out = (*Tgz_state)(unsafe.Pointer(state)).Fout if _gz_decomp(tls, state) == -int32(1) { return -int32(1) } } } return 0 } // C documentation // // /* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ func _gz_skip(tls *libc.TLS, state Tgz_statep, len1 Toff_t) (r int32) { var n, v1 uint32 _, _ = n, v1 /* skip over len bytes or reach end-of-file, whichever comes first */ for len1 != 0 { /* skip over whatever is in output buffer */ if (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave != 0 { if libc.Bool(libc.Bool(uint32(4) == uint32(8)) && (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave > Xgz_intmax(tls)) || libc.Int64FromUint32((*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave) > len1 { v1 = libc.Uint32FromInt64(len1) } else { v1 = (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave } n = v1 (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave -= n (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext += uintptr(n) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos += libc.Int64FromUint32(n) len1 -= libc.Int64FromUint32(n) } else { if (*Tgz_state)(unsafe.Pointer(state)).Feof != 0 && (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_in == uint32(0) { break } else { /* get more output, looking for header if required */ if _gz_fetch(tls, state) == -int32(1) { return -int32(1) } } } } return 0 } // C documentation // // /* Read len bytes into buf from file, or less than len up to the end of the // input. Return the number of bytes read. If zero is returned, either the // end of file was reached, or there was an error. state->err must be // consulted in that case to determine which. */ func _gz_read(tls *libc.TLS, state Tgz_statep, buf Tvoidp, len1 Tz_size_t) (r Tz_size_t) { bp := tls.Alloc(16) defer tls.Free(16) var got Tz_size_t var _ /* n at bp+0 */ uint32 _ = got /* if len is zero, avoid unnecessary operations */ if len1 == uint32(0) { return uint32(0) } /* process a skip request */ if (*Tgz_state)(unsafe.Pointer(state)).Fseek != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 if _gz_skip(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fskip) == -int32(1) { return uint32(0) } } /* get len bytes to buf, or less than len if at the end */ got = uint32(0) for cond := true; cond; cond = len1 != 0 { /* set n to the maximum amount of len that fits in an unsigned int */ *(*uint32)(unsafe.Pointer(bp)) = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if *(*uint32)(unsafe.Pointer(bp)) > len1 { *(*uint32)(unsafe.Pointer(bp)) = len1 } /* first just try copying data from the output buffer */ if (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave != 0 { if (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave < *(*uint32)(unsafe.Pointer(bp)) { *(*uint32)(unsafe.Pointer(bp)) = (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave } libc.Xmemcpy(tls, buf, (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext, *(*uint32)(unsafe.Pointer(bp))) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext += uintptr(*(*uint32)(unsafe.Pointer(bp))) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave -= *(*uint32)(unsafe.Pointer(bp)) } else { if (*Tgz_state)(unsafe.Pointer(state)).Feof != 0 && (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_in == uint32(0) { (*Tgz_state)(unsafe.Pointer(state)).Fpast = int32(1) /* tried to read past end */ break } else { if (*Tgz_state)(unsafe.Pointer(state)).Fhow == LOOK || *(*uint32)(unsafe.Pointer(bp)) < (*Tgz_state)(unsafe.Pointer(state)).Fsize<how == GZIP */ (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_out = *(*uint32)(unsafe.Pointer(bp)) (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Fnext_out = buf if _gz_decomp(tls, state) == -int32(1) { return uint32(0) } *(*uint32)(unsafe.Pointer(bp)) = (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave = uint32(0) } } } } /* update progress */ len1 -= *(*uint32)(unsafe.Pointer(bp)) buf = buf + uintptr(*(*uint32)(unsafe.Pointer(bp))) got += *(*uint32)(unsafe.Pointer(bp)) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos += libc.Int64FromUint32(*(*uint32)(unsafe.Pointer(bp))) } /* return number of bytes read into user buffer */ return got } // C documentation // // /* -- see zlib.h -- */ func Xgzread(tls *libc.TLS, file TgzFile, buf Tvoidp, len1 uint32) (r int32) { var state Tgz_statep _ = state /* get internal structure */ if file == libc.UintptrFromInt32(0) { return -int32(1) } state = file /* check that we're reading and that there's no (serious) error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK && (*Tgz_state)(unsafe.Pointer(state)).Ferr != -int32(5) { return -int32(1) } /* since an int is returned, make sure len fits in one, otherwise return with an error (this avoids a flaw in the interface) */ if libc.Int32FromUint32(len1) < 0 { Xgz_error(tls, state, -int32(2), __ccgo_ts+57501) return -int32(1) } /* read len or fewer bytes to buf */ len1 = _gz_read(tls, state, buf, len1) /* check for an error */ if len1 == uint32(0) && (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK && (*Tgz_state)(unsafe.Pointer(state)).Ferr != -int32(5) { return -int32(1) } /* return the number of bytes read (this is assured to fit in an int) */ return libc.Int32FromUint32(len1) } // C documentation // // /* -- see zlib.h -- */ func Xgzfread(tls *libc.TLS, buf Tvoidp, size Tz_size_t, nitems Tz_size_t, file TgzFile) (r Tz_size_t) { var len1 Tz_size_t var state Tgz_statep var v1 uint32 _, _, _ = len1, state, v1 /* get internal structure */ if file == libc.UintptrFromInt32(0) { return uint32(0) } state = file /* check that we're reading and that there's no (serious) error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK && (*Tgz_state)(unsafe.Pointer(state)).Ferr != -int32(5) { return uint32(0) } /* compute bytes to read -- error on overflow */ len1 = nitems * size if size != 0 && len1/size != nitems { Xgz_error(tls, state, -int32(2), __ccgo_ts+57532) return uint32(0) } /* read len or fewer bytes to buf, return the number of full items read */ if len1 != 0 { v1 = _gz_read(tls, state, buf, len1) / size } else { v1 = uint32(0) } return v1 } // C documentation // // /* -- see zlib.h -- */ func Xgzgetc(tls *libc.TLS, file TgzFile) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var state Tgz_statep var v1, v2 uintptr var v3 int32 var _ /* buf at bp+0 */ [1]uint8 _, _, _, _ = state, v1, v2, v3 /* get internal structure */ if file == libc.UintptrFromInt32(0) { return -int32(1) } state = file /* check that we're reading and that there's no (serious) error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK && (*Tgz_state)(unsafe.Pointer(state)).Ferr != -int32(5) { return -int32(1) } /* try output buffer (no need to check for skip request) */ if (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave-- (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos++ v2 = state + 4 v1 = *(*uintptr)(unsafe.Pointer(v2)) *(*uintptr)(unsafe.Pointer(v2))++ return libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v1))) } /* nothing there -- try gz_read() */ if _gz_read(tls, state, bp, uint32(1)) < uint32(1) { v3 = -int32(1) } else { v3 = libc.Int32FromUint8((*(*[1]uint8)(unsafe.Pointer(bp)))[0]) } return v3 } func Xgzgetc_(tls *libc.TLS, file TgzFile) (r int32) { return Xgzgetc(tls, file) } // C documentation // // /* -- see zlib.h -- */ func Xgzungetc(tls *libc.TLS, c int32, file TgzFile) (r int32) { var dest, src, v1, v2 uintptr var state Tgz_statep _, _, _, _, _ = dest, src, state, v1, v2 /* get internal structure */ if file == libc.UintptrFromInt32(0) { return -int32(1) } state = file /* in case this was just opened, set up the input buffer */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) && (*Tgz_state)(unsafe.Pointer(state)).Fhow == LOOK && (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave == uint32(0) { _gz_look(tls, state) } /* check that we're reading and that there's no (serious) error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK && (*Tgz_state)(unsafe.Pointer(state)).Ferr != -int32(5) { return -int32(1) } /* process a skip request */ if (*Tgz_state)(unsafe.Pointer(state)).Fseek != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 if _gz_skip(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fskip) == -int32(1) { return -int32(1) } } /* can't push EOF */ if c < 0 { return -int32(1) } /* if output buffer empty, put byte at end (allows more pushing) */ if (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave == uint32(0) { (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave = uint32(1) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext = (*Tgz_state)(unsafe.Pointer(state)).Fout + uintptr((*Tgz_state)(unsafe.Pointer(state)).Fsize< (*Tgz_state)(unsafe.Pointer(state)).Fout { dest-- v1 = dest src-- v2 = src *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v2)) } (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext = dest } (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave++ (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext-- *(*uint8)(unsafe.Pointer((*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext)) = libc.Uint8FromInt32(c) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos-- (*Tgz_state)(unsafe.Pointer(state)).Fpast = 0 return c } // C documentation // // /* -- see zlib.h -- */ func Xgzgets(tls *libc.TLS, file TgzFile, buf uintptr, len1 int32) (r uintptr) { var eol, str uintptr var left, n, v1 uint32 var state Tgz_statep _, _, _, _, _, _ = eol, left, n, state, str, v1 /* check parameters and get internal structure */ if file == libc.UintptrFromInt32(0) || buf == libc.UintptrFromInt32(0) || len1 < int32(1) { return libc.UintptrFromInt32(0) } state = file /* check that we're reading and that there's no (serious) error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK && (*Tgz_state)(unsafe.Pointer(state)).Ferr != -int32(5) { return libc.UintptrFromInt32(0) } /* process a skip request */ if (*Tgz_state)(unsafe.Pointer(state)).Fseek != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 if _gz_skip(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fskip) == -int32(1) { return libc.UintptrFromInt32(0) } } /* copy output bytes up to new line or len - 1, whichever comes first -- append a terminating zero to the string (we don't check for a zero in the contents, let the user worry about that) */ str = buf left = libc.Uint32FromInt32(len1) - uint32(1) if left != 0 { for cond := true; cond; cond = left != 0 && eol == libc.UintptrFromInt32(0) { /* assure that something is in the output buffer */ if (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave == uint32(0) && _gz_fetch(tls, state) == -int32(1) { return libc.UintptrFromInt32(0) } /* error */ if (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave == uint32(0) { /* end of file */ (*Tgz_state)(unsafe.Pointer(state)).Fpast = int32(1) /* read past end */ break /* return what we have */ } /* look for end-of-line in current output buffer */ if (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave > left { v1 = left } else { v1 = (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave } n = v1 eol = libc.Xmemchr(tls, (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext, int32('\n'), n) if eol != libc.UintptrFromInt32(0) { n = libc.Uint32FromInt32(int32(eol)-int32((*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext)) + uint32(1) } /* copy through end-of-line, or remainder if not found */ libc.Xmemcpy(tls, buf, (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext, n) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave -= n (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext += uintptr(n) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos += libc.Int64FromUint32(n) left -= n buf += uintptr(n) } } /* return terminated string, or if nothing, end of file */ if buf == str { return libc.UintptrFromInt32(0) } *(*uint8)(unsafe.Pointer(buf)) = uint8(0) return str } // C documentation // // /* -- see zlib.h -- */ func Xgzdirect(tls *libc.TLS, file TgzFile) (r int32) { var state Tgz_statep _ = state /* get internal structure */ if file == libc.UintptrFromInt32(0) { return 0 } state = file /* if the state is not known, but we can find out, then do so (this is mainly for right after a gzopen() or gzdopen()) */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode == int32(GZ_READ) && (*Tgz_state)(unsafe.Pointer(state)).Fhow == LOOK && (*Tgz_state)(unsafe.Pointer(state)).Fx.Fhave == uint32(0) { _gz_look(tls, state) } /* return 1 if transparent, 0 if processing a gzip stream */ return (*Tgz_state)(unsafe.Pointer(state)).Fdirect } // C documentation // // /* -- see zlib.h -- */ func Xgzclose_r(tls *libc.TLS, file TgzFile) (r int32) { var err, ret, v1, v2 int32 var state Tgz_statep _, _, _, _, _ = err, ret, state, v1, v2 /* get internal structure */ if file == libc.UintptrFromInt32(0) { return -int32(2) } state = file /* check that we're reading */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_READ) { return -int32(2) } /* free memory and close file */ if (*Tgz_state)(unsafe.Pointer(state)).Fsize != 0 { XinflateEnd(tls, state+108) libc.Xfree(tls, (*Tgz_state)(unsafe.Pointer(state)).Fout) libc.Xfree(tls, (*Tgz_state)(unsafe.Pointer(state)).Fin) } if (*Tgz_state)(unsafe.Pointer(state)).Ferr == -int32(5) { v1 = -int32(5) } else { v1 = Z_OK } err = v1 Xgz_error(tls, state, Z_OK, libc.UintptrFromInt32(0)) libc.Xfree(tls, (*Tgz_state)(unsafe.Pointer(state)).Fpath) ret = libc.Xclose(tls, (*Tgz_state)(unsafe.Pointer(state)).Ffd) libc.Xfree(tls, state) if ret != 0 { v2 = -int32(1) } else { v2 = err } return v2 } // C documentation // // /* Initialize state for writing a gzip file. Mark initialization by setting // state->size to non-zero. Return -1 on a memory allocation failure, or 0 on // success. */ func _gz_init(tls *libc.TLS, state Tgz_statep) (r int32) { var ret int32 var strm Tz_streamp _, _ = ret, strm strm = state + 108 /* allocate input buffer (double size for gzprintf) */ (*Tgz_state)(unsafe.Pointer(state)).Fin = libc.Xmalloc(tls, (*Tgz_state)(unsafe.Pointer(state)).Fwant<direct is true, then simply write // to the output file without compressing, and ignore flush. */ func _gz_comp(tls *libc.TLS, state Tgz_statep, flush int32) (r int32) { var have, max, put, v1, v2 uint32 var ret, writ int32 var strm Tz_streamp _, _, _, _, _, _, _, _ = have, max, put, ret, strm, writ, v1, v2 max = libc.Uint32FromInt32(-libc.Int32FromInt32(1))>>libc.Int32FromInt32(2) + libc.Uint32FromInt32(1) strm = state + 108 /* allocate memory if this is the first time through */ if (*Tgz_state)(unsafe.Pointer(state)).Fsize == uint32(0) && _gz_init(tls, state) == -int32(1) { return -int32(1) } /* write directly if requested */ if (*Tgz_state)(unsafe.Pointer(state)).Fdirect != 0 { for (*Tz_stream)(unsafe.Pointer(strm)).Favail_in != 0 { if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in > max { v1 = max } else { v1 = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in } put = v1 writ = libc.Xwrite(tls, (*Tgz_state)(unsafe.Pointer(state)).Ffd, (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in, put) if writ < 0 { Xgz_error(tls, state, -int32(1), libc.Xstrerror(tls, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))))) return -int32(1) } *(*TuInt)(unsafe.Pointer(strm + 4)) -= libc.Uint32FromInt32(writ) *(*uintptr)(unsafe.Pointer(strm)) += uintptr(writ) } return 0 } /* check for a pending reset */ if (*Tgz_state)(unsafe.Pointer(state)).Freset != 0 { /* don't start a new gzip member unless there is data to write */ if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in == uint32(0) { return 0 } XdeflateReset(tls, strm) (*Tgz_state)(unsafe.Pointer(state)).Freset = 0 } /* run deflate() on provided input until it produces no more output */ ret = Z_OK for cond := true; cond; cond = have != 0 { /* write out current buffer contents if full, or if flushing, but if doing Z_FINISH then don't write until we get to Z_STREAM_END */ if (*Tz_stream)(unsafe.Pointer(strm)).Favail_out == uint32(0) || flush != Z_NO_FLUSH && (flush != int32(Z_FINISH) || ret == int32(Z_STREAM_END)) { for (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out > (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext { if int32((*Tz_stream)(unsafe.Pointer(strm)).Fnext_out)-int32((*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext) > libc.Int32FromUint32(max) { v2 = max } else { v2 = libc.Uint32FromInt32(int32((*Tz_stream)(unsafe.Pointer(strm)).Fnext_out) - int32((*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext)) } put = v2 writ = libc.Xwrite(tls, (*Tgz_state)(unsafe.Pointer(state)).Ffd, (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext, put) if writ < 0 { Xgz_error(tls, state, -int32(1), libc.Xstrerror(tls, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))))) return -int32(1) } (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext += uintptr(writ) } if (*Tz_stream)(unsafe.Pointer(strm)).Favail_out == uint32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Favail_out = (*Tgz_state)(unsafe.Pointer(state)).Fsize (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out = (*Tgz_state)(unsafe.Pointer(state)).Fout (*Tgz_state)(unsafe.Pointer(state)).Fx.Fnext = (*Tgz_state)(unsafe.Pointer(state)).Fout } } /* compress */ have = (*Tz_stream)(unsafe.Pointer(strm)).Favail_out ret = Xdeflate(tls, strm, flush) if ret == -int32(2) { Xgz_error(tls, state, -int32(2), __ccgo_ts+57596) return -int32(1) } have -= (*Tz_stream)(unsafe.Pointer(strm)).Favail_out } /* if that completed a deflate stream, allow another to start */ if flush == int32(Z_FINISH) { (*Tgz_state)(unsafe.Pointer(state)).Freset = int32(1) } /* all done, no errors */ return 0 } // C documentation // // /* Compress len zeros to output. Return -1 on a write error or memory // allocation failure by gz_comp(), or 0 on success. */ func _gz_zero(tls *libc.TLS, state Tgz_statep, len1 Toff_t) (r int32) { var first int32 var n, v1 uint32 var strm Tz_streamp _, _, _, _ = first, n, strm, v1 strm = state + 108 /* consume whatever's left in the input buffer */ if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in != 0 && _gz_comp(tls, state, Z_NO_FLUSH) == -int32(1) { return -int32(1) } /* compress len zeros (len guaranteed > 0) */ first = int32(1) for len1 != 0 { if libc.Bool(libc.Bool(uint32(4) == uint32(8)) && (*Tgz_state)(unsafe.Pointer(state)).Fsize > Xgz_intmax(tls)) || libc.Int64FromUint32((*Tgz_state)(unsafe.Pointer(state)).Fsize) > len1 { v1 = libc.Uint32FromInt64(len1) } else { v1 = (*Tgz_state)(unsafe.Pointer(state)).Fsize } n = v1 if first != 0 { libc.Xmemset(tls, (*Tgz_state)(unsafe.Pointer(state)).Fin, 0, n) first = 0 } (*Tz_stream)(unsafe.Pointer(strm)).Favail_in = n (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in = (*Tgz_state)(unsafe.Pointer(state)).Fin (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos += libc.Int64FromUint32(n) if _gz_comp(tls, state, Z_NO_FLUSH) == -int32(1) { return -int32(1) } len1 -= libc.Int64FromUint32(n) } return 0 } // C documentation // // /* Write len bytes from buf to file. Return the number of bytes written. If // the returned value is less than len, then there was an error. */ func _gz_write(tls *libc.TLS, state Tgz_statep, buf Tvoidpc, len1 Tz_size_t) (r Tz_size_t) { var copy1, have, n uint32 var put Tz_size_t _, _, _, _ = copy1, have, n, put put = len1 /* if len is zero, avoid unnecessary operations */ if len1 == uint32(0) { return uint32(0) } /* allocate memory if this is the first time through */ if (*Tgz_state)(unsafe.Pointer(state)).Fsize == uint32(0) && _gz_init(tls, state) == -int32(1) { return uint32(0) } /* check for seek request */ if (*Tgz_state)(unsafe.Pointer(state)).Fseek != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 if _gz_zero(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fskip) == -int32(1) { return uint32(0) } } /* for small len, copy to input buffer, otherwise compress directly */ if len1 < (*Tgz_state)(unsafe.Pointer(state)).Fsize { /* copy to input buffer, compress when full */ for cond := true; cond; cond = len1 != 0 { if (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_in == uint32(0) { (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Fnext_in = (*Tgz_state)(unsafe.Pointer(state)).Fin } have = libc.Uint32FromInt32(int32((*Tgz_state)(unsafe.Pointer(state)).Fstrm.Fnext_in+uintptr((*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_in)) - int32((*Tgz_state)(unsafe.Pointer(state)).Fin)) copy1 = (*Tgz_state)(unsafe.Pointer(state)).Fsize - have if copy1 > len1 { copy1 = len1 } libc.Xmemcpy(tls, (*Tgz_state)(unsafe.Pointer(state)).Fin+uintptr(have), buf, copy1) (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_in += copy1 (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos += libc.Int64FromUint32(copy1) buf = buf + uintptr(copy1) len1 -= copy1 if len1 != 0 && _gz_comp(tls, state, Z_NO_FLUSH) == -int32(1) { return uint32(0) } } } else { /* consume whatever's left in the input buffer */ if (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_in != 0 && _gz_comp(tls, state, Z_NO_FLUSH) == -int32(1) { return uint32(0) } /* directly compress user buffer to file */ (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Fnext_in = buf for cond := true; cond; cond = len1 != 0 { n = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) if n > len1 { n = len1 } (*Tgz_state)(unsafe.Pointer(state)).Fstrm.Favail_in = n (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos += libc.Int64FromUint32(n) if _gz_comp(tls, state, Z_NO_FLUSH) == -int32(1) { return uint32(0) } len1 -= n } } /* input was all buffered or compressed */ return put } // C documentation // // /* -- see zlib.h -- */ func Xgzwrite(tls *libc.TLS, file TgzFile, buf Tvoidpc, len1 uint32) (r int32) { var state Tgz_statep _ = state /* get internal structure */ if file == libc.UintptrFromInt32(0) { return 0 } state = file /* check that we're writing and that there's no error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK { return 0 } /* since an int is returned, make sure len fits in one, otherwise return with an error (this avoids a flaw in the interface) */ if libc.Int32FromUint32(len1) < 0 { Xgz_error(tls, state, -int32(3), __ccgo_ts+57635) return 0 } /* write len bytes from buf (the return value will fit in an int) */ return libc.Int32FromUint32(_gz_write(tls, state, buf, len1)) } // C documentation // // /* -- see zlib.h -- */ func Xgzfwrite(tls *libc.TLS, buf Tvoidpc, size Tz_size_t, nitems Tz_size_t, file TgzFile) (r Tz_size_t) { var len1 Tz_size_t var state Tgz_statep var v1 uint32 _, _, _ = len1, state, v1 /* get internal structure */ if file == libc.UintptrFromInt32(0) { return uint32(0) } state = file /* check that we're writing and that there's no error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK { return uint32(0) } /* compute bytes to read -- error on overflow */ len1 = nitems * size if size != 0 && len1/size != nitems { Xgz_error(tls, state, -int32(2), __ccgo_ts+57532) return uint32(0) } /* write len bytes to buf, return the number of full items written */ if len1 != 0 { v1 = _gz_write(tls, state, buf, len1) / size } else { v1 = uint32(0) } return v1 } // C documentation // // /* -- see zlib.h -- */ func Xgzputc(tls *libc.TLS, file TgzFile, c int32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var have uint32 var state Tgz_statep var strm Tz_streamp var _ /* buf at bp+0 */ [1]uint8 _, _, _ = have, state, strm /* get internal structure */ if file == libc.UintptrFromInt32(0) { return -int32(1) } state = file strm = state + 108 /* check that we're writing and that there's no error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK { return -int32(1) } /* check for seek request */ if (*Tgz_state)(unsafe.Pointer(state)).Fseek != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 if _gz_zero(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fskip) == -int32(1) { return -int32(1) } } /* try writing to input buffer for speed (state->size == 0 if buffer not initialized) */ if (*Tgz_state)(unsafe.Pointer(state)).Fsize != 0 { if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in == uint32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in = (*Tgz_state)(unsafe.Pointer(state)).Fin } have = libc.Uint32FromInt32(int32((*Tz_stream)(unsafe.Pointer(strm)).Fnext_in+uintptr((*Tz_stream)(unsafe.Pointer(strm)).Favail_in)) - int32((*Tgz_state)(unsafe.Pointer(state)).Fin)) if have < (*Tgz_state)(unsafe.Pointer(state)).Fsize { *(*uint8)(unsafe.Pointer((*Tgz_state)(unsafe.Pointer(state)).Fin + uintptr(have))) = libc.Uint8FromInt32(c) (*Tz_stream)(unsafe.Pointer(strm)).Favail_in++ (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos++ return c & int32(0xff) } } /* no room in buffer or not initialized, use gz_write() */ (*(*[1]uint8)(unsafe.Pointer(bp)))[0] = libc.Uint8FromInt32(c) if _gz_write(tls, state, bp, uint32(1)) != uint32(1) { return -int32(1) } return c & int32(0xff) } // C documentation // // /* -- see zlib.h -- */ func Xgzputs(tls *libc.TLS, file TgzFile, s uintptr) (r int32) { var len1, put Tz_size_t var state Tgz_statep var v1 int32 _, _, _, _ = len1, put, state, v1 /* get internal structure */ if file == libc.UintptrFromInt32(0) { return -int32(1) } state = file /* check that we're writing and that there's no error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK { return -int32(1) } /* write string */ len1 = libc.Xstrlen(tls, s) if libc.Int32FromUint32(len1) < 0 || len1 != len1 { Xgz_error(tls, state, -int32(2), __ccgo_ts+57672) return -int32(1) } put = _gz_write(tls, state, s, len1) if put < len1 { v1 = -int32(1) } else { v1 = libc.Int32FromUint32(len1) } return v1 } // C documentation // // /* -- see zlib.h -- */ func Xgzvprintf(tls *libc.TLS, file TgzFile, format uintptr, va Tva_list) (r int32) { var left uint32 var len1 int32 var next uintptr var state Tgz_statep var strm Tz_streamp _, _, _, _, _ = left, len1, next, state, strm /* get internal structure */ if file == libc.UintptrFromInt32(0) { return -int32(2) } state = file strm = state + 108 /* check that we're writing and that there's no error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK { return -int32(2) } /* make sure we have some buffer space */ if (*Tgz_state)(unsafe.Pointer(state)).Fsize == uint32(0) && _gz_init(tls, state) == -int32(1) { return (*Tgz_state)(unsafe.Pointer(state)).Ferr } /* check for seek request */ if (*Tgz_state)(unsafe.Pointer(state)).Fseek != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 if _gz_zero(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fskip) == -int32(1) { return (*Tgz_state)(unsafe.Pointer(state)).Ferr } } /* do the printf() into the input buffer, put length in len -- the input buffer is double-sized just for this function, so there is guaranteed to be state->size bytes available after the current contents */ if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in == uint32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in = (*Tgz_state)(unsafe.Pointer(state)).Fin } next = (*Tgz_state)(unsafe.Pointer(state)).Fin + uintptr(int32((*Tz_stream)(unsafe.Pointer(strm)).Fnext_in)-int32((*Tgz_state)(unsafe.Pointer(state)).Fin)) + uintptr((*Tz_stream)(unsafe.Pointer(strm)).Favail_in) *(*uint8)(unsafe.Pointer(next + uintptr((*Tgz_state)(unsafe.Pointer(state)).Fsize-uint32(1)))) = uint8(0) len1 = libc.X__builtin_vsnprintf(tls, next, (*Tgz_state)(unsafe.Pointer(state)).Fsize, format, va) /* check that printf() results fit in buffer */ if len1 == 0 || libc.Uint32FromInt32(len1) >= (*Tgz_state)(unsafe.Pointer(state)).Fsize || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(next + uintptr((*Tgz_state)(unsafe.Pointer(state)).Fsize-uint32(1))))) != 0 { return 0 } /* update buffer and position, compress first half if past that */ *(*TuInt)(unsafe.Pointer(strm + 4)) += libc.Uint32FromInt32(len1) (*Tgz_state)(unsafe.Pointer(state)).Fx.Fpos += int64(len1) if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in >= (*Tgz_state)(unsafe.Pointer(state)).Fsize { left = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in - (*Tgz_state)(unsafe.Pointer(state)).Fsize (*Tz_stream)(unsafe.Pointer(strm)).Favail_in = (*Tgz_state)(unsafe.Pointer(state)).Fsize if _gz_comp(tls, state, Z_NO_FLUSH) == -int32(1) { return (*Tgz_state)(unsafe.Pointer(state)).Ferr } libc.Xmemmove(tls, (*Tgz_state)(unsafe.Pointer(state)).Fin, (*Tgz_state)(unsafe.Pointer(state)).Fin+uintptr((*Tgz_state)(unsafe.Pointer(state)).Fsize), left) (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in = (*Tgz_state)(unsafe.Pointer(state)).Fin (*Tz_stream)(unsafe.Pointer(strm)).Favail_in = left } return len1 } func Xgzprintf(tls *libc.TLS, file TgzFile, format uintptr, va1 uintptr) (r int32) { var ret int32 var va Tva_list _, _ = ret, va va = va1 ret = Xgzvprintf(tls, file, format, va) _ = va return ret } // C documentation // // /* -- see zlib.h -- */ func Xgzflush(tls *libc.TLS, file TgzFile, flush int32) (r int32) { var state Tgz_statep _ = state /* get internal structure */ if file == libc.UintptrFromInt32(0) { return -int32(2) } state = file /* check that we're writing and that there's no error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK { return -int32(2) } /* check flush parameter */ if flush < 0 || flush > int32(Z_FINISH) { return -int32(2) } /* check for seek request */ if (*Tgz_state)(unsafe.Pointer(state)).Fseek != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 if _gz_zero(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fskip) == -int32(1) { return (*Tgz_state)(unsafe.Pointer(state)).Ferr } } /* compress remaining data with requested flush */ _gz_comp(tls, state, flush) return (*Tgz_state)(unsafe.Pointer(state)).Ferr } // C documentation // // /* -- see zlib.h -- */ func Xgzsetparams(tls *libc.TLS, file TgzFile, level int32, strategy int32) (r int32) { var state Tgz_statep var strm Tz_streamp _, _ = state, strm /* get internal structure */ if file == libc.UintptrFromInt32(0) { return -int32(2) } state = file strm = state + 108 /* check that we're writing and that there's no error */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) || (*Tgz_state)(unsafe.Pointer(state)).Ferr != Z_OK || (*Tgz_state)(unsafe.Pointer(state)).Fdirect != 0 { return -int32(2) } /* if no change is requested, then do nothing */ if level == (*Tgz_state)(unsafe.Pointer(state)).Flevel && strategy == (*Tgz_state)(unsafe.Pointer(state)).Fstrategy { return Z_OK } /* check for seek request */ if (*Tgz_state)(unsafe.Pointer(state)).Fseek != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 if _gz_zero(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fskip) == -int32(1) { return (*Tgz_state)(unsafe.Pointer(state)).Ferr } } /* change compression parameters for subsequent input */ if (*Tgz_state)(unsafe.Pointer(state)).Fsize != 0 { /* flush previous input with previous parameters before changing */ if (*Tz_stream)(unsafe.Pointer(strm)).Favail_in != 0 && _gz_comp(tls, state, int32(Z_BLOCK)) == -int32(1) { return (*Tgz_state)(unsafe.Pointer(state)).Ferr } XdeflateParams(tls, strm, level, strategy) } (*Tgz_state)(unsafe.Pointer(state)).Flevel = level (*Tgz_state)(unsafe.Pointer(state)).Fstrategy = strategy return Z_OK } // C documentation // // /* -- see zlib.h -- */ func Xgzclose_w(tls *libc.TLS, file TgzFile) (r int32) { var ret int32 var state Tgz_statep _, _ = ret, state ret = Z_OK /* get internal structure */ if file == libc.UintptrFromInt32(0) { return -int32(2) } state = file /* check that we're writing */ if (*Tgz_state)(unsafe.Pointer(state)).Fmode != int32(GZ_WRITE) { return -int32(2) } /* check for seek request */ if (*Tgz_state)(unsafe.Pointer(state)).Fseek != 0 { (*Tgz_state)(unsafe.Pointer(state)).Fseek = 0 if _gz_zero(tls, state, (*Tgz_state)(unsafe.Pointer(state)).Fskip) == -int32(1) { ret = (*Tgz_state)(unsafe.Pointer(state)).Ferr } } /* flush, free memory, and close file */ if _gz_comp(tls, state, int32(Z_FINISH)) == -int32(1) { ret = (*Tgz_state)(unsafe.Pointer(state)).Ferr } if (*Tgz_state)(unsafe.Pointer(state)).Fsize != 0 { if !((*Tgz_state)(unsafe.Pointer(state)).Fdirect != 0) { XdeflateEnd(tls, state+108) libc.Xfree(tls, (*Tgz_state)(unsafe.Pointer(state)).Fout) } libc.Xfree(tls, (*Tgz_state)(unsafe.Pointer(state)).Fin) } Xgz_error(tls, state, Z_OK, libc.UintptrFromInt32(0)) libc.Xfree(tls, (*Tgz_state)(unsafe.Pointer(state)).Fpath) if libc.Xclose(tls, (*Tgz_state)(unsafe.Pointer(state)).Ffd) == -int32(1) { ret = -int32(1) } libc.Xfree(tls, state) return ret } const ENOUGH_DISTS = 592 const ENOUGH_LENS = 852 const PRESET_DICT2 = 0x20 type Tcode = struct { Fop uint8 Fbits uint8 Fval uint16 } type Tcodetype = int32 const CODES = 0 const LENS = 1 const DISTS = 2 type Tinflate_mode = int32 const HEAD = 16180 const FLAGS = 16181 const TIME = 16182 const OS = 16183 const EXLEN = 16184 const EXTRA = 16185 const NAME = 16186 const COMMENT = 16187 const HCRC = 16188 const DICTID = 16189 const DICT = 16190 const TYPE = 16191 const TYPEDO = 16192 const STORED = 16193 const COPY_ = 16194 const COPY1 = 16195 const TABLE = 16196 const LENLENS = 16197 const CODELENS = 16198 const LEN_ = 16199 const LEN = 16200 const LENEXT = 16201 const DIST = 16202 const DISTEXT = 16203 const MATCH = 16204 const LIT = 16205 const CHECK = 16206 const LENGTH = 16207 const DONE = 16208 const BAD = 16209 const MEM = 16210 const SYNC = 16211 type Tinflate_state = struct { Fstrm Tz_streamp Fmode Tinflate_mode Flast int32 Fwrap int32 Fhavedict int32 Fflags int32 Fdmax uint32 Fcheck uint32 Ftotal uint32 Fhead Tgz_headerp Fwbits uint32 Fwsize uint32 Fwhave uint32 Fwnext uint32 Fwindow uintptr Fhold uint32 Fbits uint32 Flength uint32 Foffset uint32 Fextra uint32 Flencode uintptr Fdistcode uintptr Flenbits uint32 Fdistbits uint32 Fncode uint32 Fnlen uint32 Fndist uint32 Fhave uint32 Fnext uintptr Flens [320]uint16 Fwork [288]uint16 Fcodes [1444]Tcode Fsane int32 Fback int32 Fwas uint32 } // C documentation // // /* // strm provides memory allocation functions in zalloc and zfree, or // Z_NULL to use the library memory allocation functions. // // windowBits is in the range 8..15, and window is a user-supplied // window and output buffer that is 2**windowBits bytes. // */ func XinflateBackInit_(tls *libc.TLS, strm Tz_streamp, windowBits int32, window uintptr, version uintptr, stream_size int32) (r int32) { var state uintptr _ = state if version == uintptr(Z_NULL) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(version))) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(__ccgo_ts + 15959))) || stream_size != libc.Int32FromUint32(libc.Uint32FromInt64(56)) { return -int32(6) } if strm == uintptr(Z_NULL) || window == uintptr(Z_NULL) || windowBits < int32(8) || windowBits > int32(15) { return -int32(2) } (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = uintptr(Z_NULL) /* in case we return an error */ if (*Tz_stream)(unsafe.Pointer(strm)).Fzalloc == libc.UintptrFromInt32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fzalloc = __ccgo_fp(Xzcalloc) (*Tz_stream)(unsafe.Pointer(strm)).Fopaque = libc.UintptrFromInt32(0) } if (*Tz_stream)(unsafe.Pointer(strm)).Fzfree == libc.UintptrFromInt32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fzfree = __ccgo_fp(Xzcfree) } state = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, libc.Uint32FromInt32(libc.Int32FromInt32(1)), libc.Uint32FromInt64(7120)) if state == uintptr(Z_NULL) { return -int32(4) } (*Tz_stream)(unsafe.Pointer(strm)).Fstate = state (*Tinflate_state)(unsafe.Pointer(state)).Fdmax = uint32(32768) (*Tinflate_state)(unsafe.Pointer(state)).Fwbits = libc.Uint32FromInt32(windowBits) (*Tinflate_state)(unsafe.Pointer(state)).Fwsize = uint32(1) << windowBits (*Tinflate_state)(unsafe.Pointer(state)).Fwindow = window (*Tinflate_state)(unsafe.Pointer(state)).Fwnext = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fwhave = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fsane = int32(1) return Z_OK } // C documentation // // /* // Return state with length and distance decoding tables and index sizes set to // fixed code decoding. Normally this returns fixed tables from inffixed.h. // If BUILDFIXED is defined, then instead this routine builds the tables the // first time it's called, and returns those tables the first time and // thereafter. This reduces the size of the code by about 2K bytes, in // exchange for a little execution time. However, BUILDFIXED should not be // used for threaded applications, since the rewriting of the tables and virgin // may not be thread-safe. // */ func _fixedtables(tls *libc.TLS, state uintptr) { (*Tinflate_state)(unsafe.Pointer(state)).Flencode = uintptr(unsafe.Pointer(&_lenfix)) (*Tinflate_state)(unsafe.Pointer(state)).Flenbits = uint32(9) (*Tinflate_state)(unsafe.Pointer(state)).Fdistcode = uintptr(unsafe.Pointer(&_distfix)) (*Tinflate_state)(unsafe.Pointer(state)).Fdistbits = uint32(5) } var _lenfix = [512]Tcode{ 0: { Fop: uint8(96), Fbits: uint8(7), }, 1: { Fbits: uint8(8), Fval: uint16(80), }, 2: { Fbits: uint8(8), Fval: uint16(16), }, 3: { Fop: uint8(20), Fbits: uint8(8), Fval: uint16(115), }, 4: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(31), }, 5: { Fbits: uint8(8), Fval: uint16(112), }, 6: { Fbits: uint8(8), Fval: uint16(48), }, 7: { Fbits: uint8(9), Fval: uint16(192), }, 8: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(10), }, 9: { Fbits: uint8(8), Fval: uint16(96), }, 10: { Fbits: uint8(8), Fval: uint16(32), }, 11: { Fbits: uint8(9), Fval: uint16(160), }, 12: { Fbits: uint8(8), }, 13: { Fbits: uint8(8), Fval: uint16(128), }, 14: { Fbits: uint8(8), Fval: uint16(64), }, 15: { Fbits: uint8(9), Fval: uint16(224), }, 16: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(6), }, 17: { Fbits: uint8(8), Fval: uint16(88), }, 18: { Fbits: uint8(8), Fval: uint16(24), }, 19: { Fbits: uint8(9), Fval: uint16(144), }, 20: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(59), }, 21: { Fbits: uint8(8), Fval: uint16(120), }, 22: { Fbits: uint8(8), Fval: uint16(56), }, 23: { Fbits: uint8(9), Fval: uint16(208), }, 24: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(17), }, 25: { Fbits: uint8(8), Fval: uint16(104), }, 26: { Fbits: uint8(8), Fval: uint16(40), }, 27: { Fbits: uint8(9), Fval: uint16(176), }, 28: { Fbits: uint8(8), Fval: uint16(8), }, 29: { Fbits: uint8(8), Fval: uint16(136), }, 30: { Fbits: uint8(8), Fval: uint16(72), }, 31: { Fbits: uint8(9), Fval: uint16(240), }, 32: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(4), }, 33: { Fbits: uint8(8), Fval: uint16(84), }, 34: { Fbits: uint8(8), Fval: uint16(20), }, 35: { Fop: uint8(21), Fbits: uint8(8), Fval: uint16(227), }, 36: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(43), }, 37: { Fbits: uint8(8), Fval: uint16(116), }, 38: { Fbits: uint8(8), Fval: uint16(52), }, 39: { Fbits: uint8(9), Fval: uint16(200), }, 40: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(13), }, 41: { Fbits: uint8(8), Fval: uint16(100), }, 42: { Fbits: uint8(8), Fval: uint16(36), }, 43: { Fbits: uint8(9), Fval: uint16(168), }, 44: { Fbits: uint8(8), Fval: uint16(4), }, 45: { Fbits: uint8(8), Fval: uint16(132), }, 46: { Fbits: uint8(8), Fval: uint16(68), }, 47: { Fbits: uint8(9), Fval: uint16(232), }, 48: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(8), }, 49: { Fbits: uint8(8), Fval: uint16(92), }, 50: { Fbits: uint8(8), Fval: uint16(28), }, 51: { Fbits: uint8(9), Fval: uint16(152), }, 52: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(83), }, 53: { Fbits: uint8(8), Fval: uint16(124), }, 54: { Fbits: uint8(8), Fval: uint16(60), }, 55: { Fbits: uint8(9), Fval: uint16(216), }, 56: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(23), }, 57: { Fbits: uint8(8), Fval: uint16(108), }, 58: { Fbits: uint8(8), Fval: uint16(44), }, 59: { Fbits: uint8(9), Fval: uint16(184), }, 60: { Fbits: uint8(8), Fval: uint16(12), }, 61: { Fbits: uint8(8), Fval: uint16(140), }, 62: { Fbits: uint8(8), Fval: uint16(76), }, 63: { Fbits: uint8(9), Fval: uint16(248), }, 64: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(3), }, 65: { Fbits: uint8(8), Fval: uint16(82), }, 66: { Fbits: uint8(8), Fval: uint16(18), }, 67: { Fop: uint8(21), Fbits: uint8(8), Fval: uint16(163), }, 68: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(35), }, 69: { Fbits: uint8(8), Fval: uint16(114), }, 70: { Fbits: uint8(8), Fval: uint16(50), }, 71: { Fbits: uint8(9), Fval: uint16(196), }, 72: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(11), }, 73: { Fbits: uint8(8), Fval: uint16(98), }, 74: { Fbits: uint8(8), Fval: uint16(34), }, 75: { Fbits: uint8(9), Fval: uint16(164), }, 76: { Fbits: uint8(8), Fval: uint16(2), }, 77: { Fbits: uint8(8), Fval: uint16(130), }, 78: { Fbits: uint8(8), Fval: uint16(66), }, 79: { Fbits: uint8(9), Fval: uint16(228), }, 80: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(7), }, 81: { Fbits: uint8(8), Fval: uint16(90), }, 82: { Fbits: uint8(8), Fval: uint16(26), }, 83: { Fbits: uint8(9), Fval: uint16(148), }, 84: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(67), }, 85: { Fbits: uint8(8), Fval: uint16(122), }, 86: { Fbits: uint8(8), Fval: uint16(58), }, 87: { Fbits: uint8(9), Fval: uint16(212), }, 88: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(19), }, 89: { Fbits: uint8(8), Fval: uint16(106), }, 90: { Fbits: uint8(8), Fval: uint16(42), }, 91: { Fbits: uint8(9), Fval: uint16(180), }, 92: { Fbits: uint8(8), Fval: uint16(10), }, 93: { Fbits: uint8(8), Fval: uint16(138), }, 94: { Fbits: uint8(8), Fval: uint16(74), }, 95: { Fbits: uint8(9), Fval: uint16(244), }, 96: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(5), }, 97: { Fbits: uint8(8), Fval: uint16(86), }, 98: { Fbits: uint8(8), Fval: uint16(22), }, 99: { Fop: uint8(64), Fbits: uint8(8), }, 100: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(51), }, 101: { Fbits: uint8(8), Fval: uint16(118), }, 102: { Fbits: uint8(8), Fval: uint16(54), }, 103: { Fbits: uint8(9), Fval: uint16(204), }, 104: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(15), }, 105: { Fbits: uint8(8), Fval: uint16(102), }, 106: { Fbits: uint8(8), Fval: uint16(38), }, 107: { Fbits: uint8(9), Fval: uint16(172), }, 108: { Fbits: uint8(8), Fval: uint16(6), }, 109: { Fbits: uint8(8), Fval: uint16(134), }, 110: { Fbits: uint8(8), Fval: uint16(70), }, 111: { Fbits: uint8(9), Fval: uint16(236), }, 112: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(9), }, 113: { Fbits: uint8(8), Fval: uint16(94), }, 114: { Fbits: uint8(8), Fval: uint16(30), }, 115: { Fbits: uint8(9), Fval: uint16(156), }, 116: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(99), }, 117: { Fbits: uint8(8), Fval: uint16(126), }, 118: { Fbits: uint8(8), Fval: uint16(62), }, 119: { Fbits: uint8(9), Fval: uint16(220), }, 120: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(27), }, 121: { Fbits: uint8(8), Fval: uint16(110), }, 122: { Fbits: uint8(8), Fval: uint16(46), }, 123: { Fbits: uint8(9), Fval: uint16(188), }, 124: { Fbits: uint8(8), Fval: uint16(14), }, 125: { Fbits: uint8(8), Fval: uint16(142), }, 126: { Fbits: uint8(8), Fval: uint16(78), }, 127: { Fbits: uint8(9), Fval: uint16(252), }, 128: { Fop: uint8(96), Fbits: uint8(7), }, 129: { Fbits: uint8(8), Fval: uint16(81), }, 130: { Fbits: uint8(8), Fval: uint16(17), }, 131: { Fop: uint8(21), Fbits: uint8(8), Fval: uint16(131), }, 132: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(31), }, 133: { Fbits: uint8(8), Fval: uint16(113), }, 134: { Fbits: uint8(8), Fval: uint16(49), }, 135: { Fbits: uint8(9), Fval: uint16(194), }, 136: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(10), }, 137: { Fbits: uint8(8), Fval: uint16(97), }, 138: { Fbits: uint8(8), Fval: uint16(33), }, 139: { Fbits: uint8(9), Fval: uint16(162), }, 140: { Fbits: uint8(8), Fval: uint16(1), }, 141: { Fbits: uint8(8), Fval: uint16(129), }, 142: { Fbits: uint8(8), Fval: uint16(65), }, 143: { Fbits: uint8(9), Fval: uint16(226), }, 144: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(6), }, 145: { Fbits: uint8(8), Fval: uint16(89), }, 146: { Fbits: uint8(8), Fval: uint16(25), }, 147: { Fbits: uint8(9), Fval: uint16(146), }, 148: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(59), }, 149: { Fbits: uint8(8), Fval: uint16(121), }, 150: { Fbits: uint8(8), Fval: uint16(57), }, 151: { Fbits: uint8(9), Fval: uint16(210), }, 152: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(17), }, 153: { Fbits: uint8(8), Fval: uint16(105), }, 154: { Fbits: uint8(8), Fval: uint16(41), }, 155: { Fbits: uint8(9), Fval: uint16(178), }, 156: { Fbits: uint8(8), Fval: uint16(9), }, 157: { Fbits: uint8(8), Fval: uint16(137), }, 158: { Fbits: uint8(8), Fval: uint16(73), }, 159: { Fbits: uint8(9), Fval: uint16(242), }, 160: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(4), }, 161: { Fbits: uint8(8), Fval: uint16(85), }, 162: { Fbits: uint8(8), Fval: uint16(21), }, 163: { Fop: uint8(16), Fbits: uint8(8), Fval: uint16(258), }, 164: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(43), }, 165: { Fbits: uint8(8), Fval: uint16(117), }, 166: { Fbits: uint8(8), Fval: uint16(53), }, 167: { Fbits: uint8(9), Fval: uint16(202), }, 168: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(13), }, 169: { Fbits: uint8(8), Fval: uint16(101), }, 170: { Fbits: uint8(8), Fval: uint16(37), }, 171: { Fbits: uint8(9), Fval: uint16(170), }, 172: { Fbits: uint8(8), Fval: uint16(5), }, 173: { Fbits: uint8(8), Fval: uint16(133), }, 174: { Fbits: uint8(8), Fval: uint16(69), }, 175: { Fbits: uint8(9), Fval: uint16(234), }, 176: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(8), }, 177: { Fbits: uint8(8), Fval: uint16(93), }, 178: { Fbits: uint8(8), Fval: uint16(29), }, 179: { Fbits: uint8(9), Fval: uint16(154), }, 180: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(83), }, 181: { Fbits: uint8(8), Fval: uint16(125), }, 182: { Fbits: uint8(8), Fval: uint16(61), }, 183: { Fbits: uint8(9), Fval: uint16(218), }, 184: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(23), }, 185: { Fbits: uint8(8), Fval: uint16(109), }, 186: { Fbits: uint8(8), Fval: uint16(45), }, 187: { Fbits: uint8(9), Fval: uint16(186), }, 188: { Fbits: uint8(8), Fval: uint16(13), }, 189: { Fbits: uint8(8), Fval: uint16(141), }, 190: { Fbits: uint8(8), Fval: uint16(77), }, 191: { Fbits: uint8(9), Fval: uint16(250), }, 192: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(3), }, 193: { Fbits: uint8(8), Fval: uint16(83), }, 194: { Fbits: uint8(8), Fval: uint16(19), }, 195: { Fop: uint8(21), Fbits: uint8(8), Fval: uint16(195), }, 196: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(35), }, 197: { Fbits: uint8(8), Fval: uint16(115), }, 198: { Fbits: uint8(8), Fval: uint16(51), }, 199: { Fbits: uint8(9), Fval: uint16(198), }, 200: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(11), }, 201: { Fbits: uint8(8), Fval: uint16(99), }, 202: { Fbits: uint8(8), Fval: uint16(35), }, 203: { Fbits: uint8(9), Fval: uint16(166), }, 204: { Fbits: uint8(8), Fval: uint16(3), }, 205: { Fbits: uint8(8), Fval: uint16(131), }, 206: { Fbits: uint8(8), Fval: uint16(67), }, 207: { Fbits: uint8(9), Fval: uint16(230), }, 208: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(7), }, 209: { Fbits: uint8(8), Fval: uint16(91), }, 210: { Fbits: uint8(8), Fval: uint16(27), }, 211: { Fbits: uint8(9), Fval: uint16(150), }, 212: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(67), }, 213: { Fbits: uint8(8), Fval: uint16(123), }, 214: { Fbits: uint8(8), Fval: uint16(59), }, 215: { Fbits: uint8(9), Fval: uint16(214), }, 216: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(19), }, 217: { Fbits: uint8(8), Fval: uint16(107), }, 218: { Fbits: uint8(8), Fval: uint16(43), }, 219: { Fbits: uint8(9), Fval: uint16(182), }, 220: { Fbits: uint8(8), Fval: uint16(11), }, 221: { Fbits: uint8(8), Fval: uint16(139), }, 222: { Fbits: uint8(8), Fval: uint16(75), }, 223: { Fbits: uint8(9), Fval: uint16(246), }, 224: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(5), }, 225: { Fbits: uint8(8), Fval: uint16(87), }, 226: { Fbits: uint8(8), Fval: uint16(23), }, 227: { Fop: uint8(64), Fbits: uint8(8), }, 228: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(51), }, 229: { Fbits: uint8(8), Fval: uint16(119), }, 230: { Fbits: uint8(8), Fval: uint16(55), }, 231: { Fbits: uint8(9), Fval: uint16(206), }, 232: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(15), }, 233: { Fbits: uint8(8), Fval: uint16(103), }, 234: { Fbits: uint8(8), Fval: uint16(39), }, 235: { Fbits: uint8(9), Fval: uint16(174), }, 236: { Fbits: uint8(8), Fval: uint16(7), }, 237: { Fbits: uint8(8), Fval: uint16(135), }, 238: { Fbits: uint8(8), Fval: uint16(71), }, 239: { Fbits: uint8(9), Fval: uint16(238), }, 240: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(9), }, 241: { Fbits: uint8(8), Fval: uint16(95), }, 242: { Fbits: uint8(8), Fval: uint16(31), }, 243: { Fbits: uint8(9), Fval: uint16(158), }, 244: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(99), }, 245: { Fbits: uint8(8), Fval: uint16(127), }, 246: { Fbits: uint8(8), Fval: uint16(63), }, 247: { Fbits: uint8(9), Fval: uint16(222), }, 248: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(27), }, 249: { Fbits: uint8(8), Fval: uint16(111), }, 250: { Fbits: uint8(8), Fval: uint16(47), }, 251: { Fbits: uint8(9), Fval: uint16(190), }, 252: { Fbits: uint8(8), Fval: uint16(15), }, 253: { Fbits: uint8(8), Fval: uint16(143), }, 254: { Fbits: uint8(8), Fval: uint16(79), }, 255: { Fbits: uint8(9), Fval: uint16(254), }, 256: { Fop: uint8(96), Fbits: uint8(7), }, 257: { Fbits: uint8(8), Fval: uint16(80), }, 258: { Fbits: uint8(8), Fval: uint16(16), }, 259: { Fop: uint8(20), Fbits: uint8(8), Fval: uint16(115), }, 260: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(31), }, 261: { Fbits: uint8(8), Fval: uint16(112), }, 262: { Fbits: uint8(8), Fval: uint16(48), }, 263: { Fbits: uint8(9), Fval: uint16(193), }, 264: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(10), }, 265: { Fbits: uint8(8), Fval: uint16(96), }, 266: { Fbits: uint8(8), Fval: uint16(32), }, 267: { Fbits: uint8(9), Fval: uint16(161), }, 268: { Fbits: uint8(8), }, 269: { Fbits: uint8(8), Fval: uint16(128), }, 270: { Fbits: uint8(8), Fval: uint16(64), }, 271: { Fbits: uint8(9), Fval: uint16(225), }, 272: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(6), }, 273: { Fbits: uint8(8), Fval: uint16(88), }, 274: { Fbits: uint8(8), Fval: uint16(24), }, 275: { Fbits: uint8(9), Fval: uint16(145), }, 276: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(59), }, 277: { Fbits: uint8(8), Fval: uint16(120), }, 278: { Fbits: uint8(8), Fval: uint16(56), }, 279: { Fbits: uint8(9), Fval: uint16(209), }, 280: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(17), }, 281: { Fbits: uint8(8), Fval: uint16(104), }, 282: { Fbits: uint8(8), Fval: uint16(40), }, 283: { Fbits: uint8(9), Fval: uint16(177), }, 284: { Fbits: uint8(8), Fval: uint16(8), }, 285: { Fbits: uint8(8), Fval: uint16(136), }, 286: { Fbits: uint8(8), Fval: uint16(72), }, 287: { Fbits: uint8(9), Fval: uint16(241), }, 288: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(4), }, 289: { Fbits: uint8(8), Fval: uint16(84), }, 290: { Fbits: uint8(8), Fval: uint16(20), }, 291: { Fop: uint8(21), Fbits: uint8(8), Fval: uint16(227), }, 292: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(43), }, 293: { Fbits: uint8(8), Fval: uint16(116), }, 294: { Fbits: uint8(8), Fval: uint16(52), }, 295: { Fbits: uint8(9), Fval: uint16(201), }, 296: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(13), }, 297: { Fbits: uint8(8), Fval: uint16(100), }, 298: { Fbits: uint8(8), Fval: uint16(36), }, 299: { Fbits: uint8(9), Fval: uint16(169), }, 300: { Fbits: uint8(8), Fval: uint16(4), }, 301: { Fbits: uint8(8), Fval: uint16(132), }, 302: { Fbits: uint8(8), Fval: uint16(68), }, 303: { Fbits: uint8(9), Fval: uint16(233), }, 304: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(8), }, 305: { Fbits: uint8(8), Fval: uint16(92), }, 306: { Fbits: uint8(8), Fval: uint16(28), }, 307: { Fbits: uint8(9), Fval: uint16(153), }, 308: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(83), }, 309: { Fbits: uint8(8), Fval: uint16(124), }, 310: { Fbits: uint8(8), Fval: uint16(60), }, 311: { Fbits: uint8(9), Fval: uint16(217), }, 312: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(23), }, 313: { Fbits: uint8(8), Fval: uint16(108), }, 314: { Fbits: uint8(8), Fval: uint16(44), }, 315: { Fbits: uint8(9), Fval: uint16(185), }, 316: { Fbits: uint8(8), Fval: uint16(12), }, 317: { Fbits: uint8(8), Fval: uint16(140), }, 318: { Fbits: uint8(8), Fval: uint16(76), }, 319: { Fbits: uint8(9), Fval: uint16(249), }, 320: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(3), }, 321: { Fbits: uint8(8), Fval: uint16(82), }, 322: { Fbits: uint8(8), Fval: uint16(18), }, 323: { Fop: uint8(21), Fbits: uint8(8), Fval: uint16(163), }, 324: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(35), }, 325: { Fbits: uint8(8), Fval: uint16(114), }, 326: { Fbits: uint8(8), Fval: uint16(50), }, 327: { Fbits: uint8(9), Fval: uint16(197), }, 328: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(11), }, 329: { Fbits: uint8(8), Fval: uint16(98), }, 330: { Fbits: uint8(8), Fval: uint16(34), }, 331: { Fbits: uint8(9), Fval: uint16(165), }, 332: { Fbits: uint8(8), Fval: uint16(2), }, 333: { Fbits: uint8(8), Fval: uint16(130), }, 334: { Fbits: uint8(8), Fval: uint16(66), }, 335: { Fbits: uint8(9), Fval: uint16(229), }, 336: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(7), }, 337: { Fbits: uint8(8), Fval: uint16(90), }, 338: { Fbits: uint8(8), Fval: uint16(26), }, 339: { Fbits: uint8(9), Fval: uint16(149), }, 340: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(67), }, 341: { Fbits: uint8(8), Fval: uint16(122), }, 342: { Fbits: uint8(8), Fval: uint16(58), }, 343: { Fbits: uint8(9), Fval: uint16(213), }, 344: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(19), }, 345: { Fbits: uint8(8), Fval: uint16(106), }, 346: { Fbits: uint8(8), Fval: uint16(42), }, 347: { Fbits: uint8(9), Fval: uint16(181), }, 348: { Fbits: uint8(8), Fval: uint16(10), }, 349: { Fbits: uint8(8), Fval: uint16(138), }, 350: { Fbits: uint8(8), Fval: uint16(74), }, 351: { Fbits: uint8(9), Fval: uint16(245), }, 352: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(5), }, 353: { Fbits: uint8(8), Fval: uint16(86), }, 354: { Fbits: uint8(8), Fval: uint16(22), }, 355: { Fop: uint8(64), Fbits: uint8(8), }, 356: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(51), }, 357: { Fbits: uint8(8), Fval: uint16(118), }, 358: { Fbits: uint8(8), Fval: uint16(54), }, 359: { Fbits: uint8(9), Fval: uint16(205), }, 360: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(15), }, 361: { Fbits: uint8(8), Fval: uint16(102), }, 362: { Fbits: uint8(8), Fval: uint16(38), }, 363: { Fbits: uint8(9), Fval: uint16(173), }, 364: { Fbits: uint8(8), Fval: uint16(6), }, 365: { Fbits: uint8(8), Fval: uint16(134), }, 366: { Fbits: uint8(8), Fval: uint16(70), }, 367: { Fbits: uint8(9), Fval: uint16(237), }, 368: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(9), }, 369: { Fbits: uint8(8), Fval: uint16(94), }, 370: { Fbits: uint8(8), Fval: uint16(30), }, 371: { Fbits: uint8(9), Fval: uint16(157), }, 372: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(99), }, 373: { Fbits: uint8(8), Fval: uint16(126), }, 374: { Fbits: uint8(8), Fval: uint16(62), }, 375: { Fbits: uint8(9), Fval: uint16(221), }, 376: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(27), }, 377: { Fbits: uint8(8), Fval: uint16(110), }, 378: { Fbits: uint8(8), Fval: uint16(46), }, 379: { Fbits: uint8(9), Fval: uint16(189), }, 380: { Fbits: uint8(8), Fval: uint16(14), }, 381: { Fbits: uint8(8), Fval: uint16(142), }, 382: { Fbits: uint8(8), Fval: uint16(78), }, 383: { Fbits: uint8(9), Fval: uint16(253), }, 384: { Fop: uint8(96), Fbits: uint8(7), }, 385: { Fbits: uint8(8), Fval: uint16(81), }, 386: { Fbits: uint8(8), Fval: uint16(17), }, 387: { Fop: uint8(21), Fbits: uint8(8), Fval: uint16(131), }, 388: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(31), }, 389: { Fbits: uint8(8), Fval: uint16(113), }, 390: { Fbits: uint8(8), Fval: uint16(49), }, 391: { Fbits: uint8(9), Fval: uint16(195), }, 392: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(10), }, 393: { Fbits: uint8(8), Fval: uint16(97), }, 394: { Fbits: uint8(8), Fval: uint16(33), }, 395: { Fbits: uint8(9), Fval: uint16(163), }, 396: { Fbits: uint8(8), Fval: uint16(1), }, 397: { Fbits: uint8(8), Fval: uint16(129), }, 398: { Fbits: uint8(8), Fval: uint16(65), }, 399: { Fbits: uint8(9), Fval: uint16(227), }, 400: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(6), }, 401: { Fbits: uint8(8), Fval: uint16(89), }, 402: { Fbits: uint8(8), Fval: uint16(25), }, 403: { Fbits: uint8(9), Fval: uint16(147), }, 404: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(59), }, 405: { Fbits: uint8(8), Fval: uint16(121), }, 406: { Fbits: uint8(8), Fval: uint16(57), }, 407: { Fbits: uint8(9), Fval: uint16(211), }, 408: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(17), }, 409: { Fbits: uint8(8), Fval: uint16(105), }, 410: { Fbits: uint8(8), Fval: uint16(41), }, 411: { Fbits: uint8(9), Fval: uint16(179), }, 412: { Fbits: uint8(8), Fval: uint16(9), }, 413: { Fbits: uint8(8), Fval: uint16(137), }, 414: { Fbits: uint8(8), Fval: uint16(73), }, 415: { Fbits: uint8(9), Fval: uint16(243), }, 416: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(4), }, 417: { Fbits: uint8(8), Fval: uint16(85), }, 418: { Fbits: uint8(8), Fval: uint16(21), }, 419: { Fop: uint8(16), Fbits: uint8(8), Fval: uint16(258), }, 420: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(43), }, 421: { Fbits: uint8(8), Fval: uint16(117), }, 422: { Fbits: uint8(8), Fval: uint16(53), }, 423: { Fbits: uint8(9), Fval: uint16(203), }, 424: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(13), }, 425: { Fbits: uint8(8), Fval: uint16(101), }, 426: { Fbits: uint8(8), Fval: uint16(37), }, 427: { Fbits: uint8(9), Fval: uint16(171), }, 428: { Fbits: uint8(8), Fval: uint16(5), }, 429: { Fbits: uint8(8), Fval: uint16(133), }, 430: { Fbits: uint8(8), Fval: uint16(69), }, 431: { Fbits: uint8(9), Fval: uint16(235), }, 432: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(8), }, 433: { Fbits: uint8(8), Fval: uint16(93), }, 434: { Fbits: uint8(8), Fval: uint16(29), }, 435: { Fbits: uint8(9), Fval: uint16(155), }, 436: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(83), }, 437: { Fbits: uint8(8), Fval: uint16(125), }, 438: { Fbits: uint8(8), Fval: uint16(61), }, 439: { Fbits: uint8(9), Fval: uint16(219), }, 440: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(23), }, 441: { Fbits: uint8(8), Fval: uint16(109), }, 442: { Fbits: uint8(8), Fval: uint16(45), }, 443: { Fbits: uint8(9), Fval: uint16(187), }, 444: { Fbits: uint8(8), Fval: uint16(13), }, 445: { Fbits: uint8(8), Fval: uint16(141), }, 446: { Fbits: uint8(8), Fval: uint16(77), }, 447: { Fbits: uint8(9), Fval: uint16(251), }, 448: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(3), }, 449: { Fbits: uint8(8), Fval: uint16(83), }, 450: { Fbits: uint8(8), Fval: uint16(19), }, 451: { Fop: uint8(21), Fbits: uint8(8), Fval: uint16(195), }, 452: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(35), }, 453: { Fbits: uint8(8), Fval: uint16(115), }, 454: { Fbits: uint8(8), Fval: uint16(51), }, 455: { Fbits: uint8(9), Fval: uint16(199), }, 456: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(11), }, 457: { Fbits: uint8(8), Fval: uint16(99), }, 458: { Fbits: uint8(8), Fval: uint16(35), }, 459: { Fbits: uint8(9), Fval: uint16(167), }, 460: { Fbits: uint8(8), Fval: uint16(3), }, 461: { Fbits: uint8(8), Fval: uint16(131), }, 462: { Fbits: uint8(8), Fval: uint16(67), }, 463: { Fbits: uint8(9), Fval: uint16(231), }, 464: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(7), }, 465: { Fbits: uint8(8), Fval: uint16(91), }, 466: { Fbits: uint8(8), Fval: uint16(27), }, 467: { Fbits: uint8(9), Fval: uint16(151), }, 468: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(67), }, 469: { Fbits: uint8(8), Fval: uint16(123), }, 470: { Fbits: uint8(8), Fval: uint16(59), }, 471: { Fbits: uint8(9), Fval: uint16(215), }, 472: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(19), }, 473: { Fbits: uint8(8), Fval: uint16(107), }, 474: { Fbits: uint8(8), Fval: uint16(43), }, 475: { Fbits: uint8(9), Fval: uint16(183), }, 476: { Fbits: uint8(8), Fval: uint16(11), }, 477: { Fbits: uint8(8), Fval: uint16(139), }, 478: { Fbits: uint8(8), Fval: uint16(75), }, 479: { Fbits: uint8(9), Fval: uint16(247), }, 480: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(5), }, 481: { Fbits: uint8(8), Fval: uint16(87), }, 482: { Fbits: uint8(8), Fval: uint16(23), }, 483: { Fop: uint8(64), Fbits: uint8(8), }, 484: { Fop: uint8(19), Fbits: uint8(7), Fval: uint16(51), }, 485: { Fbits: uint8(8), Fval: uint16(119), }, 486: { Fbits: uint8(8), Fval: uint16(55), }, 487: { Fbits: uint8(9), Fval: uint16(207), }, 488: { Fop: uint8(17), Fbits: uint8(7), Fval: uint16(15), }, 489: { Fbits: uint8(8), Fval: uint16(103), }, 490: { Fbits: uint8(8), Fval: uint16(39), }, 491: { Fbits: uint8(9), Fval: uint16(175), }, 492: { Fbits: uint8(8), Fval: uint16(7), }, 493: { Fbits: uint8(8), Fval: uint16(135), }, 494: { Fbits: uint8(8), Fval: uint16(71), }, 495: { Fbits: uint8(9), Fval: uint16(239), }, 496: { Fop: uint8(16), Fbits: uint8(7), Fval: uint16(9), }, 497: { Fbits: uint8(8), Fval: uint16(95), }, 498: { Fbits: uint8(8), Fval: uint16(31), }, 499: { Fbits: uint8(9), Fval: uint16(159), }, 500: { Fop: uint8(20), Fbits: uint8(7), Fval: uint16(99), }, 501: { Fbits: uint8(8), Fval: uint16(127), }, 502: { Fbits: uint8(8), Fval: uint16(63), }, 503: { Fbits: uint8(9), Fval: uint16(223), }, 504: { Fop: uint8(18), Fbits: uint8(7), Fval: uint16(27), }, 505: { Fbits: uint8(8), Fval: uint16(111), }, 506: { Fbits: uint8(8), Fval: uint16(47), }, 507: { Fbits: uint8(9), Fval: uint16(191), }, 508: { Fbits: uint8(8), Fval: uint16(15), }, 509: { Fbits: uint8(8), Fval: uint16(143), }, 510: { Fbits: uint8(8), Fval: uint16(79), }, 511: { Fbits: uint8(9), Fval: uint16(255), }, } var _distfix = [32]Tcode{ 0: { Fop: uint8(16), Fbits: uint8(5), Fval: uint16(1), }, 1: { Fop: uint8(23), Fbits: uint8(5), Fval: uint16(257), }, 2: { Fop: uint8(19), Fbits: uint8(5), Fval: uint16(17), }, 3: { Fop: uint8(27), Fbits: uint8(5), Fval: uint16(4097), }, 4: { Fop: uint8(17), Fbits: uint8(5), Fval: uint16(5), }, 5: { Fop: uint8(25), Fbits: uint8(5), Fval: uint16(1025), }, 6: { Fop: uint8(21), Fbits: uint8(5), Fval: uint16(65), }, 7: { Fop: uint8(29), Fbits: uint8(5), Fval: uint16(16385), }, 8: { Fop: uint8(16), Fbits: uint8(5), Fval: uint16(3), }, 9: { Fop: uint8(24), Fbits: uint8(5), Fval: uint16(513), }, 10: { Fop: uint8(20), Fbits: uint8(5), Fval: uint16(33), }, 11: { Fop: uint8(28), Fbits: uint8(5), Fval: uint16(8193), }, 12: { Fop: uint8(18), Fbits: uint8(5), Fval: uint16(9), }, 13: { Fop: uint8(26), Fbits: uint8(5), Fval: uint16(2049), }, 14: { Fop: uint8(22), Fbits: uint8(5), Fval: uint16(129), }, 15: { Fop: uint8(64), Fbits: uint8(5), }, 16: { Fop: uint8(16), Fbits: uint8(5), Fval: uint16(2), }, 17: { Fop: uint8(23), Fbits: uint8(5), Fval: uint16(385), }, 18: { Fop: uint8(19), Fbits: uint8(5), Fval: uint16(25), }, 19: { Fop: uint8(27), Fbits: uint8(5), Fval: uint16(6145), }, 20: { Fop: uint8(17), Fbits: uint8(5), Fval: uint16(7), }, 21: { Fop: uint8(25), Fbits: uint8(5), Fval: uint16(1537), }, 22: { Fop: uint8(21), Fbits: uint8(5), Fval: uint16(97), }, 23: { Fop: uint8(29), Fbits: uint8(5), Fval: uint16(24577), }, 24: { Fop: uint8(16), Fbits: uint8(5), Fval: uint16(4), }, 25: { Fop: uint8(24), Fbits: uint8(5), Fval: uint16(769), }, 26: { Fop: uint8(20), Fbits: uint8(5), Fval: uint16(49), }, 27: { Fop: uint8(28), Fbits: uint8(5), Fval: uint16(12289), }, 28: { Fop: uint8(18), Fbits: uint8(5), Fval: uint16(13), }, 29: { Fop: uint8(26), Fbits: uint8(5), Fval: uint16(3073), }, 30: { Fop: uint8(22), Fbits: uint8(5), Fval: uint16(193), }, 31: { Fop: uint8(64), Fbits: uint8(5), }, } /* Macros for inflateBack(): */ /* Load returned state from inflate_fast() */ /* Set state from registers for inflate_fast() */ /* Clear the input bit accumulator */ /* Assure that some input is available. If input is requested, but denied, then return a Z_BUF_ERROR from inflateBack(). */ /* Get a byte of input into the bit accumulator, or return from inflateBack() with an error if there is no input available. */ /* Assure that there are at least n bits in the bit accumulator. If there is not enough available input to do that, then return from inflateBack() with an error. */ /* Return the low n bits of the bit accumulator (n < 16) */ /* Remove n bits from the bit accumulator */ /* Remove zero to seven bits as needed to go to a byte boundary */ /* Assure that some output space is available, by writing out the window if it's full. If the write fails, return from inflateBack() with a Z_BUF_ERROR. */ // C documentation // // /* // strm provides the memory allocation functions and window buffer on input, // and provides information on the unused input on return. For Z_DATA_ERROR // returns, strm will also provide an error message. // // in() and out() are the call-back input and output functions. When // inflateBack() needs more input, it calls in(). When inflateBack() has // filled the window with output, or when it completes with data in the // window, it calls out() to write out the data. The application must not // change the provided input until in() is called again or inflateBack() // returns. The application must not change the window/output buffer until // inflateBack() returns. // // in() and out() are called with a descriptor parameter provided in the // inflateBack() call. This parameter can be a structure that provides the // information required to do the read or write, as well as accumulated // information on the input and output such as totals and check values. // // in() should return zero on failure. out() should return non-zero on // failure. If either in() or out() fails, than inflateBack() returns a // Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it // was in() or out() that caused in the error. Otherwise, inflateBack() // returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format // error, or Z_MEM_ERROR if it could not allocate memory for the state. // inflateBack() can also return Z_STREAM_ERROR if the input parameters // are not correct, i.e. strm is Z_NULL or the state was not initialized. // */ func XinflateBack(tls *libc.TLS, strm Tz_streamp, in Tin_func, in_desc uintptr, out Tout_func, out_desc uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var bits, copy1, have, hold, left, len1, v1, v18, v20, v24, v29, v30, v43, v44 uint32 var from, put, state, v11, v15, v16, v17, v19, v21, v23, v25, v26, v27, v28, v31, v33, v35, v36, v37, v39, v41, v42, v46, v47 uintptr var here, last Tcode var ret int32 var _ /* next at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bits, copy1, from, have, here, hold, last, left, len1, put, ret, state, v1, v11, v15, v16, v17, v18, v19, v20, v21, v23, v24, v25, v26, v27, v28, v29, v30, v31, v33, v35, v36, v37, v39, v41, v42, v43, v44, v46, v47 /* return code */ /* Check that the strm exists and that the state was initialized */ if strm == uintptr(Z_NULL) || (*Tz_stream)(unsafe.Pointer(strm)).Fstate == uintptr(Z_NULL) { return -int32(2) } state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate /* Reset the state */ (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = uintptr(Z_NULL) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TYPE) (*Tinflate_state)(unsafe.Pointer(state)).Flast = 0 (*Tinflate_state)(unsafe.Pointer(state)).Fwhave = uint32(0) *(*uintptr)(unsafe.Pointer(bp)) = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in if *(*uintptr)(unsafe.Pointer(bp)) != uintptr(Z_NULL) { v1 = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in } else { v1 = uint32(0) } have = v1 hold = uint32(0) bits = uint32(0) put = (*Tinflate_state)(unsafe.Pointer(state)).Fwindow left = (*Tinflate_state)(unsafe.Pointer(state)).Fwsize /* Inflate until end of block marked as last */ for { switch (*Tinflate_state)(unsafe.Pointer(state)).Fmode { case int32(TYPE): goto _3 case int32(STORED): goto _4 case int32(TABLE): goto _5 case int32(LEN): goto _6 case int32(DONE): goto _7 case int32(BAD): goto _8 default: goto _9 } goto _10 _3: ; /* determine and dispatch block type */ if (*Tinflate_state)(unsafe.Pointer(state)).Flast != 0 { hold >>= bits & uint32(7) bits -= bits & uint32(7) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(DONE) goto _10 } for bits < libc.Uint32FromInt32(libc.Int32FromInt32(3)) { if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v11 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v11))) << bits bits += uint32(8) } (*Tinflate_state)(unsafe.Pointer(state)).Flast = libc.Int32FromUint32(hold & (libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(1)) switch hold & (libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(2)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(2)) goto _10 _4: ; /* get and verify stored block length */ _14: ; hold >>= bits & uint32(7) bits -= bits & uint32(7) goto _13 _13: ; if 0 != 0 { goto _14 } goto _12 _12: ; /* go to byte boundary */ for bits < libc.Uint32FromInt32(libc.Int32FromInt32(32)) { if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v15 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v15))) << bits bits += uint32(8) } if hold&uint32(0xffff) != hold>>int32(16)^uint32(0xffff) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57725 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _10 } (*Tinflate_state)(unsafe.Pointer(state)).Flength = hold & uint32(0xffff) hold = uint32(0) bits = uint32(0) /* copy stored block from input to output */ for (*Tinflate_state)(unsafe.Pointer(state)).Flength != uint32(0) { copy1 = (*Tinflate_state)(unsafe.Pointer(state)).Flength if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } if left == uint32(0) { put = (*Tinflate_state)(unsafe.Pointer(state)).Fwindow left = (*Tinflate_state)(unsafe.Pointer(state)).Fwsize (*Tinflate_state)(unsafe.Pointer(state)).Fwhave = left if (*(*func(*libc.TLS, uintptr, uintptr, uint32) int32)(unsafe.Pointer(&struct{ uintptr }{out})))(tls, out_desc, put, left) != 0 { ret = -int32(5) goto inf_leave } } if copy1 > have { copy1 = have } if copy1 > left { copy1 = left } libc.Xmemcpy(tls, put, *(*uintptr)(unsafe.Pointer(bp)), copy1) have -= copy1 *(*uintptr)(unsafe.Pointer(bp)) += uintptr(copy1) left -= copy1 put += uintptr(copy1) *(*uint32)(unsafe.Pointer(state + 68)) -= copy1 } (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TYPE) goto _10 _5: ; /* get dynamic table entries descriptor */ for bits < libc.Uint32FromInt32(libc.Int32FromInt32(14)) { if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v16 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v16))) << bits bits += uint32(8) } (*Tinflate_state)(unsafe.Pointer(state)).Fnlen = hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(5)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(5)) (*Tinflate_state)(unsafe.Pointer(state)).Fndist = hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(5)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(5)) (*Tinflate_state)(unsafe.Pointer(state)).Fncode = hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(4)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(4)) if (*Tinflate_state)(unsafe.Pointer(state)).Fnlen > uint32(286) || (*Tinflate_state)(unsafe.Pointer(state)).Fndist > uint32(30) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57754 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _10 } /* get code length code lengths (not a typo) */ (*Tinflate_state)(unsafe.Pointer(state)).Fhave = uint32(0) for (*Tinflate_state)(unsafe.Pointer(state)).Fhave < (*Tinflate_state)(unsafe.Pointer(state)).Fncode { for bits < libc.Uint32FromInt32(libc.Int32FromInt32(3)) { if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v17 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v17))) << bits bits += uint32(8) } v19 = state + 108 v18 = *(*uint32)(unsafe.Pointer(v19)) *(*uint32)(unsafe.Pointer(v19))++ *(*uint16)(unsafe.Pointer(state + 116 + uintptr(_order[v18])*2)) = uint16(hold & (libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(3)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(3)) } for (*Tinflate_state)(unsafe.Pointer(state)).Fhave < uint32(19) { v21 = state + 108 v20 = *(*uint32)(unsafe.Pointer(v21)) *(*uint32)(unsafe.Pointer(v21))++ *(*uint16)(unsafe.Pointer(state + 116 + uintptr(_order[v20])*2)) = uint16(0) } (*Tinflate_state)(unsafe.Pointer(state)).Fnext = state + 1332 (*Tinflate_state)(unsafe.Pointer(state)).Flencode = (*Tinflate_state)(unsafe.Pointer(state)).Fnext (*Tinflate_state)(unsafe.Pointer(state)).Flenbits = uint32(7) ret = Xinflate_table(tls, int32(CODES), state+116, uint32(19), state+112, state+88, state+756) if ret != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57790 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _10 } /* get length and distance code code lengths */ (*Tinflate_state)(unsafe.Pointer(state)).Fhave = uint32(0) for (*Tinflate_state)(unsafe.Pointer(state)).Fhave < (*Tinflate_state)(unsafe.Pointer(state)).Fnlen+(*Tinflate_state)(unsafe.Pointer(state)).Fndist { for { here = *(*Tcode)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Flencode + uintptr(hold&(libc.Uint32FromUint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Flenbits-libc.Uint32FromInt32(1)))*4)) if uint32(here.Fbits) <= bits { break } if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v23 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v23))) << bits bits += uint32(8) goto _22 _22: } if libc.Int32FromUint16(here.Fval) < int32(16) { hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) v25 = state + 108 v24 = *(*uint32)(unsafe.Pointer(v25)) *(*uint32)(unsafe.Pointer(v25))++ *(*uint16)(unsafe.Pointer(state + 116 + uintptr(v24)*2)) = here.Fval } else { if libc.Int32FromUint16(here.Fval) == int32(16) { for bits < libc.Uint32FromInt32(libc.Int32FromUint8(here.Fbits)+libc.Int32FromInt32(2)) { if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v26 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v26))) << bits bits += uint32(8) } hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) if (*Tinflate_state)(unsafe.Pointer(state)).Fhave == uint32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57815 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) break } len1 = uint32(*(*uint16)(unsafe.Pointer(state + 116 + uintptr((*Tinflate_state)(unsafe.Pointer(state)).Fhave-uint32(1))*2))) copy1 = uint32(3) + hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(2)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(2)) } else { if libc.Int32FromUint16(here.Fval) == int32(17) { for bits < libc.Uint32FromInt32(libc.Int32FromUint8(here.Fbits)+libc.Int32FromInt32(3)) { if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v27 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v27))) << bits bits += uint32(8) } hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) len1 = uint32(0) copy1 = uint32(3) + hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(3)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(3)) } else { for bits < libc.Uint32FromInt32(libc.Int32FromUint8(here.Fbits)+libc.Int32FromInt32(7)) { if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v28 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v28))) << bits bits += uint32(8) } hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) len1 = uint32(0) copy1 = uint32(11) + hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(7)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(7)) } } if (*Tinflate_state)(unsafe.Pointer(state)).Fhave+copy1 > (*Tinflate_state)(unsafe.Pointer(state)).Fnlen+(*Tinflate_state)(unsafe.Pointer(state)).Fndist { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57815 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) break } for { v29 = copy1 copy1-- if !(v29 != 0) { break } v31 = state + 108 v30 = *(*uint32)(unsafe.Pointer(v31)) *(*uint32)(unsafe.Pointer(v31))++ *(*uint16)(unsafe.Pointer(state + 116 + uintptr(v30)*2)) = uint16(len1) } } } /* handle error breaks in while */ if (*Tinflate_state)(unsafe.Pointer(state)).Fmode == int32(BAD) { goto _10 } /* check for end-of-block code (better have one) */ if libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(state + 116 + 256*2))) == 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57841 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _10 } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ (*Tinflate_state)(unsafe.Pointer(state)).Fnext = state + 1332 (*Tinflate_state)(unsafe.Pointer(state)).Flencode = (*Tinflate_state)(unsafe.Pointer(state)).Fnext (*Tinflate_state)(unsafe.Pointer(state)).Flenbits = uint32(9) ret = Xinflate_table(tls, int32(LENS), state+116, (*Tinflate_state)(unsafe.Pointer(state)).Fnlen, state+112, state+88, state+756) if ret != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57878 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _10 } (*Tinflate_state)(unsafe.Pointer(state)).Fdistcode = (*Tinflate_state)(unsafe.Pointer(state)).Fnext (*Tinflate_state)(unsafe.Pointer(state)).Fdistbits = uint32(6) ret = Xinflate_table(tls, int32(DISTS), state+116+uintptr((*Tinflate_state)(unsafe.Pointer(state)).Fnlen)*2, (*Tinflate_state)(unsafe.Pointer(state)).Fndist, state+112, state+92, state+756) if ret != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57906 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _10 } (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(LEN) /* fallthrough */ _6: ; /* use inflate_fast() if we have enough input and output */ if have >= uint32(6) && left >= uint32(258) { (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out = put (*Tz_stream)(unsafe.Pointer(strm)).Favail_out = left (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in = *(*uintptr)(unsafe.Pointer(bp)) (*Tz_stream)(unsafe.Pointer(strm)).Favail_in = have (*Tinflate_state)(unsafe.Pointer(state)).Fhold = hold (*Tinflate_state)(unsafe.Pointer(state)).Fbits = bits if (*Tinflate_state)(unsafe.Pointer(state)).Fwhave < (*Tinflate_state)(unsafe.Pointer(state)).Fwsize { (*Tinflate_state)(unsafe.Pointer(state)).Fwhave = (*Tinflate_state)(unsafe.Pointer(state)).Fwsize - left } Xinflate_fast(tls, strm, (*Tinflate_state)(unsafe.Pointer(state)).Fwsize) put = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out left = (*Tz_stream)(unsafe.Pointer(strm)).Favail_out *(*uintptr)(unsafe.Pointer(bp)) = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in have = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in hold = (*Tinflate_state)(unsafe.Pointer(state)).Fhold bits = (*Tinflate_state)(unsafe.Pointer(state)).Fbits goto _10 } /* get a literal, length, or end-of-block code */ for { here = *(*Tcode)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Flencode + uintptr(hold&(libc.Uint32FromUint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Flenbits-libc.Uint32FromInt32(1)))*4)) if uint32(here.Fbits) <= bits { break } if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v33 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v33))) << bits bits += uint32(8) goto _32 _32: } if here.Fop != 0 && libc.Int32FromUint8(here.Fop)&int32(0xf0) == 0 { last = here for { here = *(*Tcode)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Flencode + uintptr(uint32(last.Fval)+hold&(uint32(1)<<(libc.Int32FromUint8(last.Fbits)+libc.Int32FromUint8(last.Fop))-uint32(1))>>last.Fbits)*4)) if libc.Uint32FromInt32(libc.Int32FromUint8(last.Fbits)+libc.Int32FromUint8(here.Fbits)) <= bits { break } if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v35 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v35))) << bits bits += uint32(8) goto _34 _34: } hold >>= uint32(last.Fbits) bits -= uint32(last.Fbits) } hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) (*Tinflate_state)(unsafe.Pointer(state)).Flength = uint32(here.Fval) /* process literal */ if libc.Int32FromUint8(here.Fop) == 0 { if left == uint32(0) { put = (*Tinflate_state)(unsafe.Pointer(state)).Fwindow left = (*Tinflate_state)(unsafe.Pointer(state)).Fwsize (*Tinflate_state)(unsafe.Pointer(state)).Fwhave = left if (*(*func(*libc.TLS, uintptr, uintptr, uint32) int32)(unsafe.Pointer(&struct{ uintptr }{out})))(tls, out_desc, put, left) != 0 { ret = -int32(5) goto inf_leave } } v36 = put put++ *(*uint8)(unsafe.Pointer(v36)) = uint8((*Tinflate_state)(unsafe.Pointer(state)).Flength) left-- (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(LEN) goto _10 } /* process end of block */ if libc.Int32FromUint8(here.Fop)&int32(32) != 0 { (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TYPE) goto _10 } /* invalid code */ if libc.Int32FromUint8(here.Fop)&int32(64) != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57928 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _10 } /* length code -- get extra bits, if any */ (*Tinflate_state)(unsafe.Pointer(state)).Fextra = uint32(here.Fop) & uint32(15) if (*Tinflate_state)(unsafe.Pointer(state)).Fextra != uint32(0) { for bits < (*Tinflate_state)(unsafe.Pointer(state)).Fextra { if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v37 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v37))) << bits bits += uint32(8) } *(*uint32)(unsafe.Pointer(state + 68)) += hold & (uint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Fextra - uint32(1)) hold >>= (*Tinflate_state)(unsafe.Pointer(state)).Fextra bits -= (*Tinflate_state)(unsafe.Pointer(state)).Fextra } /* get distance code */ for { here = *(*Tcode)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fdistcode + uintptr(hold&(libc.Uint32FromUint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Fdistbits-libc.Uint32FromInt32(1)))*4)) if uint32(here.Fbits) <= bits { break } if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v39 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v39))) << bits bits += uint32(8) goto _38 _38: } if libc.Int32FromUint8(here.Fop)&int32(0xf0) == 0 { last = here for { here = *(*Tcode)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fdistcode + uintptr(uint32(last.Fval)+hold&(uint32(1)<<(libc.Int32FromUint8(last.Fbits)+libc.Int32FromUint8(last.Fop))-uint32(1))>>last.Fbits)*4)) if libc.Uint32FromInt32(libc.Int32FromUint8(last.Fbits)+libc.Int32FromUint8(here.Fbits)) <= bits { break } if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v41 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v41))) << bits bits += uint32(8) goto _40 _40: } hold >>= uint32(last.Fbits) bits -= uint32(last.Fbits) } hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) if libc.Int32FromUint8(here.Fop)&int32(64) != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57956 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _10 } (*Tinflate_state)(unsafe.Pointer(state)).Foffset = uint32(here.Fval) /* get distance extra bits, if any */ (*Tinflate_state)(unsafe.Pointer(state)).Fextra = uint32(here.Fop) & uint32(15) if (*Tinflate_state)(unsafe.Pointer(state)).Fextra != uint32(0) { for bits < (*Tinflate_state)(unsafe.Pointer(state)).Fextra { if have == uint32(0) { have = (*(*func(*libc.TLS, uintptr, uintptr) uint32)(unsafe.Pointer(&struct{ uintptr }{in})))(tls, in_desc, bp) if have == uint32(0) { *(*uintptr)(unsafe.Pointer(bp)) = uintptr(Z_NULL) ret = -int32(5) goto inf_leave } } have-- v42 = *(*uintptr)(unsafe.Pointer(bp)) *(*uintptr)(unsafe.Pointer(bp))++ hold += uint32(*(*uint8)(unsafe.Pointer(v42))) << bits bits += uint32(8) } *(*uint32)(unsafe.Pointer(state + 72)) += hold & (uint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Fextra - uint32(1)) hold >>= (*Tinflate_state)(unsafe.Pointer(state)).Fextra bits -= (*Tinflate_state)(unsafe.Pointer(state)).Fextra } if (*Tinflate_state)(unsafe.Pointer(state)).Fwhave < (*Tinflate_state)(unsafe.Pointer(state)).Fwsize { v43 = left } else { v43 = uint32(0) } if (*Tinflate_state)(unsafe.Pointer(state)).Foffset > (*Tinflate_state)(unsafe.Pointer(state)).Fwsize-v43 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57978 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _10 } /* copy match from window to output */ for cond := true; cond; cond = (*Tinflate_state)(unsafe.Pointer(state)).Flength != uint32(0) { if left == uint32(0) { put = (*Tinflate_state)(unsafe.Pointer(state)).Fwindow left = (*Tinflate_state)(unsafe.Pointer(state)).Fwsize (*Tinflate_state)(unsafe.Pointer(state)).Fwhave = left if (*(*func(*libc.TLS, uintptr, uintptr, uint32) int32)(unsafe.Pointer(&struct{ uintptr }{out})))(tls, out_desc, put, left) != 0 { ret = -int32(5) goto inf_leave } } copy1 = (*Tinflate_state)(unsafe.Pointer(state)).Fwsize - (*Tinflate_state)(unsafe.Pointer(state)).Foffset if copy1 < left { from = put + uintptr(copy1) copy1 = left - copy1 } else { from = put - uintptr((*Tinflate_state)(unsafe.Pointer(state)).Foffset) copy1 = left } if copy1 > (*Tinflate_state)(unsafe.Pointer(state)).Flength { copy1 = (*Tinflate_state)(unsafe.Pointer(state)).Flength } *(*uint32)(unsafe.Pointer(state + 68)) -= copy1 left -= copy1 for { v46 = put put++ v47 = from from++ *(*uint8)(unsafe.Pointer(v46)) = *(*uint8)(unsafe.Pointer(v47)) goto _45 _45: ; copy1-- v44 = copy1 if !(v44 != 0) { break } } } goto _10 _7: ; /* inflate stream terminated properly */ ret = int32(Z_STREAM_END) goto inf_leave _8: ; ret = -int32(3) goto inf_leave _9: ; /* can't happen, but makes compilers happy */ ret = -int32(2) goto inf_leave _10: ; goto _2 _2: } /* Write leftover output and return unused input */ goto inf_leave inf_leave: ; if left < (*Tinflate_state)(unsafe.Pointer(state)).Fwsize { if (*(*func(*libc.TLS, uintptr, uintptr, uint32) int32)(unsafe.Pointer(&struct{ uintptr }{out})))(tls, out_desc, (*Tinflate_state)(unsafe.Pointer(state)).Fwindow, (*Tinflate_state)(unsafe.Pointer(state)).Fwsize-left) != 0 && ret == int32(Z_STREAM_END) { ret = -int32(5) } } (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in = *(*uintptr)(unsafe.Pointer(bp)) (*Tz_stream)(unsafe.Pointer(strm)).Favail_in = have return ret } var _order = [19]uint16{ 0: uint16(16), 1: uint16(17), 2: uint16(18), 4: uint16(8), 5: uint16(7), 6: uint16(9), 7: uint16(6), 8: uint16(10), 9: uint16(5), 10: uint16(11), 11: uint16(4), 12: uint16(12), 13: uint16(3), 14: uint16(13), 15: uint16(2), 16: uint16(14), 17: uint16(1), 18: uint16(15), } func XinflateBackEnd(tls *libc.TLS, strm Tz_streamp) (r int32) { if strm == uintptr(Z_NULL) || (*Tz_stream)(unsafe.Pointer(strm)).Fstate == uintptr(Z_NULL) || (*Tz_stream)(unsafe.Pointer(strm)).Fzfree == libc.UintptrFromInt32(0) { return -int32(2) } (*(*func(*libc.TLS, Tvoidpf, Tvoidpf))(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzfree})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tz_stream)(unsafe.Pointer(strm)).Fstate) (*Tz_stream)(unsafe.Pointer(strm)).Fstate = uintptr(Z_NULL) return Z_OK } // C documentation // // /* // Decode literal, length, and distance codes and write out the resulting // literal and match bytes until either not enough input or output is // available, an end-of-block is encountered, or a data error is encountered. // When large enough input and output buffers are supplied to inflate(), for // example, a 16K input buffer and a 64K output buffer, more than 95% of the // inflate execution time is spent in this routine. // // Entry assumptions: // // state->mode == LEN // strm->avail_in >= 6 // strm->avail_out >= 258 // start >= strm->avail_out // state->bits < 8 // // On return, state->mode is one of: // // LEN -- ran out of enough output space or enough available input // TYPE -- reached end of block code, inflate() to interpret next block // BAD -- error in block data // // Notes: // // - The maximum input bits used by a length/distance pair is 15 bits for the // length code, 5 bits for the length extra, 15 bits for the distance code, // and 13 bits for the distance extra. This totals 48 bits, or six bytes. // Therefore if strm->avail_in >= 6, then there is enough input to avoid // checking for available input while decoding. // // - The maximum bytes that a single length/distance pair can output is 258 // bytes, which is the maximum length that can be coded. inflate_fast() // requires strm->avail_out >= 258 for each loop to avoid checking for // output space. // */ func Xinflate_fast(tls *libc.TLS, strm Tz_streamp, start uint32) { var beg, dcode, end, from, here, in, last, lcode, out, state, window, v1, v11, v12, v15, v16, v19, v2, v20, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v5, v6, v7, v8 uintptr var bits, dist, dmask, hold, len1, lmask, op, whave, wnext, wsize, v13, v17, v21, v9 uint32 var v45, v46 int32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = beg, bits, dcode, dist, dmask, end, from, here, hold, in, last, lcode, len1, lmask, op, out, state, whave, window, wnext, wsize, v1, v11, v12, v13, v15, v16, v17, v19, v2, v20, v21, v23, v24, v25, v26, v27, v28, v29, v3, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v4, v40, v41, v42, v43, v44, v45, v46, v5, v6, v7, v8, v9 /* where to copy match from */ /* copy state to local variables */ state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate in = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in last = in + uintptr((*Tz_stream)(unsafe.Pointer(strm)).Favail_in-libc.Uint32FromInt32(5)) out = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out beg = out - uintptr(start-(*Tz_stream)(unsafe.Pointer(strm)).Favail_out) end = out + uintptr((*Tz_stream)(unsafe.Pointer(strm)).Favail_out-libc.Uint32FromInt32(257)) wsize = (*Tinflate_state)(unsafe.Pointer(state)).Fwsize whave = (*Tinflate_state)(unsafe.Pointer(state)).Fwhave wnext = (*Tinflate_state)(unsafe.Pointer(state)).Fwnext window = (*Tinflate_state)(unsafe.Pointer(state)).Fwindow hold = (*Tinflate_state)(unsafe.Pointer(state)).Fhold bits = (*Tinflate_state)(unsafe.Pointer(state)).Fbits lcode = (*Tinflate_state)(unsafe.Pointer(state)).Flencode dcode = (*Tinflate_state)(unsafe.Pointer(state)).Fdistcode lmask = uint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Flenbits - uint32(1) dmask = uint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Fdistbits - uint32(1) /* decode literals and length/distances until end-of-block or not enough input data or output space */ for cond := true; cond; cond = in < last && out < end { if bits < uint32(15) { v1 = in in++ hold += uint32(*(*uint8)(unsafe.Pointer(v1))) << bits bits += uint32(8) v2 = in in++ hold += uint32(*(*uint8)(unsafe.Pointer(v2))) << bits bits += uint32(8) } here = lcode + uintptr(hold&lmask)*4 goto dolen dolen: ; op = uint32((*Tcode)(unsafe.Pointer(here)).Fbits) hold >>= op bits -= op op = uint32((*Tcode)(unsafe.Pointer(here)).Fop) if op == uint32(0) { /* literal */ v3 = out out++ *(*uint8)(unsafe.Pointer(v3)) = uint8((*Tcode)(unsafe.Pointer(here)).Fval) } else { if op&uint32(16) != 0 { /* length base */ len1 = uint32((*Tcode)(unsafe.Pointer(here)).Fval) op &= uint32(15) /* number of extra bits */ if op != 0 { if bits < op { v4 = in in++ hold += uint32(*(*uint8)(unsafe.Pointer(v4))) << bits bits += uint32(8) } len1 += hold & (uint32(1)<>= op bits -= op } if bits < uint32(15) { v5 = in in++ hold += uint32(*(*uint8)(unsafe.Pointer(v5))) << bits bits += uint32(8) v6 = in in++ hold += uint32(*(*uint8)(unsafe.Pointer(v6))) << bits bits += uint32(8) } here = dcode + uintptr(hold&dmask)*4 goto dodist dodist: ; op = uint32((*Tcode)(unsafe.Pointer(here)).Fbits) hold >>= op bits -= op op = uint32((*Tcode)(unsafe.Pointer(here)).Fop) if op&uint32(16) != 0 { /* distance base */ dist = uint32((*Tcode)(unsafe.Pointer(here)).Fval) op &= uint32(15) /* number of extra bits */ if bits < op { v7 = in in++ hold += uint32(*(*uint8)(unsafe.Pointer(v7))) << bits bits += uint32(8) if bits < op { v8 = in in++ hold += uint32(*(*uint8)(unsafe.Pointer(v8))) << bits bits += uint32(8) } } dist += hold & (uint32(1)<>= op bits -= op op = libc.Uint32FromInt32(int32(out) - int32(beg)) /* max distance in output */ if dist > op { /* see if copy from window */ op = dist - op /* distance back in window */ if op > whave { if (*Tinflate_state)(unsafe.Pointer(state)).Fsane != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57978 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) break } } from = window if wnext == uint32(0) { /* very common case */ from += uintptr(wsize - op) if op < len1 { /* some from window */ len1 -= op for { v11 = out out++ v12 = from from++ *(*uint8)(unsafe.Pointer(v11)) = *(*uint8)(unsafe.Pointer(v12)) goto _10 _10: ; op-- v9 = op if !(v9 != 0) { break } } from = out - uintptr(dist) /* rest from output */ } } else { if wnext < op { /* wrap around window */ from += uintptr(wsize + wnext - op) op -= wnext if op < len1 { /* some from end of window */ len1 -= op for { v15 = out out++ v16 = from from++ *(*uint8)(unsafe.Pointer(v15)) = *(*uint8)(unsafe.Pointer(v16)) goto _14 _14: ; op-- v13 = op if !(v13 != 0) { break } } from = window if wnext < len1 { /* some from start of window */ op = wnext len1 -= op for { v19 = out out++ v20 = from from++ *(*uint8)(unsafe.Pointer(v19)) = *(*uint8)(unsafe.Pointer(v20)) goto _18 _18: ; op-- v17 = op if !(v17 != 0) { break } } from = out - uintptr(dist) /* rest from output */ } } } else { /* contiguous in window */ from += uintptr(wnext - op) if op < len1 { /* some from window */ len1 -= op for { v23 = out out++ v24 = from from++ *(*uint8)(unsafe.Pointer(v23)) = *(*uint8)(unsafe.Pointer(v24)) goto _22 _22: ; op-- v21 = op if !(v21 != 0) { break } } from = out - uintptr(dist) /* rest from output */ } } } for len1 > uint32(2) { v25 = out out++ v26 = from from++ *(*uint8)(unsafe.Pointer(v25)) = *(*uint8)(unsafe.Pointer(v26)) v27 = out out++ v28 = from from++ *(*uint8)(unsafe.Pointer(v27)) = *(*uint8)(unsafe.Pointer(v28)) v29 = out out++ v30 = from from++ *(*uint8)(unsafe.Pointer(v29)) = *(*uint8)(unsafe.Pointer(v30)) len1 -= uint32(3) } if len1 != 0 { v31 = out out++ v32 = from from++ *(*uint8)(unsafe.Pointer(v31)) = *(*uint8)(unsafe.Pointer(v32)) if len1 > uint32(1) { v33 = out out++ v34 = from from++ *(*uint8)(unsafe.Pointer(v33)) = *(*uint8)(unsafe.Pointer(v34)) } } } else { from = out - uintptr(dist) /* copy direct from output */ for cond := true; cond; cond = len1 > uint32(2) { /* minimum length is three */ v35 = out out++ v36 = from from++ *(*uint8)(unsafe.Pointer(v35)) = *(*uint8)(unsafe.Pointer(v36)) v37 = out out++ v38 = from from++ *(*uint8)(unsafe.Pointer(v37)) = *(*uint8)(unsafe.Pointer(v38)) v39 = out out++ v40 = from from++ *(*uint8)(unsafe.Pointer(v39)) = *(*uint8)(unsafe.Pointer(v40)) len1 -= uint32(3) } if len1 != 0 { v41 = out out++ v42 = from from++ *(*uint8)(unsafe.Pointer(v41)) = *(*uint8)(unsafe.Pointer(v42)) if len1 > uint32(1) { v43 = out out++ v44 = from from++ *(*uint8)(unsafe.Pointer(v43)) = *(*uint8)(unsafe.Pointer(v44)) } } } } else { if op&uint32(64) == uint32(0) { /* 2nd level distance code */ here = dcode + uintptr((*Tcode)(unsafe.Pointer(here)).Fval)*4 + uintptr(hold&(libc.Uint32FromUint32(1)<> int32(3) in -= uintptr(len1) bits -= len1 << int32(3) hold &= uint32(1)< int32(SYNC) { return int32(1) } return 0 } func XinflateResetKeep(tls *libc.TLS, strm Tz_streamp) (r int32) { var state, v3, v4 uintptr var v1 TuLong var v2 uint32 _, _, _, _, _ = state, v1, v2, v3, v4 if _inflateStateCheck(tls, strm) != 0 { return -int32(2) } state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate v2 = libc.Uint32FromInt32(0) (*Tinflate_state)(unsafe.Pointer(state)).Ftotal = v2 v1 = v2 (*Tz_stream)(unsafe.Pointer(strm)).Ftotal_out = v1 (*Tz_stream)(unsafe.Pointer(strm)).Ftotal_in = v1 (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = uintptr(Z_NULL) if (*Tinflate_state)(unsafe.Pointer(state)).Fwrap != 0 { /* to support ill-conceived Java test suite */ (*Tz_stream)(unsafe.Pointer(strm)).Fadler = libc.Uint32FromInt32((*Tinflate_state)(unsafe.Pointer(state)).Fwrap & int32(1)) } (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(HEAD) (*Tinflate_state)(unsafe.Pointer(state)).Flast = 0 (*Tinflate_state)(unsafe.Pointer(state)).Fhavedict = 0 (*Tinflate_state)(unsafe.Pointer(state)).Fflags = -int32(1) (*Tinflate_state)(unsafe.Pointer(state)).Fdmax = uint32(32768) (*Tinflate_state)(unsafe.Pointer(state)).Fhead = uintptr(Z_NULL) (*Tinflate_state)(unsafe.Pointer(state)).Fhold = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fbits = uint32(0) v4 = state + 1332 (*Tinflate_state)(unsafe.Pointer(state)).Fnext = v4 v3 = v4 (*Tinflate_state)(unsafe.Pointer(state)).Fdistcode = v3 (*Tinflate_state)(unsafe.Pointer(state)).Flencode = v3 (*Tinflate_state)(unsafe.Pointer(state)).Fsane = int32(1) (*Tinflate_state)(unsafe.Pointer(state)).Fback = -int32(1) return Z_OK } func XinflateReset(tls *libc.TLS, strm Tz_streamp) (r int32) { var state uintptr _ = state if _inflateStateCheck(tls, strm) != 0 { return -int32(2) } state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate (*Tinflate_state)(unsafe.Pointer(state)).Fwsize = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fwhave = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fwnext = uint32(0) return XinflateResetKeep(tls, strm) } func XinflateReset2(tls *libc.TLS, strm Tz_streamp, windowBits int32) (r int32) { var state uintptr var wrap int32 _, _ = state, wrap /* get the state */ if _inflateStateCheck(tls, strm) != 0 { return -int32(2) } state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate /* extract wrap request from windowBits parameter */ if windowBits < 0 { if windowBits < -int32(15) { return -int32(2) } wrap = 0 windowBits = -windowBits } else { wrap = windowBits>>int32(4) + int32(5) if windowBits < int32(48) { windowBits &= int32(15) } } /* set number of window bits, free window if different */ if windowBits != 0 && (windowBits < int32(8) || windowBits > int32(15)) { return -int32(2) } if (*Tinflate_state)(unsafe.Pointer(state)).Fwindow != uintptr(Z_NULL) && (*Tinflate_state)(unsafe.Pointer(state)).Fwbits != libc.Uint32FromInt32(windowBits) { (*(*func(*libc.TLS, Tvoidpf, Tvoidpf))(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzfree})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, (*Tinflate_state)(unsafe.Pointer(state)).Fwindow) (*Tinflate_state)(unsafe.Pointer(state)).Fwindow = uintptr(Z_NULL) } /* update state and reset the rest of it */ (*Tinflate_state)(unsafe.Pointer(state)).Fwrap = wrap (*Tinflate_state)(unsafe.Pointer(state)).Fwbits = libc.Uint32FromInt32(windowBits) return XinflateReset(tls, strm) } func XinflateInit2_(tls *libc.TLS, strm Tz_streamp, windowBits int32, version uintptr, stream_size int32) (r int32) { var ret int32 var state uintptr _, _ = ret, state if version == uintptr(Z_NULL) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(version))) != libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(__ccgo_ts + 15959))) || stream_size != libc.Int32FromUint32(libc.Uint32FromInt64(56)) { return -int32(6) } if strm == uintptr(Z_NULL) { return -int32(2) } (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = uintptr(Z_NULL) /* in case we return an error */ if (*Tz_stream)(unsafe.Pointer(strm)).Fzalloc == libc.UintptrFromInt32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fzalloc = __ccgo_fp(Xzcalloc) (*Tz_stream)(unsafe.Pointer(strm)).Fopaque = libc.UintptrFromInt32(0) } if (*Tz_stream)(unsafe.Pointer(strm)).Fzfree == libc.UintptrFromInt32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fzfree = __ccgo_fp(Xzcfree) } state = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, libc.Uint32FromInt32(libc.Int32FromInt32(1)), libc.Uint32FromInt64(7120)) if state == uintptr(Z_NULL) { return -int32(4) } (*Tz_stream)(unsafe.Pointer(strm)).Fstate = state (*Tinflate_state)(unsafe.Pointer(state)).Fstrm = strm (*Tinflate_state)(unsafe.Pointer(state)).Fwindow = uintptr(Z_NULL) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(HEAD) /* to pass state test in inflateReset2() */ ret = XinflateReset2(tls, strm, windowBits) if ret != Z_OK { (*(*func(*libc.TLS, Tvoidpf, Tvoidpf))(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(strm)).Fzfree})))(tls, (*Tz_stream)(unsafe.Pointer(strm)).Fopaque, state) (*Tz_stream)(unsafe.Pointer(strm)).Fstate = uintptr(Z_NULL) } return ret } func XinflateInit_(tls *libc.TLS, strm Tz_streamp, version uintptr, stream_size int32) (r int32) { return XinflateInit2_(tls, strm, int32(MAX_WBITS), version, stream_size) } func XinflatePrime(tls *libc.TLS, strm Tz_streamp, bits int32, value int32) (r int32) { var state uintptr _ = state if _inflateStateCheck(tls, strm) != 0 { return -int32(2) } if bits == 0 { return Z_OK } state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate if bits < 0 { (*Tinflate_state)(unsafe.Pointer(state)).Fhold = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fbits = uint32(0) return Z_OK } if bits > int32(16) || (*Tinflate_state)(unsafe.Pointer(state)).Fbits+libc.Uint32FromInt32(bits) > uint32(32) { return -int32(2) } value = value & (libc.Int32FromInt32(1)<wsize or less output bytes into the circular window */ if copy1 >= (*Tinflate_state)(unsafe.Pointer(state)).Fwsize { libc.Xmemcpy(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fwindow, end-uintptr((*Tinflate_state)(unsafe.Pointer(state)).Fwsize), (*Tinflate_state)(unsafe.Pointer(state)).Fwsize) (*Tinflate_state)(unsafe.Pointer(state)).Fwnext = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fwhave = (*Tinflate_state)(unsafe.Pointer(state)).Fwsize } else { dist = (*Tinflate_state)(unsafe.Pointer(state)).Fwsize - (*Tinflate_state)(unsafe.Pointer(state)).Fwnext if dist > copy1 { dist = copy1 } libc.Xmemcpy(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fwindow+uintptr((*Tinflate_state)(unsafe.Pointer(state)).Fwnext), end-uintptr(copy1), dist) copy1 -= dist if copy1 != 0 { libc.Xmemcpy(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fwindow, end-uintptr(copy1), copy1) (*Tinflate_state)(unsafe.Pointer(state)).Fwnext = copy1 (*Tinflate_state)(unsafe.Pointer(state)).Fwhave = (*Tinflate_state)(unsafe.Pointer(state)).Fwsize } else { *(*uint32)(unsafe.Pointer(state + 52)) += dist if (*Tinflate_state)(unsafe.Pointer(state)).Fwnext == (*Tinflate_state)(unsafe.Pointer(state)).Fwsize { (*Tinflate_state)(unsafe.Pointer(state)).Fwnext = uint32(0) } if (*Tinflate_state)(unsafe.Pointer(state)).Fwhave < (*Tinflate_state)(unsafe.Pointer(state)).Fwsize { *(*uint32)(unsafe.Pointer(state + 48)) += dist } } } return 0 } /* Macros for inflate(): */ /* check function to use adler32() for zlib or crc32() for gzip */ /* check macros for header crc */ /* Load registers with state in inflate() for speed */ /* Restore state from registers in inflate() */ /* Clear the input bit accumulator */ /* Get a byte of input into the bit accumulator, or return from inflate() if there is no input available. */ /* Assure that there are at least n bits in the bit accumulator. If there is not enough available input to do that, then return from inflate(). */ /* Return the low n bits of the bit accumulator (n < 16) */ /* Remove n bits from the bit accumulator */ /* Remove zero to seven bits as needed to go to a byte boundary */ /* inflate() uses a state machine to process as much input data and generate as much output data as possible before returning. The state machine is structured roughly as follows: for (;;) switch (state) { ... case STATEn: if (not enough input data or output space to make progress) return; ... make progress ... state = STATEm; break; ... } so when inflate() is called again, the same case is attempted again, and if the appropriate resources are provided, the machine proceeds to the next state. The NEEDBITS() macro is usually the way the state evaluates whether it can proceed or should return. NEEDBITS() does the return if the requested bits are not available. The typical use of the BITS macros is: NEEDBITS(n); ... do something with BITS(n) ... DROPBITS(n); where NEEDBITS(n) either returns from inflate() if there isn't enough input left to load n bits into the accumulator, or it continues. BITS(n) gives the low n bits in the accumulator. When done, DROPBITS(n) drops the low n bits off the accumulator. INITBITS() clears the accumulator and sets the number of available bits to zero. BYTEBITS() discards just enough bits to put the accumulator on a byte boundary. After BYTEBITS() and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return if there is no input available. The decoding of variable length codes uses PULLBYTE() directly in order to pull just enough bytes to decode the next code, and no more. Some states loop until they get enough input, making sure that enough state information is maintained to continue the loop where it left off if NEEDBITS() returns in the loop. For example, want, need, and keep would all have to actually be part of the saved state in case NEEDBITS() returns: case STATEw: while (want < need) { NEEDBITS(n); keep[want++] = BITS(n); DROPBITS(n); } state = STATEx; case STATEx: As shown above, if the next state is also the next case, then the break is omitted. A state may also return if there is not enough output space available to complete that state. Those states are copying stored data, writing a literal byte, and copying a matching string. When returning, a "goto inf_leave" is used to update the total counters, update the check value, and determine whether any progress has been made during that inflate() call in order to return the proper return code. Progress is defined as a change in either strm->avail_in or strm->avail_out. When there is a window, goto inf_leave will update the window with the last output written. If a goto inf_leave occurs in the middle of decompression and there is no window currently, goto inf_leave will create one and copy output to the window for the next call of inflate(). In this implementation, the flush parameter of inflate() only affects the return code (per zlib.h). inflate() always writes as much as possible to strm->next_out, given the space available and the provided input--the effect documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers the allocation of and copying into a sliding window until necessary, which provides the effect documented in zlib.h for Z_FINISH when the entire input stream available. So the only thing the flush parameter actually does is: when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it will return Z_BUF_ERROR if it has not reached the end of the stream. */ func Xinflate(tls *libc.TLS, strm Tz_streamp, flush int32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var bits, copy1, have, hold, in, left, len1, out, v101, v102, v37, v46, v48, v49, v50, v52, v53, v56, v58, v59, v64, v66, v70, v75, v76, v90, v96, v97, v98 uint32 var from, next, put, state, v100, v36, v42, v43, v44, v45, v51, v54, v55, v57, v60, v61, v62, v63, v65, v67, v69, v71, v72, v73, v74, v77, v79, v81, v82, v85, v87, v88, v92, v93, v94, v95, p83, p89 uintptr var here, last Tcode var ret, v103, v104, v105, v38 int32 var v47, v99 bool var _ /* hbuf at bp+0 */ [4]uint8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bits, copy1, from, have, here, hold, in, last, left, len1, next, out, put, ret, state, v100, v101, v102, v103, v104, v105, v36, v37, v38, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63, v64, v65, v66, v67, v69, v70, v71, v72, v73, v74, v75, v76, v77, v79, v81, v82, v85, v87, v88, v90, v92, v93, v94, v95, v96, v97, v98, v99, p83, p89 /* buffer for gzip header crc calculation */ if _inflateStateCheck(tls, strm) != 0 || (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out == uintptr(Z_NULL) || (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in == uintptr(Z_NULL) && (*Tz_stream)(unsafe.Pointer(strm)).Favail_in != uint32(0) { return -int32(2) } state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate if (*Tinflate_state)(unsafe.Pointer(state)).Fmode == int32(TYPE) { (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TYPEDO) } /* skip check */ put = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out left = (*Tz_stream)(unsafe.Pointer(strm)).Favail_out next = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in have = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in hold = (*Tinflate_state)(unsafe.Pointer(state)).Fhold bits = (*Tinflate_state)(unsafe.Pointer(state)).Fbits in = have out = left ret = Z_OK for { switch (*Tinflate_state)(unsafe.Pointer(state)).Fmode { case int32(HEAD): goto _2 case int32(FLAGS): goto _3 case int32(TIME): goto _4 case int32(OS): goto _5 case int32(EXLEN): goto _6 case int32(EXTRA): goto _7 case int32(NAME): goto _8 case int32(COMMENT): goto _9 case int32(HCRC): goto _10 case int32(DICTID): goto _11 case int32(DICT): goto _12 case int32(TYPE): goto _13 case int32(TYPEDO): goto _14 case int32(STORED): goto _15 case int32(COPY_): goto _16 case int32(COPY1): goto _17 case int32(TABLE): goto _18 case int32(LENLENS): goto _19 case int32(CODELENS): goto _20 case int32(LEN_): goto _21 case int32(LEN): goto _22 case int32(LENEXT): goto _23 case int32(DIST): goto _24 case int32(DISTEXT): goto _25 case int32(MATCH): goto _26 case int32(LIT): goto _27 case int32(CHECK): goto _28 case int32(LENGTH): goto _29 case int32(DONE): goto _30 case int32(BAD): goto _31 case int32(MEM): goto _32 default: goto _33 case int32(SYNC): goto _34 } goto _35 _2: ; if (*Tinflate_state)(unsafe.Pointer(state)).Fwrap == 0 { (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TYPEDO) goto _35 } for bits < libc.Uint32FromInt32(libc.Int32FromInt32(16)) { if have == uint32(0) { goto inf_leave } have-- v36 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v36))) << bits bits += uint32(8) } if (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(2) != 0 && hold == uint32(0x8b1f) { /* gzip header */ if (*Tinflate_state)(unsafe.Pointer(state)).Fwbits == uint32(0) { (*Tinflate_state)(unsafe.Pointer(state)).Fwbits = uint32(15) } (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = Xcrc32(tls, uint32(0), uintptr(Z_NULL), uint32(0)) (*(*[4]uint8)(unsafe.Pointer(bp)))[0] = uint8(hold) (*(*[4]uint8)(unsafe.Pointer(bp)))[int32(1)] = uint8(hold >> libc.Int32FromInt32(8)) (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = Xcrc32(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fcheck, bp, uint32(2)) hold = uint32(0) bits = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(FLAGS) goto _35 } if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) { (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fdone = -int32(1) } if !((*Tinflate_state)(unsafe.Pointer(state)).Fwrap&libc.Int32FromInt32(1) != 0) || (hold&(libc.Uint32FromUint32(1)<>int32(8))%uint32(31) != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 58008 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } if hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(4)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(4)) len1 = hold&(libc.Uint32FromUint32(1)< uint32(15) || len1 > (*Tinflate_state)(unsafe.Pointer(state)).Fwbits { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 58058 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } (*Tinflate_state)(unsafe.Pointer(state)).Fdmax = uint32(1) << len1 (*Tinflate_state)(unsafe.Pointer(state)).Fflags = 0 /* indicate zlib header */ v37 = Xadler32(tls, uint32(0), uintptr(Z_NULL), uint32(0)) (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = v37 (*Tz_stream)(unsafe.Pointer(strm)).Fadler = v37 if hold&uint32(0x200) != 0 { v38 = int32(DICTID) } else { v38 = int32(TYPE) } (*Tinflate_state)(unsafe.Pointer(state)).Fmode = v38 hold = uint32(0) bits = uint32(0) goto _35 _3: ; _41: ; for bits < libc.Uint32FromInt32(libc.Int32FromInt32(16)) { if have == uint32(0) { goto inf_leave } have-- v42 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v42))) << bits bits += uint32(8) } goto _40 _40: ; if 0 != 0 { goto _41 } goto _39 _39: ; (*Tinflate_state)(unsafe.Pointer(state)).Fflags = libc.Int32FromUint32(hold) if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0xff) != int32(Z_DEFLATED) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 58031 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0xe000) != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 58078 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) { (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Ftext = libc.Int32FromUint32(hold >> libc.Int32FromInt32(8) & libc.Uint32FromInt32(1)) } if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0200) != 0 && (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(4) != 0 { (*(*[4]uint8)(unsafe.Pointer(bp)))[0] = uint8(hold) (*(*[4]uint8)(unsafe.Pointer(bp)))[int32(1)] = uint8(hold >> libc.Int32FromInt32(8)) (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = Xcrc32(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fcheck, bp, uint32(2)) } hold = uint32(0) bits = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TIME) /* fallthrough */ _4: ; for bits < libc.Uint32FromInt32(libc.Int32FromInt32(32)) { if have == uint32(0) { goto inf_leave } have-- v43 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v43))) << bits bits += uint32(8) } if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) { (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Ftime = hold } if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0200) != 0 && (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(4) != 0 { (*(*[4]uint8)(unsafe.Pointer(bp)))[0] = uint8(hold) (*(*[4]uint8)(unsafe.Pointer(bp)))[int32(1)] = uint8(hold >> libc.Int32FromInt32(8)) (*(*[4]uint8)(unsafe.Pointer(bp)))[int32(2)] = uint8(hold >> libc.Int32FromInt32(16)) (*(*[4]uint8)(unsafe.Pointer(bp)))[int32(3)] = uint8(hold >> libc.Int32FromInt32(24)) (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = Xcrc32(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fcheck, bp, uint32(4)) } hold = uint32(0) bits = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(OS) /* fallthrough */ _5: ; for bits < libc.Uint32FromInt32(libc.Int32FromInt32(16)) { if have == uint32(0) { goto inf_leave } have-- v44 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v44))) << bits bits += uint32(8) } if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) { (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fxflags = libc.Int32FromUint32(hold & libc.Uint32FromInt32(0xff)) (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fos = libc.Int32FromUint32(hold >> libc.Int32FromInt32(8)) } if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0200) != 0 && (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(4) != 0 { (*(*[4]uint8)(unsafe.Pointer(bp)))[0] = uint8(hold) (*(*[4]uint8)(unsafe.Pointer(bp)))[int32(1)] = uint8(hold >> libc.Int32FromInt32(8)) (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = Xcrc32(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fcheck, bp, uint32(2)) } hold = uint32(0) bits = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(EXLEN) /* fallthrough */ _6: ; if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0400) != 0 { for bits < libc.Uint32FromInt32(libc.Int32FromInt32(16)) { if have == uint32(0) { goto inf_leave } have-- v45 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v45))) << bits bits += uint32(8) } (*Tinflate_state)(unsafe.Pointer(state)).Flength = hold if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) { (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fextra_len = hold } if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0200) != 0 && (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(4) != 0 { (*(*[4]uint8)(unsafe.Pointer(bp)))[0] = uint8(hold) (*(*[4]uint8)(unsafe.Pointer(bp)))[int32(1)] = uint8(hold >> libc.Int32FromInt32(8)) (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = Xcrc32(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fcheck, bp, uint32(2)) } hold = uint32(0) bits = uint32(0) } else { if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) { (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fextra = uintptr(Z_NULL) } } (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(EXTRA) /* fallthrough */ _7: ; if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0400) != 0 { copy1 = (*Tinflate_state)(unsafe.Pointer(state)).Flength if copy1 > have { copy1 = have } if copy1 != 0 { if v47 = (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) && (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fextra != uintptr(Z_NULL); v47 { v46 = (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fextra_len - (*Tinflate_state)(unsafe.Pointer(state)).Flength len1 = v46 } if v47 && v46 < (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fextra_max { if len1+copy1 > (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fextra_max { v48 = (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fextra_max - len1 } else { v48 = copy1 } libc.Xmemcpy(tls, (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fextra+uintptr(len1), next, v48) } if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0200) != 0 && (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(4) != 0 { (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = Xcrc32(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fcheck, next, copy1) } have -= copy1 next += uintptr(copy1) *(*uint32)(unsafe.Pointer(state + 68)) -= copy1 } if (*Tinflate_state)(unsafe.Pointer(state)).Flength != 0 { goto inf_leave } } (*Tinflate_state)(unsafe.Pointer(state)).Flength = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(NAME) /* fallthrough */ _8: ; if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0800) != 0 { if have == uint32(0) { goto inf_leave } copy1 = uint32(0) for cond := true; cond; cond = len1 != 0 && copy1 < have { v49 = copy1 copy1++ len1 = uint32(*(*uint8)(unsafe.Pointer(next + uintptr(v49)))) if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) && (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fname != uintptr(Z_NULL) && (*Tinflate_state)(unsafe.Pointer(state)).Flength < (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fname_max { v51 = state + 68 v50 = *(*uint32)(unsafe.Pointer(v51)) *(*uint32)(unsafe.Pointer(v51))++ *(*TBytef)(unsafe.Pointer((*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fname + uintptr(v50))) = uint8(len1) } } if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0200) != 0 && (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(4) != 0 { (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = Xcrc32(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fcheck, next, copy1) } have -= copy1 next += uintptr(copy1) if len1 != 0 { goto inf_leave } } else { if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) { (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fname = uintptr(Z_NULL) } } (*Tinflate_state)(unsafe.Pointer(state)).Flength = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(COMMENT) /* fallthrough */ _9: ; if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x1000) != 0 { if have == uint32(0) { goto inf_leave } copy1 = uint32(0) for cond := true; cond; cond = len1 != 0 && copy1 < have { v52 = copy1 copy1++ len1 = uint32(*(*uint8)(unsafe.Pointer(next + uintptr(v52)))) if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) && (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fcomment != uintptr(Z_NULL) && (*Tinflate_state)(unsafe.Pointer(state)).Flength < (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fcomm_max { v54 = state + 68 v53 = *(*uint32)(unsafe.Pointer(v54)) *(*uint32)(unsafe.Pointer(v54))++ *(*TBytef)(unsafe.Pointer((*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fcomment + uintptr(v53))) = uint8(len1) } } if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0200) != 0 && (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(4) != 0 { (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = Xcrc32(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fcheck, next, copy1) } have -= copy1 next += uintptr(copy1) if len1 != 0 { goto inf_leave } } else { if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) { (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fcomment = uintptr(Z_NULL) } } (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(HCRC) /* fallthrough */ _10: ; if (*Tinflate_state)(unsafe.Pointer(state)).Fflags&int32(0x0200) != 0 { for bits < libc.Uint32FromInt32(libc.Int32FromInt32(16)) { if have == uint32(0) { goto inf_leave } have-- v55 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v55))) << bits bits += uint32(8) } if (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(4) != 0 && hold != (*Tinflate_state)(unsafe.Pointer(state)).Fcheck&uint32(0xffff) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 58103 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } hold = uint32(0) bits = uint32(0) } if (*Tinflate_state)(unsafe.Pointer(state)).Fhead != uintptr(Z_NULL) { (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fhcrc = (*Tinflate_state)(unsafe.Pointer(state)).Fflags >> libc.Int32FromInt32(9) & libc.Int32FromInt32(1) (*Tgz_header)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fhead)).Fdone = int32(1) } v56 = Xcrc32(tls, uint32(0), uintptr(Z_NULL), uint32(0)) (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = v56 (*Tz_stream)(unsafe.Pointer(strm)).Fadler = v56 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TYPE) goto _35 _11: ; for bits < libc.Uint32FromInt32(libc.Int32FromInt32(32)) { if have == uint32(0) { goto inf_leave } have-- v57 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v57))) << bits bits += uint32(8) } v58 = hold>>libc.Int32FromInt32(24)&libc.Uint32FromInt32(0xff) + hold>>libc.Int32FromInt32(8)&libc.Uint32FromInt32(0xff00) + hold&libc.Uint32FromInt32(0xff00)<>= bits & uint32(7) bits -= bits & uint32(7) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(CHECK) goto _35 } for bits < libc.Uint32FromInt32(libc.Int32FromInt32(3)) { if have == uint32(0) { goto inf_leave } have-- v60 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v60))) << bits bits += uint32(8) } (*Tinflate_state)(unsafe.Pointer(state)).Flast = libc.Int32FromUint32(hold & (libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(1)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(1)) switch hold & (libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(2)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(2)) goto inf_leave } case uint32(2): /* dynamic block */ (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TABLE) case uint32(3): (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57706 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) } hold >>= libc.Uint32FromInt32(libc.Int32FromInt32(2)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(2)) goto _35 _15: ; hold >>= bits & uint32(7) bits -= bits & uint32(7) /* go to byte boundary */ for bits < libc.Uint32FromInt32(libc.Int32FromInt32(32)) { if have == uint32(0) { goto inf_leave } have-- v61 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v61))) << bits bits += uint32(8) } if hold&uint32(0xffff) != hold>>int32(16)^uint32(0xffff) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57725 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } (*Tinflate_state)(unsafe.Pointer(state)).Flength = hold & uint32(0xffff) hold = uint32(0) bits = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(COPY_) if flush == int32(Z_TREES) { goto inf_leave } /* fallthrough */ _16: ; (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(COPY1) /* fallthrough */ _17: ; copy1 = (*Tinflate_state)(unsafe.Pointer(state)).Flength if copy1 != 0 { if copy1 > have { copy1 = have } if copy1 > left { copy1 = left } if copy1 == uint32(0) { goto inf_leave } libc.Xmemcpy(tls, put, next, copy1) have -= copy1 next += uintptr(copy1) left -= copy1 put += uintptr(copy1) *(*uint32)(unsafe.Pointer(state + 68)) -= copy1 goto _35 } (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TYPE) goto _35 _18: ; for bits < libc.Uint32FromInt32(libc.Int32FromInt32(14)) { if have == uint32(0) { goto inf_leave } have-- v62 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v62))) << bits bits += uint32(8) } (*Tinflate_state)(unsafe.Pointer(state)).Fnlen = hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(5)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(5)) (*Tinflate_state)(unsafe.Pointer(state)).Fndist = hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(5)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(5)) (*Tinflate_state)(unsafe.Pointer(state)).Fncode = hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(4)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(4)) if (*Tinflate_state)(unsafe.Pointer(state)).Fnlen > uint32(286) || (*Tinflate_state)(unsafe.Pointer(state)).Fndist > uint32(30) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57754 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } (*Tinflate_state)(unsafe.Pointer(state)).Fhave = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(LENLENS) /* fallthrough */ _19: ; for (*Tinflate_state)(unsafe.Pointer(state)).Fhave < (*Tinflate_state)(unsafe.Pointer(state)).Fncode { for bits < libc.Uint32FromInt32(libc.Int32FromInt32(3)) { if have == uint32(0) { goto inf_leave } have-- v63 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v63))) << bits bits += uint32(8) } v65 = state + 108 v64 = *(*uint32)(unsafe.Pointer(v65)) *(*uint32)(unsafe.Pointer(v65))++ *(*uint16)(unsafe.Pointer(state + 116 + uintptr(_order1[v64])*2)) = uint16(hold & (libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(3)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(3)) } for (*Tinflate_state)(unsafe.Pointer(state)).Fhave < uint32(19) { v67 = state + 108 v66 = *(*uint32)(unsafe.Pointer(v67)) *(*uint32)(unsafe.Pointer(v67))++ *(*uint16)(unsafe.Pointer(state + 116 + uintptr(_order1[v66])*2)) = uint16(0) } (*Tinflate_state)(unsafe.Pointer(state)).Fnext = state + 1332 (*Tinflate_state)(unsafe.Pointer(state)).Flencode = (*Tinflate_state)(unsafe.Pointer(state)).Fnext (*Tinflate_state)(unsafe.Pointer(state)).Flenbits = uint32(7) ret = Xinflate_table(tls, int32(CODES), state+116, uint32(19), state+112, state+88, state+756) if ret != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57790 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } (*Tinflate_state)(unsafe.Pointer(state)).Fhave = uint32(0) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(CODELENS) /* fallthrough */ _20: ; for (*Tinflate_state)(unsafe.Pointer(state)).Fhave < (*Tinflate_state)(unsafe.Pointer(state)).Fnlen+(*Tinflate_state)(unsafe.Pointer(state)).Fndist { for { here = *(*Tcode)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Flencode + uintptr(hold&(libc.Uint32FromUint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Flenbits-libc.Uint32FromInt32(1)))*4)) if uint32(here.Fbits) <= bits { break } if have == uint32(0) { goto inf_leave } have-- v69 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v69))) << bits bits += uint32(8) goto _68 _68: } if libc.Int32FromUint16(here.Fval) < int32(16) { hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) v71 = state + 108 v70 = *(*uint32)(unsafe.Pointer(v71)) *(*uint32)(unsafe.Pointer(v71))++ *(*uint16)(unsafe.Pointer(state + 116 + uintptr(v70)*2)) = here.Fval } else { if libc.Int32FromUint16(here.Fval) == int32(16) { for bits < libc.Uint32FromInt32(libc.Int32FromUint8(here.Fbits)+libc.Int32FromInt32(2)) { if have == uint32(0) { goto inf_leave } have-- v72 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v72))) << bits bits += uint32(8) } hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) if (*Tinflate_state)(unsafe.Pointer(state)).Fhave == uint32(0) { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57815 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) break } len1 = uint32(*(*uint16)(unsafe.Pointer(state + 116 + uintptr((*Tinflate_state)(unsafe.Pointer(state)).Fhave-uint32(1))*2))) copy1 = uint32(3) + hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(2)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(2)) } else { if libc.Int32FromUint16(here.Fval) == int32(17) { for bits < libc.Uint32FromInt32(libc.Int32FromUint8(here.Fbits)+libc.Int32FromInt32(3)) { if have == uint32(0) { goto inf_leave } have-- v73 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v73))) << bits bits += uint32(8) } hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) len1 = uint32(0) copy1 = uint32(3) + hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(3)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(3)) } else { for bits < libc.Uint32FromInt32(libc.Int32FromUint8(here.Fbits)+libc.Int32FromInt32(7)) { if have == uint32(0) { goto inf_leave } have-- v74 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v74))) << bits bits += uint32(8) } hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) len1 = uint32(0) copy1 = uint32(11) + hold&(libc.Uint32FromUint32(1)<>= libc.Uint32FromInt32(libc.Int32FromInt32(7)) bits -= libc.Uint32FromInt32(libc.Int32FromInt32(7)) } } if (*Tinflate_state)(unsafe.Pointer(state)).Fhave+copy1 > (*Tinflate_state)(unsafe.Pointer(state)).Fnlen+(*Tinflate_state)(unsafe.Pointer(state)).Fndist { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57815 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) break } for { v75 = copy1 copy1-- if !(v75 != 0) { break } v77 = state + 108 v76 = *(*uint32)(unsafe.Pointer(v77)) *(*uint32)(unsafe.Pointer(v77))++ *(*uint16)(unsafe.Pointer(state + 116 + uintptr(v76)*2)) = uint16(len1) } } } /* handle error breaks in while */ if (*Tinflate_state)(unsafe.Pointer(state)).Fmode == int32(BAD) { goto _35 } /* check for end-of-block code (better have one) */ if libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(state + 116 + 256*2))) == 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57841 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ (*Tinflate_state)(unsafe.Pointer(state)).Fnext = state + 1332 (*Tinflate_state)(unsafe.Pointer(state)).Flencode = (*Tinflate_state)(unsafe.Pointer(state)).Fnext (*Tinflate_state)(unsafe.Pointer(state)).Flenbits = uint32(9) ret = Xinflate_table(tls, int32(LENS), state+116, (*Tinflate_state)(unsafe.Pointer(state)).Fnlen, state+112, state+88, state+756) if ret != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57878 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } (*Tinflate_state)(unsafe.Pointer(state)).Fdistcode = (*Tinflate_state)(unsafe.Pointer(state)).Fnext (*Tinflate_state)(unsafe.Pointer(state)).Fdistbits = uint32(6) ret = Xinflate_table(tls, int32(DISTS), state+116+uintptr((*Tinflate_state)(unsafe.Pointer(state)).Fnlen)*2, (*Tinflate_state)(unsafe.Pointer(state)).Fndist, state+112, state+92, state+756) if ret != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57906 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(LEN_) if flush == int32(Z_TREES) { goto inf_leave } /* fallthrough */ _21: ; (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(LEN) /* fallthrough */ _22: ; if have >= uint32(6) && left >= uint32(258) { (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out = put (*Tz_stream)(unsafe.Pointer(strm)).Favail_out = left (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in = next (*Tz_stream)(unsafe.Pointer(strm)).Favail_in = have (*Tinflate_state)(unsafe.Pointer(state)).Fhold = hold (*Tinflate_state)(unsafe.Pointer(state)).Fbits = bits Xinflate_fast(tls, strm, out) put = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_out left = (*Tz_stream)(unsafe.Pointer(strm)).Favail_out next = (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in have = (*Tz_stream)(unsafe.Pointer(strm)).Favail_in hold = (*Tinflate_state)(unsafe.Pointer(state)).Fhold bits = (*Tinflate_state)(unsafe.Pointer(state)).Fbits if (*Tinflate_state)(unsafe.Pointer(state)).Fmode == int32(TYPE) { (*Tinflate_state)(unsafe.Pointer(state)).Fback = -int32(1) } goto _35 } (*Tinflate_state)(unsafe.Pointer(state)).Fback = 0 for { here = *(*Tcode)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Flencode + uintptr(hold&(libc.Uint32FromUint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Flenbits-libc.Uint32FromInt32(1)))*4)) if uint32(here.Fbits) <= bits { break } if have == uint32(0) { goto inf_leave } have-- v79 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v79))) << bits bits += uint32(8) goto _78 _78: } if here.Fop != 0 && libc.Int32FromUint8(here.Fop)&int32(0xf0) == 0 { last = here for { here = *(*Tcode)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Flencode + uintptr(uint32(last.Fval)+hold&(uint32(1)<<(libc.Int32FromUint8(last.Fbits)+libc.Int32FromUint8(last.Fop))-uint32(1))>>last.Fbits)*4)) if libc.Uint32FromInt32(libc.Int32FromUint8(last.Fbits)+libc.Int32FromUint8(here.Fbits)) <= bits { break } if have == uint32(0) { goto inf_leave } have-- v81 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v81))) << bits bits += uint32(8) goto _80 _80: } hold >>= uint32(last.Fbits) bits -= uint32(last.Fbits) *(*int32)(unsafe.Pointer(state + 7112)) += libc.Int32FromUint8(last.Fbits) } hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) *(*int32)(unsafe.Pointer(state + 7112)) += libc.Int32FromUint8(here.Fbits) (*Tinflate_state)(unsafe.Pointer(state)).Flength = uint32(here.Fval) if libc.Int32FromUint8(here.Fop) == 0 { (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(LIT) goto _35 } if libc.Int32FromUint8(here.Fop)&int32(32) != 0 { (*Tinflate_state)(unsafe.Pointer(state)).Fback = -int32(1) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TYPE) goto _35 } if libc.Int32FromUint8(here.Fop)&int32(64) != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57928 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } (*Tinflate_state)(unsafe.Pointer(state)).Fextra = uint32(here.Fop) & uint32(15) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(LENEXT) /* fallthrough */ _23: ; if (*Tinflate_state)(unsafe.Pointer(state)).Fextra != 0 { for bits < (*Tinflate_state)(unsafe.Pointer(state)).Fextra { if have == uint32(0) { goto inf_leave } have-- v82 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v82))) << bits bits += uint32(8) } *(*uint32)(unsafe.Pointer(state + 68)) += hold & (uint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Fextra - uint32(1)) hold >>= (*Tinflate_state)(unsafe.Pointer(state)).Fextra bits -= (*Tinflate_state)(unsafe.Pointer(state)).Fextra p83 = state + 7112 *(*int32)(unsafe.Pointer(p83)) = int32(uint32(*(*int32)(unsafe.Pointer(p83))) + (*Tinflate_state)(unsafe.Pointer(state)).Fextra) } (*Tinflate_state)(unsafe.Pointer(state)).Fwas = (*Tinflate_state)(unsafe.Pointer(state)).Flength (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(DIST) /* fallthrough */ _24: ; for { here = *(*Tcode)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fdistcode + uintptr(hold&(libc.Uint32FromUint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Fdistbits-libc.Uint32FromInt32(1)))*4)) if uint32(here.Fbits) <= bits { break } if have == uint32(0) { goto inf_leave } have-- v85 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v85))) << bits bits += uint32(8) goto _84 _84: } if libc.Int32FromUint8(here.Fop)&int32(0xf0) == 0 { last = here for { here = *(*Tcode)(unsafe.Pointer((*Tinflate_state)(unsafe.Pointer(state)).Fdistcode + uintptr(uint32(last.Fval)+hold&(uint32(1)<<(libc.Int32FromUint8(last.Fbits)+libc.Int32FromUint8(last.Fop))-uint32(1))>>last.Fbits)*4)) if libc.Uint32FromInt32(libc.Int32FromUint8(last.Fbits)+libc.Int32FromUint8(here.Fbits)) <= bits { break } if have == uint32(0) { goto inf_leave } have-- v87 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v87))) << bits bits += uint32(8) goto _86 _86: } hold >>= uint32(last.Fbits) bits -= uint32(last.Fbits) *(*int32)(unsafe.Pointer(state + 7112)) += libc.Int32FromUint8(last.Fbits) } hold >>= uint32(here.Fbits) bits -= uint32(here.Fbits) *(*int32)(unsafe.Pointer(state + 7112)) += libc.Int32FromUint8(here.Fbits) if libc.Int32FromUint8(here.Fop)&int32(64) != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57956 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } (*Tinflate_state)(unsafe.Pointer(state)).Foffset = uint32(here.Fval) (*Tinflate_state)(unsafe.Pointer(state)).Fextra = uint32(here.Fop) & uint32(15) (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(DISTEXT) /* fallthrough */ _25: ; if (*Tinflate_state)(unsafe.Pointer(state)).Fextra != 0 { for bits < (*Tinflate_state)(unsafe.Pointer(state)).Fextra { if have == uint32(0) { goto inf_leave } have-- v88 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v88))) << bits bits += uint32(8) } *(*uint32)(unsafe.Pointer(state + 72)) += hold & (uint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Fextra - uint32(1)) hold >>= (*Tinflate_state)(unsafe.Pointer(state)).Fextra bits -= (*Tinflate_state)(unsafe.Pointer(state)).Fextra p89 = state + 7112 *(*int32)(unsafe.Pointer(p89)) = int32(uint32(*(*int32)(unsafe.Pointer(p89))) + (*Tinflate_state)(unsafe.Pointer(state)).Fextra) } (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(MATCH) /* fallthrough */ _26: ; if left == uint32(0) { goto inf_leave } copy1 = out - left if (*Tinflate_state)(unsafe.Pointer(state)).Foffset > copy1 { /* copy from window */ copy1 = (*Tinflate_state)(unsafe.Pointer(state)).Foffset - copy1 if copy1 > (*Tinflate_state)(unsafe.Pointer(state)).Fwhave { if (*Tinflate_state)(unsafe.Pointer(state)).Fsane != 0 { (*Tz_stream)(unsafe.Pointer(strm)).Fmsg = __ccgo_ts + 57978 (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(BAD) goto _35 } } if copy1 > (*Tinflate_state)(unsafe.Pointer(state)).Fwnext { copy1 -= (*Tinflate_state)(unsafe.Pointer(state)).Fwnext from = (*Tinflate_state)(unsafe.Pointer(state)).Fwindow + uintptr((*Tinflate_state)(unsafe.Pointer(state)).Fwsize-copy1) } else { from = (*Tinflate_state)(unsafe.Pointer(state)).Fwindow + uintptr((*Tinflate_state)(unsafe.Pointer(state)).Fwnext-copy1) } if copy1 > (*Tinflate_state)(unsafe.Pointer(state)).Flength { copy1 = (*Tinflate_state)(unsafe.Pointer(state)).Flength } } else { /* copy from output */ from = put - uintptr((*Tinflate_state)(unsafe.Pointer(state)).Foffset) copy1 = (*Tinflate_state)(unsafe.Pointer(state)).Flength } if copy1 > left { copy1 = left } left -= copy1 *(*uint32)(unsafe.Pointer(state + 68)) -= copy1 for { v92 = put put++ v93 = from from++ *(*uint8)(unsafe.Pointer(v92)) = *(*uint8)(unsafe.Pointer(v93)) goto _91 _91: ; copy1-- v90 = copy1 if !(v90 != 0) { break } } if (*Tinflate_state)(unsafe.Pointer(state)).Flength == uint32(0) { (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(LEN) } goto _35 _27: ; if left == uint32(0) { goto inf_leave } v94 = put put++ *(*uint8)(unsafe.Pointer(v94)) = uint8((*Tinflate_state)(unsafe.Pointer(state)).Flength) left-- (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(LEN) goto _35 _28: ; if (*Tinflate_state)(unsafe.Pointer(state)).Fwrap != 0 { for bits < libc.Uint32FromInt32(libc.Int32FromInt32(32)) { if have == uint32(0) { goto inf_leave } have-- v95 = next next++ hold += uint32(*(*uint8)(unsafe.Pointer(v95))) << bits bits += uint32(8) } out -= left *(*TuLong)(unsafe.Pointer(strm + 20)) += out *(*uint32)(unsafe.Pointer(state + 32)) += out if (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(4) != 0 && out != 0 { if (*Tinflate_state)(unsafe.Pointer(state)).Fflags != 0 { v97 = Xcrc32(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fcheck, put-uintptr(out), out) } else { v97 = Xadler32(tls, (*Tinflate_state)(unsafe.Pointer(state)).Fcheck, put-uintptr(out), out) } v96 = v97 (*Tinflate_state)(unsafe.Pointer(state)).Fcheck = v96 (*Tz_stream)(unsafe.Pointer(strm)).Fadler = v96 } out = left if v99 = (*Tinflate_state)(unsafe.Pointer(state)).Fwrap&int32(4) != 0; v99 { if (*Tinflate_state)(unsafe.Pointer(state)).Fflags != 0 { v98 = hold } else { v98 = hold>>int32(24)&uint32(0xff) + hold>>int32(8)&uint32(0xff00) + hold&uint32(0xff00)<>= (*Tinflate_state)(unsafe.Pointer(state)).Fbits & uint32(7) *(*uint32)(unsafe.Pointer(state + 64)) -= (*Tinflate_state)(unsafe.Pointer(state)).Fbits & uint32(7) len1 = uint32(0) for (*Tinflate_state)(unsafe.Pointer(state)).Fbits >= uint32(8) { v1 = len1 len1++ (*(*[4]uint8)(unsafe.Pointer(bp)))[v1] = uint8((*Tinflate_state)(unsafe.Pointer(state)).Fhold) *(*uint32)(unsafe.Pointer(state + 60)) >>= uint32(8) *(*uint32)(unsafe.Pointer(state + 64)) -= uint32(8) } (*Tinflate_state)(unsafe.Pointer(state)).Fhave = uint32(0) _syncsearch(tls, state+108, bp, len1) } /* search available input */ len1 = _syncsearch(tls, state+108, (*Tz_stream)(unsafe.Pointer(strm)).Fnext_in, (*Tz_stream)(unsafe.Pointer(strm)).Favail_in) *(*TuInt)(unsafe.Pointer(strm + 4)) -= len1 *(*uintptr)(unsafe.Pointer(strm)) += uintptr(len1) *(*TuLong)(unsafe.Pointer(strm + 8)) += len1 /* return no joy or set up to restart inflate() on a new block */ if (*Tinflate_state)(unsafe.Pointer(state)).Fhave != uint32(4) { return -int32(3) } if (*Tinflate_state)(unsafe.Pointer(state)).Fflags == -int32(1) { (*Tinflate_state)(unsafe.Pointer(state)).Fwrap = 0 } else { *(*int32)(unsafe.Pointer(state + 12)) &= ^libc.Int32FromInt32(4) } /* no point in computing a check value now */ flags = (*Tinflate_state)(unsafe.Pointer(state)).Fflags in = (*Tz_stream)(unsafe.Pointer(strm)).Ftotal_in out = (*Tz_stream)(unsafe.Pointer(strm)).Ftotal_out XinflateReset(tls, strm) (*Tz_stream)(unsafe.Pointer(strm)).Ftotal_in = in (*Tz_stream)(unsafe.Pointer(strm)).Ftotal_out = out (*Tinflate_state)(unsafe.Pointer(state)).Fflags = flags (*Tinflate_state)(unsafe.Pointer(state)).Fmode = int32(TYPE) return Z_OK } // C documentation // // /* // Returns true if inflate is currently at the end of a block generated by // Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP // implementation to provide an additional safety check. PPP uses // Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored // block. When decompressing, PPP checks that at the end of input packet, // inflate is waiting for these length bytes. // */ func XinflateSyncPoint(tls *libc.TLS, strm Tz_streamp) (r int32) { var state uintptr _ = state if _inflateStateCheck(tls, strm) != 0 { return -int32(2) } state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate return libc.BoolInt32((*Tinflate_state)(unsafe.Pointer(state)).Fmode == int32(STORED) && (*Tinflate_state)(unsafe.Pointer(state)).Fbits == uint32(0)) } func XinflateCopy(tls *libc.TLS, dest Tz_streamp, source Tz_streamp) (r int32) { var copy1, state, window uintptr var wsize uint32 _, _, _, _ = copy1, state, window, wsize /* check input */ if _inflateStateCheck(tls, source) != 0 || dest == uintptr(Z_NULL) { return -int32(2) } state = (*Tz_stream)(unsafe.Pointer(source)).Fstate /* allocate space */ copy1 = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(source)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(source)).Fopaque, libc.Uint32FromInt32(libc.Int32FromInt32(1)), libc.Uint32FromInt64(7120)) if copy1 == uintptr(Z_NULL) { return -int32(4) } window = uintptr(Z_NULL) if (*Tinflate_state)(unsafe.Pointer(state)).Fwindow != uintptr(Z_NULL) { window = (*(*func(*libc.TLS, Tvoidpf, TuInt, TuInt) Tvoidpf)(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(source)).Fzalloc})))(tls, (*Tz_stream)(unsafe.Pointer(source)).Fopaque, libc.Uint32FromUint32(1)<<(*Tinflate_state)(unsafe.Pointer(state)).Fwbits, libc.Uint32FromInt64(1)) if window == uintptr(Z_NULL) { (*(*func(*libc.TLS, Tvoidpf, Tvoidpf))(unsafe.Pointer(&struct{ uintptr }{(*Tz_stream)(unsafe.Pointer(source)).Fzfree})))(tls, (*Tz_stream)(unsafe.Pointer(source)).Fopaque, copy1) return -int32(4) } } /* copy state */ libc.Xmemcpy(tls, dest, source, uint32(56)) libc.Xmemcpy(tls, copy1, state, uint32(7120)) (*Tinflate_state)(unsafe.Pointer(copy1)).Fstrm = dest if (*Tinflate_state)(unsafe.Pointer(state)).Flencode >= state+1332 && (*Tinflate_state)(unsafe.Pointer(state)).Flencode <= state+1332+uintptr(libc.Int32FromInt32(ENOUGH_LENS)+libc.Int32FromInt32(ENOUGH_DISTS))*4-uintptr(1)*4 { (*Tinflate_state)(unsafe.Pointer(copy1)).Flencode = copy1 + 1332 + uintptr((int32((*Tinflate_state)(unsafe.Pointer(state)).Flencode)-T__predefined_ptrdiff_t(state+1332))/4)*4 (*Tinflate_state)(unsafe.Pointer(copy1)).Fdistcode = copy1 + 1332 + uintptr((int32((*Tinflate_state)(unsafe.Pointer(state)).Fdistcode)-T__predefined_ptrdiff_t(state+1332))/4)*4 } (*Tinflate_state)(unsafe.Pointer(copy1)).Fnext = copy1 + 1332 + uintptr((int32((*Tinflate_state)(unsafe.Pointer(state)).Fnext)-T__predefined_ptrdiff_t(state+1332))/4)*4 if window != uintptr(Z_NULL) { wsize = uint32(1) << (*Tinflate_state)(unsafe.Pointer(state)).Fwbits libc.Xmemcpy(tls, window, (*Tinflate_state)(unsafe.Pointer(state)).Fwindow, wsize) } (*Tinflate_state)(unsafe.Pointer(copy1)).Fwindow = window (*Tz_stream)(unsafe.Pointer(dest)).Fstate = copy1 return Z_OK } func XinflateUndermine(tls *libc.TLS, strm Tz_streamp, subvert int32) (r int32) { var state uintptr _ = state if _inflateStateCheck(tls, strm) != 0 { return -int32(2) } state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate _ = subvert (*Tinflate_state)(unsafe.Pointer(state)).Fsane = int32(1) return -int32(3) } func XinflateValidate(tls *libc.TLS, strm Tz_streamp, check int32) (r int32) { var state uintptr _ = state if _inflateStateCheck(tls, strm) != 0 { return -int32(2) } state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate if check != 0 && (*Tinflate_state)(unsafe.Pointer(state)).Fwrap != 0 { *(*int32)(unsafe.Pointer(state + 12)) |= int32(4) } else { *(*int32)(unsafe.Pointer(state + 12)) &= ^libc.Int32FromInt32(4) } return Z_OK } func XinflateMark(tls *libc.TLS, strm Tz_streamp) (r int32) { var state uintptr var v1, v2 uint32 _, _, _ = state, v1, v2 if _inflateStateCheck(tls, strm) != 0 { return -(libc.Int32FromInt32(1) << libc.Int32FromInt32(16)) } state = (*Tz_stream)(unsafe.Pointer(strm)).Fstate if (*Tinflate_state)(unsafe.Pointer(state)).Fmode == int32(COPY1) { v1 = (*Tinflate_state)(unsafe.Pointer(state)).Flength } else { if (*Tinflate_state)(unsafe.Pointer(state)).Fmode == int32(MATCH) { v2 = (*Tinflate_state)(unsafe.Pointer(state)).Fwas - (*Tinflate_state)(unsafe.Pointer(state)).Flength } else { v2 = uint32(0) } v1 = v2 } return libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromUint32(libc.Uint32FromInt32((*Tinflate_state)(unsafe.Pointer(state)).Fback)<= uint32(1)) { break } if libc.Int32FromUint16((*(*[16]uint16)(unsafe.Pointer(bp)))[max]) != 0 { break } goto _3 _3: ; max-- } if root > max { root = max } if max == uint32(0) { /* no symbols to code at all */ here.Fop = libc.Uint8FromInt32(64) /* invalid code marker */ here.Fbits = libc.Uint8FromInt32(1) here.Fval = libc.Uint16FromInt32(0) v5 = table v4 = *(*uintptr)(unsafe.Pointer(v5)) *(*uintptr)(unsafe.Pointer(v5)) += 4 *(*Tcode)(unsafe.Pointer(v4)) = here /* make a table to force an error */ v7 = table v6 = *(*uintptr)(unsafe.Pointer(v7)) *(*uintptr)(unsafe.Pointer(v7)) += 4 *(*Tcode)(unsafe.Pointer(v6)) = here *(*uint32)(unsafe.Pointer(bits)) = uint32(1) return 0 /* no symbols, but wait for decoding to report error */ } min = uint32(1) for { if !(min < max) { break } if libc.Int32FromUint16((*(*[16]uint16)(unsafe.Pointer(bp)))[min]) != 0 { break } goto _8 _8: ; min++ } if root < min { root = min } /* check for an over-subscribed or incomplete set of lengths */ left = int32(1) len1 = uint32(1) for { if !(len1 <= uint32(MAXBITS)) { break } left <<= int32(1) left -= libc.Int32FromUint16((*(*[16]uint16)(unsafe.Pointer(bp)))[len1]) if left < 0 { return -int32(1) } /* over-subscribed */ goto _9 _9: ; len1++ } if left > 0 && (type1 == int32(CODES) || max != uint32(1)) { return -int32(1) } /* incomplete set */ /* generate offsets into symbol table for each length for sorting */ (*(*[16]uint16)(unsafe.Pointer(bp + 32)))[int32(1)] = uint16(0) len1 = uint32(1) for { if !(len1 < uint32(MAXBITS)) { break } (*(*[16]uint16)(unsafe.Pointer(bp + 32)))[len1+uint32(1)] = libc.Uint16FromInt32(libc.Int32FromUint16((*(*[16]uint16)(unsafe.Pointer(bp + 32)))[len1]) + libc.Int32FromUint16((*(*[16]uint16)(unsafe.Pointer(bp)))[len1])) goto _10 _10: ; len1++ } /* sort symbols by length, by symbol order within each length */ sym = uint32(0) for { if !(sym < codes) { break } if libc.Int32FromUint16(*(*uint16)(unsafe.Pointer(lens + uintptr(sym)*2))) != 0 { v13 = bp + 32 + uintptr(*(*uint16)(unsafe.Pointer(lens + uintptr(sym)*2)))*2 v12 = *(*uint16)(unsafe.Pointer(v13)) *(*uint16)(unsafe.Pointer(v13))++ *(*uint16)(unsafe.Pointer(work + uintptr(v12)*2)) = uint16(sym) } goto _11 _11: ; sym++ } /* Create and fill in decoding tables. In this loop, the table being filled is at next and has curr index bits. The code being used is huff with length len. That code is converted to an index by dropping drop bits off of the bottom. For codes where len is less than drop + curr, those top drop + curr - len bits are incremented through all values to fill the table with replicated entries. root is the number of index bits for the root table. When len exceeds root, sub-tables are created pointed to by the root entry with an index of the low root bits of huff. This is saved in low to check for when a new sub-table should be started. drop is zero when the root table is being filled, and drop is root when sub-tables are being filled. When a new sub-table is needed, it is necessary to look ahead in the code lengths to determine what size sub-table is needed. The length counts are used for this, and so count[] is decremented as codes are entered in the tables. used keeps track of how many table entries have been allocated from the provided *table space. It is checked for LENS and DIST tables against the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in the initial root table size constants. See the comments in inftrees.h for more information. sym increments through all symbols, and the loop terminates when all codes of length max, i.e. all codes, have been processed. This routine permits incomplete codes, so another loop after this one fills in the rest of the decoding tables with invalid code markers. */ /* set up for code type */ switch type1 { case int32(CODES): v14 = work extra = v14 base = v14 /* dummy value--not used */ match = uint32(20) case int32(LENS): base = uintptr(unsafe.Pointer(&_lbase)) extra = uintptr(unsafe.Pointer(&_lext)) match = uint32(257) default: /* DISTS */ base = uintptr(unsafe.Pointer(&_dbase)) extra = uintptr(unsafe.Pointer(&_dext)) match = uint32(0) } /* initialize state for loop */ huff = uint32(0) /* starting code */ sym = uint32(0) /* starting code symbol */ len1 = min /* starting code length */ next = *(*uintptr)(unsafe.Pointer(table)) /* current table to fill in */ curr = root /* current table index bits */ drop = uint32(0) /* current bits to drop from code for index */ low = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) /* trigger new sub-table when len > root */ used = uint32(1) << root /* use root table entries */ mask = used - uint32(1) /* mask for comparing low */ /* check available table space */ if type1 == int32(LENS) && used > uint32(ENOUGH_LENS) || type1 == int32(DISTS) && used > uint32(ENOUGH_DISTS) { return int32(1) } /* process all codes and make table entries */ for { /* create table entry */ here.Fbits = uint8(len1 - drop) if uint32(*(*uint16)(unsafe.Pointer(work + uintptr(sym)*2)))+uint32(1) < match { here.Fop = libc.Uint8FromInt32(0) here.Fval = *(*uint16)(unsafe.Pointer(work + uintptr(sym)*2)) } else { if uint32(*(*uint16)(unsafe.Pointer(work + uintptr(sym)*2))) >= match { here.Fop = uint8(*(*uint16)(unsafe.Pointer(extra + uintptr(uint32(*(*uint16)(unsafe.Pointer(work + uintptr(sym)*2)))-match)*2))) here.Fval = *(*uint16)(unsafe.Pointer(base + uintptr(uint32(*(*uint16)(unsafe.Pointer(work + uintptr(sym)*2)))-match)*2)) } else { here.Fop = libc.Uint8FromInt32(libc.Int32FromInt32(32) + libc.Int32FromInt32(64)) /* end of block */ here.Fval = uint16(0) } } /* replicate for those indices with low len bits equal to huff */ incr = uint32(1) << (len1 - drop) fill = uint32(1) << curr min = fill /* save offset to next table */ for cond := true; cond; cond = fill != uint32(0) { fill -= incr *(*Tcode)(unsafe.Pointer(next + uintptr(huff>>drop+fill)*4)) = here } /* backwards increment the len-bit code huff */ incr = uint32(1) << (len1 - uint32(1)) for huff&incr != 0 { incr >>= uint32(1) } if incr != uint32(0) { huff &= incr - uint32(1) huff += incr } else { huff = uint32(0) } /* go to next symbol, update count, len */ sym++ v17 = bp + uintptr(len1)*2 *(*uint16)(unsafe.Pointer(v17))-- v16 = *(*uint16)(unsafe.Pointer(v17)) if libc.Int32FromUint16(v16) == 0 { if len1 == max { break } len1 = uint32(*(*uint16)(unsafe.Pointer(lens + uintptr(*(*uint16)(unsafe.Pointer(work + uintptr(sym)*2)))*2))) } /* create new sub-table if needed */ if len1 > root && huff&mask != low { /* if first time, transition to sub-tables */ if drop == uint32(0) { drop = root } /* increment past last table */ next += uintptr(min) * 4 /* here min is 1 << curr */ /* determine length of next table */ curr = len1 - drop left = libc.Int32FromInt32(1) << curr for curr+drop < max { left -= libc.Int32FromUint16((*(*[16]uint16)(unsafe.Pointer(bp)))[curr+drop]) if left <= 0 { break } curr++ left <<= int32(1) } /* check for enough space */ used += uint32(1) << curr if type1 == int32(LENS) && used > uint32(ENOUGH_LENS) || type1 == int32(DISTS) && used > uint32(ENOUGH_DISTS) { return int32(1) } /* point entry in root table to sub-table */ low = huff & mask (*(*Tcode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(table)) + uintptr(low)*4))).Fop = uint8(curr) (*(*Tcode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(table)) + uintptr(low)*4))).Fbits = uint8(root) (*(*Tcode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(table)) + uintptr(low)*4))).Fval = libc.Uint16FromInt32((int32(next) - int32(*(*uintptr)(unsafe.Pointer(table)))) / 4) } goto _15 _15: } /* fill in remaining table entry if code is incomplete (guaranteed to have at most one remaining entry, since if the code is incomplete, the maximum code length that was allowed to get this far is one bit) */ if huff != uint32(0) { here.Fop = libc.Uint8FromInt32(64) /* invalid code marker */ here.Fbits = uint8(len1 - drop) here.Fval = libc.Uint16FromInt32(0) *(*Tcode)(unsafe.Pointer(next + uintptr(huff)*4)) = here } /* set return parameters */ *(*uintptr)(unsafe.Pointer(table)) += uintptr(used) * 4 *(*uint32)(unsafe.Pointer(bits)) = root return 0 } var _lbase = [31]uint16{ 0: uint16(3), 1: uint16(4), 2: uint16(5), 3: uint16(6), 4: uint16(7), 5: uint16(8), 6: uint16(9), 7: uint16(10), 8: uint16(11), 9: uint16(13), 10: uint16(15), 11: uint16(17), 12: uint16(19), 13: uint16(23), 14: uint16(27), 15: uint16(31), 16: uint16(35), 17: uint16(43), 18: uint16(51), 19: uint16(59), 20: uint16(67), 21: uint16(83), 22: uint16(99), 23: uint16(115), 24: uint16(131), 25: uint16(163), 26: uint16(195), 27: uint16(227), 28: uint16(258), } var _lext = [31]uint16{ 0: uint16(16), 1: uint16(16), 2: uint16(16), 3: uint16(16), 4: uint16(16), 5: uint16(16), 6: uint16(16), 7: uint16(16), 8: uint16(17), 9: uint16(17), 10: uint16(17), 11: uint16(17), 12: uint16(18), 13: uint16(18), 14: uint16(18), 15: uint16(18), 16: uint16(19), 17: uint16(19), 18: uint16(19), 19: uint16(19), 20: uint16(20), 21: uint16(20), 22: uint16(20), 23: uint16(20), 24: uint16(21), 25: uint16(21), 26: uint16(21), 27: uint16(21), 28: uint16(16), 29: uint16(203), 30: uint16(77), } var _dbase = [32]uint16{ 0: uint16(1), 1: uint16(2), 2: uint16(3), 3: uint16(4), 4: uint16(5), 5: uint16(7), 6: uint16(9), 7: uint16(13), 8: uint16(17), 9: uint16(25), 10: uint16(33), 11: uint16(49), 12: uint16(65), 13: uint16(97), 14: uint16(129), 15: uint16(193), 16: uint16(257), 17: uint16(385), 18: uint16(513), 19: uint16(769), 20: uint16(1025), 21: uint16(1537), 22: uint16(2049), 23: uint16(3073), 24: uint16(4097), 25: uint16(6145), 26: uint16(8193), 27: uint16(12289), 28: uint16(16385), 29: uint16(24577), } var _dext = [32]uint16{ 0: uint16(16), 1: uint16(16), 2: uint16(16), 3: uint16(16), 4: uint16(17), 5: uint16(17), 6: uint16(18), 7: uint16(18), 8: uint16(19), 9: uint16(19), 10: uint16(20), 11: uint16(20), 12: uint16(21), 13: uint16(21), 14: uint16(22), 15: uint16(22), 16: uint16(23), 17: uint16(23), 18: uint16(24), 19: uint16(24), 20: uint16(25), 21: uint16(25), 22: uint16(26), 23: uint16(26), 24: uint16(27), 25: uint16(27), 26: uint16(28), 27: uint16(28), 28: uint16(29), 29: uint16(29), 30: uint16(64), 31: uint16(64), } const DIST_CODE_LEN = 512 const END_BLOCK = 256 const MAX_BL_BITS = 7 const REPZ_11_138 = 18 const REPZ_3_10 = 17 const REP_3_6 = 16 const SMALLEST = 1 const TCONST = "const" type Tstatic_tree_desc = struct { Fstatic_tree uintptr Fextra_bits uintptr Fextra_base int32 Felems int32 Fmax_length int32 } type Tstatic_tree_desc_s = Tstatic_tree_desc /* =========================================================================== * Constants */ /* Bit length codes must not exceed MAX_BL_BITS bits */ /* end of block literal code */ /* repeat previous bit length 3-6 times (2 bits of repeat count) */ /* repeat a zero length 3-10 times (3 bits of repeat count) */ /* repeat a zero length 11-138 times (7 bits of repeat count) */ var _extra_lbits = [29]int32{ 8: int32(1), 9: int32(1), 10: int32(1), 11: int32(1), 12: int32(2), 13: int32(2), 14: int32(2), 15: int32(2), 16: int32(3), 17: int32(3), 18: int32(3), 19: int32(3), 20: int32(4), 21: int32(4), 22: int32(4), 23: int32(4), 24: int32(5), 25: int32(5), 26: int32(5), 27: int32(5), } var _extra_dbits = [30]int32{ 4: int32(1), 5: int32(1), 6: int32(2), 7: int32(2), 8: int32(3), 9: int32(3), 10: int32(4), 11: int32(4), 12: int32(5), 13: int32(5), 14: int32(6), 15: int32(6), 16: int32(7), 17: int32(7), 18: int32(8), 19: int32(8), 20: int32(9), 21: int32(9), 22: int32(10), 23: int32(10), 24: int32(11), 25: int32(11), 26: int32(12), 27: int32(12), 28: int32(13), 29: int32(13), } var _extra_blbits = [19]int32{ 16: int32(2), 17: int32(3), 18: int32(7), } var _bl_order = [19]Tuch{ 0: uint8(16), 1: uint8(17), 2: uint8(18), 4: uint8(8), 5: uint8(7), 6: uint8(9), 7: uint8(6), 8: uint8(10), 9: uint8(5), 10: uint8(11), 11: uint8(4), 12: uint8(12), 13: uint8(3), 14: uint8(13), 15: uint8(2), 16: uint8(14), 17: uint8(1), 18: uint8(15), } var _static_ltree = [288]Tct_data{ 0: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(12)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 1: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(140)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 2: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(76)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 3: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(204)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 4: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(44)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 5: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(172)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 6: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(108)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 7: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(236)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 8: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(28)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 9: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(156)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 10: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(92)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 11: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(220)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 12: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(60)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 13: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(188)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 14: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(124)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 15: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(252)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 16: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(2)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 17: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(130)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 18: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(66)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 19: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(194)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 20: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(34)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 21: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(162)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 22: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(98)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 23: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(226)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 24: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(18)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 25: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(146)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 26: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(82)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 27: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(210)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 28: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(50)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 29: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(178)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 30: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(114)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 31: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(242)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 32: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(10)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 33: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(138)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 34: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(74)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 35: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(202)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 36: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(42)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 37: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(170)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 38: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(106)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 39: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(234)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 40: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(26)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 41: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(154)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 42: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(90)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 43: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(218)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 44: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(58)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 45: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(186)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 46: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(122)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 47: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(250)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 48: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(6)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 49: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(134)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 50: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(70)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 51: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(198)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 52: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(38)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 53: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(166)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 54: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(102)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 55: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(230)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 56: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(22)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 57: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(150)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 58: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(86)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 59: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(214)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 60: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(54)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 61: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(182)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 62: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(118)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 63: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(246)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 64: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(14)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 65: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(142)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 66: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(78)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 67: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(206)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 68: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(46)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 69: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(174)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 70: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(110)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 71: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(238)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 72: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(30)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 73: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(158)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 74: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(94)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 75: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(222)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 76: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(62)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 77: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(190)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 78: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(126)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 79: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(254)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 80: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(1)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 81: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(129)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 82: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(65)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 83: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(193)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 84: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(33)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 85: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(161)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 86: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(97)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 87: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(225)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 88: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(17)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 89: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(145)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 90: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(81)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 91: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(209)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 92: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(49)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 93: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(177)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 94: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(113)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 95: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(241)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 96: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 97: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(137)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 98: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(73)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 99: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(201)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 100: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(41)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 101: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(169)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 102: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(105)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 103: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(233)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 104: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(25)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 105: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(153)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 106: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(89)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 107: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(217)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 108: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(57)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 109: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(185)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 110: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(121)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 111: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(249)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 112: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 113: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(133)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 114: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(69)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 115: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(197)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 116: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(37)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 117: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(165)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 118: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(101)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 119: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(229)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 120: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(21)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 121: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(149)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 122: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(85)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 123: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(213)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 124: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(53)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 125: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(181)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 126: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(117)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 127: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(245)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 128: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(13)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 129: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(141)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 130: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(77)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 131: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(205)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 132: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(45)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 133: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(173)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 134: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(109)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 135: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(237)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 136: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(29)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 137: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(157)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 138: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(93)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 139: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(221)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 140: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(61)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 141: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(189)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 142: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(125)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 143: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(253)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 144: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(19)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 145: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(275)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 146: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(147)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 147: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(403)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 148: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(83)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 149: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(339)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 150: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(211)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 151: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(467)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 152: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(51)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 153: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(307)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 154: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(179)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 155: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(435)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 156: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(115)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 157: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(371)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 158: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(243)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 159: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(499)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 160: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(11)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 161: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(267)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 162: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(139)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 163: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(395)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 164: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(75)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 165: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(331)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 166: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(203)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 167: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(459)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 168: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(43)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 169: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(299)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 170: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(171)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 171: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(427)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 172: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(107)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 173: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(363)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 174: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(235)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 175: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(491)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 176: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(27)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 177: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(283)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 178: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(155)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 179: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(411)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 180: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(91)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 181: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(347)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 182: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(219)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 183: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(475)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 184: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(59)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 185: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(315)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 186: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(187)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 187: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(443)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 188: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(123)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 189: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(379)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 190: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(251)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 191: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(507)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 192: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 193: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(263)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 194: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(135)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 195: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(391)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 196: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(71)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 197: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(327)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 198: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(199)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 199: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(455)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 200: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(39)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 201: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(295)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 202: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(167)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 203: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(423)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 204: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(103)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 205: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(359)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 206: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(231)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 207: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(487)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 208: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(23)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 209: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(279)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 210: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(151)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 211: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(407)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 212: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(87)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 213: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(343)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 214: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(215)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 215: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(471)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 216: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(55)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 217: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(311)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 218: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(183)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 219: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(439)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 220: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(119)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 221: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(375)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 222: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(247)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 223: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(503)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 224: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(15)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 225: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(271)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 226: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(143)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 227: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(399)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 228: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(79)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 229: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(335)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 230: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(207)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 231: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(463)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 232: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(47)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 233: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(303)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 234: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(175)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 235: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(431)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 236: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(111)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 237: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(367)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 238: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(239)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 239: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(495)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 240: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(31)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 241: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(287)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 242: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(159)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 243: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(415)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 244: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(95)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 245: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(351)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 246: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(223)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 247: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(479)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 248: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(63)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 249: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(319)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 250: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(191)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 251: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(447)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 252: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(127)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 253: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(383)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 254: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(255)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 255: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(511)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), }, 256: { Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 257: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(64)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 258: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(32)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 259: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(96)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 260: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(16)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 261: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(80)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 262: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(48)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 263: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(112)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 264: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 265: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(72)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 266: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(40)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 267: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(104)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 268: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(24)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 269: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(88)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 270: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(56)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 271: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(120)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 272: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(4)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 273: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(68)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 274: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(36)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 275: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(100)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 276: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(20)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 277: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(84)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 278: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(52)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 279: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(116)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), }, 280: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(3)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 281: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(131)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 282: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(67)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 283: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(195)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 284: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(35)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 285: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(163)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 286: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(99)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, 287: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(227)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), }, } var _static_dtree = [30]Tct_data{ 0: { Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 1: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(16)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 2: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(8)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 3: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(24)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 4: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(4)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 5: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(20)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 6: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(12)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 7: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(28)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 8: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(2)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 9: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(18)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 10: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(10)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 11: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(26)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 12: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(6)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 13: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(22)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 14: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(14)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 15: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(30)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 16: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(1)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 17: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(17)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 18: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(9)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 19: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(25)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 20: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 21: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(21)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 22: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(13)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 23: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(29)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 24: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(3)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 25: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(19)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 26: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(11)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 27: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(27)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 28: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(7)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, 29: { Ffc: *(*struct { Fcode [0]Tush Ffreq Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(23)})), Fdl: *(*struct { Flen1 [0]Tush Fdad Tush })(unsafe.Pointer(&struct{ f Tush }{f: uint16(5)})), }, } var _base_length = [29]int32{ 1: int32(1), 2: int32(2), 3: int32(3), 4: int32(4), 5: int32(5), 6: int32(6), 7: int32(7), 8: int32(8), 9: int32(10), 10: int32(12), 11: int32(14), 12: int32(16), 13: int32(20), 14: int32(24), 15: int32(28), 16: int32(32), 17: int32(40), 18: int32(48), 19: int32(56), 20: int32(64), 21: int32(80), 22: int32(96), 23: int32(112), 24: int32(128), 25: int32(160), 26: int32(192), 27: int32(224), } var _base_dist = [30]int32{ 1: int32(1), 2: int32(2), 3: int32(3), 4: int32(4), 5: int32(6), 6: int32(8), 7: int32(12), 8: int32(16), 9: int32(24), 10: int32(32), 11: int32(48), 12: int32(64), 13: int32(96), 14: int32(128), 15: int32(192), 16: int32(256), 17: int32(384), 18: int32(512), 19: int32(768), 20: int32(1024), 21: int32(1536), 22: int32(2048), 23: int32(3072), 24: int32(4096), 25: int32(6144), 26: int32(8192), 27: int32(12288), 28: int32(16384), 29: int32(24576), } var _static_l_desc = Tstatic_tree_desc{ Fstatic_tree: uintptr(unsafe.Pointer(&_static_ltree)), Fextra_bits: uintptr(unsafe.Pointer(&_extra_lbits)), Fextra_base: libc.Int32FromInt32(LITERALS) + libc.Int32FromInt32(1), Felems: libc.Int32FromInt32(LITERALS) + libc.Int32FromInt32(1) + libc.Int32FromInt32(LENGTH_CODES), Fmax_length: int32(MAX_BITS), } var _static_d_desc = Tstatic_tree_desc{ Fstatic_tree: uintptr(unsafe.Pointer(&_static_dtree)), Fextra_bits: uintptr(unsafe.Pointer(&_extra_dbits)), Felems: int32(D_CODES), Fmax_length: int32(MAX_BITS), } var _static_bl_desc = Tstatic_tree_desc{ Fextra_bits: uintptr(unsafe.Pointer(&_extra_blbits)), Felems: int32(BL_CODES), Fmax_length: int32(MAX_BL_BITS), } /* =========================================================================== * Output a short LSB first on the stream. * IN assertion: there is enough room in pendingBuf. */ // C documentation // // /* =========================================================================== // * Reverse the first len bits of a code, using straightforward code (a faster // * method would use a table) // * IN assertion: 1 <= len <= 15 // */ func _bi_reverse(tls *libc.TLS, code uint32, len1 int32) (r uint32) { var res uint32 var v1 int32 _, _ = res, v1 res = uint32(0) for { res |= code & uint32(1) code >>= uint32(1) res <<= uint32(1) goto _2 _2: ; len1-- v1 = len1 if !(v1 > 0) { break } } return res >> int32(1) } // C documentation // // /* =========================================================================== // * Flush the bit buffer, keeping at most 7 bits in it. // */ func _bi_flush(tls *libc.TLS, s uintptr) { var v1, v3, v5 Tulg var v2, v4, v6, p7 uintptr _, _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6, p7 if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid == int32(16) { v2 = s + 20 v1 = *(*Tulg)(unsafe.Pointer(v2)) *(*Tulg)(unsafe.Pointer(v2))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v1))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v4 = s + 20 v3 = *(*Tulg)(unsafe.Pointer(v4)) *(*Tulg)(unsafe.Pointer(v4))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v3))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = uint16(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid = 0 } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid >= int32(8) { v6 = s + 20 v5 = *(*Tulg)(unsafe.Pointer(v6)) *(*Tulg)(unsafe.Pointer(v6))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v5))) = uint8((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) p7 = s + 5816 *(*Tush)(unsafe.Pointer(p7)) = Tush(int32(*(*Tush)(unsafe.Pointer(p7))) >> libc.Int32FromInt32(8)) *(*int32)(unsafe.Pointer(s + 5820)) -= int32(8) } } } // C documentation // // /* =========================================================================== // * Flush the bit buffer and align the output on a byte boundary // */ func _bi_windup(tls *libc.TLS, s uintptr) { var v1, v3, v5 Tulg var v2, v4, v6 uintptr _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6 if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > int32(8) { v2 = s + 20 v1 = *(*Tulg)(unsafe.Pointer(v2)) *(*Tulg)(unsafe.Pointer(v2))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v1))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v4 = s + 20 v3 = *(*Tulg)(unsafe.Pointer(v4)) *(*Tulg)(unsafe.Pointer(v4))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v3))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) } else { if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > 0 { v6 = s + 20 v5 = *(*Tulg)(unsafe.Pointer(v6)) *(*Tulg)(unsafe.Pointer(v6))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v5))) = uint8((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) } } (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = uint16(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid = 0 } // C documentation // // /* =========================================================================== // * Generate the codes for a given tree and bit counts (which need not be // * optimal). // * IN assertion: the array bl_count contains the bit length statistics for // * the given tree and the field len is set for all tree elements. // * OUT assertion: the field code is set for all tree elements of non // * zero code length. // */ func _gen_codes(tls *libc.TLS, tree uintptr, max_code int32, bl_count uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var bits, len1, n int32 var code uint32 var v3 Tush var v4 uintptr var _ /* next_code at bp+0 */ [16]Tush _, _, _, _, _, _ = bits, code, len1, n, v3, v4 /* next code value for each bit length */ code = uint32(0) /* code index */ /* The distribution counts are first used to generate the code values * without bit reversal. */ bits = int32(1) for { if !(bits <= int32(MAX_BITS)) { break } code = (code + uint32(*(*Tushf)(unsafe.Pointer(bl_count + uintptr(bits-int32(1))*2)))) << int32(1) (*(*[16]Tush)(unsafe.Pointer(bp)))[bits] = uint16(code) goto _1 _1: ; bits++ } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ n = 0 for { if !(n <= max_code) { break } len1 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(n)*4 + 2))) if len1 == 0 { goto _2 } /* Now reverse the bits */ v4 = bp + uintptr(len1)*2 v3 = *(*Tush)(unsafe.Pointer(v4)) *(*Tush)(unsafe.Pointer(v4))++ *(*Tush)(unsafe.Pointer(tree + uintptr(n)*4)) = uint16(_bi_reverse(tls, uint32(v3), len1)) goto _2 _2: ; n++ } } /* Send a code of the given tree. c and tree must not have side effects */ /* =========================================================================== * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ /* the arguments must not have side effects */ // C documentation // // /* =========================================================================== // * Initialize the various 'constant' tables. // */ func _tr_static_init(tls *libc.TLS) { } /* =========================================================================== * Generate the file trees.h describing the static trees. */ // C documentation // // /* =========================================================================== // * Initialize a new block. // */ func _init_block(tls *libc.TLS, s uintptr) { var n int32 var v4 Tulg var v5 TuInt _, _, _ = n, v4, v5 /* iterates over tree elements */ /* Initialize the trees. */ n = 0 for { if !(n < libc.Int32FromInt32(LITERALS)+libc.Int32FromInt32(1)+libc.Int32FromInt32(LENGTH_CODES)) { break } *(*Tush)(unsafe.Pointer(s + 148 + uintptr(n)*4)) = uint16(0) goto _1 _1: ; n++ } n = 0 for { if !(n < int32(D_CODES)) { break } *(*Tush)(unsafe.Pointer(s + 2440 + uintptr(n)*4)) = uint16(0) goto _2 _2: ; n++ } n = 0 for { if !(n < int32(BL_CODES)) { break } *(*Tush)(unsafe.Pointer(s + 2684 + uintptr(n)*4)) = uint16(0) goto _3 _3: ; n++ } *(*Tush)(unsafe.Pointer(s + 148 + 256*4)) = uint16(1) v4 = libc.Uint32FromInt32(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fstatic_len = v4 (*Tdeflate_state)(unsafe.Pointer(s)).Fopt_len = v4 v5 = libc.Uint32FromInt32(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fmatches = v5 (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next = v5 } // C documentation // // /* =========================================================================== // * Initialize the tree data structures for a new zlib stream. // */ func X_tr_init(tls *libc.TLS, s uintptr) { _tr_static_init(tls) (*Tdeflate_state)(unsafe.Pointer(s)).Fl_desc.Fdyn_tree = s + 148 (*Tdeflate_state)(unsafe.Pointer(s)).Fl_desc.Fstat_desc = uintptr(unsafe.Pointer(&_static_l_desc)) (*Tdeflate_state)(unsafe.Pointer(s)).Fd_desc.Fdyn_tree = s + 2440 (*Tdeflate_state)(unsafe.Pointer(s)).Fd_desc.Fstat_desc = uintptr(unsafe.Pointer(&_static_d_desc)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbl_desc.Fdyn_tree = s + 2684 (*Tdeflate_state)(unsafe.Pointer(s)).Fbl_desc.Fstat_desc = uintptr(unsafe.Pointer(&_static_bl_desc)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = uint16(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid = 0 /* Initialize the first block of the first file: */ _init_block(tls, s) } /* Index within the heap array of least frequent node in the Huffman tree */ /* =========================================================================== * Remove the smallest element from the heap and recreate the heap with * one less element. Updates heap and heap_len. */ /* =========================================================================== * Compares to subtrees, using the tree depth as tie breaker when * the subtrees have equal frequency. This minimizes the worst case length. */ // C documentation // // /* =========================================================================== // * Restore the heap property by moving down the tree starting at node k, // * exchanging a node with the smallest of its two sons if necessary, stopping // * when the heap property is re-established (each father smaller than its // * two sons). // */ func _pqdownheap(tls *libc.TLS, s uintptr, tree uintptr, k int32) { var j, v int32 _, _ = j, v v = *(*int32)(unsafe.Pointer(s + 2908 + uintptr(k)*4)) j = k << int32(1) /* left son of k */ for j <= (*Tdeflate_state)(unsafe.Pointer(s)).Fheap_len { /* Set j to the smallest of the two sons: */ if j < (*Tdeflate_state)(unsafe.Pointer(s)).Fheap_len && (libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(*(*int32)(unsafe.Pointer(s + 2908 + uintptr(j+int32(1))*4)))*4))) < libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(*(*int32)(unsafe.Pointer(s + 2908 + uintptr(j)*4)))*4))) || libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(*(*int32)(unsafe.Pointer(s + 2908 + uintptr(j+int32(1))*4)))*4))) == libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(*(*int32)(unsafe.Pointer(s + 2908 + uintptr(j)*4)))*4))) && libc.Int32FromUint8(*(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(*(*int32)(unsafe.Pointer(s + 2908 + uintptr(j+int32(1))*4)))))) <= libc.Int32FromUint8(*(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(*(*int32)(unsafe.Pointer(s + 2908 + uintptr(j)*4))))))) { j++ } /* Exit if v is smaller than both sons */ if libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(v)*4))) < libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(*(*int32)(unsafe.Pointer(s + 2908 + uintptr(j)*4)))*4))) || libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(v)*4))) == libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(*(*int32)(unsafe.Pointer(s + 2908 + uintptr(j)*4)))*4))) && libc.Int32FromUint8(*(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(v)))) <= libc.Int32FromUint8(*(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(*(*int32)(unsafe.Pointer(s + 2908 + uintptr(j)*4)))))) { break } /* Exchange v with the smallest son */ *(*int32)(unsafe.Pointer(s + 2908 + uintptr(k)*4)) = *(*int32)(unsafe.Pointer(s + 2908 + uintptr(j)*4)) k = j /* And continue down the tree, setting j to the left son of k */ j <<= int32(1) } *(*int32)(unsafe.Pointer(s + 2908 + uintptr(k)*4)) = v } // C documentation // // /* =========================================================================== // * Compute the optimal bit lengths for a tree and update the total bit length // * for the current block. // * IN assertion: the fields freq and dad are set, heap[heap_max] and // * above are the tree nodes sorted by increasing frequency. // * OUT assertions: the field len is set to the optimal bit length, the // * array bl_count contains the frequencies for each bit length. // * The length opt_len is updated; static_len is also updated if stree is // * not null. // */ func _gen_bitlen(tls *libc.TLS, s uintptr, desc uintptr) { var base, bits, h, m, max_code, max_length, n, overflow, xbits, v5 int32 var extra, stree, tree, p3 uintptr var f Tush _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = base, bits, extra, f, h, m, max_code, max_length, n, overflow, stree, tree, xbits, v5, p3 tree = (*Ttree_desc)(unsafe.Pointer(desc)).Fdyn_tree max_code = (*Ttree_desc)(unsafe.Pointer(desc)).Fmax_code stree = (*Tstatic_tree_desc)(unsafe.Pointer((*Ttree_desc)(unsafe.Pointer(desc)).Fstat_desc)).Fstatic_tree extra = (*Tstatic_tree_desc)(unsafe.Pointer((*Ttree_desc)(unsafe.Pointer(desc)).Fstat_desc)).Fextra_bits base = (*Tstatic_tree_desc)(unsafe.Pointer((*Ttree_desc)(unsafe.Pointer(desc)).Fstat_desc)).Fextra_base max_length = (*Tstatic_tree_desc)(unsafe.Pointer((*Ttree_desc)(unsafe.Pointer(desc)).Fstat_desc)).Fmax_length /* frequency */ overflow = 0 /* number of elements with bit length too large */ bits = 0 for { if !(bits <= int32(MAX_BITS)) { break } *(*Tush)(unsafe.Pointer(s + 2876 + uintptr(bits)*2)) = uint16(0) goto _1 _1: ; bits++ } /* In a first pass, compute the optimal bit lengths (which may * overflow in the case of the bit length tree). */ *(*Tush)(unsafe.Pointer(tree + uintptr(*(*int32)(unsafe.Pointer(s + 2908 + uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fheap_max)*4)))*4 + 2)) = uint16(0) /* root of the heap */ h = (*Tdeflate_state)(unsafe.Pointer(s)).Fheap_max + int32(1) for { if !(h < libc.Int32FromInt32(2)*(libc.Int32FromInt32(LITERALS)+libc.Int32FromInt32(1)+libc.Int32FromInt32(LENGTH_CODES))+libc.Int32FromInt32(1)) { break } n = *(*int32)(unsafe.Pointer(s + 2908 + uintptr(h)*4)) bits = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(*(*Tush)(unsafe.Pointer(tree + uintptr(n)*4 + 2)))*4 + 2))) + int32(1) if bits > max_length { bits = max_length overflow++ } *(*Tush)(unsafe.Pointer(tree + uintptr(n)*4 + 2)) = libc.Uint16FromInt32(bits) /* We overwrite tree[n].Dad which is no longer needed */ if n > max_code { goto _2 } /* not a leaf node */ *(*Tush)(unsafe.Pointer(s + 2876 + uintptr(bits)*2))++ xbits = 0 if n >= base { xbits = *(*Tintf)(unsafe.Pointer(extra + uintptr(n-base)*4)) } f = *(*Tush)(unsafe.Pointer(tree + uintptr(n)*4)) *(*Tulg)(unsafe.Pointer(s + 5800)) += uint32(f) * libc.Uint32FromInt32(bits+xbits) if stree != 0 { *(*Tulg)(unsafe.Pointer(s + 5804)) += uint32(f) * libc.Uint32FromInt32(libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(stree + uintptr(n)*4 + 2)))+xbits) } goto _2 _2: ; h++ } if overflow == 0 { return } /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ for cond := true; cond; cond = overflow > 0 { bits = max_length - int32(1) for libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2876 + uintptr(bits)*2))) == 0 { bits-- } *(*Tush)(unsafe.Pointer(s + 2876 + uintptr(bits)*2))-- /* move one leaf down the tree */ p3 = s + 2876 + uintptr(bits+int32(1))*2 *(*Tush)(unsafe.Pointer(p3)) = Tush(int32(*(*Tush)(unsafe.Pointer(p3))) + libc.Int32FromInt32(2)) /* move one overflow item as its brother */ *(*Tush)(unsafe.Pointer(s + 2876 + uintptr(max_length)*2))-- /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] */ overflow -= int32(2) } /* Now recompute all bit lengths, scanning in increasing frequency. * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * lengths instead of fixing only the wrong ones. This idea is taken * from 'ar' written by Haruhiko Okumura.) */ bits = max_length for { if !(bits != 0) { break } n = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2876 + uintptr(bits)*2))) for n != 0 { h-- v5 = h m = *(*int32)(unsafe.Pointer(s + 2908 + uintptr(v5)*4)) if m > max_code { continue } if uint32(*(*Tush)(unsafe.Pointer(tree + uintptr(m)*4 + 2))) != libc.Uint32FromInt32(bits) { *(*Tulg)(unsafe.Pointer(s + 5800)) += (libc.Uint32FromInt32(bits) - uint32(*(*Tush)(unsafe.Pointer(tree + uintptr(m)*4 + 2)))) * uint32(*(*Tush)(unsafe.Pointer(tree + uintptr(m)*4))) *(*Tush)(unsafe.Pointer(tree + uintptr(m)*4 + 2)) = libc.Uint16FromInt32(bits) } n-- } goto _4 _4: ; bits-- } } // C documentation // // /* =========================================================================== // * Construct one Huffman tree and assigns the code bit strings and lengths. // * Update the total bit length for the current block. // * IN assertion: the field freq is set for all tree elements. // * OUT assertions: the fields len and code are set to the optimal bit length // * and corresponding code. The length opt_len is updated; static_len is // * also updated if stree is not null. The field max_code is set. // */ func _build_tree(tls *libc.TLS, s uintptr, desc uintptr) { var elems, m, max_code, n, node, v11, v13, v15, v17, v19, v2, v20, v4, v5, v6, v7, v8 int32 var stree, tree, v12, v14, v16, v21, v3, v9 uintptr var v18 Tush _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = elems, m, max_code, n, node, stree, tree, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 tree = (*Ttree_desc)(unsafe.Pointer(desc)).Fdyn_tree stree = (*Tstatic_tree_desc)(unsafe.Pointer((*Ttree_desc)(unsafe.Pointer(desc)).Fstat_desc)).Fstatic_tree elems = (*Tstatic_tree_desc)(unsafe.Pointer((*Ttree_desc)(unsafe.Pointer(desc)).Fstat_desc)).Felems /* iterate over heap elements */ max_code = -int32(1) /* new node being created */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n + 1]. * heap[0] is not used. */ (*Tdeflate_state)(unsafe.Pointer(s)).Fheap_len = 0 /* new node being created */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n + 1]. * heap[0] is not used. */ (*Tdeflate_state)(unsafe.Pointer(s)).Fheap_max = libc.Int32FromInt32(2)*(libc.Int32FromInt32(LITERALS)+libc.Int32FromInt32(1)+libc.Int32FromInt32(LENGTH_CODES)) + libc.Int32FromInt32(1) n = 0 for { if !(n < elems) { break } if libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(n)*4))) != 0 { v3 = s + 5200 *(*int32)(unsafe.Pointer(v3))++ v2 = *(*int32)(unsafe.Pointer(v3)) v4 = n max_code = v4 *(*int32)(unsafe.Pointer(s + 2908 + uintptr(v2)*4)) = v4 *(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(n))) = uint8(0) } else { *(*Tush)(unsafe.Pointer(tree + uintptr(n)*4 + 2)) = uint16(0) } goto _1 _1: ; n++ } /* The pkzip format requires that at least one distance code exists, * and that at least one bit should be sent even if there is only one * possible code. So to avoid special checks later on we force at least * two codes of non zero frequency. */ for (*Tdeflate_state)(unsafe.Pointer(s)).Fheap_len < int32(2) { if max_code < int32(2) { max_code++ v7 = max_code v6 = v7 } else { v6 = 0 } v5 = v6 v9 = s + 5200 *(*int32)(unsafe.Pointer(v9))++ v8 = *(*int32)(unsafe.Pointer(v9)) *(*int32)(unsafe.Pointer(s + 2908 + uintptr(v8)*4)) = v5 node = v5 *(*Tush)(unsafe.Pointer(tree + uintptr(node)*4)) = uint16(1) *(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(node))) = uint8(0) (*Tdeflate_state)(unsafe.Pointer(s)).Fopt_len-- if stree != 0 { *(*Tulg)(unsafe.Pointer(s + 5804)) -= uint32(*(*Tush)(unsafe.Pointer(stree + uintptr(node)*4 + 2))) } /* node is 0 or 1 so it does not have extra bits */ } (*Ttree_desc)(unsafe.Pointer(desc)).Fmax_code = max_code /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ n = (*Tdeflate_state)(unsafe.Pointer(s)).Fheap_len / int32(2) for { if !(n >= int32(1)) { break } _pqdownheap(tls, s, tree, n) goto _10 _10: ; n-- } /* Construct the Huffman tree by repeatedly combining the least two * frequent nodes. */ node = elems /* next internal node of the tree */ for cond := true; cond; cond = (*Tdeflate_state)(unsafe.Pointer(s)).Fheap_len >= int32(2) { n = *(*int32)(unsafe.Pointer(s + 2908 + 1*4)) v12 = s + 5200 v11 = *(*int32)(unsafe.Pointer(v12)) *(*int32)(unsafe.Pointer(v12))-- *(*int32)(unsafe.Pointer(s + 2908 + 1*4)) = *(*int32)(unsafe.Pointer(s + 2908 + uintptr(v11)*4)) _pqdownheap(tls, s, tree, int32(SMALLEST)) /* n = node of least frequency */ m = *(*int32)(unsafe.Pointer(s + 2908 + 1*4)) /* m = node of next least frequency */ v14 = s + 5204 *(*int32)(unsafe.Pointer(v14))-- v13 = *(*int32)(unsafe.Pointer(v14)) *(*int32)(unsafe.Pointer(s + 2908 + uintptr(v13)*4)) = n /* keep the nodes sorted by frequency */ v16 = s + 5204 *(*int32)(unsafe.Pointer(v16))-- v15 = *(*int32)(unsafe.Pointer(v16)) *(*int32)(unsafe.Pointer(s + 2908 + uintptr(v15)*4)) = m /* Create a new node father of n and m */ *(*Tush)(unsafe.Pointer(tree + uintptr(node)*4)) = libc.Uint16FromInt32(libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(n)*4))) + libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(m)*4)))) if libc.Int32FromUint8(*(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(n)))) >= libc.Int32FromUint8(*(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(m)))) { v17 = libc.Int32FromUint8(*(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(n)))) } else { v17 = libc.Int32FromUint8(*(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(m)))) } *(*Tuch)(unsafe.Pointer(s + 5208 + uintptr(node))) = libc.Uint8FromInt32(v17 + libc.Int32FromInt32(1)) v18 = libc.Uint16FromInt32(node) *(*Tush)(unsafe.Pointer(tree + uintptr(m)*4 + 2)) = v18 *(*Tush)(unsafe.Pointer(tree + uintptr(n)*4 + 2)) = v18 /* and insert the new node in the heap */ v19 = node node++ *(*int32)(unsafe.Pointer(s + 2908 + 1*4)) = v19 _pqdownheap(tls, s, tree, int32(SMALLEST)) } v21 = s + 5204 *(*int32)(unsafe.Pointer(v21))-- v20 = *(*int32)(unsafe.Pointer(v21)) *(*int32)(unsafe.Pointer(s + 2908 + uintptr(v20)*4)) = *(*int32)(unsafe.Pointer(s + 2908 + 1*4)) /* At this point, the fields freq and dad are set. We can now * generate the bit lengths. */ _gen_bitlen(tls, s, desc) /* The field len is now set, we can generate the bit codes */ _gen_codes(tls, tree, max_code, s+2876) } // C documentation // // /* =========================================================================== // * Scan a literal or distance tree to determine the frequencies of the codes // * in the bit length tree. // */ func _scan_tree(tls *libc.TLS, s uintptr, tree uintptr, max_code int32) { var count, curlen, max_count, min_count, n, nextlen, prevlen, v2 int32 var p3 uintptr _, _, _, _, _, _, _, _, _ = count, curlen, max_count, min_count, n, nextlen, prevlen, v2, p3 /* iterates over all tree elements */ prevlen = -int32(1) /* length of current code */ nextlen = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + 2))) /* length of next code */ count = 0 /* repeat count of the current code */ max_count = int32(7) /* max repeat count */ min_count = int32(4) /* min repeat count */ if nextlen == 0 { max_count = int32(138) min_count = libc.Int32FromInt32(3) } *(*Tush)(unsafe.Pointer(tree + uintptr(max_code+int32(1))*4 + 2)) = libc.Uint16FromInt32(0xffff) /* guard */ n = 0 for { if !(n <= max_code) { break } curlen = nextlen nextlen = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(n+int32(1))*4 + 2))) count++ v2 = count if v2 < max_count && curlen == nextlen { goto _1 } else { if count < min_count { p3 = s + 2684 + uintptr(curlen)*4 *(*Tush)(unsafe.Pointer(p3)) = Tush(int32(*(*Tush)(unsafe.Pointer(p3))) + count) } else { if curlen != 0 { if curlen != prevlen { *(*Tush)(unsafe.Pointer(s + 2684 + uintptr(curlen)*4))++ } *(*Tush)(unsafe.Pointer(s + 2684 + 16*4))++ } else { if count <= int32(10) { *(*Tush)(unsafe.Pointer(s + 2684 + 17*4))++ } else { *(*Tush)(unsafe.Pointer(s + 2684 + 18*4))++ } } } } count = 0 prevlen = curlen if nextlen == 0 { max_count = int32(138) min_count = libc.Int32FromInt32(3) } else { if curlen == nextlen { max_count = int32(6) min_count = libc.Int32FromInt32(3) } else { max_count = int32(7) min_count = libc.Int32FromInt32(4) } } goto _1 _1: ; n++ } } // C documentation // // /* =========================================================================== // * Send a literal or distance tree in compressed form, using the codes in // * bl_tree. // */ func _send_tree(tls *libc.TLS, s uintptr, tree uintptr, max_code int32) { var count, curlen, len1, len11, len2, len3, len4, len5, len6, len7, max_count, min_count, n, nextlen, prevlen, val, val1, val2, val3, val4, val5, val6, val7, v2, v3 int32 var v12, v14, v18, v20, v24, v26, v30, v32, v36, v38, v42, v44, v48, v50, v6, v8 Tulg var v13, v15, v19, v21, v25, v27, v31, v33, v37, v39, v43, v45, v49, v51, v7, v9, p10, p11, p16, p17, p22, p23, p28, p29, p34, p35, p40, p41, p46, p47, p5, p52 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = count, curlen, len1, len11, len2, len3, len4, len5, len6, len7, max_count, min_count, n, nextlen, prevlen, val, val1, val2, val3, val4, val5, val6, val7, v12, v13, v14, v15, v18, v19, v2, v20, v21, v24, v25, v26, v27, v3, v30, v31, v32, v33, v36, v37, v38, v39, v42, v43, v44, v45, v48, v49, v50, v51, v6, v7, v8, v9, p10, p11, p16, p17, p22, p23, p28, p29, p34, p35, p40, p41, p46, p47, p5, p52 /* iterates over all tree elements */ prevlen = -int32(1) /* length of current code */ nextlen = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + 2))) /* length of next code */ count = 0 /* repeat count of the current code */ max_count = int32(7) /* max repeat count */ min_count = int32(4) /* min repeat count */ /* tree[max_code + 1].Len = -1; */ /* guard already set */ if nextlen == 0 { max_count = int32(138) min_count = libc.Int32FromInt32(3) } n = 0 for { if !(n <= max_code) { break } curlen = nextlen nextlen = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(tree + uintptr(n+int32(1))*4 + 2))) count++ v2 = count if v2 < max_count && curlen == nextlen { goto _1 } else { if count < min_count { for { len1 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + uintptr(curlen)*4 + 2))) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len1 { val = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + uintptr(curlen)*4))) p5 = s + 5816 *(*Tush)(unsafe.Pointer(p5)) = Tush(int32(*(*Tush)(unsafe.Pointer(p5))) | libc.Int32FromUint16(libc.Uint16FromInt32(val))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v7 = s + 20 v6 = *(*Tulg)(unsafe.Pointer(v7)) *(*Tulg)(unsafe.Pointer(v7))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v6))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v9 = s + 20 v8 = *(*Tulg)(unsafe.Pointer(v9)) *(*Tulg)(unsafe.Pointer(v9))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v8))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len1 - int32(Buf_size) } else { p10 = s + 5816 *(*Tush)(unsafe.Pointer(p10)) = Tush(int32(*(*Tush)(unsafe.Pointer(p10))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + uintptr(curlen)*4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len1 } goto _4 _4: ; count-- v3 = count if !(v3 != 0) { break } } } else { if curlen != 0 { if curlen != prevlen { len11 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + uintptr(curlen)*4 + 2))) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len11 { val1 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + uintptr(curlen)*4))) p11 = s + 5816 *(*Tush)(unsafe.Pointer(p11)) = Tush(int32(*(*Tush)(unsafe.Pointer(p11))) | libc.Int32FromUint16(libc.Uint16FromInt32(val1))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v13 = s + 20 v12 = *(*Tulg)(unsafe.Pointer(v13)) *(*Tulg)(unsafe.Pointer(v13))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v12))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v15 = s + 20 v14 = *(*Tulg)(unsafe.Pointer(v15)) *(*Tulg)(unsafe.Pointer(v15))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v14))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val1)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len11 - int32(Buf_size) } else { p16 = s + 5816 *(*Tush)(unsafe.Pointer(p16)) = Tush(int32(*(*Tush)(unsafe.Pointer(p16))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + uintptr(curlen)*4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len11 } count-- } len2 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + 16*4 + 2))) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len2 { val2 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + 16*4))) p17 = s + 5816 *(*Tush)(unsafe.Pointer(p17)) = Tush(int32(*(*Tush)(unsafe.Pointer(p17))) | libc.Int32FromUint16(libc.Uint16FromInt32(val2))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v19 = s + 20 v18 = *(*Tulg)(unsafe.Pointer(v19)) *(*Tulg)(unsafe.Pointer(v19))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v18))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v21 = s + 20 v20 = *(*Tulg)(unsafe.Pointer(v21)) *(*Tulg)(unsafe.Pointer(v21))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v20))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val2)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len2 - int32(Buf_size) } else { p22 = s + 5816 *(*Tush)(unsafe.Pointer(p22)) = Tush(int32(*(*Tush)(unsafe.Pointer(p22))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + 16*4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len2 } len3 = int32(2) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len3 { val3 = count - int32(3) p23 = s + 5816 *(*Tush)(unsafe.Pointer(p23)) = Tush(int32(*(*Tush)(unsafe.Pointer(p23))) | libc.Int32FromUint16(libc.Uint16FromInt32(val3))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v25 = s + 20 v24 = *(*Tulg)(unsafe.Pointer(v25)) *(*Tulg)(unsafe.Pointer(v25))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v24))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v27 = s + 20 v26 = *(*Tulg)(unsafe.Pointer(v27)) *(*Tulg)(unsafe.Pointer(v27))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v26))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val3)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len3 - int32(Buf_size) } else { p28 = s + 5816 *(*Tush)(unsafe.Pointer(p28)) = Tush(int32(*(*Tush)(unsafe.Pointer(p28))) | libc.Int32FromUint16(libc.Uint16FromInt32(count-libc.Int32FromInt32(3)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len3 } } else { if count <= int32(10) { len4 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + 17*4 + 2))) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len4 { val4 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + 17*4))) p29 = s + 5816 *(*Tush)(unsafe.Pointer(p29)) = Tush(int32(*(*Tush)(unsafe.Pointer(p29))) | libc.Int32FromUint16(libc.Uint16FromInt32(val4))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v31 = s + 20 v30 = *(*Tulg)(unsafe.Pointer(v31)) *(*Tulg)(unsafe.Pointer(v31))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v30))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v33 = s + 20 v32 = *(*Tulg)(unsafe.Pointer(v33)) *(*Tulg)(unsafe.Pointer(v33))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v32))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val4)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len4 - int32(Buf_size) } else { p34 = s + 5816 *(*Tush)(unsafe.Pointer(p34)) = Tush(int32(*(*Tush)(unsafe.Pointer(p34))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + 17*4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len4 } len5 = int32(3) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len5 { val5 = count - int32(3) p35 = s + 5816 *(*Tush)(unsafe.Pointer(p35)) = Tush(int32(*(*Tush)(unsafe.Pointer(p35))) | libc.Int32FromUint16(libc.Uint16FromInt32(val5))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v37 = s + 20 v36 = *(*Tulg)(unsafe.Pointer(v37)) *(*Tulg)(unsafe.Pointer(v37))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v36))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v39 = s + 20 v38 = *(*Tulg)(unsafe.Pointer(v39)) *(*Tulg)(unsafe.Pointer(v39))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v38))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val5)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len5 - int32(Buf_size) } else { p40 = s + 5816 *(*Tush)(unsafe.Pointer(p40)) = Tush(int32(*(*Tush)(unsafe.Pointer(p40))) | libc.Int32FromUint16(libc.Uint16FromInt32(count-libc.Int32FromInt32(3)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len5 } } else { len6 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + 18*4 + 2))) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len6 { val6 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + 18*4))) p41 = s + 5816 *(*Tush)(unsafe.Pointer(p41)) = Tush(int32(*(*Tush)(unsafe.Pointer(p41))) | libc.Int32FromUint16(libc.Uint16FromInt32(val6))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v43 = s + 20 v42 = *(*Tulg)(unsafe.Pointer(v43)) *(*Tulg)(unsafe.Pointer(v43))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v42))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v45 = s + 20 v44 = *(*Tulg)(unsafe.Pointer(v45)) *(*Tulg)(unsafe.Pointer(v45))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v44))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val6)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len6 - int32(Buf_size) } else { p46 = s + 5816 *(*Tush)(unsafe.Pointer(p46)) = Tush(int32(*(*Tush)(unsafe.Pointer(p46))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + 18*4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len6 } len7 = int32(7) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len7 { val7 = count - int32(11) p47 = s + 5816 *(*Tush)(unsafe.Pointer(p47)) = Tush(int32(*(*Tush)(unsafe.Pointer(p47))) | libc.Int32FromUint16(libc.Uint16FromInt32(val7))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v49 = s + 20 v48 = *(*Tulg)(unsafe.Pointer(v49)) *(*Tulg)(unsafe.Pointer(v49))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v48))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v51 = s + 20 v50 = *(*Tulg)(unsafe.Pointer(v51)) *(*Tulg)(unsafe.Pointer(v51))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v50))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val7)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len7 - int32(Buf_size) } else { p52 = s + 5816 *(*Tush)(unsafe.Pointer(p52)) = Tush(int32(*(*Tush)(unsafe.Pointer(p52))) | libc.Int32FromUint16(libc.Uint16FromInt32(count-libc.Int32FromInt32(11)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len7 } } } } } count = 0 prevlen = curlen if nextlen == 0 { max_count = int32(138) min_count = libc.Int32FromInt32(3) } else { if curlen == nextlen { max_count = int32(6) min_count = libc.Int32FromInt32(3) } else { max_count = int32(7) min_count = libc.Int32FromInt32(4) } } goto _1 _1: ; n++ } } // C documentation // // /* =========================================================================== // * Construct the Huffman tree for the bit lengths and return the index in // * bl_order of the last bit length code to send. // */ func _build_bl_tree(tls *libc.TLS, s uintptr) (r int32) { var max_blindex int32 _ = max_blindex /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ _scan_tree(tls, s, s+148, (*Tdeflate_state)(unsafe.Pointer(s)).Fl_desc.Fmax_code) _scan_tree(tls, s, s+2440, (*Tdeflate_state)(unsafe.Pointer(s)).Fd_desc.Fmax_code) /* Build the bit length tree: */ _build_tree(tls, s, s+2864) /* opt_len now includes the length of the tree representations, except the * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format * requires that at least 4 bit length codes be sent. (appnote.txt says * 3 but the actual value used is 4.) */ max_blindex = libc.Int32FromInt32(BL_CODES) - libc.Int32FromInt32(1) for { if !(max_blindex >= int32(3)) { break } if libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + uintptr(_bl_order[max_blindex])*4 + 2))) != 0 { break } goto _1 _1: ; max_blindex-- } /* Update opt_len to include the bit length tree and counts */ *(*Tulg)(unsafe.Pointer(s + 5800)) += uint32(3)*(libc.Uint32FromInt32(max_blindex)+uint32(1)) + uint32(5) + uint32(5) + uint32(4) return max_blindex } // C documentation // // /* =========================================================================== // * Send the header for a block using dynamic Huffman trees: the counts, the // * lengths of the bit length codes, the literal tree and the distance tree. // * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. // */ func _send_all_trees(tls *libc.TLS, s uintptr, lcodes int32, dcodes int32, blcodes int32) { var len1, len11, len2, len3, rank, val, val1, val2, val3 int32 var v10, v14, v16, v2, v21, v23, v4, v8 Tulg var v11, v15, v17, v22, v24, v3, v5, v9, p1, p12, p13, p18, p20, p25, p6, p7 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = len1, len11, len2, len3, rank, val, val1, val2, val3, v10, v11, v14, v15, v16, v17, v2, v21, v22, v23, v24, v3, v4, v5, v8, v9, p1, p12, p13, p18, p20, p25, p6, p7 /* index in bl_order */ len1 = int32(5) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len1 { val = lcodes - int32(257) p1 = s + 5816 *(*Tush)(unsafe.Pointer(p1)) = Tush(int32(*(*Tush)(unsafe.Pointer(p1))) | libc.Int32FromUint16(libc.Uint16FromInt32(val))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v3 = s + 20 v2 = *(*Tulg)(unsafe.Pointer(v3)) *(*Tulg)(unsafe.Pointer(v3))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v2))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v5 = s + 20 v4 = *(*Tulg)(unsafe.Pointer(v5)) *(*Tulg)(unsafe.Pointer(v5))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v4))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len1 - int32(Buf_size) } else { p6 = s + 5816 *(*Tush)(unsafe.Pointer(p6)) = Tush(int32(*(*Tush)(unsafe.Pointer(p6))) | libc.Int32FromUint16(libc.Uint16FromInt32(lcodes-libc.Int32FromInt32(257)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len1 } /* not +255 as stated in appnote.txt */ len11 = int32(5) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len11 { val1 = dcodes - int32(1) p7 = s + 5816 *(*Tush)(unsafe.Pointer(p7)) = Tush(int32(*(*Tush)(unsafe.Pointer(p7))) | libc.Int32FromUint16(libc.Uint16FromInt32(val1))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v9 = s + 20 v8 = *(*Tulg)(unsafe.Pointer(v9)) *(*Tulg)(unsafe.Pointer(v9))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v8))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v11 = s + 20 v10 = *(*Tulg)(unsafe.Pointer(v11)) *(*Tulg)(unsafe.Pointer(v11))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v10))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val1)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len11 - int32(Buf_size) } else { p12 = s + 5816 *(*Tush)(unsafe.Pointer(p12)) = Tush(int32(*(*Tush)(unsafe.Pointer(p12))) | libc.Int32FromUint16(libc.Uint16FromInt32(dcodes-libc.Int32FromInt32(1)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len11 } len2 = int32(4) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len2 { val2 = blcodes - int32(4) p13 = s + 5816 *(*Tush)(unsafe.Pointer(p13)) = Tush(int32(*(*Tush)(unsafe.Pointer(p13))) | libc.Int32FromUint16(libc.Uint16FromInt32(val2))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v15 = s + 20 v14 = *(*Tulg)(unsafe.Pointer(v15)) *(*Tulg)(unsafe.Pointer(v15))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v14))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v17 = s + 20 v16 = *(*Tulg)(unsafe.Pointer(v17)) *(*Tulg)(unsafe.Pointer(v17))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v16))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val2)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len2 - int32(Buf_size) } else { p18 = s + 5816 *(*Tush)(unsafe.Pointer(p18)) = Tush(int32(*(*Tush)(unsafe.Pointer(p18))) | libc.Int32FromUint16(libc.Uint16FromInt32(blcodes-libc.Int32FromInt32(4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len2 } /* not -3 as stated in appnote.txt */ rank = 0 for { if !(rank < blcodes) { break } len3 = int32(3) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len3 { val3 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + uintptr(_bl_order[rank])*4 + 2))) p20 = s + 5816 *(*Tush)(unsafe.Pointer(p20)) = Tush(int32(*(*Tush)(unsafe.Pointer(p20))) | libc.Int32FromUint16(libc.Uint16FromInt32(val3))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v22 = s + 20 v21 = *(*Tulg)(unsafe.Pointer(v22)) *(*Tulg)(unsafe.Pointer(v22))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v21))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v24 = s + 20 v23 = *(*Tulg)(unsafe.Pointer(v24)) *(*Tulg)(unsafe.Pointer(v24))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v23))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val3)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len3 - int32(Buf_size) } else { p25 = s + 5816 *(*Tush)(unsafe.Pointer(p25)) = Tush(int32(*(*Tush)(unsafe.Pointer(p25))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 2684 + uintptr(_bl_order[rank])*4 + 2)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len3 } goto _19 _19: ; rank++ } _send_tree(tls, s, s+148, lcodes-int32(1)) /* literal tree */ _send_tree(tls, s, s+2440, dcodes-int32(1)) /* distance tree */ } // C documentation // // /* =========================================================================== // * Send a stored block // */ func X_tr_stored_block(tls *libc.TLS, s uintptr, buf uintptr, stored_len Tulg, last int32) { var len1, val int32 var v10, v12, v14, v3, v5, v8, p1, p6 uintptr var v11, v13, v2, v4, v7, v9 Tulg _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = len1, val, v10, v11, v12, v13, v14, v2, v3, v4, v5, v7, v8, v9, p1, p6 len1 = int32(3) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len1 { val = libc.Int32FromInt32(STORED_BLOCK)<> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len1 - int32(Buf_size) } else { p6 = s + 5816 *(*Tush)(unsafe.Pointer(p6)) = Tush(int32(*(*Tush)(unsafe.Pointer(p6))) | libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(STORED_BLOCK)<> libc.Int32FromInt32(8)) v12 = s + 20 v11 = *(*Tulg)(unsafe.Pointer(v12)) *(*Tulg)(unsafe.Pointer(v12))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v11))) = libc.Uint8FromInt32(libc.Int32FromUint16(uint16(^stored_len)) & libc.Int32FromInt32(0xff)) v14 = s + 20 v13 = *(*Tulg)(unsafe.Pointer(v14)) *(*Tulg)(unsafe.Pointer(v14))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v13))) = libc.Uint8FromInt32(libc.Int32FromUint16(uint16(^stored_len)) >> libc.Int32FromInt32(8)) if stored_len != 0 { libc.Xmemcpy(tls, (*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf+uintptr((*Tdeflate_state)(unsafe.Pointer(s)).Fpending), buf, stored_len) } *(*Tulg)(unsafe.Pointer(s + 20)) += stored_len } // C documentation // // /* =========================================================================== // * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) // */ func X_tr_flush_bits(tls *libc.TLS, s uintptr) { _bi_flush(tls, s) } // C documentation // // /* =========================================================================== // * Send one empty static block to give enough lookahead for inflate. // * This takes 10 bits, of which 7 may remain in the bit buffer. // */ func X_tr_align(tls *libc.TLS, s uintptr) { var len1, len11, val, val1 int32 var v10, v2, v4, v8 Tulg var v11, v3, v5, v9, p1, p12, p6, p7 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = len1, len11, val, val1, v10, v11, v2, v3, v4, v5, v8, v9, p1, p12, p6, p7 len1 = int32(3) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len1 { val = libc.Int32FromInt32(STATIC_TREES) << libc.Int32FromInt32(1) p1 = s + 5816 *(*Tush)(unsafe.Pointer(p1)) = Tush(int32(*(*Tush)(unsafe.Pointer(p1))) | libc.Int32FromUint16(libc.Uint16FromInt32(val))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v3 = s + 20 v2 = *(*Tulg)(unsafe.Pointer(v3)) *(*Tulg)(unsafe.Pointer(v3))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v2))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v5 = s + 20 v4 = *(*Tulg)(unsafe.Pointer(v5)) *(*Tulg)(unsafe.Pointer(v5))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v4))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len1 - int32(Buf_size) } else { p6 = s + 5816 *(*Tush)(unsafe.Pointer(p6)) = Tush(int32(*(*Tush)(unsafe.Pointer(p6))) | libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(STATIC_TREES)< libc.Int32FromInt32(Buf_size)-len11 { val1 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(uintptr(unsafe.Pointer(&_static_ltree)) + 256*4))) p7 = s + 5816 *(*Tush)(unsafe.Pointer(p7)) = Tush(int32(*(*Tush)(unsafe.Pointer(p7))) | libc.Int32FromUint16(libc.Uint16FromInt32(val1))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v9 = s + 20 v8 = *(*Tulg)(unsafe.Pointer(v9)) *(*Tulg)(unsafe.Pointer(v9))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v8))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v11 = s + 20 v10 = *(*Tulg)(unsafe.Pointer(v11)) *(*Tulg)(unsafe.Pointer(v11))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v10))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val1)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len11 - int32(Buf_size) } else { p12 = s + 5816 *(*Tush)(unsafe.Pointer(p12)) = Tush(int32(*(*Tush)(unsafe.Pointer(p12))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(uintptr(unsafe.Pointer(&_static_ltree)) + 256*4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len11 } _bi_flush(tls, s) } // C documentation // // /* =========================================================================== // * Send the block data compressed using the given Huffman trees // */ func _compress_block(tls *libc.TLS, s uintptr, ltree uintptr, dtree uintptr) { var code, dist, sx, v1, v2, v3 uint32 var extra, lc, len1, len11, len2, len3, len4, len5, val, val1, val2, val3, val4, val5, v22 int32 var v11, v13, v17, v19, v24, v26, v30, v32, v36, v38, v5, v7 Tulg var v12, v14, v18, v20, v25, v27, v31, v33, v37, v39, v6, v8, p10, p15, p16, p21, p23, p28, p29, p34, p35, p4, p40, p9 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = code, dist, extra, lc, len1, len11, len2, len3, len4, len5, sx, val, val1, val2, val3, val4, val5, v1, v11, v12, v13, v14, v17, v18, v19, v2, v20, v22, v24, v25, v26, v27, v3, v30, v31, v32, v33, v36, v37, v38, v39, v5, v6, v7, v8, p10, p15, p16, p21, p23, p28, p29, p34, p35, p4, p40, p9 /* match length or unmatched char (if dist == 0) */ sx = uint32(0) /* number of extra bits to send */ if (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next != uint32(0) { for cond := true; cond; cond = sx < (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next { v1 = sx sx++ dist = libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v1)))) & int32(0xff)) v2 = sx sx++ dist += libc.Uint32FromInt32(libc.Int32FromUint8(*(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v2))))&libc.Int32FromInt32(0xff)) << int32(8) v3 = sx sx++ lc = libc.Int32FromUint8(*(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v3)))) if dist == uint32(0) { len1 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(ltree + uintptr(lc)*4 + 2))) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len1 { val = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(ltree + uintptr(lc)*4))) p4 = s + 5816 *(*Tush)(unsafe.Pointer(p4)) = Tush(int32(*(*Tush)(unsafe.Pointer(p4))) | libc.Int32FromUint16(libc.Uint16FromInt32(val))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v6 = s + 20 v5 = *(*Tulg)(unsafe.Pointer(v6)) *(*Tulg)(unsafe.Pointer(v6))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v5))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v8 = s + 20 v7 = *(*Tulg)(unsafe.Pointer(v8)) *(*Tulg)(unsafe.Pointer(v8))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v7))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len1 - int32(Buf_size) } else { p9 = s + 5816 *(*Tush)(unsafe.Pointer(p9)) = Tush(int32(*(*Tush)(unsafe.Pointer(p9))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(ltree + uintptr(lc)*4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len1 } /* send a literal byte */ } else { /* Here, lc is the match length - MIN_MATCH */ code = uint32(X_length_code[lc]) len11 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(ltree + uintptr(code+uint32(LITERALS)+uint32(1))*4 + 2))) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len11 { val1 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(ltree + uintptr(code+uint32(LITERALS)+uint32(1))*4))) p10 = s + 5816 *(*Tush)(unsafe.Pointer(p10)) = Tush(int32(*(*Tush)(unsafe.Pointer(p10))) | libc.Int32FromUint16(libc.Uint16FromInt32(val1))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v12 = s + 20 v11 = *(*Tulg)(unsafe.Pointer(v12)) *(*Tulg)(unsafe.Pointer(v12))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v11))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v14 = s + 20 v13 = *(*Tulg)(unsafe.Pointer(v14)) *(*Tulg)(unsafe.Pointer(v14))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v13))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val1)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len11 - int32(Buf_size) } else { p15 = s + 5816 *(*Tush)(unsafe.Pointer(p15)) = Tush(int32(*(*Tush)(unsafe.Pointer(p15))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(ltree + uintptr(code+uint32(LITERALS)+uint32(1))*4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len11 } /* send length code */ extra = _extra_lbits[code] if extra != 0 { lc -= _base_length[code] len2 = extra if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len2 { val2 = lc p16 = s + 5816 *(*Tush)(unsafe.Pointer(p16)) = Tush(int32(*(*Tush)(unsafe.Pointer(p16))) | libc.Int32FromUint16(libc.Uint16FromInt32(val2))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v18 = s + 20 v17 = *(*Tulg)(unsafe.Pointer(v18)) *(*Tulg)(unsafe.Pointer(v18))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v17))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v20 = s + 20 v19 = *(*Tulg)(unsafe.Pointer(v20)) *(*Tulg)(unsafe.Pointer(v20))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v19))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val2)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len2 - int32(Buf_size) } else { p21 = s + 5816 *(*Tush)(unsafe.Pointer(p21)) = Tush(int32(*(*Tush)(unsafe.Pointer(p21))) | libc.Int32FromUint16(libc.Uint16FromInt32(lc))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len2 } /* send the extra length bits */ } dist-- /* dist is now the match distance - 1 */ if dist < uint32(256) { v22 = libc.Int32FromUint8(X_dist_code[dist]) } else { v22 = libc.Int32FromUint8(X_dist_code[uint32(256)+dist>>int32(7)]) } code = libc.Uint32FromInt32(v22) len3 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(dtree + uintptr(code)*4 + 2))) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len3 { val3 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(dtree + uintptr(code)*4))) p23 = s + 5816 *(*Tush)(unsafe.Pointer(p23)) = Tush(int32(*(*Tush)(unsafe.Pointer(p23))) | libc.Int32FromUint16(libc.Uint16FromInt32(val3))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v25 = s + 20 v24 = *(*Tulg)(unsafe.Pointer(v25)) *(*Tulg)(unsafe.Pointer(v25))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v24))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v27 = s + 20 v26 = *(*Tulg)(unsafe.Pointer(v27)) *(*Tulg)(unsafe.Pointer(v27))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v26))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val3)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len3 - int32(Buf_size) } else { p28 = s + 5816 *(*Tush)(unsafe.Pointer(p28)) = Tush(int32(*(*Tush)(unsafe.Pointer(p28))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(dtree + uintptr(code)*4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len3 } /* send the distance code */ extra = _extra_dbits[code] if extra != 0 { dist -= libc.Uint32FromInt32(_base_dist[code]) len4 = extra if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len4 { val4 = libc.Int32FromUint32(dist) p29 = s + 5816 *(*Tush)(unsafe.Pointer(p29)) = Tush(int32(*(*Tush)(unsafe.Pointer(p29))) | libc.Int32FromUint16(libc.Uint16FromInt32(val4))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v31 = s + 20 v30 = *(*Tulg)(unsafe.Pointer(v31)) *(*Tulg)(unsafe.Pointer(v31))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v30))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v33 = s + 20 v32 = *(*Tulg)(unsafe.Pointer(v33)) *(*Tulg)(unsafe.Pointer(v33))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v32))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val4)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len4 - int32(Buf_size) } else { p34 = s + 5816 *(*Tush)(unsafe.Pointer(p34)) = Tush(int32(*(*Tush)(unsafe.Pointer(p34))) | libc.Int32FromUint16(uint16(dist))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len4 } /* send the extra distance bits */ } } /* literal or match pair ? */ /* Check for no overlay of pending_buf on needed symbols */ } } len5 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(ltree + 256*4 + 2))) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len5 { val5 = libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(ltree + 256*4))) p35 = s + 5816 *(*Tush)(unsafe.Pointer(p35)) = Tush(int32(*(*Tush)(unsafe.Pointer(p35))) | libc.Int32FromUint16(libc.Uint16FromInt32(val5))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) v37 = s + 20 v36 = *(*Tulg)(unsafe.Pointer(v37)) *(*Tulg)(unsafe.Pointer(v37))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v36))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) & libc.Int32FromInt32(0xff)) v39 = s + 20 v38 = *(*Tulg)(unsafe.Pointer(v39)) *(*Tulg)(unsafe.Pointer(v39))++ *(*TBytef)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fpending_buf + uintptr(v38))) = libc.Uint8FromInt32(libc.Int32FromUint16((*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf) >> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val5)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len5 - int32(Buf_size) } else { p40 = s + 5816 *(*Tush)(unsafe.Pointer(p40)) = Tush(int32(*(*Tush)(unsafe.Pointer(p40))) | libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(ltree + 256*4)))<<(*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid) *(*int32)(unsafe.Pointer(s + 5820)) += len5 } } // C documentation // // /* =========================================================================== // * Check if the data type is TEXT or BINARY, using the following algorithm: // * - TEXT if the two conditions below are satisfied: // * a) There are no non-portable control characters belonging to the // * "block list" (0..6, 14..25, 28..31). // * b) There is at least one printable character belonging to the // * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). // * - BINARY otherwise. // * - The following partially-portable control characters form a // * "gray list" that is ignored in this detection algorithm: // * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). // * IN assertion: the fields Freq of dyn_ltree are set. // */ func _detect_data_type(tls *libc.TLS, s uintptr) (r int32) { var block_mask uint32 var n int32 _, _ = block_mask, n /* block_mask is the bit mask of block-listed bytes * set bits 0..6, 14..25, and 28..31 * 0xf3ffc07f = binary 11110011111111111100000001111111 */ block_mask = uint32(0xf3ffc07f) /* Check for non-textual ("block-listed") bytes. */ n = 0 for { if !(n <= int32(31)) { break } if block_mask&uint32(1) != 0 && libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 148 + uintptr(n)*4))) != 0 { return Z_BINARY } goto _1 _1: ; n++ block_mask >>= uint32(1) } /* Check for textual ("allow-listed") bytes. */ if libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 148 + 9*4))) != 0 || libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 148 + 10*4))) != 0 || libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 148 + 13*4))) != 0 { return int32(Z_TEXT) } n = int32(32) for { if !(n < int32(LITERALS)) { break } if libc.Int32FromUint16(*(*Tush)(unsafe.Pointer(s + 148 + uintptr(n)*4))) != 0 { return int32(Z_TEXT) } goto _2 _2: ; n++ } /* There are no "block-listed" or "allow-listed" bytes: * this stream either is empty or has tolerated ("gray-listed") bytes only. */ return Z_BINARY } // C documentation // // /* =========================================================================== // * Determine the best encoding for the current block: dynamic trees, static // * trees or store, and write out the encoded block. // */ func X_tr_flush_block(tls *libc.TLS, s uintptr, buf uintptr, stored_len Tulg, last int32) { var len1, len11, max_blindex, val, val1 int32 var opt_lenb, static_lenb, v1, v11, v3, v5, v9 Tulg var v10, v12, v4, v6, p13, p2, p7, p8 uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = len1, len11, max_blindex, opt_lenb, static_lenb, val, val1, v1, v10, v11, v12, v3, v4, v5, v6, v9, p13, p2, p7, p8 /* opt_len and static_len in bytes */ max_blindex = 0 /* index of last bit length code of non zero freq */ /* Build the Huffman trees unless a stored block is forced */ if (*Tdeflate_state)(unsafe.Pointer(s)).Flevel > 0 { /* Check if the file is binary or text */ if (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Fdata_type == int32(Z_UNKNOWN) { (*Tz_stream)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fstrm)).Fdata_type = _detect_data_type(tls, s) } /* Construct the literal and distance trees */ _build_tree(tls, s, s+2840) _build_tree(tls, s, s+2852) /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations. */ /* Build the bit length tree for the above two trees, and get the index * in bl_order of the last bit length code to send. */ max_blindex = _build_bl_tree(tls, s) /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = ((*Tdeflate_state)(unsafe.Pointer(s)).Fopt_len + uint32(3) + uint32(7)) >> int32(3) static_lenb = ((*Tdeflate_state)(unsafe.Pointer(s)).Fstatic_len + uint32(3) + uint32(7)) >> int32(3) if static_lenb <= opt_lenb || (*Tdeflate_state)(unsafe.Pointer(s)).Fstrategy == int32(Z_FIXED) { opt_lenb = static_lenb } } else { v1 = stored_len + libc.Uint32FromInt32(5) static_lenb = v1 opt_lenb = v1 /* force a stored block */ } if stored_len+uint32(4) <= opt_lenb && buf != libc.UintptrFromInt32(0) { /* 4: two words for the lengths */ /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to * transform a block into a stored block. */ X_tr_stored_block(tls, s, buf, stored_len, last) } else { if static_lenb == opt_lenb { len1 = int32(3) if (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid > libc.Int32FromInt32(Buf_size)-len1 { val = libc.Int32FromInt32(STATIC_TREES)<> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len1 - int32(Buf_size) } else { p7 = s + 5816 *(*Tush)(unsafe.Pointer(p7)) = Tush(int32(*(*Tush)(unsafe.Pointer(p7))) | libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(STATIC_TREES)< libc.Int32FromInt32(Buf_size)-len11 { val1 = libc.Int32FromInt32(DYN_TREES)<> libc.Int32FromInt32(8)) (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_buf = libc.Uint16FromInt32(libc.Int32FromUint16(libc.Uint16FromInt32(val1)) >> (int32(Buf_size) - (*Tdeflate_state)(unsafe.Pointer(s)).Fbi_valid)) *(*int32)(unsafe.Pointer(s + 5820)) += len11 - int32(Buf_size) } else { p13 = s + 5816 *(*Tush)(unsafe.Pointer(p13)) = Tush(int32(*(*Tush)(unsafe.Pointer(p13))) | libc.Int32FromUint16(libc.Uint16FromInt32(libc.Int32FromInt32(DYN_TREES)<> libc.Int32FromInt32(8)) v6 = s + 5792 v5 = *(*TuInt)(unsafe.Pointer(v6)) *(*TuInt)(unsafe.Pointer(v6))++ *(*Tuchf)(unsafe.Pointer((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_buf + uintptr(v5))) = uint8(lc) if dist == uint32(0) { /* lc is the unmatched char */ *(*Tush)(unsafe.Pointer(s + 148 + uintptr(lc)*4))++ } else { (*Tdeflate_state)(unsafe.Pointer(s)).Fmatches++ /* Here, lc is the match length - MIN_MATCH */ dist-- /* dist = match distance - 1 */ *(*Tush)(unsafe.Pointer(s + 148 + uintptr(libc.Int32FromUint8(X_length_code[lc])+int32(LITERALS)+int32(1))*4))++ if dist < uint32(256) { v7 = libc.Int32FromUint8(X_dist_code[dist]) } else { v7 = libc.Int32FromUint8(X_dist_code[uint32(256)+dist>>int32(7)]) } *(*Tush)(unsafe.Pointer(s + 2440 + uintptr(v7)*4))++ } return libc.BoolInt32((*Tdeflate_state)(unsafe.Pointer(s)).Fsym_next == (*Tdeflate_state)(unsafe.Pointer(s)).Fsym_end) } // C documentation // // /* =========================================================================== // Decompresses the source buffer into the destination buffer. *sourceLen is // the byte length of the source buffer. Upon entry, *destLen is the total size // of the destination buffer, which must be large enough to hold the entire // uncompressed data. (The size of the uncompressed data must have been saved // previously by the compressor and transmitted to the decompressor by some // mechanism outside the scope of this compression library.) Upon exit, // *destLen is the size of the decompressed data and *sourceLen is the number // of source bytes consumed. Upon return, source + *sourceLen points to the // first unused input byte. // // uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough // memory, Z_BUF_ERROR if there was not enough room in the output buffer, or // Z_DATA_ERROR if the input data was corrupted, including if the input data is // an incomplete zlib stream. // */ func Xuncompress2(tls *libc.TLS, dest uintptr, destLen uintptr, source uintptr, sourceLen uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var err, v3, v4, v5 int32 var left, len1 TuLong var max TuInt var v1, v2 uint32 var _ /* buf at bp+56 */ [1]TByte var _ /* stream at bp+0 */ Tz_stream _, _, _, _, _, _, _, _, _ = err, left, len1, max, v1, v2, v3, v4, v5 max = libc.Uint32FromInt32(-libc.Int32FromInt32(1)) /* for detection of incomplete stream when *destLen == 0 */ len1 = *(*TuLong)(unsafe.Pointer(sourceLen)) if *(*TuLongf)(unsafe.Pointer(destLen)) != 0 { left = *(*TuLongf)(unsafe.Pointer(destLen)) *(*TuLongf)(unsafe.Pointer(destLen)) = uint32(0) } else { left = uint32(1) dest = bp + 56 } (*(*Tz_stream)(unsafe.Pointer(bp))).Fnext_in = source (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_in = uint32(0) (*(*Tz_stream)(unsafe.Pointer(bp))).Fzalloc = libc.UintptrFromInt32(0) (*(*Tz_stream)(unsafe.Pointer(bp))).Fzfree = libc.UintptrFromInt32(0) (*(*Tz_stream)(unsafe.Pointer(bp))).Fopaque = libc.UintptrFromInt32(0) err = XinflateInit_(tls, bp, __ccgo_ts+15959, libc.Int32FromInt64(56)) if err != Z_OK { return err } (*(*Tz_stream)(unsafe.Pointer(bp))).Fnext_out = dest (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_out = uint32(0) for cond := true; cond; cond = err == Z_OK { if (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_out == uint32(0) { if left > max { v1 = max } else { v1 = left } (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_out = v1 left -= (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_out } if (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_in == uint32(0) { if len1 > max { v2 = max } else { v2 = len1 } (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_in = v2 len1 -= (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_in } err = Xinflate(tls, bp, Z_NO_FLUSH) } *(*TuLong)(unsafe.Pointer(sourceLen)) -= len1 + (*(*Tz_stream)(unsafe.Pointer(bp))).Favail_in if dest != bp+56 { *(*TuLongf)(unsafe.Pointer(destLen)) = (*(*Tz_stream)(unsafe.Pointer(bp))).Ftotal_out } else { if (*(*Tz_stream)(unsafe.Pointer(bp))).Ftotal_out != 0 && err == -int32(5) { left = uint32(1) } } XinflateEnd(tls, bp) if err == int32(Z_STREAM_END) { v3 = Z_OK } else { if err == int32(Z_NEED_DICT) { v4 = -int32(3) } else { if err == -int32(5) && left+(*(*Tz_stream)(unsafe.Pointer(bp))).Favail_out != 0 { v5 = -int32(3) } else { v5 = err } v4 = v5 } v3 = v4 } return v3 } func Xuncompress(tls *libc.TLS, dest uintptr, destLen uintptr, source uintptr, _sourceLen TuLong) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) *(*TuLong)(unsafe.Pointer(bp)) = _sourceLen return Xuncompress2(tls, dest, destLen, source, bp) } const ZLIBTCL_PATCH_LEVEL = "1.3.1" /* * Prototypes for procedures defined later in this file: */ /* *---------------------------------------------------------------------------- * * Zlibtcl_Init -- * * Initialisation routine for loadable module * * Results: * None. * * Side effects: * Creates commands in the interpreter, * loads zlibtcl package. * *---------------------------------------------------------------------------- */ func XZlibtcl_Init(tls *libc.TLS, interp uintptr) (r int32) { if !(XTcl_InitStubs(tls, interp, __ccgo_ts+384, libc.Int32FromInt32(0)|libc.Int32FromInt32(TCL_MAJOR_VERSION)< int32(2) { v1 = int32(9) } else { v1 = int32(2) - err } return Xz_errmsg[v1] } func Xzcalloc(tls *libc.TLS, opaque Tvoidpf, items uint32, size uint32) (r Tvoidpf) { _ = opaque return libc.Xmalloc(tls, items*size) } func Xzcfree(tls *libc.TLS, opaque Tvoidpf, ptr Tvoidpf) { _ = opaque libc.Xfree(tls, ptr) } const AF_ALG = 38 const AF_APPLETALK = 5 const AF_ASH = 18 const AF_ATMPVC = 8 const AF_ATMSVC = 20 const AF_AX25 = 3 const AF_BLUETOOTH = 31 const AF_BRIDGE = 7 const AF_CAIF = 37 const AF_CAN = 29 const AF_DECnet = 12 const AF_ECONET = 19 const AF_FILE = 1 const AF_IB = 27 const AF_IEEE802154 = 36 const AF_INET = 2 const AF_INET6 = 10 const AF_IPX = 4 const AF_IRDA = 23 const AF_ISDN = 34 const AF_IUCV = 32 const AF_KCM = 41 const AF_KEY = 15 const AF_LLC = 26 const AF_LOCAL = 1 const AF_MAX = 45 const AF_MPLS = 28 const AF_NETBEUI = 13 const AF_NETLINK = 16 const AF_NETROM = 6 const AF_NFC = 39 const AF_PACKET = 17 const AF_PHONET = 35 const AF_PPPOX = 24 const AF_QIPCRTR = 42 const AF_RDS = 21 const AF_ROSE = 11 const AF_ROUTE = 16 const AF_RXRPC = 33 const AF_SECURITY = 14 const AF_SMC = 43 const AF_SNA = 22 const AF_TIPC = 30 const AF_UNIX = 1 const AF_UNSPEC = 0 const AF_VSOCK = 40 const AF_WANPIPE = 25 const AF_X25 = 9 const AF_XDP = 44 const AI_ADDRCONFIG = 32 const AI_ALL = 16 const AI_CANONNAME = 2 const AI_NUMERICHOST = 4 const AI_NUMERICSERV = 1024 const AI_PASSIVE = 1 const AI_V4MAPPED = 8 const ALLOC_NOBJHIGH = 1200 const AT_EACCESS1 = 512 const AT_EMPTY_PATH1 = 4096 const AT_FDCWD = -100 const AT_NO_AUTOMOUNT1 = 2048 const AT_RECURSIVE1 = 32768 const AT_REMOVEDIR1 = 512 const AT_STATX_DONT_SYNC1 = 16384 const AT_STATX_FORCE_SYNC1 = 8192 const AT_STATX_SYNC_AS_STAT1 = 0 const AT_STATX_SYNC_TYPE1 = 24576 const AT_SYMLINK_FOLLOW1 = 1024 const AT_SYMLINK_NOFOLLOW1 = 256 const BIG_ENDIAN1 = 4321 const BUS_ADRALN = 1 const BUS_ADRERR = 2 const BUS_MCEERR_AO = 5 const BUS_MCEERR_AR = 4 const BUS_OBJERR = 3 const BYTE_ORDER1 = 1234 const CANBSIZ = 255 const CANCELED = 4096 const CLD_CONTINUED = 6 const CLD_DUMPED = 3 const CLD_EXITED = 1 const CLD_KILLED = 2 const CLD_STOPPED = 5 const CLD_TRAPPED = 4 const CLL_END = -1 const CLONE_CHILD_CLEARTID = 2097152 const CLONE_CHILD_SETTID = 16777216 const CLONE_DETACHED = 4194304 const CLONE_FILES = 1024 const CLONE_FS = 512 const CLONE_IO = 2147483648 const CLONE_NEWCGROUP = 33554432 const CLONE_NEWIPC = 134217728 const CLONE_NEWNET = 1073741824 const CLONE_NEWNS = 131072 const CLONE_NEWPID = 536870912 const CLONE_NEWTIME = 128 const CLONE_NEWUSER = 268435456 const CLONE_NEWUTS = 67108864 const CLONE_PARENT = 32768 const CLONE_PARENT_SETTID = 1048576 const CLONE_PIDFD = 4096 const CLONE_PTRACE = 8192 const CLONE_SETTLS = 524288 const CLONE_SIGHAND = 2048 const CLONE_SYSVSEM = 262144 const CLONE_THREAD = 65536 const CLONE_UNTRACED = 8388608 const CLONE_VFORK = 16384 const CLONE_VM = 256 const CMD_COMPILES_EXPANDED = 8 const CMD_DEAD = 64 const CMD_DYING = 1 const CMD_HAS_EXEC_TRACES = 4 const CMD_REDEF_IN_PROGRESS = 16 const CMD_TRACE_ACTIVE = 2 const CMD_VIA_RESOLVER = 32 const CONST861 = 0 const CPU_SETSIZE = 1024 const CSIGNAL = 255 const DBL_EPSILON1 = 0 const DBL_MAX5 = 0 const DBL_MIN3 = 0 const DBL_MIN_10_EXP = -307 const DBL_MIN_EXP = -1021 const DBL_TRUE_MIN1 = 0 const DELAYTIMER_MAX1 = 2147483647 const DELETED = 1 const DEV_BSIZE = 512 const DICT_PATH_CREATE = 5 const DICT_PATH_EXISTS = 2 const DICT_PATH_READ = 0 const DICT_PATH_UPDATE = 1 const DN_ACCESS1 = 1 const DN_ATTRIB1 = 32 const DN_CREATE1 = 4 const DN_DELETE1 = 8 const DN_MODIFY1 = 2 const DN_MULTISHOT1 = 2147483648 const DN_RENAME1 = 16 const DONT_COMPILE_CMDS_INLINE = 32 const DT_BLK = 6 const DT_CHR = 2 const DT_DIR = 4 const DT_FIFO = 1 const DT_LNK = 10 const DT_REG = 8 const DT_SOCK = 12 const DT_UNKNOWN = 0 const DT_WHT = 14 const EAI_ADDRFAMILY = -9 const EAI_AGAIN = -3 const EAI_ALLDONE = -103 const EAI_BADFLAGS = -1 const EAI_CANCELED = -101 const EAI_FAIL = -4 const EAI_FAMILY = -6 const EAI_IDN_ENCODE = -105 const EAI_INPROGRESS = -100 const EAI_INTR = -104 const EAI_MEMORY = -10 const EAI_NODATA = -5 const EAI_NONAME = -2 const EAI_NOTCANCELED = -102 const EAI_OVERFLOW = -12 const EAI_SERVICE = -8 const EAI_SOCKTYPE = -7 const EAI_SYSTEM = -11 const EDEADLOCK1 = 35 const ENCODING_PROFILE_MASK = 4278190080 const ENOTSUP1 = 95 const ENSEMBLE_COMPILE = 4 const ENSEMBLE_DEAD = 1 const ERR_ALREADY_LOGGED = 4 const ERR_LEGACY_COPY = 2048 const EWOULDBLOCK1 = 11 const EXTERN = 0 const FAPPEND1 = 1024 const FASYNC1 = 8192 const FFSYNC1 = 1052672 const FLT_EPSILON1 = 0 const FLT_MAX5 = 0 const FLT_MIN1 = 0 const FLT_MIN_10_EXP = -37 const FLT_MIN_EXP = -125 const FLT_ROUNDS = 0 const FLT_TRUE_MIN1 = 0 const FNDELAY1 = 2048 const FNONBLOCK1 = 2048 const FPE_FLTDIV = 3 const FPE_FLTINV = 7 const FPE_FLTOVF = 4 const FPE_FLTRES = 6 const FPE_FLTSUB = 8 const FPE_FLTUND = 5 const FPE_INTDIV = 1 const FPE_INTOVF = 2 const FRAME_IS_LAMBDA = 2 const FRAME_IS_METHOD = 4 const FRAME_IS_OO_DEFINE = 8 const FRAME_IS_PRIVATE_DEFINE = 16 const FRAME_IS_PROC = 1 const F_GETLK64 = 12 const F_SEAL_FUTURE_WRITE1 = 16 const F_SEAL_GROW1 = 4 const F_SEAL_SEAL1 = 1 const F_SEAL_SHRINK1 = 2 const F_SEAL_WRITE1 = 8 const F_SETLK64 = 13 const F_SETLKW64 = 14 const HAVE_BLKCNT_T = 1 const HAVE_CFMAKERAW = 1 const HAVE_DECL_GETHOSTBYADDR_R = 1 const HAVE_DECL_GETHOSTBYNAME_R = 1 const HAVE_DECL_PTHREAD_MUTEX_RECURSIVE = 1 const HAVE_FREEADDRINFO = 1 const HAVE_GAI_STRERROR = 1 const HAVE_GETADDRINFO = 1 const HAVE_GETCWD = 1 const HAVE_GETGRGID_R = 1 const HAVE_GETGRGID_R_5 = 1 const HAVE_GETGRNAM_R = 1 const HAVE_GETGRNAM_R_5 = 1 const HAVE_GETHOSTBYADDR_R = 1 const HAVE_GETHOSTBYADDR_R_8 = 1 const HAVE_GETHOSTBYNAME_R = 1 const HAVE_GETHOSTBYNAME_R_6 = 1 const HAVE_GETNAMEINFO = 1 const HAVE_GETPWNAM_R = 1 const HAVE_GETPWNAM_R_5 = 1 const HAVE_GETPWUID_R = 1 const HAVE_GETPWUID_R_5 = 1 const HAVE_GMTIME_R = 1 const HAVE_INTPTR_T = 1 const HAVE_LANGINFO = 1 const HAVE_LOCALTIME_R = 1 const HAVE_MKSTEMP = 1 const HAVE_MKSTEMPS = 1 const HAVE_POSIX_SPAWNATTR_SETFLAGS = 1 const HAVE_POSIX_SPAWNP = 1 const HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 = 1 const HAVE_PSELECT = 1 const HAVE_PTHREAD_ATFORK = 1 const HAVE_PTHREAD_ATTR_SETSTACKSIZE = 1 const HAVE_SIGNED_CHAR = 1 const HAVE_STRUCT_ADDRINFO = 1 const HAVE_STRUCT_DIRENT64 = 1 const HAVE_STRUCT_IN6_ADDR = 1 const HAVE_STRUCT_SOCKADDR_IN6 = 1 const HAVE_STRUCT_SOCKADDR_STORAGE = 1 const HAVE_STRUCT_STAT_ST_BLKSIZE = 1 const HAVE_STRUCT_STAT_ST_BLOCKS = 1 const HAVE_STRUCT_STAT_ST_RDEV = 1 const HAVE_SYS_IOCTL_H = 1 const HAVE_SYS_PARAM_H = 1 const HAVE_SYS_TIME_H = 1 const HAVE_TIMEZONE_VAR = 1 const HAVE_TM_GMTOFF = 1 const HAVE_TYPE_OFF64_T = 1 const HAVE_UINTPTR_T = 1 const HAVE_VFORK = 1 const HAVE_WAITPID = 1 const HOST_NOT_FOUND = 1 const ILL_BADSTK = 8 const ILL_COPROC = 7 const ILL_ILLADR = 3 const ILL_ILLOPC = 1 const ILL_ILLOPN = 2 const ILL_ILLTRP = 4 const ILL_PRVOPC = 5 const ILL_PRVREG = 6 const INET6_ADDRSTRLEN = 46 const INET_ADDRSTRLEN = 16 const INT16_MAX1 = 32767 const INT16_MIN = -32768 const INT32_MAX1 = 2147483647 const INT32_MIN = -2147483648 const INT64_MAX3 = 9223372036854775807 const INT64_MIN = -9223372036854775808 const INT8_MAX1 = 127 const INT8_MIN = -128 const INTERP_ALTERNATE_WRONG_ARGS = 1024 const INTERP_DEBUG_FRAME = 16 const INTERP_TRACE_IN_PROGRESS = 512 const INTMAX_MAX1 = 9223372036854775807 const INTMAX_MIN1 = -9223372036854775808 const INTPTR_MAX1 = 2147483647 const INTPTR_MIN1 = -2147483648 const INT_FAST16_MAX1 = 2147483647 const INT_FAST16_MIN1 = -2147483648 const INT_FAST32_MAX1 = 2147483647 const INT_FAST32_MIN1 = -2147483648 const INT_FAST64_MAX1 = 9223372036854775807 const INT_FAST64_MIN1 = -9223372036854775808 const INT_FAST8_MAX1 = 127 const INT_FAST8_MIN1 = -128 const INT_LEAST16_MAX1 = 32767 const INT_LEAST16_MIN1 = -32768 const INT_LEAST32_MAX1 = 2147483647 const INT_LEAST32_MIN1 = -2147483648 const INT_LEAST64_MAX1 = 9223372036854775807 const INT_LEAST64_MIN1 = -9223372036854775808 const INT_LEAST8_MAX1 = 127 const INT_LEAST8_MIN1 = -128 const INT_MAX9 = 2147483647 const INT_MIN = -2147483648 const IN_CLASSA_HOST = 16777215 const IN_CLASSA_MAX = 128 const IN_CLASSA_NET = 4278190080 const IN_CLASSA_NSHIFT = 24 const IN_CLASSB_HOST = 65535 const IN_CLASSB_MAX = 65536 const IN_CLASSB_NET = 4294901760 const IN_CLASSB_NSHIFT = 16 const IN_CLASSC_HOST = 255 const IN_CLASSC_NET = 4294967040 const IN_CLASSC_NSHIFT = 8 const IN_LOOPBACKNET = 127 const IPPORT_RESERVED = 1024 const IPPROTO_AH = 51 const IPPROTO_BEETPH = 94 const IPPROTO_COMP = 108 const IPPROTO_DCCP = 33 const IPPROTO_DSTOPTS = 60 const IPPROTO_EGP = 8 const IPPROTO_ENCAP = 98 const IPPROTO_ESP = 50 const IPPROTO_ETHERNET = 143 const IPPROTO_FRAGMENT = 44 const IPPROTO_GRE = 47 const IPPROTO_HOPOPTS = 0 const IPPROTO_ICMP = 1 const IPPROTO_ICMPV6 = 58 const IPPROTO_IDP = 22 const IPPROTO_IGMP = 2 const IPPROTO_IP = 0 const IPPROTO_IPIP = 4 const IPPROTO_IPV6 = 41 const IPPROTO_MAX = 263 const IPPROTO_MH = 135 const IPPROTO_MPLS = 137 const IPPROTO_MPTCP = 262 const IPPROTO_MTP = 92 const IPPROTO_NONE = 59 const IPPROTO_PIM = 103 const IPPROTO_PUP = 12 const IPPROTO_RAW = 255 const IPPROTO_ROUTING = 43 const IPPROTO_RSVP = 46 const IPPROTO_SCTP = 132 const IPPROTO_TCP = 6 const IPPROTO_TP = 29 const IPPROTO_UDP = 17 const IPPROTO_UDPLITE = 136 const IPV6_2292DSTOPTS = 4 const IPV6_2292HOPLIMIT = 8 const IPV6_2292HOPOPTS = 3 const IPV6_2292PKTINFO = 2 const IPV6_2292PKTOPTIONS = 6 const IPV6_2292RTHDR = 5 const IPV6_ADDRFORM = 1 const IPV6_ADDR_PREFERENCES = 72 const IPV6_ADD_MEMBERSHIP = 20 const IPV6_AUTHHDR = 10 const IPV6_AUTOFLOWLABEL = 70 const IPV6_CHECKSUM = 7 const IPV6_DONTFRAG = 62 const IPV6_DROP_MEMBERSHIP = 21 const IPV6_DSTOPTS = 59 const IPV6_FREEBIND = 78 const IPV6_HDRINCL = 36 const IPV6_HOPLIMIT = 52 const IPV6_HOPOPTS = 54 const IPV6_IPSEC_POLICY = 34 const IPV6_JOIN_ANYCAST = 27 const IPV6_JOIN_GROUP = 20 const IPV6_LEAVE_ANYCAST = 28 const IPV6_LEAVE_GROUP = 21 const IPV6_MINHOPCOUNT = 73 const IPV6_MTU = 24 const IPV6_MTU_DISCOVER = 23 const IPV6_MULTICAST_ALL = 29 const IPV6_MULTICAST_HOPS = 18 const IPV6_MULTICAST_IF = 17 const IPV6_MULTICAST_LOOP = 19 const IPV6_NEXTHOP = 9 const IPV6_ORIGDSTADDR = 74 const IPV6_PATHMTU = 61 const IPV6_PKTINFO = 50 const IPV6_PMTUDISC_DO = 2 const IPV6_PMTUDISC_DONT = 0 const IPV6_PMTUDISC_INTERFACE = 4 const IPV6_PMTUDISC_OMIT = 5 const IPV6_PMTUDISC_PROBE = 3 const IPV6_PMTUDISC_WANT = 1 const IPV6_PREFER_SRC_CGA = 8 const IPV6_PREFER_SRC_COA = 4 const IPV6_PREFER_SRC_HOME = 1024 const IPV6_PREFER_SRC_NONCGA = 2048 const IPV6_PREFER_SRC_PUBLIC = 2 const IPV6_PREFER_SRC_PUBTMP_DEFAULT = 256 const IPV6_PREFER_SRC_TMP = 1 const IPV6_RECVDSTOPTS = 58 const IPV6_RECVERR = 25 const IPV6_RECVFRAGSIZE = 77 const IPV6_RECVHOPLIMIT = 51 const IPV6_RECVHOPOPTS = 53 const IPV6_RECVORIGDSTADDR = 74 const IPV6_RECVPATHMTU = 60 const IPV6_RECVPKTINFO = 49 const IPV6_RECVRTHDR = 56 const IPV6_RECVTCLASS = 66 const IPV6_ROUTER_ALERT = 22 const IPV6_ROUTER_ALERT_ISOLATE = 30 const IPV6_RTHDR = 57 const IPV6_RTHDRDSTOPTS = 55 const IPV6_RTHDR_LOOSE = 0 const IPV6_RTHDR_STRICT = 1 const IPV6_RTHDR_TYPE_0 = 0 const IPV6_RXDSTOPTS = 59 const IPV6_RXHOPOPTS = 54 const IPV6_TCLASS = 67 const IPV6_TRANSPARENT = 75 const IPV6_UNICAST_HOPS = 16 const IPV6_UNICAST_IF = 76 const IPV6_V6ONLY = 26 const IPV6_XFRM_POLICY = 35 const IP_ADD_MEMBERSHIP = 35 const IP_ADD_SOURCE_MEMBERSHIP = 39 const IP_BIND_ADDRESS_NO_PORT = 24 const IP_BLOCK_SOURCE = 38 const IP_CHECKSUM = 23 const IP_DEFAULT_MULTICAST_LOOP = 1 const IP_DEFAULT_MULTICAST_TTL = 1 const IP_DROP_MEMBERSHIP = 36 const IP_DROP_SOURCE_MEMBERSHIP = 40 const IP_FREEBIND = 15 const IP_HDRINCL = 3 const IP_IPSEC_POLICY = 16 const IP_MAX_MEMBERSHIPS = 20 const IP_MINTTL = 21 const IP_MSFILTER = 41 const IP_MTU = 14 const IP_MTU_DISCOVER = 10 const IP_MULTICAST_ALL = 49 const IP_MULTICAST_IF = 32 const IP_MULTICAST_LOOP = 34 const IP_MULTICAST_TTL = 33 const IP_NODEFRAG = 22 const IP_OPTIONS = 4 const IP_ORIGDSTADDR = 20 const IP_PASSSEC = 18 const IP_PKTINFO = 8 const IP_PKTOPTIONS = 9 const IP_PMTUDISC = 10 const IP_PMTUDISC_DO = 2 const IP_PMTUDISC_DONT = 0 const IP_PMTUDISC_INTERFACE = 4 const IP_PMTUDISC_OMIT = 5 const IP_PMTUDISC_PROBE = 3 const IP_PMTUDISC_WANT = 1 const IP_RECVERR = 11 const IP_RECVERR_RFC4884 = 26 const IP_RECVFRAGSIZE = 25 const IP_RECVOPTS = 6 const IP_RECVORIGDSTADDR = 20 const IP_RECVRETOPTS = 7 const IP_RECVTOS = 13 const IP_RECVTTL = 12 const IP_RETOPTS = 7 const IP_ROUTER_ALERT = 5 const IP_TOS = 1 const IP_TRANSPARENT = 19 const IP_TTL = 2 const IP_UNBLOCK_SOURCE = 37 const IP_UNICAST_IF = 50 const IP_XFRM_POLICY = 17 const ITIMER_PROF = 2 const ITIMER_REAL = 0 const ITIMER_VIRTUAL = 1 const LC_ALL = 6 const LC_ALL_MASK = 2147483647 const LC_COLLATE = 3 const LC_COLLATE_MASK = 8 const LC_CTYPE = 0 const LC_CTYPE_MASK = 1 const LC_GLOBAL_LOCALE = -1 const LC_MESSAGES = 5 const LC_MESSAGES_MASK = 32 const LC_MONETARY = 4 const LC_MONETARY_MASK = 16 const LC_NUMERIC = 1 const LC_NUMERIC_MASK = 2 const LC_TIME = 2 const LC_TIME_MASK = 4 const LDBL_DECIMAL_DIG1 = 17 const LDBL_EPSILON1 = 0 const LDBL_MAX1 = 0 const LDBL_MIN1 = 0 const LDBL_MIN_10_EXP = -307 const LDBL_MIN_EXP = -1021 const LDBL_TRUE_MIN1 = 0 const LISTSTORE_CANONICAL = 1 const LIST_SPAN_THRESHOLD = 101 const LITTLE_ENDIAN1 = 1234 const LLONG_MAX1 = 9223372036854775807 const LLONG_MIN = -9223372036854775808 const LOCK_EX = 2 const LOCK_NB = 4 const LOCK_SH = 1 const LOCK_UN = 8 const LONG_MAX1 = 2147483647 const LONG_MIN = -2147483648 const MAXHOSTNAMELEN = 64 const MAXNAMLEN = 255 const MAXPATHLEN = 4096 const MAXSYMLINKS = 20 const MAX_NESTING_DEPTH = 1000 const MB_CUR_MAX = 0 const MCAST_BLOCK_SOURCE = 43 const MCAST_EXCLUDE = 0 const MCAST_INCLUDE = 1 const MCAST_JOIN_GROUP = 42 const MCAST_JOIN_SOURCE_GROUP = 46 const MCAST_LEAVE_GROUP = 45 const MCAST_LEAVE_SOURCE_GROUP = 47 const MCAST_MSFILTER = 48 const MCAST_UNBLOCK_SOURCE = 44 const MINSIGSTKSZ = 2048 const MP_FIXED_CUTOFFS = 1 const MP_PREC = 4 const MSG_BATCH = 262144 const MSG_CMSG_CLOEXEC = 1073741824 const MSG_CONFIRM = 2048 const MSG_CTRUNC = 8 const MSG_DONTROUTE = 4 const MSG_DONTWAIT = 64 const MSG_EOR = 128 const MSG_ERRQUEUE = 8192 const MSG_FASTOPEN = 536870912 const MSG_FIN = 512 const MSG_MORE = 32768 const MSG_NOSIGNAL = 16384 const MSG_OOB = 1 const MSG_PEEK = 2 const MSG_PROXY = 16 const MSG_RST = 4096 const MSG_SYN = 1024 const MSG_TRUNC = 32 const MSG_WAITALL = 256 const MSG_WAITFORONE = 65536 const MSG_ZEROCOPY = 67108864 const NBBY = 8 const NCARGS = 131072 const NGROUPS = 32 const NI_DGRAM = 16 const NI_MAXHOST = 255 const NI_MAXSERV = 32 const NI_NAMEREQD = 8 const NI_NOFQDN = 4 const NI_NUMERICHOST = 1 const NI_NUMERICSCOPE = 256 const NI_NUMERICSERV = 2 const NOFILE = 256 const NOGROUP = -1 const NO_ADDRESS = 4 const NO_DATA = 4 const NO_RECOVERY = 3 const NO_UNION_WAIT = 1 const NRE_ENABLE_ASSERTS = 0 const NRE_USE_SMALL_ALLOC = 1 const NSIG = 65 const NS_DEAD = 2 const NS_DYING = 1 const NS_KILLED = 4 const NS_SUPPRESS_COMPILATION = 8 const NS_TEARDOWN = 4 const O_ACCMODE = 2097155 const O_APPEND3 = 1024 const O_ASYNC1 = 8192 const O_CLOEXEC3 = 524288 const O_CREAT5 = 64 const O_DIRECT1 = 65536 const O_DIRECTORY1 = 16384 const O_DSYNC1 = 4096 const O_EXCL3 = 128 const O_EXEC1 = 2097152 const O_LARGEFILE3 = 131072 const O_NDELAY1 = 2048 const O_NOATIME1 = 262144 const O_NOCTTY1 = 256 const O_NOFOLLOW1 = 32768 const O_NONBLOCK1 = 2048 const O_PATH1 = 2097152 const O_RDONLY15 = 0 const O_RDWR7 = 2 const O_RSYNC1 = 1052672 const O_SEARCH1 = 2097152 const O_SYNC1 = 1052672 const O_TMPFILE1 = 4210688 const O_TRUNC5 = 512 const O_WRONLY5 = 1 const PACKAGE_NAME23 = "tcl" const PACKAGE_STRING24 = "tcl 9.0" const PACKAGE_TARNAME23 = "tcl" const PACKAGE_VERSION6 = "9.0" const PDP_ENDIAN1 = 3412 const PF_ALG = 38 const PF_APPLETALK = 5 const PF_ASH = 18 const PF_ATMPVC = 8 const PF_ATMSVC = 20 const PF_AX25 = 3 const PF_BLUETOOTH = 31 const PF_BRIDGE = 7 const PF_CAIF = 37 const PF_CAN = 29 const PF_DECnet = 12 const PF_ECONET = 19 const PF_FILE = 1 const PF_IB = 27 const PF_IEEE802154 = 36 const PF_INET = 2 const PF_INET6 = 10 const PF_IPX = 4 const PF_IRDA = 23 const PF_ISDN = 34 const PF_IUCV = 32 const PF_KCM = 41 const PF_KEY = 15 const PF_LLC = 26 const PF_LOCAL = 1 const PF_MAX = 45 const PF_MPLS = 28 const PF_NETBEUI = 13 const PF_NETLINK = 16 const PF_NETROM = 6 const PF_NFC = 39 const PF_PACKET = 17 const PF_PHONET = 35 const PF_PPPOX = 24 const PF_QIPCRTR = 42 const PF_RDS = 21 const PF_ROSE = 11 const PF_ROUTE = 16 const PF_RXRPC = 33 const PF_SECURITY = 14 const PF_SMC = 43 const PF_SNA = 22 const PF_TIPC = 30 const PF_UNIX = 1 const PF_UNSPEC = 0 const PF_VSOCK = 40 const PF_WANPIPE = 25 const PF_X25 = 9 const PF_XDP = 44 const POLL_ERR = 4 const POLL_HUP = 6 const POLL_IN = 1 const POLL_MSG = 3 const POLL_OUT = 2 const POLL_PRI = 5 const PRIO_MAX = 20 const PRIO_MIN = -20 const PRIO_PGRP = 1 const PRIO_PROCESS = 0 const PRIO_USER = 2 const PTHREAD_BARRIER_SERIAL_THREAD = -1 const PTHREAD_CANCELED = -1 const PTHREAD_CANCEL_ASYNCHRONOUS = 1 const PTHREAD_CANCEL_DEFERRED = 0 const PTHREAD_CANCEL_DISABLE = 1 const PTHREAD_CANCEL_ENABLE = 0 const PTHREAD_CANCEL_MASKED = 2 const PTHREAD_CREATE_DETACHED = 1 const PTHREAD_CREATE_JOINABLE = 0 const PTHREAD_EXPLICIT_SCHED = 1 const PTHREAD_INHERIT_SCHED = 0 const PTHREAD_MUTEX_DEFAULT = 0 const PTHREAD_MUTEX_ERRORCHECK = 2 const PTHREAD_MUTEX_NORMAL = 0 const PTHREAD_MUTEX_RECURSIVE = 1 const PTHREAD_MUTEX_ROBUST = 1 const PTHREAD_MUTEX_STALLED = 0 const PTHREAD_ONCE_INIT = 0 const PTHREAD_PRIO_INHERIT = 1 const PTHREAD_PRIO_NONE = 0 const PTHREAD_PRIO_PROTECT = 2 const PTHREAD_PROCESS_PRIVATE = 0 const PTHREAD_PROCESS_SHARED = 1 const PTHREAD_SCOPE_PROCESS = 1 const PTHREAD_SCOPE_SYSTEM = 0 const PTRDIFF_MAX1 = 2147483647 const PTRDIFF_MIN1 = -2147483648 const RAND_MAX3 = 2147483647 const RAND_SEED_INITIALIZED = 64 const RLIM64_INFINITY = 18446744073709551615 const RLIM64_SAVED_CUR = 18446744073709551615 const RLIM64_SAVED_MAX = 18446744073709551615 const RLIMIT_AS = 9 const RLIMIT_CORE = 4 const RLIMIT_CPU = 0 const RLIMIT_DATA = 2 const RLIMIT_FSIZE = 1 const RLIMIT_LOCKS = 10 const RLIMIT_MEMLOCK = 8 const RLIMIT_MSGQUEUE = 12 const RLIMIT_NICE = 13 const RLIMIT_NLIMITS = 16 const RLIMIT_NOFILE = 7 const RLIMIT_NPROC = 6 const RLIMIT_RSS = 5 const RLIMIT_RTPRIO = 14 const RLIMIT_RTTIME = 15 const RLIMIT_SIGPENDING = 11 const RLIMIT_STACK = 3 const RLIM_INFINITY = 18446744073709551615 const RLIM_NLIMITS = 16 const RLIM_SAVED_CUR = 18446744073709551615 const RLIM_SAVED_MAX = 18446744073709551615 const RUSAGE_CHILDREN = -1 const RUSAGE_SELF = 0 const RUSAGE_THREAD = 1 const SAFE_INTERP = 128 const SA_EXPOSE_TAGBITS = 2048 const SA_NOCLDSTOP = 1 const SA_NOCLDWAIT = 2 const SA_NODEFER = 1073741824 const SA_NOMASK = 1073741824 const SA_ONESHOT = 2147483648 const SA_ONSTACK = 134217728 const SA_RESETHAND = 2147483648 const SA_RESTART = 268435456 const SA_RESTORER = 67108864 const SA_SIGINFO = 4 const SA_UNSUPPORTED = 1024 const SCHAR_MIN = -128 const SCHED_BATCH = 3 const SCHED_DEADLINE = 6 const SCHED_FIFO = 1 const SCHED_IDLE = 5 const SCHED_OTHER = 0 const SCHED_RESET_ON_FORK = 1073741824 const SCHED_RR = 2 const SCM_CREDENTIALS = 2 const SCM_RIGHTS = 1 const SCM_TIMESTAMP = 63 const SCM_TIMESTAMPING = 65 const SCM_TIMESTAMPING_OPT_STATS = 54 const SCM_TIMESTAMPING_PKTINFO = 58 const SCM_TIMESTAMPNS = 64 const SCM_TXTIME = 61 const SCM_WIFI_STATUS = 41 const SEGV_ACCERR = 2 const SEGV_BNDERR = 3 const SEGV_MAPERR = 1 const SEGV_MTEAERR = 8 const SEGV_MTESERR = 9 const SEGV_PKUERR = 4 const SELECT_MASK = 0 const SEM_VALUE_MAX1 = 2147483647 const SHRT_MAX1 = 32767 const SHRT_MIN = -32768 const SHUT_RD = 0 const SHUT_RDWR = 2 const SHUT_WR = 1 const SIGABRT = 6 const SIGALRM = 14 const SIGBUS = 7 const SIGCHLD = 17 const SIGCONT = 18 const SIGEV_NONE = 1 const SIGEV_SIGNAL = 0 const SIGEV_THREAD = 2 const SIGEV_THREAD_ID = 4 const SIGFPE = 8 const SIGHUP = 1 const SIGILL = 4 const SIGINT = 2 const SIGIO = 29 const SIGIOT = 6 const SIGKILL = 9 const SIGPIPE = 13 const SIGPOLL = 29 const SIGPROF = 27 const SIGPWR = 30 const SIGQUIT = 3 const SIGRTMAX = 0 const SIGRTMIN = 0 const SIGSEGV = 11 const SIGSTKFLT = 16 const SIGSTKSZ = 8192 const SIGSTOP = 19 const SIGSYS = 31 const SIGTERM = 15 const SIGTRAP = 5 const SIGTSTP = 20 const SIGTTIN = 21 const SIGTTOU = 22 const SIGUNUSED = 31 const SIGURG = 23 const SIGUSR1 = 10 const SIGUSR2 = 12 const SIGVTALRM = 26 const SIGWINCH = 28 const SIGXCPU = 24 const SIGXFSZ = 25 const SIG_ATOMIC_MAX1 = 2147483647 const SIG_ATOMIC_MIN1 = -2147483648 const SIG_BLOCK = 0 const SIG_SETMASK = 2 const SIG_UNBLOCK = 1 const SIZE_MAX1 = 4294967295 const SI_ASYNCIO = -4 const SI_ASYNCNL = -60 const SI_KERNEL = 128 const SI_MESGQ = -3 const SI_QUEUE = -1 const SI_SIGIO = -5 const SI_TIMER = -2 const SI_TKILL = -6 const SI_USER = 0 const SOCK_CLOEXEC = 524288 const SOCK_DCCP = 6 const SOCK_DGRAM = 2 const SOCK_NONBLOCK = 2048 const SOCK_PACKET = 10 const SOCK_RAW = 3 const SOCK_RDM = 4 const SOCK_SEQPACKET = 5 const SOCK_STREAM = 1 const SOL_AAL = 265 const SOL_ALG = 279 const SOL_ATM = 264 const SOL_BLUETOOTH = 274 const SOL_CAIF = 278 const SOL_DCCP = 269 const SOL_DECNET = 261 const SOL_ICMPV6 = 58 const SOL_IP = 0 const SOL_IPV6 = 41 const SOL_IRDA = 266 const SOL_IUCV = 277 const SOL_KCM = 281 const SOL_LLC = 268 const SOL_NETBEUI = 267 const SOL_NETLINK = 270 const SOL_NFC = 280 const SOL_PACKET = 263 const SOL_PNPIPE = 275 const SOL_PPPOL2TP = 273 const SOL_RAW = 255 const SOL_RDS = 276 const SOL_RXRPC = 272 const SOL_SOCKET = 1 const SOL_TIPC = 271 const SOL_TLS = 282 const SOL_X25 = 262 const SOL_XDP = 283 const SOMAXCONN = 128 const SO_ACCEPTCONN = 30 const SO_ATTACH_BPF = 50 const SO_ATTACH_FILTER = 26 const SO_ATTACH_REUSEPORT_CBPF = 51 const SO_ATTACH_REUSEPORT_EBPF = 52 const SO_BINDTODEVICE = 25 const SO_BINDTOIFINDEX = 62 const SO_BPF_EXTENSIONS = 48 const SO_BROADCAST = 6 const SO_BSDCOMPAT = 14 const SO_BUSY_POLL = 46 const SO_BUSY_POLL_BUDGET = 70 const SO_CNX_ADVICE = 53 const SO_COOKIE = 57 const SO_DEBUG = 1 const SO_DETACH_BPF = 27 const SO_DETACH_FILTER = 27 const SO_DETACH_REUSEPORT_BPF = 68 const SO_DOMAIN = 39 const SO_DONTROUTE = 5 const SO_ERROR = 4 const SO_GET_FILTER = 26 const SO_INCOMING_CPU = 49 const SO_INCOMING_NAPI_ID = 56 const SO_KEEPALIVE = 9 const SO_LINGER = 13 const SO_LOCK_FILTER = 44 const SO_MARK = 36 const SO_MAX_PACING_RATE = 47 const SO_MEMINFO = 55 const SO_NOFCS = 43 const SO_NO_CHECK = 11 const SO_OOBINLINE = 10 const SO_PASSCRED = 16 const SO_PASSSEC = 34 const SO_PEEK_OFF = 42 const SO_PEERCRED = 17 const SO_PEERGROUPS = 59 const SO_PEERNAME = 28 const SO_PEERSEC = 31 const SO_PREFER_BUSY_POLL = 69 const SO_PRIORITY = 12 const SO_PROTOCOL = 38 const SO_RCVBUF = 8 const SO_RCVBUFFORCE = 33 const SO_RCVLOWAT = 18 const SO_RCVTIMEO = 66 const SO_REUSEADDR = 2 const SO_REUSEPORT = 15 const SO_RXQ_OVFL = 40 const SO_SECURITY_AUTHENTICATION = 22 const SO_SECURITY_ENCRYPTION_NETWORK = 24 const SO_SECURITY_ENCRYPTION_TRANSPORT = 23 const SO_SELECT_ERR_QUEUE = 45 const SO_SNDBUF = 7 const SO_SNDBUFFORCE = 32 const SO_SNDLOWAT = 19 const SO_SNDTIMEO = 67 const SO_TIMESTAMP = 63 const SO_TIMESTAMPING = 65 const SO_TIMESTAMPNS = 64 const SO_TXTIME = 61 const SO_TYPE = 3 const SO_WIFI_STATUS = 41 const SO_ZEROCOPY = 60 const SSIZE_MAX1 = 2147483647 const SS_AUTODISARM = 2147483648 const SS_DISABLE = 2 const SS_FLAG_BITS = 2147483648 const SS_ONSTACK = 1 const STATIC_BUILD = 1 const STATX_ALL1 = 4095 const STATX_ATIME1 = 32 const STATX_BASIC_STATS1 = 2047 const STATX_BLOCKS1 = 1024 const STATX_BTIME1 = 2048 const STATX_CTIME1 = 128 const STATX_GID1 = 16 const STATX_INO1 = 256 const STATX_MTIME1 = 64 const STATX_SIZE1 = 512 const SYS_SECCOMP = 1 const SYS_USER_DISPATCH = 2 const S_IEXEC1 = 64 const S_IFBLK1 = 24576 const S_IFCHR1 = 8192 const S_IFDIR1 = 16384 const S_IFIFO1 = 4096 const S_IFLNK1 = 40960 const S_IFMT1 = 61440 const S_IFREG1 = 32768 const S_IFSOCK1 = 49152 const S_IREAD1 = 256 const S_IRGRP1 = 32 const S_IROTH1 = 4 const S_IRUSR1 = 256 const S_IRWXG1 = 56 const S_IRWXO1 = 7 const S_IRWXU1 = 448 const S_ISGID1 = 1024 const S_ISUID1 = 2048 const S_ISVTX1 = 512 const S_IWGRP1 = 16 const S_IWOTH1 = 2 const S_IWRITE1 = 128 const S_IWUSR1 = 128 const S_IXGRP1 = 8 const S_IXOTH1 = 1 const S_IXUSR1 = 64 const TCLFSENCODING = "NULL" const TCL_ALLOCALIGN = 0 const TCL_ALLOW_EXCEPTIONS = 4 const TCL_ALLOW_INLINE_COMPILATION1 = 131072 const TCL_ALL_EVENTS = -3 const TCL_AUTO_LENGTH = -1 const TCL_AVOID_RESOLVERS = 262144 const TCL_CANCEL_UNWIND1 = 1048576 const TCL_CFGVAL_ENCODING = "utf-8" const TCL_CLOSE_READ = 2 const TCL_CLOSE_WRITE = 4 const TCL_CODE_USER_MAX1 = 1073741823 const TCL_COMBINE1 = 16777216 const TCL_CONVERT_MULTIBYTE = -1 const TCL_CONVERT_NOSPACE = -4 const TCL_CONVERT_SYNTAX = -2 const TCL_CONVERT_UNKNOWN = -3 const TCL_CREATE_HARD_LINK1 = 2 const TCL_CREATE_NS_IF_UNKNOWN = 2048 const TCL_CREATE_SYMBOLIC_LINK1 = 1 const TCL_CUSTOM_PTR_KEYS = -1 const TCL_CUSTOM_TYPE_KEYS = -2 const TCL_DD_CONVERSION_TYPE_MASK = 3 const TCL_DD_E_FORMAT = 2 const TCL_DD_F_FORMAT = 3 const TCL_DD_NO_QUICK = 8 const TCL_DD_SHORTEST = 4 const TCL_DONT_WAIT = 2 const TCL_DOUBLE_SPACE = 27 const TCL_EACH_COLLECT = 1 const TCL_EACH_KEEP_NONE = 0 const TCL_ENCODING_CHAR_LIMIT1 = 16 const TCL_ENCODING_END1 = 2 const TCL_ENCODING_INTERNAL_USE_MASK1 = 65280 const TCL_ENCODING_NO_TERMINATE1 = 8 const TCL_ENCODING_PROFILE_REPLACE1 = 33554432 const TCL_ENCODING_PROFILE_STRICT1 = 0 const TCL_ENCODING_PROFILE_TCL81 = 16777216 const TCL_ENCODING_START1 = 1 const TCL_ENCODING_STOPONERROR1 = 0 const TCL_ENFORCE_MODE = 16 const TCL_ENSEMBLE_PREFIX1 = 2 const TCL_EVAL_DIRECT1 = 262144 const TCL_EVAL_DISCARD_RESULT = 64 const TCL_EVAL_FILE = 2 const TCL_EVAL_GLOBAL1 = 131072 const TCL_EVAL_INVOKE1 = 524288 const TCL_EVAL_NOERR1 = 2097152 const TCL_EVAL_NORESOLVE = 32 const TCL_EVAL_SOURCE_IN_FRAME = 16 const TCL_EXCEPTION = 8 const TCL_FILE_EVENTS = 8 const TCL_FIND_IF_NOT_SIMPLE = 8192 const TCL_FIND_ONLY_NS = 4096 const TCL_GLOB_PERM_HIDDEN = 2 const TCL_GLOB_PERM_R = 4 const TCL_GLOB_PERM_RONLY = 1 const TCL_GLOB_PERM_W = 8 const TCL_GLOB_PERM_X = 16 const TCL_GLOB_TYPE_BLOCK = 1 const TCL_GLOB_TYPE_CHAR = 2 const TCL_GLOB_TYPE_DIR = 4 const TCL_GLOB_TYPE_FILE = 16 const TCL_GLOB_TYPE_LINK = 32 const TCL_GLOB_TYPE_MOUNT = 128 const TCL_GLOB_TYPE_PIPE = 8 const TCL_GLOB_TYPE_SOCK = 64 const TCL_HASH_KEY_DIRECT_COMPARE1 = 4 const TCL_HASH_KEY_RANDOMIZE_HASH1 = 1 const TCL_HASH_KEY_SYSTEM_HASH1 = 2 const TCL_HASH_TYPE1 = 0 const TCL_IDLE_EVENTS = 32 const TCL_INDEX_END = -2 const TCL_INDEX_NONE = -1 const TCL_INVOKE_HIDDEN = 1 const TCL_INVOKE_NO_TRACEBACK = 4 const TCL_INVOKE_NO_UNKNOWN = 2 const TCL_IO_FAILURE = -1 const TCL_LEAVE_ERR_MSG1 = 512 const TCL_LIMIT_COMMANDS1 = 1 const TCL_LIMIT_TIME1 = 2 const TCL_LINK_LONG = 1 const TCL_LINK_READ_ONLY1 = 128 const TCL_LINK_ULONG = 10 const TCL_LOCATION_BC = 2 const TCL_LOCATION_EVAL = 0 const TCL_LOCATION_LAST = 6 const TCL_LOCATION_PREBC = 3 const TCL_LOCATION_PROC = 5 const TCL_LOCATION_SOURCE = 4 const TCL_MATCH_NOCASE = 1 const TCL_MIN_GROWTH = 1024 const TCL_MIN_TOKEN_GROWTH = 1024 const TCL_NO_EVAL1 = 65536 const TCL_OBJTYPE_V0 = 0 const TCL_PARSE_BINARY_ONLY = 64 const TCL_PARSE_DECIMAL_ONLY = 1 const TCL_PARSE_HEXADECIMAL_ONLY = 4 const TCL_PARSE_INTEGER_ONLY = 8 const TCL_PARSE_NO_UNDERSCORE = 128 const TCL_PARSE_NO_WHITESPACE = 32 const TCL_PARSE_OCTAL_ONLY = 2 const TCL_PARSE_SCAN_PREFIXES = 16 const TCL_PLATFORM_TRANSLATION = 0 const TCL_READABLE = 2 const TCL_REG_ADVANCED1 = 3 const TCL_REG_ADVF1 = 2 const TCL_REG_BASIC1 = 0 const TCL_REG_BOSONLY = 1024 const TCL_REG_CANMATCH1 = 512 const TCL_REG_EXPANDED1 = 32 const TCL_REG_EXTENDED1 = 1 const TCL_REG_NEWLINE1 = 192 const TCL_REG_NLANCH1 = 128 const TCL_REG_NLSTOP1 = 64 const TCL_REG_NOCASE1 = 8 const TCL_REG_NOSUB1 = 16 const TCL_REG_NOTBOL1 = 1 const TCL_REG_NOTEOL1 = 2 const TCL_REG_QUOTE1 = 4 const TCL_RELEASE_LEVEL1 = 2 const TCL_SHLIB_EXT = "" const TCL_STDERR = 8 const TCL_STDIN = 2 const TCL_STDOUT = 4 const TCL_STRING_IN_PLACE = 2 const TCL_STRING_MATCH_NOCASE = 1 const TCL_SUBST_ALL1 = 7 const TCL_SUBST_BACKSLASHES1 = 4 const TCL_SUBST_COMMANDS1 = 1 const TCL_SUBST_VARIABLES1 = 2 const TCL_TCPSERVER_REUSEADDR = 1 const TCL_TCPSERVER_REUSEPORT = 2 const TCL_THREAD_JOINABLE1 = 1 const TCL_THREAD_NOFLAGS1 = 0 const TCL_TIMER_EVENTS = 16 const TCL_TRACE_ARRAY1 = 2048 const TCL_TRACE_DELETE1 = 16384 const TCL_TRACE_DESTROYED1 = 128 const TCL_TRACE_ENTER_EXEC = 1 const TCL_TRACE_LEAVE_EXEC = 2 const TCL_TRACE_READS1 = 16 const TCL_TRACE_RENAME1 = 8192 const TCL_TRACE_RESULT_DYNAMIC1 = 32768 const TCL_TRACE_RESULT_OBJECT1 = 65536 const TCL_TRACE_UNSETS1 = 64 const TCL_TRACE_WRITES1 = 32 const TCL_UNLOAD_DETACH_FROM_INTERPRETER = 1 const TCL_UNLOAD_DETACH_FROM_PROCESS = 2 const TCL_WINDOW_EVENTS = 4 const TCL_WRITABLE = 4 const TCL_ZLIB_COMPRESS_DEFAULT = -1 const TRAP_BRANCH = 3 const TRAP_BRKPT = 1 const TRAP_HWBKPT = 4 const TRAP_TRACE = 2 const TRAP_UNK = 5 const TRY_AGAIN = 2 const TclOSclosedir = 0 const TclOSopen = 0 const TclOSopendir = 0 const TclOSreaddir = 0 const TclOSrewinddir = 0 const TclOSseek = 0 const TclObjInterpProc = 0 const TclObjInterpProc2 = 0 const Tcl_AttemptAlloc = 0 const Tcl_AttemptRealloc = 0 const Tcl_CreateSlave1 = 0 const Tcl_EncodingFreeProc1 = 0 const Tcl_ExitProc1 = 0 const Tcl_FSFreeInternalRepProc1 = 0 const Tcl_FileFreeProc1 = 0 const Tcl_Free = 0 const Tcl_GetMaster1 = 0 const Tcl_GetSlave1 = 0 const Tcl_LimitHandlerDeleteProc1 = 0 const Tcl_PackageInitProc1 = 0 const Tcl_PackageUnloadProc1 = 0 const Tcl_StaticPackage1 = 0 const Tcl_ThreadCreateType1 = 0 const UINT16_MAX1 = 65535 const UINT32_MAX14 = 4294967295 const UINT64_MAX4 = 18446744073709551615 const UINT8_MAX1 = 255 const UINTMAX_MAX1 = 18446744073709551615 const UINTPTR_MAX1 = 4294967295 const UINT_FAST16_MAX1 = 4294967295 const UINT_FAST32_MAX1 = 4294967295 const UINT_FAST64_MAX1 = 18446744073709551615 const UINT_FAST8_MAX1 = 255 const UINT_LEAST16_MAX1 = 65535 const UINT_LEAST32_MAX1 = 4294967295 const UINT_LEAST64_MAX1 = 18446744073709551615 const UINT_LEAST8_MAX1 = 255 const UINT_MAX9 = 4294967295 const ULLONG_MAX = 18446744073709551615 const ULONG_MAX = 4294967295 const USHRT_MAX1 = 65535 const UTIME_NOW1 = 1073741823 const UTIME_OMIT1 = 1073741822 const UWIDE_MAX = -1 const VAR_ALL_HASH = 4236 const VAR_ALL_TRACES = 2160 const VAR_ARGUMENT = 256 const VAR_ARRAY = 1 const VAR_ARRAY_ELEMENT = 4096 const VAR_CONSTANT = 65536 const VAR_DEAD_HASH = 8 const VAR_IN_HASHTABLE = 4 const VAR_IS_ARGS = 1024 const VAR_LINK = 2 const VAR_NAMESPACE_VAR = 128 const VAR_RESOLVED = 32768 const VAR_SEARCH_ACTIVE = 16384 const VAR_TEMPORARY = 512 const VAR_TRACED_ARRAY = 2048 const VAR_TRACED_READ = 16 const VAR_TRACED_UNSET = 64 const VAR_TRACED_WRITE = 32 const VAR_TRACE_ACTIVE = 8192 const WAIT_STATUS_TYPE = 0 const WCHAR_MAX = 2147483647 const WCHAR_MIN = -2147483648 const WCONTINUED = 8 const WEXITED = 4 const WINT_MAX1 = 4294967295 const WNOWAIT = 16777216 const WSTOPPED = 2 const ZIPFS_BUILD = 2 const _LARGEFILE64_SOURCE = 1 const _NSIG = 65 const _POSIX2_C_BIND1 = 200809 const _POSIX2_VERSION1 = 200809 const _POSIX_ADVISORY_INFO1 = 200809 const _POSIX_ASYNCHRONOUS_IO1 = 200809 const _POSIX_BARRIERS1 = 200809 const _POSIX_CLOCK_SELECTION1 = 200809 const _POSIX_CPUTIME1 = 200809 const _POSIX_FSYNC1 = 200809 const _POSIX_IPV61 = 200809 const _POSIX_MAPPED_FILES1 = 200809 const _POSIX_MEMLOCK1 = 200809 const _POSIX_MEMLOCK_RANGE1 = 200809 const _POSIX_MEMORY_PROTECTION1 = 200809 const _POSIX_MESSAGE_PASSING1 = 200809 const _POSIX_MONOTONIC_CLOCK1 = 200809 const _POSIX_RAW_SOCKETS1 = 200809 const _POSIX_READER_WRITER_LOCKS1 = 200809 const _POSIX_REALTIME_SIGNALS1 = 200809 const _POSIX_SEMAPHORES1 = 200809 const _POSIX_SHARED_MEMORY_OBJECTS1 = 200809 const _POSIX_SPAWN1 = 200809 const _POSIX_SPIN_LOCKS1 = 200809 const _POSIX_THREADS1 = 200809 const _POSIX_THREAD_ATTR_STACKADDR1 = 200809 const _POSIX_THREAD_ATTR_STACKSIZE1 = 200809 const _POSIX_THREAD_CPUTIME1 = 200809 const _POSIX_THREAD_PRIORITY_SCHEDULING1 = 200809 const _POSIX_THREAD_PROCESS_SHARED1 = 200809 const _POSIX_THREAD_SAFE_FUNCTIONS1 = 200809 const _POSIX_TIMEOUTS1 = 200809 const _POSIX_TIMERS1 = 200809 const __ACCUM_EPSILON__1 = 0 const __ACCUM_MAX__1 = 0 const __ACCUM_MIN__ = 0 const __BYTE_ORDER__1 = 1234 const __DBL_MIN_10_EXP__ = -307 const __DBL_MIN_EXP__ = -1021 const __FLOAT_WORD_ORDER__1 = 1234 const __FLT32X_DENORM_MIN__1 = 0 const __FLT32X_EPSILON__1 = 0 const __FLT32X_MAX__1 = 0 const __FLT32X_MIN_10_EXP__ = -307 const __FLT32X_MIN_EXP__ = -1021 const __FLT32X_MIN__1 = 0 const __FLT32X_NORM_MAX__1 = 0 const __FLT32_DENORM_MIN__1 = 0 const __FLT32_EPSILON__1 = 0 const __FLT32_MAX__1 = 0 const __FLT32_MIN_10_EXP__ = -37 const __FLT32_MIN_EXP__ = -125 const __FLT32_MIN__1 = 0 const __FLT32_NORM_MAX__1 = 0 const __FLT64_DENORM_MIN__1 = 0 const __FLT64_EPSILON__1 = 0 const __FLT64_MAX__1 = 0 const __FLT64_MIN_10_EXP__ = -307 const __FLT64_MIN_EXP__ = -1021 const __FLT64_MIN__1 = 0 const __FLT64_NORM_MAX__1 = 0 const __FLT_DENORM_MIN__1 = 0 const __FLT_EPSILON__1 = 0 const __FLT_MAX__1 = 0 const __FLT_MIN_10_EXP__ = -37 const __FLT_MIN_EXP__ = -125 const __FLT_MIN__1 = 0 const __FLT_NORM_MAX__1 = 0 const __FRACT_EPSILON__1 = 0 const __FRACT_MAX__1 = 0 const __FRACT_MIN__ = 0 const __FUNCTION__1 = 0 const __INT16_MAX__1 = 32767 const __INT32_MAX__1 = 2147483647 const __INT32_TYPE__1 = 0 const __INT64_MAX__1 = 9223372036854775807 const __INT8_MAX__1 = 127 const __INTMAX_MAX__1 = 9223372036854775807 const __INTPTR_MAX__1 = 2147483647 const __INTPTR_TYPE__1 = 0 const __INT_FAST16_MAX__1 = 2147483647 const __INT_FAST16_TYPE__1 = 0 const __INT_FAST32_MAX__1 = 2147483647 const __INT_FAST32_TYPE__1 = 0 const __INT_FAST64_MAX__1 = 9223372036854775807 const __INT_FAST8_MAX__1 = 127 const __INT_LEAST16_MAX__1 = 32767 const __INT_LEAST32_MAX__1 = 2147483647 const __INT_LEAST32_TYPE__1 = 0 const __INT_LEAST64_MAX__1 = 9223372036854775807 const __INT_LEAST8_MAX__1 = 127 const __INT_MAX__1 = 2147483647 const __LACCUM_EPSILON__1 = 0 const __LACCUM_MAX__1 = 0 const __LACCUM_MIN__ = 0 const __LDBL_DENORM_MIN__1 = 0 const __LDBL_EPSILON__1 = 0 const __LDBL_MAX__1 = 0 const __LDBL_MIN_10_EXP__ = -307 const __LDBL_MIN_EXP__ = -1021 const __LDBL_MIN__1 = 0 const __LDBL_NORM_MAX__1 = 0 const __LFRACT_EPSILON__1 = 0 const __LFRACT_MAX__1 = 0 const __LFRACT_MIN__ = 0 const __LLACCUM_EPSILON__1 = 0 const __LLACCUM_MAX__1 = 0 const __LLACCUM_MIN__ = 0 const __LLFRACT_EPSILON__1 = 0 const __LLFRACT_MAX__1 = 0 const __LLFRACT_MIN__ = 0 const __LONG_LONG_MAX__1 = 9223372036854775807 const __LONG_MAX1 = 2147483647 const __LONG_MAX__1 = 2147483647 const __PRETTY_FUNCTION__1 = 0 const __PTRDIFF_MAX__1 = 2147483647 const __PTRDIFF_TYPE__1 = 0 const __SACCUM_EPSILON__1 = 0 const __SACCUM_MAX__1 = 0 const __SACCUM_MIN__ = 0 const __SCHAR_MAX__1 = 127 const __SFRACT_EPSILON__1 = 0 const __SFRACT_MAX__1 = 0 const __SFRACT_MIN__ = 0 const __SHRT_MAX__1 = 32767 const __SIG_ATOMIC_MAX__1 = 2147483647 const __SIG_ATOMIC_MIN__ = -2147483648 const __SIG_ATOMIC_TYPE__1 = 0 const __SIZE_MAX__1 = 4294967295 const __UACCUM_EPSILON__1 = 0 const __UACCUM_MAX__1 = 0 const __UACCUM_MIN__1 = 0 const __UAPI_DEF_IN6_ADDR = 0 const __UAPI_DEF_IN6_ADDR_ALT = 0 const __UAPI_DEF_IN6_PKTINFO = 0 const __UAPI_DEF_IN_ADDR = 0 const __UAPI_DEF_IN_CLASS = 0 const __UAPI_DEF_IN_IPPROTO = 0 const __UAPI_DEF_IN_PKTINFO = 0 const __UAPI_DEF_IP6_MTUINFO = 0 const __UAPI_DEF_IPPROTO_V6 = 0 const __UAPI_DEF_IPV6_MREQ = 0 const __UAPI_DEF_IPV6_OPTIONS = 0 const __UAPI_DEF_IP_MREQ = 0 const __UAPI_DEF_SOCKADDR_IN = 0 const __UAPI_DEF_SOCKADDR_IN6 = 0 const __UFRACT_EPSILON__1 = 0 const __UFRACT_MAX__1 = 0 const __UFRACT_MIN__1 = 0 const __UINT16_MAX__1 = 65535 const __UINT32_MAX__1 = 4294967295 const __UINT64_MAX__1 = 18446744073709551615 const __UINT8_MAX__1 = 255 const __UINTMAX_MAX__1 = 18446744073709551615 const __UINTPTR_MAX__1 = 4294967295 const __UINT_FAST16_MAX__1 = 4294967295 const __UINT_FAST32_MAX__1 = 4294967295 const __UINT_FAST64_MAX__1 = 18446744073709551615 const __UINT_FAST8_MAX__1 = 255 const __UINT_LEAST16_MAX__1 = 65535 const __UINT_LEAST32_MAX__1 = 4294967295 const __UINT_LEAST64_MAX__1 = 18446744073709551615 const __UINT_LEAST8_MAX__1 = 255 const __ULACCUM_EPSILON__1 = 0 const __ULACCUM_MAX__1 = 0 const __ULACCUM_MIN__1 = 0 const __ULFRACT_EPSILON__1 = 0 const __ULFRACT_MAX__1 = 0 const __ULFRACT_MIN__1 = 0 const __ULLACCUM_EPSILON__1 = 0 const __ULLACCUM_MAX__1 = 0 const __ULLACCUM_MIN__1 = 0 const __ULLFRACT_EPSILON__1 = 0 const __ULLFRACT_MAX__1 = 0 const __ULLFRACT_MIN__1 = 0 const __USACCUM_EPSILON__1 = 0 const __USACCUM_MAX__1 = 0 const __USACCUM_MIN__1 = 0 const __USFRACT_EPSILON__1 = 0 const __USFRACT_MAX__1 = 0 const __USFRACT_MIN__1 = 0 const __WALL = 1073741824 const __WCHAR_MAX__1 = 4294967295 const __WCLONE = 2147483648 const __WINT_MAX__1 = 4294967295 const __WNOTHREAD = 536870912 const __inline1 = 0 const __restrict1 = 0 const __restrict_arr1 = 0 const __tm_gmtoff1 = 0 const __tm_zone1 = 0 const __ucontext = 0 const alloca1 = 0 const alphasort64 = 0 const attemptckalloc1 = 0 const attemptckrealloc1 = 0 const blkcnt64_t = 0 const ckalloc1 = 0 const ckfree1 = 0 const ckrealloc1 = 0 const creat64 = 0 const d_fileno = 0 const dirent64 = 0 const errno = 0 const fallocate64 = 0 const fgetpos64 = 0 const flock64 = 0 const fopen64 = 0 const fpos64_t = 0 const freopen64 = 0 const fsblkcnt64_t = 0 const fseeko64 = 0 const fsetpos64 = 0 const fsfilcnt64_t = 0 const fstat64 = 0 const fstatat64 = 0 const ftello64 = 0 const ftruncate64 = 0 const getdents64 = 0 const getrlimit64 = 0 const h_errno = 0 const ino64_t = 0 const lockf64 = 0 const loff_t1 = 0 const lseek64 = 0 const lstat64 = 0 const mkostemp64 = 0 const mkostemps64 = 0 const mkstemp64 = 0 const mkstemps64 = 0 const off64_t = 0 const open64 = 0 const openat64 = 0 const posix_fadvise64 = 0 const posix_fallocate64 = 0 const pread64 = 0 const prlimit64 = 0 const pwrite64 = 0 const readdir64 = 0 const readdir64_r = 0 const rlim64_t = 0 const rlimit64 = 0 const scandir64 = 0 const setrlimit64 = 0 const stat64 = 0 const tmpfile64 = 0 const truncate64 = 0 const versionsort64 = 0 type Tpasswd = struct { Fpw_name uintptr Fpw_passwd uintptr Fpw_uid Tuid_t Fpw_gid Tgid_t Fpw_gecos uintptr Fpw_dir uintptr Fpw_shell uintptr } type Tstack_t = struct { Fss_sp uintptr Fss_flags int32 Fss_size Tsize_t } type Tsigaltstack = Tstack_t type Tgreg_t = int32 type Tgregset_t = [18]int32 type Tmcontext_t = struct { Ftrap_no uint32 Ferror_code uint32 Foldmask uint32 Farm_r0 uint32 Farm_r1 uint32 Farm_r2 uint32 Farm_r3 uint32 Farm_r4 uint32 Farm_r5 uint32 Farm_r6 uint32 Farm_r7 uint32 Farm_r8 uint32 Farm_r9 uint32 Farm_r10 uint32 Farm_fp uint32 Farm_ip uint32 Farm_sp uint32 Farm_lr uint32 Farm_pc uint32 Farm_cpsr uint32 Ffault_address uint32 } type Tsigcontext = Tmcontext_t type Tucontext_t = struct { F__ccgo_align [0]uint32 Fuc_flags uint32 Fuc_link uintptr Fuc_stack Tstack_t Fuc_mcontext Tmcontext_t Fuc_sigmask Tsigset_t Fuc_regspace [64]uint64 } type Tucontext = Tucontext_t type Tsigval = struct { Fsival_ptr [0]uintptr Fsival_int int32 } type Tsiginfo_t = struct { Fsi_signo int32 Fsi_errno int32 Fsi_code int32 F__si_fields struct { F__si_common [0]struct { F__first struct { F__timer [0]struct { Fsi_timerid int32 Fsi_overrun int32 } F__piduid struct { Fsi_pid Tpid_t Fsi_uid Tuid_t } } F__second struct { F__sigchld [0]struct { Fsi_status int32 Fsi_utime Tclock_t Fsi_stime Tclock_t } Fsi_value Tsigval F__ccgo_pad2 [8]byte } } F__sigfault [0]struct { Fsi_addr uintptr Fsi_addr_lsb int16 F__first struct { Fsi_pkey [0]uint32 F__addr_bnd struct { Fsi_lower uintptr Fsi_upper uintptr } } } F__sigpoll [0]struct { Fsi_band int32 Fsi_fd int32 } F__sigsys [0]struct { Fsi_call_addr uintptr Fsi_syscall int32 Fsi_arch uint32 } F__pad [116]uint8 } } type Tsigaction = struct { F__sa_handler struct { Fsa_sigaction [0]uintptr Fsa_handler uintptr } Fsa_mask Tsigset_t Fsa_flags int32 Fsa_restorer uintptr } type Tsigevent = struct { Fsigev_value Tsigval Fsigev_signo int32 Fsigev_notify int32 F__sev_fields struct { Fsigev_notify_thread_id [0]Tpid_t F__sev_thread [0]struct { Fsigev_notify_function uintptr Fsigev_notify_attributes uintptr } F__pad [52]uint8 } } type Tsig_t = uintptr type Tsighandler_t = uintptr type Tsig_atomic_t = int32 type Titimerval = struct { F__ccgo_align [0]uint32 Fit_interval Ttimeval Fit_value Ttimeval } type Ttimezone = struct { Ftz_minuteswest int32 Ftz_dsttime int32 } type Trlim_t = uint64 type Trlimit = struct { F__ccgo_align [0]uint32 Frlim_cur Trlim_t Frlim_max Trlim_t } type Trusage = struct { F__ccgo_align [0]uint32 Fru_utime Ttimeval Fru_stime Ttimeval Fru_maxrss int32 Fru_ixrss int32 Fru_idrss int32 Fru_isrss int32 Fru_minflt int32 Fru_majflt int32 Fru_nswap int32 Fru_inblock int32 Fru_oublock int32 Fru_msgsnd int32 Fru_msgrcv int32 Fru_nsignals int32 Fru_nvcsw int32 Fru_nivcsw int32 F__reserved [16]int32 } type Tdirent = struct { F__ccgo_align [0]uint32 Fd_ino Tino_t Fd_off Toff_t Fd_reclen uint16 Fd_type uint8 Fd_name [256]uint8 F__ccgo_pad5 [5]byte } type TTcl_DirEntry = struct { F__ccgo_align [0]uint32 Fd_ino Tino_t Fd_off Toff_t Fd_reclen uint16 Fd_type uint8 Fd_name [256]uint8 F__ccgo_pad5 [5]byte } type TTcl_SeekOffset = int64 type Tidtype_t = int32 const P_ALL = 0 const P_PID = 1 const P_PGID = 2 const P_PIDFD = 3 type Tutimbuf = struct { F__ccgo_align [0]uint32 Factime Ttime_t Fmodtime Ttime_t } type Tsocklen_t = uint32 type Tsa_family_t = uint16 type Tmsghdr = struct { Fmsg_name uintptr Fmsg_namelen Tsocklen_t Fmsg_iov uintptr Fmsg_iovlen int32 Fmsg_control uintptr Fmsg_controllen Tsocklen_t Fmsg_flags int32 } type Tcmsghdr = struct { Fcmsg_len Tsocklen_t Fcmsg_level int32 Fcmsg_type int32 } type Tucred = struct { Fpid Tpid_t Fuid Tuid_t Fgid Tgid_t } type Tmmsghdr = struct { Fmsg_hdr Tmsghdr Fmsg_len uint32 } type Tlinger = struct { Fl_onoff int32 Fl_linger int32 } type Tsockaddr = struct { Fsa_family Tsa_family_t Fsa_data [14]uint8 } type Tsockaddr_storage = struct { Fss_family Tsa_family_t F__ss_padding [122]uint8 F__ss_align uint32 } type Tutsname = struct { Fsysname [65]uint8 Fnodename [65]uint8 Frelease [65]uint8 Fversion [65]uint8 Fmachine [65]uint8 Fdomainname [65]uint8 } type Tin_port_t = uint16 type Tin_addr_t = uint32 type Tin_addr = struct { Fs_addr Tin_addr_t } type Tsockaddr_in = struct { Fsin_family Tsa_family_t Fsin_port Tin_port_t Fsin_addr Tin_addr Fsin_zero [8]Tuint8_t } type Tin6_addr = struct { F__in6_union struct { F__s6_addr16 [0][8]Tuint16_t F__s6_addr32 [0][4]Tuint32_t F__s6_addr [16]Tuint8_t } } type Tsockaddr_in6 = struct { Fsin6_family Tsa_family_t Fsin6_port Tin_port_t Fsin6_flowinfo Tuint32_t Fsin6_addr Tin6_addr Fsin6_scope_id Tuint32_t } type Tipv6_mreq = struct { Fipv6mr_multiaddr Tin6_addr Fipv6mr_interface uint32 } type Tip_opts = struct { Fip_dst Tin_addr Fip_opts [40]uint8 } type Tip_mreq = struct { Fimr_multiaddr Tin_addr Fimr_interface Tin_addr } type Tip_mreqn = struct { Fimr_multiaddr Tin_addr Fimr_address Tin_addr Fimr_ifindex int32 } type Tip_mreq_source = struct { Fimr_multiaddr Tin_addr Fimr_interface Tin_addr Fimr_sourceaddr Tin_addr } type Tip_msfilter = struct { Fimsf_multiaddr Tin_addr Fimsf_interface Tin_addr Fimsf_fmode Tuint32_t Fimsf_numsrc Tuint32_t Fimsf_slist [1]Tin_addr } type Tgroup_req = struct { Fgr_interface Tuint32_t Fgr_group Tsockaddr_storage } type Tgroup_source_req = struct { Fgsr_interface Tuint32_t Fgsr_group Tsockaddr_storage Fgsr_source Tsockaddr_storage } type Tgroup_filter = struct { Fgf_interface Tuint32_t Fgf_group Tsockaddr_storage Fgf_fmode Tuint32_t Fgf_numsrc Tuint32_t Fgf_slist [1]Tsockaddr_storage } type Tin_pktinfo = struct { Fipi_ifindex int32 Fipi_spec_dst Tin_addr Fipi_addr Tin_addr } type Tin6_pktinfo = struct { Fipi6_addr Tin6_addr Fipi6_ifindex uint32 } type Tip6_mtuinfo = struct { Fip6m_addr Tsockaddr_in6 Fip6m_mtu Tuint32_t } type Taddrinfo = struct { Fai_flags int32 Fai_family int32 Fai_socktype int32 Fai_protocol int32 Fai_addrlen Tsocklen_t Fai_addr uintptr Fai_canonname uintptr Fai_next uintptr } type Tnetent = struct { Fn_name uintptr Fn_aliases uintptr Fn_addrtype int32 Fn_net Tuint32_t } type Thostent = struct { Fh_name uintptr Fh_aliases uintptr Fh_addrtype int32 Fh_length int32 Fh_addr_list uintptr } type Tservent = struct { Fs_name uintptr Fs_aliases uintptr Fs_port int32 Fs_proto uintptr } type Tprotoent = struct { Fp_name uintptr Fp_aliases uintptr Fp_proto int32 } type Tsched_param = struct { Fsched_priority int32 F__reserved1 int32 F__reserved2 [4]int32 F__reserved3 int32 } type Tcpu_set_t = struct { F__bits [32]uint32 } type T__ptcb = struct { F__f uintptr F__x uintptr F__next uintptr } type Tcpu_set_t1 = struct { F__bits [32]uint32 } type Tgroup = struct { Fgr_name uintptr Fgr_passwd uintptr Fgr_gid Tgid_t Fgr_mem uintptr } type TTcl_LoadHandle_ = struct { FclientData uintptr FfindSymbolProcPtr uintptr FunloadFileProcPtr uintptr } type Tlconv = struct { Fdecimal_point uintptr Fthousands_sep uintptr Fgrouping uintptr Fint_curr_symbol uintptr Fcurrency_symbol uintptr Fmon_decimal_point uintptr Fmon_thousands_sep uintptr Fmon_grouping uintptr Fpositive_sign uintptr Fnegative_sign uintptr Fint_frac_digits uint8 Ffrac_digits uint8 Fp_cs_precedes uint8 Fp_sep_by_space uint8 Fn_cs_precedes uint8 Fn_sep_by_space uint8 Fp_sign_posn uint8 Fn_sign_posn uint8 Fint_p_cs_precedes uint8 Fint_p_sep_by_space uint8 Fint_n_cs_precedes uint8 Fint_n_sep_by_space uint8 Fint_p_sign_posn uint8 Fint_n_sign_posn uint8 } type TTcl_ResolvedVarInfo1 = struct { FfetchProc uintptr FdeleteProc uintptr } type TTcl_ResolvedVarInfo = struct { FfetchProc uintptr FdeleteProc uintptr } type TTcl_ResolverInfo = struct { FcmdResProc uintptr FvarResProc uintptr FcompiledVarResProc uintptr } type TNamespacePathEntry = struct { FnsPtr uintptr FcreatorNsPtr uintptr FprevPtr uintptr FnextPtr uintptr } type TTclVarHashTable = struct { Ftable TTcl_HashTable FnsPtr uintptr FarrayPtr uintptr } type TNamespace = struct { Fname uintptr FfullName uintptr FclientData uintptr FdeleteProc uintptr FparentPtr uintptr FchildTable TTcl_HashTable FnsId Tsize_t Finterp uintptr Fflags int32 FactivationCount TTcl_Size FrefCount TTcl_Size FcmdTable TTcl_HashTable FvarTable TTclVarHashTable FexportArrayPtr uintptr FnumExportPatterns TTcl_Size FmaxExportPatterns TTcl_Size FcmdRefEpoch TTcl_Size FresolverEpoch TTcl_Size FcmdResProc uintptr FvarResProc uintptr FcompiledVarResProc uintptr FexportLookupEpoch TTcl_Size Fensembles uintptr FunknownHandlerPtr uintptr FcommandPathLength TTcl_Size FcommandPathArray uintptr FcommandPathSourceList uintptr FearlyDeleteProc uintptr } type TNamespacePathEntry1 = struct { FnsPtr uintptr FcreatorNsPtr uintptr FprevPtr uintptr FnextPtr uintptr } type TEnsembleConfig = struct { FnsPtr uintptr Ftoken TTcl_Command Fepoch TTcl_Size FsubcommandArrayPtr uintptr FsubcommandTable TTcl_HashTable Fnext uintptr Fflags int32 FsubcommandDict uintptr FsubcmdList uintptr FunknownHandler uintptr FparameterList uintptr FnumParameters TTcl_Size } type TVarTrace = struct { FtraceProc uintptr FclientData uintptr Fflags int32 FnextPtr uintptr } type TCommandTrace = struct { FtraceProc uintptr FclientData uintptr Fflags int32 FnextPtr uintptr FrefCount TTcl_Size } type TActiveCommandTrace = struct { FcmdPtr uintptr FnextPtr uintptr FnextTracePtr uintptr FreverseScan int32 } type TActiveVarTrace = struct { FvarPtr uintptr FnextPtr uintptr FnextTracePtr uintptr } type TVar = struct { Fflags int32 Fvalue struct { FtablePtr [0]uintptr FlinkPtr [0]uintptr FobjPtr uintptr } } type TVarInHash = struct { Fvar1 TVar FrefCount TTcl_Size Fentry TTcl_HashEntry } type TCommand1 = struct { FhPtr uintptr FnsPtr uintptr FrefCount TTcl_Size FcmdEpoch TTcl_Size FcompileProc uintptr FobjProc uintptr FobjClientData uintptr Fproc uintptr FclientData uintptr FdeleteProc uintptr FdeleteData uintptr Fflags int32 FimportRefPtr uintptr FtracePtr uintptr FnreProc uintptr } type TCompiledLocal = struct { FnextPtr uintptr FnameLength TTcl_Size FframeIndex TTcl_Size FdefValuePtr uintptr FresolveInfo uintptr Fflags int32 } type TProc = struct { FiPtr uintptr FrefCount TTcl_Size FcmdPtr uintptr FbodyPtr uintptr FnumArgs TTcl_Size FnumCompiledLocals TTcl_Size FfirstLocalPtr uintptr FlastLocalPtr uintptr } type TTrace = struct { Flevel TTcl_Size Fproc uintptr FclientData uintptr FnextPtr uintptr Fflags int32 FdelProc uintptr } type TActiveInterpTrace = struct { FnextPtr uintptr FnextTracePtr uintptr FreverseScan int32 } type TAssocData = struct { Fproc uintptr FclientData uintptr } type TLocalCache = struct { FrefCount TTcl_Size FnumVars TTcl_Size FvarName0 uintptr } type TCallFrame = struct { FnsPtr uintptr FisProcCallFrame int32 Fobjc TTcl_Size Fobjv uintptr FcallerPtr uintptr FcallerVarPtr uintptr Flevel TTcl_Size FprocPtr uintptr FvarTablePtr uintptr FnumCompiledLocals TTcl_Size FcompiledLocals uintptr FclientData uintptr FlocalCachePtr uintptr FtailcallPtr uintptr } type TCmdFrame = struct { Ftype1 int32 Flevel int32 Fline uintptr Fnline TTcl_Size FframePtr uintptr FnextPtr uintptr Fdata struct { Ftebc [0]struct { FcodePtr uintptr Fpc uintptr } Feval struct { Fpath uintptr } F__ccgo_pad2 [4]byte } FcmdObj uintptr Fcmd uintptr Flen1 TTcl_Size Flitarg uintptr } type TCFWord = struct { FframePtr uintptr Fword TTcl_Size FrefCount TTcl_Size } type TCFWordBC = struct { FframePtr uintptr Fpc TTcl_Size Fword TTcl_Size FprevPtr uintptr FnextPtr uintptr Fobj uintptr } type TContLineLoc = struct { Fnum TTcl_Size } type TExtraFrameInfoField = struct { Fname uintptr Fproc uintptr FclientData uintptr } type TExtraFrameInfo = struct { Flength TTcl_Size Ffields [2]TExtraFrameInfoField } type TTclHandle = uintptr type TExecStack = struct { FprevPtr uintptr FnextPtr uintptr FmarkerPtr uintptr FendPtr uintptr FtosPtr uintptr } type TCorContext = struct { FframePtr uintptr FvarFramePtr uintptr FcmdFramePtr uintptr FlineLABCPtr uintptr } type TCoroutineData = struct { FcmdPtr uintptr FeePtr uintptr FcallerEEPtr uintptr Fcaller TCorContext Frunning TCorContext FlineLABCPtr uintptr FstackLevel uintptr FauxNumLevels TTcl_Size Fnargs TTcl_Size FyieldPtr uintptr } type TExecEnv = struct { FexecStackPtr uintptr Fconstants [2]uintptr Finterp uintptr FcallbackPtr uintptr FcorPtr uintptr Frewind int32 } type TLiteralEntry = struct { FnextPtr uintptr FobjPtr uintptr FrefCount TTcl_Size FnsPtr uintptr } type TLiteralTable = struct { Fbuckets uintptr FstaticBuckets [4]uintptr FnumBuckets Tsize_t FnumEntries Tsize_t FrebuildSize Tsize_t Fmask Tsize_t } type TEnsembleImplMap = struct { Fname uintptr Fproc uintptr FcompileProc uintptr FnreProc uintptr FclientData uintptr Funsafe int32 } type TImportRef = struct { FimportedCmdPtr uintptr FnextPtr uintptr } type TImportedCmdData = struct { FrealCmdPtr uintptr FselfPtr uintptr } type TCommand = struct { FhPtr uintptr FnsPtr uintptr FrefCount TTcl_Size FcmdEpoch TTcl_Size FcompileProc uintptr FobjProc uintptr FobjClientData uintptr Fproc uintptr FclientData uintptr FdeleteProc uintptr FdeleteData uintptr Fflags int32 FimportRefPtr uintptr FtracePtr uintptr FnreProc uintptr } type TResolverScheme = struct { Fname uintptr FcmdResProc uintptr FvarResProc uintptr FcompiledVarResProc uintptr FnextPtr uintptr } type PkgPreferOptions = int32 const PKG_PREFER_LATEST = 0 const PKG_PREFER_STABLE = 1 type TAllocCache = struct { FnextPtr uintptr Fowner TTcl_ThreadId FfirstObjPtr uintptr FnumObjects Tsize_t } type TInterp = struct { F__ccgo_align [0]uint32 FlegacyResult uintptr FlegacyFreeProc uintptr FerrorLine int32 FstubTable uintptr Fhandle TTclHandle FglobalNsPtr uintptr FhiddenCmdTablePtr uintptr FinterpInfo uintptr Foptimizer uintptr FnumLevels TTcl_Size FmaxNestingDepth TTcl_Size FframePtr uintptr FvarFramePtr uintptr FactiveVarTracePtr uintptr FreturnCode int32 FrootFramePtr uintptr FlookupNsPtr uintptr FpackageTable TTcl_HashTable FpackageUnknown uintptr FcmdCount TTcl_Size FevalFlags int32 FliteralTable TLiteralTable FcompileEpoch TTcl_Size FcompiledProcPtr uintptr FresolverPtr uintptr FscriptFile uintptr Fflags int32 FrandSeed int32 FtracePtr uintptr FassocData uintptr FexecEnvPtr uintptr FemptyObjPtr uintptr FobjResultPtr uintptr FthreadId TTcl_ThreadId FactiveCmdTracePtr uintptr FactiveInterpTracePtr uintptr FtracesForbiddingInline TTcl_Size FreturnOpts uintptr FerrorInfo uintptr FeiVar uintptr FerrorCode uintptr FecVar uintptr FreturnLevel int32 Flimit struct { F__ccgo_align [0]uint32 Factive int32 FgranularityTicker int32 Fexceeded int32 FcmdCount TTcl_Size FcmdHandlers uintptr FcmdGranularity int32 Ftime TTcl_Time FtimeHandlers uintptr FtimeGranularity int32 FtimeEvent TTcl_TimerToken Fcallbacks TTcl_HashTable F__ccgo_pad11 [4]byte } FensembleRewrite struct { FsourceObjs uintptr FnumRemovedObjs TTcl_Size FnumInsertedObjs TTcl_Size } FchanMsg uintptr FcmdFramePtr uintptr FinvokeCmdFramePtr uintptr FinvokeWord int32 FlinePBodyPtr uintptr FlineBCPtr uintptr FlineLABCPtr uintptr FlineLAPtr uintptr FscriptCLLocPtr uintptr FpackagePrefer int32 FvarTraces TTcl_HashTable FvarSearches TTcl_HashTable FallocCache uintptr FpendingObjDataPtr uintptr FasyncReadyPtr uintptr FobjectFoundation uintptr FdeferredCallbacks uintptr FasyncCancel TTcl_AsyncHandler FasyncCancelMsg uintptr FerrorStack uintptr FupLiteral uintptr FcallLiteral uintptr FinnerLiteral uintptr FinnerContext uintptr FresetErrorStack int32 } type TTclMaxAlignment = struct { F__ccgo_align [0]uint32 Funalign [8]uint8 Faligned struct { F__ccgo_align [0]uint32 FmaxAlignDouble [0]float64 FmaxAlignPointer [0]uintptr FmaxAlignLongLong int64 } } type TTclPlatformType = int32 const TCL_PLATFORM_UNIX = 0 const TCL_PLATFORM_WINDOWS = 2 type TTclEolTranslation = int32 type TclEolTranslation = int32 const TCL_TRANSLATE_AUTO = 0 const TCL_TRANSLATE_CR = 1 const TCL_TRANSLATE_LF = 2 const TCL_TRANSLATE_CRLF = 3 type TListStore = struct { FfirstUsed TTcl_Size FnumUsed TTcl_Size FnumAllocated TTcl_Size FrefCount Tsize_t Fflags int32 } type TListSpan = struct { FspanStart TTcl_Size FspanLength TTcl_Size FrefCount Tsize_t } type TListRep = struct { FstorePtr uintptr FspanPtr uintptr } type TTclFileAttrProcs = struct { FgetProc uintptr FsetProc uintptr } type TTclFile = uintptr type TTcl_PathPart = int32 type Tcl_PathPart = int32 const TCL_PATH_DIRNAME = 0 const TCL_PATH_TAIL = 1 const TCL_PATH_EXTENSION = 2 const TCL_PATH_ROOT = 3 type TProcessGlobalValue = struct { Fepoch TTcl_Size FnumBytes Tsize_t Fvalue uintptr Fencoding TTcl_Encoding Fproc uintptr Fmutex TTcl_Mutex Fkey TTcl_ThreadDataKey } type CheckEmptyStringResult = int32 const TCL_EMPTYSTRING_UNKNOWN = -1 const TCL_EMPTYSTRING_NO = 0 const TCL_EMPTYSTRING_YES = 1 type TForIterData = struct { Fcond uintptr Fbody uintptr Fnext uintptr Fmsg uintptr Fword TTcl_Size } type TmemCmpFn_t = uintptr type TTclProcessWaitStatus = int32 type TclProcessWaitStatus = int32 const TCL_PROCESS_ERROR = -1 const TCL_PROCESS_UNCHANGED = 0 const TCL_PROCESS_EXITED = 1 const TCL_PROCESS_SIGNALED = 2 const TCL_PROCESS_STOPPED = 3 const TCL_PROCESS_UNKNOWN_STATUS = 4 type TNRE_callback = struct { FprocPtr uintptr Fdata [4]uintptr FnextPtr uintptr } type TTclIntStubs = struct { Fmagic int32 Fhooks uintptr Freserved0 uintptr Freserved1 uintptr Freserved2 uintptr FtclAllocateFreeObjects uintptr Freserved4 uintptr FtclCleanupChildren uintptr FtclCleanupCommand uintptr FtclCopyAndCollapse uintptr Freserved8 uintptr FtclCreatePipeline uintptr FtclCreateProc uintptr FtclDeleteCompiledLocalVars uintptr FtclDeleteVars uintptr Freserved13 uintptr FtclDumpMemoryInfo uintptr Freserved15 uintptr FtclExprFloatError uintptr Freserved17 uintptr Freserved18 uintptr Freserved19 uintptr Freserved20 uintptr Freserved21 uintptr FtclFindElement uintptr FtclFindProc uintptr FtclFormatInt uintptr FtclFreePackageInfo uintptr Freserved26 uintptr Freserved27 uintptr FtclpGetDefaultStdChannel uintptr Freserved29 uintptr Freserved30 uintptr FtclGetExtension uintptr FtclGetFrame uintptr Freserved33 uintptr Freserved34 uintptr Freserved35 uintptr Freserved36 uintptr Freserved37 uintptr FtclGetNamespaceForQualName uintptr FtclGetObjInterpProc uintptr FtclGetOpenMode uintptr FtclGetOriginalCommand uintptr FtclpGetUserHome uintptr FtclGetObjInterpProc2 uintptr Freserved44 uintptr FtclHideUnsafeCommands uintptr FtclInExit uintptr Freserved47 uintptr Freserved48 uintptr Freserved49 uintptr Freserved50 uintptr FtclInterpInit uintptr Freserved52 uintptr Freserved53 uintptr Freserved54 uintptr FtclIsProc uintptr Freserved56 uintptr Freserved57 uintptr FtclLookupVar uintptr Freserved59 uintptr FtclNeedSpace uintptr FtclNewProcBodyObj uintptr FtclObjCommandComplete uintptr Freserved63 uintptr FtclObjInvoke uintptr Freserved65 uintptr Freserved66 uintptr Freserved67 uintptr Freserved68 uintptr FtclpAlloc uintptr Freserved70 uintptr Freserved71 uintptr Freserved72 uintptr Freserved73 uintptr FtclpFree uintptr FtclpGetClicks uintptr FtclpGetSeconds uintptr Freserved77 uintptr Freserved78 uintptr Freserved79 uintptr Freserved80 uintptr FtclpRealloc uintptr Freserved82 uintptr Freserved83 uintptr Freserved84 uintptr Freserved85 uintptr Freserved86 uintptr Freserved87 uintptr Freserved88 uintptr FtclPreventAliasLoop uintptr Freserved90 uintptr FtclProcCleanupProc uintptr FtclProcCompileProc uintptr FtclProcDeleteProc uintptr Freserved94 uintptr Freserved95 uintptr FtclRenameCommand uintptr FtclResetShadowedCmdRefs uintptr FtclServiceIdle uintptr Freserved99 uintptr Freserved100 uintptr Freserved101 uintptr FtclSetupEnv uintptr FtclSockGetPort uintptr Freserved104 uintptr Freserved105 uintptr Freserved106 uintptr Freserved107 uintptr FtclTeardownNamespace uintptr FtclUpdateReturnInfo uintptr FtclSockMinimumBuffers uintptr Ftcl_AddInterpResolvers uintptr Freserved112 uintptr Freserved113 uintptr Freserved114 uintptr Freserved115 uintptr Freserved116 uintptr Freserved117 uintptr Ftcl_GetInterpResolvers uintptr Ftcl_GetNamespaceResolvers uintptr Ftcl_FindNamespaceVar uintptr Freserved121 uintptr Freserved122 uintptr Freserved123 uintptr Freserved124 uintptr Freserved125 uintptr Ftcl_GetVariableFullName uintptr Freserved127 uintptr Ftcl_PopCallFrame uintptr Ftcl_PushCallFrame uintptr Ftcl_RemoveInterpResolvers uintptr Ftcl_SetNamespaceResolvers uintptr Freserved132 uintptr Freserved133 uintptr Freserved134 uintptr Freserved135 uintptr Freserved136 uintptr Freserved137 uintptr FtclGetEnv uintptr Freserved139 uintptr Freserved140 uintptr FtclpGetCwd uintptr FtclSetByteCodeFromAny uintptr FtclAddLiteralObj uintptr FtclHideLiteral uintptr FtclGetAuxDataType uintptr FtclHandleCreate uintptr FtclHandleFree uintptr FtclHandlePreserve uintptr FtclHandleRelease uintptr FtclRegAbout uintptr FtclRegExpRangeUniChar uintptr Freserved152 uintptr Freserved153 uintptr Freserved154 uintptr Freserved155 uintptr FtclRegError uintptr FtclVarTraceExists uintptr Freserved158 uintptr Freserved159 uintptr Freserved160 uintptr FtclChannelTransform uintptr FtclChannelEventScriptInvoker uintptr FtclGetInstructionTable uintptr FtclExpandCodeArray uintptr FtclpSetInitialEncodings uintptr FtclListObjSetElement uintptr Freserved167 uintptr Freserved168 uintptr FtclpUtfNcmp2 uintptr FtclCheckInterpTraces uintptr FtclCheckExecutionTraces uintptr FtclInThreadExit uintptr FtclUniCharMatch uintptr Freserved174 uintptr FtclCallVarTraces uintptr FtclCleanupVar uintptr FtclVarErrMsg uintptr Freserved178 uintptr Freserved179 uintptr Freserved180 uintptr Freserved181 uintptr Freserved182 uintptr Freserved183 uintptr Freserved184 uintptr Freserved185 uintptr Freserved186 uintptr Freserved187 uintptr Freserved188 uintptr Freserved189 uintptr Freserved190 uintptr Freserved191 uintptr Freserved192 uintptr Freserved193 uintptr Freserved194 uintptr Freserved195 uintptr Freserved196 uintptr Freserved197 uintptr FtclObjGetFrame uintptr Freserved199 uintptr FtclpObjRemoveDirectory uintptr FtclpObjCopyDirectory uintptr FtclpObjCreateDirectory uintptr FtclpObjDeleteFile uintptr FtclpObjCopyFile uintptr FtclpObjRenameFile uintptr FtclpObjStat uintptr FtclpObjAccess uintptr FtclpOpenFileChannel uintptr Freserved209 uintptr Freserved210 uintptr Freserved211 uintptr FtclpFindExecutable uintptr FtclGetObjNameOfExecutable uintptr FtclSetObjNameOfExecutable uintptr FtclStackAlloc uintptr FtclStackFree uintptr FtclPushStackFrame uintptr FtclPopStackFrame uintptr FtclpCreateTemporaryDirectory uintptr Freserved220 uintptr FtclListTestObj uintptr FtclListObjValidate uintptr FtclGetCStackPtr uintptr FtclGetPlatform uintptr FtclTraceDictPath uintptr FtclObjBeingDeleted uintptr FtclSetNsPath uintptr Freserved228 uintptr FtclPtrMakeUpvar uintptr FtclObjLookupVar uintptr FtclGetNamespaceFromObj uintptr FtclEvalObjEx uintptr FtclGetSrcInfoForPc uintptr FtclVarHashCreateVar uintptr FtclInitVarHashTable uintptr Freserved236 uintptr FtclResetCancellation uintptr FtclNRInterpProc uintptr FtclNRInterpProcCore uintptr FtclNRRunCallbacks uintptr FtclNREvalObjEx uintptr FtclNREvalObjv uintptr FtclDbDumpActiveObjects uintptr FtclGetNamespaceChildTable uintptr FtclGetNamespaceCommandTable uintptr FtclInitRewriteEnsemble uintptr FtclResetRewriteEnsemble uintptr FtclCopyChannel uintptr FtclDoubleDigits uintptr FtclSetChildCancelFlags uintptr FtclRegisterLiteral uintptr FtclPtrGetVar uintptr FtclPtrSetVar uintptr FtclPtrIncrObjVar uintptr FtclPtrObjMakeUpvar uintptr FtclPtrUnsetVar uintptr FtclStaticLibrary uintptr Freserved258 uintptr Freserved259 uintptr Freserved260 uintptr FtclUnusedStubEntry uintptr } type TTclIntPlatStubs = struct { Fmagic int32 Fhooks uintptr Freserved0 uintptr FtclpCloseFile uintptr FtclpCreateCommandChannel uintptr FtclpCreatePipe uintptr FtclWinGetTclInstance uintptr FtclUnixWaitForFile uintptr FtclpMakeFile uintptr FtclpOpenFile uintptr FtclpGetPid uintptr FtclpCreateTempFile uintptr Freserved10 uintptr FtclGetAndDetachPids uintptr Freserved12 uintptr Freserved13 uintptr Freserved14 uintptr FtclpCreateProcess uintptr FtclpIsAtty uintptr FtclUnixCopyFile uintptr Freserved18 uintptr Freserved19 uintptr FtclWinAddProcess uintptr Freserved21 uintptr Freserved22 uintptr Freserved23 uintptr FtclWinNoBackslash uintptr Freserved25 uintptr Freserved26 uintptr FtclWinFlushDirtyChannels uintptr Freserved28 uintptr FtclWinCPUID uintptr FtclUnixOpenTemporaryFile uintptr } /* * Use our own ISDIGIT to avoid linking to libc on windows */ // C documentation // // /* // *---------------------------------------------------------------------- // * // * Tcl_InitStubs -- // * // * Tries to initialise the stub table pointers and ensures that the // * correct version of Tcl is loaded. // * // * Results: // * The actual version of Tcl that satisfies the request, or NULL to // * indicate that an error occurred. // * // * Side effects: // * Sets the stub table pointers. // * // *---------------------------------------------------------------------- // */ func XTcl_InitStubs(tls *libc.TLS, interp uintptr, version uintptr, exact int32, magic int32) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var actualVersion, iPtr, p, q, stubsPtr, tclName, v1, v4 uintptr var count, v2 int32 var v3 bool var _ /* pkgData at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _, _ = actualVersion, count, iPtr, p, q, stubsPtr, tclName, v1, v2, v3, v4 iPtr = interp actualVersion = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0) stubsPtr = (*TInterp)(unsafe.Pointer(iPtr)).FstubTable if exact&int32(0xFF00) >= int32(0x900) { v1 = __ccgo_ts + 58271 } else { v1 = __ccgo_ts + 58275 } tclName = v1 /* * We can't optimize this check by caching tclStubsPtr because that * prevents apps from being able to load/unload Tcl dynamically multiple * times. [Bug 615304] */ if v3 = !(stubsPtr != 0); !v3 { if exact&int32(0xFF00) >= int32(0x900) { v2 = magic } else { v2 = libc.Int32FromUint32(0xFCA3BACF) } } if v3 || (*TTclStubs)(unsafe.Pointer(stubsPtr)).Fmagic != v2 { (*TInterp)(unsafe.Pointer(iPtr)).FlegacyResult = __ccgo_ts + 58279 (*TInterp)(unsafe.Pointer(iPtr)).FlegacyFreeProc = uintptr(0) /* TCL_STATIC */ return libc.UintptrFromInt32(0) } actualVersion = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(stubsPtr)).Ftcl_PkgRequireEx})))(tls, interp, tclName, version, 0, bp) if actualVersion == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } if exact&int32(1) != 0 { p = version count = 0 for *(*uint8)(unsafe.Pointer(p)) != 0 { v4 = p p++ count += libc.BoolInt32(!(libc.Uint32FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v4)))-libc.Int32FromUint8('0')) <= libc.Uint32FromInt32(9))) } if count == int32(1) { q = actualVersion p = version for *(*uint8)(unsafe.Pointer(p)) != 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(q))) { p++ q++ } if *(*uint8)(unsafe.Pointer(p)) != 0 || libc.Uint32FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(q)))-libc.Int32FromUint8('0')) <= uint32(9) { /* Construct error message */ (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(stubsPtr)).Ftcl_PkgRequireEx})))(tls, interp, tclName, version, int32(1), libc.UintptrFromInt32(0)) return libc.UintptrFromInt32(0) } } else { actualVersion = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(stubsPtr)).Ftcl_PkgRequireEx})))(tls, interp, tclName, version, int32(1), libc.UintptrFromInt32(0)) if actualVersion == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } } } if exact&int32(0xFF00) < int32(0x900) { /* We are running Tcl 8.x */ stubsPtr = *(*uintptr)(unsafe.Pointer(bp)) } if XtclStubsHandle == libc.UintptrFromInt32(0) { XtclStubsHandle = uintptr(-libc.Int32FromInt32(1)) } XtclStubsPtr = stubsPtr if (*TTclStubs)(unsafe.Pointer(stubsPtr)).Fhooks != 0 { XtclPlatStubsPtr = (*TTclStubHooks)(unsafe.Pointer((*TTclStubs)(unsafe.Pointer(stubsPtr)).Fhooks)).FtclPlatStubs XtclIntStubsPtr = (*TTclStubHooks)(unsafe.Pointer((*TTclStubs)(unsafe.Pointer(stubsPtr)).Fhooks)).FtclIntStubs XtclIntPlatStubsPtr = (*TTclStubHooks)(unsafe.Pointer((*TTclStubs)(unsafe.Pointer(stubsPtr)).Fhooks)).FtclIntPlatStubs } else { XtclPlatStubsPtr = libc.UintptrFromInt32(0) XtclIntStubsPtr = libc.UintptrFromInt32(0) XtclIntPlatStubsPtr = libc.UintptrFromInt32(0) } return actualVersion } const ALL_BUTTONS = 31465216 const ALT_MASK = 131072 const ActivateMask = 536870912 const ActivateNotify = 36 const AllHints = 127 const AllValues1 = 15 const AnyModifier = 32768 const BUILD_tk = 1 const Bool1 = 0 const Button1Mask = 256 const Button1MotionMask = 256 const Button2Mask = 512 const Button2MotionMask = 512 const Button3Mask = 1024 const Button3MotionMask = 1024 const Button4Mask = 2048 const Button4MotionMask = 2048 const Button5Mask = 4096 const Button5MotionMask = 4096 const Button6Mask = 2097152 const Button7Mask = 4194304 const Button8 = 8 const Button8Mask = 8388608 const Button9 = 9 const Button9Mask = 16777216 const ButtonMotionMask = 8192 const ButtonPressMask = 4 const ButtonReleaseMask = 8 const COLORREF = 0 const CWBackPixel = 2 const CWBackPixmap = 1 const CWBackingPixel = 256 const CWBackingPlanes = 128 const CWBackingStore = 64 const CWBitGravity = 16 const CWBorderPixel = 8 const CWBorderPixmap = 4 const CWBorderWidth = 16 const CWColormap = 8192 const CWCursor = 16384 const CWDontPropagate = 4096 const CWEventMask = 2048 const CWHeight = 8 const CWOverrideRedirect = 512 const CWSaveUnder = 1024 const CWSibling = 32 const CWStackMode = 64 const CWWidth = 4 const CWWinGravity = 32 const CWX = 1 const CWY = 2 const ColormapChangeMask = 8388608 const ControlMask = 4 const DeactivateNotify = 37 const DoBlue = 4 const DoGreen = 2 const DoRed = 1 const ELFlagFocus = 1 const ELFlagSameScreen = 2 const EMBEDDED_APP_WANTS_FOCUS = 20 const EXTENDED_MASK = 262144 const EnterWindowMask = 16 const ExposureMask = 32768 const FP_ILOGB01 = -2147483648 const FP_ILOGBNAN = -2147483648 const FocusChangeMask = 2097152 const GCArcMode = 4194304 const GCBackground = 8 const GCCapStyle = 64 const GCClipMask = 524288 const GCClipXOrigin = 131072 const GCClipYOrigin = 262144 const GCDashList = 2097152 const GCDashOffset = 1048576 const GCFillRule = 512 const GCFillStyle = 256 const GCFont = 16384 const GCForeground = 4 const GCFunction = 1 const GCGraphicsExposures = 65536 const GCJoinStyle = 128 const GCLineStyle = 32 const GCLineWidth = 16 const GCPlaneMask = 2 const GCStipple = 2048 const GCSubwindowMode = 32768 const GCTile = 1024 const GCTileStipXOrigin = 4096 const GCTileStipYOrigin = 8192 const GXand1 = 1 const GXandInverted1 = 4 const GXandReverse1 = 2 const GXclear1 = 0 const GXcopy1 = 3 const GXcopyInverted1 = 12 const GXequiv1 = 9 const GXinvert1 = 10 const GXnand1 = 14 const GXnoop1 = 5 const GXnor1 = 8 const GXor1 = 7 const GXorInverted1 = 13 const GXorReverse1 = 11 const GXset1 = 15 const GXxor1 = 6 const HAVE_LIBXFT = 1 const HAVE_PW_GECOS = 1 const HAVE_XFT = 1 const HDC = 0 const HINSTANCE = 0 const HMENU = 0 const HPALETTE = 0 const HUGE1 = 0 const HUGE_VALF1 = 0 const HWND = 0 const HeightValue1 = 8 const INFINITY = 0 const IconMaskHint = 32 const IconPixmapHint = 4 const IconPositionHint = 16 const IconWindowHint = 8 const InputHint = 1 const KBAutoRepeatMode = 128 const KBBellDuration = 8 const KBBellPercent = 2 const KBBellPitch = 4 const KBKey = 64 const KBKeyClickPercent = 1 const KBLed = 16 const KBLedMode = 32 const KeyPressMask = 1 const KeyReleaseMask = 2 const KeymapStateMask = 16384 const LPARAM = 0 const LRESULT = 0 const LeaveWindowMask = 32 const LockMask = 2 const META_MASK = 65536 const M_1_PI1 = 0 const M_2_PI1 = 0 const M_2_SQRTPI1 = 0 const M_E1 = 0 const M_LN101 = 0 const M_LN23 = 0 const M_LOG10E1 = 0 const M_LOG2E1 = 0 const M_PI3 = 0 const M_PI_21 = 0 const M_PI_41 = 0 const M_SQRT1_21 = 0 const M_SQRT21 = 0 const Mod1Mask = 8 const Mod2Mask = 16 const Mod3Mask = 32 const Mod4Mask = 64 const Mod5Mask = 128 const MouseWheelEvent = 38 const MouseWheelMask = 268435456 const NAN = 0 const NoValue1 = 0 const OwnerGrabButtonMask = 16777216 const PACKAGE_NAME24 = "tk" const PACKAGE_STRING25 = "tk 9.0" const PACKAGE_TARNAME24 = "tk" const PAllHints = 252 const PAspect = 128 const PBaseSize = 256 const PI = 0 const PMaxSize = 32 const PMinSize = 16 const PPosition = 4 const PResizeInc = 64 const PSize = 8 const PWinGravity = 512 const PointerMotionHintMask = 128 const PointerMotionMask = 64 const PropertyChangeMask = 4194304 const ResizeRedirectMask = 262144 const ShiftMask = 1 const StateHint = 2 const Status1 = 0 const StructureNotifyMask = 131072 const SubstructureNotifyMask = 524288 const SubstructureRedirectMask = 1048576 const TCL_SHLIB_EXT1 = ".so" const TKP_CLIP_PIXMAP = 0 const TKP_CLIP_REGION = 1 const TK_ANONYMOUS_WINDOW1 = 16384 const TK_ARGV_DONT_SKIP_FIRST_ARG1 = 8 const TK_ARGV_NO_ABBREV1 = 4 const TK_ARGV_NO_DEFAULTS1 = 1 const TK_ARGV_NO_LEFTOVERS1 = 2 const TK_BOTH_HALVES1 = 1024 const TK_CAN_INPUT_TEXT1 = 1048576 const TK_CHECKED_IC1 = 32 const TK_CONFIG_COLOR_ONLY = 2 const TK_CONFIG_DONT_SET_DEFAULT = 8 const TK_CONFIG_MONO_ONLY = 4 const TK_CONFIG_NULL_OK1 = 32 const TK_CONFIG_OBJS3 = 128 const TK_CONFIG_USER_BIT1 = 256 const TK_CONTAINER1 = 512 const TK_DISPLAY_COLLAPSE_MOTION_EVENTS = 1 const TK_DISPLAY_USE_IM = 2 const TK_DISPLAY_WM_TRACING = 8 const TK_DONT_DESTROY_WINDOW1 = 64 const TK_ELEMENT_STATE_ACTIVE = 1 const TK_ELEMENT_STATE_DISABLED = 2 const TK_ELEMENT_STATE_FOCUS = 4 const TK_ELEMENT_STATE_PRESSED = 8 const TK_EMBEDDED1 = 256 const TK_GRAB_ANCESTOR = 2 const TK_GRAB_EXCLUDED = 3 const TK_GRAB_FLAG1 = 16 const TK_GRAB_IN_TREE = 1 const TK_GRAB_NONE = 0 const TK_HAS_WRAPPER1 = 32768 const TK_LASTEVENT = 40 const TK_MAKE_MENU_DROPDOWN = 2 const TK_MAKE_MENU_POPUP = 1 const TK_MAKE_MENU_TEAROFF = 0 const TK_OPTION_DONT_SET_DEFAULT = 8 const TK_OPTION_NULL_OK1 = 32 const TK_PROP_PROPCHANGE1 = 262144 const TK_RELEASE_LEVEL1 = 2 const TK_RELIEF_NULL = -1 const TK_REPARENTED1 = 8192 const TK_STYLE_VERSION1 = 1 const TK_STYLE_VERSION_11 = 1 const TK_TOP_HIERARCHY1 = 131072 const TK_WIN_MANAGED1 = 65536 const TK_WM_COLORMAP_WINDOW1 = 128 const TK_WM_MANAGEABLE1 = 524288 const TK_WRAPPER1 = 4096 const TkClipBox = 0 const TkCreateRegion = 0 const TkDestroyRegion = 0 const TkIntersectRegion = 0 const TkMacOSXDrawable = 0 const TkRectInRegion = 0 const TkRegion = 0 const TkSetRegion = 0 const TkSubtractRegion = 0 const TkUnionRectWithRegion = 0 const TkWinDCState = 0 const Tk_GeomLostSlaveProc1 = 0 const Tk_GetImageMasterData1 = 0 const Tk_ImageMaster1 = 0 const Tk_MacOSXGetNSViewForDrawable = 0 const TouchpadScroll = 39 const TouchpadScrollMask = 134217728 const USPosition = 1 const USSize = 2 const VirtualEvent = 35 const VirtualEventMask = 1073741824 const VisibilityChangeMask = 65536 const VisualAllMask1 = 511 const VisualBitsPerRGBMask1 = 256 const VisualBlueMaskMask1 = 64 const VisualClassMask1 = 8 const VisualColormapSizeMask1 = 128 const VisualDepthMask1 = 4 const VisualGreenMaskMask1 = 32 const VisualIDMask1 = 1 const VisualNoMask1 = 0 const VisualRedMaskMask1 = 16 const VisualScreenMask1 = 2 const WNDPROC = 0 const WPARAM = 0 const WidthValue1 = 4 const WindowGroupHint = 64 const XATOM_H = 1 const XBufferOverflow = -1 const XC_X_cursor = 0 const XC_arrow = 2 const XC_based_arrow_down = 4 const XC_based_arrow_up = 6 const XC_boat = 8 const XC_bogosity = 10 const XC_bottom_left_corner = 12 const XC_bottom_right_corner = 14 const XC_bottom_side = 16 const XC_bottom_tee = 18 const XC_box_spiral = 20 const XC_center_ptr = 22 const XC_circle = 24 const XC_clock = 26 const XC_coffee_mug = 28 const XC_cross = 30 const XC_cross_reverse = 32 const XC_crosshair = 34 const XC_diamond_cross = 36 const XC_dot = 38 const XC_dotbox = 40 const XC_double_arrow = 42 const XC_draft_large = 44 const XC_draft_small = 46 const XC_draped_box = 48 const XC_exchange = 50 const XC_fleur = 52 const XC_gobbler = 54 const XC_gumby = 56 const XC_hand1 = 58 const XC_hand2 = 60 const XC_heart = 62 const XC_icon = 64 const XC_iron_cross = 66 const XC_left_ptr = 68 const XC_left_side = 70 const XC_left_tee = 72 const XC_leftbutton = 74 const XC_ll_angle = 76 const XC_lr_angle = 78 const XC_man = 80 const XC_middlebutton = 82 const XC_mouse = 84 const XC_num_glyphs = 154 const XC_pencil = 86 const XC_pirate = 88 const XC_plus = 90 const XC_question_arrow = 92 const XC_right_ptr = 94 const XC_right_side = 96 const XC_right_tee = 98 const XC_rightbutton = 100 const XC_rtl_logo = 102 const XC_sailboat = 104 const XC_sb_down_arrow = 106 const XC_sb_h_double_arrow = 108 const XC_sb_left_arrow = 110 const XC_sb_right_arrow = 112 const XC_sb_up_arrow = 114 const XC_sb_v_double_arrow = 116 const XC_shuttle = 118 const XC_sizing = 120 const XC_spider = 122 const XC_spraycan = 124 const XC_star = 126 const XC_target = 128 const XC_tcross = 130 const XC_top_left_arrow = 132 const XC_top_left_corner = 134 const XC_top_right_corner = 136 const XC_top_side = 138 const XC_top_tee = 140 const XC_trek = 142 const XC_ul_angle = 144 const XC_umbrella = 146 const XC_ur_angle = 148 const XC_watch = 150 const XC_xterm = 152 const XConverterNotFound = -3 const XEventSize = 0 const XIMHighlight = 4 const XIMHotKeyStateOFF1 = 2 const XIMHotKeyStateON1 = 1 const XIMPreeditArea1 = 1 const XIMPreeditCallbacks1 = 2 const XIMPreeditDisable = 2 const XIMPreeditNone1 = 16 const XIMPreeditNothing1 = 8 const XIMPreeditPosition1 = 4 const XIMPreserveState = 2 const XIMPrimary = 32 const XIMSecondary = 64 const XIMStatusArea1 = 256 const XIMStatusCallbacks1 = 512 const XIMStatusNone1 = 2048 const XIMStatusNothing1 = 1024 const XIMStringConversionBottomEdge1 = 8 const XIMStringConversionBuffer1 = 1 const XIMStringConversionChar1 = 4 const XIMStringConversionConcealed1 = 16 const XIMStringConversionLeftEdge1 = 1 const XIMStringConversionLine1 = 2 const XIMStringConversionRetrieval1 = 2 const XIMStringConversionRightEdge1 = 2 const XIMStringConversionSubstitution1 = 1 const XIMStringConversionTopEdge1 = 4 const XIMStringConversionWord1 = 3 const XIMStringConversionWrapped1 = 32 const XIMTertiary = 128 const XIMUnderline = 2 const XIMVisibleToBackword = 512 const XIMVisibleToCenter = 1024 const XIMVisibleToForward = 256 const XK_01 = 48 const XK_11 = 49 const XK_21 = 50 const XK_31 = 51 const XK_41 = 52 const XK_51 = 53 const XK_61 = 54 const XK_71 = 55 const XK_81 = 56 const XK_91 = 57 const XK_A1 = 65 const XK_AE1 = 198 const XK_Aacute1 = 193 const XK_Abelowdot1 = 16785056 const XK_Abreve1 = 451 const XK_Abreveacute1 = 16785070 const XK_Abrevebelowdot1 = 16785078 const XK_Abrevegrave1 = 16785072 const XK_Abrevehook1 = 16785074 const XK_Abrevetilde1 = 16785076 const XK_AccessX_Enable1 = 65136 const XK_AccessX_Feedback_Enable1 = 65137 const XK_Acircumflex1 = 194 const XK_Acircumflexacute1 = 16785060 const XK_Acircumflexbelowdot1 = 16785068 const XK_Acircumflexgrave1 = 16785062 const XK_Acircumflexhook1 = 16785064 const XK_Acircumflextilde1 = 16785066 const XK_Adiaeresis1 = 196 const XK_Agrave1 = 192 const XK_Ahook1 = 16785058 const XK_Alt_L1 = 65513 const XK_Alt_R1 = 65514 const XK_Amacron1 = 960 const XK_Aogonek1 = 417 const XK_Arabic_01 = 16778848 const XK_Arabic_11 = 16778849 const XK_Arabic_21 = 16778850 const XK_Arabic_31 = 16778851 const XK_Arabic_41 = 16778852 const XK_Arabic_51 = 16778853 const XK_Arabic_61 = 16778854 const XK_Arabic_71 = 16778855 const XK_Arabic_81 = 16778856 const XK_Arabic_91 = 16778857 const XK_Arabic_ain1 = 1497 const XK_Arabic_alef1 = 1479 const XK_Arabic_alefmaksura1 = 1513 const XK_Arabic_beh1 = 1480 const XK_Arabic_comma1 = 1452 const XK_Arabic_dad1 = 1494 const XK_Arabic_dal1 = 1487 const XK_Arabic_damma1 = 1519 const XK_Arabic_dammatan1 = 1516 const XK_Arabic_ddal1 = 16778888 const XK_Arabic_farsi_yeh1 = 16778956 const XK_Arabic_fatha1 = 1518 const XK_Arabic_fathatan1 = 1515 const XK_Arabic_feh1 = 1505 const XK_Arabic_fullstop1 = 16778964 const XK_Arabic_gaf1 = 16778927 const XK_Arabic_ghain1 = 1498 const XK_Arabic_ha1 = 1511 const XK_Arabic_hah1 = 1485 const XK_Arabic_hamza1 = 1473 const XK_Arabic_hamza_above1 = 16778836 const XK_Arabic_hamza_below1 = 16778837 const XK_Arabic_hamzaonalef1 = 1475 const XK_Arabic_hamzaonwaw1 = 1476 const XK_Arabic_hamzaonyeh1 = 1478 const XK_Arabic_hamzaunderalef1 = 1477 const XK_Arabic_heh1 = 1511 const XK_Arabic_heh_doachashmee1 = 16778942 const XK_Arabic_heh_goal1 = 16778945 const XK_Arabic_jeem1 = 1484 const XK_Arabic_jeh1 = 16778904 const XK_Arabic_kaf1 = 1507 const XK_Arabic_kasra1 = 1520 const XK_Arabic_kasratan1 = 1517 const XK_Arabic_keheh1 = 16778921 const XK_Arabic_khah1 = 1486 const XK_Arabic_lam1 = 1508 const XK_Arabic_madda_above1 = 16778835 const XK_Arabic_maddaonalef1 = 1474 const XK_Arabic_meem1 = 1509 const XK_Arabic_noon1 = 1510 const XK_Arabic_noon_ghunna1 = 16778938 const XK_Arabic_peh1 = 16778878 const XK_Arabic_percent1 = 16778858 const XK_Arabic_qaf1 = 1506 const XK_Arabic_question_mark1 = 1471 const XK_Arabic_ra1 = 1489 const XK_Arabic_rreh1 = 16778897 const XK_Arabic_sad1 = 1493 const XK_Arabic_seen1 = 1491 const XK_Arabic_semicolon1 = 1467 const XK_Arabic_shadda1 = 1521 const XK_Arabic_sheen1 = 1492 const XK_Arabic_sukun1 = 1522 const XK_Arabic_superscript_alef1 = 16778864 const XK_Arabic_switch1 = 65406 const XK_Arabic_tah1 = 1495 const XK_Arabic_tatweel1 = 1504 const XK_Arabic_tcheh1 = 16778886 const XK_Arabic_teh1 = 1482 const XK_Arabic_tehmarbuta1 = 1481 const XK_Arabic_thal1 = 1488 const XK_Arabic_theh1 = 1483 const XK_Arabic_tteh1 = 16778873 const XK_Arabic_veh1 = 16778916 const XK_Arabic_waw1 = 1512 const XK_Arabic_yeh1 = 1514 const XK_Arabic_yeh_baree1 = 16778962 const XK_Arabic_zah1 = 1496 const XK_Arabic_zain1 = 1490 const XK_Aring1 = 197 const XK_Armenian_AT1 = 16778552 const XK_Armenian_AYB1 = 16778545 const XK_Armenian_BEN1 = 16778546 const XK_Armenian_CHA1 = 16778569 const XK_Armenian_DA1 = 16778548 const XK_Armenian_DZA1 = 16778561 const XK_Armenian_E1 = 16778551 const XK_Armenian_FE1 = 16778582 const XK_Armenian_GHAT1 = 16778562 const XK_Armenian_GIM1 = 16778547 const XK_Armenian_HI1 = 16778565 const XK_Armenian_HO1 = 16778560 const XK_Armenian_INI1 = 16778555 const XK_Armenian_JE1 = 16778571 const XK_Armenian_KE1 = 16778580 const XK_Armenian_KEN1 = 16778559 const XK_Armenian_KHE1 = 16778557 const XK_Armenian_LYUN1 = 16778556 const XK_Armenian_MEN1 = 16778564 const XK_Armenian_NU1 = 16778566 const XK_Armenian_O1 = 16778581 const XK_Armenian_PE1 = 16778570 const XK_Armenian_PYUR1 = 16778579 const XK_Armenian_RA1 = 16778572 const XK_Armenian_RE1 = 16778576 const XK_Armenian_SE1 = 16778573 const XK_Armenian_SHA1 = 16778567 const XK_Armenian_TCHE1 = 16778563 const XK_Armenian_TO1 = 16778553 const XK_Armenian_TSA1 = 16778558 const XK_Armenian_TSO1 = 16778577 const XK_Armenian_TYUN1 = 16778575 const XK_Armenian_VEV1 = 16778574 const XK_Armenian_VO1 = 16778568 const XK_Armenian_VYUN1 = 16778578 const XK_Armenian_YECH1 = 16778549 const XK_Armenian_ZA1 = 16778550 const XK_Armenian_ZHE1 = 16778554 const XK_Armenian_accent1 = 16778587 const XK_Armenian_amanak1 = 16778588 const XK_Armenian_apostrophe1 = 16778586 const XK_Armenian_at1 = 16778600 const XK_Armenian_ayb1 = 16778593 const XK_Armenian_ben1 = 16778594 const XK_Armenian_but1 = 16778589 const XK_Armenian_cha1 = 16778617 const XK_Armenian_da1 = 16778596 const XK_Armenian_dza1 = 16778609 const XK_Armenian_e1 = 16778599 const XK_Armenian_exclam1 = 16778588 const XK_Armenian_fe1 = 16778630 const XK_Armenian_full_stop1 = 16778633 const XK_Armenian_ghat1 = 16778610 const XK_Armenian_gim1 = 16778595 const XK_Armenian_hi1 = 16778613 const XK_Armenian_ho1 = 16778608 const XK_Armenian_hyphen1 = 16778634 const XK_Armenian_ini1 = 16778603 const XK_Armenian_je1 = 16778619 const XK_Armenian_ke1 = 16778628 const XK_Armenian_ken1 = 16778607 const XK_Armenian_khe1 = 16778605 const XK_Armenian_ligature_ew1 = 16778631 const XK_Armenian_lyun1 = 16778604 const XK_Armenian_men1 = 16778612 const XK_Armenian_nu1 = 16778614 const XK_Armenian_o1 = 16778629 const XK_Armenian_paruyk1 = 16778590 const XK_Armenian_pe1 = 16778618 const XK_Armenian_pyur1 = 16778627 const XK_Armenian_question1 = 16778590 const XK_Armenian_ra1 = 16778620 const XK_Armenian_re1 = 16778624 const XK_Armenian_se1 = 16778621 const XK_Armenian_separation_mark1 = 16778589 const XK_Armenian_sha1 = 16778615 const XK_Armenian_shesht1 = 16778587 const XK_Armenian_tche1 = 16778611 const XK_Armenian_to1 = 16778601 const XK_Armenian_tsa1 = 16778606 const XK_Armenian_tso1 = 16778625 const XK_Armenian_tyun1 = 16778623 const XK_Armenian_verjaket1 = 16778633 const XK_Armenian_vev1 = 16778622 const XK_Armenian_vo1 = 16778616 const XK_Armenian_vyun1 = 16778626 const XK_Armenian_yech1 = 16778597 const XK_Armenian_yentamna1 = 16778634 const XK_Armenian_za1 = 16778598 const XK_Armenian_zhe1 = 16778602 const XK_Atilde1 = 195 const XK_AudibleBell_Enable1 = 65146 const XK_B1 = 66 const XK_Babovedot1 = 16784898 const XK_BackSpace1 = 65288 const XK_Begin1 = 65368 const XK_BounceKeys_Enable1 = 65140 const XK_Break1 = 65387 const XK_Byelorussian_SHORTU1 = 1726 const XK_Byelorussian_shortu1 = 1710 const XK_C1 = 67 const XK_CH1 = 65186 const XK_C_H1 = 65189 const XK_C_h1 = 65188 const XK_Cabovedot1 = 709 const XK_Cacute1 = 454 const XK_Cancel1 = 65385 const XK_Caps_Lock1 = 65509 const XK_Ccaron1 = 456 const XK_Ccedilla1 = 199 const XK_Ccircumflex1 = 710 const XK_Ch1 = 65185 const XK_Clear1 = 65291 const XK_Codeinput1 = 65335 const XK_ColonSign1 = 16785569 const XK_Control_L1 = 65507 const XK_Control_R1 = 65508 const XK_CruzeiroSign1 = 16785570 const XK_Cyrillic_A1 = 1761 const XK_Cyrillic_BE1 = 1762 const XK_Cyrillic_CHE1 = 1790 const XK_Cyrillic_CHE_descender1 = 16778422 const XK_Cyrillic_CHE_vertstroke1 = 16778424 const XK_Cyrillic_DE1 = 1764 const XK_Cyrillic_DZHE1 = 1727 const XK_Cyrillic_E1 = 1788 const XK_Cyrillic_EF1 = 1766 const XK_Cyrillic_EL1 = 1772 const XK_Cyrillic_EM1 = 1773 const XK_Cyrillic_EN1 = 1774 const XK_Cyrillic_EN_descender1 = 16778402 const XK_Cyrillic_ER1 = 1778 const XK_Cyrillic_ES1 = 1779 const XK_Cyrillic_GHE1 = 1767 const XK_Cyrillic_GHE_bar1 = 16778386 const XK_Cyrillic_HA1 = 1768 const XK_Cyrillic_HARDSIGN1 = 1791 const XK_Cyrillic_HA_descender1 = 16778418 const XK_Cyrillic_I1 = 1769 const XK_Cyrillic_IE1 = 1765 const XK_Cyrillic_IO1 = 1715 const XK_Cyrillic_I_macron1 = 16778466 const XK_Cyrillic_JE1 = 1720 const XK_Cyrillic_KA1 = 1771 const XK_Cyrillic_KA_descender1 = 16778394 const XK_Cyrillic_KA_vertstroke1 = 16778396 const XK_Cyrillic_LJE1 = 1721 const XK_Cyrillic_NJE1 = 1722 const XK_Cyrillic_O1 = 1775 const XK_Cyrillic_O_bar1 = 16778472 const XK_Cyrillic_PE1 = 1776 const XK_Cyrillic_SCHWA1 = 16778456 const XK_Cyrillic_SHA1 = 1787 const XK_Cyrillic_SHCHA1 = 1789 const XK_Cyrillic_SHHA1 = 16778426 const XK_Cyrillic_SHORTI1 = 1770 const XK_Cyrillic_SOFTSIGN1 = 1784 const XK_Cyrillic_TE1 = 1780 const XK_Cyrillic_TSE1 = 1763 const XK_Cyrillic_U1 = 1781 const XK_Cyrillic_U_macron1 = 16778478 const XK_Cyrillic_U_straight1 = 16778414 const XK_Cyrillic_U_straight_bar1 = 16778416 const XK_Cyrillic_VE1 = 1783 const XK_Cyrillic_YA1 = 1777 const XK_Cyrillic_YERU1 = 1785 const XK_Cyrillic_YU1 = 1760 const XK_Cyrillic_ZE1 = 1786 const XK_Cyrillic_ZHE1 = 1782 const XK_Cyrillic_ZHE_descender1 = 16778390 const XK_Cyrillic_a1 = 1729 const XK_Cyrillic_be1 = 1730 const XK_Cyrillic_che1 = 1758 const XK_Cyrillic_che_descender1 = 16778423 const XK_Cyrillic_che_vertstroke1 = 16778425 const XK_Cyrillic_de1 = 1732 const XK_Cyrillic_dzhe1 = 1711 const XK_Cyrillic_e1 = 1756 const XK_Cyrillic_ef1 = 1734 const XK_Cyrillic_el1 = 1740 const XK_Cyrillic_em1 = 1741 const XK_Cyrillic_en1 = 1742 const XK_Cyrillic_en_descender1 = 16778403 const XK_Cyrillic_er1 = 1746 const XK_Cyrillic_es1 = 1747 const XK_Cyrillic_ghe1 = 1735 const XK_Cyrillic_ghe_bar1 = 16778387 const XK_Cyrillic_ha1 = 1736 const XK_Cyrillic_ha_descender1 = 16778419 const XK_Cyrillic_hardsign1 = 1759 const XK_Cyrillic_i1 = 1737 const XK_Cyrillic_i_macron1 = 16778467 const XK_Cyrillic_ie1 = 1733 const XK_Cyrillic_io1 = 1699 const XK_Cyrillic_je1 = 1704 const XK_Cyrillic_ka1 = 1739 const XK_Cyrillic_ka_descender1 = 16778395 const XK_Cyrillic_ka_vertstroke1 = 16778397 const XK_Cyrillic_lje1 = 1705 const XK_Cyrillic_nje1 = 1706 const XK_Cyrillic_o1 = 1743 const XK_Cyrillic_o_bar1 = 16778473 const XK_Cyrillic_pe1 = 1744 const XK_Cyrillic_schwa1 = 16778457 const XK_Cyrillic_sha1 = 1755 const XK_Cyrillic_shcha1 = 1757 const XK_Cyrillic_shha1 = 16778427 const XK_Cyrillic_shorti1 = 1738 const XK_Cyrillic_softsign1 = 1752 const XK_Cyrillic_te1 = 1748 const XK_Cyrillic_tse1 = 1731 const XK_Cyrillic_u1 = 1749 const XK_Cyrillic_u_macron1 = 16778479 const XK_Cyrillic_u_straight1 = 16778415 const XK_Cyrillic_u_straight_bar1 = 16778417 const XK_Cyrillic_ve1 = 1751 const XK_Cyrillic_ya1 = 1745 const XK_Cyrillic_yeru1 = 1753 const XK_Cyrillic_yu1 = 1728 const XK_Cyrillic_ze1 = 1754 const XK_Cyrillic_zhe1 = 1750 const XK_Cyrillic_zhe_descender1 = 16778391 const XK_D1 = 68 const XK_Dabovedot1 = 16784906 const XK_Dcaron1 = 463 const XK_Delete1 = 65535 const XK_DongSign1 = 16785579 const XK_Down1 = 65364 const XK_Dstroke1 = 464 const XK_E1 = 69 const XK_ENG1 = 957 const XK_ETH1 = 208 const XK_EZH1 = 16777655 const XK_Eabovedot1 = 972 const XK_Eacute1 = 201 const XK_Ebelowdot1 = 16785080 const XK_Ecaron1 = 460 const XK_Ecircumflex1 = 202 const XK_Ecircumflexacute1 = 16785086 const XK_Ecircumflexbelowdot1 = 16785094 const XK_Ecircumflexgrave1 = 16785088 const XK_Ecircumflexhook1 = 16785090 const XK_Ecircumflextilde1 = 16785092 const XK_EcuSign1 = 16785568 const XK_Ediaeresis1 = 203 const XK_Egrave1 = 200 const XK_Ehook1 = 16785082 const XK_Eisu_Shift1 = 65327 const XK_Eisu_toggle1 = 65328 const XK_Emacron1 = 938 const XK_End1 = 65367 const XK_Eogonek1 = 458 const XK_Escape1 = 65307 const XK_Eth1 = 208 const XK_Etilde1 = 16785084 const XK_EuroSign1 = 8364 const XK_Execute1 = 65378 const XK_F36 = 70 const XK_F110 = 65470 const XK_F101 = 65479 const XK_F111 = 65480 const XK_F121 = 65481 const XK_F131 = 65482 const XK_F141 = 65483 const XK_F151 = 65484 const XK_F161 = 65485 const XK_F171 = 65486 const XK_F181 = 65487 const XK_F191 = 65488 const XK_F210 = 65471 const XK_F201 = 65489 const XK_F211 = 65490 const XK_F221 = 65491 const XK_F231 = 65492 const XK_F241 = 65493 const XK_F251 = 65494 const XK_F261 = 65495 const XK_F271 = 65496 const XK_F281 = 65497 const XK_F291 = 65498 const XK_F37 = 65472 const XK_F301 = 65499 const XK_F311 = 65500 const XK_F321 = 65501 const XK_F331 = 65502 const XK_F341 = 65503 const XK_F351 = 65504 const XK_F41 = 65473 const XK_F51 = 65474 const XK_F61 = 65475 const XK_F71 = 65476 const XK_F81 = 65477 const XK_F91 = 65478 const XK_FFrancSign1 = 16785571 const XK_Fabovedot1 = 16784926 const XK_Farsi_01 = 16778992 const XK_Farsi_11 = 16778993 const XK_Farsi_21 = 16778994 const XK_Farsi_31 = 16778995 const XK_Farsi_41 = 16778996 const XK_Farsi_51 = 16778997 const XK_Farsi_61 = 16778998 const XK_Farsi_71 = 16778999 const XK_Farsi_81 = 16779000 const XK_Farsi_91 = 16779001 const XK_Farsi_yeh1 = 16778956 const XK_Find1 = 65384 const XK_First_Virtual_Screen1 = 65232 const XK_G1 = 71 const XK_Gabovedot1 = 725 const XK_Gbreve1 = 683 const XK_Gcaron1 = 16777702 const XK_Gcedilla1 = 939 const XK_Gcircumflex1 = 728 const XK_Georgian_an1 = 16781520 const XK_Georgian_ban1 = 16781521 const XK_Georgian_can1 = 16781546 const XK_Georgian_char1 = 16781549 const XK_Georgian_chin1 = 16781545 const XK_Georgian_cil1 = 16781548 const XK_Georgian_don1 = 16781523 const XK_Georgian_en1 = 16781524 const XK_Georgian_fi1 = 16781558 const XK_Georgian_gan1 = 16781522 const XK_Georgian_ghan1 = 16781542 const XK_Georgian_hae1 = 16781552 const XK_Georgian_har1 = 16781556 const XK_Georgian_he1 = 16781553 const XK_Georgian_hie1 = 16781554 const XK_Georgian_hoe1 = 16781557 const XK_Georgian_in1 = 16781528 const XK_Georgian_jhan1 = 16781551 const XK_Georgian_jil1 = 16781547 const XK_Georgian_kan1 = 16781529 const XK_Georgian_khar1 = 16781541 const XK_Georgian_las1 = 16781530 const XK_Georgian_man1 = 16781531 const XK_Georgian_nar1 = 16781532 const XK_Georgian_on1 = 16781533 const XK_Georgian_par1 = 16781534 const XK_Georgian_phar1 = 16781540 const XK_Georgian_qar1 = 16781543 const XK_Georgian_rae1 = 16781536 const XK_Georgian_san1 = 16781537 const XK_Georgian_shin1 = 16781544 const XK_Georgian_tan1 = 16781527 const XK_Georgian_tar1 = 16781538 const XK_Georgian_un1 = 16781539 const XK_Georgian_vin1 = 16781525 const XK_Georgian_we1 = 16781555 const XK_Georgian_xan1 = 16781550 const XK_Georgian_zen1 = 16781526 const XK_Georgian_zhar1 = 16781535 const XK_Greek_ALPHA1 = 1985 const XK_Greek_ALPHAaccent1 = 1953 const XK_Greek_BETA1 = 1986 const XK_Greek_CHI1 = 2007 const XK_Greek_DELTA1 = 1988 const XK_Greek_EPSILON1 = 1989 const XK_Greek_EPSILONaccent1 = 1954 const XK_Greek_ETA1 = 1991 const XK_Greek_ETAaccent1 = 1955 const XK_Greek_GAMMA1 = 1987 const XK_Greek_IOTA1 = 1993 const XK_Greek_IOTAaccent1 = 1956 const XK_Greek_IOTAdiaeresis1 = 1957 const XK_Greek_IOTAdieresis1 = 1957 const XK_Greek_KAPPA1 = 1994 const XK_Greek_LAMBDA1 = 1995 const XK_Greek_LAMDA1 = 1995 const XK_Greek_MU1 = 1996 const XK_Greek_NU1 = 1997 const XK_Greek_OMEGA1 = 2009 const XK_Greek_OMEGAaccent1 = 1963 const XK_Greek_OMICRON1 = 1999 const XK_Greek_OMICRONaccent1 = 1959 const XK_Greek_PHI1 = 2006 const XK_Greek_PI1 = 2000 const XK_Greek_PSI1 = 2008 const XK_Greek_RHO1 = 2001 const XK_Greek_SIGMA1 = 2002 const XK_Greek_TAU1 = 2004 const XK_Greek_THETA1 = 1992 const XK_Greek_UPSILON1 = 2005 const XK_Greek_UPSILONaccent1 = 1960 const XK_Greek_UPSILONdieresis1 = 1961 const XK_Greek_XI1 = 1998 const XK_Greek_ZETA1 = 1990 const XK_Greek_accentdieresis1 = 1966 const XK_Greek_alpha1 = 2017 const XK_Greek_alphaaccent1 = 1969 const XK_Greek_beta1 = 2018 const XK_Greek_chi1 = 2039 const XK_Greek_delta1 = 2020 const XK_Greek_epsilon1 = 2021 const XK_Greek_epsilonaccent1 = 1970 const XK_Greek_eta1 = 2023 const XK_Greek_etaaccent1 = 1971 const XK_Greek_finalsmallsigma1 = 2035 const XK_Greek_gamma1 = 2019 const XK_Greek_horizbar1 = 1967 const XK_Greek_iota1 = 2025 const XK_Greek_iotaaccent1 = 1972 const XK_Greek_iotaaccentdieresis1 = 1974 const XK_Greek_iotadieresis1 = 1973 const XK_Greek_kappa1 = 2026 const XK_Greek_lambda1 = 2027 const XK_Greek_lamda1 = 2027 const XK_Greek_mu1 = 2028 const XK_Greek_nu1 = 2029 const XK_Greek_omega1 = 2041 const XK_Greek_omegaaccent1 = 1979 const XK_Greek_omicron1 = 2031 const XK_Greek_omicronaccent1 = 1975 const XK_Greek_phi1 = 2038 const XK_Greek_pi1 = 2032 const XK_Greek_psi1 = 2040 const XK_Greek_rho1 = 2033 const XK_Greek_sigma1 = 2034 const XK_Greek_switch1 = 65406 const XK_Greek_tau1 = 2036 const XK_Greek_theta1 = 2024 const XK_Greek_upsilon1 = 2037 const XK_Greek_upsilonaccent1 = 1976 const XK_Greek_upsilonaccentdieresis1 = 1978 const XK_Greek_upsilondieresis1 = 1977 const XK_Greek_xi1 = 2030 const XK_Greek_zeta1 = 2022 const XK_H1 = 72 const XK_Hangul1 = 65329 const XK_Hangul_A1 = 3775 const XK_Hangul_AE1 = 3776 const XK_Hangul_AraeA1 = 3830 const XK_Hangul_AraeAE1 = 3831 const XK_Hangul_Banja1 = 65337 const XK_Hangul_Cieuc1 = 3770 const XK_Hangul_Codeinput1 = 65335 const XK_Hangul_Dikeud1 = 3751 const XK_Hangul_E1 = 3780 const XK_Hangul_EO1 = 3779 const XK_Hangul_EU1 = 3793 const XK_Hangul_End1 = 65331 const XK_Hangul_Hanja1 = 65332 const XK_Hangul_Hieuh1 = 3774 const XK_Hangul_I1 = 3795 const XK_Hangul_Ieung1 = 3767 const XK_Hangul_J_Cieuc1 = 3818 const XK_Hangul_J_Dikeud1 = 3802 const XK_Hangul_J_Hieuh1 = 3822 const XK_Hangul_J_Ieung1 = 3816 const XK_Hangul_J_Jieuj1 = 3817 const XK_Hangul_J_Khieuq1 = 3819 const XK_Hangul_J_Kiyeog1 = 3796 const XK_Hangul_J_KiyeogSios1 = 3798 const XK_Hangul_J_KkogjiDalrinIeung1 = 3833 const XK_Hangul_J_Mieum1 = 3811 const XK_Hangul_J_Nieun1 = 3799 const XK_Hangul_J_NieunHieuh1 = 3801 const XK_Hangul_J_NieunJieuj1 = 3800 const XK_Hangul_J_PanSios1 = 3832 const XK_Hangul_J_Phieuf1 = 3821 const XK_Hangul_J_Pieub1 = 3812 const XK_Hangul_J_PieubSios1 = 3813 const XK_Hangul_J_Rieul1 = 3803 const XK_Hangul_J_RieulHieuh1 = 3810 const XK_Hangul_J_RieulKiyeog1 = 3804 const XK_Hangul_J_RieulMieum1 = 3805 const XK_Hangul_J_RieulPhieuf1 = 3809 const XK_Hangul_J_RieulPieub1 = 3806 const XK_Hangul_J_RieulSios1 = 3807 const XK_Hangul_J_RieulTieut1 = 3808 const XK_Hangul_J_Sios1 = 3814 const XK_Hangul_J_SsangKiyeog1 = 3797 const XK_Hangul_J_SsangSios1 = 3815 const XK_Hangul_J_Tieut1 = 3820 const XK_Hangul_J_YeorinHieuh1 = 3834 const XK_Hangul_Jamo1 = 65333 const XK_Hangul_Jeonja1 = 65336 const XK_Hangul_Jieuj1 = 3768 const XK_Hangul_Khieuq1 = 3771 const XK_Hangul_Kiyeog1 = 3745 const XK_Hangul_KiyeogSios1 = 3747 const XK_Hangul_KkogjiDalrinIeung1 = 3827 const XK_Hangul_Mieum1 = 3761 const XK_Hangul_MultipleCandidate1 = 65341 const XK_Hangul_Nieun1 = 3748 const XK_Hangul_NieunHieuh1 = 3750 const XK_Hangul_NieunJieuj1 = 3749 const XK_Hangul_O1 = 3783 const XK_Hangul_OE1 = 3786 const XK_Hangul_PanSios1 = 3826 const XK_Hangul_Phieuf1 = 3773 const XK_Hangul_Pieub1 = 3762 const XK_Hangul_PieubSios1 = 3764 const XK_Hangul_PostHanja1 = 65339 const XK_Hangul_PreHanja1 = 65338 const XK_Hangul_PreviousCandidate1 = 65342 const XK_Hangul_Rieul1 = 3753 const XK_Hangul_RieulHieuh1 = 3760 const XK_Hangul_RieulKiyeog1 = 3754 const XK_Hangul_RieulMieum1 = 3755 const XK_Hangul_RieulPhieuf1 = 3759 const XK_Hangul_RieulPieub1 = 3756 const XK_Hangul_RieulSios1 = 3757 const XK_Hangul_RieulTieut1 = 3758 const XK_Hangul_RieulYeorinHieuh1 = 3823 const XK_Hangul_Romaja1 = 65334 const XK_Hangul_SingleCandidate1 = 65340 const XK_Hangul_Sios1 = 3765 const XK_Hangul_Special1 = 65343 const XK_Hangul_SsangDikeud1 = 3752 const XK_Hangul_SsangJieuj1 = 3769 const XK_Hangul_SsangKiyeog1 = 3746 const XK_Hangul_SsangPieub1 = 3763 const XK_Hangul_SsangSios1 = 3766 const XK_Hangul_Start1 = 65330 const XK_Hangul_SunkyeongeumMieum1 = 3824 const XK_Hangul_SunkyeongeumPhieuf1 = 3828 const XK_Hangul_SunkyeongeumPieub1 = 3825 const XK_Hangul_Tieut1 = 3772 const XK_Hangul_U1 = 3788 const XK_Hangul_WA1 = 3784 const XK_Hangul_WAE1 = 3785 const XK_Hangul_WE1 = 3790 const XK_Hangul_WEO1 = 3789 const XK_Hangul_WI1 = 3791 const XK_Hangul_YA1 = 3777 const XK_Hangul_YAE1 = 3778 const XK_Hangul_YE1 = 3782 const XK_Hangul_YEO1 = 3781 const XK_Hangul_YI1 = 3794 const XK_Hangul_YO1 = 3787 const XK_Hangul_YU1 = 3792 const XK_Hangul_YeorinHieuh1 = 3829 const XK_Hangul_switch1 = 65406 const XK_Hankaku1 = 65321 const XK_Hcircumflex1 = 678 const XK_Hebrew_switch1 = 65406 const XK_Help1 = 65386 const XK_Henkan1 = 65315 const XK_Henkan_Mode1 = 65315 const XK_Hiragana1 = 65317 const XK_Hiragana_Katakana1 = 65319 const XK_Home1 = 65360 const XK_Hstroke1 = 673 const XK_Hyper_L1 = 65517 const XK_Hyper_R1 = 65518 const XK_I1 = 73 const XK_ISO_Center_Object1 = 65075 const XK_ISO_Continuous_Underline1 = 65072 const XK_ISO_Discontinuous_Underline1 = 65073 const XK_ISO_Emphasize1 = 65074 const XK_ISO_Enter1 = 65076 const XK_ISO_Fast_Cursor_Down1 = 65071 const XK_ISO_Fast_Cursor_Left1 = 65068 const XK_ISO_Fast_Cursor_Right1 = 65069 const XK_ISO_Fast_Cursor_Up1 = 65070 const XK_ISO_First_Group1 = 65036 const XK_ISO_First_Group_Lock1 = 65037 const XK_ISO_Group_Latch1 = 65030 const XK_ISO_Group_Lock1 = 65031 const XK_ISO_Group_Shift1 = 65406 const XK_ISO_Last_Group1 = 65038 const XK_ISO_Last_Group_Lock1 = 65039 const XK_ISO_Left_Tab1 = 65056 const XK_ISO_Level2_Latch1 = 65026 const XK_ISO_Level3_Latch1 = 65028 const XK_ISO_Level3_Lock1 = 65029 const XK_ISO_Level3_Shift1 = 65027 const XK_ISO_Level5_Latch1 = 65042 const XK_ISO_Level5_Lock1 = 65043 const XK_ISO_Level5_Shift1 = 65041 const XK_ISO_Lock1 = 65025 const XK_ISO_Move_Line_Down1 = 65058 const XK_ISO_Move_Line_Up1 = 65057 const XK_ISO_Next_Group1 = 65032 const XK_ISO_Next_Group_Lock1 = 65033 const XK_ISO_Partial_Line_Down1 = 65060 const XK_ISO_Partial_Line_Up1 = 65059 const XK_ISO_Partial_Space_Left1 = 65061 const XK_ISO_Partial_Space_Right1 = 65062 const XK_ISO_Prev_Group1 = 65034 const XK_ISO_Prev_Group_Lock1 = 65035 const XK_ISO_Release_Both_Margins1 = 65067 const XK_ISO_Release_Margin_Left1 = 65065 const XK_ISO_Release_Margin_Right1 = 65066 const XK_ISO_Set_Margin_Left1 = 65063 const XK_ISO_Set_Margin_Right1 = 65064 const XK_Iabovedot1 = 681 const XK_Iacute1 = 205 const XK_Ibelowdot1 = 16785098 const XK_Ibreve1 = 16777516 const XK_Icircumflex1 = 206 const XK_Idiaeresis1 = 207 const XK_Igrave1 = 204 const XK_Ihook1 = 16785096 const XK_Imacron1 = 975 const XK_Insert1 = 65379 const XK_Iogonek1 = 967 const XK_Itilde1 = 933 const XK_J1 = 74 const XK_Jcircumflex1 = 684 const XK_K1 = 75 const XK_KP_01 = 65456 const XK_KP_11 = 65457 const XK_KP_21 = 65458 const XK_KP_31 = 65459 const XK_KP_41 = 65460 const XK_KP_51 = 65461 const XK_KP_61 = 65462 const XK_KP_71 = 65463 const XK_KP_81 = 65464 const XK_KP_91 = 65465 const XK_KP_Add1 = 65451 const XK_KP_Begin1 = 65437 const XK_KP_Decimal1 = 65454 const XK_KP_Delete1 = 65439 const XK_KP_Divide1 = 65455 const XK_KP_Down1 = 65433 const XK_KP_End1 = 65436 const XK_KP_Enter1 = 65421 const XK_KP_Equal1 = 65469 const XK_KP_F11 = 65425 const XK_KP_F21 = 65426 const XK_KP_F31 = 65427 const XK_KP_F41 = 65428 const XK_KP_Home1 = 65429 const XK_KP_Insert1 = 65438 const XK_KP_Left1 = 65430 const XK_KP_Multiply1 = 65450 const XK_KP_Next1 = 65435 const XK_KP_Page_Down1 = 65435 const XK_KP_Page_Up1 = 65434 const XK_KP_Prior1 = 65434 const XK_KP_Right1 = 65432 const XK_KP_Separator1 = 65452 const XK_KP_Space1 = 65408 const XK_KP_Subtract1 = 65453 const XK_KP_Tab1 = 65417 const XK_KP_Up1 = 65431 const XK_Kana_Lock1 = 65325 const XK_Kana_Shift1 = 65326 const XK_Kanji1 = 65313 const XK_Kanji_Bangou1 = 65335 const XK_Katakana1 = 65318 const XK_Kcedilla1 = 979 const XK_Korean_Won1 = 3839 const XK_L11 = 76 const XK_L12 = 65480 const XK_L101 = 65489 const XK_L21 = 65481 const XK_L31 = 65482 const XK_L41 = 65483 const XK_L51 = 65484 const XK_L61 = 65485 const XK_L71 = 65486 const XK_L81 = 65487 const XK_L91 = 65488 const XK_Lacute1 = 453 const XK_Last_Virtual_Screen1 = 65236 const XK_Lbelowdot1 = 16784950 const XK_Lcaron1 = 421 const XK_Lcedilla1 = 934 const XK_Left1 = 65361 const XK_Linefeed1 = 65290 const XK_LiraSign1 = 16785572 const XK_Lstroke1 = 419 const XK_M1 = 77 const XK_Mabovedot1 = 16784960 const XK_Macedonia_DSE1 = 1717 const XK_Macedonia_GJE1 = 1714 const XK_Macedonia_KJE1 = 1724 const XK_Macedonia_dse1 = 1701 const XK_Macedonia_gje1 = 1698 const XK_Macedonia_kje1 = 1708 const XK_Mae_Koho1 = 65342 const XK_Massyo1 = 65324 const XK_Menu1 = 65383 const XK_Meta_L1 = 65511 const XK_Meta_R1 = 65512 const XK_MillSign1 = 16785573 const XK_Mode_switch1 = 65406 const XK_MouseKeys_Accel_Enable1 = 65143 const XK_MouseKeys_Enable1 = 65142 const XK_Muhenkan1 = 65314 const XK_Multi_key1 = 65312 const XK_MultipleCandidate1 = 65341 const XK_N1 = 78 const XK_Nacute1 = 465 const XK_NairaSign1 = 16785574 const XK_Ncaron1 = 466 const XK_Ncedilla1 = 977 const XK_NewSheqelSign1 = 16785578 const XK_Next1 = 65366 const XK_Next_Virtual_Screen1 = 65234 const XK_Ntilde1 = 209 const XK_Num_Lock1 = 65407 const XK_O1 = 79 const XK_OE1 = 5052 const XK_Oacute1 = 211 const XK_Obarred1 = 16777631 const XK_Obelowdot1 = 16785100 const XK_Ocaron1 = 16777681 const XK_Ocircumflex1 = 212 const XK_Ocircumflexacute1 = 16785104 const XK_Ocircumflexbelowdot1 = 16785112 const XK_Ocircumflexgrave1 = 16785106 const XK_Ocircumflexhook1 = 16785108 const XK_Ocircumflextilde1 = 16785110 const XK_Odiaeresis1 = 214 const XK_Odoubleacute1 = 469 const XK_Ograve1 = 210 const XK_Ohook1 = 16785102 const XK_Ohorn1 = 16777632 const XK_Ohornacute1 = 16785114 const XK_Ohornbelowdot1 = 16785122 const XK_Ohorngrave1 = 16785116 const XK_Ohornhook1 = 16785118 const XK_Ohorntilde1 = 16785120 const XK_Omacron1 = 978 const XK_Ooblique1 = 216 const XK_Oslash1 = 216 const XK_Otilde1 = 213 const XK_Overlay1_Enable1 = 65144 const XK_Overlay2_Enable1 = 65145 const XK_P1 = 80 const XK_Pabovedot1 = 16784982 const XK_Page_Down1 = 65366 const XK_Page_Up1 = 65365 const XK_Pause1 = 65299 const XK_PesetaSign1 = 16785575 const XK_Pointer_Accelerate1 = 65274 const XK_Pointer_Button11 = 65257 const XK_Pointer_Button21 = 65258 const XK_Pointer_Button31 = 65259 const XK_Pointer_Button41 = 65260 const XK_Pointer_Button51 = 65261 const XK_Pointer_Button_Dflt1 = 65256 const XK_Pointer_DblClick11 = 65263 const XK_Pointer_DblClick21 = 65264 const XK_Pointer_DblClick31 = 65265 const XK_Pointer_DblClick41 = 65266 const XK_Pointer_DblClick51 = 65267 const XK_Pointer_DblClick_Dflt1 = 65262 const XK_Pointer_DfltBtnNext1 = 65275 const XK_Pointer_DfltBtnPrev1 = 65276 const XK_Pointer_Down1 = 65251 const XK_Pointer_DownLeft1 = 65254 const XK_Pointer_DownRight1 = 65255 const XK_Pointer_Drag11 = 65269 const XK_Pointer_Drag21 = 65270 const XK_Pointer_Drag31 = 65271 const XK_Pointer_Drag41 = 65272 const XK_Pointer_Drag51 = 65277 const XK_Pointer_Drag_Dflt1 = 65268 const XK_Pointer_EnableKeys1 = 65273 const XK_Pointer_Left1 = 65248 const XK_Pointer_Right1 = 65249 const XK_Pointer_Up1 = 65250 const XK_Pointer_UpLeft1 = 65252 const XK_Pointer_UpRight1 = 65253 const XK_Prev_Virtual_Screen1 = 65233 const XK_PreviousCandidate1 = 65342 const XK_Print1 = 65377 const XK_Prior1 = 65365 const XK_Q1 = 81 const XK_R16 = 82 const XK_R17 = 65490 const XK_R101 = 65499 const XK_R111 = 65500 const XK_R121 = 65501 const XK_R131 = 65502 const XK_R141 = 65503 const XK_R151 = 65504 const XK_R21 = 65491 const XK_R31 = 65492 const XK_R41 = 65493 const XK_R51 = 65494 const XK_R61 = 65495 const XK_R71 = 65496 const XK_R81 = 65497 const XK_R91 = 65498 const XK_Racute1 = 448 const XK_Rcaron1 = 472 const XK_Rcedilla1 = 931 const XK_Redo1 = 65382 const XK_RepeatKeys_Enable1 = 65138 const XK_Return1 = 65293 const XK_Right1 = 65363 const XK_Romaji1 = 65316 const XK_RupeeSign1 = 16785576 const XK_S1 = 83 const XK_SCHWA1 = 16777615 const XK_Sabovedot1 = 16784992 const XK_Sacute1 = 422 const XK_Scaron1 = 425 const XK_Scedilla1 = 426 const XK_Scircumflex1 = 734 const XK_Scroll_Lock1 = 65300 const XK_Select1 = 65376 const XK_Serbian_DJE1 = 1713 const XK_Serbian_DZE1 = 1727 const XK_Serbian_JE1 = 1720 const XK_Serbian_LJE1 = 1721 const XK_Serbian_NJE1 = 1722 const XK_Serbian_TSHE1 = 1723 const XK_Serbian_dje1 = 1697 const XK_Serbian_dze1 = 1711 const XK_Serbian_je1 = 1704 const XK_Serbian_lje1 = 1705 const XK_Serbian_nje1 = 1706 const XK_Serbian_tshe1 = 1707 const XK_Shift_L1 = 65505 const XK_Shift_Lock1 = 65510 const XK_Shift_R1 = 65506 const XK_SingleCandidate1 = 65340 const XK_Sinh_a1 = 16780677 const XK_Sinh_aa1 = 16780678 const XK_Sinh_aa21 = 16780751 const XK_Sinh_ae1 = 16780679 const XK_Sinh_ae21 = 16780752 const XK_Sinh_aee1 = 16780680 const XK_Sinh_aee21 = 16780753 const XK_Sinh_ai1 = 16780691 const XK_Sinh_ai21 = 16780763 const XK_Sinh_al1 = 16780746 const XK_Sinh_au1 = 16780694 const XK_Sinh_au21 = 16780766 const XK_Sinh_ba1 = 16780726 const XK_Sinh_bha1 = 16780727 const XK_Sinh_ca1 = 16780704 const XK_Sinh_cha1 = 16780705 const XK_Sinh_dda1 = 16780713 const XK_Sinh_ddha1 = 16780714 const XK_Sinh_dha1 = 16780719 const XK_Sinh_dhha1 = 16780720 const XK_Sinh_e1 = 16780689 const XK_Sinh_e21 = 16780761 const XK_Sinh_ee1 = 16780690 const XK_Sinh_ee21 = 16780762 const XK_Sinh_fa1 = 16780742 const XK_Sinh_ga1 = 16780700 const XK_Sinh_gha1 = 16780701 const XK_Sinh_h21 = 16780675 const XK_Sinh_ha1 = 16780740 const XK_Sinh_i1 = 16780681 const XK_Sinh_i21 = 16780754 const XK_Sinh_ii1 = 16780682 const XK_Sinh_ii21 = 16780755 const XK_Sinh_ja1 = 16780706 const XK_Sinh_jha1 = 16780707 const XK_Sinh_jnya1 = 16780709 const XK_Sinh_ka1 = 16780698 const XK_Sinh_kha1 = 16780699 const XK_Sinh_kunddaliya1 = 16780788 const XK_Sinh_la1 = 16780733 const XK_Sinh_lla1 = 16780741 const XK_Sinh_lu1 = 16780687 const XK_Sinh_lu21 = 16780767 const XK_Sinh_luu1 = 16780688 const XK_Sinh_luu21 = 16780787 const XK_Sinh_ma1 = 16780728 const XK_Sinh_mba1 = 16780729 const XK_Sinh_na1 = 16780721 const XK_Sinh_ndda1 = 16780716 const XK_Sinh_ndha1 = 16780723 const XK_Sinh_ng1 = 16780674 const XK_Sinh_ng21 = 16780702 const XK_Sinh_nga1 = 16780703 const XK_Sinh_nja1 = 16780710 const XK_Sinh_nna1 = 16780715 const XK_Sinh_nya1 = 16780708 const XK_Sinh_o1 = 16780692 const XK_Sinh_o21 = 16780764 const XK_Sinh_oo1 = 16780693 const XK_Sinh_oo21 = 16780765 const XK_Sinh_pa1 = 16780724 const XK_Sinh_pha1 = 16780725 const XK_Sinh_ra1 = 16780731 const XK_Sinh_ri1 = 16780685 const XK_Sinh_rii1 = 16780686 const XK_Sinh_ru21 = 16780760 const XK_Sinh_ruu21 = 16780786 const XK_Sinh_sa1 = 16780739 const XK_Sinh_sha1 = 16780737 const XK_Sinh_ssha1 = 16780738 const XK_Sinh_tha1 = 16780717 const XK_Sinh_thha1 = 16780718 const XK_Sinh_tta1 = 16780711 const XK_Sinh_ttha1 = 16780712 const XK_Sinh_u1 = 16780683 const XK_Sinh_u21 = 16780756 const XK_Sinh_uu1 = 16780684 const XK_Sinh_uu21 = 16780758 const XK_Sinh_va1 = 16780736 const XK_Sinh_ya1 = 16780730 const XK_SlowKeys_Enable1 = 65139 const XK_StickyKeys_Enable1 = 65141 const XK_Super_L1 = 65515 const XK_Super_R1 = 65516 const XK_Sys_Req1 = 65301 const XK_T1 = 84 const XK_THORN1 = 222 const XK_Tab1 = 65289 const XK_Tabovedot1 = 16785002 const XK_Tcaron1 = 427 const XK_Tcedilla1 = 478 const XK_Terminate_Server1 = 65237 const XK_Thai_baht1 = 3551 const XK_Thai_bobaimai1 = 3514 const XK_Thai_chochan1 = 3496 const XK_Thai_chochang1 = 3498 const XK_Thai_choching1 = 3497 const XK_Thai_chochoe1 = 3500 const XK_Thai_dochada1 = 3502 const XK_Thai_dodek1 = 3508 const XK_Thai_fofa1 = 3517 const XK_Thai_fofan1 = 3519 const XK_Thai_hohip1 = 3531 const XK_Thai_honokhuk1 = 3534 const XK_Thai_khokhai1 = 3490 const XK_Thai_khokhon1 = 3493 const XK_Thai_khokhuat1 = 3491 const XK_Thai_khokhwai1 = 3492 const XK_Thai_khorakhang1 = 3494 const XK_Thai_kokai1 = 3489 const XK_Thai_lakkhangyao1 = 3557 const XK_Thai_lekchet1 = 3575 const XK_Thai_lekha1 = 3573 const XK_Thai_lekhok1 = 3574 const XK_Thai_lekkao1 = 3577 const XK_Thai_leknung1 = 3569 const XK_Thai_lekpaet1 = 3576 const XK_Thai_leksam1 = 3571 const XK_Thai_leksi1 = 3572 const XK_Thai_leksong1 = 3570 const XK_Thai_leksun1 = 3568 const XK_Thai_lochula1 = 3532 const XK_Thai_loling1 = 3525 const XK_Thai_lu1 = 3526 const XK_Thai_maichattawa1 = 3563 const XK_Thai_maiek1 = 3560 const XK_Thai_maihanakat1 = 3537 const XK_Thai_maihanakat_maitho1 = 3550 const XK_Thai_maitaikhu1 = 3559 const XK_Thai_maitho1 = 3561 const XK_Thai_maitri1 = 3562 const XK_Thai_maiyamok1 = 3558 const XK_Thai_moma1 = 3521 const XK_Thai_ngongu1 = 3495 const XK_Thai_nikhahit1 = 3565 const XK_Thai_nonen1 = 3507 const XK_Thai_nonu1 = 3513 const XK_Thai_oang1 = 3533 const XK_Thai_paiyannoi1 = 3535 const XK_Thai_phinthu1 = 3546 const XK_Thai_phophan1 = 3518 const XK_Thai_phophung1 = 3516 const XK_Thai_phosamphao1 = 3520 const XK_Thai_popla1 = 3515 const XK_Thai_rorua1 = 3523 const XK_Thai_ru1 = 3524 const XK_Thai_saraa1 = 3536 const XK_Thai_saraaa1 = 3538 const XK_Thai_saraae1 = 3553 const XK_Thai_saraaimaimalai1 = 3556 const XK_Thai_saraaimaimuan1 = 3555 const XK_Thai_saraam1 = 3539 const XK_Thai_sarae1 = 3552 const XK_Thai_sarai1 = 3540 const XK_Thai_saraii1 = 3541 const XK_Thai_sarao1 = 3554 const XK_Thai_sarau1 = 3544 const XK_Thai_saraue1 = 3542 const XK_Thai_sarauee1 = 3543 const XK_Thai_sarauu1 = 3545 const XK_Thai_sorusi1 = 3529 const XK_Thai_sosala1 = 3528 const XK_Thai_soso1 = 3499 const XK_Thai_sosua1 = 3530 const XK_Thai_thanthakhat1 = 3564 const XK_Thai_thonangmontho1 = 3505 const XK_Thai_thophuthao1 = 3506 const XK_Thai_thothahan1 = 3511 const XK_Thai_thothan1 = 3504 const XK_Thai_thothong1 = 3512 const XK_Thai_thothung1 = 3510 const XK_Thai_topatak1 = 3503 const XK_Thai_totao1 = 3509 const XK_Thai_wowaen1 = 3527 const XK_Thai_yoyak1 = 3522 const XK_Thai_yoying1 = 3501 const XK_Thorn1 = 222 const XK_Touroku1 = 65323 const XK_Tslash1 = 940 const XK_U1 = 85 const XK_Uacute1 = 218 const XK_Ubelowdot1 = 16785124 const XK_Ubreve1 = 733 const XK_Ucircumflex1 = 219 const XK_Udiaeresis1 = 220 const XK_Udoubleacute1 = 475 const XK_Ugrave1 = 217 const XK_Uhook1 = 16785126 const XK_Uhorn1 = 16777647 const XK_Uhornacute1 = 16785128 const XK_Uhornbelowdot1 = 16785136 const XK_Uhorngrave1 = 16785130 const XK_Uhornhook1 = 16785132 const XK_Uhorntilde1 = 16785134 const XK_Ukrainian_GHE_WITH_UPTURN1 = 1725 const XK_Ukrainian_I1 = 1718 const XK_Ukrainian_IE1 = 1716 const XK_Ukrainian_YI1 = 1719 const XK_Ukrainian_ghe_with_upturn1 = 1709 const XK_Ukrainian_i1 = 1702 const XK_Ukrainian_ie1 = 1700 const XK_Ukrainian_yi1 = 1703 const XK_Ukranian_I1 = 1718 const XK_Ukranian_JE1 = 1716 const XK_Ukranian_YI1 = 1719 const XK_Ukranian_i1 = 1702 const XK_Ukranian_je1 = 1700 const XK_Ukranian_yi1 = 1703 const XK_Umacron1 = 990 const XK_Undo1 = 65381 const XK_Uogonek1 = 985 const XK_Up1 = 65362 const XK_Uring1 = 473 const XK_Utilde1 = 989 const XK_V1 = 86 const XK_VoidSymbol1 = 16777215 const XK_W1 = 87 const XK_Wacute1 = 16785026 const XK_Wcircumflex1 = 16777588 const XK_Wdiaeresis1 = 16785028 const XK_Wgrave1 = 16785024 const XK_WonSign1 = 16785577 const XK_X1 = 88 const XK_Xabovedot1 = 16785034 const XK_Y1 = 89 const XK_Yacute1 = 221 const XK_Ybelowdot1 = 16785140 const XK_Ycircumflex1 = 16777590 const XK_Ydiaeresis1 = 5054 const XK_Ygrave1 = 16785138 const XK_Yhook1 = 16785142 const XK_Ytilde1 = 16785144 const XK_Z1 = 90 const XK_Zabovedot1 = 431 const XK_Zacute1 = 428 const XK_Zcaron1 = 430 const XK_Zen_Koho1 = 65341 const XK_Zenkaku1 = 65320 const XK_Zenkaku_Hankaku1 = 65322 const XK_Zstroke1 = 16777653 const XK_a1 = 97 const XK_aacute1 = 225 const XK_abelowdot1 = 16785057 const XK_abovedot1 = 511 const XK_abreve1 = 483 const XK_abreveacute1 = 16785071 const XK_abrevebelowdot1 = 16785079 const XK_abrevegrave1 = 16785073 const XK_abrevehook1 = 16785075 const XK_abrevetilde1 = 16785077 const XK_acircumflex1 = 226 const XK_acircumflexacute1 = 16785061 const XK_acircumflexbelowdot1 = 16785069 const XK_acircumflexgrave1 = 16785063 const XK_acircumflexhook1 = 16785065 const XK_acircumflextilde1 = 16785067 const XK_acute1 = 180 const XK_adiaeresis1 = 228 const XK_ae1 = 230 const XK_agrave1 = 224 const XK_ahook1 = 16785059 const XK_amacron1 = 992 const XK_ampersand1 = 38 const XK_aogonek1 = 433 const XK_apostrophe1 = 39 const XK_approxeq1 = 16785992 const XK_aring1 = 229 const XK_asciicircum1 = 94 const XK_asciitilde1 = 126 const XK_asterisk1 = 42 const XK_at1 = 64 const XK_atilde1 = 227 const XK_b1 = 98 const XK_babovedot1 = 16784899 const XK_backslash1 = 92 const XK_bar1 = 124 const XK_because1 = 16785973 const XK_braceleft1 = 123 const XK_braceright1 = 125 const XK_bracketleft1 = 91 const XK_bracketright1 = 93 const XK_braille_blank1 = 16787456 const XK_braille_dot_11 = 65521 const XK_braille_dot_101 = 65530 const XK_braille_dot_21 = 65522 const XK_braille_dot_31 = 65523 const XK_braille_dot_41 = 65524 const XK_braille_dot_51 = 65525 const XK_braille_dot_61 = 65526 const XK_braille_dot_71 = 65527 const XK_braille_dot_81 = 65528 const XK_braille_dot_91 = 65529 const XK_braille_dots_11 = 16787457 const XK_braille_dots_121 = 16787459 const XK_braille_dots_1231 = 16787463 const XK_braille_dots_12341 = 16787471 const XK_braille_dots_123451 = 16787487 const XK_braille_dots_1234561 = 16787519 const XK_braille_dots_12345671 = 16787583 const XK_braille_dots_123456781 = 16787711 const XK_braille_dots_12345681 = 16787647 const XK_braille_dots_1234571 = 16787551 const XK_braille_dots_12345781 = 16787679 const XK_braille_dots_1234581 = 16787615 const XK_braille_dots_123461 = 16787503 const XK_braille_dots_1234671 = 16787567 const XK_braille_dots_12346781 = 16787695 const XK_braille_dots_1234681 = 16787631 const XK_braille_dots_123471 = 16787535 const XK_braille_dots_1234781 = 16787663 const XK_braille_dots_123481 = 16787599 const XK_braille_dots_12351 = 16787479 const XK_braille_dots_123561 = 16787511 const XK_braille_dots_1235671 = 16787575 const XK_braille_dots_12356781 = 16787703 const XK_braille_dots_1235681 = 16787639 const XK_braille_dots_123571 = 16787543 const XK_braille_dots_1235781 = 16787671 const XK_braille_dots_123581 = 16787607 const XK_braille_dots_12361 = 16787495 const XK_braille_dots_123671 = 16787559 const XK_braille_dots_1236781 = 16787687 const XK_braille_dots_123681 = 16787623 const XK_braille_dots_12371 = 16787527 const XK_braille_dots_123781 = 16787655 const XK_braille_dots_12381 = 16787591 const XK_braille_dots_1241 = 16787467 const XK_braille_dots_12451 = 16787483 const XK_braille_dots_124561 = 16787515 const XK_braille_dots_1245671 = 16787579 const XK_braille_dots_12456781 = 16787707 const XK_braille_dots_1245681 = 16787643 const XK_braille_dots_124571 = 16787547 const XK_braille_dots_1245781 = 16787675 const XK_braille_dots_124581 = 16787611 const XK_braille_dots_12461 = 16787499 const XK_braille_dots_124671 = 16787563 const XK_braille_dots_1246781 = 16787691 const XK_braille_dots_124681 = 16787627 const XK_braille_dots_12471 = 16787531 const XK_braille_dots_124781 = 16787659 const XK_braille_dots_12481 = 16787595 const XK_braille_dots_1251 = 16787475 const XK_braille_dots_12561 = 16787507 const XK_braille_dots_125671 = 16787571 const XK_braille_dots_1256781 = 16787699 const XK_braille_dots_125681 = 16787635 const XK_braille_dots_12571 = 16787539 const XK_braille_dots_125781 = 16787667 const XK_braille_dots_12581 = 16787603 const XK_braille_dots_1261 = 16787491 const XK_braille_dots_12671 = 16787555 const XK_braille_dots_126781 = 16787683 const XK_braille_dots_12681 = 16787619 const XK_braille_dots_1271 = 16787523 const XK_braille_dots_12781 = 16787651 const XK_braille_dots_1281 = 16787587 const XK_braille_dots_131 = 16787461 const XK_braille_dots_1341 = 16787469 const XK_braille_dots_13451 = 16787485 const XK_braille_dots_134561 = 16787517 const XK_braille_dots_1345671 = 16787581 const XK_braille_dots_13456781 = 16787709 const XK_braille_dots_1345681 = 16787645 const XK_braille_dots_134571 = 16787549 const XK_braille_dots_1345781 = 16787677 const XK_braille_dots_134581 = 16787613 const XK_braille_dots_13461 = 16787501 const XK_braille_dots_134671 = 16787565 const XK_braille_dots_1346781 = 16787693 const XK_braille_dots_134681 = 16787629 const XK_braille_dots_13471 = 16787533 const XK_braille_dots_134781 = 16787661 const XK_braille_dots_13481 = 16787597 const XK_braille_dots_1351 = 16787477 const XK_braille_dots_13561 = 16787509 const XK_braille_dots_135671 = 16787573 const XK_braille_dots_1356781 = 16787701 const XK_braille_dots_135681 = 16787637 const XK_braille_dots_13571 = 16787541 const XK_braille_dots_135781 = 16787669 const XK_braille_dots_13581 = 16787605 const XK_braille_dots_1361 = 16787493 const XK_braille_dots_13671 = 16787557 const XK_braille_dots_136781 = 16787685 const XK_braille_dots_13681 = 16787621 const XK_braille_dots_1371 = 16787525 const XK_braille_dots_13781 = 16787653 const XK_braille_dots_1381 = 16787589 const XK_braille_dots_141 = 16787465 const XK_braille_dots_1451 = 16787481 const XK_braille_dots_14561 = 16787513 const XK_braille_dots_145671 = 16787577 const XK_braille_dots_1456781 = 16787705 const XK_braille_dots_145681 = 16787641 const XK_braille_dots_14571 = 16787545 const XK_braille_dots_145781 = 16787673 const XK_braille_dots_14581 = 16787609 const XK_braille_dots_1461 = 16787497 const XK_braille_dots_14671 = 16787561 const XK_braille_dots_146781 = 16787689 const XK_braille_dots_14681 = 16787625 const XK_braille_dots_1471 = 16787529 const XK_braille_dots_14781 = 16787657 const XK_braille_dots_1481 = 16787593 const XK_braille_dots_151 = 16787473 const XK_braille_dots_1561 = 16787505 const XK_braille_dots_15671 = 16787569 const XK_braille_dots_156781 = 16787697 const XK_braille_dots_15681 = 16787633 const XK_braille_dots_1571 = 16787537 const XK_braille_dots_15781 = 16787665 const XK_braille_dots_1581 = 16787601 const XK_braille_dots_161 = 16787489 const XK_braille_dots_1671 = 16787553 const XK_braille_dots_16781 = 16787681 const XK_braille_dots_1681 = 16787617 const XK_braille_dots_171 = 16787521 const XK_braille_dots_1781 = 16787649 const XK_braille_dots_181 = 16787585 const XK_braille_dots_21 = 16787458 const XK_braille_dots_231 = 16787462 const XK_braille_dots_2341 = 16787470 const XK_braille_dots_23451 = 16787486 const XK_braille_dots_234561 = 16787518 const XK_braille_dots_2345671 = 16787582 const XK_braille_dots_23456781 = 16787710 const XK_braille_dots_2345681 = 16787646 const XK_braille_dots_234571 = 16787550 const XK_braille_dots_2345781 = 16787678 const XK_braille_dots_234581 = 16787614 const XK_braille_dots_23461 = 16787502 const XK_braille_dots_234671 = 16787566 const XK_braille_dots_2346781 = 16787694 const XK_braille_dots_234681 = 16787630 const XK_braille_dots_23471 = 16787534 const XK_braille_dots_234781 = 16787662 const XK_braille_dots_23481 = 16787598 const XK_braille_dots_2351 = 16787478 const XK_braille_dots_23561 = 16787510 const XK_braille_dots_235671 = 16787574 const XK_braille_dots_2356781 = 16787702 const XK_braille_dots_235681 = 16787638 const XK_braille_dots_23571 = 16787542 const XK_braille_dots_235781 = 16787670 const XK_braille_dots_23581 = 16787606 const XK_braille_dots_2361 = 16787494 const XK_braille_dots_23671 = 16787558 const XK_braille_dots_236781 = 16787686 const XK_braille_dots_23681 = 16787622 const XK_braille_dots_2371 = 16787526 const XK_braille_dots_23781 = 16787654 const XK_braille_dots_2381 = 16787590 const XK_braille_dots_241 = 16787466 const XK_braille_dots_2451 = 16787482 const XK_braille_dots_24561 = 16787514 const XK_braille_dots_245671 = 16787578 const XK_braille_dots_2456781 = 16787706 const XK_braille_dots_245681 = 16787642 const XK_braille_dots_24571 = 16787546 const XK_braille_dots_245781 = 16787674 const XK_braille_dots_24581 = 16787610 const XK_braille_dots_2461 = 16787498 const XK_braille_dots_24671 = 16787562 const XK_braille_dots_246781 = 16787690 const XK_braille_dots_24681 = 16787626 const XK_braille_dots_2471 = 16787530 const XK_braille_dots_24781 = 16787658 const XK_braille_dots_2481 = 16787594 const XK_braille_dots_251 = 16787474 const XK_braille_dots_2561 = 16787506 const XK_braille_dots_25671 = 16787570 const XK_braille_dots_256781 = 16787698 const XK_braille_dots_25681 = 16787634 const XK_braille_dots_2571 = 16787538 const XK_braille_dots_25781 = 16787666 const XK_braille_dots_2581 = 16787602 const XK_braille_dots_261 = 16787490 const XK_braille_dots_2671 = 16787554 const XK_braille_dots_26781 = 16787682 const XK_braille_dots_2681 = 16787618 const XK_braille_dots_271 = 16787522 const XK_braille_dots_2781 = 16787650 const XK_braille_dots_281 = 16787586 const XK_braille_dots_31 = 16787460 const XK_braille_dots_341 = 16787468 const XK_braille_dots_3451 = 16787484 const XK_braille_dots_34561 = 16787516 const XK_braille_dots_345671 = 16787580 const XK_braille_dots_3456781 = 16787708 const XK_braille_dots_345681 = 16787644 const XK_braille_dots_34571 = 16787548 const XK_braille_dots_345781 = 16787676 const XK_braille_dots_34581 = 16787612 const XK_braille_dots_3461 = 16787500 const XK_braille_dots_34671 = 16787564 const XK_braille_dots_346781 = 16787692 const XK_braille_dots_34681 = 16787628 const XK_braille_dots_3471 = 16787532 const XK_braille_dots_34781 = 16787660 const XK_braille_dots_3481 = 16787596 const XK_braille_dots_351 = 16787476 const XK_braille_dots_3561 = 16787508 const XK_braille_dots_35671 = 16787572 const XK_braille_dots_356781 = 16787700 const XK_braille_dots_35681 = 16787636 const XK_braille_dots_3571 = 16787540 const XK_braille_dots_35781 = 16787668 const XK_braille_dots_3581 = 16787604 const XK_braille_dots_361 = 16787492 const XK_braille_dots_3671 = 16787556 const XK_braille_dots_36781 = 16787684 const XK_braille_dots_3681 = 16787620 const XK_braille_dots_371 = 16787524 const XK_braille_dots_3781 = 16787652 const XK_braille_dots_381 = 16787588 const XK_braille_dots_41 = 16787464 const XK_braille_dots_451 = 16787480 const XK_braille_dots_4561 = 16787512 const XK_braille_dots_45671 = 16787576 const XK_braille_dots_456781 = 16787704 const XK_braille_dots_45681 = 16787640 const XK_braille_dots_4571 = 16787544 const XK_braille_dots_45781 = 16787672 const XK_braille_dots_4581 = 16787608 const XK_braille_dots_461 = 16787496 const XK_braille_dots_4671 = 16787560 const XK_braille_dots_46781 = 16787688 const XK_braille_dots_4681 = 16787624 const XK_braille_dots_471 = 16787528 const XK_braille_dots_4781 = 16787656 const XK_braille_dots_481 = 16787592 const XK_braille_dots_51 = 16787472 const XK_braille_dots_561 = 16787504 const XK_braille_dots_5671 = 16787568 const XK_braille_dots_56781 = 16787696 const XK_braille_dots_5681 = 16787632 const XK_braille_dots_571 = 16787536 const XK_braille_dots_5781 = 16787664 const XK_braille_dots_581 = 16787600 const XK_braille_dots_61 = 16787488 const XK_braille_dots_671 = 16787552 const XK_braille_dots_6781 = 16787680 const XK_braille_dots_681 = 16787616 const XK_braille_dots_71 = 16787520 const XK_braille_dots_781 = 16787648 const XK_braille_dots_81 = 16787584 const XK_breve1 = 418 const XK_brokenbar1 = 166 const XK_c1 = 99 const XK_c_h1 = 65187 const XK_cabovedot1 = 741 const XK_cacute1 = 486 const XK_caron1 = 439 const XK_ccaron1 = 488 const XK_ccedilla1 = 231 const XK_ccircumflex1 = 742 const XK_cedilla1 = 184 const XK_cent1 = 162 const XK_ch1 = 65184 const XK_colon1 = 58 const XK_combining_acute1 = 16777985 const XK_combining_belowdot1 = 16778019 const XK_combining_grave1 = 16777984 const XK_combining_hook1 = 16777993 const XK_combining_tilde1 = 16777987 const XK_comma1 = 44 const XK_containsas1 = 16785931 const XK_copyright1 = 169 const XK_cuberoot1 = 16785947 const XK_currency1 = 164 const XK_d1 = 100 const XK_dabovedot1 = 16784907 const XK_dcaron1 = 495 const XK_dead_A1 = 65153 const XK_dead_E1 = 65155 const XK_dead_I1 = 65157 const XK_dead_O1 = 65159 const XK_dead_U1 = 65161 const XK_dead_a1 = 65152 const XK_dead_abovecomma1 = 65124 const XK_dead_abovedot1 = 65110 const XK_dead_abovereversedcomma1 = 65125 const XK_dead_abovering1 = 65112 const XK_dead_aboveverticalline1 = 65169 const XK_dead_acute1 = 65105 const XK_dead_belowbreve1 = 65131 const XK_dead_belowcircumflex1 = 65129 const XK_dead_belowcomma1 = 65134 const XK_dead_belowdiaeresis1 = 65132 const XK_dead_belowdot1 = 65120 const XK_dead_belowmacron1 = 65128 const XK_dead_belowring1 = 65127 const XK_dead_belowtilde1 = 65130 const XK_dead_belowverticalline1 = 65170 const XK_dead_breve1 = 65109 const XK_dead_capital_schwa1 = 65163 const XK_dead_caron1 = 65114 const XK_dead_cedilla1 = 65115 const XK_dead_circumflex1 = 65106 const XK_dead_currency1 = 65135 const XK_dead_dasia1 = 65125 const XK_dead_diaeresis1 = 65111 const XK_dead_doubleacute1 = 65113 const XK_dead_doublegrave1 = 65126 const XK_dead_e1 = 65154 const XK_dead_grave1 = 65104 const XK_dead_greek1 = 65164 const XK_dead_hook1 = 65121 const XK_dead_horn1 = 65122 const XK_dead_i1 = 65156 const XK_dead_invertedbreve1 = 65133 const XK_dead_iota1 = 65117 const XK_dead_longsolidusoverlay1 = 65171 const XK_dead_lowline1 = 65168 const XK_dead_macron1 = 65108 const XK_dead_o1 = 65158 const XK_dead_ogonek1 = 65116 const XK_dead_perispomeni1 = 65107 const XK_dead_psili1 = 65124 const XK_dead_semivoiced_sound1 = 65119 const XK_dead_small_schwa1 = 65162 const XK_dead_stroke1 = 65123 const XK_dead_tilde1 = 65107 const XK_dead_u1 = 65160 const XK_dead_voiced_sound1 = 65118 const XK_degree1 = 176 const XK_diaeresis1 = 168 const XK_dintegral1 = 16785964 const XK_division1 = 247 const XK_dollar1 = 36 const XK_doubleacute1 = 445 const XK_dstroke1 = 496 const XK_e1 = 101 const XK_eabovedot1 = 1004 const XK_eacute1 = 233 const XK_ebelowdot1 = 16785081 const XK_ecaron1 = 492 const XK_ecircumflex1 = 234 const XK_ecircumflexacute1 = 16785087 const XK_ecircumflexbelowdot1 = 16785095 const XK_ecircumflexgrave1 = 16785089 const XK_ecircumflexhook1 = 16785091 const XK_ecircumflextilde1 = 16785093 const XK_ediaeresis1 = 235 const XK_egrave1 = 232 const XK_ehook1 = 16785083 const XK_eightsubscript1 = 16785544 const XK_eightsuperior1 = 16785528 const XK_elementof1 = 16785928 const XK_emacron1 = 954 const XK_emptyset1 = 16785925 const XK_eng1 = 959 const XK_eogonek1 = 490 const XK_equal1 = 61 const XK_eth1 = 240 const XK_etilde1 = 16785085 const XK_exclam1 = 33 const XK_exclamdown1 = 161 const XK_ezh1 = 16777874 const XK_f1 = 102 const XK_fabovedot1 = 16784927 const XK_fivesubscript1 = 16785541 const XK_fivesuperior1 = 16785525 const XK_foursubscript1 = 16785540 const XK_foursuperior1 = 16785524 const XK_fourthroot1 = 16785948 const XK_g1 = 103 const XK_gabovedot1 = 757 const XK_gbreve1 = 699 const XK_gcaron1 = 16777703 const XK_gcedilla1 = 955 const XK_gcircumflex1 = 760 const XK_grave1 = 96 const XK_greater1 = 62 const XK_guillemotleft1 = 171 const XK_guillemotright1 = 187 const XK_h1 = 104 const XK_hcircumflex1 = 694 const XK_hebrew_aleph1 = 3296 const XK_hebrew_ayin1 = 3314 const XK_hebrew_bet1 = 3297 const XK_hebrew_beth1 = 3297 const XK_hebrew_chet1 = 3303 const XK_hebrew_dalet1 = 3299 const XK_hebrew_daleth1 = 3299 const XK_hebrew_doublelowline1 = 3295 const XK_hebrew_finalkaph1 = 3306 const XK_hebrew_finalmem1 = 3309 const XK_hebrew_finalnun1 = 3311 const XK_hebrew_finalpe1 = 3315 const XK_hebrew_finalzade1 = 3317 const XK_hebrew_finalzadi1 = 3317 const XK_hebrew_gimel1 = 3298 const XK_hebrew_gimmel1 = 3298 const XK_hebrew_he1 = 3300 const XK_hebrew_het1 = 3303 const XK_hebrew_kaph1 = 3307 const XK_hebrew_kuf1 = 3319 const XK_hebrew_lamed1 = 3308 const XK_hebrew_mem1 = 3310 const XK_hebrew_nun1 = 3312 const XK_hebrew_pe1 = 3316 const XK_hebrew_qoph1 = 3319 const XK_hebrew_resh1 = 3320 const XK_hebrew_samech1 = 3313 const XK_hebrew_samekh1 = 3313 const XK_hebrew_shin1 = 3321 const XK_hebrew_taf1 = 3322 const XK_hebrew_taw1 = 3322 const XK_hebrew_tet1 = 3304 const XK_hebrew_teth1 = 3304 const XK_hebrew_waw1 = 3301 const XK_hebrew_yod1 = 3305 const XK_hebrew_zade1 = 3318 const XK_hebrew_zadi1 = 3318 const XK_hebrew_zain1 = 3302 const XK_hebrew_zayin1 = 3302 const XK_hstroke1 = 689 const XK_hyphen1 = 173 const XK_i1 = 105 const XK_iacute1 = 237 const XK_ibelowdot1 = 16785099 const XK_ibreve1 = 16777517 const XK_icircumflex1 = 238 const XK_idiaeresis1 = 239 const XK_idotless1 = 697 const XK_igrave1 = 236 const XK_ihook1 = 16785097 const XK_imacron1 = 1007 const XK_iogonek1 = 999 const XK_itilde1 = 949 const XK_j1 = 106 const XK_jcircumflex1 = 700 const XK_k1 = 107 const XK_kana_A1 = 1201 const XK_kana_CHI1 = 1217 const XK_kana_E1 = 1204 const XK_kana_FU1 = 1228 const XK_kana_HA1 = 1226 const XK_kana_HE1 = 1229 const XK_kana_HI1 = 1227 const XK_kana_HO1 = 1230 const XK_kana_HU1 = 1228 const XK_kana_I1 = 1202 const XK_kana_KA1 = 1206 const XK_kana_KE1 = 1209 const XK_kana_KI1 = 1207 const XK_kana_KO1 = 1210 const XK_kana_KU1 = 1208 const XK_kana_MA1 = 1231 const XK_kana_ME1 = 1234 const XK_kana_MI1 = 1232 const XK_kana_MO1 = 1235 const XK_kana_MU1 = 1233 const XK_kana_N1 = 1245 const XK_kana_NA1 = 1221 const XK_kana_NE1 = 1224 const XK_kana_NI1 = 1222 const XK_kana_NO1 = 1225 const XK_kana_NU1 = 1223 const XK_kana_O1 = 1205 const XK_kana_RA1 = 1239 const XK_kana_RE1 = 1242 const XK_kana_RI1 = 1240 const XK_kana_RO1 = 1243 const XK_kana_RU1 = 1241 const XK_kana_SA1 = 1211 const XK_kana_SE1 = 1214 const XK_kana_SHI1 = 1212 const XK_kana_SO1 = 1215 const XK_kana_SU1 = 1213 const XK_kana_TA1 = 1216 const XK_kana_TE1 = 1219 const XK_kana_TI1 = 1217 const XK_kana_TO1 = 1220 const XK_kana_TSU1 = 1218 const XK_kana_TU1 = 1218 const XK_kana_U1 = 1203 const XK_kana_WA1 = 1244 const XK_kana_WO1 = 1190 const XK_kana_YA1 = 1236 const XK_kana_YO1 = 1238 const XK_kana_YU1 = 1237 const XK_kana_a1 = 1191 const XK_kana_closingbracket1 = 1187 const XK_kana_comma1 = 1188 const XK_kana_conjunctive1 = 1189 const XK_kana_e1 = 1194 const XK_kana_fullstop1 = 1185 const XK_kana_i1 = 1192 const XK_kana_middledot1 = 1189 const XK_kana_o1 = 1195 const XK_kana_openingbracket1 = 1186 const XK_kana_switch1 = 65406 const XK_kana_tsu1 = 1199 const XK_kana_tu1 = 1199 const XK_kana_u1 = 1193 const XK_kana_ya1 = 1196 const XK_kana_yo1 = 1198 const XK_kana_yu1 = 1197 const XK_kappa1 = 930 const XK_kcedilla1 = 1011 const XK_kra1 = 930 const XK_l1 = 108 const XK_lacute1 = 485 const XK_lbelowdot1 = 16784951 const XK_lcaron1 = 437 const XK_lcedilla1 = 950 const XK_less1 = 60 const XK_lstroke1 = 435 const XK_m1 = 109 const XK_mabovedot1 = 16784961 const XK_macron1 = 175 const XK_masculine1 = 186 const XK_minus1 = 45 const XK_mu1 = 181 const XK_multiply1 = 215 const XK_n1 = 110 const XK_nacute1 = 497 const XK_ncaron1 = 498 const XK_ncedilla1 = 1009 const XK_ninesubscript1 = 16785545 const XK_ninesuperior1 = 16785529 const XK_nobreakspace1 = 160 const XK_notapproxeq1 = 16785991 const XK_notelementof1 = 16785929 const XK_notidentical1 = 16786018 const XK_notsign1 = 172 const XK_ntilde1 = 241 const XK_numbersign1 = 35 const XK_numerosign1 = 1712 const XK_o1 = 111 const XK_oacute1 = 243 const XK_obarred1 = 16777845 const XK_obelowdot1 = 16785101 const XK_ocaron1 = 16777682 const XK_ocircumflex1 = 244 const XK_ocircumflexacute1 = 16785105 const XK_ocircumflexbelowdot1 = 16785113 const XK_ocircumflexgrave1 = 16785107 const XK_ocircumflexhook1 = 16785109 const XK_ocircumflextilde1 = 16785111 const XK_odiaeresis1 = 246 const XK_odoubleacute1 = 501 const XK_oe1 = 5053 const XK_ogonek1 = 434 const XK_ograve1 = 242 const XK_ohook1 = 16785103 const XK_ohorn1 = 16777633 const XK_ohornacute1 = 16785115 const XK_ohornbelowdot1 = 16785123 const XK_ohorngrave1 = 16785117 const XK_ohornhook1 = 16785119 const XK_ohorntilde1 = 16785121 const XK_omacron1 = 1010 const XK_onehalf1 = 189 const XK_onequarter1 = 188 const XK_onesubscript1 = 16785537 const XK_onesuperior1 = 185 const XK_ooblique1 = 248 const XK_ordfeminine1 = 170 const XK_oslash1 = 248 const XK_otilde1 = 245 const XK_overline1 = 1150 const XK_p1 = 112 const XK_pabovedot1 = 16784983 const XK_paragraph1 = 182 const XK_parenleft1 = 40 const XK_parenright1 = 41 const XK_partdifferential1 = 16785922 const XK_percent1 = 37 const XK_period1 = 46 const XK_periodcentered1 = 183 const XK_plus1 = 43 const XK_plusminus1 = 177 const XK_prolongedsound1 = 1200 const XK_q1 = 113 const XK_question1 = 63 const XK_questiondown1 = 191 const XK_quotedbl1 = 34 const XK_quoteleft1 = 96 const XK_quoteright1 = 39 const XK_r1 = 114 const XK_racute1 = 480 const XK_rcaron1 = 504 const XK_rcedilla1 = 947 const XK_registered1 = 174 const XK_s1 = 115 const XK_sabovedot1 = 16784993 const XK_sacute1 = 438 const XK_scaron1 = 441 const XK_scedilla1 = 442 const XK_schwa1 = 16777817 const XK_scircumflex1 = 766 const XK_script_switch1 = 65406 const XK_section1 = 167 const XK_semicolon1 = 59 const XK_semivoicedsound1 = 1247 const XK_sevensubscript1 = 16785543 const XK_sevensuperior1 = 16785527 const XK_sixsubscript1 = 16785542 const XK_sixsuperior1 = 16785526 const XK_slash1 = 47 const XK_space1 = 32 const XK_squareroot1 = 16785946 const XK_ssharp1 = 223 const XK_sterling1 = 163 const XK_stricteq1 = 16786019 const XK_t1 = 116 const XK_tabovedot1 = 16785003 const XK_tcaron1 = 443 const XK_tcedilla1 = 510 const XK_thorn1 = 254 const XK_threequarters1 = 190 const XK_threesubscript1 = 16785539 const XK_threesuperior1 = 179 const XK_tintegral1 = 16785965 const XK_tslash1 = 956 const XK_twosubscript1 = 16785538 const XK_twosuperior1 = 178 const XK_u1 = 117 const XK_uacute1 = 250 const XK_ubelowdot1 = 16785125 const XK_ubreve1 = 765 const XK_ucircumflex1 = 251 const XK_udiaeresis1 = 252 const XK_udoubleacute1 = 507 const XK_ugrave1 = 249 const XK_uhook1 = 16785127 const XK_uhorn1 = 16777648 const XK_uhornacute1 = 16785129 const XK_uhornbelowdot1 = 16785137 const XK_uhorngrave1 = 16785131 const XK_uhornhook1 = 16785133 const XK_uhorntilde1 = 16785135 const XK_umacron1 = 1022 const XK_underscore1 = 95 const XK_uogonek1 = 1017 const XK_uring1 = 505 const XK_utilde1 = 1021 const XK_v1 = 118 const XK_voicedsound1 = 1246 const XK_w1 = 119 const XK_wacute1 = 16785027 const XK_wcircumflex1 = 16777589 const XK_wdiaeresis1 = 16785029 const XK_wgrave1 = 16785025 const XK_x1 = 120 const XK_xabovedot1 = 16785035 const XK_y1 = 121 const XK_yacute1 = 253 const XK_ybelowdot1 = 16785141 const XK_ycircumflex1 = 16777591 const XK_ydiaeresis1 = 255 const XK_yen1 = 165 const XK_ygrave1 = 16785139 const XK_yhook1 = 16785143 const XK_ytilde1 = 16785145 const XK_z1 = 122 const XK_zabovedot1 = 447 const XK_zacute1 = 444 const XK_zcaron1 = 446 const XK_zerosubscript1 = 16785536 const XK_zerosuperior1 = 16785520 const XK_zstroke1 = 16777654 const XLocaleNotSupported = -2 const XNegative1 = 16 const XNoMemory = -1 const XUrgencyHint = 256 const XValue1 = 1 const XrmEnumAllLevels = 0 const XrmEnumOneLevel = 1 const YNegative1 = 32 const YValue1 = 2 const _X_INLINE1 = 0 const _X_RESTRICT_KYWD1 = 0 const _Xconst1 = 0 const __UNIX__ = 1 const c_class = 0 const static_assert1 = 0 type TXrmQuark = int32 type TXrmQuarkList = uintptr type TXrmString = uintptr type TXrmBinding = int32 const XrmBindTightly = 0 const XrmBindLoosely = 1 type TXrmBindingList = uintptr type TXrmName = int32 type TXrmNameList = uintptr type TXrmClass = int32 type TXrmClassList = uintptr type TXrmRepresentation = int32 type TXrmValue = struct { Fsize uint32 Faddr TXPointer } type TXrmValuePtr = uintptr type TXrmHashBucket = uintptr type TXrmHashTable = uintptr type TXrmDatabase = uintptr type TXrmOptionKind = int32 const XrmoptionNoArg = 0 const XrmoptionIsArg = 1 const XrmoptionStickyArg = 2 const XrmoptionSepArg = 3 const XrmoptionResArg = 4 const XrmoptionSkipArg = 5 const XrmoptionSkipLine = 6 const XrmoptionSkipNArgs = 7 type TXrmOptionDescRec = struct { Foption uintptr Fspecifier uintptr FargKind TXrmOptionKind Fvalue TXPointer } type TXrmOptionDescList = uintptr type TXAfterFunction = uintptr type TTkIntXlibStubs = struct { Fmagic int32 Fhooks uintptr } type TTkpCursor = uintptr type TTkBindInfo = uintptr type TTkBusy = uintptr type TTkCursor = struct { Fcursor TTk_Cursor Fdisplay uintptr FresourceRefCount TTcl_Size FobjRefCount TTcl_Size FotherTable uintptr FhashPtr uintptr FidHashPtr uintptr FnextPtr uintptr } type TTkCaret = struct { FwinPtr uintptr Fx int32 Fy int32 Fheight int32 } type TTkLockUsage = int32 type TkLockUsage = int32 const LU_IGNORE = 0 const LU_CAPS = 1 const LU_SHIFT = 2 type TTkDisplay = struct { Fdisplay uintptr FnextPtr uintptr Fname uintptr FlastEventTime TTime FborderInit int32 FborderTable TTcl_HashTable FatomInit int32 FnameTable TTcl_HashTable FatomTable TTcl_HashTable FbindInfoStale int32 FmodeModMask uint32 FmetaModMask uint32 FaltModMask uint32 FlockUsage TTkLockUsage FnumModKeyCodes TTcl_Size FmodKeyCodes uintptr FbitmapInit int32 FbitmapAutoNumber int32 FbitmapNameTable TTcl_HashTable FbitmapIdTable TTcl_HashTable FbitmapDataTable TTcl_HashTable FnumIdSearches int32 FnumSlowSearches int32 FcolorInit int32 FstressPtr uintptr FcolorNameTable TTcl_HashTable FcolorValueTable TTcl_HashTable FcursorInit int32 FcursorNameTable TTcl_HashTable FcursorDataTable TTcl_HashTable FcursorIdTable TTcl_HashTable FcursorString [20]uint8 FcursorFont TFont FerrorPtr uintptr FdeleteCount TTcl_Size FdelayedMotionPtr uintptr FfocusDebug int32 FimplicitWinPtr uintptr FfocusPtr uintptr FgcValueTable TTcl_HashTable FgcIdTable TTcl_HashTable FgcInit int32 FmaintainHashTable TTcl_HashTable FgeomInit int32 FuidTable TTcl_HashTable FuidInit int32 FgrabWinPtr uintptr FeventualGrabWinPtr uintptr FbuttonWinPtr uintptr FserverWinPtr uintptr FfirstGrabEventPtr uintptr FlastGrabEventPtr uintptr FgrabFlags int32 FgridInit int32 FgridHashTable TTcl_HashTable FimageId int32 FpostCommandGeneration int32 FpackInit int32 FpackerHashTable TTcl_HashTable FplaceInit int32 FcontainerTable TTcl_HashTable FcontentTable TTcl_HashTable FselectionInfoPtr uintptr FmultipleAtom TAtom FincrAtom TAtom FtargetsAtom TAtom FtimestampAtom TAtom FtextAtom TAtom FcompoundTextAtom TAtom FapplicationAtom TAtom FwindowAtom TAtom FclipboardAtom TAtom Futf8Atom TAtom FatomPairAtom TAtom FclipWindow TTk_Window FclipboardActive int32 FclipboardAppPtr uintptr FclipTargetPtr uintptr FcommTkwin TTk_Window FcommProperty TAtom FregistryProperty TAtom FappNameProperty TAtom FfirstWmPtr uintptr FforegroundWmPtr uintptr FcmapPtr uintptr FinputMethod TXIM FinputStyle TXIMStyle FinputXfs TXFontSet FwinTable TTcl_HashTable FrefCount TTcl_Size FwarpWindow TTk_Window FwarpMainwin TTk_Window FwarpX int32 FwarpY int32 Fflags uint32 Fcaret TTkCaret FiconDataSize int32 FiconDataPtr uintptr FximGeneration int32 } type TTkErrorHandler = struct { FdispPtr uintptr FfirstRequest uint32 FlastRequest uint32 Ferror1 int32 Frequest int32 FminorCode int32 FerrorProc uintptr FclientData uintptr FnextPtr uintptr } type TTkEventHandler = struct { Fmask uint32 Fproc uintptr FclientData uintptr FnextPtr uintptr } type TTkMainInfo = struct { FrefCount TTcl_Size FwinPtr uintptr Finterp uintptr FnameTable TTcl_HashTable FdeletionEpoch Tsize_t FbindingTable TTk_BindingTable FbindInfo TTkBindInfo FfontInfoPtr uintptr FtlFocusPtr uintptr FdisplayFocusPtr uintptr FoptionRootPtr uintptr FimageTable TTcl_HashTable FstrictMotif int32 FalwaysShowSelection int32 FnextPtr uintptr FbusyTable TTcl_HashTable FtclUpdateObjProc uintptr FtclUpdateObjProc2 uintptr FttkNbTabsStickBit uint32 FtroughInnerX int32 FtroughInnerY int32 FtroughInnerWidth int32 FtroughInnerHeight int32 } type TTkPredefBitmap = struct { Fsource uintptr Fwidth int32 Fheight int32 Fnative int32 } type TTkWindow = struct { Fdisplay uintptr FdispPtr uintptr FscreenNum int32 Fvisual uintptr Fdepth int32 Fwindow TWindow FchildList uintptr FlastChildPtr uintptr FparentPtr uintptr FnextPtr uintptr FmainPtr uintptr FpathName uintptr FnameUid TTk_Uid FclassUid TTk_Uid Fchanges TXWindowChanges FdirtyChanges uint32 Fatts TXSetWindowAttributes FdirtyAtts uint32 Fflags uint32 FhandlerList uintptr FinputContext TXIC FtagPtr uintptr FnumTags TTcl_Size FoptionLevel TTcl_Size FselHandlerList uintptr FgeomMgrPtr uintptr FgeomData uintptr FreqWidth int32 FreqHeight int32 FinternalBorderLeft int32 FwmInfoPtr uintptr FclassProcsPtr uintptr FinstanceData uintptr FprivatePtr uintptr FinternalBorderRight int32 FinternalBorderTop int32 FinternalBorderBottom int32 FminReqWidth int32 FminReqHeight int32 FximGeneration int32 FgeomMgrName uintptr FmaintainerPtr uintptr } type TTkKeyEvent = struct { FkeyEvent TXKeyEvent FcharValuePtr uintptr FcharValueLen TTcl_Size Fkeysym TKeySym } type TTkEnsemble = struct { Fname uintptr Fproc uintptr Fsubensemble uintptr } type TTkStateMap = struct { FnumKey int32 FstrKey uintptr } type TTkpClipMask = struct { Ftype1 int32 Fvalue struct { Fregion [0]TRegion Fpixmap TPixmap } } type TTkObjType = struct { FobjType TTcl_ObjType Fversion Tsize_t } type TTkTextBTree = uintptr type TTkIntStubs = struct { Fmagic int32 Fhooks uintptr FtkAllocWindow uintptr FtkBezierPoints uintptr FtkBezierScreenPoints uintptr Freserved3 uintptr FtkBindEventProc uintptr FtkBindFree uintptr FtkBindInit uintptr FtkChangeEventWindow uintptr FtkClipInit uintptr FtkComputeAnchor uintptr Freserved10 uintptr Freserved11 uintptr FtkCreateCursorFromData uintptr FtkCreateFrame uintptr FtkCreateMainWindow uintptr FtkCurrentTime uintptr FtkDeleteAllImages uintptr FtkDoConfigureNotify uintptr FtkDrawInsetFocusHighlight uintptr FtkEventDeadWindow uintptr FtkFillPolygon uintptr FtkFindStateNum uintptr FtkFindStateString uintptr FtkFocusDeadWindow uintptr FtkFocusFilterEvent uintptr FtkFocusKeyEvent uintptr FtkFontPkgInit uintptr FtkFontPkgFree uintptr FtkFreeBindingTags uintptr FtkpFreeCursor uintptr FtkGetBitmapData uintptr FtkGetButtPoints uintptr FtkGetCursorByName uintptr FtkGetDefaultScreenName uintptr FtkGetDisplay uintptr FtkGetDisplayOf uintptr FtkGetFocusWin uintptr FtkGetInterpNames uintptr FtkGetMiterPoints uintptr FtkGetPointerCoords uintptr FtkGetServerInfo uintptr FtkGrabDeadWindow uintptr FtkGrabState uintptr FtkIncludePoint uintptr FtkInOutEvents uintptr FtkInstallFrameMenu uintptr FtkKeysymToString uintptr FtkLineToArea uintptr FtkLineToPoint uintptr FtkMakeBezierCurve uintptr FtkMakeBezierPostscript uintptr FtkOptionClassChanged uintptr FtkOptionDeadWindow uintptr FtkOvalToArea uintptr FtkOvalToPoint uintptr FtkpChangeFocus uintptr FtkpCloseDisplay uintptr FtkpClaimFocus uintptr FtkpDisplayWarning uintptr FtkpGetAppName uintptr Freserved60 uintptr FtkpGetWrapperWindow uintptr FtkpInit uintptr FtkpInitializeMenuBindings uintptr Freserved64 uintptr FtkpMakeMenuWindow uintptr Freserved66 uintptr FtkpMenuNotifyToplevelCreate uintptr FtkpOpenDisplay uintptr FtkPointerEvent uintptr FtkPolygonToArea uintptr FtkPolygonToPoint uintptr FtkPositionInTree uintptr FtkpRedirectKeyEvent uintptr Freserved74 uintptr Freserved75 uintptr Freserved76 uintptr FtkQueueEventForAllChildren uintptr FtkReadBitmapFile uintptr FtkScrollWindow uintptr FtkSelDeadWindow uintptr FtkSelEventProc uintptr FtkSelInit uintptr FtkSelPropProc uintptr Freserved84 uintptr Freserved85 uintptr FtkStringToKeysym uintptr FtkThickPolyLineToArea uintptr FtkWmAddToColormapWindows uintptr FtkWmDeadWindow uintptr FtkWmFocusToplevel uintptr FtkWmMapWindow uintptr FtkWmNewWindow uintptr FtkWmProtocolEventProc uintptr FtkWmRemoveFromColormapWindows uintptr FtkWmRestackToplevel uintptr FtkWmSetClass uintptr FtkWmUnmapWindow uintptr FtkDebugBitmap uintptr FtkDebugBorder uintptr FtkDebugCursor uintptr FtkDebugColor uintptr FtkDebugConfig uintptr FtkDebugFont uintptr FtkFindStateNumObj uintptr FtkGetBitmapPredefTable uintptr FtkGetDisplayList uintptr FtkGetMainInfoList uintptr FtkGetWindowFromObj uintptr FtkpGetString uintptr FtkpGetSubFonts uintptr Freserved111 uintptr FtkpMenuThreadInit uintptr FxClipBox uintptr FxCreateRegion uintptr FxDestroyRegion uintptr FxIntersectRegion uintptr FxRectInRegion uintptr FxSetRegion uintptr FxUnionRectWithRegion uintptr Freserved120 uintptr FtkpCreateNativeBitmap uintptr FtkpDefineNativeBitmaps uintptr Freserved123 uintptr FtkpGetNativeAppBitmap uintptr Freserved125 uintptr Freserved126 uintptr Freserved127 uintptr Freserved128 uintptr Freserved129 uintptr Freserved130 uintptr Freserved131 uintptr Freserved132 uintptr Freserved133 uintptr Freserved134 uintptr Freserved135 uintptr FtkSetFocusWin uintptr FtkpSetKeycodeAndState uintptr FtkpGetKeySym uintptr FtkpInitKeymapInfo uintptr FtkPhotoGetValidRegion uintptr FtkWmStackorderToplevel uintptr FtkFocusFree uintptr FtkClipCleanup uintptr FtkGCCleanup uintptr FxSubtractRegion uintptr FtkStylePkgInit uintptr FtkStylePkgFree uintptr FtkToplevelWindowForCommand uintptr FtkGetOptionSpec uintptr FtkMakeRawCurve uintptr FtkMakeRawCurvePostscript uintptr FtkpDrawFrame uintptr FtkCreateThreadExitHandler uintptr FtkDeleteThreadExitHandler uintptr Freserved155 uintptr FtkpTestembedCmd uintptr FtkpTesttextCmd uintptr FtkSelGetSelection uintptr FtkTextGetIndex uintptr FtkTextIndexBackBytes uintptr FtkTextIndexForwBytes uintptr FtkTextMakeByteIndex uintptr FtkTextPrintIndex uintptr FtkTextSetMark uintptr FtkTextXviewCmd uintptr FtkTextChanged uintptr FtkBTreeNumLines uintptr FtkTextInsertDisplayProc uintptr FtkStateParseProc uintptr FtkStatePrintProc uintptr FtkCanvasDashParseProc uintptr FtkCanvasDashPrintProc uintptr FtkOffsetParseProc uintptr FtkOffsetPrintProc uintptr FtkPixelParseProc uintptr FtkPixelPrintProc uintptr FtkOrientParseProc uintptr FtkOrientPrintProc uintptr FtkSmoothParseProc uintptr FtkSmoothPrintProc uintptr FtkDrawAngledTextLayout uintptr FtkUnderlineAngledTextLayout uintptr FtkIntersectAngledTextLayout uintptr FtkDrawAngledChars uintptr FtkpRedrawWidget uintptr FtkpWillDrawWidget uintptr FtkDebugPhotoStringMatchDef uintptr } type TTkIntPlatStubs = struct { Fmagic int32 Fhooks uintptr FtkCreateXEventSource uintptr Freserved1 uintptr FtkGenerateActivateEvents uintptr Freserved3 uintptr Freserved4 uintptr Freserved5 uintptr FtkpScanWindowId uintptr Freserved7 uintptr Freserved8 uintptr FtkpWmSetState uintptr Freserved10 uintptr Freserved11 uintptr Freserved12 uintptr Freserved13 uintptr Freserved14 uintptr Freserved15 uintptr Freserved16 uintptr Freserved17 uintptr Freserved18 uintptr Freserved19 uintptr Freserved20 uintptr Freserved21 uintptr Freserved22 uintptr Freserved23 uintptr Freserved24 uintptr Freserved25 uintptr Freserved26 uintptr Freserved27 uintptr Freserved28 uintptr Freserved29 uintptr Freserved30 uintptr Freserved31 uintptr Freserved32 uintptr Freserved33 uintptr Freserved34 uintptr Freserved35 uintptr Freserved36 uintptr Freserved37 uintptr FtkpCmapStressed uintptr FtkpSync uintptr FtkUnixContainerId uintptr FtkUnixDoOneXEvent uintptr FtkUnixSetMenubar uintptr FtkWmCleanup uintptr FtkSendCleanup uintptr FtkpTestsendCmd uintptr } type TTkPlatStubs = struct { Fmagic int32 Fhooks uintptr } /* * Use our own isdigit to avoid linking to libc on windows */ func _isDigit(tls *libc.TLS, c int32) (r int32) { return libc.BoolInt32(c >= int32('0') && c <= int32('9')) } // C documentation // // /* // *---------------------------------------------------------------------- // * // * Tk_InitStubs -- // * // * Checks that the correct version of Tk is loaded and that it supports // * stubs. It then initialises the stub table pointers. // * // * Results: // * The actual version of Tk that satisfies the request, or NULL to // * indicate that an error occurred. // * // * Side effects: // * Sets the stub table pointers. // * // *---------------------------------------------------------------------- // */ func XTk_InitStubs(tls *libc.TLS, interp uintptr, version uintptr, exact int32) (r uintptr) { bp := tls.Alloc(96) defer tls.Free(96) var actualVersion, errMsg, p, packageName, q, v1 uintptr var count int32 var _ /* clientData at bp+0 */ uintptr _, _, _, _, _, _, _ = actualVersion, count, errMsg, p, packageName, q, v1 packageName = __ccgo_ts + 58328 errMsg = libc.UintptrFromInt32(0) *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0) actualVersion = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_PkgRequireEx})))(tls, interp, packageName, version, 0, bp) if actualVersion == libc.UintptrFromInt32(0) { packageName = __ccgo_ts + 58331 actualVersion = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_PkgRequireEx})))(tls, interp, packageName, version, 0, bp) if actualVersion == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } } if exact != 0 { p = version count = 0 for *(*uint8)(unsafe.Pointer(p)) != 0 { v1 = p p++ count += libc.BoolInt32(!(_isDigit(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v1)))) != 0)) } if count == int32(1) { q = actualVersion p = version for *(*uint8)(unsafe.Pointer(p)) != 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(q))) { p++ q++ } if *(*uint8)(unsafe.Pointer(p)) != 0 || _isDigit(tls, libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(q)))) != 0 { /* Construct error message */ (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_PkgRequireEx})))(tls, interp, packageName, version, int32(1), libc.UintptrFromInt32(0)) return libc.UintptrFromInt32(0) } } else { actualVersion = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_PkgRequireEx})))(tls, interp, packageName, version, int32(1), libc.UintptrFromInt32(0)) if actualVersion == libc.UintptrFromInt32(0) { return libc.UintptrFromInt32(0) } } } if *(*uintptr)(unsafe.Pointer(bp)) == libc.UintptrFromInt32(0) { errMsg = __ccgo_ts + 58334 } else { XtkStubsPtr = *(*uintptr)(unsafe.Pointer(bp)) if (*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Fhooks != 0 { XtkPlatStubsPtr = (*TTkStubHooks)(unsafe.Pointer((*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Fhooks)).FtkPlatStubs XtkIntStubsPtr = (*TTkStubHooks)(unsafe.Pointer((*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Fhooks)).FtkIntStubs XtkIntPlatStubsPtr = (*TTkStubHooks)(unsafe.Pointer((*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Fhooks)).FtkIntPlatStubs XtkIntXlibStubsPtr = (*TTkStubHooks)(unsafe.Pointer((*TTkStubs)(unsafe.Pointer(XtkStubsPtr)).Fhooks)).FtkIntXlibStubs } else { XtkPlatStubsPtr = libc.UintptrFromInt32(0) XtkIntStubsPtr = libc.UintptrFromInt32(0) XtkIntPlatStubsPtr = libc.UintptrFromInt32(0) XtkIntXlibStubsPtr = libc.UintptrFromInt32(0) } return actualVersion } (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_ResetResult})))(tls, interp) (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TTclStubs)(unsafe.Pointer(XtclStubsPtr)).Ftcl_AppendResult})))(tls, interp, libc.VaList(bp+16, __ccgo_ts+58361, packageName, __ccgo_ts+58376, version, __ccgo_ts+58397, actualVersion, __ccgo_ts+58415, errMsg, libc.UintptrFromInt32(0))) return libc.UintptrFromInt32(0) } func __ccgo_fp(f interface{}) uintptr { type iface [2]uintptr return (*iface)(unsafe.Pointer(&f))[1] } var XTIFFFaxBlackCodes = [109]Ttableentry{ 0: { Flength: uint16(10), Fcode: uint16(0x37), }, 1: { Flength: uint16(3), Fcode: uint16(0x2), Frunlen: int16(1), }, 2: { Flength: uint16(2), Fcode: uint16(0x3), Frunlen: int16(2), }, 3: { Flength: uint16(2), Fcode: uint16(0x2), Frunlen: int16(3), }, 4: { Flength: uint16(3), Fcode: uint16(0x3), Frunlen: int16(4), }, 5: { Flength: uint16(4), Fcode: uint16(0x3), Frunlen: int16(5), }, 6: { Flength: uint16(4), Fcode: uint16(0x2), Frunlen: int16(6), }, 7: { Flength: uint16(5), Fcode: uint16(0x3), Frunlen: int16(7), }, 8: { Flength: uint16(6), Fcode: uint16(0x5), Frunlen: int16(8), }, 9: { Flength: uint16(6), Fcode: uint16(0x4), Frunlen: int16(9), }, 10: { Flength: uint16(7), Fcode: uint16(0x4), Frunlen: int16(10), }, 11: { Flength: uint16(7), Fcode: uint16(0x5), Frunlen: int16(11), }, 12: { Flength: uint16(7), Fcode: uint16(0x7), Frunlen: int16(12), }, 13: { Flength: uint16(8), Fcode: uint16(0x4), Frunlen: int16(13), }, 14: { Flength: uint16(8), Fcode: uint16(0x7), Frunlen: int16(14), }, 15: { Flength: uint16(9), Fcode: uint16(0x18), Frunlen: int16(15), }, 16: { Flength: uint16(10), Fcode: uint16(0x17), Frunlen: int16(16), }, 17: { Flength: uint16(10), Fcode: uint16(0x18), Frunlen: int16(17), }, 18: { Flength: uint16(10), Fcode: uint16(0x8), Frunlen: int16(18), }, 19: { Flength: uint16(11), Fcode: uint16(0x67), Frunlen: int16(19), }, 20: { Flength: uint16(11), Fcode: uint16(0x68), Frunlen: int16(20), }, 21: { Flength: uint16(11), Fcode: uint16(0x6C), Frunlen: int16(21), }, 22: { Flength: uint16(11), Fcode: uint16(0x37), Frunlen: int16(22), }, 23: { Flength: uint16(11), Fcode: uint16(0x28), Frunlen: int16(23), }, 24: { Flength: uint16(11), Fcode: uint16(0x17), Frunlen: int16(24), }, 25: { Flength: uint16(11), Fcode: uint16(0x18), Frunlen: int16(25), }, 26: { Flength: uint16(12), Fcode: uint16(0xCA), Frunlen: int16(26), }, 27: { Flength: uint16(12), Fcode: uint16(0xCB), Frunlen: int16(27), }, 28: { Flength: uint16(12), Fcode: uint16(0xCC), Frunlen: int16(28), }, 29: { Flength: uint16(12), Fcode: uint16(0xCD), Frunlen: int16(29), }, 30: { Flength: uint16(12), Fcode: uint16(0x68), Frunlen: int16(30), }, 31: { Flength: uint16(12), Fcode: uint16(0x69), Frunlen: int16(31), }, 32: { Flength: uint16(12), Fcode: uint16(0x6A), Frunlen: int16(32), }, 33: { Flength: uint16(12), Fcode: uint16(0x6B), Frunlen: int16(33), }, 34: { Flength: uint16(12), Fcode: uint16(0xD2), Frunlen: int16(34), }, 35: { Flength: uint16(12), Fcode: uint16(0xD3), Frunlen: int16(35), }, 36: { Flength: uint16(12), Fcode: uint16(0xD4), Frunlen: int16(36), }, 37: { Flength: uint16(12), Fcode: uint16(0xD5), Frunlen: int16(37), }, 38: { Flength: uint16(12), Fcode: uint16(0xD6), Frunlen: int16(38), }, 39: { Flength: uint16(12), Fcode: uint16(0xD7), Frunlen: int16(39), }, 40: { Flength: uint16(12), Fcode: uint16(0x6C), Frunlen: int16(40), }, 41: { Flength: uint16(12), Fcode: uint16(0x6D), Frunlen: int16(41), }, 42: { Flength: uint16(12), Fcode: uint16(0xDA), Frunlen: int16(42), }, 43: { Flength: uint16(12), Fcode: uint16(0xDB), Frunlen: int16(43), }, 44: { Flength: uint16(12), Fcode: uint16(0x54), Frunlen: int16(44), }, 45: { Flength: uint16(12), Fcode: uint16(0x55), Frunlen: int16(45), }, 46: { Flength: uint16(12), Fcode: uint16(0x56), Frunlen: int16(46), }, 47: { Flength: uint16(12), Fcode: uint16(0x57), Frunlen: int16(47), }, 48: { Flength: uint16(12), Fcode: uint16(0x64), Frunlen: int16(48), }, 49: { Flength: uint16(12), Fcode: uint16(0x65), Frunlen: int16(49), }, 50: { Flength: uint16(12), Fcode: uint16(0x52), Frunlen: int16(50), }, 51: { Flength: uint16(12), Fcode: uint16(0x53), Frunlen: int16(51), }, 52: { Flength: uint16(12), Fcode: uint16(0x24), Frunlen: int16(52), }, 53: { Flength: uint16(12), Fcode: uint16(0x37), Frunlen: int16(53), }, 54: { Flength: uint16(12), Fcode: uint16(0x38), Frunlen: int16(54), }, 55: { Flength: uint16(12), Fcode: uint16(0x27), Frunlen: int16(55), }, 56: { Flength: uint16(12), Fcode: uint16(0x28), Frunlen: int16(56), }, 57: { Flength: uint16(12), Fcode: uint16(0x58), Frunlen: int16(57), }, 58: { Flength: uint16(12), Fcode: uint16(0x59), Frunlen: int16(58), }, 59: { Flength: uint16(12), Fcode: uint16(0x2B), Frunlen: int16(59), }, 60: { Flength: uint16(12), Fcode: uint16(0x2C), Frunlen: int16(60), }, 61: { Flength: uint16(12), Fcode: uint16(0x5A), Frunlen: int16(61), }, 62: { Flength: uint16(12), Fcode: uint16(0x66), Frunlen: int16(62), }, 63: { Flength: uint16(12), Fcode: uint16(0x67), Frunlen: int16(63), }, 64: { Flength: uint16(10), Fcode: uint16(0xF), Frunlen: int16(64), }, 65: { Flength: uint16(12), Fcode: uint16(0xC8), Frunlen: int16(128), }, 66: { Flength: uint16(12), Fcode: uint16(0xC9), Frunlen: int16(192), }, 67: { Flength: uint16(12), Fcode: uint16(0x5B), Frunlen: int16(256), }, 68: { Flength: uint16(12), Fcode: uint16(0x33), Frunlen: int16(320), }, 69: { Flength: uint16(12), Fcode: uint16(0x34), Frunlen: int16(384), }, 70: { Flength: uint16(12), Fcode: uint16(0x35), Frunlen: int16(448), }, 71: { Flength: uint16(13), Fcode: uint16(0x6C), Frunlen: int16(512), }, 72: { Flength: uint16(13), Fcode: uint16(0x6D), Frunlen: int16(576), }, 73: { Flength: uint16(13), Fcode: uint16(0x4A), Frunlen: int16(640), }, 74: { Flength: uint16(13), Fcode: uint16(0x4B), Frunlen: int16(704), }, 75: { Flength: uint16(13), Fcode: uint16(0x4C), Frunlen: int16(768), }, 76: { Flength: uint16(13), Fcode: uint16(0x4D), Frunlen: int16(832), }, 77: { Flength: uint16(13), Fcode: uint16(0x72), Frunlen: int16(896), }, 78: { Flength: uint16(13), Fcode: uint16(0x73), Frunlen: int16(960), }, 79: { Flength: uint16(13), Fcode: uint16(0x74), Frunlen: int16(1024), }, 80: { Flength: uint16(13), Fcode: uint16(0x75), Frunlen: int16(1088), }, 81: { Flength: uint16(13), Fcode: uint16(0x76), Frunlen: int16(1152), }, 82: { Flength: uint16(13), Fcode: uint16(0x77), Frunlen: int16(1216), }, 83: { Flength: uint16(13), Fcode: uint16(0x52), Frunlen: int16(1280), }, 84: { Flength: uint16(13), Fcode: uint16(0x53), Frunlen: int16(1344), }, 85: { Flength: uint16(13), Fcode: uint16(0x54), Frunlen: int16(1408), }, 86: { Flength: uint16(13), Fcode: uint16(0x55), Frunlen: int16(1472), }, 87: { Flength: uint16(13), Fcode: uint16(0x5A), Frunlen: int16(1536), }, 88: { Flength: uint16(13), Fcode: uint16(0x5B), Frunlen: int16(1600), }, 89: { Flength: uint16(13), Fcode: uint16(0x64), Frunlen: int16(1664), }, 90: { Flength: uint16(13), Fcode: uint16(0x65), Frunlen: int16(1728), }, 91: { Flength: uint16(11), Fcode: uint16(0x8), Frunlen: int16(1792), }, 92: { Flength: uint16(11), Fcode: uint16(0xC), Frunlen: int16(1856), }, 93: { Flength: uint16(11), Fcode: uint16(0xD), Frunlen: int16(1920), }, 94: { Flength: uint16(12), Fcode: uint16(0x12), Frunlen: int16(1984), }, 95: { Flength: uint16(12), Fcode: uint16(0x13), Frunlen: int16(2048), }, 96: { Flength: uint16(12), Fcode: uint16(0x14), Frunlen: int16(2112), }, 97: { Flength: uint16(12), Fcode: uint16(0x15), Frunlen: int16(2176), }, 98: { Flength: uint16(12), Fcode: uint16(0x16), Frunlen: int16(2240), }, 99: { Flength: uint16(12), Fcode: uint16(0x17), Frunlen: int16(2304), }, 100: { Flength: uint16(12), Fcode: uint16(0x1C), Frunlen: int16(2368), }, 101: { Flength: uint16(12), Fcode: uint16(0x1D), Frunlen: int16(2432), }, 102: { Flength: uint16(12), Fcode: uint16(0x1E), Frunlen: int16(2496), }, 103: { Flength: uint16(12), Fcode: uint16(0x1F), Frunlen: int16(2560), }, 104: { Flength: uint16(12), Fcode: uint16(0x1), Frunlen: int16(-int32(1)), }, 105: { Flength: uint16(9), Fcode: uint16(0x1), Frunlen: int16(-int32(2)), }, 106: { Flength: uint16(10), Fcode: uint16(0x1), Frunlen: int16(-int32(2)), }, 107: { Flength: uint16(11), Fcode: uint16(0x1), Frunlen: int16(-int32(2)), }, 108: { Flength: uint16(12), Frunlen: int16(-int32(2)), }, } var XTIFFFaxBlackTable = [8192]TTIFFFaxTabEnt{ 0: { FState: uint8(12), FWidth: uint8(11), }, 1: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 9: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 10: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 11: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 12: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 13: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 14: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 15: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 16: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 17: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 18: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 19: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 20: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 21: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 22: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 23: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 24: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 25: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 26: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 27: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 28: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 29: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 30: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 31: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 32: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 33: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 34: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 35: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 36: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 37: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 38: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 39: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 40: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 41: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 42: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 43: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 44: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 45: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 46: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 47: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 48: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 49: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 50: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 51: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 52: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 53: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 54: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 55: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 56: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 57: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 58: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 59: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 60: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 61: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 62: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 63: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 64: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(18), }, 65: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 66: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 67: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 68: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 69: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 70: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 71: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 72: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 73: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 74: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 75: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 76: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 77: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 78: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 79: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 80: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 81: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 82: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 83: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 84: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 85: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 86: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 87: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 88: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 89: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 90: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 91: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 92: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 93: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 94: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 95: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 96: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(17), }, 97: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 98: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 99: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 100: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 101: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 102: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 103: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 104: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 105: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 106: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 107: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 108: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 109: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 110: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 111: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 112: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 113: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 114: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 115: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 116: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 117: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 118: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 119: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 120: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 121: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 122: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 123: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 124: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 125: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 126: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 127: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 128: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1792), }, 129: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 130: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 131: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 132: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 133: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 134: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 135: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 136: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 137: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 138: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 139: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 140: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 141: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 142: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 143: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 144: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 145: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 146: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 147: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 148: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 149: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 150: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 151: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 152: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 153: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 154: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 155: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 156: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 157: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 158: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 159: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 160: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(23), }, 161: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 162: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 163: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 164: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 165: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 166: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 167: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 168: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 169: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 170: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 171: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 172: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 173: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 174: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 175: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 176: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(20), }, 177: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 178: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 179: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 180: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 181: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 182: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 183: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 184: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 185: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 186: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 187: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 188: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 189: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 190: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 191: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 192: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(25), }, 193: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 194: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 195: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 196: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 197: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 198: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 199: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 200: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 201: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 202: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 203: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 204: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 205: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 206: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 207: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 208: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 209: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 210: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 211: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 212: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 213: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 214: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 215: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 216: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 217: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 218: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 219: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 220: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 221: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 222: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 223: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 224: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 225: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 226: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 227: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 228: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 229: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 230: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 231: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 232: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 233: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 234: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 235: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 236: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 237: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 238: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 239: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 240: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 241: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 242: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 243: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 244: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 245: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 246: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 247: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 248: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 249: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 250: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 251: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 252: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 253: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 254: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 255: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 256: {}, 257: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 258: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 259: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 260: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 261: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 262: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 263: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 264: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 265: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 266: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 267: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 268: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 269: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 270: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 271: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 272: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 273: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 274: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 275: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 276: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 277: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 278: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 279: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 280: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 281: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 282: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 283: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 284: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 285: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 286: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 287: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 288: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 289: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 290: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 291: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 292: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 293: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 294: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 295: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 296: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 297: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 298: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 299: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 300: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 301: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 302: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 303: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 304: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(128), }, 305: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 306: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 307: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 308: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 309: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 310: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 311: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 312: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 313: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 314: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 315: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 316: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 317: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 318: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 319: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 320: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(56), }, 321: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 322: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 323: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 324: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 325: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 326: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 327: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 328: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 329: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 330: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 331: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 332: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 333: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 334: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 335: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 336: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 337: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 338: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 339: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 340: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 341: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 342: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 343: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 344: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 345: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 346: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 347: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 348: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 349: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 350: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 351: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 352: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(30), }, 353: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 354: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 355: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 356: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 357: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 358: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 359: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 360: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 361: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 362: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 363: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 364: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 365: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 366: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 367: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 368: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 369: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 370: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 371: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 372: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 373: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 374: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 375: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 376: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 377: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 378: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 379: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 380: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 381: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 382: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 383: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 384: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1856), }, 385: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 386: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 387: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 388: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 389: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 390: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 391: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 392: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 393: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 394: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 395: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 396: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 397: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 398: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 399: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 400: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 401: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 402: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 403: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 404: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 405: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 406: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 407: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 408: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 409: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 410: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 411: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 412: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 413: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 414: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 415: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 416: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(57), }, 417: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 418: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 419: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 420: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 421: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 422: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 423: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 424: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 425: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 426: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 427: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 428: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 429: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 430: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 431: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 432: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(21), }, 433: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 434: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 435: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 436: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 437: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 438: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 439: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 440: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 441: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 442: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 443: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 444: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 445: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 446: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 447: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 448: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(54), }, 449: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 450: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 451: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 452: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 453: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 454: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 455: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 456: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 457: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 458: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 459: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 460: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 461: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 462: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 463: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 464: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 465: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 466: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 467: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 468: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 469: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 470: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 471: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 472: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 473: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 474: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 475: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 476: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 477: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 478: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 479: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 480: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 481: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 482: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 483: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 484: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 485: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 486: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 487: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 488: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 489: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 490: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 491: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 492: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 493: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 494: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 495: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 496: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 497: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 498: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 499: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 500: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 501: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 502: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 503: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 504: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 505: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 506: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 507: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 508: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 509: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 510: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 511: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 512: {}, 513: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 514: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 515: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 516: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 517: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 518: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 519: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 520: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 521: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 522: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 523: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 524: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 525: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 526: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 527: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 528: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 529: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 530: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 531: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 532: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 533: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 534: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 535: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 536: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 537: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 538: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 539: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 540: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 541: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 542: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 543: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 544: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 545: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 546: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 547: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 548: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 549: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 550: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 551: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 552: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 553: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 554: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 555: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 556: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 557: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 558: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 559: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 560: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 561: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 562: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 563: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 564: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 565: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 566: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 567: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 568: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 569: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 570: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 571: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 572: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 573: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 574: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 575: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 576: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(52), }, 577: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 578: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 579: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 580: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 581: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 582: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 583: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 584: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 585: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 586: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 587: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 588: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 589: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 590: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 591: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 592: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 593: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 594: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 595: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 596: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 597: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 598: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 599: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 600: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 601: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 602: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 603: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 604: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 605: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 606: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 607: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 608: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(48), }, 609: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 610: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 611: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 612: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 613: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 614: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 615: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 616: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 617: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 618: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 619: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 620: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 621: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 622: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 623: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 624: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 625: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 626: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 627: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 628: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 629: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 630: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 631: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 632: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 633: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 634: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 635: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 636: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 637: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 638: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 639: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 640: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2112), }, 641: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 642: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 643: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 644: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 645: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 646: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 647: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 648: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 649: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 650: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 651: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 652: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 653: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 654: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 655: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 656: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 657: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 658: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 659: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 660: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 661: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 662: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 663: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 664: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 665: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 666: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 667: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 668: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 669: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 670: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 671: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 672: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(44), }, 673: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 674: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 675: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 676: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 677: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 678: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 679: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 680: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 681: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 682: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 683: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 684: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 685: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 686: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 687: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 688: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(36), }, 689: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 690: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 691: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 692: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 693: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 694: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 695: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 696: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 697: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 698: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 699: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 700: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 701: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 702: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 703: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 704: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(384), }, 705: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 706: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 707: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 708: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 709: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 710: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 711: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 712: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 713: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 714: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 715: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 716: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 717: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 718: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 719: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 720: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 721: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 722: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 723: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 724: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 725: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 726: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 727: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 728: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 729: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 730: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 731: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 732: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 733: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 734: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 735: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 736: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 737: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 738: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 739: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 740: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 741: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 742: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 743: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 744: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 745: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 746: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 747: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 748: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 749: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 750: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 751: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 752: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 753: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 754: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 755: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 756: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 757: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 758: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 759: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 760: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 761: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 762: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 763: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 764: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 765: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 766: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 767: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 768: {}, 769: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 770: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 771: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 772: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 773: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 774: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 775: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 776: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 777: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 778: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 779: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 780: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 781: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 782: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 783: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 784: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 785: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 786: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 787: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 788: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 789: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 790: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 791: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 792: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 793: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 794: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 795: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 796: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 797: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 798: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 799: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 800: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 801: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 802: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 803: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 804: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 805: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 806: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 807: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 808: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 809: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 810: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 811: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 812: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 813: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 814: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 815: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 816: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(28), }, 817: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 818: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 819: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 820: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 821: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 822: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 823: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 824: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 825: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 826: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 827: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 828: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 829: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 830: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 831: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 832: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(60), }, 833: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 834: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 835: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 836: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 837: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 838: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 839: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 840: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 841: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 842: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 843: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 844: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 845: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 846: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 847: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 848: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 849: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 850: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 851: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 852: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 853: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 854: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 855: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 856: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 857: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 858: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 859: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 860: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 861: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 862: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 863: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 864: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(40), }, 865: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 866: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 867: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 868: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 869: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 870: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 871: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 872: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 873: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 874: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 875: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 876: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 877: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 878: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 879: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 880: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 881: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 882: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 883: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 884: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 885: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 886: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 887: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 888: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 889: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 890: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 891: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 892: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 893: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 894: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 895: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 896: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2368), }, 897: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 898: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 899: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 900: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 901: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 902: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 903: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 904: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 905: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 906: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 907: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 908: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 909: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 910: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 911: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 912: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 913: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 914: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 915: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 916: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 917: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 918: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 919: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 920: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 921: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 922: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 923: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 924: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 925: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 926: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 927: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 928: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(16), }, 929: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 930: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 931: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 932: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 933: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 934: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 935: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 936: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 937: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 938: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 939: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 940: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 941: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 942: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 943: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 944: { FState: uint8(8), FWidth: uint8(10), }, 945: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 946: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 947: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 948: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 949: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 950: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 951: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 952: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 953: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 954: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 955: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 956: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 957: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 958: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 959: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 960: { FState: uint8(10), FWidth: uint8(10), FParam: uint32(64), }, 961: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 962: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 963: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 964: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 965: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 966: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 967: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 968: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 969: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 970: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 971: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 972: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 973: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 974: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 975: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 976: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 977: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 978: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 979: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 980: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 981: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 982: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 983: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 984: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 985: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 986: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 987: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 988: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 989: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 990: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 991: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 992: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 993: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 994: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 995: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 996: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 997: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 998: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 999: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1000: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1001: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1002: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1003: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1004: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1005: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1006: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1007: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1008: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 1009: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1010: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1011: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1012: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1013: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1014: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1015: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1016: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1017: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1018: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1019: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1020: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1021: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1022: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1023: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1024: {}, 1025: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1026: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1027: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1028: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1029: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1030: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1031: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1032: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1033: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1034: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1035: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1036: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1037: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1038: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1039: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1040: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 1041: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1042: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1043: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1044: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1045: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1046: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1047: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1048: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1049: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1050: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1051: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1052: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1053: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1054: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1055: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1056: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 1057: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1058: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1059: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1060: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1061: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1062: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1063: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1064: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1065: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1066: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1067: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1068: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1069: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1070: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1071: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1072: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 1073: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1074: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1075: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1076: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1077: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1078: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1079: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1080: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1081: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1082: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1083: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1084: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1085: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1086: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1087: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1088: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(18), }, 1089: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1090: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1091: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1092: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1093: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1094: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1095: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1096: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1097: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1098: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1099: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1100: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1101: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1102: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1103: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1104: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 1105: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1106: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1107: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1108: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1109: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1110: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1111: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1112: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1113: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1114: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1115: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1116: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1117: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1118: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1119: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1120: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(17), }, 1121: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1122: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1123: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1124: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1125: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1126: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1127: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1128: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1129: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1130: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1131: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1132: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1133: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1134: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1135: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1136: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 1137: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1138: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1139: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1140: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1141: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1142: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1143: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1144: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1145: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1146: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1147: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1148: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1149: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1150: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1151: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1152: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(1984), }, 1153: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1154: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1155: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1156: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1157: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1158: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1159: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1160: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1161: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1162: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1163: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1164: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1165: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1166: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1167: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1168: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 1169: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1170: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1171: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1172: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1173: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1174: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1175: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1176: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1177: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1178: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1179: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1180: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1181: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1182: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1183: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1184: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(50), }, 1185: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1186: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1187: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1188: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1189: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1190: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1191: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1192: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1193: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1194: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1195: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1196: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1197: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1198: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1199: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1200: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(34), }, 1201: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1202: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1203: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1204: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1205: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1206: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1207: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1208: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1209: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1210: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1211: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1212: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1213: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1214: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1215: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1216: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1664), }, 1217: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1218: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1219: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1220: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1221: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1222: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1223: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1224: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1225: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1226: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1227: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1228: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1229: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1230: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1231: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1232: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 1233: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1234: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1235: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1236: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1237: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1238: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1239: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1240: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1241: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1242: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1243: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1244: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1245: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1246: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1247: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1248: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 1249: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1250: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1251: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1252: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1253: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1254: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1255: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1256: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1257: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1258: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1259: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1260: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1261: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1262: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1263: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1264: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 1265: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1266: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1267: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1268: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1269: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1270: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1271: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1272: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1273: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1274: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1275: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1276: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1277: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1278: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1279: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1280: {}, 1281: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1282: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1283: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1284: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1285: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1286: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1287: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1288: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1289: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1290: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1291: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1292: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1293: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1294: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1295: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1296: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 1297: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1298: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1299: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1300: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1301: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1302: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1303: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1304: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1305: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1306: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1307: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1308: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1309: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1310: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1311: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1312: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 1313: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1314: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1315: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1316: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1317: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1318: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1319: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1320: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1321: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1322: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1323: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1324: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1325: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1326: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1327: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1328: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(26), }, 1329: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1330: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1331: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1332: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1333: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1334: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1335: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1336: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1337: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1338: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1339: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1340: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1341: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1342: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1343: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1344: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1408), }, 1345: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1346: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1347: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1348: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1349: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1350: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1351: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1352: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1353: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1354: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1355: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1356: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1357: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1358: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1359: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1360: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 1361: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1362: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1363: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1364: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1365: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1366: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1367: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1368: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1369: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1370: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1371: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1372: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1373: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1374: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1375: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1376: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(32), }, 1377: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1378: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1379: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1380: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1381: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1382: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1383: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1384: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1385: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1386: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1387: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1388: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1389: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1390: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1391: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1392: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 1393: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1394: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1395: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1396: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1397: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1398: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1399: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1400: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1401: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1402: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1403: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1404: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1405: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1406: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1407: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1408: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1920), }, 1409: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1410: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1411: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1412: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1413: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1414: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1415: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1416: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1417: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1418: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1419: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1420: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1421: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1422: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1423: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1424: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 1425: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1426: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1427: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1428: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1429: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1430: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1431: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1432: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1433: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1434: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1435: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1436: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1437: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1438: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1439: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1440: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(61), }, 1441: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1442: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1443: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1444: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1445: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1446: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1447: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1448: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1449: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1450: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1451: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1452: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1453: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1454: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1455: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1456: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(42), }, 1457: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1458: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1459: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1460: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1461: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1462: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1463: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1464: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1465: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1466: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1467: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1468: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1469: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1470: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1471: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1472: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1024), }, 1473: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1474: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1475: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1476: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1477: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1478: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1479: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1480: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1481: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1482: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1483: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1484: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1485: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1486: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1487: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1488: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 1489: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1490: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1491: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1492: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1493: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1494: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1495: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1496: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1497: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1498: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1499: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1500: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1501: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1502: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1503: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1504: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 1505: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1506: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1507: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1508: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1509: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1510: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1511: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1512: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1513: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1514: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1515: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1516: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1517: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1518: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1519: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1520: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 1521: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1522: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1523: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1524: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1525: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1526: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1527: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1528: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1529: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1530: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1531: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1532: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1533: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1534: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1535: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1536: {}, 1537: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1538: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1539: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1540: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1541: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1542: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1543: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1544: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1545: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1546: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1547: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1548: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1549: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1550: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1551: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1552: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 1553: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1554: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1555: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1556: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1557: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1558: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1559: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1560: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1561: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1562: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1563: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1564: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1565: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1566: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1567: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1568: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 1569: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1570: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1571: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1572: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1573: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1574: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1575: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1576: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1577: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1578: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1579: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1580: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1581: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1582: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1583: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1584: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 1585: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1586: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1587: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1588: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1589: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1590: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1591: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1592: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1593: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1594: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1595: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1596: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1597: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1598: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1599: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1600: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(768), }, 1601: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1602: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1603: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1604: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1605: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1606: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1607: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1608: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1609: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1610: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1611: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1612: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1613: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1614: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1615: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1616: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 1617: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1618: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1619: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1620: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1621: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1622: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1623: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1624: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1625: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1626: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1627: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1628: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1629: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1630: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1631: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1632: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(62), }, 1633: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1634: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1635: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1636: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1637: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1638: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1639: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1640: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1641: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1642: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1643: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1644: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1645: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1646: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1647: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1648: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 1649: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1650: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1651: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1652: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1653: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1654: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1655: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1656: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1657: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1658: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1659: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1660: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1661: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1662: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1663: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1664: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2240), }, 1665: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1666: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1667: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1668: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1669: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1670: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1671: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1672: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1673: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1674: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1675: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1676: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1677: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1678: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1679: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1680: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 1681: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1682: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1683: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1684: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1685: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1686: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1687: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1688: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1689: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1690: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1691: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1692: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1693: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1694: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1695: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1696: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(46), }, 1697: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1698: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1699: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1700: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1701: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1702: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1703: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1704: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1705: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1706: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1707: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1708: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1709: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1710: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1711: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1712: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(38), }, 1713: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1714: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1715: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1716: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1717: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1718: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1719: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1720: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1721: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1722: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1723: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1724: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1725: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1726: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1727: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1728: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(512), }, 1729: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1730: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1731: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1732: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1733: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1734: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1735: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1736: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1737: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1738: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1739: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1740: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1741: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1742: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1743: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1744: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 1745: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1746: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1747: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1748: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1749: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1750: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1751: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1752: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1753: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1754: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1755: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1756: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1757: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1758: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1759: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1760: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 1761: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1762: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1763: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1764: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1765: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1766: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1767: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1768: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1769: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1770: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1771: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1772: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1773: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1774: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1775: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1776: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 1777: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1778: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1779: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1780: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1781: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1782: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1783: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1784: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1785: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1786: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1787: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1788: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1789: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1790: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1791: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1792: {}, 1793: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1794: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1795: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1796: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1797: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1798: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1799: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1800: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1801: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1802: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1803: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1804: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1805: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1806: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1807: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1808: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 1809: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1810: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1811: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1812: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1813: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1814: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1815: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1816: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1817: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1818: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1819: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1820: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1821: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1822: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1823: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1824: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 1825: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1826: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1827: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1828: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1829: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1830: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1831: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1832: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1833: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1834: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1835: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1836: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1837: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1838: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1839: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1840: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(19), }, 1841: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1842: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1843: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1844: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1845: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1846: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1847: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1848: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1849: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1850: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1851: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1852: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1853: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1854: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1855: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1856: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(24), }, 1857: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1858: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1859: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1860: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1861: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1862: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1863: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1864: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1865: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1866: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1867: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1868: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1869: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1870: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1871: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1872: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 1873: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1874: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1875: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1876: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1877: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1878: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1879: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1880: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1881: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1882: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1883: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1884: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1885: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1886: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1887: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1888: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(22), }, 1889: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1890: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1891: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1892: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1893: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1894: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1895: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1896: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1897: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1898: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1899: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1900: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1901: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1902: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1903: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1904: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 1905: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1906: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1907: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1908: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1909: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1910: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1911: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1912: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1913: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1914: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1915: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1916: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1917: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1918: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1919: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1920: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2496), }, 1921: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1922: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1923: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1924: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1925: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1926: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1927: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1928: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1929: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1930: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1931: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1932: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1933: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1934: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1935: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1936: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 1937: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1938: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1939: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1940: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1941: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1942: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1943: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1944: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1945: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1946: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1947: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1948: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1949: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1950: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1951: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1952: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(16), }, 1953: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1954: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1955: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1956: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1957: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1958: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1959: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1960: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 1961: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1962: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1963: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1964: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1965: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1966: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1967: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1968: { FState: uint8(8), FWidth: uint8(10), }, 1969: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1970: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1971: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1972: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1973: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1974: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1975: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1976: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 1977: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1978: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1979: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1980: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1981: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1982: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1983: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1984: { FState: uint8(10), FWidth: uint8(10), FParam: uint32(64), }, 1985: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1986: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1987: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1988: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 1989: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1990: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1991: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1992: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 1993: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1994: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 1995: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 1996: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 1997: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 1998: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 1999: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2000: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 2001: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2002: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2003: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2004: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2005: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2006: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2007: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2008: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2009: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2010: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2011: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2012: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2013: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2014: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2015: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2016: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 2017: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2018: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2019: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2020: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2021: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2022: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2023: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2024: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2025: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2026: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2027: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2028: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2029: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2030: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2031: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2032: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 2033: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2034: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2035: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2036: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2037: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2038: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2039: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2040: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2041: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2042: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2043: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2044: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2045: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2046: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2047: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2048: { FState: uint8(12), FWidth: uint8(11), }, 2049: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2050: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2051: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2052: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2053: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2054: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2055: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2056: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2057: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2058: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2059: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2060: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2061: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2062: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2063: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2064: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 2065: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2066: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2067: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2068: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2069: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2070: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2071: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2072: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2073: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2074: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2075: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2076: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2077: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2078: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2079: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2080: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 2081: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2082: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2083: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2084: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2085: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2086: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2087: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2088: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2089: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2090: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2091: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2092: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2093: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2094: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2095: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2096: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 2097: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2098: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2099: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2100: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2101: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2102: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2103: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2104: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2105: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2106: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2107: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2108: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2109: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2110: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2111: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2112: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(18), }, 2113: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2114: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2115: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2116: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2117: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2118: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2119: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2120: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2121: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2122: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2123: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2124: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2125: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2126: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2127: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2128: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 2129: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2130: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2131: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2132: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2133: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2134: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2135: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2136: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2137: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2138: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2139: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2140: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2141: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2142: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2143: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2144: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(17), }, 2145: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2146: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2147: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2148: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2149: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2150: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2151: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2152: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2153: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2154: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2155: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2156: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2157: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2158: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2159: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2160: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 2161: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2162: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2163: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2164: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2165: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2166: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2167: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2168: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2169: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2170: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2171: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2172: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2173: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2174: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2175: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2176: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1792), }, 2177: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2178: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2179: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2180: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2181: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2182: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2183: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2184: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2185: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2186: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2187: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2188: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2189: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2190: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2191: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2192: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 2193: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2194: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2195: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2196: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2197: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2198: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2199: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2200: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2201: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2202: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2203: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2204: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2205: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2206: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2207: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2208: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(23), }, 2209: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2210: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2211: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2212: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2213: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2214: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2215: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2216: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2217: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2218: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2219: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2220: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2221: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2222: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2223: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2224: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(20), }, 2225: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2226: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2227: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2228: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2229: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2230: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2231: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2232: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2233: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2234: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2235: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2236: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2237: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2238: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2239: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2240: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(25), }, 2241: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2242: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2243: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2244: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2245: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2246: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2247: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2248: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2249: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2250: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2251: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2252: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2253: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2254: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2255: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2256: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 2257: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2258: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2259: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2260: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2261: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2262: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2263: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2264: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2265: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2266: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2267: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2268: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2269: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2270: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2271: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2272: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 2273: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2274: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2275: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2276: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2277: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2278: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2279: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2280: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2281: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2282: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2283: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2284: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2285: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2286: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2287: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2288: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 2289: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2290: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2291: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2292: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2293: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2294: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2295: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2296: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2297: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2298: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2299: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2300: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2301: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2302: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2303: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2304: {}, 2305: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2306: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2307: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2308: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2309: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2310: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2311: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2312: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2313: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2314: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2315: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2316: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2317: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2318: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2319: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2320: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 2321: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2322: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2323: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2324: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2325: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2326: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2327: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2328: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2329: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2330: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2331: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2332: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2333: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2334: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2335: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2336: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 2337: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2338: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2339: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2340: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2341: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2342: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2343: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2344: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2345: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2346: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2347: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2348: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2349: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2350: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2351: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2352: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(192), }, 2353: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2354: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2355: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2356: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2357: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2358: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2359: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2360: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2361: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2362: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2363: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2364: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2365: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2366: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2367: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2368: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1280), }, 2369: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2370: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2371: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2372: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2373: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2374: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2375: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2376: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2377: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2378: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2379: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2380: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2381: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2382: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2383: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2384: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 2385: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2386: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2387: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2388: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2389: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2390: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2391: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2392: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2393: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2394: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2395: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2396: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2397: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2398: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2399: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2400: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(31), }, 2401: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2402: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2403: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2404: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2405: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2406: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2407: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2408: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2409: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2410: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2411: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2412: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2413: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2414: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2415: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2416: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 2417: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2418: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2419: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2420: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2421: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2422: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2423: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2424: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2425: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2426: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2427: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2428: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2429: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2430: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2431: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2432: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1856), }, 2433: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2434: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2435: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2436: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2437: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2438: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2439: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2440: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2441: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2442: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2443: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2444: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2445: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2446: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2447: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2448: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 2449: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2450: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2451: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2452: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2453: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2454: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2455: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2456: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2457: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2458: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2459: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2460: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2461: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2462: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2463: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2464: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(58), }, 2465: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2466: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2467: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2468: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2469: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2470: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2471: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2472: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2473: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2474: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2475: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2476: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2477: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2478: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2479: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2480: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(21), }, 2481: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2482: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2483: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2484: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2485: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2486: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2487: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2488: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2489: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2490: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2491: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2492: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2493: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2494: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2495: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2496: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(896), }, 2497: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2498: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2499: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2500: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2501: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2502: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2503: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2504: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2505: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2506: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2507: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2508: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2509: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2510: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2511: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2512: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 2513: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2514: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2515: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2516: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2517: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2518: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2519: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2520: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2521: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2522: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2523: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2524: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2525: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2526: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2527: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2528: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 2529: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2530: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2531: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2532: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2533: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2534: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2535: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2536: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2537: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2538: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2539: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2540: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2541: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2542: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2543: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2544: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 2545: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2546: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2547: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2548: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2549: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2550: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2551: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2552: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2553: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2554: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2555: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2556: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2557: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2558: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2559: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2560: {}, 2561: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2562: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2563: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2564: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2565: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2566: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2567: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2568: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2569: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2570: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2571: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2572: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2573: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2574: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2575: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2576: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 2577: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2578: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2579: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2580: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2581: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2582: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2583: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2584: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2585: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2586: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2587: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2588: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2589: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2590: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2591: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2592: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 2593: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2594: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2595: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2596: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2597: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2598: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2599: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2600: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2601: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2602: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2603: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2604: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2605: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2606: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2607: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2608: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 2609: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2610: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2611: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2612: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2613: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2614: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2615: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2616: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2617: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2618: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2619: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2620: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2621: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2622: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2623: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2624: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(640), }, 2625: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2626: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2627: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2628: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2629: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2630: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2631: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2632: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2633: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2634: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2635: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2636: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2637: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2638: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2639: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2640: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 2641: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2642: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2643: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2644: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2645: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2646: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2647: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2648: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2649: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2650: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2651: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2652: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2653: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2654: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2655: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2656: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(49), }, 2657: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2658: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2659: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2660: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2661: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2662: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2663: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2664: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2665: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2666: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2667: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2668: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2669: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2670: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2671: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2672: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 2673: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2674: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2675: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2676: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2677: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2678: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2679: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2680: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2681: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2682: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2683: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2684: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2685: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2686: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2687: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2688: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2176), }, 2689: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2690: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2691: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2692: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2693: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2694: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2695: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2696: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2697: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2698: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2699: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2700: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2701: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2702: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2703: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2704: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 2705: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2706: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2707: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2708: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2709: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2710: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2711: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2712: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2713: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2714: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2715: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2716: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2717: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2718: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2719: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2720: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(45), }, 2721: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2722: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2723: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2724: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2725: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2726: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2727: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2728: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2729: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2730: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2731: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2732: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2733: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2734: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2735: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2736: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(37), }, 2737: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2738: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2739: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2740: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2741: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2742: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2743: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2744: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2745: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2746: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2747: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2748: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2749: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2750: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2751: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2752: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(448), }, 2753: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2754: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2755: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2756: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2757: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2758: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2759: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2760: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2761: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2762: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2763: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2764: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2765: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2766: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2767: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2768: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 2769: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2770: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2771: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2772: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2773: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2774: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2775: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2776: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2777: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2778: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2779: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2780: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2781: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2782: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2783: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2784: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 2785: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2786: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2787: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2788: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2789: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2790: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2791: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2792: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2793: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2794: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2795: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2796: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2797: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2798: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2799: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2800: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 2801: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2802: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2803: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2804: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2805: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2806: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2807: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2808: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2809: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2810: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2811: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2812: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2813: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2814: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2815: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2816: {}, 2817: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2818: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2819: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2820: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2821: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2822: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2823: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2824: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2825: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2826: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2827: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2828: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2829: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2830: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2831: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2832: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 2833: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2834: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2835: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2836: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2837: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2838: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2839: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2840: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2841: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2842: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2843: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2844: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2845: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2846: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2847: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2848: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 2849: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2850: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2851: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2852: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2853: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2854: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2855: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2856: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2857: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2858: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2859: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2860: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2861: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2862: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2863: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2864: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(29), }, 2865: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2866: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2867: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2868: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2869: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2870: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2871: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2872: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2873: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2874: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2875: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2876: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2877: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2878: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2879: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2880: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1536), }, 2881: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2882: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2883: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2884: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2885: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2886: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2887: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2888: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2889: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2890: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2891: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2892: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2893: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2894: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2895: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2896: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 2897: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2898: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2899: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2900: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2901: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2902: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2903: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2904: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2905: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2906: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2907: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2908: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2909: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2910: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2911: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2912: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(41), }, 2913: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2914: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2915: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2916: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2917: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2918: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2919: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2920: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2921: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2922: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2923: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2924: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2925: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2926: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2927: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2928: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 2929: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2930: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2931: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2932: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2933: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2934: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2935: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2936: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2937: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2938: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2939: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2940: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2941: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2942: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2943: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2944: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2432), }, 2945: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2946: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2947: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2948: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2949: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2950: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2951: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2952: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 2953: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2954: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2955: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2956: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2957: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2958: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2959: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2960: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 2961: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2962: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2963: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2964: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2965: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2966: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2967: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2968: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 2969: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2970: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2971: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2972: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2973: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2974: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2975: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2976: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(16), }, 2977: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2978: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2979: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2980: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2981: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2982: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2983: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2984: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 2985: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2986: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2987: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2988: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 2989: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2990: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2991: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2992: { FState: uint8(8), FWidth: uint8(10), }, 2993: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2994: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 2995: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 2996: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 2997: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 2998: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 2999: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3000: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3001: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3002: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3003: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3004: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3005: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3006: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3007: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3008: { FState: uint8(10), FWidth: uint8(10), FParam: uint32(64), }, 3009: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3010: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3011: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3012: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3013: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3014: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3015: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3016: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3017: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3018: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3019: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3020: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3021: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3022: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3023: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3024: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 3025: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3026: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3027: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3028: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3029: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3030: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3031: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3032: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3033: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3034: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3035: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3036: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3037: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3038: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3039: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3040: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 3041: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3042: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3043: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3044: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3045: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3046: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3047: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3048: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3049: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3050: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3051: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3052: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3053: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3054: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3055: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3056: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 3057: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3058: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3059: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3060: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3061: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3062: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3063: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3064: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3065: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3066: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3067: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3068: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3069: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3070: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3071: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3072: {}, 3073: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3074: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3075: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3076: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3077: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3078: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3079: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3080: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3081: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3082: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3083: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3084: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3085: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3086: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3087: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3088: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 3089: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3090: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3091: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3092: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3093: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3094: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3095: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3096: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3097: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3098: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3099: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3100: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3101: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3102: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3103: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3104: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 3105: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3106: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3107: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3108: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3109: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3110: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3111: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3112: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3113: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3114: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3115: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3116: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3117: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3118: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3119: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3120: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 3121: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3122: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3123: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3124: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3125: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3126: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3127: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3128: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3129: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3130: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3131: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3132: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3133: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3134: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3135: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3136: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(18), }, 3137: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3138: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3139: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3140: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3141: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3142: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3143: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3144: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3145: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3146: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3147: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3148: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3149: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3150: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3151: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3152: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 3153: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3154: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3155: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3156: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3157: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3158: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3159: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3160: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3161: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3162: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3163: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3164: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3165: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3166: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3167: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3168: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(17), }, 3169: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3170: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3171: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3172: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3173: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3174: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3175: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3176: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3177: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3178: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3179: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3180: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3181: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3182: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3183: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3184: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 3185: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3186: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3187: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3188: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3189: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3190: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3191: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3192: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3193: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3194: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3195: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3196: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3197: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3198: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3199: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3200: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2048), }, 3201: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3202: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3203: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3204: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3205: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3206: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3207: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3208: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3209: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3210: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3211: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3212: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3213: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3214: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3215: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3216: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 3217: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3218: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3219: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3220: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3221: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3222: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3223: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3224: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3225: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3226: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3227: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3228: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3229: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3230: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3231: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3232: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(51), }, 3233: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3234: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3235: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3236: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3237: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3238: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3239: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3240: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3241: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3242: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3243: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3244: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3245: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3246: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3247: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3248: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(35), }, 3249: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3250: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3251: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3252: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3253: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3254: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3255: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3256: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3257: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3258: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3259: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3260: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3261: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3262: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3263: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3264: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(320), }, 3265: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3266: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3267: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3268: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3269: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3270: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3271: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3272: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3273: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3274: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3275: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3276: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3277: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3278: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3279: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3280: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 3281: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3282: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3283: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3284: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3285: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3286: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3287: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3288: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3289: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3290: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3291: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3292: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3293: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3294: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3295: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3296: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 3297: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3298: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3299: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3300: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3301: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3302: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3303: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3304: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3305: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3306: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3307: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3308: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3309: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3310: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3311: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3312: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 3313: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3314: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3315: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3316: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3317: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3318: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3319: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3320: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3321: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3322: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3323: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3324: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3325: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3326: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3327: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3328: {}, 3329: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3330: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3331: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3332: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3333: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3334: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3335: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3336: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3337: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3338: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3339: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3340: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3341: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3342: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3343: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3344: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 3345: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3346: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3347: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3348: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3349: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3350: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3351: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3352: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3353: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3354: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3355: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3356: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3357: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3358: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3359: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3360: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 3361: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3362: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3363: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3364: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3365: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3366: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3367: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3368: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3369: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3370: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3371: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3372: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3373: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3374: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3375: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3376: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(27), }, 3377: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3378: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3379: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3380: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3381: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3382: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3383: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3384: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3385: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3386: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3387: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3388: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3389: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3390: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3391: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3392: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(59), }, 3393: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3394: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3395: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3396: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3397: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3398: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3399: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3400: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3401: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3402: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3403: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3404: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3405: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3406: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3407: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3408: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 3409: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3410: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3411: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3412: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3413: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3414: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3415: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3416: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3417: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3418: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3419: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3420: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3421: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3422: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3423: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3424: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(33), }, 3425: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3426: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3427: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3428: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3429: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3430: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3431: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3432: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3433: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3434: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3435: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3436: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3437: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3438: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3439: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3440: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 3441: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3442: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3443: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3444: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3445: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3446: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3447: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3448: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3449: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3450: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3451: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3452: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3453: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3454: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3455: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3456: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1920), }, 3457: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3458: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3459: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3460: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3461: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3462: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3463: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3464: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3465: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3466: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3467: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3468: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3469: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3470: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3471: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3472: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 3473: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3474: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3475: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3476: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3477: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3478: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3479: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3480: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3481: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3482: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3483: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3484: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3485: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3486: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3487: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3488: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(256), }, 3489: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3490: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3491: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3492: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3493: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3494: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3495: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3496: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3497: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3498: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3499: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3500: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3501: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3502: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3503: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3504: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(43), }, 3505: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3506: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3507: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3508: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3509: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3510: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3511: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3512: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3513: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3514: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3515: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3516: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3517: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3518: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3519: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3520: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1152), }, 3521: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3522: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3523: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3524: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3525: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3526: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3527: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3528: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3529: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3530: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3531: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3532: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3533: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3534: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3535: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3536: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 3537: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3538: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3539: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3540: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3541: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3542: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3543: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3544: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3545: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3546: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3547: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3548: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3549: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3550: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3551: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3552: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 3553: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3554: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3555: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3556: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3557: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3558: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3559: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3560: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3561: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3562: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3563: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3564: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3565: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3566: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3567: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3568: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 3569: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3570: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3571: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3572: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3573: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3574: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3575: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3576: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3577: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3578: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3579: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3580: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3581: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3582: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3583: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3584: {}, 3585: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3586: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3587: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3588: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3589: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3590: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3591: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3592: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3593: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3594: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3595: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3596: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3597: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3598: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3599: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3600: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 3601: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3602: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3603: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3604: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3605: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3606: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3607: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3608: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3609: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3610: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3611: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3612: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3613: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3614: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3615: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3616: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 3617: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3618: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3619: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3620: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3621: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3622: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3623: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3624: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3625: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3626: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3627: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3628: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3629: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3630: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3631: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3632: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 3633: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3634: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3635: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3636: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3637: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3638: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3639: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3640: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3641: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3642: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3643: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3644: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3645: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3646: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3647: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3648: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(55), }, 3649: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3650: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3651: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3652: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3653: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3654: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3655: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3656: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3657: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3658: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3659: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3660: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3661: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3662: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3663: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3664: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 3665: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3666: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3667: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3668: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3669: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3670: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3671: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3672: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3673: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3674: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3675: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3676: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3677: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3678: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3679: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3680: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(63), }, 3681: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3682: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3683: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3684: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3685: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3686: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3687: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3688: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3689: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3690: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3691: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3692: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3693: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3694: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3695: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3696: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 3697: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3698: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3699: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3700: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3701: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3702: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3703: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3704: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3705: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3706: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3707: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3708: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3709: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3710: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3711: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3712: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2304), }, 3713: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3714: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3715: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3716: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3717: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3718: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3719: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3720: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3721: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3722: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3723: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3724: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3725: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3726: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3727: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3728: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 3729: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3730: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3731: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3732: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3733: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3734: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3735: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3736: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3737: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3738: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3739: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3740: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3741: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3742: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3743: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3744: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(47), }, 3745: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3746: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3747: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3748: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3749: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3750: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3751: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3752: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3753: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3754: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3755: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3756: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3757: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3758: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3759: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3760: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(39), }, 3761: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3762: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3763: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3764: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3765: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3766: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3767: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3768: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3769: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3770: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3771: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3772: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3773: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3774: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3775: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3776: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(53), }, 3777: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3778: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3779: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3780: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3781: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3782: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3783: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3784: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3785: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3786: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3787: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3788: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3789: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3790: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3791: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3792: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 3793: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3794: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3795: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3796: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3797: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3798: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3799: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3800: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3801: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3802: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3803: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3804: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3805: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3806: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3807: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3808: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 3809: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3810: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3811: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3812: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3813: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3814: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3815: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3816: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3817: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3818: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3819: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3820: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3821: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3822: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3823: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3824: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 3825: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3826: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3827: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3828: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3829: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3830: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3831: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3832: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3833: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3834: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3835: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3836: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3837: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3838: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3839: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3840: {}, 3841: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3842: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3843: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3844: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3845: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3846: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3847: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3848: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3849: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3850: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3851: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3852: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3853: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3854: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3855: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3856: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 3857: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3858: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3859: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3860: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3861: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3862: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3863: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3864: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3865: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3866: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3867: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3868: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3869: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3870: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3871: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3872: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 3873: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3874: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3875: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3876: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3877: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3878: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3879: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3880: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3881: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3882: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3883: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3884: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3885: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3886: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3887: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3888: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(19), }, 3889: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3890: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3891: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3892: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3893: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3894: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3895: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3896: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3897: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3898: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3899: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3900: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3901: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3902: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3903: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3904: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(24), }, 3905: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3906: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3907: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3908: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3909: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3910: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3911: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3912: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3913: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3914: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3915: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3916: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3917: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3918: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3919: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3920: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 3921: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3922: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3923: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3924: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3925: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3926: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3927: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3928: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3929: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3930: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3931: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3932: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3933: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3934: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3935: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3936: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(22), }, 3937: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3938: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3939: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3940: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3941: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3942: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3943: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3944: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 3945: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3946: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3947: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3948: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3949: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3950: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3951: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3952: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 3953: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3954: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3955: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3956: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3957: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3958: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3959: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3960: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3961: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3962: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3963: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3964: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3965: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3966: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3967: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3968: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2560), }, 3969: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3970: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3971: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3972: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3973: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3974: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3975: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3976: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 3977: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3978: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3979: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3980: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3981: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3982: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3983: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3984: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 3985: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3986: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3987: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3988: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 3989: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3990: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3991: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3992: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 3993: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3994: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 3995: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 3996: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 3997: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 3998: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 3999: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4000: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(16), }, 4001: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4002: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4003: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4004: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4005: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4006: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4007: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4008: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4009: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4010: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4011: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4012: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4013: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4014: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4015: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4016: { FState: uint8(8), FWidth: uint8(10), }, 4017: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4018: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4019: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4020: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4021: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4022: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4023: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4024: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4025: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4026: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4027: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4028: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4029: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4030: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4031: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4032: { FState: uint8(10), FWidth: uint8(10), FParam: uint32(64), }, 4033: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4034: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4035: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4036: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4037: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4038: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4039: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4040: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4041: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4042: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4043: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4044: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4045: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4046: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4047: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4048: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 4049: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4050: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4051: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4052: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4053: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4054: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4055: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4056: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4057: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4058: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4059: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4060: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4061: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4062: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4063: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4064: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 4065: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4066: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4067: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4068: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4069: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4070: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4071: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4072: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4073: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4074: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4075: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4076: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4077: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4078: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4079: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4080: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 4081: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4082: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4083: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4084: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4085: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4086: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4087: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4088: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4089: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4090: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4091: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4092: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4093: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4094: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4095: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4096: { FState: uint8(12), FWidth: uint8(11), }, 4097: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4098: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4099: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4100: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4101: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4102: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4103: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4104: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4105: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4106: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4107: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4108: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4109: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4110: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4111: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4112: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 4113: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4114: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4115: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4116: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4117: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4118: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4119: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4120: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4121: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4122: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4123: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4124: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4125: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4126: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4127: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4128: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 4129: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4130: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4131: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4132: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4133: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4134: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4135: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4136: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4137: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4138: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4139: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4140: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4141: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4142: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4143: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4144: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 4145: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4146: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4147: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4148: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4149: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4150: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4151: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4152: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4153: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4154: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4155: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4156: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4157: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4158: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4159: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4160: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(18), }, 4161: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4162: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4163: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4164: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4165: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4166: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4167: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4168: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4169: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4170: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4171: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4172: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4173: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4174: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4175: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4176: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 4177: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4178: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4179: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4180: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4181: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4182: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4183: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4184: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4185: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4186: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4187: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4188: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4189: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4190: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4191: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4192: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(17), }, 4193: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4194: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4195: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4196: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4197: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4198: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4199: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4200: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4201: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4202: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4203: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4204: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4205: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4206: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4207: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4208: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 4209: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4210: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4211: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4212: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4213: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4214: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4215: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4216: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4217: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4218: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4219: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4220: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4221: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4222: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4223: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4224: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1792), }, 4225: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4226: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4227: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4228: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4229: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4230: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4231: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4232: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4233: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4234: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4235: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4236: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4237: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4238: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4239: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4240: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 4241: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4242: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4243: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4244: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4245: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4246: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4247: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4248: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4249: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4250: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4251: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4252: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4253: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4254: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4255: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4256: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(23), }, 4257: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4258: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4259: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4260: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4261: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4262: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4263: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4264: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4265: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4266: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4267: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4268: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4269: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4270: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4271: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4272: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(20), }, 4273: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4274: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4275: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4276: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4277: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4278: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4279: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4280: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4281: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4282: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4283: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4284: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4285: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4286: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4287: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4288: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(25), }, 4289: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4290: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4291: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4292: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4293: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4294: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4295: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4296: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4297: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4298: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4299: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4300: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4301: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4302: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4303: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4304: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 4305: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4306: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4307: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4308: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4309: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4310: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4311: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4312: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4313: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4314: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4315: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4316: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4317: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4318: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4319: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4320: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 4321: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4322: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4323: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4324: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4325: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4326: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4327: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4328: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4329: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4330: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4331: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4332: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4333: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4334: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4335: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4336: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 4337: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4338: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4339: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4340: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4341: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4342: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4343: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4344: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4345: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4346: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4347: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4348: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4349: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4350: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4351: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4352: {}, 4353: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4354: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4355: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4356: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4357: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4358: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4359: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4360: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4361: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4362: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4363: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4364: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4365: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4366: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4367: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4368: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 4369: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4370: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4371: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4372: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4373: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4374: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4375: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4376: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4377: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4378: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4379: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4380: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4381: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4382: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4383: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4384: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 4385: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4386: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4387: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4388: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4389: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4390: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4391: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4392: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4393: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4394: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4395: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4396: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4397: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4398: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4399: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4400: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(128), }, 4401: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4402: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4403: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4404: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4405: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4406: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4407: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4408: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4409: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4410: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4411: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4412: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4413: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4414: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4415: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4416: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(56), }, 4417: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4418: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4419: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4420: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4421: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4422: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4423: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4424: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4425: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4426: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4427: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4428: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4429: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4430: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4431: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4432: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 4433: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4434: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4435: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4436: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4437: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4438: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4439: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4440: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4441: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4442: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4443: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4444: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4445: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4446: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4447: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4448: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(30), }, 4449: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4450: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4451: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4452: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4453: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4454: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4455: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4456: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4457: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4458: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4459: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4460: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4461: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4462: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4463: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4464: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 4465: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4466: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4467: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4468: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4469: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4470: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4471: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4472: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4473: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4474: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4475: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4476: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4477: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4478: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4479: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4480: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1856), }, 4481: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4482: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4483: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4484: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4485: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4486: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4487: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4488: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4489: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4490: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4491: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4492: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4493: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4494: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4495: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4496: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 4497: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4498: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4499: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4500: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4501: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4502: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4503: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4504: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4505: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4506: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4507: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4508: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4509: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4510: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4511: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4512: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(57), }, 4513: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4514: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4515: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4516: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4517: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4518: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4519: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4520: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4521: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4522: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4523: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4524: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4525: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4526: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4527: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4528: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(21), }, 4529: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4530: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4531: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4532: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4533: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4534: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4535: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4536: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4537: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4538: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4539: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4540: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4541: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4542: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4543: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4544: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(54), }, 4545: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4546: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4547: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4548: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4549: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4550: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4551: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4552: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4553: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4554: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4555: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4556: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4557: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4558: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4559: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4560: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 4561: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4562: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4563: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4564: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4565: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4566: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4567: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4568: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4569: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4570: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4571: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4572: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4573: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4574: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4575: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4576: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 4577: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4578: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4579: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4580: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4581: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4582: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4583: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4584: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4585: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4586: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4587: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4588: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4589: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4590: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4591: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4592: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 4593: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4594: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4595: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4596: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4597: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4598: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4599: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4600: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4601: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4602: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4603: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4604: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4605: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4606: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4607: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4608: {}, 4609: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4610: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4611: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4612: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4613: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4614: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4615: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4616: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4617: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4618: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4619: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4620: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4621: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4622: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4623: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4624: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 4625: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4626: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4627: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4628: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4629: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4630: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4631: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4632: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4633: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4634: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4635: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4636: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4637: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4638: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4639: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4640: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 4641: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4642: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4643: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4644: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4645: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4646: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4647: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4648: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4649: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4650: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4651: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4652: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4653: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4654: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4655: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4656: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 4657: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4658: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4659: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4660: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4661: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4662: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4663: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4664: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4665: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4666: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4667: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4668: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4669: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4670: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4671: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4672: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(52), }, 4673: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4674: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4675: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4676: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4677: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4678: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4679: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4680: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4681: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4682: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4683: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4684: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4685: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4686: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4687: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4688: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 4689: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4690: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4691: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4692: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4693: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4694: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4695: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4696: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4697: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4698: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4699: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4700: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4701: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4702: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4703: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4704: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(48), }, 4705: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4706: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4707: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4708: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4709: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4710: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4711: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4712: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4713: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4714: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4715: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4716: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4717: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4718: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4719: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4720: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 4721: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4722: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4723: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4724: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4725: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4726: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4727: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4728: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4729: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4730: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4731: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4732: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4733: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4734: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4735: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4736: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2112), }, 4737: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4738: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4739: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4740: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4741: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4742: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4743: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4744: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4745: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4746: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4747: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4748: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4749: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4750: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4751: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4752: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 4753: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4754: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4755: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4756: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4757: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4758: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4759: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4760: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4761: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4762: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4763: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4764: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4765: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4766: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4767: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4768: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(44), }, 4769: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4770: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4771: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4772: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4773: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4774: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4775: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4776: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4777: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4778: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4779: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4780: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4781: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4782: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4783: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4784: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(36), }, 4785: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4786: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4787: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4788: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4789: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4790: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4791: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4792: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4793: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4794: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4795: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4796: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4797: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4798: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4799: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4800: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(384), }, 4801: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4802: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4803: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4804: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4805: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4806: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4807: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4808: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4809: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4810: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4811: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4812: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4813: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4814: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4815: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4816: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 4817: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4818: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4819: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4820: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4821: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4822: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4823: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4824: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4825: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4826: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4827: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4828: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4829: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4830: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4831: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4832: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 4833: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4834: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4835: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4836: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4837: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4838: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4839: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4840: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4841: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4842: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4843: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4844: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4845: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4846: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4847: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4848: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 4849: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4850: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4851: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4852: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4853: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4854: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4855: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4856: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4857: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4858: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4859: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4860: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4861: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4862: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4863: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4864: {}, 4865: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4866: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4867: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4868: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4869: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4870: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4871: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4872: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4873: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4874: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4875: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4876: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4877: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4878: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4879: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4880: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 4881: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4882: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4883: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4884: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4885: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4886: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4887: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4888: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4889: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4890: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4891: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4892: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4893: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4894: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4895: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4896: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 4897: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4898: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4899: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4900: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4901: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4902: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4903: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4904: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4905: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4906: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4907: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4908: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4909: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4910: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4911: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4912: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(28), }, 4913: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4914: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4915: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4916: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4917: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4918: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4919: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4920: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4921: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4922: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4923: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4924: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4925: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4926: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4927: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4928: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(60), }, 4929: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4930: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4931: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4932: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4933: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4934: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4935: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4936: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 4937: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4938: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4939: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4940: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4941: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4942: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4943: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4944: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 4945: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4946: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4947: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4948: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4949: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4950: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4951: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4952: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4953: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4954: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4955: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4956: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4957: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4958: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4959: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4960: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(40), }, 4961: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4962: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4963: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4964: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4965: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4966: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4967: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4968: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 4969: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4970: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4971: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4972: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4973: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4974: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4975: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4976: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 4977: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4978: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4979: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4980: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4981: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4982: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4983: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4984: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 4985: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4986: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4987: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4988: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 4989: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4990: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4991: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4992: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2368), }, 4993: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4994: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 4995: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 4996: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 4997: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 4998: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 4999: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5000: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5001: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5002: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5003: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5004: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5005: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5006: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5007: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5008: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 5009: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5010: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5011: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5012: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5013: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5014: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5015: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5016: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5017: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5018: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5019: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5020: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5021: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5022: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5023: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5024: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(16), }, 5025: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5026: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5027: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5028: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5029: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5030: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5031: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5032: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5033: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5034: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5035: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5036: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5037: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5038: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5039: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5040: { FState: uint8(8), FWidth: uint8(10), }, 5041: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5042: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5043: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5044: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5045: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5046: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5047: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5048: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5049: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5050: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5051: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5052: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5053: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5054: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5055: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5056: { FState: uint8(10), FWidth: uint8(10), FParam: uint32(64), }, 5057: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5058: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5059: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5060: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5061: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5062: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5063: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5064: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5065: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5066: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5067: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5068: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5069: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5070: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5071: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5072: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 5073: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5074: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5075: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5076: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5077: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5078: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5079: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5080: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5081: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5082: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5083: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5084: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5085: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5086: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5087: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5088: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 5089: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5090: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5091: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5092: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5093: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5094: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5095: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5096: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5097: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5098: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5099: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5100: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5101: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5102: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5103: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5104: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 5105: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5106: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5107: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5108: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5109: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5110: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5111: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5112: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5113: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5114: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5115: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5116: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5117: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5118: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5119: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5120: {}, 5121: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5122: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5123: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5124: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5125: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5126: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5127: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5128: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5129: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5130: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5131: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5132: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5133: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5134: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5135: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5136: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 5137: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5138: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5139: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5140: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5141: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5142: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5143: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5144: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5145: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5146: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5147: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5148: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5149: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5150: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5151: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5152: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 5153: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5154: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5155: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5156: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5157: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5158: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5159: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5160: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5161: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5162: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5163: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5164: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5165: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5166: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5167: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5168: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 5169: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5170: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5171: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5172: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5173: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5174: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5175: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5176: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5177: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5178: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5179: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5180: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5181: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5182: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5183: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5184: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(18), }, 5185: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5186: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5187: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5188: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5189: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5190: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5191: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5192: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5193: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5194: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5195: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5196: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5197: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5198: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5199: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5200: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 5201: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5202: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5203: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5204: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5205: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5206: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5207: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5208: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5209: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5210: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5211: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5212: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5213: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5214: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5215: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5216: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(17), }, 5217: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5218: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5219: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5220: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5221: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5222: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5223: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5224: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5225: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5226: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5227: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5228: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5229: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5230: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5231: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5232: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 5233: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5234: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5235: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5236: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5237: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5238: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5239: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5240: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5241: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5242: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5243: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5244: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5245: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5246: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5247: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5248: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(1984), }, 5249: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5250: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5251: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5252: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5253: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5254: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5255: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5256: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5257: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5258: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5259: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5260: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5261: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5262: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5263: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5264: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 5265: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5266: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5267: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5268: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5269: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5270: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5271: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5272: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5273: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5274: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5275: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5276: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5277: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5278: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5279: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5280: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(50), }, 5281: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5282: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5283: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5284: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5285: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5286: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5287: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5288: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5289: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5290: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5291: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5292: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5293: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5294: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5295: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5296: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(34), }, 5297: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5298: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5299: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5300: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5301: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5302: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5303: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5304: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5305: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5306: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5307: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5308: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5309: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5310: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5311: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5312: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1728), }, 5313: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5314: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5315: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5316: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5317: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5318: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5319: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5320: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5321: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5322: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5323: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5324: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5325: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5326: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5327: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5328: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 5329: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5330: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5331: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5332: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5333: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5334: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5335: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5336: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5337: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5338: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5339: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5340: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5341: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5342: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5343: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5344: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 5345: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5346: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5347: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5348: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5349: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5350: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5351: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5352: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5353: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5354: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5355: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5356: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5357: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5358: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5359: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5360: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 5361: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5362: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5363: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5364: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5365: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5366: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5367: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5368: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5369: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5370: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5371: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5372: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5373: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5374: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5375: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5376: {}, 5377: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5378: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5379: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5380: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5381: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5382: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5383: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5384: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5385: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5386: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5387: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5388: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5389: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5390: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5391: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5392: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 5393: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5394: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5395: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5396: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5397: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5398: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5399: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5400: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5401: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5402: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5403: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5404: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5405: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5406: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5407: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5408: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 5409: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5410: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5411: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5412: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5413: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5414: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5415: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5416: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5417: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5418: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5419: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5420: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5421: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5422: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5423: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5424: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(26), }, 5425: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5426: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5427: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5428: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5429: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5430: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5431: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5432: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5433: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5434: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5435: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5436: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5437: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5438: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5439: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5440: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1472), }, 5441: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5442: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5443: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5444: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5445: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5446: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5447: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5448: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5449: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5450: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5451: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5452: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5453: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5454: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5455: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5456: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 5457: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5458: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5459: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5460: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5461: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5462: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5463: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5464: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5465: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5466: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5467: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5468: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5469: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5470: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5471: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5472: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(32), }, 5473: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5474: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5475: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5476: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5477: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5478: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5479: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5480: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5481: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5482: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5483: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5484: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5485: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5486: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5487: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5488: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 5489: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5490: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5491: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5492: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5493: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5494: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5495: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5496: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5497: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5498: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5499: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5500: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5501: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5502: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5503: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5504: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1920), }, 5505: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5506: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5507: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5508: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5509: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5510: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5511: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5512: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5513: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5514: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5515: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5516: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5517: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5518: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5519: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5520: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 5521: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5522: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5523: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5524: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5525: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5526: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5527: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5528: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5529: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5530: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5531: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5532: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5533: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5534: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5535: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5536: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(61), }, 5537: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5538: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5539: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5540: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5541: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5542: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5543: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5544: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5545: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5546: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5547: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5548: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5549: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5550: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5551: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5552: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(42), }, 5553: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5554: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5555: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5556: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5557: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5558: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5559: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5560: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5561: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5562: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5563: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5564: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5565: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5566: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5567: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5568: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1088), }, 5569: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5570: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5571: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5572: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5573: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5574: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5575: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5576: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5577: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5578: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5579: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5580: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5581: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5582: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5583: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5584: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 5585: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5586: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5587: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5588: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5589: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5590: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5591: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5592: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5593: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5594: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5595: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5596: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5597: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5598: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5599: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5600: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 5601: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5602: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5603: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5604: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5605: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5606: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5607: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5608: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5609: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5610: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5611: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5612: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5613: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5614: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5615: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5616: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 5617: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5618: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5619: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5620: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5621: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5622: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5623: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5624: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5625: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5626: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5627: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5628: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5629: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5630: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5631: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5632: {}, 5633: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5634: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5635: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5636: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5637: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5638: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5639: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5640: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5641: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5642: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5643: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5644: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5645: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5646: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5647: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5648: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 5649: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5650: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5651: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5652: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5653: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5654: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5655: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5656: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5657: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5658: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5659: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5660: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5661: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5662: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5663: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5664: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 5665: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5666: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5667: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5668: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5669: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5670: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5671: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5672: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5673: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5674: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5675: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5676: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5677: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5678: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5679: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5680: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 5681: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5682: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5683: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5684: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5685: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5686: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5687: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5688: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5689: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5690: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5691: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5692: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5693: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5694: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5695: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5696: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(832), }, 5697: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5698: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5699: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5700: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5701: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5702: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5703: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5704: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5705: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5706: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5707: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5708: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5709: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5710: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5711: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5712: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 5713: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5714: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5715: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5716: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5717: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5718: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5719: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5720: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5721: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5722: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5723: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5724: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5725: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5726: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5727: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5728: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(62), }, 5729: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5730: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5731: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5732: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5733: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5734: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5735: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5736: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5737: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5738: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5739: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5740: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5741: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5742: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5743: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5744: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 5745: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5746: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5747: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5748: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5749: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5750: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5751: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5752: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5753: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5754: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5755: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5756: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5757: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5758: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5759: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5760: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2240), }, 5761: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5762: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5763: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5764: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5765: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5766: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5767: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5768: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5769: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5770: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5771: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5772: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5773: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5774: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5775: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5776: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 5777: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5778: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5779: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5780: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5781: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5782: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5783: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5784: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5785: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5786: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5787: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5788: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5789: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5790: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5791: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5792: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(46), }, 5793: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5794: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5795: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5796: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5797: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5798: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5799: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5800: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5801: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5802: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5803: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5804: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5805: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5806: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5807: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5808: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(38), }, 5809: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5810: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5811: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5812: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5813: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5814: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5815: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5816: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5817: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5818: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5819: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5820: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5821: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5822: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5823: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5824: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(576), }, 5825: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5826: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5827: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5828: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5829: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5830: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5831: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5832: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5833: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5834: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5835: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5836: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5837: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5838: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5839: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5840: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 5841: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5842: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5843: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5844: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5845: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5846: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5847: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5848: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5849: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5850: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5851: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5852: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5853: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5854: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5855: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5856: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 5857: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5858: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5859: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5860: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5861: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5862: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5863: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5864: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5865: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5866: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5867: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5868: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5869: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5870: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5871: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5872: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 5873: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5874: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5875: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5876: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5877: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5878: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5879: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5880: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5881: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5882: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5883: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5884: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5885: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5886: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5887: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5888: {}, 5889: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5890: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5891: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5892: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5893: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5894: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5895: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5896: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5897: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5898: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5899: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5900: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5901: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5902: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5903: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5904: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 5905: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5906: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5907: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5908: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5909: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5910: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5911: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5912: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5913: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5914: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5915: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5916: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5917: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5918: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5919: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5920: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 5921: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5922: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5923: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5924: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5925: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5926: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5927: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5928: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5929: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5930: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5931: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5932: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5933: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5934: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5935: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5936: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(19), }, 5937: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5938: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5939: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5940: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5941: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5942: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5943: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5944: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5945: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5946: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5947: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5948: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5949: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5950: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5951: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5952: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(24), }, 5953: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5954: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5955: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5956: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5957: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5958: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5959: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5960: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 5961: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5962: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5963: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5964: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5965: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5966: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5967: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5968: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 5969: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5970: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5971: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5972: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5973: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5974: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5975: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5976: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 5977: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5978: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5979: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5980: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5981: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5982: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5983: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5984: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(22), }, 5985: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5986: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5987: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5988: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 5989: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5990: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5991: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5992: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 5993: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5994: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 5995: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 5996: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 5997: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 5998: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 5999: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6000: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 6001: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6002: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6003: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6004: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6005: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6006: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6007: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6008: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6009: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6010: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6011: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6012: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6013: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6014: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6015: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6016: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2496), }, 6017: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6018: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6019: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6020: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6021: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6022: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6023: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6024: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6025: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6026: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6027: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6028: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6029: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6030: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6031: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6032: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 6033: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6034: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6035: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6036: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6037: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6038: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6039: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6040: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6041: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6042: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6043: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6044: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6045: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6046: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6047: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6048: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(16), }, 6049: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6050: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6051: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6052: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6053: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6054: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6055: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6056: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6057: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6058: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6059: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6060: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6061: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6062: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6063: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6064: { FState: uint8(8), FWidth: uint8(10), }, 6065: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6066: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6067: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6068: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6069: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6070: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6071: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6072: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6073: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6074: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6075: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6076: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6077: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6078: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6079: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6080: { FState: uint8(10), FWidth: uint8(10), FParam: uint32(64), }, 6081: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6082: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6083: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6084: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6085: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6086: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6087: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6088: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6089: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6090: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6091: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6092: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6093: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6094: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6095: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6096: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 6097: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6098: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6099: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6100: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6101: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6102: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6103: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6104: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6105: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6106: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6107: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6108: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6109: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6110: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6111: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6112: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 6113: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6114: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6115: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6116: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6117: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6118: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6119: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6120: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6121: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6122: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6123: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6124: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6125: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6126: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6127: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6128: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 6129: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6130: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6131: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6132: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6133: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6134: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6135: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6136: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6137: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6138: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6139: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6140: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6141: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6142: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6143: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6144: { FState: uint8(12), FWidth: uint8(11), }, 6145: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6146: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6147: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6148: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6149: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6150: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6151: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6152: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6153: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6154: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6155: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6156: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6157: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6158: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6159: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6160: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 6161: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6162: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6163: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6164: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6165: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6166: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6167: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6168: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6169: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6170: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6171: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6172: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6173: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6174: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6175: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6176: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 6177: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6178: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6179: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6180: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6181: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6182: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6183: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6184: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6185: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6186: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6187: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6188: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6189: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6190: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6191: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6192: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 6193: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6194: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6195: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6196: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6197: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6198: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6199: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6200: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6201: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6202: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6203: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6204: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6205: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6206: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6207: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6208: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(18), }, 6209: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6210: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6211: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6212: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6213: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6214: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6215: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6216: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6217: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6218: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6219: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6220: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6221: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6222: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6223: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6224: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 6225: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6226: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6227: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6228: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6229: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6230: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6231: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6232: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6233: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6234: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6235: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6236: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6237: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6238: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6239: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6240: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(17), }, 6241: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6242: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6243: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6244: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6245: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6246: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6247: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6248: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6249: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6250: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6251: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6252: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6253: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6254: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6255: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6256: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 6257: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6258: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6259: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6260: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6261: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6262: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6263: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6264: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6265: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6266: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6267: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6268: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6269: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6270: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6271: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6272: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1792), }, 6273: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6274: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6275: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6276: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6277: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6278: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6279: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6280: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6281: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6282: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6283: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6284: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6285: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6286: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6287: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6288: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 6289: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6290: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6291: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6292: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6293: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6294: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6295: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6296: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6297: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6298: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6299: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6300: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6301: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6302: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6303: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6304: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(23), }, 6305: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6306: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6307: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6308: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6309: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6310: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6311: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6312: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6313: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6314: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6315: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6316: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6317: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6318: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6319: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6320: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(20), }, 6321: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6322: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6323: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6324: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6325: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6326: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6327: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6328: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6329: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6330: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6331: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6332: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6333: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6334: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6335: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6336: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(25), }, 6337: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6338: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6339: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6340: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6341: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6342: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6343: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6344: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6345: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6346: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6347: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6348: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6349: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6350: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6351: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6352: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 6353: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6354: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6355: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6356: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6357: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6358: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6359: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6360: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6361: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6362: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6363: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6364: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6365: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6366: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6367: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6368: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 6369: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6370: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6371: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6372: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6373: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6374: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6375: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6376: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6377: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6378: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6379: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6380: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6381: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6382: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6383: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6384: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 6385: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6386: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6387: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6388: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6389: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6390: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6391: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6392: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6393: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6394: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6395: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6396: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6397: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6398: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6399: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6400: {}, 6401: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6402: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6403: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6404: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6405: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6406: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6407: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6408: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6409: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6410: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6411: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6412: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6413: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6414: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6415: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6416: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 6417: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6418: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6419: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6420: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6421: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6422: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6423: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6424: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6425: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6426: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6427: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6428: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6429: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6430: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6431: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6432: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 6433: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6434: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6435: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6436: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6437: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6438: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6439: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6440: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6441: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6442: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6443: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6444: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6445: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6446: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6447: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6448: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(192), }, 6449: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6450: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6451: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6452: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6453: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6454: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6455: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6456: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6457: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6458: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6459: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6460: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6461: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6462: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6463: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6464: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1344), }, 6465: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6466: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6467: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6468: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6469: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6470: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6471: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6472: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6473: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6474: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6475: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6476: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6477: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6478: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6479: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6480: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 6481: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6482: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6483: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6484: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6485: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6486: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6487: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6488: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6489: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6490: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6491: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6492: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6493: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6494: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6495: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6496: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(31), }, 6497: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6498: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6499: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6500: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6501: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6502: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6503: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6504: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6505: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6506: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6507: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6508: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6509: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6510: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6511: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6512: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 6513: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6514: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6515: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6516: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6517: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6518: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6519: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6520: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6521: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6522: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6523: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6524: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6525: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6526: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6527: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6528: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1856), }, 6529: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6530: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6531: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6532: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6533: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6534: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6535: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6536: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6537: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6538: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6539: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6540: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6541: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6542: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6543: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6544: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 6545: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6546: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6547: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6548: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6549: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6550: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6551: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6552: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6553: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6554: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6555: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6556: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6557: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6558: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6559: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6560: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(58), }, 6561: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6562: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6563: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6564: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6565: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6566: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6567: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6568: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6569: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6570: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6571: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6572: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6573: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6574: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6575: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6576: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(21), }, 6577: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6578: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6579: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6580: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6581: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6582: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6583: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6584: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6585: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6586: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6587: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6588: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6589: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6590: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6591: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6592: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(960), }, 6593: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6594: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6595: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6596: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6597: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6598: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6599: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6600: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6601: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6602: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6603: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6604: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6605: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6606: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6607: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6608: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 6609: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6610: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6611: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6612: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6613: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6614: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6615: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6616: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6617: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6618: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6619: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6620: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6621: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6622: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6623: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6624: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 6625: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6626: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6627: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6628: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6629: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6630: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6631: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6632: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6633: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6634: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6635: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6636: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6637: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6638: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6639: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6640: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 6641: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6642: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6643: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6644: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6645: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6646: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6647: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6648: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6649: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6650: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6651: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6652: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6653: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6654: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6655: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6656: {}, 6657: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6658: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6659: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6660: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6661: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6662: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6663: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6664: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6665: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6666: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6667: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6668: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6669: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6670: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6671: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6672: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 6673: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6674: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6675: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6676: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6677: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6678: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6679: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6680: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6681: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6682: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6683: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6684: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6685: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6686: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6687: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6688: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 6689: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6690: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6691: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6692: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6693: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6694: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6695: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6696: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6697: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6698: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6699: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6700: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6701: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6702: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6703: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6704: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 6705: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6706: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6707: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6708: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6709: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6710: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6711: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6712: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6713: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6714: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6715: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6716: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6717: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6718: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6719: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6720: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(704), }, 6721: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6722: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6723: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6724: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6725: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6726: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6727: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6728: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6729: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6730: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6731: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6732: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6733: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6734: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6735: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6736: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 6737: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6738: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6739: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6740: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6741: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6742: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6743: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6744: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6745: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6746: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6747: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6748: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6749: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6750: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6751: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6752: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(49), }, 6753: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6754: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6755: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6756: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6757: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6758: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6759: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6760: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6761: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6762: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6763: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6764: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6765: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6766: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6767: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6768: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 6769: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6770: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6771: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6772: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6773: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6774: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6775: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6776: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6777: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6778: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6779: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6780: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6781: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6782: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6783: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6784: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2176), }, 6785: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6786: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6787: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6788: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6789: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6790: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6791: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6792: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6793: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6794: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6795: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6796: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6797: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6798: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6799: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6800: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 6801: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6802: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6803: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6804: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6805: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6806: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6807: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6808: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6809: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6810: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6811: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6812: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6813: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6814: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6815: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6816: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(45), }, 6817: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6818: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6819: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6820: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6821: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6822: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6823: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6824: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6825: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6826: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6827: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6828: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6829: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6830: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6831: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6832: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(37), }, 6833: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6834: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6835: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6836: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6837: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6838: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6839: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6840: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6841: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6842: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6843: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6844: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6845: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6846: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6847: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6848: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(448), }, 6849: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6850: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6851: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6852: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6853: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6854: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6855: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6856: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6857: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6858: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6859: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6860: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6861: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6862: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6863: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6864: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 6865: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6866: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6867: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6868: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6869: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6870: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6871: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6872: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6873: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6874: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6875: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6876: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6877: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6878: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6879: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6880: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 6881: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6882: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6883: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6884: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6885: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6886: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6887: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6888: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6889: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6890: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6891: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6892: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6893: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6894: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6895: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6896: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 6897: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6898: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6899: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6900: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6901: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6902: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6903: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6904: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6905: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6906: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6907: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6908: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6909: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6910: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6911: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6912: {}, 6913: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6914: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6915: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6916: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6917: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6918: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6919: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6920: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6921: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6922: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6923: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6924: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6925: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6926: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6927: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6928: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 6929: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6930: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6931: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6932: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6933: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6934: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6935: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6936: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6937: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6938: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6939: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6940: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6941: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6942: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6943: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6944: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 6945: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6946: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6947: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6948: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6949: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6950: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6951: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6952: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 6953: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6954: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6955: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6956: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6957: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6958: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6959: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6960: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(29), }, 6961: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6962: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6963: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6964: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6965: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6966: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6967: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6968: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 6969: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6970: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6971: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6972: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6973: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6974: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6975: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6976: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1600), }, 6977: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6978: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6979: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6980: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6981: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6982: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6983: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6984: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 6985: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6986: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6987: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6988: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 6989: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6990: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6991: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6992: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 6993: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6994: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 6995: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 6996: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 6997: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 6998: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 6999: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7000: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7001: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7002: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7003: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7004: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7005: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7006: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7007: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7008: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(41), }, 7009: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7010: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7011: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7012: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7013: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7014: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7015: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7016: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7017: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7018: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7019: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7020: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7021: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7022: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7023: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7024: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 7025: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7026: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7027: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7028: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7029: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7030: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7031: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7032: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7033: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7034: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7035: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7036: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7037: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7038: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7039: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7040: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2432), }, 7041: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7042: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7043: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7044: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7045: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7046: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7047: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7048: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7049: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7050: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7051: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7052: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7053: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7054: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7055: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7056: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 7057: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7058: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7059: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7060: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7061: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7062: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7063: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7064: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7065: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7066: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7067: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7068: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7069: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7070: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7071: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7072: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(16), }, 7073: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7074: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7075: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7076: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7077: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7078: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7079: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7080: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7081: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7082: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7083: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7084: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7085: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7086: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7087: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7088: { FState: uint8(8), FWidth: uint8(10), }, 7089: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7090: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7091: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7092: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7093: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7094: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7095: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7096: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7097: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7098: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7099: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7100: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7101: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7102: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7103: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7104: { FState: uint8(10), FWidth: uint8(10), FParam: uint32(64), }, 7105: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7106: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7107: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7108: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7109: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7110: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7111: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7112: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7113: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7114: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7115: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7116: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7117: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7118: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7119: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7120: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 7121: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7122: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7123: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7124: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7125: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7126: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7127: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7128: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7129: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7130: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7131: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7132: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7133: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7134: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7135: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7136: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 7137: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7138: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7139: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7140: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7141: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7142: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7143: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7144: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7145: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7146: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7147: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7148: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7149: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7150: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7151: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7152: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 7153: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7154: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7155: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7156: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7157: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7158: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7159: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7160: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7161: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7162: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7163: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7164: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7165: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7166: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7167: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7168: {}, 7169: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7170: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7171: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7172: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7173: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7174: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7175: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7176: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7177: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7178: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7179: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7180: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7181: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7182: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7183: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7184: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 7185: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7186: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7187: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7188: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7189: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7190: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7191: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7192: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7193: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7194: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7195: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7196: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7197: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7198: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7199: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7200: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 7201: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7202: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7203: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7204: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7205: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7206: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7207: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7208: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7209: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7210: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7211: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7212: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7213: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7214: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7215: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7216: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 7217: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7218: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7219: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7220: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7221: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7222: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7223: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7224: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7225: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7226: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7227: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7228: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7229: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7230: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7231: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7232: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(18), }, 7233: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7234: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7235: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7236: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7237: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7238: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7239: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7240: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7241: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7242: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7243: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7244: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7245: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7246: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7247: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7248: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 7249: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7250: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7251: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7252: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7253: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7254: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7255: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7256: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7257: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7258: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7259: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7260: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7261: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7262: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7263: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7264: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(17), }, 7265: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7266: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7267: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7268: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7269: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7270: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7271: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7272: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7273: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7274: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7275: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7276: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7277: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7278: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7279: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7280: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 7281: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7282: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7283: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7284: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7285: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7286: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7287: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7288: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7289: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7290: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7291: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7292: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7293: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7294: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7295: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7296: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2048), }, 7297: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7298: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7299: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7300: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7301: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7302: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7303: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7304: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7305: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7306: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7307: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7308: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7309: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7310: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7311: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7312: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 7313: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7314: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7315: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7316: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7317: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7318: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7319: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7320: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7321: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7322: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7323: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7324: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7325: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7326: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7327: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7328: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(51), }, 7329: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7330: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7331: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7332: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7333: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7334: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7335: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7336: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7337: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7338: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7339: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7340: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7341: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7342: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7343: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7344: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(35), }, 7345: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7346: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7347: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7348: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7349: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7350: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7351: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7352: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7353: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7354: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7355: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7356: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7357: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7358: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7359: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7360: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(320), }, 7361: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7362: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7363: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7364: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7365: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7366: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7367: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7368: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7369: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7370: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7371: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7372: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7373: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7374: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7375: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7376: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 7377: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7378: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7379: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7380: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7381: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7382: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7383: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7384: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7385: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7386: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7387: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7388: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7389: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7390: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7391: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7392: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 7393: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7394: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7395: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7396: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7397: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7398: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7399: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7400: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7401: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7402: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7403: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7404: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7405: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7406: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7407: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7408: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 7409: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7410: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7411: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7412: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7413: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7414: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7415: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7416: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7417: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7418: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7419: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7420: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7421: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7422: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7423: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7424: {}, 7425: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7426: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7427: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7428: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7429: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7430: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7431: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7432: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7433: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7434: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7435: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7436: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7437: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7438: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7439: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7440: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 7441: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7442: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7443: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7444: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7445: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7446: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7447: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7448: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7449: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7450: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7451: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7452: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7453: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7454: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7455: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7456: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 7457: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7458: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7459: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7460: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7461: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7462: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7463: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7464: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7465: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7466: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7467: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7468: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7469: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7470: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7471: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7472: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(27), }, 7473: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7474: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7475: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7476: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7477: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7478: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7479: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7480: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7481: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7482: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7483: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7484: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7485: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7486: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7487: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7488: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(59), }, 7489: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7490: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7491: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7492: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7493: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7494: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7495: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7496: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7497: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7498: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7499: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7500: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7501: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7502: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7503: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7504: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 7505: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7506: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7507: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7508: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7509: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7510: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7511: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7512: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7513: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7514: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7515: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7516: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7517: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7518: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7519: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7520: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(33), }, 7521: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7522: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7523: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7524: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7525: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7526: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7527: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7528: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7529: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7530: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7531: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7532: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7533: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7534: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7535: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7536: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 7537: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7538: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7539: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7540: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7541: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7542: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7543: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7544: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7545: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7546: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7547: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7548: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7549: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7550: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7551: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7552: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1920), }, 7553: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7554: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7555: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7556: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7557: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7558: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7559: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7560: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7561: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7562: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7563: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7564: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7565: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7566: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7567: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7568: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 7569: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7570: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7571: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7572: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7573: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7574: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7575: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7576: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7577: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7578: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7579: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7580: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7581: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7582: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7583: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7584: { FState: uint8(10), FWidth: uint8(12), FParam: uint32(256), }, 7585: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7586: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7587: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7588: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7589: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7590: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7591: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7592: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7593: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7594: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7595: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7596: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7597: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7598: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7599: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7600: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(43), }, 7601: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7602: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7603: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7604: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7605: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7606: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7607: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7608: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7609: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7610: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7611: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7612: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7613: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7614: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7615: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7616: { FState: uint8(10), FWidth: uint8(13), FParam: uint32(1216), }, 7617: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7618: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7619: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7620: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7621: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7622: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7623: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7624: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7625: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7626: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7627: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7628: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7629: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7630: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7631: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7632: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 7633: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7634: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7635: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7636: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7637: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7638: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7639: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7640: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7641: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7642: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7643: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7644: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7645: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7646: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7647: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7648: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 7649: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7650: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7651: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7652: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7653: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7654: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7655: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7656: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7657: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7658: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7659: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7660: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7661: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7662: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7663: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7664: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 7665: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7666: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7667: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7668: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7669: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7670: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7671: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7672: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7673: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7674: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7675: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7676: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7677: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7678: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7679: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7680: {}, 7681: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7682: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7683: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7684: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7685: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7686: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7687: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7688: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7689: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7690: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7691: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7692: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7693: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7694: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7695: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7696: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 7697: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7698: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7699: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7700: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7701: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7702: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7703: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7704: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7705: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7706: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7707: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7708: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7709: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7710: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7711: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7712: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 7713: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7714: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7715: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7716: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7717: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7718: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7719: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7720: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7721: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7722: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7723: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7724: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7725: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7726: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7727: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7728: { FState: uint8(8), FWidth: uint8(9), FParam: uint32(15), }, 7729: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7730: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7731: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7732: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7733: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7734: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7735: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7736: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7737: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7738: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7739: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7740: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7741: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7742: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7743: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7744: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(55), }, 7745: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7746: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7747: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7748: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7749: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7750: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7751: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7752: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7753: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7754: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7755: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7756: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7757: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7758: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7759: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7760: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 7761: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7762: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7763: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7764: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7765: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7766: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7767: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7768: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7769: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7770: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7771: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7772: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7773: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7774: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7775: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7776: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(63), }, 7777: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7778: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7779: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7780: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7781: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7782: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7783: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7784: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7785: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7786: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7787: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7788: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7789: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7790: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7791: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7792: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 7793: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7794: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7795: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7796: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7797: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7798: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7799: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7800: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7801: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7802: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7803: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7804: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7805: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7806: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7807: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7808: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2304), }, 7809: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7810: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7811: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7812: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7813: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7814: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7815: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7816: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7817: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7818: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7819: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7820: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7821: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7822: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7823: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7824: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 7825: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7826: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7827: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7828: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7829: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7830: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7831: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7832: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7833: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7834: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7835: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7836: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7837: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7838: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7839: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7840: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(47), }, 7841: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7842: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7843: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7844: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7845: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7846: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7847: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7848: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7849: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7850: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7851: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7852: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7853: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7854: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7855: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7856: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(39), }, 7857: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7858: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7859: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7860: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7861: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7862: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7863: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7864: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7865: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7866: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7867: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7868: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7869: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7870: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7871: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7872: { FState: uint8(8), FWidth: uint8(12), FParam: uint32(53), }, 7873: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7874: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7875: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7876: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7877: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7878: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7879: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7880: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7881: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7882: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7883: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7884: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7885: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7886: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7887: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7888: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 7889: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7890: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7891: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7892: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7893: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7894: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7895: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7896: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7897: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7898: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7899: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7900: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7901: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7902: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7903: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7904: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 7905: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7906: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7907: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7908: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7909: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7910: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7911: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7912: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7913: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7914: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7915: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7916: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7917: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7918: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7919: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7920: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 7921: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7922: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7923: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7924: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7925: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7926: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7927: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7928: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7929: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7930: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7931: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7932: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7933: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7934: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7935: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7936: {}, 7937: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7938: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7939: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7940: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7941: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7942: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7943: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7944: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 7945: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7946: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7947: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7948: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7949: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7950: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7951: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7952: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 7953: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7954: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7955: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7956: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7957: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7958: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7959: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7960: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7961: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7962: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7963: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7964: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7965: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7966: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7967: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7968: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(13), }, 7969: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7970: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7971: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7972: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7973: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7974: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7975: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7976: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 7977: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7978: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7979: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7980: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7981: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7982: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7983: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7984: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(19), }, 7985: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7986: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7987: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7988: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 7989: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7990: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7991: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7992: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 7993: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7994: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 7995: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 7996: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 7997: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 7998: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 7999: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8000: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(24), }, 8001: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8002: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8003: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8004: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8005: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8006: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8007: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8008: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 8009: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8010: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8011: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8012: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8013: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8014: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8015: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8016: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 8017: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8018: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8019: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8020: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8021: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8022: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8023: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8024: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 8025: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8026: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8027: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8028: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8029: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8030: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8031: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8032: { FState: uint8(8), FWidth: uint8(11), FParam: uint32(22), }, 8033: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8034: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8035: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8036: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8037: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8038: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8039: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8040: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 8041: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8042: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8043: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8044: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8045: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8046: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8047: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8048: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 8049: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8050: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8051: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8052: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8053: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8054: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8055: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8056: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 8057: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8058: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8059: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8060: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8061: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8062: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8063: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8064: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2560), }, 8065: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8066: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8067: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8068: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8069: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8070: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8071: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8072: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 8073: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8074: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8075: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8076: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8077: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8078: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8079: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8080: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(10), }, 8081: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8082: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8083: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8084: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8085: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8086: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8087: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8088: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 8089: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8090: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8091: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8092: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8093: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8094: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8095: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8096: { FState: uint8(8), FWidth: uint8(10), FParam: uint32(16), }, 8097: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8098: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8099: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8100: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8101: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8102: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8103: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8104: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 8105: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8106: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8107: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8108: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8109: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8110: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8111: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8112: { FState: uint8(8), FWidth: uint8(10), }, 8113: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8114: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8115: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8116: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8117: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8118: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8119: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8120: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 8121: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8122: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8123: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8124: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8125: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8126: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8127: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8128: { FState: uint8(10), FWidth: uint8(10), FParam: uint32(64), }, 8129: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8130: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8131: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8132: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8133: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8134: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8135: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8136: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(9), }, 8137: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8138: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8139: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8140: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8141: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8142: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8143: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8144: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(11), }, 8145: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8146: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8147: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8148: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8149: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8150: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8151: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8152: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 8153: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8154: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8155: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8156: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8157: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8158: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8159: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8160: { FState: uint8(8), FWidth: uint8(8), FParam: uint32(14), }, 8161: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8162: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8163: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8164: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8165: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8166: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8167: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8168: { FState: uint8(8), FWidth: uint8(6), FParam: uint32(8), }, 8169: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8170: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8171: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8172: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8173: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8174: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8175: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8176: { FState: uint8(8), FWidth: uint8(7), FParam: uint32(12), }, 8177: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8178: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8179: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8180: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(6), }, 8181: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8182: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8183: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8184: { FState: uint8(8), FWidth: uint8(5), FParam: uint32(7), }, 8185: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8186: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(1), }, 8187: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, 8188: { FState: uint8(8), FWidth: uint8(4), FParam: uint32(5), }, 8189: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(3), }, 8190: { FState: uint8(8), FWidth: uint8(3), FParam: uint32(4), }, 8191: { FState: uint8(8), FWidth: uint8(2), FParam: uint32(2), }, } /* * The following macros define the majority of the G3/G4 decoder * algorithm using the state tables defined elsewhere. To build * a decoder you need some setup code and some glue code. Note * that you may also need/want to change the way the NeedBits* * macros get input data if, for example, you know the data to be * decoded is properly aligned and oriented (doing so before running * the decoder can be a big performance win). * * Consult the decoder in the TIFF library for an idea of what you * need to define and setup to make use of these definitions. * * NB: to enable a debugging version of these macros define FAX3_DEBUG * before including this file. Trace output goes to stdout. */ /* * Need <=8 or <=16 bits of input data. Unlike viewfax we * cannot use/assume a word-aligned, properly bit swizzled * input data set because data may come from an arbitrarily * aligned, read-only source such as a memory-mapped file. * Note also that the viewfax decoder does not check for * running off the end of the input data buffer. This is * possible for G3-encoded data because it prescans the input * data to count EOL markers, but can cause problems for G4 * data. In any event, we don't prescan and must watch for * running out of data since we can't permit the library to * scan past the end of the input data buffer. * * Finally, note that we must handle remaindered data at the end * of a strip specially. The coder asks for a fixed number of * bits when scanning for the next code. This may be more bits * than are actually present in the data stream. If we appear * to run out of data but still have some number of valid bits * remaining then we makeup the requested amount with zeros and * return successfully. If the returned data is incorrect then * we should be called again and get a premature EOF error; * otherwise we should get the right answer. */ /* * Append a run to the run length array for the * current row and reset decoding state. */ /* * Synchronize input decoding at the start of each * row by scanning for an EOL (if appropriate) and * skipping any trash data that might be present * after a decoding error. Note that the decoding * done elsewhere that recognizes an EOL only consumes * 11 consecutive zero bits. This means that if EOLcnt * is non-zero then we still need to scan for the final flag * bit that is part of the EOL code. */ /* * Cleanup the array of runs after decoding a row. * We adjust final runs to insure the user buffer is not * overwritten and/or undecoded area is white filled. */ /* * Decode a line of 1D-encoded data. * * The line expanders are written as macros so that they can be reused * but still have direct access to the local variables of the "calling" * function. * * Note that unlike the original version we have to explicitly test for * a0 >= lastx after each black/white run is decoded. This is because * the original code depended on the input data being zero-padded to * insure the decoder recognized an EOL before running out of data. */ /* * Update the value of b1 using the array * of runs for the reference line. */ // C documentation // // /* // * Expand a row of 2D-encoded data. // */ var XTIFFFaxMainTable = [128]TTIFFFaxTabEnt{ 0: { FState: uint8(12), FWidth: uint8(7), }, 1: { FState: uint8(3), FWidth: uint8(1), }, 2: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 3: { FState: uint8(3), FWidth: uint8(1), }, 4: { FState: uint8(2), FWidth: uint8(3), }, 5: { FState: uint8(3), FWidth: uint8(1), }, 6: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 7: { FState: uint8(3), FWidth: uint8(1), }, 8: { FState: uint8(1), FWidth: uint8(4), }, 9: { FState: uint8(3), FWidth: uint8(1), }, 10: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 11: { FState: uint8(3), FWidth: uint8(1), }, 12: { FState: uint8(2), FWidth: uint8(3), }, 13: { FState: uint8(3), FWidth: uint8(1), }, 14: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 15: { FState: uint8(3), FWidth: uint8(1), }, 16: { FState: uint8(5), FWidth: uint8(6), FParam: uint32(2), }, 17: { FState: uint8(3), FWidth: uint8(1), }, 18: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 19: { FState: uint8(3), FWidth: uint8(1), }, 20: { FState: uint8(2), FWidth: uint8(3), }, 21: { FState: uint8(3), FWidth: uint8(1), }, 22: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 23: { FState: uint8(3), FWidth: uint8(1), }, 24: { FState: uint8(1), FWidth: uint8(4), }, 25: { FState: uint8(3), FWidth: uint8(1), }, 26: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 27: { FState: uint8(3), FWidth: uint8(1), }, 28: { FState: uint8(2), FWidth: uint8(3), }, 29: { FState: uint8(3), FWidth: uint8(1), }, 30: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 31: { FState: uint8(3), FWidth: uint8(1), }, 32: { FState: uint8(5), FWidth: uint8(7), FParam: uint32(3), }, 33: { FState: uint8(3), FWidth: uint8(1), }, 34: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 35: { FState: uint8(3), FWidth: uint8(1), }, 36: { FState: uint8(2), FWidth: uint8(3), }, 37: { FState: uint8(3), FWidth: uint8(1), }, 38: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 39: { FState: uint8(3), FWidth: uint8(1), }, 40: { FState: uint8(1), FWidth: uint8(4), }, 41: { FState: uint8(3), FWidth: uint8(1), }, 42: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 43: { FState: uint8(3), FWidth: uint8(1), }, 44: { FState: uint8(2), FWidth: uint8(3), }, 45: { FState: uint8(3), FWidth: uint8(1), }, 46: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 47: { FState: uint8(3), FWidth: uint8(1), }, 48: { FState: uint8(4), FWidth: uint8(6), FParam: uint32(2), }, 49: { FState: uint8(3), FWidth: uint8(1), }, 50: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 51: { FState: uint8(3), FWidth: uint8(1), }, 52: { FState: uint8(2), FWidth: uint8(3), }, 53: { FState: uint8(3), FWidth: uint8(1), }, 54: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 55: { FState: uint8(3), FWidth: uint8(1), }, 56: { FState: uint8(1), FWidth: uint8(4), }, 57: { FState: uint8(3), FWidth: uint8(1), }, 58: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 59: { FState: uint8(3), FWidth: uint8(1), }, 60: { FState: uint8(2), FWidth: uint8(3), }, 61: { FState: uint8(3), FWidth: uint8(1), }, 62: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 63: { FState: uint8(3), FWidth: uint8(1), }, 64: { FState: uint8(6), FWidth: uint8(7), }, 65: { FState: uint8(3), FWidth: uint8(1), }, 66: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 67: { FState: uint8(3), FWidth: uint8(1), }, 68: { FState: uint8(2), FWidth: uint8(3), }, 69: { FState: uint8(3), FWidth: uint8(1), }, 70: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 71: { FState: uint8(3), FWidth: uint8(1), }, 72: { FState: uint8(1), FWidth: uint8(4), }, 73: { FState: uint8(3), FWidth: uint8(1), }, 74: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 75: { FState: uint8(3), FWidth: uint8(1), }, 76: { FState: uint8(2), FWidth: uint8(3), }, 77: { FState: uint8(3), FWidth: uint8(1), }, 78: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 79: { FState: uint8(3), FWidth: uint8(1), }, 80: { FState: uint8(5), FWidth: uint8(6), FParam: uint32(2), }, 81: { FState: uint8(3), FWidth: uint8(1), }, 82: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 83: { FState: uint8(3), FWidth: uint8(1), }, 84: { FState: uint8(2), FWidth: uint8(3), }, 85: { FState: uint8(3), FWidth: uint8(1), }, 86: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 87: { FState: uint8(3), FWidth: uint8(1), }, 88: { FState: uint8(1), FWidth: uint8(4), }, 89: { FState: uint8(3), FWidth: uint8(1), }, 90: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 91: { FState: uint8(3), FWidth: uint8(1), }, 92: { FState: uint8(2), FWidth: uint8(3), }, 93: { FState: uint8(3), FWidth: uint8(1), }, 94: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 95: { FState: uint8(3), FWidth: uint8(1), }, 96: { FState: uint8(4), FWidth: uint8(7), FParam: uint32(3), }, 97: { FState: uint8(3), FWidth: uint8(1), }, 98: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 99: { FState: uint8(3), FWidth: uint8(1), }, 100: { FState: uint8(2), FWidth: uint8(3), }, 101: { FState: uint8(3), FWidth: uint8(1), }, 102: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 103: { FState: uint8(3), FWidth: uint8(1), }, 104: { FState: uint8(1), FWidth: uint8(4), }, 105: { FState: uint8(3), FWidth: uint8(1), }, 106: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 107: { FState: uint8(3), FWidth: uint8(1), }, 108: { FState: uint8(2), FWidth: uint8(3), }, 109: { FState: uint8(3), FWidth: uint8(1), }, 110: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 111: { FState: uint8(3), FWidth: uint8(1), }, 112: { FState: uint8(4), FWidth: uint8(6), FParam: uint32(2), }, 113: { FState: uint8(3), FWidth: uint8(1), }, 114: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 115: { FState: uint8(3), FWidth: uint8(1), }, 116: { FState: uint8(2), FWidth: uint8(3), }, 117: { FState: uint8(3), FWidth: uint8(1), }, 118: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 119: { FState: uint8(3), FWidth: uint8(1), }, 120: { FState: uint8(1), FWidth: uint8(4), }, 121: { FState: uint8(3), FWidth: uint8(1), }, 122: { FState: uint8(5), FWidth: uint8(3), FParam: uint32(1), }, 123: { FState: uint8(3), FWidth: uint8(1), }, 124: { FState: uint8(2), FWidth: uint8(3), }, 125: { FState: uint8(3), FWidth: uint8(1), }, 126: { FState: uint8(4), FWidth: uint8(3), FParam: uint32(1), }, 127: { FState: uint8(3), FWidth: uint8(1), }, } var XTIFFFaxWhiteCodes = [109]Ttableentry{ 0: { Flength: uint16(8), Fcode: uint16(0x35), }, 1: { Flength: uint16(6), Fcode: uint16(0x7), Frunlen: int16(1), }, 2: { Flength: uint16(4), Fcode: uint16(0x7), Frunlen: int16(2), }, 3: { Flength: uint16(4), Fcode: uint16(0x8), Frunlen: int16(3), }, 4: { Flength: uint16(4), Fcode: uint16(0xB), Frunlen: int16(4), }, 5: { Flength: uint16(4), Fcode: uint16(0xC), Frunlen: int16(5), }, 6: { Flength: uint16(4), Fcode: uint16(0xE), Frunlen: int16(6), }, 7: { Flength: uint16(4), Fcode: uint16(0xF), Frunlen: int16(7), }, 8: { Flength: uint16(5), Fcode: uint16(0x13), Frunlen: int16(8), }, 9: { Flength: uint16(5), Fcode: uint16(0x14), Frunlen: int16(9), }, 10: { Flength: uint16(5), Fcode: uint16(0x7), Frunlen: int16(10), }, 11: { Flength: uint16(5), Fcode: uint16(0x8), Frunlen: int16(11), }, 12: { Flength: uint16(6), Fcode: uint16(0x8), Frunlen: int16(12), }, 13: { Flength: uint16(6), Fcode: uint16(0x3), Frunlen: int16(13), }, 14: { Flength: uint16(6), Fcode: uint16(0x34), Frunlen: int16(14), }, 15: { Flength: uint16(6), Fcode: uint16(0x35), Frunlen: int16(15), }, 16: { Flength: uint16(6), Fcode: uint16(0x2A), Frunlen: int16(16), }, 17: { Flength: uint16(6), Fcode: uint16(0x2B), Frunlen: int16(17), }, 18: { Flength: uint16(7), Fcode: uint16(0x27), Frunlen: int16(18), }, 19: { Flength: uint16(7), Fcode: uint16(0xC), Frunlen: int16(19), }, 20: { Flength: uint16(7), Fcode: uint16(0x8), Frunlen: int16(20), }, 21: { Flength: uint16(7), Fcode: uint16(0x17), Frunlen: int16(21), }, 22: { Flength: uint16(7), Fcode: uint16(0x3), Frunlen: int16(22), }, 23: { Flength: uint16(7), Fcode: uint16(0x4), Frunlen: int16(23), }, 24: { Flength: uint16(7), Fcode: uint16(0x28), Frunlen: int16(24), }, 25: { Flength: uint16(7), Fcode: uint16(0x2B), Frunlen: int16(25), }, 26: { Flength: uint16(7), Fcode: uint16(0x13), Frunlen: int16(26), }, 27: { Flength: uint16(7), Fcode: uint16(0x24), Frunlen: int16(27), }, 28: { Flength: uint16(7), Fcode: uint16(0x18), Frunlen: int16(28), }, 29: { Flength: uint16(8), Fcode: uint16(0x2), Frunlen: int16(29), }, 30: { Flength: uint16(8), Fcode: uint16(0x3), Frunlen: int16(30), }, 31: { Flength: uint16(8), Fcode: uint16(0x1A), Frunlen: int16(31), }, 32: { Flength: uint16(8), Fcode: uint16(0x1B), Frunlen: int16(32), }, 33: { Flength: uint16(8), Fcode: uint16(0x12), Frunlen: int16(33), }, 34: { Flength: uint16(8), Fcode: uint16(0x13), Frunlen: int16(34), }, 35: { Flength: uint16(8), Fcode: uint16(0x14), Frunlen: int16(35), }, 36: { Flength: uint16(8), Fcode: uint16(0x15), Frunlen: int16(36), }, 37: { Flength: uint16(8), Fcode: uint16(0x16), Frunlen: int16(37), }, 38: { Flength: uint16(8), Fcode: uint16(0x17), Frunlen: int16(38), }, 39: { Flength: uint16(8), Fcode: uint16(0x28), Frunlen: int16(39), }, 40: { Flength: uint16(8), Fcode: uint16(0x29), Frunlen: int16(40), }, 41: { Flength: uint16(8), Fcode: uint16(0x2A), Frunlen: int16(41), }, 42: { Flength: uint16(8), Fcode: uint16(0x2B), Frunlen: int16(42), }, 43: { Flength: uint16(8), Fcode: uint16(0x2C), Frunlen: int16(43), }, 44: { Flength: uint16(8), Fcode: uint16(0x2D), Frunlen: int16(44), }, 45: { Flength: uint16(8), Fcode: uint16(0x4), Frunlen: int16(45), }, 46: { Flength: uint16(8), Fcode: uint16(0x5), Frunlen: int16(46), }, 47: { Flength: uint16(8), Fcode: uint16(0xA), Frunlen: int16(47), }, 48: { Flength: uint16(8), Fcode: uint16(0xB), Frunlen: int16(48), }, 49: { Flength: uint16(8), Fcode: uint16(0x52), Frunlen: int16(49), }, 50: { Flength: uint16(8), Fcode: uint16(0x53), Frunlen: int16(50), }, 51: { Flength: uint16(8), Fcode: uint16(0x54), Frunlen: int16(51), }, 52: { Flength: uint16(8), Fcode: uint16(0x55), Frunlen: int16(52), }, 53: { Flength: uint16(8), Fcode: uint16(0x24), Frunlen: int16(53), }, 54: { Flength: uint16(8), Fcode: uint16(0x25), Frunlen: int16(54), }, 55: { Flength: uint16(8), Fcode: uint16(0x58), Frunlen: int16(55), }, 56: { Flength: uint16(8), Fcode: uint16(0x59), Frunlen: int16(56), }, 57: { Flength: uint16(8), Fcode: uint16(0x5A), Frunlen: int16(57), }, 58: { Flength: uint16(8), Fcode: uint16(0x5B), Frunlen: int16(58), }, 59: { Flength: uint16(8), Fcode: uint16(0x4A), Frunlen: int16(59), }, 60: { Flength: uint16(8), Fcode: uint16(0x4B), Frunlen: int16(60), }, 61: { Flength: uint16(8), Fcode: uint16(0x32), Frunlen: int16(61), }, 62: { Flength: uint16(8), Fcode: uint16(0x33), Frunlen: int16(62), }, 63: { Flength: uint16(8), Fcode: uint16(0x34), Frunlen: int16(63), }, 64: { Flength: uint16(5), Fcode: uint16(0x1B), Frunlen: int16(64), }, 65: { Flength: uint16(5), Fcode: uint16(0x12), Frunlen: int16(128), }, 66: { Flength: uint16(6), Fcode: uint16(0x17), Frunlen: int16(192), }, 67: { Flength: uint16(7), Fcode: uint16(0x37), Frunlen: int16(256), }, 68: { Flength: uint16(8), Fcode: uint16(0x36), Frunlen: int16(320), }, 69: { Flength: uint16(8), Fcode: uint16(0x37), Frunlen: int16(384), }, 70: { Flength: uint16(8), Fcode: uint16(0x64), Frunlen: int16(448), }, 71: { Flength: uint16(8), Fcode: uint16(0x65), Frunlen: int16(512), }, 72: { Flength: uint16(8), Fcode: uint16(0x68), Frunlen: int16(576), }, 73: { Flength: uint16(8), Fcode: uint16(0x67), Frunlen: int16(640), }, 74: { Flength: uint16(9), Fcode: uint16(0xCC), Frunlen: int16(704), }, 75: { Flength: uint16(9), Fcode: uint16(0xCD), Frunlen: int16(768), }, 76: { Flength: uint16(9), Fcode: uint16(0xD2), Frunlen: int16(832), }, 77: { Flength: uint16(9), Fcode: uint16(0xD3), Frunlen: int16(896), }, 78: { Flength: uint16(9), Fcode: uint16(0xD4), Frunlen: int16(960), }, 79: { Flength: uint16(9), Fcode: uint16(0xD5), Frunlen: int16(1024), }, 80: { Flength: uint16(9), Fcode: uint16(0xD6), Frunlen: int16(1088), }, 81: { Flength: uint16(9), Fcode: uint16(0xD7), Frunlen: int16(1152), }, 82: { Flength: uint16(9), Fcode: uint16(0xD8), Frunlen: int16(1216), }, 83: { Flength: uint16(9), Fcode: uint16(0xD9), Frunlen: int16(1280), }, 84: { Flength: uint16(9), Fcode: uint16(0xDA), Frunlen: int16(1344), }, 85: { Flength: uint16(9), Fcode: uint16(0xDB), Frunlen: int16(1408), }, 86: { Flength: uint16(9), Fcode: uint16(0x98), Frunlen: int16(1472), }, 87: { Flength: uint16(9), Fcode: uint16(0x99), Frunlen: int16(1536), }, 88: { Flength: uint16(9), Fcode: uint16(0x9A), Frunlen: int16(1600), }, 89: { Flength: uint16(6), Fcode: uint16(0x18), Frunlen: int16(1664), }, 90: { Flength: uint16(9), Fcode: uint16(0x9B), Frunlen: int16(1728), }, 91: { Flength: uint16(11), Fcode: uint16(0x8), Frunlen: int16(1792), }, 92: { Flength: uint16(11), Fcode: uint16(0xC), Frunlen: int16(1856), }, 93: { Flength: uint16(11), Fcode: uint16(0xD), Frunlen: int16(1920), }, 94: { Flength: uint16(12), Fcode: uint16(0x12), Frunlen: int16(1984), }, 95: { Flength: uint16(12), Fcode: uint16(0x13), Frunlen: int16(2048), }, 96: { Flength: uint16(12), Fcode: uint16(0x14), Frunlen: int16(2112), }, 97: { Flength: uint16(12), Fcode: uint16(0x15), Frunlen: int16(2176), }, 98: { Flength: uint16(12), Fcode: uint16(0x16), Frunlen: int16(2240), }, 99: { Flength: uint16(12), Fcode: uint16(0x17), Frunlen: int16(2304), }, 100: { Flength: uint16(12), Fcode: uint16(0x1C), Frunlen: int16(2368), }, 101: { Flength: uint16(12), Fcode: uint16(0x1D), Frunlen: int16(2432), }, 102: { Flength: uint16(12), Fcode: uint16(0x1E), Frunlen: int16(2496), }, 103: { Flength: uint16(12), Fcode: uint16(0x1F), Frunlen: int16(2560), }, 104: { Flength: uint16(12), Fcode: uint16(0x1), Frunlen: int16(-int32(1)), }, 105: { Flength: uint16(9), Fcode: uint16(0x1), Frunlen: int16(-int32(2)), }, 106: { Flength: uint16(10), Fcode: uint16(0x1), Frunlen: int16(-int32(2)), }, 107: { Flength: uint16(11), Fcode: uint16(0x1), Frunlen: int16(-int32(2)), }, 108: { Flength: uint16(12), Frunlen: int16(-int32(2)), }, } var XTIFFFaxWhiteTable = [4096]TTIFFFaxTabEnt{ 0: { FState: uint8(12), FWidth: uint8(11), }, 1: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 4: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 5: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 6: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 7: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 8: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 9: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 10: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 11: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 12: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 13: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 14: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 15: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 16: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 17: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 18: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 19: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 20: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 21: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 22: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 23: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 24: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 25: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 26: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 27: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 28: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 29: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 30: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 31: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 32: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 33: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 34: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 35: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 36: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 37: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 38: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 39: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 40: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 41: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 42: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 43: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 44: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 45: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 46: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 47: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 48: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 49: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 50: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1472), }, 51: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 52: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 53: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 54: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1216), }, 55: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 56: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 57: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 58: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 59: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 60: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 61: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 62: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 63: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 64: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 65: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 66: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 67: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 68: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 69: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 70: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 71: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 72: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 73: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 74: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 75: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 76: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 77: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 78: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 79: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 80: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 81: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 82: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 83: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 84: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 85: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 86: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(960), }, 87: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 88: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 89: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 90: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 91: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 92: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 93: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 94: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 95: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 96: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 97: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 98: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 99: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 100: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 101: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 102: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(704), }, 103: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 104: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 105: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 106: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 107: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 108: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 109: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 110: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 111: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 112: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 113: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 114: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 115: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 116: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 117: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 118: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 119: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 120: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 121: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 122: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 123: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 124: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 125: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 126: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 127: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 128: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1792), }, 129: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 130: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 131: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 132: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 133: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 134: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 135: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 136: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 137: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 138: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 139: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 140: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 141: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 142: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 143: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 144: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 145: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 146: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 147: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 148: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 149: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 150: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(832), }, 151: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 152: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 153: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 154: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 155: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 156: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 157: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 158: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 159: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 160: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 161: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 162: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 163: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 164: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 165: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 166: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 167: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 168: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 169: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 170: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 171: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 172: { FState: uint8(7), FWidth: uint8(8), }, 173: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 174: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 175: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 176: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 177: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 178: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1600), }, 179: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 180: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 181: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 182: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1344), }, 183: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 184: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 185: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 186: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 187: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 188: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 189: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 190: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 191: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 192: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 193: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 194: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 195: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 196: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 197: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 198: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 199: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 200: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 201: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 202: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 203: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 204: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 205: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 206: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 207: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 208: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 209: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 210: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 211: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 212: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 213: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 214: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1088), }, 215: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 216: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 217: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 218: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 219: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 220: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 221: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 222: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 223: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 224: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 225: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 226: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 227: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 228: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 229: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 230: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 231: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 232: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 233: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 234: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 235: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 236: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 237: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 238: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 239: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 240: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 241: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 242: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 243: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 244: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 245: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 246: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 247: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 248: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 249: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 250: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 251: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 252: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 253: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 254: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 255: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 256: {}, 257: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 258: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 259: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 260: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 261: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 262: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 263: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 264: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 265: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 266: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 267: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 268: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 269: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 270: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 271: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 272: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 273: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 274: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 275: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 276: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 277: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 278: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 279: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 280: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 281: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 282: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 283: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 284: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 285: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 286: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 287: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 288: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 289: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 290: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 291: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 292: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 293: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 294: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 295: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 296: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 297: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 298: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 299: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 300: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 301: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 302: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 303: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 304: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 305: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 306: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1536), }, 307: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 308: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 309: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 310: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1280), }, 311: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 312: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 313: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 314: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 315: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 316: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 317: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 318: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 319: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 320: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 321: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 322: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 323: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 324: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 325: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 326: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 327: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 328: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 329: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 330: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 331: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 332: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 333: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 334: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 335: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 336: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 337: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 338: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 339: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 340: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 341: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 342: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1024), }, 343: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 344: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 345: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 346: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 347: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 348: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 349: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 350: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 351: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 352: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 353: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 354: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 355: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 356: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 357: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 358: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(768), }, 359: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 360: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 361: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 362: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 363: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 364: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 365: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 366: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 367: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 368: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 369: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 370: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 371: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 372: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 373: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 374: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 375: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 376: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 377: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 378: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 379: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 380: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 381: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 382: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 383: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 384: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1856), }, 385: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 386: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 387: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 388: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 389: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 390: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 391: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 392: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 393: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 394: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 395: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 396: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 397: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 398: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 399: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 400: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 401: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 402: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 403: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 404: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 405: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 406: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(896), }, 407: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 408: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 409: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 410: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 411: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 412: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 413: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 414: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 415: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 416: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 417: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 418: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 419: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 420: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 421: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 422: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 423: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 424: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 425: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 426: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 427: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 428: { FState: uint8(7), FWidth: uint8(8), }, 429: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 430: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 431: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 432: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 433: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 434: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1728), }, 435: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 436: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 437: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 438: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1408), }, 439: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 440: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 441: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 442: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 443: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 444: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 445: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 446: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 447: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 448: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 449: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 450: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 451: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 452: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 453: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 454: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 455: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 456: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 457: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 458: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 459: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 460: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 461: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 462: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 463: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 464: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 465: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 466: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 467: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 468: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 469: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 470: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1152), }, 471: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 472: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 473: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 474: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 475: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 476: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 477: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 478: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 479: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 480: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 481: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 482: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 483: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 484: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 485: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 486: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 487: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 488: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 489: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 490: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 491: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 492: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 493: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 494: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 495: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 496: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 497: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 498: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 499: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 500: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 501: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 502: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 503: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 504: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 505: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 506: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 507: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 508: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 509: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 510: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 511: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 512: {}, 513: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 514: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 515: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 516: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 517: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 518: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 519: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 520: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 521: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 522: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 523: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 524: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 525: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 526: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 527: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 528: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 529: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 530: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 531: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 532: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 533: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 534: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 535: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 536: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 537: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 538: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 539: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 540: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 541: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 542: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 543: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 544: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 545: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 546: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 547: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 548: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 549: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 550: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 551: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 552: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 553: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 554: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 555: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 556: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 557: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 558: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 559: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 560: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 561: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 562: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1472), }, 563: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 564: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 565: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 566: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1216), }, 567: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 568: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 569: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 570: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 571: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 572: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 573: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 574: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 575: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 576: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 577: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 578: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 579: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 580: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 581: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 582: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 583: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 584: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 585: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 586: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 587: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 588: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 589: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 590: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 591: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 592: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 593: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 594: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 595: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 596: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 597: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 598: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(960), }, 599: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 600: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 601: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 602: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 603: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 604: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 605: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 606: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 607: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 608: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 609: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 610: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 611: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 612: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 613: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 614: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(704), }, 615: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 616: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 617: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 618: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 619: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 620: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 621: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 622: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 623: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 624: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 625: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 626: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 627: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 628: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 629: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 630: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 631: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 632: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 633: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 634: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 635: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 636: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 637: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 638: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 639: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 640: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2112), }, 641: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 642: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 643: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 644: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 645: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 646: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 647: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 648: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 649: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 650: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 651: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 652: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 653: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 654: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 655: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 656: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 657: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 658: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 659: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 660: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 661: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 662: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(832), }, 663: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 664: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 665: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 666: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 667: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 668: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 669: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 670: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 671: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 672: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 673: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 674: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 675: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 676: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 677: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 678: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 679: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 680: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 681: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 682: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 683: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 684: { FState: uint8(7), FWidth: uint8(8), }, 685: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 686: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 687: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 688: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 689: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 690: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1600), }, 691: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 692: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 693: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 694: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1344), }, 695: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 696: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 697: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 698: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 699: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 700: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 701: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 702: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 703: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 704: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 705: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 706: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 707: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 708: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 709: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 710: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 711: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 712: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 713: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 714: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 715: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 716: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 717: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 718: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 719: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 720: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 721: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 722: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 723: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 724: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 725: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 726: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1088), }, 727: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 728: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 729: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 730: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 731: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 732: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 733: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 734: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 735: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 736: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 737: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 738: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 739: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 740: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 741: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 742: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 743: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 744: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 745: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 746: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 747: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 748: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 749: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 750: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 751: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 752: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 753: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 754: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 755: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 756: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 757: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 758: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 759: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 760: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 761: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 762: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 763: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 764: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 765: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 766: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 767: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 768: {}, 769: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 770: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 771: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 772: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 773: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 774: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 775: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 776: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 777: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 778: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 779: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 780: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 781: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 782: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 783: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 784: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 785: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 786: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 787: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 788: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 789: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 790: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 791: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 792: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 793: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 794: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 795: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 796: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 797: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 798: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 799: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 800: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 801: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 802: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 803: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 804: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 805: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 806: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 807: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 808: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 809: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 810: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 811: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 812: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 813: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 814: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 815: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 816: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 817: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 818: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1536), }, 819: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 820: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 821: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 822: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1280), }, 823: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 824: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 825: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 826: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 827: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 828: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 829: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 830: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 831: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 832: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 833: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 834: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 835: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 836: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 837: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 838: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 839: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 840: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 841: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 842: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 843: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 844: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 845: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 846: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 847: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 848: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 849: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 850: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 851: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 852: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 853: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 854: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1024), }, 855: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 856: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 857: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 858: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 859: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 860: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 861: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 862: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 863: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 864: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 865: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 866: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 867: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 868: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 869: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 870: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(768), }, 871: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 872: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 873: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 874: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 875: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 876: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 877: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 878: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 879: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 880: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 881: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 882: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 883: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 884: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 885: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 886: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 887: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 888: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 889: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 890: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 891: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 892: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 893: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 894: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 895: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 896: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2368), }, 897: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 898: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 899: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 900: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 901: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 902: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 903: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 904: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 905: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 906: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 907: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 908: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 909: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 910: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 911: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 912: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 913: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 914: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 915: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 916: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 917: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 918: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(896), }, 919: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 920: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 921: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 922: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 923: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 924: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 925: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 926: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 927: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 928: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 929: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 930: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 931: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 932: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 933: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 934: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 935: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 936: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 937: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 938: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 939: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 940: { FState: uint8(7), FWidth: uint8(8), }, 941: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 942: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 943: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 944: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 945: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 946: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1728), }, 947: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 948: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 949: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 950: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1408), }, 951: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 952: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 953: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 954: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 955: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 956: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 957: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 958: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 959: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 960: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 961: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 962: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 963: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 964: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 965: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 966: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 967: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 968: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 969: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 970: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 971: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 972: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 973: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 974: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 975: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 976: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 977: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 978: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 979: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 980: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 981: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 982: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1152), }, 983: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 984: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 985: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 986: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 987: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 988: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 989: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 990: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 991: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 992: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 993: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 994: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 995: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 996: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 997: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 998: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 999: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1000: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 1001: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1002: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 1003: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1004: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 1005: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1006: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1007: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1008: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1009: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1010: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 1011: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1012: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 1013: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1014: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 1015: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1016: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1017: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1018: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1019: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1020: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1021: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1022: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1023: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1024: {}, 1025: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1026: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1027: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1028: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1029: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1030: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1031: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1032: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 1033: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1034: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 1035: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1036: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 1037: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1038: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1039: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1040: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 1041: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1042: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 1043: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1044: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 1045: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1046: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 1047: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1048: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 1049: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1050: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 1051: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1052: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1053: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1054: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1055: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1056: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 1057: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1058: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1059: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1060: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 1061: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1062: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 1063: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1064: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 1065: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1066: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 1067: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1068: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 1069: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1070: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1071: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1072: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1073: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1074: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1472), }, 1075: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1076: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 1077: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1078: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1216), }, 1079: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1080: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1081: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1082: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1083: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1084: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1085: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1086: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1087: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1088: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 1089: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1090: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1091: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1092: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1093: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1094: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1095: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1096: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 1097: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1098: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 1099: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1100: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 1101: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1102: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1103: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1104: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 1105: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1106: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 1107: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1108: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 1109: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1110: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(960), }, 1111: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1112: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 1113: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1114: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 1115: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1116: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1117: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1118: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1119: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1120: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 1121: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1122: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1123: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1124: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 1125: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1126: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(704), }, 1127: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1128: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 1129: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1130: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 1131: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1132: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 1133: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1134: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1135: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1136: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1137: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1138: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 1139: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1140: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 1141: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1142: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 1143: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1144: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1145: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1146: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1147: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1148: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1149: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1150: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1151: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1152: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(1984), }, 1153: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1154: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1155: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1156: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1157: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1158: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1159: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1160: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 1161: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1162: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 1163: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1164: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 1165: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1166: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1167: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1168: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 1169: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1170: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 1171: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1172: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 1173: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1174: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(832), }, 1175: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1176: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 1177: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1178: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 1179: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1180: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1181: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1182: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1183: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1184: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 1185: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1186: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1187: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1188: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 1189: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1190: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 1191: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1192: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 1193: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1194: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 1195: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1196: { FState: uint8(7), FWidth: uint8(8), }, 1197: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1198: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1199: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1200: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1201: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1202: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1600), }, 1203: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1204: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 1205: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1206: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1344), }, 1207: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1208: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1209: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1210: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1211: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1212: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1213: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1214: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1215: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1216: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 1217: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1218: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1219: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1220: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1221: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1222: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1223: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1224: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 1225: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1226: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 1227: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1228: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 1229: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1230: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1231: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1232: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 1233: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1234: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 1235: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1236: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 1237: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1238: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1088), }, 1239: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1240: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 1241: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1242: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 1243: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1244: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1245: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1246: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1247: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1248: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 1249: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1250: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1251: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1252: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 1253: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1254: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 1255: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1256: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 1257: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1258: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 1259: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1260: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 1261: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1262: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1263: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1264: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1265: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1266: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 1267: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1268: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 1269: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1270: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 1271: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1272: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1273: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1274: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1275: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1276: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1277: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1278: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1279: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1280: {}, 1281: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1282: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1283: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1284: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1285: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1286: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1287: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1288: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 1289: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1290: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 1291: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1292: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 1293: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1294: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1295: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1296: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 1297: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1298: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 1299: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1300: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 1301: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1302: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 1303: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1304: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 1305: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1306: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 1307: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1308: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1309: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1310: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1311: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1312: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 1313: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1314: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1315: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1316: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 1317: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1318: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 1319: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1320: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 1321: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1322: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 1323: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1324: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 1325: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1326: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1327: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1328: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1329: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1330: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1536), }, 1331: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1332: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 1333: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1334: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1280), }, 1335: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1336: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1337: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1338: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1339: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1340: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1341: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1342: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1343: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1344: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 1345: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1346: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1347: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1348: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1349: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1350: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1351: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1352: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 1353: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1354: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 1355: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1356: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 1357: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1358: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1359: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1360: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 1361: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1362: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 1363: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1364: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 1365: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1366: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1024), }, 1367: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1368: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 1369: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1370: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 1371: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1372: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1373: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1374: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1375: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1376: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 1377: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1378: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1379: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1380: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 1381: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1382: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(768), }, 1383: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1384: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 1385: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1386: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 1387: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1388: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 1389: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1390: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1391: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1392: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1393: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1394: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 1395: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1396: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 1397: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1398: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 1399: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1400: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1401: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1402: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1403: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1404: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1405: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1406: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1407: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1408: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1920), }, 1409: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1410: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1411: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1412: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1413: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1414: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1415: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1416: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 1417: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1418: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 1419: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1420: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 1421: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1422: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1423: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1424: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 1425: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1426: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 1427: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1428: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 1429: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1430: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(896), }, 1431: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1432: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 1433: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1434: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 1435: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1436: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1437: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1438: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1439: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1440: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 1441: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1442: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1443: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1444: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 1445: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1446: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 1447: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1448: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 1449: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1450: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 1451: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1452: { FState: uint8(7), FWidth: uint8(8), }, 1453: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1454: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1455: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1456: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1457: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1458: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1728), }, 1459: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1460: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 1461: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1462: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1408), }, 1463: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1464: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1465: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1466: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1467: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1468: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1469: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1470: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1471: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1472: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 1473: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1474: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1475: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1476: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1477: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1478: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1479: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1480: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 1481: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1482: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 1483: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1484: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 1485: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1486: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1487: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1488: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 1489: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1490: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 1491: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1492: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 1493: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1494: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1152), }, 1495: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1496: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 1497: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1498: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 1499: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1500: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1501: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1502: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1503: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1504: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 1505: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1506: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1507: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1508: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 1509: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1510: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 1511: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1512: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 1513: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1514: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 1515: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1516: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 1517: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1518: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1519: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1520: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1521: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1522: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 1523: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1524: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 1525: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1526: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 1527: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1528: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1529: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1530: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1531: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1532: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1533: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1534: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1535: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1536: {}, 1537: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1538: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1539: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1540: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1541: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1542: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1543: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1544: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 1545: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1546: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 1547: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1548: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 1549: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1550: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1551: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1552: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 1553: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1554: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 1555: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1556: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 1557: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1558: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 1559: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1560: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 1561: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1562: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 1563: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1564: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1565: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1566: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1567: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1568: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 1569: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1570: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1571: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1572: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 1573: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1574: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 1575: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1576: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 1577: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1578: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 1579: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1580: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 1581: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1582: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1583: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1584: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1585: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1586: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1472), }, 1587: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1588: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 1589: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1590: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1216), }, 1591: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1592: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1593: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1594: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1595: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1596: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1597: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1598: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1599: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1600: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 1601: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1602: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1603: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1604: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1605: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1606: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1607: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1608: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 1609: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1610: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 1611: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1612: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 1613: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1614: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1615: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1616: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 1617: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1618: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 1619: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1620: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 1621: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1622: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(960), }, 1623: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1624: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 1625: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1626: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 1627: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1628: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1629: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1630: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1631: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1632: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 1633: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1634: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1635: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1636: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 1637: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1638: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(704), }, 1639: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1640: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 1641: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1642: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 1643: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1644: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 1645: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1646: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1647: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1648: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1649: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1650: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 1651: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1652: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 1653: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1654: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 1655: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1656: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1657: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1658: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1659: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1660: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1661: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1662: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1663: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1664: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2240), }, 1665: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1666: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1667: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1668: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1669: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1670: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1671: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1672: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 1673: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1674: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 1675: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1676: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 1677: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1678: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1679: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1680: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 1681: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1682: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 1683: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1684: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 1685: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1686: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(832), }, 1687: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1688: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 1689: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1690: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 1691: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1692: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1693: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1694: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1695: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1696: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 1697: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1698: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1699: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1700: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 1701: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1702: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 1703: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1704: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 1705: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1706: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 1707: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1708: { FState: uint8(7), FWidth: uint8(8), }, 1709: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1710: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1711: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1712: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1713: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1714: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1600), }, 1715: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1716: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 1717: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1718: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1344), }, 1719: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1720: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1721: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1722: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1723: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1724: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1725: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1726: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1727: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1728: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 1729: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1730: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1731: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1732: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1733: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1734: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1735: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1736: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 1737: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1738: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 1739: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1740: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 1741: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1742: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1743: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1744: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 1745: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1746: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 1747: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1748: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 1749: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1750: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1088), }, 1751: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1752: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 1753: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1754: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 1755: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1756: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1757: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1758: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1759: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1760: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 1761: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1762: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1763: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1764: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 1765: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1766: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 1767: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1768: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 1769: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1770: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 1771: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1772: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 1773: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1774: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1775: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1776: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1777: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1778: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 1779: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1780: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 1781: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1782: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 1783: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1784: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1785: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1786: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1787: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1788: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1789: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1790: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1791: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1792: {}, 1793: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1794: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1795: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1796: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1797: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1798: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1799: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1800: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 1801: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1802: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 1803: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1804: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 1805: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1806: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1807: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1808: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 1809: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1810: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 1811: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1812: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 1813: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1814: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 1815: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1816: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 1817: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1818: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 1819: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1820: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1821: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1822: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1823: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1824: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 1825: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1826: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1827: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1828: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 1829: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1830: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 1831: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1832: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 1833: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1834: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 1835: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1836: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 1837: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1838: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1839: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1840: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1841: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1842: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1536), }, 1843: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1844: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 1845: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1846: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1280), }, 1847: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1848: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1849: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1850: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1851: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1852: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1853: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1854: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1855: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1856: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 1857: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1858: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1859: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1860: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1861: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1862: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1863: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1864: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 1865: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1866: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 1867: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1868: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 1869: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1870: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1871: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1872: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 1873: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1874: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 1875: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1876: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 1877: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1878: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1024), }, 1879: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1880: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 1881: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1882: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 1883: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1884: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1885: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1886: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1887: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1888: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 1889: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1890: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1891: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1892: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 1893: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1894: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(768), }, 1895: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1896: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 1897: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1898: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 1899: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1900: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 1901: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1902: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1903: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1904: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1905: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1906: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 1907: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1908: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 1909: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1910: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 1911: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1912: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1913: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1914: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1915: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1916: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1917: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1918: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1919: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1920: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2496), }, 1921: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1922: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1923: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1924: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1925: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1926: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1927: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1928: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 1929: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1930: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 1931: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1932: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 1933: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1934: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1935: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1936: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 1937: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1938: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 1939: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1940: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 1941: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 1942: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(896), }, 1943: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1944: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 1945: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1946: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 1947: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1948: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1949: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1950: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1951: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1952: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 1953: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1954: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1955: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1956: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 1957: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1958: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 1959: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1960: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 1961: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1962: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 1963: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 1964: { FState: uint8(7), FWidth: uint8(8), }, 1965: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1966: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1967: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1968: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 1969: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1970: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1728), }, 1971: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1972: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 1973: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 1974: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1408), }, 1975: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1976: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 1977: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 1978: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 1979: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 1980: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 1981: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1982: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1983: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 1984: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 1985: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 1986: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 1987: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 1988: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 1989: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 1990: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 1991: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 1992: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 1993: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 1994: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 1995: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 1996: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 1997: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 1998: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 1999: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2000: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 2001: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2002: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 2003: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2004: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 2005: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2006: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1152), }, 2007: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2008: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 2009: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2010: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 2011: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2012: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2013: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2014: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2015: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2016: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 2017: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2018: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2019: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2020: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 2021: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2022: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 2023: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2024: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 2025: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2026: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 2027: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2028: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 2029: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2030: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2031: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2032: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2033: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2034: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 2035: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2036: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 2037: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2038: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 2039: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2040: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2041: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2042: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2043: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2044: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2045: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2046: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2047: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2048: { FState: uint8(12), FWidth: uint8(11), }, 2049: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2050: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2051: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2052: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2053: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2054: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2055: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2056: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 2057: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2058: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 2059: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2060: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 2061: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2062: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2063: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2064: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 2065: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2066: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 2067: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2068: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 2069: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2070: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 2071: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2072: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 2073: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2074: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 2075: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2076: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2077: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2078: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2079: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2080: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 2081: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2082: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2083: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2084: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 2085: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2086: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 2087: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2088: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 2089: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2090: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 2091: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2092: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 2093: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2094: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2095: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2096: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2097: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2098: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1472), }, 2099: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2100: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 2101: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2102: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1216), }, 2103: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2104: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2105: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2106: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2107: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2108: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2109: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2110: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2111: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2112: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 2113: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2114: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2115: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2116: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2117: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2118: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2119: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2120: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 2121: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2122: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 2123: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2124: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 2125: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2126: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2127: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2128: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 2129: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2130: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 2131: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2132: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 2133: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2134: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(960), }, 2135: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2136: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 2137: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2138: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 2139: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2140: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2141: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2142: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2143: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2144: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 2145: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2146: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2147: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2148: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 2149: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2150: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(704), }, 2151: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2152: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 2153: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2154: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 2155: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2156: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 2157: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2158: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2159: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2160: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2161: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2162: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 2163: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2164: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 2165: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2166: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 2167: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2168: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2169: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2170: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2171: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2172: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2173: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2174: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2175: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2176: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1792), }, 2177: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2178: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2179: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2180: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2181: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2182: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2183: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2184: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 2185: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2186: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 2187: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2188: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 2189: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2190: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2191: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2192: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 2193: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2194: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 2195: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2196: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 2197: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2198: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(832), }, 2199: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2200: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 2201: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2202: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 2203: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2204: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2205: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2206: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2207: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2208: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 2209: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2210: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2211: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2212: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 2213: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2214: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 2215: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2216: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 2217: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2218: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 2219: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2220: { FState: uint8(7), FWidth: uint8(8), }, 2221: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2222: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2223: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2224: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2225: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2226: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1600), }, 2227: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2228: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 2229: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2230: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1344), }, 2231: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2232: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2233: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2234: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2235: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2236: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2237: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2238: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2239: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2240: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 2241: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2242: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2243: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2244: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2245: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2246: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2247: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2248: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 2249: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2250: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 2251: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2252: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 2253: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2254: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2255: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2256: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 2257: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2258: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 2259: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2260: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 2261: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2262: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1088), }, 2263: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2264: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 2265: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2266: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 2267: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2268: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2269: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2270: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2271: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2272: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 2273: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2274: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2275: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2276: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 2277: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2278: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 2279: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2280: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 2281: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2282: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 2283: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2284: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 2285: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2286: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2287: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2288: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2289: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2290: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 2291: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2292: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 2293: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2294: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 2295: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2296: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2297: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2298: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2299: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2300: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2301: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2302: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2303: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2304: {}, 2305: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2306: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2307: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2308: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2309: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2310: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2311: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2312: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 2313: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2314: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 2315: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2316: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 2317: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2318: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2319: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2320: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 2321: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2322: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 2323: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2324: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 2325: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2326: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 2327: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2328: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 2329: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2330: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 2331: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2332: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2333: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2334: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2335: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2336: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 2337: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2338: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2339: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2340: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 2341: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2342: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 2343: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2344: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 2345: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2346: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 2347: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2348: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 2349: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2350: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2351: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2352: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2353: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2354: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1536), }, 2355: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2356: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 2357: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2358: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1280), }, 2359: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2360: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2361: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2362: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2363: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2364: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2365: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2366: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2367: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2368: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 2369: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2370: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2371: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2372: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2373: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2374: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2375: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2376: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 2377: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2378: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 2379: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2380: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 2381: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2382: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2383: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2384: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 2385: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2386: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 2387: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2388: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 2389: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2390: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1024), }, 2391: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2392: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 2393: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2394: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 2395: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2396: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2397: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2398: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2399: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2400: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 2401: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2402: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2403: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2404: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 2405: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2406: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(768), }, 2407: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2408: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 2409: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2410: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 2411: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2412: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 2413: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2414: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2415: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2416: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2417: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2418: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 2419: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2420: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 2421: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2422: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 2423: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2424: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2425: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2426: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2427: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2428: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2429: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2430: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2431: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2432: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1856), }, 2433: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2434: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2435: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2436: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2437: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2438: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2439: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2440: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 2441: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2442: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 2443: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2444: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 2445: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2446: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2447: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2448: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 2449: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2450: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 2451: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2452: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 2453: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2454: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(896), }, 2455: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2456: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 2457: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2458: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 2459: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2460: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2461: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2462: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2463: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2464: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 2465: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2466: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2467: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2468: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 2469: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2470: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 2471: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2472: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 2473: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2474: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 2475: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2476: { FState: uint8(7), FWidth: uint8(8), }, 2477: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2478: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2479: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2480: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2481: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2482: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1728), }, 2483: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2484: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 2485: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2486: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1408), }, 2487: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2488: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2489: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2490: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2491: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2492: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2493: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2494: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2495: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2496: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 2497: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2498: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2499: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2500: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2501: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2502: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2503: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2504: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 2505: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2506: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 2507: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2508: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 2509: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2510: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2511: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2512: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 2513: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2514: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 2515: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2516: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 2517: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2518: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1152), }, 2519: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2520: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 2521: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2522: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 2523: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2524: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2525: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2526: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2527: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2528: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 2529: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2530: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2531: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2532: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 2533: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2534: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 2535: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2536: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 2537: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2538: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 2539: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2540: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 2541: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2542: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2543: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2544: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2545: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2546: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 2547: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2548: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 2549: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2550: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 2551: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2552: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2553: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2554: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2555: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2556: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2557: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2558: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2559: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2560: {}, 2561: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2562: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2563: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2564: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2565: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2566: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2567: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2568: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 2569: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2570: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 2571: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2572: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 2573: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2574: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2575: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2576: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 2577: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2578: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 2579: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2580: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 2581: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2582: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 2583: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2584: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 2585: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2586: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 2587: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2588: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2589: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2590: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2591: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2592: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 2593: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2594: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2595: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2596: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 2597: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2598: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 2599: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2600: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 2601: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2602: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 2603: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2604: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 2605: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2606: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2607: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2608: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2609: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2610: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1472), }, 2611: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2612: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 2613: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2614: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1216), }, 2615: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2616: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2617: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2618: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2619: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2620: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2621: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2622: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2623: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2624: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 2625: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2626: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2627: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2628: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2629: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2630: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2631: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2632: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 2633: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2634: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 2635: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2636: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 2637: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2638: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2639: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2640: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 2641: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2642: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 2643: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2644: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 2645: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2646: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(960), }, 2647: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2648: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 2649: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2650: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 2651: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2652: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2653: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2654: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2655: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2656: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 2657: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2658: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2659: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2660: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 2661: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2662: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(704), }, 2663: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2664: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 2665: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2666: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 2667: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2668: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 2669: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2670: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2671: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2672: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2673: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2674: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 2675: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2676: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 2677: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2678: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 2679: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2680: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2681: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2682: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2683: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2684: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2685: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2686: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2687: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2688: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2176), }, 2689: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2690: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2691: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2692: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2693: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2694: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2695: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2696: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 2697: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2698: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 2699: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2700: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 2701: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2702: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2703: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2704: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 2705: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2706: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 2707: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2708: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 2709: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2710: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(832), }, 2711: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2712: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 2713: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2714: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 2715: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2716: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2717: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2718: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2719: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2720: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 2721: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2722: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2723: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2724: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 2725: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2726: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 2727: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2728: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 2729: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2730: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 2731: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2732: { FState: uint8(7), FWidth: uint8(8), }, 2733: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2734: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2735: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2736: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2737: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2738: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1600), }, 2739: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2740: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 2741: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2742: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1344), }, 2743: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2744: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2745: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2746: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2747: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2748: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2749: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2750: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2751: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2752: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 2753: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2754: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2755: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2756: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2757: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2758: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2759: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2760: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 2761: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2762: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 2763: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2764: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 2765: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2766: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2767: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2768: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 2769: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2770: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 2771: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2772: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 2773: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2774: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1088), }, 2775: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2776: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 2777: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2778: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 2779: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2780: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2781: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2782: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2783: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2784: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 2785: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2786: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2787: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2788: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 2789: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2790: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 2791: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2792: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 2793: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2794: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 2795: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2796: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 2797: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2798: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2799: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2800: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2801: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2802: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 2803: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2804: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 2805: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2806: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 2807: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2808: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2809: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2810: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2811: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2812: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2813: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2814: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2815: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2816: {}, 2817: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2818: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2819: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2820: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2821: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2822: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2823: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2824: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 2825: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2826: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 2827: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2828: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 2829: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2830: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2831: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2832: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 2833: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2834: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 2835: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2836: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 2837: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2838: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 2839: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2840: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 2841: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2842: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 2843: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2844: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2845: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2846: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2847: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2848: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 2849: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2850: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2851: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2852: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 2853: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2854: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 2855: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2856: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 2857: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2858: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 2859: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2860: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 2861: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2862: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2863: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2864: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2865: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2866: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1536), }, 2867: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2868: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 2869: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2870: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1280), }, 2871: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2872: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2873: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2874: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2875: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2876: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2877: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2878: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2879: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2880: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 2881: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2882: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2883: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2884: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2885: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2886: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2887: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2888: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 2889: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2890: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 2891: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2892: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 2893: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2894: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2895: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2896: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 2897: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2898: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 2899: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2900: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 2901: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2902: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1024), }, 2903: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2904: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 2905: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2906: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 2907: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2908: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2909: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2910: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2911: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2912: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 2913: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2914: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2915: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2916: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 2917: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2918: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(768), }, 2919: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2920: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 2921: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2922: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 2923: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2924: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 2925: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2926: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2927: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2928: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2929: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2930: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 2931: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2932: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 2933: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2934: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 2935: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2936: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 2937: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2938: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 2939: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2940: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2941: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2942: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2943: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2944: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2432), }, 2945: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2946: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2947: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2948: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 2949: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2950: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 2951: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2952: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 2953: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2954: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 2955: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 2956: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 2957: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2958: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2959: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2960: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 2961: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2962: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 2963: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2964: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 2965: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 2966: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(896), }, 2967: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2968: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 2969: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 2970: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 2971: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 2972: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 2973: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2974: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2975: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2976: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 2977: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2978: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 2979: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2980: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 2981: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 2982: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 2983: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 2984: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 2985: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 2986: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 2987: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 2988: { FState: uint8(7), FWidth: uint8(8), }, 2989: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 2990: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 2991: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 2992: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 2993: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 2994: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1728), }, 2995: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 2996: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 2997: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 2998: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1408), }, 2999: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3000: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3001: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3002: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3003: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3004: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3005: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3006: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3007: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3008: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 3009: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3010: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3011: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3012: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3013: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3014: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3015: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3016: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 3017: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3018: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 3019: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3020: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 3021: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3022: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3023: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3024: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 3025: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3026: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 3027: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3028: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 3029: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3030: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1152), }, 3031: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3032: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 3033: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3034: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 3035: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3036: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3037: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3038: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3039: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3040: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 3041: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3042: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3043: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3044: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 3045: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3046: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 3047: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3048: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 3049: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3050: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 3051: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3052: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 3053: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3054: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3055: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3056: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3057: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3058: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 3059: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3060: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 3061: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3062: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 3063: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3064: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3065: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3066: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3067: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3068: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3069: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3070: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3071: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3072: {}, 3073: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3074: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3075: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3076: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3077: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3078: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3079: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3080: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 3081: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3082: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 3083: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3084: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 3085: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3086: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3087: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3088: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 3089: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3090: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 3091: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3092: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 3093: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3094: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 3095: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3096: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 3097: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3098: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 3099: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3100: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3101: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3102: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3103: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3104: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 3105: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3106: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3107: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3108: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 3109: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3110: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 3111: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3112: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 3113: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3114: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 3115: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3116: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 3117: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3118: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3119: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3120: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3121: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3122: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1472), }, 3123: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3124: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 3125: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3126: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1216), }, 3127: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3128: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3129: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3130: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3131: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3132: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3133: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3134: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3135: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3136: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 3137: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3138: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3139: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3140: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3141: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3142: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3143: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3144: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 3145: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3146: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 3147: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3148: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 3149: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3150: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3151: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3152: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 3153: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3154: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 3155: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3156: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 3157: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3158: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(960), }, 3159: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3160: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 3161: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3162: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 3163: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3164: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3165: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3166: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3167: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3168: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 3169: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3170: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3171: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3172: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 3173: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3174: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(704), }, 3175: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3176: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 3177: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3178: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 3179: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3180: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 3181: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3182: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3183: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3184: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3185: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3186: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 3187: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3188: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 3189: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3190: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 3191: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3192: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3193: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3194: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3195: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3196: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3197: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3198: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3199: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3200: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2048), }, 3201: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3202: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3203: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3204: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3205: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3206: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3207: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3208: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 3209: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3210: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 3211: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3212: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 3213: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3214: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3215: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3216: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 3217: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3218: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 3219: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3220: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 3221: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3222: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(832), }, 3223: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3224: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 3225: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3226: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 3227: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3228: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3229: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3230: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3231: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3232: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 3233: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3234: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3235: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3236: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 3237: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3238: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 3239: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3240: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 3241: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3242: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 3243: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3244: { FState: uint8(7), FWidth: uint8(8), }, 3245: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3246: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3247: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3248: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3249: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3250: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1600), }, 3251: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3252: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 3253: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3254: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1344), }, 3255: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3256: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3257: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3258: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3259: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3260: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3261: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3262: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3263: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3264: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 3265: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3266: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3267: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3268: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3269: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3270: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3271: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3272: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 3273: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3274: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 3275: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3276: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 3277: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3278: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3279: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3280: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 3281: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3282: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 3283: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3284: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 3285: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3286: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1088), }, 3287: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3288: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 3289: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3290: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 3291: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3292: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3293: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3294: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3295: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3296: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 3297: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3298: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3299: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3300: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 3301: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3302: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 3303: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3304: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 3305: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3306: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 3307: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3308: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 3309: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3310: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3311: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3312: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3313: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3314: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 3315: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3316: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 3317: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3318: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 3319: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3320: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3321: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3322: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3323: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3324: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3325: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3326: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3327: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3328: {}, 3329: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3330: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3331: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3332: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3333: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3334: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3335: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3336: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 3337: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3338: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 3339: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3340: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 3341: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3342: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3343: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3344: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 3345: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3346: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 3347: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3348: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 3349: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3350: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 3351: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3352: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 3353: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3354: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 3355: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3356: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3357: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3358: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3359: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3360: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 3361: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3362: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3363: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3364: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 3365: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3366: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 3367: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3368: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 3369: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3370: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 3371: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3372: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 3373: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3374: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3375: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3376: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3377: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3378: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1536), }, 3379: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3380: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 3381: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3382: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1280), }, 3383: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3384: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3385: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3386: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3387: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3388: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3389: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3390: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3391: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3392: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 3393: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3394: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3395: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3396: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3397: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3398: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3399: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3400: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 3401: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3402: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 3403: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3404: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 3405: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3406: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3407: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3408: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 3409: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3410: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 3411: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3412: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 3413: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3414: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1024), }, 3415: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3416: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 3417: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3418: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 3419: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3420: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3421: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3422: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3423: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3424: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 3425: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3426: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3427: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3428: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 3429: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3430: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(768), }, 3431: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3432: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 3433: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3434: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 3435: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3436: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 3437: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3438: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3439: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3440: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3441: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3442: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 3443: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3444: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 3445: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3446: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 3447: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3448: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3449: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3450: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3451: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3452: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3453: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3454: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3455: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3456: { FState: uint8(11), FWidth: uint8(11), FParam: uint32(1920), }, 3457: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3458: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3459: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3460: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3461: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3462: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3463: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3464: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 3465: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3466: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 3467: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3468: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 3469: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3470: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3471: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3472: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 3473: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3474: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 3475: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3476: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 3477: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3478: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(896), }, 3479: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3480: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 3481: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3482: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 3483: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3484: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3485: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3486: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3487: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3488: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 3489: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3490: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3491: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3492: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 3493: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3494: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 3495: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3496: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 3497: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3498: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 3499: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3500: { FState: uint8(7), FWidth: uint8(8), }, 3501: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3502: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3503: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3504: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3505: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3506: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1728), }, 3507: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3508: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 3509: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3510: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1408), }, 3511: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3512: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3513: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3514: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3515: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3516: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3517: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3518: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3519: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3520: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 3521: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3522: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3523: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3524: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3525: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3526: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3527: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3528: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 3529: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3530: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 3531: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3532: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 3533: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3534: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3535: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3536: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 3537: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3538: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 3539: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3540: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 3541: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3542: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1152), }, 3543: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3544: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 3545: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3546: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 3547: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3548: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3549: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3550: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3551: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3552: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 3553: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3554: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3555: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3556: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 3557: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3558: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 3559: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3560: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 3561: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3562: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 3563: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3564: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 3565: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3566: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3567: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3568: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3569: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3570: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 3571: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3572: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 3573: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3574: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 3575: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3576: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3577: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3578: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3579: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3580: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3581: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3582: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3583: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3584: {}, 3585: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3586: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3587: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3588: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3589: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3590: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3591: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3592: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 3593: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3594: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 3595: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3596: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 3597: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3598: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3599: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3600: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 3601: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3602: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 3603: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3604: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 3605: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3606: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 3607: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3608: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 3609: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3610: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 3611: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3612: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3613: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3614: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3615: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3616: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 3617: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3618: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3619: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3620: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 3621: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3622: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 3623: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3624: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 3625: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3626: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 3627: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3628: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 3629: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3630: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3631: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3632: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3633: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3634: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1472), }, 3635: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3636: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 3637: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3638: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1216), }, 3639: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3640: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3641: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3642: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3643: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3644: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3645: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3646: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3647: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3648: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 3649: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3650: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3651: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3652: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3653: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3654: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3655: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3656: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 3657: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3658: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 3659: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3660: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 3661: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3662: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3663: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3664: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 3665: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3666: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 3667: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3668: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 3669: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3670: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(960), }, 3671: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3672: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 3673: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3674: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 3675: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3676: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3677: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3678: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3679: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3680: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 3681: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3682: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3683: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3684: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 3685: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3686: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(704), }, 3687: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3688: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 3689: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3690: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 3691: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3692: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 3693: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3694: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3695: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3696: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3697: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3698: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 3699: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3700: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 3701: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3702: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 3703: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3704: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3705: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3706: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3707: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3708: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3709: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3710: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3711: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3712: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2304), }, 3713: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3714: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3715: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3716: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3717: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3718: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3719: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3720: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 3721: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3722: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 3723: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3724: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 3725: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3726: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3727: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3728: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 3729: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3730: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 3731: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3732: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 3733: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3734: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(832), }, 3735: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3736: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 3737: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3738: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 3739: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3740: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3741: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3742: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3743: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3744: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 3745: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3746: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3747: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3748: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 3749: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3750: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 3751: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3752: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 3753: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3754: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 3755: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3756: { FState: uint8(7), FWidth: uint8(8), }, 3757: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3758: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3759: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3760: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3761: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3762: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1600), }, 3763: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3764: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 3765: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3766: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1344), }, 3767: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3768: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3769: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3770: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3771: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3772: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3773: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3774: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3775: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3776: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 3777: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3778: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3779: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3780: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3781: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3782: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3783: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3784: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 3785: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3786: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 3787: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3788: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 3789: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3790: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3791: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3792: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 3793: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3794: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 3795: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3796: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 3797: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3798: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1088), }, 3799: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3800: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 3801: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3802: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 3803: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3804: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3805: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3806: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3807: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3808: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 3809: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3810: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3811: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3812: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 3813: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3814: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 3815: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3816: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 3817: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3818: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 3819: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3820: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 3821: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3822: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3823: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3824: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3825: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3826: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 3827: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3828: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 3829: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3830: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 3831: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3832: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3833: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3834: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3835: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3836: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3837: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3838: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3839: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3840: {}, 3841: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3842: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3843: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3844: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3845: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3846: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3847: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3848: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 3849: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3850: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 3851: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3852: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 3853: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3854: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3855: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3856: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 3857: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3858: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 3859: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3860: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(39), }, 3861: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3862: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(576), }, 3863: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3864: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 3865: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3866: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(55), }, 3867: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3868: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3869: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3870: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3871: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3872: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(45), }, 3873: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3874: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3875: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3876: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(53), }, 3877: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3878: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(448), }, 3879: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3880: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(35), }, 3881: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3882: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(51), }, 3883: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3884: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(63), }, 3885: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3886: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3887: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3888: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3889: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3890: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1536), }, 3891: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3892: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(43), }, 3893: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3894: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1280), }, 3895: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3896: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3897: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3898: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3899: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3900: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3901: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3902: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3903: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3904: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(29), }, 3905: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3906: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3907: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3908: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3909: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3910: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3911: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3912: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(33), }, 3913: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3914: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(49), }, 3915: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3916: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(61), }, 3917: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3918: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3919: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3920: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(47), }, 3921: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3922: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(59), }, 3923: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3924: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(41), }, 3925: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3926: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1024), }, 3927: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3928: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(31), }, 3929: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3930: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(57), }, 3931: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3932: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3933: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3934: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3935: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3936: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 3937: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3938: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3939: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3940: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 3941: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3942: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(768), }, 3943: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3944: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(37), }, 3945: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3946: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 3947: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 3948: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(320), }, 3949: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3950: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3951: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3952: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 3953: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3954: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 3955: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3956: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 3957: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 3958: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 3959: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3960: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 3961: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3962: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 3963: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3964: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3965: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3966: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3967: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3968: { FState: uint8(11), FWidth: uint8(12), FParam: uint32(2560), }, 3969: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3970: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 3971: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3972: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 3973: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 3974: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 3975: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3976: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(20), }, 3977: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 3978: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(24), }, 3979: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 3980: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(28), }, 3981: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3982: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3983: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 3984: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(23), }, 3985: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 3986: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(27), }, 3987: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 3988: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(40), }, 3989: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 3990: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(896), }, 3991: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 3992: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(19), }, 3993: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 3994: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(56), }, 3995: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 3996: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 3997: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 3998: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 3999: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 4000: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(46), }, 4001: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 4002: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 4003: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 4004: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(54), }, 4005: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 4006: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(512), }, 4007: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 4008: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(36), }, 4009: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 4010: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(52), }, 4011: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 4012: { FState: uint8(7), FWidth: uint8(8), }, 4013: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 4014: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 4015: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 4016: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 4017: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 4018: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1728), }, 4019: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 4020: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(44), }, 4021: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 4022: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1408), }, 4023: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 4024: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 4025: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 4026: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 4027: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 4028: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 4029: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 4030: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 4031: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 4032: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(30), }, 4033: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 4034: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 4035: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 4036: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(12), }, 4037: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 4038: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(1664), }, 4039: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 4040: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(34), }, 4041: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 4042: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(50), }, 4043: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(14), }, 4044: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(62), }, 4045: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 4046: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 4047: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 4048: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(48), }, 4049: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 4050: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(60), }, 4051: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 4052: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(42), }, 4053: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(16), }, 4054: { FState: uint8(9), FWidth: uint8(9), FParam: uint32(1152), }, 4055: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 4056: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(32), }, 4057: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 4058: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(58), }, 4059: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 4060: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 4061: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 4062: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 4063: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 4064: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(22), }, 4065: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 4066: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(11), }, 4067: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 4068: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(26), }, 4069: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(9), }, 4070: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(640), }, 4071: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 4072: { FState: uint8(7), FWidth: uint8(8), FParam: uint32(38), }, 4073: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(128), }, 4074: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(25), }, 4075: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(15), }, 4076: { FState: uint8(9), FWidth: uint8(8), FParam: uint32(384), }, 4077: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 4078: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 4079: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, 4080: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(13), }, 4081: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(3), }, 4082: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(18), }, 4083: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(5), }, 4084: { FState: uint8(7), FWidth: uint8(7), FParam: uint32(21), }, 4085: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(17), }, 4086: { FState: uint8(9), FWidth: uint8(7), FParam: uint32(256), }, 4087: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(6), }, 4088: { FState: uint8(7), FWidth: uint8(6), FParam: uint32(1), }, 4089: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(8), }, 4090: { FState: uint8(9), FWidth: uint8(6), FParam: uint32(192), }, 4091: { FState: uint8(9), FWidth: uint8(5), FParam: uint32(64), }, 4092: { FState: uint8(7), FWidth: uint8(5), FParam: uint32(10), }, 4093: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(4), }, 4094: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(2), }, 4095: { FState: uint8(7), FWidth: uint8(4), FParam: uint32(7), }, } // C documentation // // /* // * Compression schemes statically built into the library. // */ var X_TIFFBuiltinCODECS = [22]TTIFFCodec{ 0: { Fname: __ccgo_ts + 22249, Fscheme: uint16(COMPRESSION_NONE), }, 1: { Fname: __ccgo_ts + 22254, Fscheme: uint16(COMPRESSION_LZW), }, 2: { Fname: __ccgo_ts + 22258, Fscheme: uint16(COMPRESSION_PACKBITS), }, 3: { Fname: __ccgo_ts + 22267, Fscheme: uint16(COMPRESSION_THUNDERSCAN), }, 4: { Fname: __ccgo_ts + 22279, Fscheme: uint16(COMPRESSION_NEXT), }, 5: { Fname: __ccgo_ts + 22284, Fscheme: uint16(COMPRESSION_JPEG), }, 6: { Fname: __ccgo_ts + 22289, Fscheme: uint16(COMPRESSION_OJPEG), }, 7: { Fname: __ccgo_ts + 22304, Fscheme: uint16(COMPRESSION_CCITTRLE), }, 8: { Fname: __ccgo_ts + 22314, Fscheme: uint16(COMPRESSION_CCITTRLEW), }, 9: { Fname: __ccgo_ts + 22326, Fscheme: uint16(COMPRESSION_CCITTFAX3), }, 10: { Fname: __ccgo_ts + 22340, Fscheme: uint16(COMPRESSION_CCITTFAX4), }, 11: { Fname: __ccgo_ts + 22354, Fscheme: uint16(COMPRESSION_JBIG), }, 12: { Fname: __ccgo_ts + 22363, Fscheme: uint16(COMPRESSION_DEFLATE), }, 13: { Fname: __ccgo_ts + 22371, Fscheme: uint16(COMPRESSION_ADOBE_DEFLATE), }, 14: { Fname: __ccgo_ts + 22384, Fscheme: uint16(COMPRESSION_PIXARLOG), }, 15: { Fname: __ccgo_ts + 22393, Fscheme: uint16(COMPRESSION_SGILOG), }, 16: { Fname: __ccgo_ts + 22400, Fscheme: uint16(COMPRESSION_SGILOG24), }, 17: { Fname: __ccgo_ts + 22409, Fscheme: uint16(COMPRESSION_LZMA), }, 18: { Fname: __ccgo_ts + 22414, Fscheme: uint16(COMPRESSION_ZSTD), }, 19: { Fname: __ccgo_ts + 22419, Fscheme: uint16(COMPRESSION_WEBP), }, 20: { Fname: __ccgo_ts + 22424, Fscheme: uint16(COMPRESSION_LERC), }, 21: {}, } var X_TIFFerrorHandler = uintptr(0) var X_TIFFerrorHandlerExt TTIFFErrorHandlerExt var X_TIFFwarningHandler = uintptr(0) var X_TIFFwarningHandlerExt TTIFFErrorHandlerExt var X_dist_code = [512]Tuch{ 1: uint8(1), 2: uint8(2), 3: uint8(3), 4: uint8(4), 5: uint8(4), 6: uint8(5), 7: uint8(5), 8: uint8(6), 9: uint8(6), 10: uint8(6), 11: uint8(6), 12: uint8(7), 13: uint8(7), 14: uint8(7), 15: uint8(7), 16: uint8(8), 17: uint8(8), 18: uint8(8), 19: uint8(8), 20: uint8(8), 21: uint8(8), 22: uint8(8), 23: uint8(8), 24: uint8(9), 25: uint8(9), 26: uint8(9), 27: uint8(9), 28: uint8(9), 29: uint8(9), 30: uint8(9), 31: uint8(9), 32: uint8(10), 33: uint8(10), 34: uint8(10), 35: uint8(10), 36: uint8(10), 37: uint8(10), 38: uint8(10), 39: uint8(10), 40: uint8(10), 41: uint8(10), 42: uint8(10), 43: uint8(10), 44: uint8(10), 45: uint8(10), 46: uint8(10), 47: uint8(10), 48: uint8(11), 49: uint8(11), 50: uint8(11), 51: uint8(11), 52: uint8(11), 53: uint8(11), 54: uint8(11), 55: uint8(11), 56: uint8(11), 57: uint8(11), 58: uint8(11), 59: uint8(11), 60: uint8(11), 61: uint8(11), 62: uint8(11), 63: uint8(11), 64: uint8(12), 65: uint8(12), 66: uint8(12), 67: uint8(12), 68: uint8(12), 69: uint8(12), 70: uint8(12), 71: uint8(12), 72: uint8(12), 73: uint8(12), 74: uint8(12), 75: uint8(12), 76: uint8(12), 77: uint8(12), 78: uint8(12), 79: uint8(12), 80: uint8(12), 81: uint8(12), 82: uint8(12), 83: uint8(12), 84: uint8(12), 85: uint8(12), 86: uint8(12), 87: uint8(12), 88: uint8(12), 89: uint8(12), 90: uint8(12), 91: uint8(12), 92: uint8(12), 93: uint8(12), 94: uint8(12), 95: uint8(12), 96: uint8(13), 97: uint8(13), 98: uint8(13), 99: uint8(13), 100: uint8(13), 101: uint8(13), 102: uint8(13), 103: uint8(13), 104: uint8(13), 105: uint8(13), 106: uint8(13), 107: uint8(13), 108: uint8(13), 109: uint8(13), 110: uint8(13), 111: uint8(13), 112: uint8(13), 113: uint8(13), 114: uint8(13), 115: uint8(13), 116: uint8(13), 117: uint8(13), 118: uint8(13), 119: uint8(13), 120: uint8(13), 121: uint8(13), 122: uint8(13), 123: uint8(13), 124: uint8(13), 125: uint8(13), 126: uint8(13), 127: uint8(13), 128: uint8(14), 129: uint8(14), 130: uint8(14), 131: uint8(14), 132: uint8(14), 133: uint8(14), 134: uint8(14), 135: uint8(14), 136: uint8(14), 137: uint8(14), 138: uint8(14), 139: uint8(14), 140: uint8(14), 141: uint8(14), 142: uint8(14), 143: uint8(14), 144: uint8(14), 145: uint8(14), 146: uint8(14), 147: uint8(14), 148: uint8(14), 149: uint8(14), 150: uint8(14), 151: uint8(14), 152: uint8(14), 153: uint8(14), 154: uint8(14), 155: uint8(14), 156: uint8(14), 157: uint8(14), 158: uint8(14), 159: uint8(14), 160: uint8(14), 161: uint8(14), 162: uint8(14), 163: uint8(14), 164: uint8(14), 165: uint8(14), 166: uint8(14), 167: uint8(14), 168: uint8(14), 169: uint8(14), 170: uint8(14), 171: uint8(14), 172: uint8(14), 173: uint8(14), 174: uint8(14), 175: uint8(14), 176: uint8(14), 177: uint8(14), 178: uint8(14), 179: uint8(14), 180: uint8(14), 181: uint8(14), 182: uint8(14), 183: uint8(14), 184: uint8(14), 185: uint8(14), 186: uint8(14), 187: uint8(14), 188: uint8(14), 189: uint8(14), 190: uint8(14), 191: uint8(14), 192: uint8(15), 193: uint8(15), 194: uint8(15), 195: uint8(15), 196: uint8(15), 197: uint8(15), 198: uint8(15), 199: uint8(15), 200: uint8(15), 201: uint8(15), 202: uint8(15), 203: uint8(15), 204: uint8(15), 205: uint8(15), 206: uint8(15), 207: uint8(15), 208: uint8(15), 209: uint8(15), 210: uint8(15), 211: uint8(15), 212: uint8(15), 213: uint8(15), 214: uint8(15), 215: uint8(15), 216: uint8(15), 217: uint8(15), 218: uint8(15), 219: uint8(15), 220: uint8(15), 221: uint8(15), 222: uint8(15), 223: uint8(15), 224: uint8(15), 225: uint8(15), 226: uint8(15), 227: uint8(15), 228: uint8(15), 229: uint8(15), 230: uint8(15), 231: uint8(15), 232: uint8(15), 233: uint8(15), 234: uint8(15), 235: uint8(15), 236: uint8(15), 237: uint8(15), 238: uint8(15), 239: uint8(15), 240: uint8(15), 241: uint8(15), 242: uint8(15), 243: uint8(15), 244: uint8(15), 245: uint8(15), 246: uint8(15), 247: uint8(15), 248: uint8(15), 249: uint8(15), 250: uint8(15), 251: uint8(15), 252: uint8(15), 253: uint8(15), 254: uint8(15), 255: uint8(15), 258: uint8(16), 259: uint8(17), 260: uint8(18), 261: uint8(18), 262: uint8(19), 263: uint8(19), 264: uint8(20), 265: uint8(20), 266: uint8(20), 267: uint8(20), 268: uint8(21), 269: uint8(21), 270: uint8(21), 271: uint8(21), 272: uint8(22), 273: uint8(22), 274: uint8(22), 275: uint8(22), 276: uint8(22), 277: uint8(22), 278: uint8(22), 279: uint8(22), 280: uint8(23), 281: uint8(23), 282: uint8(23), 283: uint8(23), 284: uint8(23), 285: uint8(23), 286: uint8(23), 287: uint8(23), 288: uint8(24), 289: uint8(24), 290: uint8(24), 291: uint8(24), 292: uint8(24), 293: uint8(24), 294: uint8(24), 295: uint8(24), 296: uint8(24), 297: uint8(24), 298: uint8(24), 299: uint8(24), 300: uint8(24), 301: uint8(24), 302: uint8(24), 303: uint8(24), 304: uint8(25), 305: uint8(25), 306: uint8(25), 307: uint8(25), 308: uint8(25), 309: uint8(25), 310: uint8(25), 311: uint8(25), 312: uint8(25), 313: uint8(25), 314: uint8(25), 315: uint8(25), 316: uint8(25), 317: uint8(25), 318: uint8(25), 319: uint8(25), 320: uint8(26), 321: uint8(26), 322: uint8(26), 323: uint8(26), 324: uint8(26), 325: uint8(26), 326: uint8(26), 327: uint8(26), 328: uint8(26), 329: uint8(26), 330: uint8(26), 331: uint8(26), 332: uint8(26), 333: uint8(26), 334: uint8(26), 335: uint8(26), 336: uint8(26), 337: uint8(26), 338: uint8(26), 339: uint8(26), 340: uint8(26), 341: uint8(26), 342: uint8(26), 343: uint8(26), 344: uint8(26), 345: uint8(26), 346: uint8(26), 347: uint8(26), 348: uint8(26), 349: uint8(26), 350: uint8(26), 351: uint8(26), 352: uint8(27), 353: uint8(27), 354: uint8(27), 355: uint8(27), 356: uint8(27), 357: uint8(27), 358: uint8(27), 359: uint8(27), 360: uint8(27), 361: uint8(27), 362: uint8(27), 363: uint8(27), 364: uint8(27), 365: uint8(27), 366: uint8(27), 367: uint8(27), 368: uint8(27), 369: uint8(27), 370: uint8(27), 371: uint8(27), 372: uint8(27), 373: uint8(27), 374: uint8(27), 375: uint8(27), 376: uint8(27), 377: uint8(27), 378: uint8(27), 379: uint8(27), 380: uint8(27), 381: uint8(27), 382: uint8(27), 383: uint8(27), 384: uint8(28), 385: uint8(28), 386: uint8(28), 387: uint8(28), 388: uint8(28), 389: uint8(28), 390: uint8(28), 391: uint8(28), 392: uint8(28), 393: uint8(28), 394: uint8(28), 395: uint8(28), 396: uint8(28), 397: uint8(28), 398: uint8(28), 399: uint8(28), 400: uint8(28), 401: uint8(28), 402: uint8(28), 403: uint8(28), 404: uint8(28), 405: uint8(28), 406: uint8(28), 407: uint8(28), 408: uint8(28), 409: uint8(28), 410: uint8(28), 411: uint8(28), 412: uint8(28), 413: uint8(28), 414: uint8(28), 415: uint8(28), 416: uint8(28), 417: uint8(28), 418: uint8(28), 419: uint8(28), 420: uint8(28), 421: uint8(28), 422: uint8(28), 423: uint8(28), 424: uint8(28), 425: uint8(28), 426: uint8(28), 427: uint8(28), 428: uint8(28), 429: uint8(28), 430: uint8(28), 431: uint8(28), 432: uint8(28), 433: uint8(28), 434: uint8(28), 435: uint8(28), 436: uint8(28), 437: uint8(28), 438: uint8(28), 439: uint8(28), 440: uint8(28), 441: uint8(28), 442: uint8(28), 443: uint8(28), 444: uint8(28), 445: uint8(28), 446: uint8(28), 447: uint8(28), 448: uint8(29), 449: uint8(29), 450: uint8(29), 451: uint8(29), 452: uint8(29), 453: uint8(29), 454: uint8(29), 455: uint8(29), 456: uint8(29), 457: uint8(29), 458: uint8(29), 459: uint8(29), 460: uint8(29), 461: uint8(29), 462: uint8(29), 463: uint8(29), 464: uint8(29), 465: uint8(29), 466: uint8(29), 467: uint8(29), 468: uint8(29), 469: uint8(29), 470: uint8(29), 471: uint8(29), 472: uint8(29), 473: uint8(29), 474: uint8(29), 475: uint8(29), 476: uint8(29), 477: uint8(29), 478: uint8(29), 479: uint8(29), 480: uint8(29), 481: uint8(29), 482: uint8(29), 483: uint8(29), 484: uint8(29), 485: uint8(29), 486: uint8(29), 487: uint8(29), 488: uint8(29), 489: uint8(29), 490: uint8(29), 491: uint8(29), 492: uint8(29), 493: uint8(29), 494: uint8(29), 495: uint8(29), 496: uint8(29), 497: uint8(29), 498: uint8(29), 499: uint8(29), 500: uint8(29), 501: uint8(29), 502: uint8(29), 503: uint8(29), 504: uint8(29), 505: uint8(29), 506: uint8(29), 507: uint8(29), 508: uint8(29), 509: uint8(29), 510: uint8(29), 511: uint8(29), } var X_length_code = [256]Tuch{ 1: uint8(1), 2: uint8(2), 3: uint8(3), 4: uint8(4), 5: uint8(5), 6: uint8(6), 7: uint8(7), 8: uint8(8), 9: uint8(8), 10: uint8(9), 11: uint8(9), 12: uint8(10), 13: uint8(10), 14: uint8(11), 15: uint8(11), 16: uint8(12), 17: uint8(12), 18: uint8(12), 19: uint8(12), 20: uint8(13), 21: uint8(13), 22: uint8(13), 23: uint8(13), 24: uint8(14), 25: uint8(14), 26: uint8(14), 27: uint8(14), 28: uint8(15), 29: uint8(15), 30: uint8(15), 31: uint8(15), 32: uint8(16), 33: uint8(16), 34: uint8(16), 35: uint8(16), 36: uint8(16), 37: uint8(16), 38: uint8(16), 39: uint8(16), 40: uint8(17), 41: uint8(17), 42: uint8(17), 43: uint8(17), 44: uint8(17), 45: uint8(17), 46: uint8(17), 47: uint8(17), 48: uint8(18), 49: uint8(18), 50: uint8(18), 51: uint8(18), 52: uint8(18), 53: uint8(18), 54: uint8(18), 55: uint8(18), 56: uint8(19), 57: uint8(19), 58: uint8(19), 59: uint8(19), 60: uint8(19), 61: uint8(19), 62: uint8(19), 63: uint8(19), 64: uint8(20), 65: uint8(20), 66: uint8(20), 67: uint8(20), 68: uint8(20), 69: uint8(20), 70: uint8(20), 71: uint8(20), 72: uint8(20), 73: uint8(20), 74: uint8(20), 75: uint8(20), 76: uint8(20), 77: uint8(20), 78: uint8(20), 79: uint8(20), 80: uint8(21), 81: uint8(21), 82: uint8(21), 83: uint8(21), 84: uint8(21), 85: uint8(21), 86: uint8(21), 87: uint8(21), 88: uint8(21), 89: uint8(21), 90: uint8(21), 91: uint8(21), 92: uint8(21), 93: uint8(21), 94: uint8(21), 95: uint8(21), 96: uint8(22), 97: uint8(22), 98: uint8(22), 99: uint8(22), 100: uint8(22), 101: uint8(22), 102: uint8(22), 103: uint8(22), 104: uint8(22), 105: uint8(22), 106: uint8(22), 107: uint8(22), 108: uint8(22), 109: uint8(22), 110: uint8(22), 111: uint8(22), 112: uint8(23), 113: uint8(23), 114: uint8(23), 115: uint8(23), 116: uint8(23), 117: uint8(23), 118: uint8(23), 119: uint8(23), 120: uint8(23), 121: uint8(23), 122: uint8(23), 123: uint8(23), 124: uint8(23), 125: uint8(23), 126: uint8(23), 127: uint8(23), 128: uint8(24), 129: uint8(24), 130: uint8(24), 131: uint8(24), 132: uint8(24), 133: uint8(24), 134: uint8(24), 135: uint8(24), 136: uint8(24), 137: uint8(24), 138: uint8(24), 139: uint8(24), 140: uint8(24), 141: uint8(24), 142: uint8(24), 143: uint8(24), 144: uint8(24), 145: uint8(24), 146: uint8(24), 147: uint8(24), 148: uint8(24), 149: uint8(24), 150: uint8(24), 151: uint8(24), 152: uint8(24), 153: uint8(24), 154: uint8(24), 155: uint8(24), 156: uint8(24), 157: uint8(24), 158: uint8(24), 159: uint8(24), 160: uint8(25), 161: uint8(25), 162: uint8(25), 163: uint8(25), 164: uint8(25), 165: uint8(25), 166: uint8(25), 167: uint8(25), 168: uint8(25), 169: uint8(25), 170: uint8(25), 171: uint8(25), 172: uint8(25), 173: uint8(25), 174: uint8(25), 175: uint8(25), 176: uint8(25), 177: uint8(25), 178: uint8(25), 179: uint8(25), 180: uint8(25), 181: uint8(25), 182: uint8(25), 183: uint8(25), 184: uint8(25), 185: uint8(25), 186: uint8(25), 187: uint8(25), 188: uint8(25), 189: uint8(25), 190: uint8(25), 191: uint8(25), 192: uint8(26), 193: uint8(26), 194: uint8(26), 195: uint8(26), 196: uint8(26), 197: uint8(26), 198: uint8(26), 199: uint8(26), 200: uint8(26), 201: uint8(26), 202: uint8(26), 203: uint8(26), 204: uint8(26), 205: uint8(26), 206: uint8(26), 207: uint8(26), 208: uint8(26), 209: uint8(26), 210: uint8(26), 211: uint8(26), 212: uint8(26), 213: uint8(26), 214: uint8(26), 215: uint8(26), 216: uint8(26), 217: uint8(26), 218: uint8(26), 219: uint8(26), 220: uint8(26), 221: uint8(26), 222: uint8(26), 223: uint8(26), 224: uint8(27), 225: uint8(27), 226: uint8(27), 227: uint8(27), 228: uint8(27), 229: uint8(27), 230: uint8(27), 231: uint8(27), 232: uint8(27), 233: uint8(27), 234: uint8(27), 235: uint8(27), 236: uint8(27), 237: uint8(27), 238: uint8(27), 239: uint8(27), 240: uint8(27), 241: uint8(27), 242: uint8(27), 243: uint8(27), 244: uint8(27), 245: uint8(27), 246: uint8(27), 247: uint8(27), 248: uint8(27), 249: uint8(27), 250: uint8(27), 251: uint8(27), 252: uint8(27), 253: uint8(27), 254: uint8(27), 255: uint8(28), } var Xdeflate_copyright = [68]uint8{' ', 'd', 'e', 'f', 'l', 'a', 't', 'e', ' ', '1', '.', '3', '.', '1', ' ', 'C', 'o', 'p', 'y', 'r', 'i', 'g', 'h', 't', ' ', '1', '9', '9', '5', '-', '2', '0', '2', '4', ' ', 'J', 'e', 'a', 'n', '-', 'l', 'o', 'u', 'p', ' ', 'G', 'a', 'i', 'l', 'l', 'y', ' ', 'a', 'n', 'd', ' ', 'M', 'a', 'r', 'k', ' ', 'A', 'd', 'l', 'e', 'r', ' '} var XimgPixmapImageType = TTk_ImageType{ Fname: __ccgo_ts + 48241, } var Xinflate_copyright = [47]uint8{' ', 'i', 'n', 'f', 'l', 'a', 't', 'e', ' ', '1', '.', '3', '.', '1', ' ', 'C', 'o', 'p', 'y', 'r', 'i', 'g', 'h', 't', ' ', '1', '9', '9', '5', '-', '2', '0', '2', '4', ' ', 'M', 'a', 'r', 'k', ' ', 'A', 'd', 'l', 'e', 'r', ' '} /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Informational/debugging messages */ /* The following #define specifies the packing of the four components * into the compact INT32 representation. * Note that this formula must match the actual arithmetic encoder * and decoder implementation. The implementation has to be changed * if this formula is changed. * The current organization is leaned on Markus Kuhn's JBIG * implementation (jbig_tab.c). */ var Xjpeg_aritab = [114]TINT32{ 0: libc.Int32FromInt32(0x5a1d)<XYZ\x00Image width is zero in IHDR\x00Invalid image width in IHDR\x00Image width is too large for this architecture\x00Image width exceeds user limit in IHDR\x00Image height is zero in IHDR\x00Invalid image height in IHDR\x00Image height exceeds user limit in IHDR\x00Invalid bit depth in IHDR\x00Invalid color type in IHDR\x00Invalid color type/bit depth combination in IHDR\x00Unknown interlace method in IHDR\x00Unknown compression method in IHDR\x00MNG features are not allowed in a PNG datastream\x00Unknown filter method in IHDR\x00Invalid filter method in IHDR\x00Invalid IHDR data\x00ASCII conversion buffer too small\x00fixed point overflow ignored\x00gamma table being rebuilt\x00png_process_data_skip is not implemented in any current version of libpng\x00Not a PNG file\x00PNG file corrupted by ASCII conversion\x00Missing IHDR before IDAT\x00Missing PLTE before IDAT\x00Too many IDATs found\x00Invalid IHDR length\x00Potential overflow of save_buffer\x00Insufficient memory for save_buffer\x00save_buffer error\x00Not enough compressed data\x00No IDAT data (internal error)\x00Truncated compressed data in IDAT\x00IDAT: ADLER32 checksum mismatch\x00Decompression error in IDAT\x00Extra compressed data in IDAT\x00Extra compression data in IDAT\x00bad adaptive filter value\x00progressive row overflow\x00internal progressive row size calculation error\x00png_read_update_info/png_start_read_image: duplicate call\x00png_start_read_image/png_read_update_info: duplicate call\x00Invalid attempt to read row data\x00sequential row overflow\x00internal sequential row size calculation error\x00Interlace handling should be turned on when using png_read_image\x00Read palette index exceeding num_palette\x00.Too many IDATs found\x00..Too many IDATs found\x00Image is too high to process with png_read_png()\x00png_image_read: out of memory\x00png_image_read: opaque pointer not NULL\x00png_image_begin_read_from_stdio: invalid argument\x00png_image_begin_read_from_stdio: incorrect PNG_IMAGE_VERSION\x00rb\x00png_image_begin_read_from_file: invalid argument\x00png_image_begin_read_from_file: incorrect PNG_IMAGE_VERSION\x00read beyond end of data\x00invalid memory read\x00png_image_begin_read_from_memory: invalid argument\x00png_image_begin_read_from_memory: incorrect PNG_IMAGE_VERSION\x00unexpected encoding (internal error)\x00color-map index out of range\x00bad encoding (internal error)\x00background color must be supplied to remove alpha/transparency\x00gray[8] color-map: too few entries\x00gray[16] color-map: too few entries\x00gray+alpha color-map: too few entries\x00gray-alpha color-map: too few entries\x00ga-alpha color-map: too few entries\x00rgb[ga] color-map: too few entries\x00rgb[gray] color-map: too few entries\x00rgb+alpha color-map: too few entries\x00rgb-alpha color-map: too few entries\x00rgb color-map: too few entries\x00palette color-map: too few entries\x00invalid PNG color type\x00bad data option (internal error)\x00color map overflow (BAD internal error)\x00bad processing option (internal error)\x00bad background index (internal error)\x00unknown interlace type\x00bad color-map processing (internal error)\x00lost rgb to gray\x00unexpected compose\x00lost/gained channels\x00unexpected 8-bit transformation\x00unexpected bit depth\x00png_read_image: unsupported transformation\x00png_image_read: alpha channel lost\x00unexpected alpha swap transformation\x00png_read_image: invalid transformations\x00png_image_finish_read[color-map]: no color-map\x00png_image_finish_read: image too large\x00png_image_finish_read: invalid argument\x00png_image_finish_read: row_stride too large\x00png_image_finish_read: damaged PNG_IMAGE_VERSION\x00Call to NULL read function\x00Read Error\x00Can't set both read_data_fn and write_data_fn in the same structure\x00Can't discard critical data on CRC error\x00invalid after png_start_read_image or png_read_update_info\x00invalid before the PNG header has been read\x00Application must supply a known background gamma\x00png_set_background\x00gamma value\x00output gamma out of expected range\x00invalid alpha mode\x00conflicting calls to set alpha mode and background\x00invalid file gamma in png_set_gamma\x00invalid screen gamma in png_set_gamma\x00invalid error action to rgb_to_gray\x00ignoring out of range rgb_to_gray coefficients\x00rgb to gray red coefficient\x00rgb to gray green coefficient\x00libpng does not support gamma+background+rgb_to_gray\x00invalid background gamma type\x00Palette is NULL in indexed image\x00png_do_encode_alpha: unexpected call\x00NULL row buffer\x00Uninitialized row\x00png_do_rgb_to_gray found nongray pixel\x00png_do_quantize returned rowbytes=0\x00PNG unsigned integer out of range\x00PNG fixed point integer out of range\x00CRC error\x00insufficient memory to read chunk\x00 using zstream\x001.3.1\x00invalid window size (libpng)\x00zstream unclaimed\x00extra compressed data\x00out of place\x00invalid\x00missing IHDR\x00ignored in grayscale PNG\x00tRNS must be after\x00hIST must be after\x00bKGD must be after\x00invalid values\x00too many profiles\x00out of memory\x00bad compression method\x00bad keyword\x00No space in chunk cache for sPLT\x00malformed sPLT chunk\x00sPLT chunk has bad length\x00sPLT chunk too long\x00sPLT chunk requires too much memory\x00invalid with alpha channel\x00invalid index\x00invalid gray level\x00invalid color\x00incorrect byte-order specifier\x00invalid parameter count\x00unrecognized equation type\x00invalid data\x00invalid unit\x00bad width format\x00non-positive width\x00bad height format\x00non-positive height\x00no space in chunk cache\x00Insufficient memory to process text chunk\x00unknown compression type\x00Read failure in png_handle_zTXt\x00bad compression info\x00unknown chunk exceeds memory limits\x00error in user chunk\x00Saving unknown chunk:\x00forcing save of an unhandled chunk; please call png_set_keep_unknown_chunks\x00unhandled critical chunk\x00invalid chunk type\x00chunk data is too large\x00internal row logic error\x00internal row size calculation error\x00internal row width error\x00invalid user transform pixel depth\x00Not enough image data\x00Extra compressed data\x00Too much image data\x00Row has too many bytes to allocate in memory\x00cHRM White X\x00cHRM White Y\x00cHRM Red X\x00cHRM Red Y\x00cHRM Green X\x00cHRM Green Y\x00cHRM Blue X\x00cHRM Blue Y\x00cHRM Red Z\x00cHRM Green Z\x00cHRM Blue Z\x00png_set_eXIf does not work; use png_set_eXIf_1\x00Insufficient memory for eXIf chunk data\x00png_set_gAMA\x00Invalid palette size, hIST allocation skipped\x00Insufficient memory for hIST chunk data\x00Invalid pCAL equation type\x00Invalid pCAL parameter count\x00Invalid format for pCAL parameter\x00Insufficient memory for pCAL purpose\x00Insufficient memory for pCAL units\x00Insufficient memory for pCAL params\x00Insufficient memory for pCAL parameter\x00Invalid sCAL unit\x00Invalid sCAL width\x00Invalid sCAL height\x00Memory allocation failed while processing sCAL\x00Invalid sCAL width ignored\x00Invalid sCAL height ignored\x00Invalid palette length\x00Invalid palette\x00Invalid iCCP compression method\x00Insufficient memory to process iCCP chunk\x00Insufficient memory to process iCCP profile\x00Insufficient memory to store text\x00too many text chunks\x00text compression mode is out of range\x00text chunk: out of memory\x00tRNS chunk has out-of-range samples for bit_depth\x00too many sPLT chunks\x00png_set_sPLT: invalid sPLT\x00sPLT out of memory\x00png_set_unknown_chunks now expects a valid location\x00invalid location in png_set_unknown_chunks\x00too many unknown chunks\x00unknown chunk: out of memory\x00invalid unknown chunk location\x00png_set_keep_unknown_chunks: invalid keep\x00png_set_keep_unknown_chunks: no chunk list\x00png_set_keep_unknown_chunks: too many chunks\x00invalid compression buffer size\x00Compression buffer size cannot be changed because it is in use\x00Compression buffer size limited to system maximum\x00Compression buffer size cannot be reduced below 6\x00keyword truncated\x00keyword \"@1\": bad character '0x@2'\x00pngtcl\x00png_set_filler is invalid for low bit depth gray output\x00png_set_filler: inappropriate color type\x00info change after png_start_read_image or png_read_update_info\x00Call to NULL write function\x00Write Error\x00Writing zero-length unknown chunk\x00profile matches sRGB but writing iCCP instead\x00Valid palette required for paletted images\x00No IDATs written into file\x00Wrote palette index exceeding num_palette\x00png_write_info was never called before png_write_row\x00internal write transform logic error\x00Unknown row filter for method 0\x00png_set_filter: UP/AVG/PAETH cannot be added after start\x00Unknown custom filter method\x00Only compression windows <= 32k supported by PNG\x00Only compression windows >= 256 supported by PNG\x00Only compression method 8 is supported by PNG\x00no rows for png_write_image to write\x00PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported\x00png_image_write_: out of memory\x00png_write_image: internal call error\x00memory image too large\x00supplied row stride too small\x00image row stride too large\x00no color-map for color-mapped image\x00png_write_image: unsupported transformation\x00png_image_write_to_memory: PNG too big\x00png_image_write_to_memory: invalid argument\x00png_image_write_to_memory: incorrect PNG_IMAGE_VERSION\x00png_image_write_to_stdio: invalid argument\x00png_image_write_to_stdio: incorrect PNG_IMAGE_VERSION\x00wb\x00png_image_write_to_file: invalid argument\x00png_image_write_to_file: incorrect PNG_IMAGE_VERSION\x00length exceeds PNG maximum\x00in use by IDAT\x00deflateEnd failed (ignored)\x00compressed data too long\x00error writing ancillary chunked compressed data\x00Invalid bit depth for grayscale image\x00Invalid bit depth for RGB image\x00Invalid bit depth for paletted image\x00Invalid bit depth for grayscale+alpha image\x00Invalid bit depth for RGBA image\x00Invalid image color type specified\x00Invalid compression type specified\x00Invalid filter type specified\x00Invalid interlace type specified\x00Invalid number of colors in palette\x00Ignoring request to write a PLTE chunk in grayscale PNG\x00Z_OK on Z_FINISH with output space\x00Invalid sRGB rendering intent specified\x00No profile for iCCP chunk\x00ICC profile too short\x00ICC profile length invalid (not a multiple of 4)\x00Profile length does not match profile\x00iCCP: invalid keyword\x00sPLT: invalid keyword\x00Invalid sBIT depth specified\x00Invalid number of transparent colors specified\x00Ignoring attempt to write tRNS chunk out-of-range for bit_depth\x00Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8\x00Can't write tRNS with an alpha channel\x00Invalid background palette index\x00Ignoring attempt to write 16-bit bKGD chunk when bit_depth is 8\x00Ignoring attempt to write bKGD chunk out-of-range for bit_depth\x00Invalid number of histogram entries specified\x00tEXt: invalid keyword\x00tEXt: text too long\x00zTXt: invalid compression type\x00zTXt: invalid keyword\x00iTXt: invalid keyword\x00iTXt: invalid compression\x00iTXt: uncompressed text too long\x00Unrecognized unit type for oFFs chunk\x00Unrecognized equation type for pCAL chunk\x00pCAL: invalid keyword\x00Can't write sCAL (buffer too small)\x00Unrecognized unit type for pHYs chunk\x00Invalid time specified for tIME chunk\x00Integer overflow in %s\x00Invalid argument to _TIFFMultiplySSize() in %s\x00Integer overflow\x00Failed to allocate memory for %s (%d elements of %d bytes each)\x00Cannot get \"Predictor\" tag as plugin is not configured\x00No space for \"TransferFunction\" tag\x00TIFFCleanup\x00tif_cur_cumulated_mem_alloc = %llu whereas it should be 0\x00None\x00LZW\x00PackBits\x00ThunderScan\x00NeXT\x00JPEG\x00Old-style JPEG\x00CCITT RLE\x00CCITT RLE/W\x00CCITT Group 3\x00CCITT Group 4\x00ISO JBIG\x00Deflate\x00AdobeDeflate\x00PixarLog\x00SGILog\x00SGILog24\x00LZMA\x00ZSTD\x00WEBP\x00LERC\x00%u\x00%s compression support is not configured\x00%s %s encoding is not implemented\x00Compression scheme %u %s encoding is not implemented\x00scanline\x00strip\x00tile\x00%s %s decoding is not implemented\x00Compression scheme %u %s decoding is not implemented\x00Compression algorithm does not support random access\x00TIFFRegisterCODEC\x00No space to register compression scheme %s\x00TIFFUnRegisterCODEC\x00Cannot remove compression scheme %s; not registered\x00SubfileType\x00OldSubfileType\x00ImageWidth\x00ImageLength\x00BitsPerSample\x00Compression\x00PhotometricInterpretation\x00Threshholding\x00CellWidth\x00CellLength\x00FillOrder\x00DocumentName\x00ImageDescription\x00Make\x00Model\x00StripOffsets\x00Orientation\x00SamplesPerPixel\x00RowsPerStrip\x00StripByteCounts\x00MinSampleValue\x00MaxSampleValue\x00XResolution\x00YResolution\x00PlanarConfiguration\x00PageName\x00XPosition\x00YPosition\x00FreeOffsets\x00FreeByteCounts\x00GrayResponseUnit\x00GrayResponseCurve\x00ResolutionUnit\x00PageNumber\x00ColorResponseUnit\x00TransferFunction\x00Software\x00DateTime\x00Artist\x00HostComputer\x00WhitePoint\x00PrimaryChromaticities\x00ColorMap\x00HalftoneHints\x00TileWidth\x00TileLength\x00TileOffsets\x00TileByteCounts\x00SubIFD\x00InkSet\x00InkNames\x00NumberOfInks\x00DotRange\x00TargetPrinter\x00ExtraSamples\x00SampleFormat\x00SMinSampleValue\x00SMaxSampleValue\x00ClipPath\x00XClipPathUnits\x00YClipPathUnits\x00YCbCrCoefficients\x00YCbCrSubsampling\x00YCbCrPositioning\x00ReferenceBlackWhite\x00XMLPacket\x00Matteing\x00DataType\x00ImageDepth\x00TileDepth\x00ImageFullWidth\x00ImageFullLength\x00TextureFormat\x00TextureWrapModes\x00FieldOfViewCotangent\x00MatrixWorldToScreen\x00MatrixWorldToCamera\x00Copyright\x00RichTIFFIPTC\x00Photoshop\x00EXIFIFDOffset\x00ICC Profile\x00GPSIFDOffset\x00FaxRecvParams\x00FaxSubAddress\x00FaxRecvTime\x00FaxDcs\x00StoNits\x00Adobe Photoshop Document Data Block\x00InteroperabilityIFDOffset\x00DNGVersion\x00DNGBackwardVersion\x00UniqueCameraModel\x00LocalizedCameraModel\x00CFAPlaneColor\x00CFALayout\x00LinearizationTable\x00BlackLevelRepeatDim\x00BlackLevel\x00BlackLevelDeltaH\x00BlackLevelDeltaV\x00WhiteLevel\x00DefaultScale\x00BestQualityScale\x00DefaultCropOrigin\x00DefaultCropSize\x00ColorMatrix1\x00ColorMatrix2\x00CameraCalibration1\x00CameraCalibration2\x00ReductionMatrix1\x00ReductionMatrix2\x00AnalogBalance\x00AsShotNeutral\x00AsShotWhiteXY\x00BaselineExposure\x00BaselineNoise\x00BaselineSharpness\x00BayerGreenSplit\x00LinearResponseLimit\x00CameraSerialNumber\x00LensInfo\x00ChromaBlurRadius\x00AntiAliasStrength\x00ShadowScale\x00DNGPrivateData\x00MakerNoteSafety\x00CalibrationIlluminant1\x00CalibrationIlluminant2\x00RawDataUniqueID\x00OriginalRawFileName\x00OriginalRawFileData\x00ActiveArea\x00MaskedAreas\x00AsShotICCProfile\x00AsShotPreProfileMatrix\x00CurrentICCProfile\x00CurrentPreProfileMatrix\x00PerSample\x00EP CFARepeatPatternDim\x00EP CFAPattern\x00Indexed\x00GlobalParametersIFD\x00ProfileType\x00FaxProfile\x00CodingMethods\x00VersionYear\x00ModeNumber\x00Decode\x00ImageBaseColor\x00T82Options\x00StripRowCounts\x00ImageLayer\x00ExposureTime\x00FNumber\x00ExposureProgram\x00SpectralSensitivity\x00ISOSpeedRatings\x00OptoelectricConversionFactor\x00SensitivityType\x00StandardOutputSensitivity\x00RecommendedExposureIndex\x00ISOSpeed\x00ISOSpeedLatitudeyyy\x00ISOSpeedLatitudezzz\x00ExifVersion\x00DateTimeOriginal\x00DateTimeDigitized\x00OffsetTime\x00OffsetTimeOriginal\x00OffsetTimeDigitized\x00ComponentsConfiguration\x00CompressedBitsPerPixel\x00ShutterSpeedValue\x00ApertureValue\x00BrightnessValue\x00ExposureBiasValue\x00MaxApertureValue\x00SubjectDistance\x00MeteringMode\x00LightSource\x00Flash\x00FocalLength\x00SubjectArea\x00MakerNote\x00UserComment\x00SubSecTime\x00SubSecTimeOriginal\x00SubSecTimeDigitized\x00Temperature\x00Humidity\x00Pressure\x00WaterDepth\x00Acceleration\x00CameraElevationAngle\x00FlashpixVersion\x00ColorSpace\x00PixelXDimension\x00PixelYDimension\x00RelatedSoundFile\x00FlashEnergy\x00SpatialFrequencyResponse\x00FocalPlaneXResolution\x00FocalPlaneYResolution\x00FocalPlaneResolutionUnit\x00SubjectLocation\x00ExposureIndex\x00SensingMethod\x00FileSource\x00SceneType\x00CFAPattern\x00CustomRendered\x00ExposureMode\x00WhiteBalance\x00DigitalZoomRatio\x00FocalLengthIn35mmFilm\x00SceneCaptureType\x00GainControl\x00Contrast\x00Saturation\x00Sharpness\x00DeviceSettingDescription\x00SubjectDistanceRange\x00ImageUniqueID\x00CameraOwnerName\x00BodySerialNumber\x00LensSpecification\x00LensMake\x00LensModel\x00LensSerialNumber\x00Gamma\x00CompositeImage\x00SourceImageNumberOfCompositeImage\x00SourceExposureTimesOfCompositeImage\x00VersionID\x00LatitudeRef\x00Latitude\x00LongitudeRef\x00Longitude\x00AltitudeRef\x00Altitude\x00TimeStamp\x00Satellites\x00Status\x00MeasureMode\x00DOP\x00SpeedRef\x00Speed\x00TrackRef\x00Track\x00ImgDirectionRef\x00ImgDirection\x00MapDatum\x00DestLatitudeRef\x00DestLatitude\x00DestLongitudeRef\x00DestLongitude\x00DestBearingRef\x00DestBearing\x00DestDistanceRef\x00DestDistance\x00ProcessingMethod\x00AreaInformation\x00DateStamp\x00Differential\x00HorizontalPositioningError\x00_TIFFSetupFields\x00Setting up field info failed\x00Failed to allocate fields array\x00%s: \n\x00TRUE\x00FALSE\x00field[%2d] %5lu, %2d, %2d, %d, %2d, %5s, %5s, %s\n\x00TIFFFieldWithTag\x00Warning, unknown tag 0x%x\x00TIFFFieldWithName\x00Warning, unknown tag %s\x00Tag %d\x00The value of field_readcount and field_writecount must be greater than or equal to -3 and not zero.\x00Field_name of %d.th allocation tag %d is NULL\x00ExtraSamples tag value is changing, but TransferFunction was read with a different value. Canceling it\x00TIFFSetField\x00%s: Invalid InkNames value; no null at given buffer end location %u, after %u ink\x00SamplesPerPixel tag value is changing, but SMinSampleValue tag was read with a different value. Canceling it\x00SamplesPerPixel tag value is changing, but SMaxSampleValue tag was read with a different value. Canceling it\x00SamplesPerPixel tag value is changing, but TransferFunction was read with a different value. Canceling it\x00Nonstandard tile width %u, convert file\x00Nonstandard tile length %u, convert file\x00%s: Sorry, cannot nest SubIFDs\x00Warning %s; Tag %s:\n Value %u of NumberOfInks is different from the number of inks %u.\n -> NumberOfInks value adapted to %u\x00Warning %s; Tag %s:\n Value %u of NumberOfInks is different from the SamplesPerPixel value %u\x00Error %s; Tag %s:\n It is not possible to set the value %u for NumberOfInks\n which is different from the number of inks in the InkNames tag (%u)\x00pseudo-\x00%s: Ignored %stag \"%s\" (not supported by libtiff)\x00%s: Invalid %stag \"%s\" (not supported by codec)\x00%s: Failed to allocate space for list of custom values\x00%s: Bad field type %d for \"%s\"\x00%s: Too long string value for \"%s\". Maximum supported is 2147483647 bytes\x00%s: Null count for \"%s\" (type %d, writecount %d, passcount %d)\x00custom tag binary object\x00%s: Bad LONG8 value %llu at %d. array position for \"%s\" tag %d in ClassicTIFF. Tag won't be written to file\x00%s: Bad SLONG8 value %lli at %d. array position for \"%s\" tag %d in ClassicTIFF. Tag won't be written to file\x00%s: Bad LONG8 or IFD8 value %llu for \"%s\" tag %d in ClassicTIFF. Tag won't be written to file\x00%s: Bad SLONG8 value %lli for \"%s\" tag %d in ClassicTIFF. Tag won't be written to file\x00Rational2Double: .set_field_type in not 4 but %d\x00%s: Bad value %u for \"%s\" tag\x00%s: Bad value %f for \"%s\" tag\x00%s: Unknown %stag %u\x00%s: Cannot modify tag \"%s\" while writing\x00_TIFFVGetField\x00Starting directory %u at offset 0x%llx (%llu) might cause an IFD loop\x00%s:%d: %s: Error fetching directory count\x00./../compat/libtiff/libtiff/tif_dir.c\x00Error fetching directory link\x00Sanity check on directory count failed\x00%s: Error fetching directory link\x00the next directory %u at offset 0x%llx (%llu) might be an IFD loop. Treating directory %d as last directory\x00Can not unlink directory in read-only file\x00For TIFFUnlinkDirectory() first directory starts with number 1 and not 0\x00Directory %u does not exist\x00Error writing directory link\x00TIFFReadDirEntryArray\x00ReadDirEntryArray\x00Requested memory size for tag %d (0x%x) %u is greater than filesize %llu. Memory not allocated, tag not read\x00Incorrect count for \"%s\"\x00Incompatible type for \"%s\"\x00IO error during reading of \"%s\"\x00Incorrect value for \"%s\"\x00Cannot handle different values per sample for \"%s\"\x00Sanity check on size of \"%s\" value failed\x00Out of memory reading of \"%s\"\x00Incorrect count for \"%s\"; tag ignored\x00Incompatible type for \"%s\"; tag ignored\x00IO error during reading of \"%s\"; tag ignored\x00Incorrect value for \"%s\"; tag ignored\x00Cannot handle different values per sample for \"%s\"; tag ignored\x00Sanity check on size of \"%s\" value failed; tag ignored\x00Out of memory reading of \"%s\"; tag ignored\x00EvaluateIFDdatasizeReading\x00Too large IFD data size\x00Failed to read directory at offset %llu\x00Failed to allocate memory for counting IFD data size at reading\x00Unknown field with tag %u (0x%x) encountered\x00Registering anonymous field with tag %u (0x%x) failed\x00Planarconfig tag value assumed incorrect, assuming data is contig instead of chunky\x00unknown tagname\x00Invalid data type for tag %s\x00Ignoring %s since BitsPerSample tag not found\x00Ignoring %s because BitsPerSample=%u>24\x00Photometric tag is missing, assuming data is YCbCr\x00Photometric tag value assumed incorrect, assuming data is YCbCr instead of RGB\x00BitsPerSample tag is missing, assuming 8 bits per sample\x00SamplesPerPixel tag is missing, assuming correct SamplesPerPixel value is 3\x00SamplesPerPixel tag is missing, applying correct SamplesPerPixel value of 3\x00tiles\x00strips\x00Cannot handle zero number of %s\x00Sum of Photometric type-related color channels and ExtraSamples doesn't match SamplesPerPixel. Defining non-color channels as ExtraSamples.\x00Failed to allocate memory for temporary new sampleinfo array (%u 16 bit elements)\x00Colormap\x00TIFF directory is missing required \"StripByteCounts\" field, calculating from imagelength\x00Bogus \"StripByteCounts\" field, ignoring and calculating from imagelength\x00Wrong \"StripByteCounts\" field, ignoring and calculating from imagelength\x00Cannot handle zero scanline size\x00Cannot handle zero tile size\x00Cannot handle zero strip size\x00Invalid TIFF directory; tags are not sorted in ascending order\x00Failed to read custom directory at offset %llu\x00Wrong data type %u for \"%s\"; tag ignored\x00Requested memory size for StripByteCounts of %llu is greater than filesize %llu. Memory not allocated\x00for \"StripByteCounts\" array\x00Cannot determine size of unknown tag type %u\x00TIFF directory is missing required \"%s\" field\x00_TIFFCheckDirNumberAndOffset\x00Not enough memory\x00TIFF directory %d has IFD looping to directory %u at offset 0x%llx (%llu)\x00Insertion in tif_map_dir_offset_to_number failed\x00Insertion in tif_map_dir_number_to_offset failed\x00Cannot handle more than %u TIFF directories\x00malloc(sizeof(TIFFOffsetAndDirNumber)) failed\x00_TIFFRemoveEntryFromDirectoryListByOffset\x00Unexpectedly tif_map_dir_number_to_offset is missing but tif_map_dir_offset_to_number exists.\x00incorrect count for field \"%s\" (%llu, expecting %u); tag ignored\x00incorrect count for field \"%s\" (%llu, expecting %u); tag trimmed\x00%s: Seek error accessing TIFF directory\x00%s: Can not read TIFF directory count\x00Sanity check on directory count failed, this is probably not a valid IFD offset\x00to read TIFF directory\x00%.100s: Can not read TIFF directory\x00Can not read TIFF directory count\x00Sanity check on directory count failed, zero tag directories not supported\x00Requested memory size for TIFF directory of %llu is greater than filesize %llu. Memory not allocated, TIFF directory not read\x00Can not read TIFF directory\x00TIFFFetchNormalTag\x00No definition found for tag %u\x00Defined set_field_type of custom tag %u (%s) is TIFF_SETGET_UNDEFINED and thus tag is not read from file\x00ASCII value for tag \"%s\" contains null byte in value; value incorrectly truncated during reading due to implementation limitations\x00ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null\x00incorrect count for field \"%s\", expected 2, got %llu\x00incorrect count for field \"%s\", expected %d, got %llu\x00ASCII value for ASCII array tag \"%s\" does not end in null byte. Forcing it to be null\x00LIBTIFF_STRILE_ARRAY_MAX_RESIZE_COUNT\x00Requested memory size for StripArray of %llu is greater than filesize %llu. Memory not allocated\x00for strip array\x00allocChoppedUpStripArrays\x00Requested memory size for StripByteCount and StripOffsets %llu is greater than filesize %llu. Memory not allocated\x00for chopped \"StripByteCounts\" array\x00for chopped \"StripOffsets\" array\x00Invalid type for [Strip|Tile][Offset/ByteCount] tag\x00Cannot read offset/size for strile %d\x00Cannot read offset/size for strile around ~%d\x00File too short\x00Cannot allocate strip offset and bytecount arrays\x00File opened in read-only mode\x00Directory has already been written\x00Error updating TIFF header\x00tif->tif_diroff exceeds 32 bit range allowed for Classic TIFF\x00Error fetching directory count\x00Sanity check on tag count failed, likely corrupt TIFF\x00Error post-encoding before directory write\x00Error flushing data before directory write\x00Creating TIFF with legacy Deflate codec identifier, COMPRESSION_ADOBE_DEFLATE is more widely supported\x00unknown\x00Cannot write tag %u (%s)\x00TIFFLib: _TIFFWriteDirectorySec()\x00Rational2Double: .set_field_type is not 4 but %d\x00Maximum TIFF file size exceeded\x00Cannot find SubIFD tag\x00IO error writing directory at seek to offset\x00IO error writing directory\x00tif_curdircount is TIFF_NON_EXISTENT_DIR_NUMBER, not expected !! Line %d\x00Attempt to write unsigned long value %llu larger than 0xFFFFFFFF for tag %d in Classic TIFF file. TIFF file writing aborted\x00Attempt to write signed long value %lli larger than 0x7FFFFFFF (2147483647) for tag %d in Classic TIFF file. TIFF writing to file aborted\x00Attempt to write signed long value %lli smaller than 0x80000000 (-2147483648) for tag %d in Classic TIFF file. TIFF writing to file aborted\x00Attempt to write value larger than 0xFFFFFFFF in LONG array.\x00Attempt to write value larger than 0xFFFF in SHORT array.\x00Attempt to write value larger than 0xFFFFFFFF in Classic TIFF file.\x00Too few TransferFunctions provided. Tag not written to file\x00Illegal value for SubIFD tag\x00TIFFWriteDirectoryTagCheckedLong8Array\x00LONG8 not allowed for ClassicTIFF\x00TIFFWriteDirectoryTagCheckedSlong8Array\x00SLONG8 not allowed for ClassicTIFF\x00Negative value is illegal\x00Not-a-number value is illegal\x00TIFFLib: DoubleToRational()\x00 Negative Value for Unsigned Rational given.\x00 Num or Denom exceeds ULONG: val=%14.6f, num=%12llu, denom=%12llu | num2=%12llu, denom2=%12llu\x00TIFFLib: DoubleToSrational()\x00 Num or Denom exceeds LONG: val=%14.6f, num=%12llu, denom=%12llu | num2=%12llu, denom2=%12llu\x00IO error writing tag data\x00libtiff does not allow writing more than 2147483647 bytes in a tag\x00Error writing SubIFD directory link\x00Error writing TIFF header\x00Memory mapped files not currently supported for this operation.\x00Attempt to reset field on directory not already on disk.\x00%s: Can not read TIFF directory entry.\x00%s: Could not find tag %u.\x00for field buffer.\x00Value exceeds 32bit range of output type.\x00Value exceeds 16bit range of output type.\x00Unhandled type conversion.\x00%s: Can not write TIFF directory entry.\x00Not enough data for scanline %u, expected a request for at most %d bytes, got a request for %d bytes\x00Bad code word at line %u of %s %u (x %u)\x00Uncompressed data (not supported) at line %u of %s %u (x %u)\x00Premature EOL\x00Line length mismatch\x00%s at line %u of %s %u (got %u, expected %u)\x00Premature EOF at line %u of %s %u (x %u)\x00Fractional scanlines cannot be read\x00End of file has already been reached %d times within that strip\x00Buffer overflow at line %u of %s %u\x00Bits/sample must be 1 for Group 3/4 encoding/decoding\x00Inconsistent number of bytes per row : rowbytes=%lld rowpixels=%u\x00Row pixels integer overflow (rowpixels %u)\x00for Group 3/4 run arrays\x00No space for Group 3/4 reference line\x00Fractional scanlines cannot be written\x00FaxMode\x00FaxFillFunc\x00BadFaxLines\x00CleanFaxData\x00ConsecutiveBadFaxLines\x00Group3Options\x00Group4Options\x00 \x00 Group 4 Options:\x00%suncompressed data\x00 Group 3 Options:\x00%s2-d encoding\x00+\x00%sEOL padding\x00 (%u = 0x%x)\n\x00 Fax Data:\x00 clean\x00 receiver regenerated\x00 uncorrected errors\x00 Bad Fax Lines: %u\n\x00 Consecutive Bad Fax Lines: %u\n\x00InitCCITTFax3\x00Merging common CCITT Fax codec-specific tags failed\x00No space for state block\x00TIFFInitCCITTFax3\x00Merging CCITT Fax 3 codec-specific tags failed\x00Buffer overrun detected : %d bytes available, %d bits needed\x00TIFFInitCCITTFax4\x00Merging CCITT Fax 4 codec-specific tags failed\x00Directory has not yet been written\x00Directory has changes other than the strile arrays. TIFFRewriteDirectory() should be called instead\x00Function not called together with TIFFDeferStrileArrayWriting()\x00tifftcl\x004.7.0\x00Sorry, requested compression method is not configured\x00Sorry, can not handle images with %u-bit samples\x00Sorry, can not handle images with IEEE floating-point samples\x00Missing needed %s tag\x00Sorry, can not handle contiguous data with %s=%u, and %s=%u and Bits/Sample=%u\x00Samples/pixel\x00Sorry, can not handle RGB image with %s=%d\x00Color channels\x00Sorry, can not handle separated image with %s=%d\x00Sorry, can not handle separated image with %s=%u\x00Sorry, LogL data must have %s=%d\x00Sorry, LogLuv data must have %s=%d or %d\x00Sorry, can not handle LogLuv images with %s=%u\x00Planarconfiguration\x00Sorry, can not handle image with %s=%u, %s=%d\x00colorchannels\x00Sorry, can not handle image with %s=%u, %s=%d and %s=%u\x00Bits/sample\x00Sorry, can not handle image with %s=%u\x00Missing required \"Colormap\" tag\x00Out of memory for colormap copy\x00Sorry, can not handle image\x00No \"get\" routine setup\x00No \"put\" routine setupl; probably can not handle image format\x00%s\x00No space for tile buffer\x00unsupported tile size (too wide)\x00tile width or height is zero\x00gtTileSeparate\x00Invalid vertical YCbCr subsampling\x00Width overflow\x00rowsperstrip is zero\x00Integer overflow in gtStripContig\x00gtStripSeparate\x00Integer overflow in gtStripSeparate\x00No space for YCbCr->RGB conversion state\x00Invalid values for YCbCrCoefficients tag\x00Invalid values for ReferenceBlackWhite tag\x00Invalid value for WhitePoint tag.\x00No space for CIE L*a*b*->RGB conversion state.\x00Failed to initialize CIE L*a*b*->RGB conversion state.\x00No space for B&W mapping table\x00No space for photometric conversion table\x00No space for Palette mapping table\x00Assuming 8-bit colormap\x00Can't use TIFFReadRGBAStrip() with tiled file.\x00Row passed to TIFFReadRGBAStrip() must be first in a strip.\x00Invalid row passed to TIFFReadRGBAStrip().\x00Can't use TIFFReadRGBATile() with striped file.\x00tile_xsize or tile_ysize is zero\x00Row/col passed to TIFFReadRGBATile() must be topleft corner of a tile.\x00Invalid row/col passed to TIFFReadRGBATile().\x00Translation buffer too short\x00Not enough data at row %u (short %d pixels)\x00Sorry, can not handle LogL image with %s=%u\x00No support for converting user data format to LogL\x00No space for SGILog translation buffer\x00SGILog compression cannot handle non-contiguous data\x00No support for converting user data format to LogLuv\x00Inappropriate photometric interpretation %u for SGILog compression; %s\x00must be either LogLUV or LogL\x00Y, L\x00XYZ, Luv\x00SGILog compression supported only for %s, or raw data\x00Unknown data format %d for LogLuv compression\x00Unknown encoding %d for LogLuv compression\x00SGILogDataFmt\x00SGILogEncode\x00Merging SGILog codec-specific tags failed\x00%s: No space for LogLuv state block\x00No space for LZW state block\x00No space for LZW code table\x00Old-style LZW codes, convert file\x00LZWDecode: Scanline %u cannot be read due to previous error\x00Not enough data at scanline %u (short %llu bytes)\x00LZWDecode: Strip %u not terminated with EOI code\x00Using code not yet in table\x00LZWDecode: Corrupted LZW table at scanline %u\x00Corrupted LZW table at scanline %u\x00Wrong length of decoded string: data probably corrupted at scanline %u\x00No space for LZW hash table\x00Invalid data for scanline %u\x00Not enough data for scanline %u\x00Unsupported BitsPerSample = %u\x00\"%s\": Bad mode\x00Memory allocation of %llu bytes is beyond the %llu byte limit defined in open options\x00Cumulated memory allocation of %llu + %llu bytes is beyond the %llu cumulated byte limit defined in open options\x00_TIFFmallocExt\x00_TIFFcallocExt\x00_TIFFreallocExt\x00%s: Memory allocation of %llu bytes is beyond the %llu byte limit defined in open options\x00%s: Memory allocation of %llu bytes is beyond the %llu cumulated byte limit defined in open options\x00%s: Out of memory (TIFF structure)\x00One of the client procedures is NULL pointer.\x00H(ost) mode is deprecated. Since libtiff 4.5.1, it is an alias of 'B' / FILLORDER_MSB2LSB.\x00Cannot read TIFF header\x00Not a TIFF or MDI file, bad magic number %u (0x%x)\x00Not a TIFF file, bad version number %u (0x%x)\x00Not a TIFF file, bad BigTIFF offsetsize %u (0x%x)\x00Not a TIFF file, bad BigTIFF unused %u (0x%x)\x00Discarding %d bytes to avoid buffer overrun\x00Terminating PackBitsDecode due to lack of data.\x00Horizontal differencing \"Predictor\" not supported with %u-bit samples\x00Floating point \"Predictor\" not supported with %u data format\x00Floating point \"Predictor\" not supported with %u-bit samples\x00\"Predictor\" value %d not supported\x00horAcc8\x00(cc%stride)!=0\x00horAcc16\x00cc%(2*stride))!=0\x00horAcc32\x00cc%(4*stride))!=0\x00horAcc64\x00cc%(8*stride))!=0\x00fpAcc\x00cc%(bps*stride))!=0\x00PredictorDecodeTile\x00occ0%rowsize != 0\x00horDiff8\x00(cc%(2*stride))!=0\x00horDiff32\x00(cc%(4*stride))!=0\x00horDiff64\x00(cc%(8*stride))!=0\x00fpDiff\x00(cc%(bps*stride))!=0\x00Out of memory allocating %lld byte temp buffer.\x00PredictorEncodeTile\x00(cc0%rowsize)!=0\x00Predictor\x00 Predictor: \x00none \x00horizontal differencing \x00floating point predictor \x00%d (0x%x)\n\x00TIFFPredictorInit\x00Merging Predictor codec-specific tags failed\x00min-is-white\x00min-is-black\x00RGB color\x00palette color (RGB from colormap)\x00transparency mask\x00separated\x00YCbCr\x007 (0x7)\x00CIE L*a*b*\x00ICC L*a*b*\x00ITU L*a*b*\x000 (0x0)\x00row 0 top, col 0 lhs\x00row 0 top, col 0 rhs\x00row 0 bottom, col 0 rhs\x00row 0 bottom, col 0 lhs\x00row 0 lhs, col 0 top\x00row 0 rhs, col 0 top\x00row 0 rhs, col 0 bottom\x00row 0 lhs, col 0 bottom\x00GDAL Metadata\x00GDAL NoDataValue\x00 %s: \x000x%x\x00%lf\x00%f\x00%llu\x00%lld\x000x%llx\x00\x00,\x00 Ink Set: \x00CMYK\n\x00%u (0x%x)\n\x00 Dot Range: %u-%u\n\x00 White Point: %g-%g\n\x00 XMLPacket (XMP Metadata):\n\x00 RichTIFFIPTC Data: , %u bytes\n\x00 Photoshop Data: , %u bytes\n\x00 ICC Profile: , %u bytes\n\x00 Sample to Nits conversion factor: %.4e\n\x00TIFF Directory at offset 0x%llx (%llu)\n\x00 Subfile Type:\x00%sreduced-resolution image\x00/\x00%smulti-page document\x00%stransparency mask\x00 Image Width: %u Image Length: %u\x00 Image Depth: %u\x00 Tile Width: %u Tile Length: %u\x00 Tile Depth: %u\x00 Resolution: %g, %g\x00 (unitless)\x00 pixels/inch\x00 pixels/cm\x00 (unit %u = 0x%x)\x00 Position: %g, %g\n\x00 Bits/Sample: %u\n\x00 Sample Format: \x00void\n\x00signed integer\n\x00unsigned integer\n\x00IEEE floating point\n\x00complex signed integer\n\x00complex IEEE floating point\n\x00 Compression Scheme: \x00 Photometric Interpretation: \x00CIE Log2(L)\n\x00CIE Log2(L) (u',v')\n\x00 Extra Samples: %u<\x00%sunspecified\x00%sassoc-alpha\x00%sunassoc-alpha\x00%s%u (0x%x)\x00, \x00>\n\x00 Ink Names: \x00 NumberOfInks: %d\n\x00 Thresholding: \x00bilevel art scan\n\x00halftone or dithered scan\n\x00error diffused\n\x00 FillOrder: \x00msb-to-lsb\n\x00lsb-to-msb\n\x00 YCbCr Subsampling: %u, %u\n\x00 YCbCr Positioning: \x00centered\n\x00cosited\n\x00 Halftone Hints: light %u dark %u\n\x00 Orientation: \x00 Samples/Pixel: %x\n\x00 Rows/Strip: \x00(infinite)\n\x00%u\n\x00 Min Sample Value: %u\n\x00 Max Sample Value: %u\n\x00 SMin Sample Value:\x00 %g\x00 SMax Sample Value:\x00 Planar Configuration: \x00single image plane\n\x00separate image planes\n\x00 Page Number: %u-%u\n\x00 Color Map: \x00 %5ld: %5u %5u %5u\n\x00(present)\n\x00 Reference Black/White:\n\x00 %2d: %5g %5g\n\x00 Transfer Function: \x00 %2ld: %5u\x00 %5u\x00 SubIFD Offsets:\x00 %5llu\x00Tiles\x00Strips\x00 %u %s:\n\x00 %3u: [%8llu, %8llu]\n\x00\tt\bb\rr\nn\vv\x00\\%c\x00\\%03o\x00 %s: \"\x00\"\n\x00Chunk size requested is larger than file size.\x00Invalid buffer size\x00No space for data buffer at scanline %u\x00Read error at scanline %u; got %d bytes, expected %d\x00Read error at row %u, col %u, tile %u; got %d bytes, expected %d\x00Data buffer too small to hold part of strip %d\x00Seek error at scanline %u, strip %d\x00%u: Row out of range, max %u\x00%u: Sample out of range, max %u\x00%u: Strip out of range, max %u\x00No space for strip buffer\x00Seek error at scanline %u, strip %u\x00Read error at scanline %u, strip %u; got %d bytes, expected %d\x00Seek error at row %u, col %u, tile %u\x00Compression scheme does not support access to raw uncompressed data\x00Invalid strip byte count %llu, strip %u\x00Too large strip byte count %llu, strip %u. Limiting to %llu\x00Read error on strip %u; got %llu bytes, expected %llu\x00Data buffer too small to hold strip %u\x00%u: Tile out of range, max %u\x00Invalid tile byte count for tile %u. Expected %llu, got %llu\x00Likely invalid tile byte count for tile %u. Uncompressed tile size is %llu, compressed one is %llu\x00Read error at row %u, col %u; got %d bytes, expected %d\x00%llu: Invalid tile byte count, tile %u\x00Too large tile byte count %llu, tile %u. Limiting to %llu\x00Data buffer too small to hold tile %u\x00Zero tilewidth\x00Zero tiles\x00File not open for reading\x00Can not read tiles from a striped image\x00Can not read scanlines from a tiled image\x00Cannot compute strip: RowsPerStrip is zero\x00%lu: Sample out of range, max %lu\x00TIFFNumberOfStrips\x00RowsPerStrip is zero\x00Invalid td_samplesperpixel value\x00Invalid YCbCr subsampling (%dx%d)\x00%llu: Invalid strip byte count, strip %lu\x00Invalid YCbCr subsampling\x00Computed scanline size is zero\x00Wrong bitspersample value (%d), Thunder decoder only supports 4bits per sample.\x00Not enough\x00Too much\x00%s data at scanline %lu (%llu != %llu)\x00%lu: Col out of range, max %lu\x00%lu: Row out of range, max %lu\x00%lu: Depth out of range, max %lu\x00TIFFNumberOfTiles\x00Tile length is zero\x00Tile width is zero\x00TIFFTileRowSize\x00Samples per pixel is zero\x00Computed tile row size is zero\x00%s: %s\x00%s: Cannot open\x00%s: \x00Warning, \x00.\n\x00Can not change \"ImageLength\" when using separate planes\x00Zero strips per image\x00Can not grow image by strips when using separate planes\x00Tile %lu out of range, max %lu\x00TIFFSetupStrips\x00Too large Strip/Tile Offsets/ByteCounts arrays\x00for \"StripOffsets\" array\x00File not open for writing\x00Can not write tiles to a striped image\x00Can not write scanlines to a tiled image\x00Must set \"ImageWidth\" before writing data\x00No space for %s arrays\x00No space for output buffer\x00No space to expand strip arrays\x00Seek error at scanline %lu\x00Seek error\x00Cannot read\x00Cannot write\x00Write error at scanline %lu\x00pcx\x00img::pcx\x00\tSize in pixel : %d x %d\n\x00\tDots per inch : %d x %d\n\x00\tNumber of channels: %d\n\x00\tBits per pixel : %d\n\x00\tBytes per line : %d\n\x00yes\x00no\x00\tRLE compression : %s\n\x00Unexpected end-of-file while scanline %d\x00Unexpected end-of-file while reading colormap\x00-compression\x00rle\x00Invalid compression mode \"%s\": must be none or rle.\x00Format (4 channels, 1 bit per channel) \x00is not supported yet.\x00Image has invalid channel/bpp combination: (%d, %d)\x00Can't write PCX header.\x00Can't write %d bytes to image file.\x00pixmap\x00-data\x00-file\x00Unable to allocate memory for PixmapMaster.\x00must specify one of -data or -file\x00can't get image from a file in a\x00 safe interpreter\x00TkimgXpmGetData(): -data and -file are all NULL\x00File format error\x00/* XPM\x00r\x00Unable to allocate memory for command buffer.\x00: \x00Unable to allocate memory for ColorStruct.\x00Unable to allocate memory for color string.\x00Unable to allocate memory for color name.\x00black\x00wrong # args: should be \"\x00 option ?arg arg ...?\"\x00cget\x00 cget option\"\x00configure\x00refcount\x00bad option \"\x00\": must be cget, configure or refcount\x00Unable to allocate memory for PixmapInstance.\x00tried to delete pixmap image when instances still exist\x00img::pixmap\x00png\x00img::png\x00\tDots per inch : %.0f x %.0f\n\x00\tNum channels : %d\n\x00\tBits per channel: %d\n\x00\tFile gamma : %s\n\x00\tFile gamma : %f\n\x00\tTags:\n\x00\t %s: %s\n\x00-alpha\x00-withalpha\x00-matte\x00-tag\x00Invalid alpha value \"%s\": must be a double value greater or equal to zero.\x00Invalid withalpha mode \"%s\": must be 1 or 0, on or off, true or false.\x00Maximum number of tags (10) exceeded.\x00No value specified for key \"%s\".\x00ppm\x00img::ppm\x00\tMaximum value : %d\n\x00\tGamma correction : %f\n\x00\tMinimum map value : %f\n\x00\tMaximum map value : %f\n\x00TopDown\x00BottomUp\x00\tVertical encoding : %s\n\x00Yes\x00No\x00\tAscii format : %s\n\x00\tHost byte order : %s\n\x00cannot read next ASCII value\x00-scanorder\x00-ascii\x00Invalid scanline mode \"%s\": must be TopDown or BottomUp.\x00Invalid ascii mode \"%s\": must be 1 or 0, on or off, true or false.\x00couldn't read PPM header from file \"\x00PPM image file \"\x00\" has bad maximum intensity value \x00%d\n\x00P%d\n%d %d\n255\n\x00Error writing \"\x00P6 \x00P3 \x00P5 \x00P2 \x00%d %d %d\x00ps\x00pdf\x00img::ps\x00 Page : %d\n\x00 Size in pixel : %d x %d\n\x00 Zoom : %.2f x %.2f\n\x00 Ghostscript call:\x00 %s\x00-zoom\x00-gs\x00gs\x00Invalid x zoom value \"%s\": must be a double value greater than zero.\x00Invalid y zoom value \"%s\": must be a double value greater than zero.\x00%!PS-Adobe-\x00%B\x00oundingBox:\x00-r%dx%d\x00-sOutputFile=\x00-dFirstPage=%d -dLastPage=%d\x00%%BoundingBox:\x00-g%dx%d\x00-sDEVICE=ppmraw\x00-q\x00-dNOPAUSE\x00-\x00\nquit\n\x00gs error: \"\x00%PDF-\x00raw\x00img::raw\x00byte\x00\tPixel type : %s\n\x00\tVertical encoding : %s\n\x00\tHost byte order : %s\n\x00\tFile byte order : %s\n\x00\tMapping mode : %s\n\x00\tGamma correction : %lf\n\x00\tMinimum map value : %lf\n\x00\tMaximum map value : %lf\n\x00\tSaturation : %lf\n\x00\tCutOff : %lf%%\n\x00RAW handler: Error reading header line\n\x00Magic=%s\n\x00Unable to parse header field Magic\n\x00RAW\x00Invalid value for header field Magic:\x00Must be \"RAW\"\n\x00Width=%d\n\x00Unable to parse header field Width\n\x00Height=%d\n\x00Unable to parse header field Height\n\x00NumChan=%d\n\x00Unable to parse header field NumChan\n\x00Invalid value for header field NumChan:\x00Must be 1 or 3\n\x00ByteOrder=%s\n\x00Unable to parse header field ByteOrder\n\x00Invalid value for header field ByteOrder:\x00Must be \x00 or \x00ScanOrder=%s\n\x00Unable to parse header field ScanOrder\n\x00Invalid value for header field ScanOrder:\x00PixelType=%s\n\x00Unable to parse header field PixelType\n\x00, short\x00-useheader\x00-width\x00-height\x00-nchan\x00-byteorder\x00-pixeltype\x00-skipbytes\x00-uuencode\x00-nomap\x00scanorder\x00Invalid useheader mode \"%s\": must be 1 or 0, on or off, true or false.\x00Invalid image width value \"%s\": must be an integer value greater than zero.\x00Invalid image height value \"%s\": must be an integer value greater than zero.\x00Invalid number of channels \"%s\": must be 1, 2, 3 or 4.\x00Invalid byteorder mode \"%s\": must be Intel or Motorola.\x00Invalid scanorder mode \"%s\": must be TopDown or BottomUp.\x00Invalid pixeltype mode \"%s\": must be double, float, int, short or byte.\x00Invalid nomap mode \"%s\": must be 1 or 0, on or off, true or false.\x00Invalid skipbytes value \"%s\": must be an integer value greater or equal to zero.\x00sgi\x00img::sgi\x00Read/Write mode not supported.\x00no name\x00Error writing image header.\x00Error reading image header.\x00Bad magic number in image header.\x00Error allocating image rows.\x00Error reading rowstart.\x00Error allocating temporary buffer.\x00Error writing rowstart.\x00Row number out of range\x00Invalid image dimension.\x00Invalid image type.\x00Invalid bytes per pixel.\x00\tBytes per pixel : %d\n\x00\tCompression : %s\n\x00Error open output file\x00Invalid number of channels: %d\x00sun\x00img::sun\x00\tDepth of pixels : %d\n\x00RLE\x00\tCompression : %s\n\x00\tColormap type : %d\n\x00Can't allocate memory of size %d\x00Unexpected EOF while reading scanline %d\x00Cannot read image data\x00Unknown Sun Raster type: %d\x00Unable to read color map\x00Image has invalid pixel depth: %d\x00Can't write %d bytes to image file\x00tga\x00img::tga\x00Unexpected end of file\x00\tSize in pixel : %d x %d\n\x00\tNumber of channels : %d\n\x00\tCompression : %s\n\x00TopBottom\x00BottomTop\x00LeftRight\x00RightLeft\x00\tHorizontal encoding: %s\n\x00JPEGTables\x00JPEGLib\x00TIFFjpeg_progress_monitor\x00Scan number %d exceeds maximum scans (%d). This limit can be raised through the LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER environment variable.\x00LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER\x00TIFFjpeg_tables_dest\x00No space for JPEGTables\x00Unable to allocate memory for auto-correcting of subsampling values; auto-correcting skipped\x00Unable to auto-correct subsampling values, likely corrupt JPEG compressed data in first strip/tile; auto-correcting skipped\x00Subsampling values inside JPEG compressed data have no TIFF equivalent, auto-correction of TIFF subsampling values failed\x00Auto-corrected former TIFF subsampling values [%u,%u] to match subsampling values inside JPEG compressed data [%u,%u]\x00JPEGSetupDecode\x00Bogus JPEGTables field\x00Improper JPEG strip/tile size, expected %ux%u, got %ux%u\x00JPEG strip size exceeds expected dimensions, expected %ux%u, got %ux%u\x00JPEG strip/tile size exceeds expected dimensions, expected %ux%u, got %ux%u\x00Improper JPEG component count\x00Improper JPEG data precision\x00The JPEG strip/tile is encoded with progressive mode, which is normally not legal for JPEG-in-TIFF.\nlibtiff should be able to decode it, but it might cause compatibility issues with other readers\x00LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC\x00Reading this image would require libjpeg to allocate at least %llu bytes. This is disabled since above the %ld threshold. You may override this restriction by defining the LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC environment variable, or setting the JPEGMEM environment variable to a value greater or equal to '%lluM'\x00Improper JPEG sampling factors %d,%d\nApparently should be %u,%u.\x00Improper JPEG sampling factors\x00fractional scanline not read\x00TIFFReadScanline\x00scanline oriented access is not supported for downsampled JPEG compressed images, consider enabling TIFF_JPEGCOLORMODE as JPEGCOLORMODE_RGB.\x00JPEGDecodeRaw\x00application buffer not large enough for all data.\x00application buffer not large enough for all data, possible subsampling issue\x00mozjpeg library likely detected. Disable emission of Huffman tables in JpegTables tag, and use optimize_coding to avoid potential issues\x00Invalig horizontal/vertical sampling value\x00BitsPerSample %u not allowed for JPEG\x00PhotometricInterpretation %u not allowed for JPEG\x00JPEG tile height must be multiple of %u\x00JPEG tile width must be multiple of %u\x00RowsPerStrip must be multiple of %u for JPEG\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Strip/tile too large for JPEG\x00fractional scanline discarded\x00JPEGEncode\x00Failed to allocate memory\x00 JPEG Tables: (%u bytes)\n\x00TIFFInitJPEG\x00Merging JPEG codec-specific tags failed\x00No space for JPEG state block\x00Failed to allocate memory for JPEG tables\x00tiff\x00img::tiff\x00\tDots per inch: %.0f x %.0f\n\x00Null count for\x00no image data for this index\x00Image size too large\x00Cannot allocate raster memory\x00deflate\x00logluv\x00lzw\x00packbits\x00pixarlog\x00Invalid compression mode \"%s\": must be deflate, jpeg, logluv, lzw, packbits, pixarlog or none.\x00smallendian\x00wl\x00littleendian\x00bigendian\x00network\x00Invalid byteorder \"%s\": must be bigendian, littleendian, network, smallendian or none.\x00PixarLog compression can't handle bits depth/data format combination (depth: %u)\x00(null)\x00ZLib cannot deal with buffers this size\x00%u bit input not supported in PixarLog\x00sp->stream.avail_out > sp->tbuf_size\x00Decoding error at scanline %u, %s\x00ZLib error: %s\x00Not enough data at scanline %u (short %u bytes)\x00stride %d is not a multiple of sample count, %d, data truncated.\x00Unsupported bits/sample: %u\x00PixarLog compression can't handle %u bit linear encodings\x00Too many input bytes provided\x00Encoder error: %s\x00Merging PixarLog codec-specific tags failed\x00No space for PixarLog state block\x00Decoding error at scanline %lu, %s\x00Not enough data at scanline %lu (short %llu bytes)\x00Invalid ZipQuality value. Should be in [-1,%d] range\x00Invalid DeflateCodec value.\x00DeflateCodec = DEFLATE_SUBCODEC_LIBDEFLATE unsupported in this build\x00Merging Deflate codec-specific tags failed\x00No space for ZIP state block\x00window\x00img::window\x00 Window \"\x00\" does not exist.\x00\" is not mapped.\x00Window \"\x00\" cannot be transformed into a pixmap (possibly obscured?)\x00xbm\x00img::xbm\x00-background\x00-foreground\x00Cannot read next word.\x00_width\x00_height\x00_x_hot\x00_y_hot\x00char\x00%c 0x%02x\x00};\x00,\n\x00xpm\x00img::xpm\x00Width and Height: %dx%d\n\x00Number of colors: %d\n\x00Byte size: %d\n\x00couldn't read XPM header\x00XPM image file has dimension(s) <= 0\x00XPM image file has invalid byte size \x00(should be 1, 2, 3 or 4)\x00Unable to allocate memory for row data.\x00Unable to read color map.\x00Unable to read color definition.\x00/* XPM */\nstatic char * %s[] = {\n\x00\"%d %d %d %d\",\n\x00 \x00\"%s s None c None\",\n\x00\"%s c #%02x%02x%02x\",\n\x00\"};\x00\",\n\x00\x00%s%s%s\x00unexpected end of file\x00internal error: inflate stream corrupt\x00compressed data error\x00request does not fit in an int\x00request does not fit in a size_t\x00out of room to push characters\x00internal error: deflate stream corrupt\x00requested length does not fit in int\x00string length does not fit in int\x00invalid block type\x00invalid stored block lengths\x00too many length or distance symbols\x00invalid code lengths set\x00invalid bit length repeat\x00invalid code -- missing end-of-block\x00invalid literal/lengths set\x00invalid distances set\x00invalid literal/length code\x00invalid distance code\x00invalid distance too far back\x00incorrect header check\x00unknown compression method\x00invalid window size\x00unknown header flags set\x00header crc mismatch\x00incorrect data check\x00incorrect length check\x00zlibtcl\x00need dictionary\x00stream end\x00file error\x00stream error\x00data error\x00buffer error\x00incompatible version\x00tcl\x00Tcl\x00interpreter uses an incompatible stubs mechanism\x00tk\x00Tk\x00missing stub table pointer\x00Error loading \x00 (requested version \x00, actual version \x00): \x00"