[FFmpeg-devel] [PATCH] lavfi/rotate: support few more pixel formats
Paul B Mahol
onemda at gmail.com
Fri Jul 5 22:13:07 CEST 2013
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavfilter/drawutils.c | 15 ++++++++++++++-
libavfilter/vf_rotate.c | 4 ++++
tests/ref/fate/filter-pixfmts-rotate | 7 +++++++
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
index b230761..2aff682 100644
--- a/libavfilter/drawutils.c
+++ b/libavfilter/drawutils.c
@@ -70,7 +70,20 @@ int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t
*is_packed_rgba = ff_fill_rgba_map(rgba_map, pix_fmt) >= 0;
- if (*is_packed_rgba) {
+ if (pix_fmt == AV_PIX_FMT_GBRP || pix_fmt == AV_PIX_FMT_GBRAP) {
+ int plane;
+
+ for (i = 0; i < 4; i++)
+ dst_color[rgba_map[i]] = rgba_color[i];
+
+ for (plane = 0; plane < 4; plane++) {
+ pixel_step[plane] = 1;
+ line[plane] = av_malloc(w);
+ memset(line[plane], dst_color[plane], w);
+ }
+ if (rgba_map_ptr)
+ memcpy(rgba_map_ptr, rgba_map, sizeof(rgba_map[0]) * 4);
+ } else if (*is_packed_rgba) {
pixel_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;
for (i = 0; i < 4; i++)
dst_color[rgba_map[i]] = rgba_color[i];
diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c
index a032f99..ed33db5 100644
--- a/libavfilter/vf_rotate.c
+++ b/libavfilter/vf_rotate.c
@@ -123,12 +123,16 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
static enum PixelFormat pix_fmts[] = {
+ AV_PIX_FMT_0RGB, AV_PIX_FMT_RGB0,
+ AV_PIX_FMT_0BGR, AV_PIX_FMT_BGR0,
AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA,
AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA,
AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P,
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUV410P,
AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA420P,
AV_PIX_FMT_NONE
};
diff --git a/tests/ref/fate/filter-pixfmts-rotate b/tests/ref/fate/filter-pixfmts-rotate
index b7757a9..62d9a37 100644
--- a/tests/ref/fate/filter-pixfmts-rotate
+++ b/tests/ref/fate/filter-pixfmts-rotate
@@ -1,10 +1,17 @@
+0bgr 21864cc5480275ad4df50d688af0f6ea
+0rgb b39f0a27506f7552be8327665af36022
abgr 24f441d2e6e67cae2d3451aa1dad23a7
argb 993002f41f621d04cd76278e466c03eb
+bgr0 850981edb25795122e8ee96b5b000cf7
bgr24 d0f449e8b38e07c947bd808f441a8ace
bgra 54cebf01881cb63ec3727f7cc23b0a6b
+gbrap 6d69c0cd0cba6300065f8d990e35b081
+gbrp b73c4db6a96fa79106232ba0e2da1c10
gray d58ee8dc3476a30debbddc65e1038d69
+rgb0 43e0e08a9df458c4ffc18d5bfbe643fc
rgb24 739f0eb47e76ce5c87354d5631ac2d5b
rgba f25570a798f24e8174729d978872c272
+yuv410p 22e673170464119cafb1a973c5a8080c
yuv420p afed4567a1b2d54ca9bc87bbdfff9a34
yuv444p df57aba68928092b54f6b75ab01e3110
yuva420p ad9bdb4f21855550a6f94e2d96588097
--
1.7.11.2
More information about the ffmpeg-devel
mailing list