From 3dfbd11fc846d01e894420a0b88261c8792ecce5 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 4 Feb 2015 18:01:51 +0100 Subject: [PATCH] video-converter: add fastpath for some gray formats --- gst-libs/gst/video/video-converter.c | 12 ++++++++++++ gst-libs/gst/video/video-scaler.c | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/gst-libs/gst/video/video-converter.c b/gst-libs/gst/video/video-converter.c index 676b87617f..3570539010 100644 --- a/gst-libs/gst/video/video-converter.c +++ b/gst-libs/gst/video/video-converter.c @@ -3336,6 +3336,18 @@ static const VideoTransform transforms[] = { convert_scale_planes, GST_VIDEO_FORMAT_RGB}, {GST_VIDEO_FORMAT_BGR, GST_VIDEO_FORMAT_BGR, TRUE, FALSE, FALSE, 0, 0, convert_scale_planes, GST_VIDEO_FORMAT_BGR}, + + {GST_VIDEO_FORMAT_GRAY8, GST_VIDEO_FORMAT_GRAY8, TRUE, FALSE, FALSE, 0, 0, + convert_scale_planes, GST_VIDEO_FORMAT_GRAY8}, +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + {GST_VIDEO_FORMAT_GRAY16_LE, GST_VIDEO_FORMAT_GRAY16_LE, TRUE, FALSE, FALSE, + 0, 0, + convert_scale_planes, GST_VIDEO_FORMAT_GRAY16_LE}, +#else + {GST_VIDEO_FORMAT_GRAY16_BE, GST_VIDEO_FORMAT_GRAY16_BE, TRUE, FALSE, FALSE, + 0, 0, + convert_scale_planes, GST_VIDEO_FORMAT_GRAY16_BE}, +#endif }; static gboolean diff --git a/gst-libs/gst/video/video-scaler.c b/gst-libs/gst/video/video-scaler.c index 7b86235c25..a74be5555a 100644 --- a/gst-libs/gst/video/video-scaler.c +++ b/gst-libs/gst/video/video-scaler.c @@ -1209,6 +1209,18 @@ gst_video_scaler_horizontal (GstVideoScaler * scale, GstVideoFormat format, break; } break; + case GST_VIDEO_FORMAT_GRAY16_LE: + case GST_VIDEO_FORMAT_GRAY16_BE: + switch (scale->resampler.max_taps) { + case 1: + func = video_scale_h_near_u16; + break; + default: + func = video_scale_h_ntap_u16; + break; + } + n_elems = 1; + break; default: goto no_func; } @@ -1291,6 +1303,11 @@ gst_video_scaler_vertical (GstVideoScaler * scale, GstVideoFormat format, bits = 8; n_elems = 2; break; + case GST_VIDEO_FORMAT_GRAY16_LE: + case GST_VIDEO_FORMAT_GRAY16_BE: + bits = 16; + n_elems = 1; + break; default: goto no_func; }