This function detects changes made on avifEncoder. It returns true on success (i.e., if every change is valid), or false on failure (i.e., if any setting that can't change was changed). It reports a bitwise-OR of detected changes in encoderChanges.
| 549 | // change is valid), or false on failure (i.e., if any setting that can't change was changed). It |
| 550 | // reports a bitwise-OR of detected changes in encoderChanges. |
| 551 | static avifBool avifEncoderDetectChanges(const avifEncoder * encoder, avifEncoderChanges * encoderChanges) |
| 552 | { |
| 553 | const avifEncoder * lastEncoder = &encoder->data->lastEncoder; |
| 554 | *encoderChanges = 0; |
| 555 | |
| 556 | if (!lastEncoder->data) { |
| 557 | // lastEncoder is not initialized. |
| 558 | return AVIF_TRUE; |
| 559 | } |
| 560 | |
| 561 | if ((lastEncoder->codecChoice != encoder->codecChoice) || (lastEncoder->maxThreads != encoder->maxThreads) || |
| 562 | (lastEncoder->speed != encoder->speed) || (lastEncoder->keyframeInterval != encoder->keyframeInterval) || |
| 563 | (lastEncoder->timescale != encoder->timescale) || (lastEncoder->repetitionCount != encoder->repetitionCount) || |
| 564 | (lastEncoder->extraLayerCount != encoder->extraLayerCount)) { |
| 565 | return AVIF_FALSE; |
| 566 | } |
| 567 | |
| 568 | if (encoder->data->lastQuality != encoder->data->quality) { |
| 569 | *encoderChanges |= AVIF_ENCODER_CHANGE_QUALITY; |
| 570 | } |
| 571 | if (encoder->data->lastQualityAlpha != encoder->data->qualityAlpha) { |
| 572 | *encoderChanges |= AVIF_ENCODER_CHANGE_QUALITY_ALPHA; |
| 573 | } |
| 574 | if (lastEncoder->minQuantizer != encoder->minQuantizer) { |
| 575 | *encoderChanges |= AVIF_ENCODER_CHANGE_MIN_QUANTIZER; |
| 576 | } |
| 577 | if (lastEncoder->maxQuantizer != encoder->maxQuantizer) { |
| 578 | *encoderChanges |= AVIF_ENCODER_CHANGE_MAX_QUANTIZER; |
| 579 | } |
| 580 | if (lastEncoder->minQuantizerAlpha != encoder->minQuantizerAlpha) { |
| 581 | *encoderChanges |= AVIF_ENCODER_CHANGE_MIN_QUANTIZER_ALPHA; |
| 582 | } |
| 583 | if (lastEncoder->maxQuantizerAlpha != encoder->maxQuantizerAlpha) { |
| 584 | *encoderChanges |= AVIF_ENCODER_CHANGE_MAX_QUANTIZER_ALPHA; |
| 585 | } |
| 586 | if (encoder->data->lastTileRowsLog2 != encoder->data->tileRowsLog2) { |
| 587 | *encoderChanges |= AVIF_ENCODER_CHANGE_TILE_ROWS_LOG2; |
| 588 | } |
| 589 | if (encoder->data->lastTileColsLog2 != encoder->data->tileColsLog2) { |
| 590 | *encoderChanges |= AVIF_ENCODER_CHANGE_TILE_COLS_LOG2; |
| 591 | } |
| 592 | if (memcmp(&lastEncoder->scalingMode, &encoder->scalingMode, sizeof(avifScalingMode)) != 0) { |
| 593 | *encoderChanges |= AVIF_ENCODER_CHANGE_SCALING_MODE; |
| 594 | } |
| 595 | if (encoder->csOptions->count > 0) { |
| 596 | *encoderChanges |= AVIF_ENCODER_CHANGE_CODEC_SPECIFIC; |
| 597 | } |
| 598 | |
| 599 | if (lastEncoder->sampleTransformRecipe != encoder->sampleTransformRecipe) { |
| 600 | return AVIF_FALSE; |
| 601 | } |
| 602 | |
| 603 | return AVIF_TRUE; |
| 604 | } |
| 605 | |
| 606 | // Same as 'avifEncoderWriteColorProperties' but for the colr nclx box only. |
| 607 | static avifResult avifEncoderWriteNclxProperty(avifRWStream * dedupStream, |
no outgoing calls
no test coverage detected