- /* Here's an image of out_size. Below we may write to it starting at an offset so we get some padding.
- Hence we want to write in the following pattern:
-
- block start write start line end
- |..(padding)..|<------line-size------------->|..(padding)..|
- |..(padding)..|<------line-size------------->|..(padding)..|
- |..(padding)..|<------line-size------------->|..(padding)..|
-
- where line-size is of the smaller (inter_size) image and the full padded line length is that of
- out_size. To get things to work we have to tell FFmpeg that the stride is that of out_size.
- However some parts of FFmpeg (notably rgb48Toxyz12 in swscale.c) process data for the full
- specified *stride*. This does not matter until we get to the last line:
-
- block start write start line end
- |..(padding)..|<------line-size------------->|XXXwrittenXXX|
- |XXXwrittenXXX|<------line-size------------->|XXXwrittenXXX|
- |XXXwrittenXXX|<------line-size------------->|XXXwrittenXXXXXXwrittenXXX
- ^^^^ out of bounds
-
- To get around this, we ask Image to overallocate its buffers by the overrun.
- */
-
- shared_ptr<Image> out (new Image (out_format, out_size, out_aligned, (out_size.width - inter_size.width) / 2));