JD2022-TU1/main/tools/legacy/TextureCookerCTR/Pica/etccompress.h

170 lines
8.4 KiB
C

/*
//------------------------------------------------------------
// Copyright (c) 2009 by Digital Media Professionals Inc.
// All rights reserved.
//------------------------------------------------------------
// This source code is the confidential and proprietary
// of Digital Media Professionals Inc.
//------------------------------------------------------------
*/
#ifndef DMP_ETC_TEXTURE_COMPRESSION_RGBA_DEFINE_FLAG_H
#define DMP_ETC_TEXTURE_COMPRESSION_RGBA_DEFINE_FLAG_H 1
#ifdef ETCCOMPRESS_EXPORTS
#define ETCCOMPRESS_API __declspec(dllexport)
#else
#define ETCCOMPRESS_API __declspec(dllimport)
#endif
#define ETCCOMPRESS_FORMAT_ETC1_RGB8_NATIVE (0x1011)
#define ETCCOMPRESS_FORMAT_ETC1_ALPHA_RGBA8_NATIVE (0x1021)
#define ETCCOMPRESS_FORMAT_RGB8 (0x2010)
#define ETCCOMPRESS_FORMAT_RGBA8 (0x2020)
/*
// ==================================================================== //
// Function name: dmpETCToolVersion //
// -------------------------------------------------------------------- //
// This function denote tool version. //
// -------------------------------------------------------------------- //
// Return (const char*) : version string. //
// ==================================================================== //
*/
ETCCOMPRESS_API const char *dmpETCToolVersion(void);
/*
// ==================================================================== //
// Function name: dmpETCAvailable //
// -------------------------------------------------------------------- //
// This function calculates compressed size of ETC data. //
// -------------------------------------------------------------------- //
// Return (const char *) : string. //
// The name of the compression format available. //
// ex) "ETCCOMPRESS_FORMAT_ETC1_RGB8_NATIVE" //
// "ETCCOMPRESS_FORMAT_ETC1_ALPHA_RGBA8_NATIVE" //
// ==================================================================== //
*/
ETCCOMPRESS_API const char *dmpETCAvailable(void);
/*
// ==================================================================== //
// Function name: dmpETCLength //
// -------------------------------------------------------------------- //
// This function calculates compressed size of ETC data. //
// -------------------------------------------------------------------- //
// Return (int) : 0 for fail, none zero for success //
// -------------------------------------------------------------------- //
// Arguments //
// width: The width of the lowest level image in the 'inpixels' //
// height: The height of the lowest level image in the 'inpixels' //
// levels: The count of the array elements in 'inpixels' //
// dstFormat The format of th pixture. //
// ETCCOMPRESS_FORMAT_ETC1_RGB8_NATIVE and //
// ETCCOMPRESS_FORMAT_ETC1_ALPHA_RGBA8_NATIVE are //
// available. //
// ==================================================================== //
*/
ETCCOMPRESS_API int dmpETCLength(
int width,
int height,
int levels,
int dstFormat
);
/*
// ==================================================================== //
// Function name: dmpETCCompression //
// -------------------------------------------------------------------- //
// This function converts RGBA or RGB image to ETC data. //
// It's possble to specify one to multi-level images as input images //
// -------------------------------------------------------------------- //
// Return (int) : 0 for fail, none zero for success //
// -------------------------------------------------------------------- //
// Arguments //
// inpixels: Array of the pointers to input images. 'inpixels[0]' //
// should point lowest level image in the array //
// srcFormat: The format of source picture. //
// ETCCOMPRESS_FORMAT_RGB8 and ETCCOMPRESS_FORMAT_RGBA8 //
// are available. //
// width: The width of the lowest level image in the 'inpixels' //
// height: The height of the lowest level image in the 'inpixels' //
// levels: The count of the array elements in 'inpixels' //
// quality: The output ETC quality. 0,1,2 are available //
// '0' for low-quality(high speed) //
// '1' for middle-quality mode //
// '2' for high-quality mode //
// perceptual The perceptual mode. '0' or '1' are aveilable //
// '0' phisical noise reduction. //
// '1' perceptual noise reduction. //
// outpixels: Buffer for output ETC images. If operated multi-level //
// encoding, all images are listed sequencially. If null //
// pointer is specified to this argument, output size is //
// set to 'psize' without encoding //
// dstFormat: The format of the compressed picture. //
// ETCCOMPRESS_FORMAT_ETC1_RGB8_NATIVE and //
// ETCCOMPRESS_FORMAT_ETC1_ALPHA_RGBA8_NATIVE are //
// available. //
// psize: buffer for the size of output image(s) //
// plevels: The count of levels in output image(s) //
// progression: pointer to progress handler. Progress ratio (0.0 to //
// 1.0) is set to 'a' when progress handler is involved //
// ==================================================================== //
*/
ETCCOMPRESS_API int dmpETCCompression(
void **inpixels,
int srcFormat,
int width,
int height,
int levels,
int quality,
int perceptual,
void *outpixels,
int dstFormat,
int *psize,
int *plevels,
void(*progression)(double a)
);
/*
// ==================================================================== //
// Function name: dmpETCDeCompression //
// -------------------------------------------------------------------- //
// This function converts ETC image to RGB data. //
// -------------------------------------------------------------------- //
// Return (int) : 0 for fail, none zero for success //
// -------------------------------------------------------------------- //
// Arguments //
// etcblocks: the pointers to input compressed images. //
// srcFormat: The format of the compressed picture. //
// ETCCOMPRESS_FORMAT_ETC1_RGB8_NATIVE and //
// ETCCOMPRESS_FORMAT_ETC1_ALPHA_RGBA8_NATIVE are //
// available. //
// size: The length of the compressed image. //
// width: The width of the lowest level image in the 'etcblocks' //
// height: The height of the lowest level image in the 'etcblocks' //
// outpixels: Buffer for output decompressed image. //
// if null pointer is specified to this argument, //
// output levels is set to 'plevels' without encoding //
// dstFormat: The format of decompressed pictures. //
// ETCCOMPRESS_FORMAT_RGB8 and ETCCOMPRESS_FORMAT_RGBA8 //
// are available. //
// levels: The level number of outputpixels. //
// plevels: The level number of decoded pictures. //
// ==================================================================== //
*/
ETCCOMPRESS_API int dmpETCDeCompression(
void *etcblocks,
int srcFormat,
int size,
int width,
int height,
void **outpixels,
int dstFormat,
int levels,
int *plevels
);
#endif