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

Marton Balint cus at passwd.hu
Sun Jan 27 12:25:17 EET 2019



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?

Thanks,
Marton


More information about the ffmpeg-devel mailing list