WRF Preprocessing System (WPS)

repository·master·Indexed 42 days ago

https://github.com/wrf-model/wps

The WRF Preprocessing System (WPS) component of the WRF model. This documentation covers its external dependencies, including libpng v1.6.37 for PNG image processing and Jasper v1.900.29 for JPEG-2000 (JP2) standards, including ICC color profiles and ARM NEON/MIPS MSA detection fragments.

Tokens
18.2K
Snippets
53
Records
111
Agent score
54%

What's inside WPS

  1. Overview of ZLib.Ada

    master

    ZLib.Ada is a thick binding interface for the ZLib data compression library. It provides Ada-style access to the ZLib C library functions.

    Key features in version 1.3 include:

    • ZLib.Read generic routine updates: requires initialization for the Read_Last parameter, and supports Allow_Read_Some and Flush.
    • Is_Open routines added to ZLib and ZLib.Streams packages.
    • Status_Error exception definition.
    • Improved extraction to buffers with exact known decompressed sizes.
    • Fixed ULong definition (now unsigned_long) for 64-bit compatibility.
  2. Use ASM implementations of longest_match() and inflate_fast() in zlib

    master

    This directory provides assembly (ASM) implementations for the longest_match() and inflate_fast() functions to optimize zlib performance on x86 architectures.

    To use these implementations, you must assemble them using MASM, copy the resulting object files into the main zlib source directory, and then run the appropriate makefile.

  3. Use the zlibpas Pascal interface

    master

    The zlibpas unit provides a Pascal (Delphi, Kylix) interface to the zlib data compression library.

    Important Compatibility Notes:

    • Naming Conflict: Do not confuse zlibpas with Borland's built-in ZLib unit. Borland's ZLib is a suite of class wrappers that lacks essential features like checksums. zlibpas is a genuine interface to the full-fledged zlib functionality.
    • Type Mapping: C types (e.g., int, uInt, long, uLong) are translated directly into Pascal types of similar sizes (e.g., Integer, LongInt) to avoid namespace pollution. Note that unsigned integers are not converted to Pascal unsigned integers.
    • Calling Convention: The interface uses the cdecl keyword. This means it is not compatible with old Turbo Pascal. On Windows32, it uses the __fastcall convention, and on DOS/Windows16, it uses __pascal (except for callbacks).
    • Limitations: The gz* function interfaces are not translated to avoid C runtime library interfacing problems. Specifically, gzprintf cannot be translated into Pascal.
    uses zlibpas;
  4. Understand the purpose of the libpng contrib directory

    master

    The contrib directory contains external contributions that are not part of the core libpng library.

    Key characteristics:

    • Licensing: Contributions in this directory may not be under the standard libpng license, though they are all open source.
    • Build Scope: These files are not used when building the core libpng library.
    • Usage: Some components within contrib are utilized specifically for testing the library via the make check command.
  5. Customizing libpng builds and DLL names

    master

    If you modify source files or change compiler settings, you should change the resulting DLL name to avoid conflicts with standard builds.

    To properly configure custom builds, you must update pngusr.h by defining the following macros according to the instructions in pngconf.h:

    • PNG_USER_PRIVATEBUILD
    • PNG_USER_DLLFNAME_POSTFIX

    Runtime Dependency Note: All DLLs built by this project use the Microsoft dynamic C runtime library MSVCR71.DLL (or MSVCR71D.DLL for debug). If distributing these libraries, you may need to include these DLLs in your package.

  6. Use zlibwapi.dll in Windows applications

    master

    The zlibwapi.dll build uses the WINAPI calling convention and includes minizip functionality. It is designed to be compatible with older zlib.dll builds (from zlib 1.1.x) if you rename zlibwapi.dll to zlib.dll.

    Important Requirements:

    • When compiling your application's source files to use zlibwapi.dll, you must define the macro ZLIB_WINAPI.
    • Do not define the ZLIB_DLL macro, as its behavior has changed and defining it may cause compatibility issues.

    Comparison of DLL types:

    • zlibwapi.dll: Uses WINAPI calling convention; includes minizip.
    • zlib1.dll: Official DLL build that exports functions using the CDECL convention.
  7. Compile PngMinus

    master

    PngMinus is built using a Makefile that supports both static and shared library linking.

    Dependencies:

    • libpng
    • zlib

    Compilation Notes:

    • The default Makefile expects libpng libraries in ../../ and libz in ../../../zlib.
    • You can modify the Makefile to point to different paths, such as ../libpng and ../zlib.
    • The build process generates two versions of each utility: one linked with static libraries and one using shared libraries.
    # The Makefile creates two versions of each program:
    # 1. One with static library support
    # 2. One using shared libraries
  8. Build ZLib.Ada using GNAT

    master

    To build ZLib.Ada with GNAT, you must first have the ZLib C library already built on your system. Navigate to the ZLib.Ada source directory and use one of the following methods:

    Method 1: Direct command Use gnatmake with the -largs flag to specify the directory containing libz.a and link against it.

    Method 2: GNAT Project File For GNAT 3.15 or later, use the provided .gpr project file.

    # Method 1
    gnatmake test -largs -L<directory where libz.a is> -lz
    
    # Method 2 (GNAT 3.15+)
    gnatmake -Pzlib.gpr -L<directory where libz.a is>
  9. Distribute VisualPng

    master

    When distributing VisualPng, you can choose between two build configurations depending on your deployment requirements:

    1. Static Distribution (Win32 LIB):

      • Build using the Win32 LIB configuration.
      • You only need to include the executable from the ./lib directory in your distribution.
    2. Dynamic Distribution (Win32 DLL):

      • Build using the Win32 DLL configuration.
      • You must include the executable from the ./dll directory.
      • You must also include libpng1.dll, zlib.dll, and msvcrt.dll in your distribution. These files must be present in the user's PATH.
  10. Integrate ASM implementations of longest_match() and inflate_fast() into zlib

    master

    This directory provides optimized 64-bit x86 (AMD64 and Intel EM64t) assembly implementations for longest_match() and inflate_fast().

    To use these implementations in a project:

    1. Assemble the .asm files using MASM.
    2. Place the resulting object files into the zlib source directory.
    3. Define the preprocessor macros ASMV and ASMINF in your project.
    4. Include inffas8664.c in your source tree.
    5. Link inffasx64.obj and gvmat64.obj as objects during the linking stage.
    /* Preprocessor definitions required */
    #define ASMV
    #define ASMINF
    
    /* Include source and link objects: */
    // Include: inffas8664.c
    // Link: inffasx64.obj, gvmat64.obj
  11. Build zlib with Borland C and TASM

    master

    To build zlib using Borland C and TASM, use the following make command. This command enables the assembly flags via LOCAL_ZLIB and specifies both the object files (OBJA) and the path to the objects (OBJPA).

    make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj"