MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / FindZFPCompressionParam

Function FindZFPCompressionParam

Source/ThirdParty/tinyexr.h:4623–4696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4621};
4622
4623static bool FindZFPCompressionParam(ZFPCompressionParam *param,
4624 const EXRAttribute *attributes,
4625 int num_attributes, std::string *err) {
4626 bool foundType = false;
4627
4628 for (int i = 0; i < num_attributes; i++) {
4629 if ((strcmp(attributes[i].name, "zfpCompressionType") == 0)) {
4630 if (attributes[i].size == 1) {
4631 param->type = static_cast<int>(attributes[i].value[0]);
4632 foundType = true;
4633 break;
4634 } else {
4635 if (err) {
4636 (*err) +=
4637 "zfpCompressionType attribute must be uchar(1 byte) type.\n";
4638 }
4639 return false;
4640 }
4641 }
4642 }
4643
4644 if (!foundType) {
4645 if (err) {
4646 (*err) += "`zfpCompressionType` attribute not found.\n";
4647 }
4648 return false;
4649 }
4650
4651 if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_RATE) {
4652 for (int i = 0; i < num_attributes; i++) {
4653 if ((strcmp(attributes[i].name, "zfpCompressionRate") == 0) &&
4654 (attributes[i].size == 8)) {
4655 param->rate = *(reinterpret_cast<double *>(attributes[i].value));
4656 return true;
4657 }
4658 }
4659
4660 if (err) {
4661 (*err) += "`zfpCompressionRate` attribute not found.\n";
4662 }
4663
4664 } else if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_PRECISION) {
4665 for (int i = 0; i < num_attributes; i++) {
4666 if ((strcmp(attributes[i].name, "zfpCompressionPrecision") == 0) &&
4667 (attributes[i].size == 4)) {
4668 param->rate = *(reinterpret_cast<int *>(attributes[i].value));
4669 return true;
4670 }
4671 }
4672
4673 if (err) {
4674 (*err) += "`zfpCompressionPrecision` attribute not found.\n";
4675 }
4676
4677 } else if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_ACCURACY) {
4678 for (int i = 0; i < num_attributes; i++) {
4679 if ((strcmp(attributes[i].name, "zfpCompressionTolerance") == 0) &&
4680 (attributes[i].size == 8)) {

Callers 3

DecodePixelDataFunction · 0.85
DecodeChunkFunction · 0.85
EncodeChunkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected