[FFmpeg-devel] [PATCH] Add XPM decoder

Paras Chadha paraschadha18 at gmail.com
Sat Mar 11 14:02:21 EET 2017


On Sat, Mar 11, 2017 at 5:40 AM, Moritz Barsnick <barsnick at gmx.net> wrote:

>
> > +static int color_table_compare(const void *lhs, const void *rhs)
> > +{
> > +    return av_strcasecmp(lhs, ((const ColorEntry *)rhs)->name);
> > +}
> > +
> > +static const ColorEntry color_table[] = {
> > +    { "AliceBlue",            { 0xF0, 0xF8, 0xFF } },
> > +    { "AntiqueWhite",         { 0xFA, 0xEB, 0xD7 } },
> > +    { "Aqua",                 { 0x00, 0xFF, 0xFF } },
> [...]
>
> Is this duplicated from libavutil/parseutils.c?
>

Yes, it is duplicated from parseutils.c
XPM format also specifies a color None which is transparent, it has been
added to the array.
Also ColorEntry is changed a bit.
These changes are in my next patch.


>
> > +static uint32_t hexstring_to_rgba(const char *p, int len){
> > +    uint32_t ret = 0xFF000000;
> > +    const ColorEntry *entry;
> > +    char color_name[100];
> > +
> > +    if(*p == '#'){
> > +        p++;
> > +        len--;
> > +        if (len == 3) {
> > +            ret |= (convert(p[2]) <<  4) |
> > +                   (convert(p[1]) << 12) |
> > +                   (convert(p[0]) << 20);
>
> So is this a modified or redesigned av_parse_color()? Just wondering.
>

Yes, it is redesigned version of av_parse_color(). It is a bit fast than
the original.


> > +    else{
>
> If this is new code, and not copied verbatim from somewhere else, you
> need to follow coding style.
>
> > +        av_log(avctx, AV_LOG_ERROR, "invalid number of colors or chars
> per pixel\n");
>
> Feel free to quote actual offending values...
>
> > +        av_log(avctx, AV_LOG_ERROR, "unsupported number of chars per
> pixel\n");
> > +        return AVERROR_PATCHWELCOME;
>
> ...especially when asking for a patch.
>
> Sorry for nitpicking without looking at the actual code.
>
> Moritz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Rest all changes have been made.


More information about the ffmpeg-devel mailing list