[FFmpeg-devel] [PATCH] lavfi/rgbtestsrc: use ff_fill_rgba_map() rather than a local copy
Stefano Sabatini
stefasab at gmail.com
Thu Aug 2 11:16:31 CEST 2012
Also convert int rgba_map[4] to uint8_t rgba_map[4], as required by
ff_fill_rgba_map().
Simplify.
---
libavfilter/vsrc_testsrc.c | 14 +++-----------
1 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index c1d26ab..a2124ba 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -64,7 +64,7 @@ typedef struct {
uint8_t color_rgba[4];
/* only used by rgbtest */
- int rgba_map[4];
+ uint8_t rgba_map[4];
} TestSourceContext;
#define OFFSET(x) offsetof(TestSourceContext, x)
@@ -546,7 +546,7 @@ AVFILTER_DEFINE_CLASS(rgbtestsrc);
static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize,
int x, int y, int r, int g, int b, enum PixelFormat fmt,
- int rgba_map[4])
+ uint8_t rgba_map[4])
{
int32_t v;
uint8_t *p;
@@ -623,15 +623,7 @@ static int rgbtest_config_props(AVFilterLink *outlink)
{
TestSourceContext *test = outlink->src->priv;
- switch (outlink->format) {
- case PIX_FMT_ARGB: test->rgba_map[A] = 0; test->rgba_map[R] = 1; test->rgba_map[G] = 2; test->rgba_map[B] = 3; break;
- case PIX_FMT_ABGR: test->rgba_map[A] = 0; test->rgba_map[B] = 1; test->rgba_map[G] = 2; test->rgba_map[R] = 3; break;
- case PIX_FMT_RGBA:
- case PIX_FMT_RGB24: test->rgba_map[R] = 0; test->rgba_map[G] = 1; test->rgba_map[B] = 2; test->rgba_map[A] = 3; break;
- case PIX_FMT_BGRA:
- case PIX_FMT_BGR24: test->rgba_map[B] = 0; test->rgba_map[G] = 1; test->rgba_map[R] = 2; test->rgba_map[A] = 3; break;
- }
-
+ ff_fill_rgba_map(test->rgba_map, outlink->format);
return config_props(outlink);
}
--
1.7.5.4
More information about the ffmpeg-devel
mailing list