MCPcopy Create free account
hub / github.com/cinder/Cinder / FindZFPCompressionParam

Function FindZFPCompressionParam

include/tinyexr/tinyexr.h:3447–3520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3445};
3446
3447static bool FindZFPCompressionParam(ZFPCompressionParam *param,
3448 const EXRAttribute *attributes,
3449 int num_attributes, std::string *err) {
3450 bool foundType = false;
3451
3452 for (int i = 0; i < num_attributes; i++) {
3453 if ((strcmp(attributes[i].name, "zfpCompressionType") == 0)) {
3454 if (attributes[i].size == 1) {
3455 param->type = static_cast<int>(attributes[i].value[0]);
3456 foundType = true;
3457 break;
3458 } else {
3459 if (err) {
3460 (*err) +=
3461 "zfpCompressionType attribute must be uchar(1 byte) type.\n";
3462 }
3463 return false;
3464 }
3465 }
3466 }
3467
3468 if (!foundType) {
3469 if (err) {
3470 (*err) += "`zfpCompressionType` attribute not found.\n";
3471 }
3472 return false;
3473 }
3474
3475 if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_RATE) {
3476 for (int i = 0; i < num_attributes; i++) {
3477 if ((strcmp(attributes[i].name, "zfpCompressionRate") == 0) &&
3478 (attributes[i].size == 8)) {
3479 param->rate = *(reinterpret_cast<double *>(attributes[i].value));
3480 return true;
3481 }
3482 }
3483
3484 if (err) {
3485 (*err) += "`zfpCompressionRate` attribute not found.\n";
3486 }
3487
3488 } else if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_PRECISION) {
3489 for (int i = 0; i < num_attributes; i++) {
3490 if ((strcmp(attributes[i].name, "zfpCompressionPrecision") == 0) &&
3491 (attributes[i].size == 4)) {
3492 param->rate = *(reinterpret_cast<int *>(attributes[i].value));
3493 return true;
3494 }
3495 }
3496
3497 if (err) {
3498 (*err) += "`zfpCompressionPrecision` attribute not found.\n";
3499 }
3500
3501 } else if (param->type == TINYEXR_ZFP_COMPRESSIONTYPE_ACCURACY) {
3502 for (int i = 0; i < num_attributes; i++) {
3503 if ((strcmp(attributes[i].name, "zfpCompressionTolerance") == 0) &&
3504 (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