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.
Details
Details
Diff Detail
Diff Detail
- Repository
- rB Blender
Event Timeline
Comment Actions
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
Comment Actions
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.