/**
 * Lightweight HEIC (ISOBMFF) container parser.
 *
 * Extracts the HEVC decoder configuration and compressed image data from
 * HEIC files, including grid/tiled images (the common iPhone format).
 * This enables decoding via the WebCodecs VideoDecoder API without
 * shipping our own HEVC codec.
 *
 * Only the container format is parsed here (no patented codec involved).
 * Actual HEVC decoding is delegated to the browser's platform decoder.
 */
/** A single tile to decode and draw. */
export interface HeicTile {
    /** Raw HEVC bitstream for this tile. */
    data: Uint8Array;
    /** X position on the output canvas. */
    x: number;
    /** Y position on the output canvas. */
    y: number;
}
export interface HeicImageData {
    /** HEVC codec string for VideoDecoder (e.g. 'hvc1.1.6.L93.B0'). */
    codecString: string;
    /** Raw HEVCDecoderConfigurationRecord bytes for VideoDecoder description. */
    description: Uint8Array;
    /** Tiles to decode (1 for single-image, many for grid). */
    tiles: HeicTile[];
    /** Width of each HEVC tile in pixels. */
    tileWidth: number;
    /** Height of each HEVC tile in pixels. */
    tileHeight: number;
    /** Final output width in pixels. */
    outputWidth: number;
    /** Final output height in pixels. */
    outputHeight: number;
    /** Rotation angle in degrees counter-clockwise (0, 90, 180, 270). */
    rotation: number;
    /**
     * EXIF orientation (1-8) to apply when there is no native `irot`/`imir`
     * transform.
     *
     * libheif applies the `irot`/`imir` boxes but ignores EXIF orientation for
     * HEIF-family inputs, so this captures the orientation for files that carry
     * it in an EXIF tag instead. It is 1 (no change) whenever a native transform
     * is present, so the two are never applied together. This mirrors
     * `getUnappliedExifOrientation` so the canvas decode path and the sub-size
     * generation path agree on mirror-only inputs.
     */
    exifOrientation: number;
}
/**
 * Reverse all 32 bits of a number.
 *
 * @param n 32-bit unsigned integer.
 */
export declare function reverseBits32(n: number): number;
/**
 * Parse a HEIC file and extract the data needed for VideoDecoder.
 *
 * Handles both single-image HEIC files and grid/tiled images (the common
 * iPhone format where the full image is split into multiple HEVC tiles).
 *
 * @param buffer Raw HEIC file contents.
 * @return Parsed image data including codec config and HEVC tile data.
 * @throws If the file is not a valid HEIC or lacks required boxes.
 */
export declare function parseHeic(buffer: ArrayBuffer): HeicImageData;
/**
 * Extract the EXIF orientation from an ISOBMFF (HEIF/AVIF) container.
 *
 * AVIF and HEIF store EXIF metadata as an `Exif` item inside the `meta` box.
 * Neither WordPress's server-side `exif_read_data()` nor libheif applies this
 * orientation, so it is read here for client-side rotation.
 *
 * @param buffer Raw file contents.
 * @return EXIF orientation (1-8), or 1 when absent/unparseable.
 */
export declare function parseExifOrientation(buffer: ArrayBuffer): number;
/**
 * Get the EXIF orientation that neither the server nor libheif/libvips will
 * apply automatically for an ISOBMFF (HEIF/AVIF) image.
 *
 * Returns 1 (no correction needed) when the file has a native `irot`/`imir`
 * transform, because libheif already rotates it on decode. Otherwise returns
 * the EXIF Orientation tag so the caller can rotate explicitly.
 *
 * @param buffer Raw file contents.
 * @return EXIF orientation (1-8) requiring explicit rotation, or 1.
 */
export declare function getUnappliedExifOrientation(buffer: ArrayBuffer): number;
//# sourceMappingURL=heic-parser.d.ts.map