[FFmpeg-devel] [PATCH 5/5] avfilter/drawutils: support native-endian instead of little endian

Carl Eugen Hoyos ceffmpeg at gmail.com
Sun Jan 27 18:01:54 EET 2019


2019-01-27 16:18 GMT+01:00, Muhammad Faiz <mfcc64 at gmail.com>:
> On Sun, Jan 27, 2019 at 5:25 PM Marton Balint <cus at passwd.hu> wrote:
>>
>>
>>
>> On Sun, 27 Jan 2019, Muhammad Faiz wrote:
>>
>> > Signed-off-by: Muhammad Faiz <mfcc64 at gmail.com>
>> > ---
>> > Old thread is here:
>> > https://ffmpeg.org/pipermail/ffmpeg-devel/2016-June/195941.html
>> > Need someone test it on big-endian machine.
>> >
>> > libavfilter/drawutils.c     | 48 +++++++++++++++++++++----------------
>> > libavfilter/vf_rotate.c     | 26 ++++++++++----------
>> > libavfilter/vf_tinterlace.c | 30 +++++++++++------------
>> > 3 files changed, 54 insertions(+), 50 deletions(-)
>> >
>> > diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
>> > index 5f4cb548f0..12bdfcb900 100644
>> > --- a/libavfilter/drawutils.c
>> > +++ b/libavfilter/drawutils.c
>> > @@ -175,6 +175,17 @@ void ff_copy_rectangle(uint8_t *dst[4], int
>> > dst_linesize[4],
>> >     }
>> > }
>> >
>> > +static int is_native_endian(const AVPixFmtDescriptor *desc)
>> > +{
>> > +    int len = strlen(desc->name);
>> > +
>> > +    if (!strcmp(desc->name + len - 2, "be"))
>> > +        return HAVE_BIGENDIAN;
>> > +    if (!strcmp(desc->name + len - 2, "le"))
>> > +        return !HAVE_BIGENDIAN;
>> > +    return 1;
>> > +}
>> > +
>>
>> Maybe you can check if shift+depth > 8 and FMT_FLAG_BE
>> instead of string compare?
>
> I don't really understand your code.

Something like "return shift + depth <=8 ||
desc->flags | FMT_FLAG_BE ^ !HAVE_BIGENDIAN"

And since the new function is only used once, it may
be more readable not to add a new function.

> Currently I can't test on big-endian platform. Adding
> something that I don't understand and
> can't test is not a good idea.

But your patchset does change big-endian code and only
improves big-endian, no?

Carl Eugen


More information about the ffmpeg-devel mailing list