Signed-off-by: Paul B Mahol <onemda@gmail.com>
Paul B Mahol authored on 2013/01/02 01:38:54... | ... |
@@ -29,6 +29,7 @@ |
29 | 29 |
#include "libavutil/opt.h" |
30 | 30 |
#include "libavutil/pixdesc.h" |
31 | 31 |
#include "avfilter.h" |
32 |
+#include "drawutils.h" |
|
32 | 33 |
#include "formats.h" |
33 | 34 |
#include "internal.h" |
34 | 35 |
#include "video.h" |
... | ... |
@@ -175,7 +176,7 @@ static int config_props(AVFilterLink *inlink) |
175 | 175 |
AVFilterContext *ctx = inlink->dst; |
176 | 176 |
LutContext *lut = ctx->priv; |
177 | 177 |
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); |
178 |
- int rgba_map[4]; /* component index -> RGBA color index map */ |
|
178 |
+ uint8_t rgba_map[4]; /* component index -> RGBA color index map */ |
|
179 | 179 |
int min[4], max[4]; |
180 | 180 |
int val, comp, ret; |
181 | 181 |
|
... | ... |
@@ -208,14 +209,7 @@ static int config_props(AVFilterLink *inlink) |
208 | 208 |
else if (ff_fmt_is_in(inlink->format, rgb_pix_fmts)) lut->is_rgb = 1; |
209 | 209 |
|
210 | 210 |
if (lut->is_rgb) { |
211 |
- switch (inlink->format) { |
|
212 |
- case AV_PIX_FMT_ARGB: rgba_map[0] = A; rgba_map[1] = R; rgba_map[2] = G; rgba_map[3] = B; break; |
|
213 |
- case AV_PIX_FMT_ABGR: rgba_map[0] = A; rgba_map[1] = B; rgba_map[2] = G; rgba_map[3] = R; break; |
|
214 |
- case AV_PIX_FMT_RGBA: |
|
215 |
- case AV_PIX_FMT_RGB24: rgba_map[0] = R; rgba_map[1] = G; rgba_map[2] = B; rgba_map[3] = A; break; |
|
216 |
- case AV_PIX_FMT_BGRA: |
|
217 |
- case AV_PIX_FMT_BGR24: rgba_map[0] = B; rgba_map[1] = G; rgba_map[2] = R; rgba_map[3] = A; break; |
|
218 |
- } |
|
211 |
+ ff_fill_rgba_map(rgba_map, inlink->format); |
|
219 | 212 |
lut->step = av_get_bits_per_pixel(desc) >> 3; |
220 | 213 |
} |
221 | 214 |
|