[FFmpeg-devel] [RFC] Scalar color conversion utils (colorutils.[hc])?
Stefano Sabatini
stefano.sabatini-lala
Sat May 2 21:37:09 CEST 2009
On date Saturday 2009-05-02 18:45:49 +0200, Michael Niedermayer encoded:
> On Sat, May 02, 2009 at 10:27:22AM +0200, Stefano Sabatini wrote:
[...]
> > > > + rgb_color[3] = 255;
> > > > + } else {
> > > > + const ColorEntry *entry = NULL;
> > > > + entry = bsearch(color_string,
> > > > + color_table,
> > > > + FF_ARRAY_ELEMS(color_table),
> > > > + sizeof(ColorEntry),
> > > > + color_table_compare);
> > > > + if (!entry) {
> > > > + av_log(log_ctx, AV_LOG_DEBUG, "Cannot find color '%s'\n", color_string);
> > > > + return -1;
> > > > + }
> > > > + memcpy(rgb_color, entry->color, sizeof(*color) * 3);
> > > > + }
> > > > +
> > > > + return av_convert_color(color, dst_pix_fmt, dst_colorspace,
> > > > + rgb_color, PIX_FMT_RGB24, AV_COLORSPACE_RGB,
> > > > + log_ctx);
> > >
> > > i dont think it makes sense to mix color convert and color parse
> >
> > That was to perform parsing and conversion in a single step. The
> > alternative may be:
> >
> > int av_parse_color(uint16_t *rgba_color, const char *color_string, void *log_ctx);
> >
> > which would return an RGBA color, then the conversion may be done
> > explicitely using:
> >
> > av_convert_color(color, dst_pix_fmt, dst_colorspace,
> > rgb_color, PIX_FMT_RGBA, AV_COLORSPACE_RGB, log_ctx);
> >
> > but I prefer the previous more flexible variant.
>
> I think its better if we drop this patch then.
>
> I will add the enum to AVCodecContext myself, the rest is currently not of
> any relevance as it isnt and would not be used by anything. It requires lavfi
> to be merged first ...
I have a patch for this, but I have many things to study before to be
confident with the field, also I'm not sure the idea of including CIE
colorspaces is really a good idea.
> Once lavfi is merged this could be revissited but we surely wont combine
> the string parsing with colorspace convertion because frankly that is
> unflexible.
Would be:
int av_parse_color(uint16_t *rgba_color, const char *color_string, void *log_ctx);
an acceptable solution?
Regards.
--
FFmpeg = Fiendish and Faboulous Martial Portentous Educated Geek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lavc-colorspace.patch
Type: text/x-diff
Size: 1733 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090502/67b27cbd/attachment.patch>
More information about the ffmpeg-devel
mailing list