[FFmpeg-devel] [RFC] Scalar color conversion utils (colorutils.[hc])?
Stefano Sabatini
stefano.sabatini-lala
Tue Apr 28 22:28:56 CEST 2009
Hi all,
the need for such a facility mainly arises for libavfilter filters.
For example we may need something to work like this:
pad=padcolor=COLOR
or
drawbox=X:Y:COLOR
and many other filters as well may need to take in input a textual
representation of a color and convert it to a given colorspace.
libavcodec/colorspace.h defines some useful macros for converting from
RGB to YUV, but I think what we need here is a convenient API of the form:
int av_parse_color(uint16_t color[4], enum PixelFormat dst_pix_fmt, const char *color_string, void *log_ctx)
and
int av_convert_color_to(uint16_t *dst_color[4], enum PixelFormat dst_pix_fmt,
(uint16_t *src_color[4], enum PixelFormat src_pix_fmt,
void *log_ctx);
Support for HSV colorspace could be provided defining an HSV pixel format.
Some of the questions which need a response:
* We may need a table containing all the colornames <-> color. In
which colorspace should be specified the color? (An RGB32 variant
could be the ideal solution.)
* Where it should be implemented? lavfi or lsws seem the better
candidates.
* How should be done the color-spec string? It may contains a simple
name but also a color specifications. Variants which come to mind:
rgb=RR:GG::BB, hsv=HH:SS:VV, yuv=YY:UU:VV.
Regards.
--
FFmpeg = Foolish and Fast Mastering Proud Epic God
More information about the ffmpeg-devel
mailing list