[FFmpeg-devel] [PATCH 1/3] lavu/frame: add av_frame_check_align().
Muhammad Faiz
mfcc64 at gmail.com
Wed May 17 15:58:32 EEST 2017
On Thu, May 11, 2017 at 2:59 PM, Muhammad Faiz <mfcc64 at gmail.com> wrote:
> On Tue, May 9, 2017 at 8:19 PM, Nicolas George <george at nsup.org> wrote:
>> diff --git a/libavutil/frame.c b/libavutil/frame.c
>> index 24d5d5f184..e8467a1cd6 100644
>> --- a/libavutil/frame.c
>> +++ b/libavutil/frame.c
>> @@ -781,3 +781,21 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
>> }
>> return NULL;
>> }
>> +
>> +int av_frame_check_align(const AVFrame *frame, unsigned align)
>> +{
>> + unsigned mask = (1 << align) - 1;
>> + unsigned i;
>> + int ret;
>> +
>> + av_assert1(align < 16);
>> + for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
>> + if (((intptr_t)frame->data[i] & mask))
>> + return 0;
>> + if (!frame->extended_data || frame->extended_data == frame->data)
>> + return 1;
>> + for (i = AV_NUM_DATA_POINTERS; i < frame->channels; i++)
>> + if (((intptr_t)frame->extended_data[i] & mask))
>> + return 0;
>> + return 1;
>> +}
>
> Seem that you don't check linesize alignment. I don't know if it is
> required or not. Anyway the linesize constraint has been written in
> frame.h
Probably, data alignment and linesize alignment are treated differently.
More information about the ffmpeg-devel
mailing list