MCPcopy Create free account
hub / github.com/OpenPathGuidingLibrary/openpgl / FindZFPCompressionParam

Function FindZFPCompressionParam

third-party/tinyexr/tinyexr.h:3373–3446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3371};
3372
3373static bool FindZFPCompressionParam(ZFPCompressionParam *param,
3374 const EXRAttribute *attributes,
3375 int num_attributes, std::string *err) {
3376 bool foundType = false;
3377
3378 for (int i = 0; i < num_attributes; i++) {
3379 if ((strcmp(attributes[i].name, "zfpCompressionType") == 0)) {
3380 if (attributes[i].size == 1) {
3381 param->type = static_cast<int>(attributes[i].value[0]);
3382 foundType = true;
3383 break;
3384 } else {
3385 if (err) {
3386 (*err) +=
3387 "zfpCompressionType attribute must be uchar(1 byte) type.\n";
3388 }
3389 return false;
3390 }
3391 }
3392 }
3393
3394 if (!foundType) {
3395 if (err) {
3396 (*err) += "`zfpCompressionType` attribute not found.\n";
3397 }
3398 return false;
3399 }
3400
3401 if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_RATE) {
3402 for (int i = 0; i < num_attributes; i++) {
3403 if ((strcmp(attributes[i].name, "zfpCompressionRate") == 0) &&
3404 (attributes[i].size == 8)) {
3405 param->rate = *(reinterpret_cast<double *>(attributes[i].value));
3406 return true;
3407 }
3408 }
3409
3410 if (err) {
3411 (*err) += "`zfpCompressionRate` attribute not found.\n";
3412 }
3413
3414 } else if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_PRECISION) {
3415 for (int i = 0; i < num_attributes; i++) {
3416 if ((strcmp(attributes[i].name, "zfpCompressionPrecision") == 0) &&
3417 (attributes[i].size == 4)) {
3418 param->rate = *(reinterpret_cast<int *>(attributes[i].value));
3419 return true;
3420 }
3421 }
3422
3423 if (err) {
3424 (*err) += "`zfpCompressionPrecision` attribute not found.\n";
3425 }
3426
3427 } else if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_ACCURACY) {
3428 for (int i = 0; i < num_attributes; i++) {
3429 if ((strcmp(attributes[i].name, "zfpCompressionTolerance") == 0) &&
3430 (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