Add backward compatibility for AVIF chroma subsampling feature - #19698
Merged
TurboGit merged 2 commits intoNov 9, 2025
Merged
Conversation
Increment module version to 2 and add legacy_params function to handle migration from version 1 (without subsample field) to version 2 (with subsample field). This ensures that existing AVIF export presets created before the chroma subsampling feature continue to work after upgrade. Old presets are automatically migrated with subsample set to AUTO, preserving the original quality-based behavior. Changes: - Increment DT_MODULE from 1 to 2 - Add legacy_params() function to migrate v1 parameters to v2 - Old presets default to AVIF_SUBSAMPLE_AUTO for backward compatibility
There was a problem hiding this comment.
Pull Request Overview
This PR adds versioning support to the AVIF image format module to handle backwards compatibility when loading presets created with older versions. The module version is incremented from 1 to 2, and a new legacy_params function is introduced to migrate version 1 parameters to version 2.
- Module version incremented from 1 to 2
- Added
legacy_paramsfunction to migrate old presets to new format - New
subsamplefield initialized with default value for legacy presets
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add safety checks to prevent crashes in the legacy_params function for AVIF export backward compatibility. The changes include verifying the old_params_size matches the expected struct size and checking for malloc failure.
Member
|
Stupid me :( Completely forgot about this during my review. Sorry ! |
piratenpanda
pushed a commit
to piratenpanda/darktable
that referenced
this pull request
Aug 23, 2026
…able-org#19698) * AVIF export: add legacy_params for backward compatibility Increment module version to 2 and add legacy_params function to handle migration from version 1 (without subsample field) to version 2 (with subsample field). This ensures that existing AVIF export presets created before the chroma subsampling feature continue to work after upgrade. Old presets are automatically migrated with subsample set to AUTO, preserving the original quality-based behavior. Changes: - Increment DT_MODULE from 1 to 2 - Add legacy_params() function to migrate v1 parameters to v2 - Old presets default to AVIF_SUBSAMPLE_AUTO for backward compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the missing backward compatibility handling for the AVIF chroma subsampling feature that was recently merged in #19595. Thanks to @victoryforce for noticing this.
Problem
The previous PR added a new
subsamplefield to thedt_imageio_avif_tstructure but did not include:This could cause issues for users upgrading from older versions who have saved AVIF export presets.
Solution
This PR implements the required backward compatibility mechanisms:
DT_MODULE(1)toDT_MODULE(2)legacy_params()function to handle migration from version 1 (withoutsubsample) to version 2 (withsubsample)Old export presets are automatically migrated with
subsampleset toAVIF_SUBSAMPLE_AUTO, which preserves the original quality-based chroma subsampling behavior.Testing
Tested the migration path as follows:
Built and tested version 1 (parent commit c7b5d6f, before chroma subsampling feature 6cd1733):
Built and tested version 2 (current commit with backward compatibility):
Changes
src/imageio/format/avif.c:DT_MODULE(1)→DT_MODULE(2)legacy_params()function to migrate v1 parameters to v2AVIF_SUBSAMPLE_AUTORelated
Follow-up to the AVIF chroma subsampling feature PR #19595 that was recently merged.