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

Marton Balint cus at passwd.hu
Sun May 7 14:36:21 EEST 2017



On Sat, 6 May 2017, Nicolas George wrote:

> 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.

I suggest to return 1 if an actual alignment (with deep copy) happened.

> + */
> +int av_frame_realign(AVFrame *frame, unsigned align);
> +
> +/**
>  * @}
>  */

Regards,
Marton


More information about the ffmpeg-devel mailing list