Add backward compatibility for AVIF chroma subsampling feature #19698
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.