[FFmpeg-devel] [PATCH 1/3] lavu/frame: add av_frame_realign().

Nicolas George george at nsup.org
Sat May 6 12:20:04 EEST 2017


TODO Actual implementation.

Signed-off-by: Nicolas George <george at nsup.org>
---
 libavutil/frame.h | 9 +++++++++
 1 file changed, 9 insertions(+)


Here is a proposal for actually fixing the alignment problems that are all
over the place in the current code base.

Note that it is only a design proposal, all the actual implementation is
missing. I do not want to waste my time implementing if the design is to be
bikeshedded to death.


diff --git a/libavutil/frame.h b/libavutil/frame.h
index 4d8c1bed4f..162ea0716c 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -746,6 +746,15 @@ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
 const char *av_frame_side_data_name(enum AVFrameSideDataType type);
 
 /**
+ * Realign the data pointers of a frame.
+ * Make sure all frame data pointers have the alignment lower bits cleared,
+ * i.e. are a multiple of 1<<alignment.
+ * If not, a new frame is allocated and overwrites the current one.
+ * @return  >=0 for success or an AVERROR code.
+ */
+int av_frame_realign(AVFrame *frame, unsigned align);
+
+/**
  * @}
  */
 
-- 
2.11.0



More information about the ffmpeg-devel mailing list