Page MenuHome

Fix: Incorrect left border glitches in unaligned anim images
ClosedPublic

Authored by Michael (michael64) on Jan 24 2022, 9:08 AM.

Details

Summary

Using a negative linesize to flip an image vertically is supported in ffmpeg but not for every function.
This method treats frames that need and those that do not need alignment the same.
An RGBA frame buffer with alignment that ffmpeg decides is optimal for the CPU and build options is allocated by ffmpeg.
The sws_scale does the colorspace transformation into this RGBA frame buffer without flipping.
Now the image is upside down and aligned.
The combined unaligning and vertical flipping is then done by av_image_copy_to_buffer which seems to handle negative linesize correctly.

Diff Detail

Repository
rB Blender

Event Timeline

Michael (michael64) requested review of this revision.Jan 24 2022, 9:08 AM
Michael (michael64) created this revision.
This revision is now accepted and ready to land.Jan 25 2022, 4:46 PM

Since adding dead code is discouraged, I will leave this out from actual commit. Flipping image should be quite straightforward and I think we could use existing IMB_ function for that as well. See https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Comments

Just to be sure I checked code of av_image_copy_to_buffer and it essentailly does what you suggested if things would go wrong, so this should be fairly safe.