[Fix] Add Support for Images not Div by 16 (Diff. JPEG) #2865
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 pull request adds support for images not divisible by 16 to differentiable JPEG coding. As discussed in #2845 the current differentiable JPEG implementation just supports images that are divisible by 16. This is due to the fact that JPEG performs a (8 x 8) patch-wise DCT on downsampled (by 2) images. Thus the image must be divisible by 16. This pull request adds support for arbitrarily shaped images by performing padding and cropping. This implementation follows the common padding approach used before coding. In particular, the bottom and right sides of the image are padded by replication (see slide 442 of this reference). To go back to the original shape the JPEG-coded image is simply cropped again.
Type of change
Checklist