mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 10:41:04 +00:00
videoscale: port to new API
This commit is contained in:
parent
70cdd9195f
commit
835422b2ea
16 changed files with 62 additions and 10040 deletions
|
@ -1,39 +1,23 @@
|
|||
plugin_LTLIBRARIES = libgstvideoscale.la
|
||||
|
||||
ORC_SOURCE=gstvideoscaleorc
|
||||
include $(top_srcdir)/common/orc.mak
|
||||
libgstvideoscale_la_SOURCES = gstvideoscale.c
|
||||
|
||||
libgstvideoscale_la_SOURCES = \
|
||||
gstvideoscale.c \
|
||||
vs_image.c \
|
||||
vs_scanline.c \
|
||||
vs_4tap.c \
|
||||
vs_fill_borders.c \
|
||||
vs_lanczos.c
|
||||
|
||||
nodist_libgstvideoscale_la_SOURCES = $(ORC_NODIST_SOURCES)
|
||||
|
||||
libgstvideoscale_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS)
|
||||
libgstvideoscale_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
libgstvideoscale_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
libgstvideoscale_la_LIBADD = \
|
||||
$(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_API_VERSION).la \
|
||||
$(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) $(LIBM)
|
||||
$(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
|
||||
libgstvideoscale_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
|
||||
|
||||
noinst_HEADERS = \
|
||||
gstvideoscale.h \
|
||||
vs_image.h \
|
||||
vs_scanline.h \
|
||||
vs_4tap.h \
|
||||
vs_fill_borders.h
|
||||
gstvideoscale.h
|
||||
|
||||
Android.mk: Makefile.am $(BUILT_SOURCES)
|
||||
androgenizer \
|
||||
-:PROJECT libgstvideoscale -:SHARED libgstvideoscale \
|
||||
-:TAGS eng debug \
|
||||
-:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
|
||||
-:SOURCES $(libgstvideoscale_la_SOURCES) \
|
||||
$(nodist_libgstvideoscale_la_SOURCES) \
|
||||
-:SOURCES $(libgstvideoscale_la_SOURCES)
|
||||
-:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstvideoscale_la_CFLAGS) \
|
||||
-:LDFLAGS $(libgstvideoscale_la_LDFLAGS) \
|
||||
$(libgstvideoscale_la_LIBADD) \
|
||||
|
|
|
@ -78,10 +78,6 @@
|
|||
#include <gst/video/gstvideopool.h>
|
||||
|
||||
#include "gstvideoscale.h"
|
||||
#include "gstvideoscaleorc.h"
|
||||
#include "vs_image.h"
|
||||
#include "vs_4tap.h"
|
||||
#include "vs_fill_borders.h"
|
||||
|
||||
/* debug variable definition */
|
||||
GST_DEBUG_CATEGORY (video_scale_debug);
|
||||
|
@ -120,11 +116,7 @@ enum
|
|||
* FIXME: add r210 support
|
||||
*/
|
||||
|
||||
#define GST_VIDEO_FORMATS "{ I420, YV12, YUY2, UYVY, AYUV, RGBx, " \
|
||||
"BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, " \
|
||||
"BGR, Y41B, Y42B, YVYU, Y444, GRAY8, GRAY16_BE, GRAY16_LE, " \
|
||||
"v308, RGB16, RGB15, ARGB64, AYUV64, NV12, NV21 } "
|
||||
|
||||
#define GST_VIDEO_FORMATS GST_VIDEO_FORMATS_ALL
|
||||
|
||||
static GstStaticCaps gst_video_scale_format_caps =
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS) ";"
|
||||
|
@ -200,9 +192,6 @@ static void gst_video_scale_set_property (GObject * object, guint prop_id,
|
|||
static void gst_video_scale_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static GstFlowReturn do_scale (GstVideoFilter * filter, VSImage dest[4],
|
||||
VSImage src[4]);
|
||||
|
||||
#define gst_video_scale_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstVideoScale, gst_video_scale, GST_TYPE_VIDEO_FILTER);
|
||||
|
||||
|
@ -281,7 +270,6 @@ gst_video_scale_class_init (GstVideoScaleClass * klass)
|
|||
static void
|
||||
gst_video_scale_init (GstVideoScale * videoscale)
|
||||
{
|
||||
videoscale->tmp_buf = NULL;
|
||||
videoscale->method = DEFAULT_PROP_METHOD;
|
||||
videoscale->add_borders = DEFAULT_PROP_ADD_BORDERS;
|
||||
videoscale->submethod = DEFAULT_PROP_SUBMETHOD;
|
||||
|
@ -294,8 +282,8 @@ gst_video_scale_init (GstVideoScale * videoscale)
|
|||
static void
|
||||
gst_video_scale_finalize (GstVideoScale * videoscale)
|
||||
{
|
||||
if (videoscale->tmp_buf)
|
||||
g_free (videoscale->tmp_buf);
|
||||
if (videoscale->convert)
|
||||
gst_video_converter_free (videoscale->convert);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT (videoscale));
|
||||
}
|
||||
|
@ -397,47 +385,11 @@ gst_video_scale_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
get_formats_filter (GstVideoScaleMethod method)
|
||||
{
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
return NULL;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
{
|
||||
static GstStaticCaps fourtap_filter =
|
||||
GST_STATIC_CAPS ("video/x-raw(ANY),"
|
||||
"format = (string) { RGBx, xRGB, BGRx, xBGR, RGBA, "
|
||||
"ARGB, BGRA, ABGR, AYUV, ARGB64, AYUV64, "
|
||||
"RGB, BGR, v308, YUY2, YVYU, UYVY, "
|
||||
"GRAY8, GRAY16_LE, GRAY16_BE, I420, YV12, "
|
||||
"Y444, Y42B, Y41B, RGB16, RGB15, NV12, NV21 }");
|
||||
return gst_static_caps_get (&fourtap_filter);
|
||||
}
|
||||
case GST_VIDEO_SCALE_LANCZOS:
|
||||
{
|
||||
static GstStaticCaps lanczos_filter =
|
||||
GST_STATIC_CAPS ("video/x-raw(ANY),"
|
||||
"format = (string) { RGBx, xRGB, BGRx, xBGR, RGBA, "
|
||||
"ARGB, BGRA, ABGR, AYUV, ARGB64, AYUV64, "
|
||||
"I420, YV12, Y444, Y42B, Y41B, NV12, NV21 }");
|
||||
return gst_static_caps_get (&lanczos_filter);
|
||||
}
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_video_scale_transform_caps (GstBaseTransform * trans,
|
||||
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
|
||||
{
|
||||
GstVideoScale *videoscale = GST_VIDEO_SCALE (trans);
|
||||
GstVideoScaleMethod method;
|
||||
GstCaps *ret, *mfilter;
|
||||
GstCaps *ret;
|
||||
GstStructure *structure;
|
||||
GstCapsFeatures *features;
|
||||
gint i, n;
|
||||
|
@ -446,20 +398,6 @@ gst_video_scale_transform_caps (GstBaseTransform * trans,
|
|||
"Transforming caps %" GST_PTR_FORMAT " in direction %s", caps,
|
||||
(direction == GST_PAD_SINK) ? "sink" : "src");
|
||||
|
||||
GST_OBJECT_LOCK (videoscale);
|
||||
method = videoscale->method;
|
||||
GST_OBJECT_UNLOCK (videoscale);
|
||||
|
||||
/* filter the supported formats */
|
||||
/* FIXME: Ideally we would still allow passthrough for the color formats
|
||||
* that are unsupported by the selected method */
|
||||
if ((mfilter = get_formats_filter (method))) {
|
||||
caps = gst_caps_intersect_full (caps, mfilter, GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref (mfilter);
|
||||
} else {
|
||||
gst_caps_ref (caps);
|
||||
}
|
||||
|
||||
ret = gst_caps_new_empty ();
|
||||
n = gst_caps_get_size (caps);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -487,7 +425,6 @@ gst_video_scale_transform_caps (GstBaseTransform * trans,
|
|||
GST_TYPE_FRACTION_RANGE, 1, G_MAXINT, G_MAXINT, 1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
gst_caps_append_structure_full (ret, structure,
|
||||
gst_caps_features_copy (features));
|
||||
}
|
||||
|
@ -501,7 +438,6 @@ gst_video_scale_transform_caps (GstBaseTransform * trans,
|
|||
ret = intersection;
|
||||
}
|
||||
|
||||
gst_caps_unref (caps);
|
||||
GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret);
|
||||
|
||||
return ret;
|
||||
|
@ -552,16 +488,57 @@ gst_video_scale_set_info (GstVideoFilter * filter, GstCaps * in,
|
|||
}
|
||||
}
|
||||
|
||||
if (videoscale->tmp_buf)
|
||||
g_free (videoscale->tmp_buf);
|
||||
videoscale->tmp_buf = g_malloc (out_info->width * sizeof (guint64) * 4);
|
||||
|
||||
if (in_info->width == out_info->width && in_info->height == out_info->height
|
||||
&& videoscale->borders_w == 0 && videoscale->borders_h == 0) {
|
||||
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (filter), TRUE);
|
||||
} else {
|
||||
GstStructure *options;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, filter, "setup videoscaling");
|
||||
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (filter), FALSE);
|
||||
|
||||
options = gst_structure_new_empty ("videoscale");
|
||||
|
||||
switch (videoscale->method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
gst_structure_set (options,
|
||||
GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD,
|
||||
GST_TYPE_VIDEO_RESAMPLER_METHOD, GST_VIDEO_RESAMPLER_METHOD_NEAREST,
|
||||
NULL);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
gst_structure_set (options,
|
||||
GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD,
|
||||
GST_TYPE_VIDEO_RESAMPLER_METHOD, GST_VIDEO_RESAMPLER_METHOD_LINEAR,
|
||||
NULL);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
gst_structure_set (options,
|
||||
GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD,
|
||||
GST_TYPE_VIDEO_RESAMPLER_METHOD, GST_VIDEO_RESAMPLER_METHOD_CUBIC,
|
||||
NULL);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_LANCZOS:
|
||||
gst_structure_set (options,
|
||||
GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD,
|
||||
GST_TYPE_VIDEO_RESAMPLER_METHOD, GST_VIDEO_RESAMPLER_METHOD_LANCZOS,
|
||||
GST_VIDEO_RESAMPLER_OPT_ENVELOPE, G_TYPE_DOUBLE,
|
||||
videoscale->envelope, GST_VIDEO_RESAMPLER_OPT_SHARPNESS,
|
||||
G_TYPE_DOUBLE, videoscale->sharpness,
|
||||
GST_VIDEO_RESAMPLER_OPT_SHARPEN, G_TYPE_DOUBLE, videoscale->sharpen,
|
||||
NULL);
|
||||
break;
|
||||
}
|
||||
gst_structure_set (options,
|
||||
GST_VIDEO_CONVERTER_OPT_DEST_X, G_TYPE_INT, videoscale->borders_w / 2,
|
||||
GST_VIDEO_CONVERTER_OPT_DEST_Y, G_TYPE_INT, videoscale->borders_h / 2,
|
||||
GST_VIDEO_CONVERTER_OPT_DEST_WIDTH, G_TYPE_INT,
|
||||
out_info->width - videoscale->borders_w,
|
||||
GST_VIDEO_CONVERTER_OPT_DEST_HEIGHT, G_TYPE_INT,
|
||||
out_info->height - videoscale->borders_h, NULL);
|
||||
|
||||
if (videoscale->convert)
|
||||
gst_video_converter_free (videoscale->convert);
|
||||
videoscale->convert = gst_video_converter_new (in_info, out_info, options);
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (videoscale, "from=%dx%d (par=%d/%d dar=%d/%d), size %"
|
||||
|
@ -1012,457 +989,20 @@ done:
|
|||
return othercaps;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_video_scale_setup_vs_image (VSImage * image, GstVideoFrame * frame,
|
||||
gint component, gint b_w, gint b_h, gboolean interlaced, gint field)
|
||||
{
|
||||
GstVideoFormat format;
|
||||
gint width, height;
|
||||
|
||||
format = GST_VIDEO_FRAME_FORMAT (frame);
|
||||
width = GST_VIDEO_FRAME_WIDTH (frame);
|
||||
height = GST_VIDEO_FRAME_HEIGHT (frame);
|
||||
|
||||
image->real_width = GST_VIDEO_FRAME_COMP_WIDTH (frame, component);
|
||||
image->real_height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, component);
|
||||
image->width = GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (frame->info.finfo,
|
||||
component, MAX (1, width - b_w));
|
||||
image->height = GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (frame->info.finfo,
|
||||
component, MAX (1, height - b_h));
|
||||
|
||||
if (interlaced) {
|
||||
image->real_height /= 2;
|
||||
image->height /= 2;
|
||||
}
|
||||
|
||||
image->border_top = (image->real_height - image->height) / 2;
|
||||
image->border_bottom = image->real_height - image->height - image->border_top;
|
||||
|
||||
if (format == GST_VIDEO_FORMAT_YUY2 || format == GST_VIDEO_FORMAT_YVYU
|
||||
|| format == GST_VIDEO_FORMAT_UYVY) {
|
||||
g_assert (component == 0);
|
||||
|
||||
image->border_left = (image->real_width - image->width) / 2;
|
||||
|
||||
if (image->border_left % 2 == 1)
|
||||
image->border_left--;
|
||||
image->border_right = image->real_width - image->width - image->border_left;
|
||||
} else {
|
||||
image->border_left = (image->real_width - image->width) / 2;
|
||||
image->border_right = image->real_width - image->width - image->border_left;
|
||||
}
|
||||
|
||||
image->real_pixels = GST_VIDEO_FRAME_PLANE_DATA (frame, component);
|
||||
image->stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, component);
|
||||
|
||||
if (interlaced) {
|
||||
if (field == 1)
|
||||
image->real_pixels += image->stride;
|
||||
image->stride *= 2;
|
||||
}
|
||||
|
||||
image->pixels =
|
||||
image->real_pixels + image->border_top * image->stride +
|
||||
image->border_left * GST_VIDEO_FRAME_COMP_PSTRIDE (frame, component);
|
||||
|
||||
}
|
||||
|
||||
static const guint8 *
|
||||
_get_black_for_format (GstVideoFormat format)
|
||||
{
|
||||
static const guint8 black[][4] = {
|
||||
{255, 0, 0, 0}, /* 0 = ARGB, ABGR, xRGB, xBGR */
|
||||
{0, 0, 0, 255}, /* 1 = RGBA, BGRA, RGBx, BGRx */
|
||||
{255, 16, 128, 128}, /* 2 = AYUV */
|
||||
{0, 0, 0, 0}, /* 3 = RGB and BGR */
|
||||
{16, 128, 128, 0}, /* 4 = v301 */
|
||||
{16, 128, 16, 128}, /* 5 = YUY2, YUYV */
|
||||
{128, 16, 128, 16}, /* 6 = UYVY */
|
||||
{16, 0, 0, 0}, /* 7 = Y */
|
||||
{0, 0, 0, 0} /* 8 = RGB565, RGB666 */
|
||||
};
|
||||
|
||||
switch (format) {
|
||||
case GST_VIDEO_FORMAT_ARGB:
|
||||
case GST_VIDEO_FORMAT_ABGR:
|
||||
case GST_VIDEO_FORMAT_xRGB:
|
||||
case GST_VIDEO_FORMAT_xBGR:
|
||||
case GST_VIDEO_FORMAT_ARGB64:
|
||||
return black[0];
|
||||
case GST_VIDEO_FORMAT_RGBA:
|
||||
case GST_VIDEO_FORMAT_BGRA:
|
||||
case GST_VIDEO_FORMAT_RGBx:
|
||||
case GST_VIDEO_FORMAT_BGRx:
|
||||
return black[1];
|
||||
case GST_VIDEO_FORMAT_AYUV:
|
||||
case GST_VIDEO_FORMAT_AYUV64:
|
||||
return black[2];
|
||||
case GST_VIDEO_FORMAT_RGB:
|
||||
case GST_VIDEO_FORMAT_BGR:
|
||||
return black[3];
|
||||
case GST_VIDEO_FORMAT_v308:
|
||||
return black[4];
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
case GST_VIDEO_FORMAT_YVYU:
|
||||
return black[5];
|
||||
case GST_VIDEO_FORMAT_UYVY:
|
||||
return black[6];
|
||||
case GST_VIDEO_FORMAT_GRAY8:
|
||||
return black[7];
|
||||
case GST_VIDEO_FORMAT_GRAY16_LE:
|
||||
case GST_VIDEO_FORMAT_GRAY16_BE:
|
||||
return NULL; /* Handled by the caller */
|
||||
case GST_VIDEO_FORMAT_I420:
|
||||
case GST_VIDEO_FORMAT_YV12:
|
||||
case GST_VIDEO_FORMAT_Y444:
|
||||
case GST_VIDEO_FORMAT_Y42B:
|
||||
case GST_VIDEO_FORMAT_Y41B:
|
||||
case GST_VIDEO_FORMAT_NV12:
|
||||
case GST_VIDEO_FORMAT_NV21:
|
||||
return black[4]; /* Y, U, V, 0 */
|
||||
case GST_VIDEO_FORMAT_RGB16:
|
||||
case GST_VIDEO_FORMAT_RGB15:
|
||||
return black[8];
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#define GET_LINE(frame, line) \
|
||||
(gpointer)(((guint8*)(GST_VIDEO_FRAME_PLANE_DATA (frame, 0))) + \
|
||||
GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0) * (line))
|
||||
|
||||
static GstFlowReturn
|
||||
gst_video_scale_transform_frame (GstVideoFilter * filter,
|
||||
GstVideoFrame * in_frame, GstVideoFrame * out_frame)
|
||||
{
|
||||
GstVideoScale *videoscale = GST_VIDEO_SCALE (filter);
|
||||
GstVideoScale *videoscale = GST_VIDEO_SCALE_CAST (filter);
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
VSImage dest[4] = { {NULL,}, };
|
||||
VSImage src[4] = { {NULL,}, };
|
||||
gint i;
|
||||
gboolean interlaced;
|
||||
|
||||
interlaced = GST_VIDEO_FRAME_IS_INTERLACED (in_frame);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_FRAME_N_PLANES (in_frame); i++) {
|
||||
gst_video_scale_setup_vs_image (&src[i], in_frame, i, 0, 0, interlaced, 0);
|
||||
gst_video_scale_setup_vs_image (&dest[i], out_frame, i,
|
||||
videoscale->borders_w, videoscale->borders_h, interlaced, 0);
|
||||
}
|
||||
ret = do_scale (filter, dest, src);
|
||||
|
||||
if (interlaced) {
|
||||
for (i = 0; i < GST_VIDEO_FRAME_N_PLANES (in_frame); i++) {
|
||||
gst_video_scale_setup_vs_image (&src[i], in_frame, i, 0, 0, interlaced,
|
||||
1);
|
||||
gst_video_scale_setup_vs_image (&dest[i], out_frame, i,
|
||||
videoscale->borders_w, videoscale->borders_h, interlaced, 1);
|
||||
}
|
||||
ret = do_scale (filter, dest, src);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
do_scale (GstVideoFilter * filter, VSImage dest[4], VSImage src[4])
|
||||
{
|
||||
GstVideoScale *videoscale = GST_VIDEO_SCALE (filter);
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
gint method;
|
||||
const guint8 *black;
|
||||
GstVideoFormat format;
|
||||
gboolean add_borders;
|
||||
|
||||
GST_OBJECT_LOCK (videoscale);
|
||||
method = videoscale->method;
|
||||
add_borders = videoscale->add_borders;
|
||||
GST_OBJECT_UNLOCK (videoscale);
|
||||
|
||||
format = GST_VIDEO_INFO_FORMAT (&filter->in_info);
|
||||
black = _get_black_for_format (format);
|
||||
|
||||
if (filter->in_info.width == 1) {
|
||||
method = GST_VIDEO_SCALE_NEAREST;
|
||||
}
|
||||
if (method == GST_VIDEO_SCALE_4TAP &&
|
||||
(filter->in_info.width < 4 || filter->in_info.height < 4)) {
|
||||
method = GST_VIDEO_SCALE_BILINEAR;
|
||||
}
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, filter,
|
||||
"doing videoscale format %s", GST_VIDEO_INFO_NAME (&filter->in_info));
|
||||
|
||||
switch (format) {
|
||||
case GST_VIDEO_FORMAT_RGBx:
|
||||
case GST_VIDEO_FORMAT_xRGB:
|
||||
case GST_VIDEO_FORMAT_BGRx:
|
||||
case GST_VIDEO_FORMAT_xBGR:
|
||||
case GST_VIDEO_FORMAT_RGBA:
|
||||
case GST_VIDEO_FORMAT_ARGB:
|
||||
case GST_VIDEO_FORMAT_BGRA:
|
||||
case GST_VIDEO_FORMAT_ABGR:
|
||||
case GST_VIDEO_FORMAT_AYUV:
|
||||
if (add_borders)
|
||||
vs_fill_borders_RGBA (&dest[0], black);
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_RGBA (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_RGBA (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_RGBA (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_LANCZOS:
|
||||
vs_image_scale_lanczos_AYUV (&dest[0], &src[0], videoscale->tmp_buf,
|
||||
videoscale->sharpness, videoscale->dither, videoscale->submethod,
|
||||
videoscale->envelope, videoscale->sharpen);
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_ARGB64:
|
||||
case GST_VIDEO_FORMAT_AYUV64:
|
||||
if (add_borders)
|
||||
vs_fill_borders_AYUV64 (&dest[0], black);
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_AYUV64 (&dest[0], &src[0],
|
||||
videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_AYUV64 (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_AYUV64 (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_LANCZOS:
|
||||
vs_image_scale_lanczos_AYUV64 (&dest[0], &src[0], videoscale->tmp_buf,
|
||||
videoscale->sharpness, videoscale->dither, videoscale->submethod,
|
||||
videoscale->envelope, videoscale->sharpen);
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_RGB:
|
||||
case GST_VIDEO_FORMAT_BGR:
|
||||
case GST_VIDEO_FORMAT_v308:
|
||||
if (add_borders)
|
||||
vs_fill_borders_RGB (&dest[0], black);
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_RGB (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_RGB (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_RGB (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
case GST_VIDEO_FORMAT_YVYU:
|
||||
if (add_borders)
|
||||
vs_fill_borders_YUYV (&dest[0], black);
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_YUYV (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_YUYV (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_YUYV (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_UYVY:
|
||||
if (add_borders)
|
||||
vs_fill_borders_UYVY (&dest[0], black);
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_UYVY (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_UYVY (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_UYVY (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_GRAY8:
|
||||
if (add_borders)
|
||||
vs_fill_borders_Y (&dest[0], black);
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_Y (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_Y (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_Y (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_GRAY16_LE:
|
||||
case GST_VIDEO_FORMAT_GRAY16_BE:
|
||||
if (add_borders)
|
||||
vs_fill_borders_Y16 (&dest[0], 0);
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_Y16 (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_Y16 (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_Y16 (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_I420:
|
||||
case GST_VIDEO_FORMAT_YV12:
|
||||
case GST_VIDEO_FORMAT_Y444:
|
||||
case GST_VIDEO_FORMAT_Y42B:
|
||||
case GST_VIDEO_FORMAT_Y41B:
|
||||
if (add_borders) {
|
||||
vs_fill_borders_Y (&dest[0], black);
|
||||
vs_fill_borders_Y (&dest[1], black + 1);
|
||||
vs_fill_borders_Y (&dest[2], black + 2);
|
||||
}
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_Y (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
vs_image_scale_nearest_Y (&dest[1], &src[1], videoscale->tmp_buf);
|
||||
vs_image_scale_nearest_Y (&dest[2], &src[2], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_Y (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
vs_image_scale_linear_Y (&dest[1], &src[1], videoscale->tmp_buf);
|
||||
vs_image_scale_linear_Y (&dest[2], &src[2], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_Y (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
vs_image_scale_4tap_Y (&dest[1], &src[1], videoscale->tmp_buf);
|
||||
vs_image_scale_4tap_Y (&dest[2], &src[2], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_LANCZOS:
|
||||
vs_image_scale_lanczos_Y (&dest[0], &src[0], videoscale->tmp_buf,
|
||||
videoscale->sharpness, videoscale->dither, videoscale->submethod,
|
||||
videoscale->envelope, videoscale->sharpen);
|
||||
vs_image_scale_lanczos_Y (&dest[1], &src[1], videoscale->tmp_buf,
|
||||
videoscale->sharpness, videoscale->dither, videoscale->submethod,
|
||||
videoscale->envelope, videoscale->sharpen);
|
||||
vs_image_scale_lanczos_Y (&dest[2], &src[2], videoscale->tmp_buf,
|
||||
videoscale->sharpness, videoscale->dither, videoscale->submethod,
|
||||
videoscale->envelope, videoscale->sharpen);
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_NV12:
|
||||
case GST_VIDEO_FORMAT_NV21:
|
||||
/* NV21 format is exactly same as NV12 with the difference that u, v are reversed.
|
||||
So same functions of NV12 could be reused */
|
||||
if (add_borders) {
|
||||
vs_fill_borders_Y (&dest[0], black);
|
||||
vs_fill_borders_Y16 (&dest[1], (black[1] << 8) | black[2]);
|
||||
}
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_Y (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
vs_image_scale_nearest_NV12 (&dest[1], &src[1], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_Y (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
vs_image_scale_linear_NV12 (&dest[1], &src[1], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_Y (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
vs_image_scale_4tap_NV12 (&dest[1], &src[1], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_LANCZOS:
|
||||
vs_image_scale_lanczos_Y (&dest[0], &src[0], videoscale->tmp_buf,
|
||||
videoscale->sharpness, videoscale->dither, videoscale->submethod,
|
||||
videoscale->envelope, videoscale->sharpen);
|
||||
vs_image_scale_lanczos_NV (&dest[1], &src[1], videoscale->tmp_buf,
|
||||
videoscale->sharpness, videoscale->dither, videoscale->submethod,
|
||||
videoscale->envelope, videoscale->sharpen);
|
||||
break;
|
||||
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_RGB16:
|
||||
if (add_borders)
|
||||
vs_fill_borders_RGB565 (&dest[0], black);
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_RGB565 (&dest[0], &src[0],
|
||||
videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_RGB565 (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_RGB565 (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_RGB15:
|
||||
if (add_borders)
|
||||
vs_fill_borders_RGB555 (&dest[0], black);
|
||||
switch (method) {
|
||||
case GST_VIDEO_SCALE_NEAREST:
|
||||
vs_image_scale_nearest_RGB555 (&dest[0], &src[0],
|
||||
videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_BILINEAR:
|
||||
vs_image_scale_linear_RGB555 (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
case GST_VIDEO_SCALE_4TAP:
|
||||
vs_image_scale_4tap_RGB555 (&dest[0], &src[0], videoscale->tmp_buf);
|
||||
break;
|
||||
default:
|
||||
goto unknown_mode;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto unsupported;
|
||||
}
|
||||
gst_video_converter_frame (videoscale->convert, in_frame, out_frame);
|
||||
|
||||
return ret;
|
||||
|
||||
/* ERRORS */
|
||||
unsupported:
|
||||
{
|
||||
GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
|
||||
("Unsupported format %d for scaling method %d", format, method));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
unknown_mode:
|
||||
{
|
||||
GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
|
||||
("Unknown scaling method %d", videoscale->method));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1515,8 +1055,6 @@ plugin_init (GstPlugin * plugin)
|
|||
"videoscale element");
|
||||
GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
|
||||
|
||||
vs_4tap_init ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#include <gst/video/video.h>
|
||||
#include <gst/video/gstvideofilter.h>
|
||||
|
||||
#include "vs_image.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (video_scale_debug);
|
||||
|
@ -80,11 +78,10 @@ struct _GstVideoScale {
|
|||
int submethod;
|
||||
double envelope;
|
||||
|
||||
GstVideoConverter *convert;
|
||||
|
||||
gint borders_h;
|
||||
gint borders_w;
|
||||
|
||||
/*< private >*/
|
||||
guint8 *tmp_buf;
|
||||
};
|
||||
|
||||
struct _GstVideoScaleClass {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,104 +0,0 @@
|
|||
|
||||
/* autogenerated from gstvideoscaleorc.orc */
|
||||
|
||||
#ifndef _GSTVIDEOSCALEORC_H_
|
||||
#define _GSTVIDEOSCALEORC_H_
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef _ORC_INTEGER_TYPEDEFS_
|
||||
#define _ORC_INTEGER_TYPEDEFS_
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <stdint.h>
|
||||
typedef int8_t orc_int8;
|
||||
typedef int16_t orc_int16;
|
||||
typedef int32_t orc_int32;
|
||||
typedef int64_t orc_int64;
|
||||
typedef uint8_t orc_uint8;
|
||||
typedef uint16_t orc_uint16;
|
||||
typedef uint32_t orc_uint32;
|
||||
typedef uint64_t orc_uint64;
|
||||
#define ORC_UINT64_C(x) UINT64_C(x)
|
||||
#elif defined(_MSC_VER)
|
||||
typedef signed __int8 orc_int8;
|
||||
typedef signed __int16 orc_int16;
|
||||
typedef signed __int32 orc_int32;
|
||||
typedef signed __int64 orc_int64;
|
||||
typedef unsigned __int8 orc_uint8;
|
||||
typedef unsigned __int16 orc_uint16;
|
||||
typedef unsigned __int32 orc_uint32;
|
||||
typedef unsigned __int64 orc_uint64;
|
||||
#define ORC_UINT64_C(x) (x##Ui64)
|
||||
#define inline __inline
|
||||
#else
|
||||
#include <limits.h>
|
||||
typedef signed char orc_int8;
|
||||
typedef short orc_int16;
|
||||
typedef int orc_int32;
|
||||
typedef unsigned char orc_uint8;
|
||||
typedef unsigned short orc_uint16;
|
||||
typedef unsigned int orc_uint32;
|
||||
#if INT_MAX == LONG_MAX
|
||||
typedef long long orc_int64;
|
||||
typedef unsigned long long orc_uint64;
|
||||
#define ORC_UINT64_C(x) (x##ULL)
|
||||
#else
|
||||
typedef long orc_int64;
|
||||
typedef unsigned long orc_uint64;
|
||||
#define ORC_UINT64_C(x) (x##UL)
|
||||
#endif
|
||||
#endif
|
||||
typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16;
|
||||
typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32;
|
||||
typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; } orc_union64;
|
||||
#endif
|
||||
#ifndef ORC_RESTRICT
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#define ORC_RESTRICT restrict
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define ORC_RESTRICT __restrict__
|
||||
#else
|
||||
#define ORC_RESTRICT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ORC_INTERNAL
|
||||
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
||||
#define ORC_INTERNAL __attribute__((visibility("hidden")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
#define ORC_INTERNAL __hidden
|
||||
#elif defined (__GNUC__)
|
||||
#define ORC_INTERNAL __attribute__((visibility("hidden")))
|
||||
#else
|
||||
#define ORC_INTERNAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void video_scale_orc_merge_linear_u8 (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int p1, int n);
|
||||
void video_scale_orc_merge_linear_u16 (orc_uint16 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, int p1, int p2, int n);
|
||||
void video_scale_orc_splat_u16 (orc_uint16 * ORC_RESTRICT d1, int p1, int n);
|
||||
void video_scale_orc_splat_u32 (orc_uint32 * ORC_RESTRICT d1, int p1, int n);
|
||||
void video_scale_orc_splat_u64 (orc_uint64 * ORC_RESTRICT d1, orc_int64 p1, int n);
|
||||
void video_scale_orc_downsample_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
|
||||
void video_scale_orc_downsample_u16 (guint16 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n);
|
||||
void video_scale_orc_downsample_u32 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
|
||||
void video_scale_orc_downsample_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
|
||||
void video_scale_orc_resample_nearest_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int p1, int p2, int n);
|
||||
void video_scale_orc_resample_bilinear_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int p1, int p2, int n);
|
||||
void video_scale_orc_resample_nearest_u32 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int p1, int p2, int n);
|
||||
void video_scale_orc_resample_bilinear_u32 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int p1, int p2, int n);
|
||||
void video_scale_orc_resample_merge_bilinear_u32 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n);
|
||||
void video_scale_orc_merge_bicubic_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int p1, int p2, int p3, int p4, int n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
|
||||
.function video_scale_orc_merge_linear_u8
|
||||
.dest 1 d1
|
||||
.source 1 s1
|
||||
.source 1 s2
|
||||
.param 1 p1
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
.temp 1 a
|
||||
.temp 1 t
|
||||
|
||||
loadb a, s1
|
||||
convubw t1, s1
|
||||
convubw t2, s2
|
||||
subw t2, t2, t1
|
||||
mullw t2, t2, p1
|
||||
addw t2, t2, 128
|
||||
convhwb t, t2
|
||||
addb d1, t, a
|
||||
|
||||
|
||||
|
||||
.function video_scale_orc_merge_linear_u16
|
||||
.dest 2 d1
|
||||
.source 2 s1
|
||||
.source 2 s2
|
||||
.param 2 p1
|
||||
.param 2 p2
|
||||
.temp 4 t1
|
||||
.temp 4 t2
|
||||
|
||||
# This is slightly different thatn the u8 case, since muluwl
|
||||
# tends to be much faster than mulll
|
||||
muluwl t1, s1, p1
|
||||
muluwl t2, s2, p2
|
||||
addl t1, t1, t2
|
||||
shrul t1, t1, 16
|
||||
convlw d1, t1
|
||||
|
||||
|
||||
.function video_scale_orc_splat_u16
|
||||
.dest 2 d1
|
||||
.param 2 p1
|
||||
|
||||
copyw d1, p1
|
||||
|
||||
|
||||
.function video_scale_orc_splat_u32
|
||||
.dest 4 d1
|
||||
.param 4 p1
|
||||
|
||||
copyl d1, p1
|
||||
|
||||
|
||||
.function video_scale_orc_splat_u64
|
||||
.dest 8 d1
|
||||
.longparam 8 p1
|
||||
|
||||
copyq d1, p1
|
||||
|
||||
|
||||
.function video_scale_orc_downsample_u8
|
||||
.dest 1 d1 guint8
|
||||
.source 2 s1 guint8
|
||||
.temp 1 t1
|
||||
.temp 1 t2
|
||||
|
||||
splitwb t1, t2, s1
|
||||
avgub d1, t1, t2
|
||||
|
||||
|
||||
.function video_scale_orc_downsample_u16
|
||||
.dest 2 d1 guint16
|
||||
.source 4 s1 guint16
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
|
||||
splitlw t1, t2, s1
|
||||
avguw d1, t1, t2
|
||||
|
||||
|
||||
.function video_scale_orc_downsample_u32
|
||||
.dest 4 d1 guint8
|
||||
.source 8 s1 guint8
|
||||
.temp 4 t1
|
||||
.temp 4 t2
|
||||
|
||||
splitql t1, t2, s1
|
||||
x4 avgub d1, t1, t2
|
||||
|
||||
|
||||
.function video_scale_orc_downsample_yuyv
|
||||
.dest 4 d1 guint8
|
||||
.source 8 s1 guint8
|
||||
.temp 4 yyyy
|
||||
.temp 4 uvuv
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
.temp 2 yy
|
||||
.temp 2 uv
|
||||
|
||||
x4 splitwb yyyy, uvuv, s1
|
||||
x2 splitwb t1, t2, yyyy
|
||||
x2 avgub yy, t1, t2
|
||||
splitlw t1, t2, uvuv
|
||||
x2 avgub uv, t1, t2
|
||||
x2 mergebw d1, yy, uv
|
||||
|
||||
|
||||
|
||||
.function video_scale_orc_resample_nearest_u8
|
||||
.dest 1 d1 guint8
|
||||
.source 1 s1 guint8
|
||||
.param 4 p1
|
||||
.param 4 p2
|
||||
|
||||
ldresnearb d1, s1, p1, p2
|
||||
|
||||
|
||||
.function video_scale_orc_resample_bilinear_u8
|
||||
.dest 1 d1 guint8
|
||||
.source 1 s1 guint8
|
||||
.param 4 p1
|
||||
.param 4 p2
|
||||
|
||||
ldreslinb d1, s1, p1, p2
|
||||
|
||||
|
||||
.function video_scale_orc_resample_nearest_u32
|
||||
.dest 4 d1 guint8
|
||||
.source 4 s1 guint8
|
||||
.param 4 p1
|
||||
.param 4 p2
|
||||
|
||||
ldresnearl d1, s1, p1, p2
|
||||
|
||||
|
||||
.function video_scale_orc_resample_bilinear_u32
|
||||
.dest 4 d1 guint8
|
||||
.source 4 s1 guint8
|
||||
.param 4 p1
|
||||
.param 4 p2
|
||||
|
||||
ldreslinl d1, s1, p1, p2
|
||||
|
||||
|
||||
.function video_scale_orc_resample_merge_bilinear_u32
|
||||
.dest 4 d1 guint8
|
||||
.dest 4 d2 guint8
|
||||
.source 4 s1 guint8
|
||||
.source 4 s2 guint8
|
||||
.temp 4 a
|
||||
.temp 4 b
|
||||
.temp 4 t
|
||||
.temp 8 t1
|
||||
.temp 8 t2
|
||||
.param 4 p1
|
||||
.param 4 p2
|
||||
.param 4 p3
|
||||
|
||||
ldreslinl b, s2, p2, p3
|
||||
storel d2, b
|
||||
loadl a, s1
|
||||
x4 convubw t1, a
|
||||
x4 convubw t2, b
|
||||
x4 subw t2, t2, t1
|
||||
x4 mullw t2, t2, p1
|
||||
x4 convhwb t, t2
|
||||
x4 addb d1, t, a
|
||||
|
||||
|
||||
|
||||
.function video_scale_orc_merge_bicubic_u8
|
||||
.dest 1 d1 guint8
|
||||
.source 1 s1 guint8
|
||||
.source 1 s2 guint8
|
||||
.source 1 s3 guint8
|
||||
.source 1 s4 guint8
|
||||
.param 4 p1
|
||||
.param 4 p2
|
||||
.param 4 p3
|
||||
.param 4 p4
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
|
||||
mulubw t1, s2, p2
|
||||
mulubw t2, s3, p3
|
||||
addw t1, t1, t2
|
||||
mulubw t2, s1, p1
|
||||
subw t1, t1, t2
|
||||
mulubw t2, s4, p4
|
||||
subw t1, t1, t2
|
||||
addw t1, t1, 32
|
||||
shrsw t1, t1, 6
|
||||
convsuswb d1, t1
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
* Image Scaling Functions (4 tap)
|
||||
* Copyright (c) 2005 David A. Schleef <ds@schleef.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _VS_4TAP_H_
|
||||
#define _VS_4TAP_H_
|
||||
|
||||
#include "vs_image.h"
|
||||
|
||||
G_GNUC_INTERNAL void vs_4tap_init (void);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_4tap_Y (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_4tap_NV12 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_4tap_RGBA (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_4tap_RGB (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_4tap_YUYV (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_4tap_UYVY (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_4tap_RGB565 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_4tap_RGB555 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_4tap_Y16 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_4tap_AYUV64 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,421 +0,0 @@
|
|||
/*
|
||||
* Image Scaling Functions
|
||||
* Copyright (c) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vs_fill_borders.h"
|
||||
#include "gstvideoscaleorc.h"
|
||||
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
#define READ_UINT32(ptr) GST_READ_UINT32_LE(ptr)
|
||||
#define READ_UINT16(ptr) GST_READ_UINT16_LE(ptr)
|
||||
#else
|
||||
#define READ_UINT32(ptr) GST_READ_UINT32_BE(ptr)
|
||||
#define READ_UINT16(ptr) GST_READ_UINT16_BE(ptr)
|
||||
#endif
|
||||
|
||||
void
|
||||
vs_fill_borders_RGBA (const VSImage * dest, const uint8_t * val)
|
||||
{
|
||||
int i;
|
||||
int top = dest->border_top, bottom = dest->border_bottom;
|
||||
int left = dest->border_left, right = dest->border_right;
|
||||
int width = dest->width;
|
||||
int height = dest->height;
|
||||
int real_width = dest->real_width;
|
||||
gsize stride = dest->stride;
|
||||
int tmp, tmp2;
|
||||
uint8_t *data;
|
||||
uint32_t v = READ_UINT32 (val);
|
||||
|
||||
data = dest->real_pixels;
|
||||
for (i = 0; i < top; i++) {
|
||||
video_scale_orc_splat_u32 ((uint32_t *) data, v, real_width);
|
||||
data += stride;
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
tmp = height;
|
||||
tmp2 = (left + width) * 4;
|
||||
for (i = 0; i < tmp; i++) {
|
||||
video_scale_orc_splat_u32 ((uint32_t *) data, v, left);
|
||||
video_scale_orc_splat_u32 ((uint32_t *) (data + tmp2), v, right);
|
||||
data += stride;
|
||||
}
|
||||
} else {
|
||||
data += stride * height;
|
||||
}
|
||||
|
||||
for (i = 0; i < bottom; i++) {
|
||||
video_scale_orc_splat_u32 ((uint32_t *) data, v, real_width);
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_memset_u24 (uint8_t * data, uint8_t val1, uint8_t val2, uint8_t val3,
|
||||
unsigned int n)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
data[0] = val1;
|
||||
data[1] = val2;
|
||||
data[2] = val3;
|
||||
data += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_fill_borders_RGB (const VSImage * dest, const uint8_t * val)
|
||||
{
|
||||
int i;
|
||||
int top = dest->border_top, bottom = dest->border_bottom;
|
||||
int left = dest->border_left, right = dest->border_right;
|
||||
int width = dest->width;
|
||||
int height = dest->height;
|
||||
int real_width = dest->real_width;
|
||||
gsize stride = dest->stride;
|
||||
int tmp, tmp2;
|
||||
uint8_t *data;
|
||||
|
||||
data = dest->real_pixels;
|
||||
for (i = 0; i < top; i++) {
|
||||
_memset_u24 (data, val[0], val[1], val[2], real_width);
|
||||
data += stride;
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
tmp = height;
|
||||
tmp2 = (left + width) * 3;
|
||||
for (i = 0; i < tmp; i++) {
|
||||
_memset_u24 (data, val[0], val[1], val[2], left);
|
||||
_memset_u24 (data + tmp2, val[0], val[1], val[2], right);
|
||||
data += stride;
|
||||
}
|
||||
} else {
|
||||
data += stride * height;
|
||||
}
|
||||
|
||||
for (i = 0; i < bottom; i++) {
|
||||
_memset_u24 (data, val[0], val[1], val[2], real_width);
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_fill_borders_YUYV (const VSImage * dest, const uint8_t * val)
|
||||
{
|
||||
int i, j;
|
||||
int top = dest->border_top, bottom = dest->border_bottom;
|
||||
int left = dest->border_left, right = dest->border_right;
|
||||
int width = dest->width;
|
||||
int height = dest->height;
|
||||
int real_width = dest->real_width;
|
||||
gsize stride = dest->stride;
|
||||
int tmp, tmp2;
|
||||
uint8_t *data;
|
||||
|
||||
data = dest->real_pixels;
|
||||
for (i = 0; i < top; i++) {
|
||||
for (j = 0; j < real_width; j++) {
|
||||
data[2 * j] = val[0];
|
||||
data[2 * j + 1] = (j % 2 == 0) ? val[1] : val[3];
|
||||
}
|
||||
data += stride;
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
tmp = height;
|
||||
tmp2 = (left + width) * 2;
|
||||
for (i = 0; i < tmp; i++) {
|
||||
for (j = 0; j < left; j++) {
|
||||
data[2 * j] = val[0];
|
||||
data[2 * j + 1] = (j % 2 == 0) ? val[1] : val[3];
|
||||
}
|
||||
for (j = 0; j < right; j++) {
|
||||
data[tmp2 + 2 * j] = val[0];
|
||||
data[tmp2 + 2 * j + 1] = (j % 2 == 0) ? val[1] : val[3];
|
||||
}
|
||||
data += stride;
|
||||
}
|
||||
} else {
|
||||
data += stride * height;
|
||||
}
|
||||
|
||||
for (i = 0; i < bottom; i++) {
|
||||
for (j = 0; j < real_width; j++) {
|
||||
data[2 * j] = val[0];
|
||||
data[2 * j + 1] = (j % 2 == 0) ? val[1] : val[3];
|
||||
}
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_fill_borders_UYVY (const VSImage * dest, const uint8_t * val)
|
||||
{
|
||||
int i, j;
|
||||
int top = dest->border_top, bottom = dest->border_bottom;
|
||||
int left = dest->border_left, right = dest->border_right;
|
||||
int width = dest->width;
|
||||
int height = dest->height;
|
||||
int real_width = dest->real_width;
|
||||
gsize stride = dest->stride;
|
||||
int tmp, tmp2;
|
||||
uint8_t *data;
|
||||
|
||||
data = dest->real_pixels;
|
||||
for (i = 0; i < top; i++) {
|
||||
for (j = 0; j < real_width; j++) {
|
||||
data[2 * j] = (j % 2 == 0) ? val[0] : val[2];
|
||||
data[2 * j + 1] = val[1];
|
||||
}
|
||||
data += stride;
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
tmp = height;
|
||||
tmp2 = (left + width) * 2;
|
||||
for (i = 0; i < tmp; i++) {
|
||||
for (j = 0; j < left; j++) {
|
||||
data[2 * j] = (j % 2 == 0) ? val[0] : val[2];
|
||||
data[2 * j + 1] = val[1];
|
||||
}
|
||||
for (j = 0; j < right; j++) {
|
||||
data[tmp2 + 2 * j] = (j % 2 == 0) ? val[0] : val[2];
|
||||
data[tmp2 + 2 * j + 1] = val[1];
|
||||
}
|
||||
data += stride;
|
||||
}
|
||||
} else {
|
||||
data += stride * height;
|
||||
}
|
||||
|
||||
for (i = 0; i < bottom; i++) {
|
||||
for (j = 0; j < real_width; j++) {
|
||||
data[2 * j] = (j % 2 == 0) ? val[0] : val[2];
|
||||
data[2 * j + 1] = val[1];
|
||||
}
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_fill_borders_Y (const VSImage * dest, const uint8_t * val)
|
||||
{
|
||||
int i;
|
||||
int top = dest->border_top, bottom = dest->border_bottom;
|
||||
int left = dest->border_left, right = dest->border_right;
|
||||
int width = dest->width;
|
||||
int height = dest->height;
|
||||
int real_width = dest->real_width;
|
||||
gsize stride = dest->stride;
|
||||
int tmp, tmp2;
|
||||
uint8_t *data;
|
||||
|
||||
data = dest->real_pixels;
|
||||
for (i = 0; i < top; i++) {
|
||||
memset (data, *val, real_width);
|
||||
data += stride;
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
tmp = height;
|
||||
tmp2 = left + width;
|
||||
for (i = 0; i < tmp; i++) {
|
||||
memset (data, *val, left);
|
||||
memset (data + tmp2, *val, right);
|
||||
data += stride;
|
||||
}
|
||||
} else {
|
||||
data += stride * height;
|
||||
}
|
||||
|
||||
for (i = 0; i < bottom; i++) {
|
||||
memset (data, *val, real_width);
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_fill_borders_Y16 (const VSImage * dest, const uint16_t val)
|
||||
{
|
||||
int i;
|
||||
int top = dest->border_top, bottom = dest->border_bottom;
|
||||
int left = dest->border_left, right = dest->border_right;
|
||||
int width = dest->width;
|
||||
int height = dest->height;
|
||||
int real_width = dest->real_width;
|
||||
gsize stride = dest->stride;
|
||||
int tmp, tmp2;
|
||||
uint8_t *data;
|
||||
|
||||
data = dest->real_pixels;
|
||||
for (i = 0; i < top; i++) {
|
||||
video_scale_orc_splat_u16 ((uint16_t *) data, val, real_width);
|
||||
data += stride;
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
tmp = height;
|
||||
tmp2 = (left + width) * 2;
|
||||
for (i = 0; i < tmp; i++) {
|
||||
video_scale_orc_splat_u16 ((uint16_t *) data, val, left);
|
||||
video_scale_orc_splat_u16 ((uint16_t *) (data + tmp2), val, right);
|
||||
data += stride;
|
||||
}
|
||||
} else {
|
||||
data += stride * height;
|
||||
}
|
||||
|
||||
for (i = 0; i < bottom; i++) {
|
||||
video_scale_orc_splat_u16 ((uint16_t *) data, val, real_width);
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_fill_borders_RGB565 (const VSImage * dest, const uint8_t * val)
|
||||
{
|
||||
int i;
|
||||
int top = dest->border_top, bottom = dest->border_bottom;
|
||||
int left = dest->border_left, right = dest->border_right;
|
||||
int width = dest->width;
|
||||
int height = dest->height;
|
||||
int real_width = dest->real_width;
|
||||
gsize stride = dest->stride;
|
||||
int tmp, tmp2;
|
||||
uint8_t *data;
|
||||
uint16_t v = READ_UINT16 (val);
|
||||
|
||||
data = dest->real_pixels;
|
||||
for (i = 0; i < top; i++) {
|
||||
video_scale_orc_splat_u16 ((uint16_t *) data, v, real_width);
|
||||
data += stride;
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
tmp = height;
|
||||
tmp2 = (left + width) * 2;
|
||||
for (i = 0; i < tmp; i++) {
|
||||
video_scale_orc_splat_u16 ((uint16_t *) data, v, left);
|
||||
video_scale_orc_splat_u16 ((uint16_t *) (data + tmp2), v, right);
|
||||
data += stride;
|
||||
}
|
||||
} else {
|
||||
data += stride * height;
|
||||
}
|
||||
|
||||
for (i = 0; i < bottom; i++) {
|
||||
video_scale_orc_splat_u16 ((uint16_t *) data, v, real_width);
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_fill_borders_RGB555 (const VSImage * dest, const uint8_t * val)
|
||||
{
|
||||
int i;
|
||||
int top = dest->border_top, bottom = dest->border_bottom;
|
||||
int left = dest->border_left, right = dest->border_right;
|
||||
int width = dest->width;
|
||||
int height = dest->height;
|
||||
int real_width = dest->real_width;
|
||||
gsize stride = dest->stride;
|
||||
int tmp, tmp2;
|
||||
uint8_t *data;
|
||||
uint16_t v = READ_UINT16 (val);
|
||||
|
||||
data = dest->real_pixels;
|
||||
for (i = 0; i < top; i++) {
|
||||
video_scale_orc_splat_u16 ((uint16_t *) data, v, real_width);
|
||||
data += stride;
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
tmp = height;
|
||||
tmp2 = (left + width) * 2;
|
||||
for (i = 0; i < tmp; i++) {
|
||||
video_scale_orc_splat_u16 ((uint16_t *) data, v, left);
|
||||
video_scale_orc_splat_u16 ((uint16_t *) (data + tmp2), v, right);
|
||||
data += stride;
|
||||
}
|
||||
} else {
|
||||
data += stride * height;
|
||||
}
|
||||
|
||||
for (i = 0; i < bottom; i++) {
|
||||
video_scale_orc_splat_u16 ((uint16_t *) data, v, real_width);
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_fill_borders_AYUV64 (const VSImage * dest, const uint8_t * val)
|
||||
{
|
||||
int i;
|
||||
int top = dest->border_top, bottom = dest->border_bottom;
|
||||
int left = dest->border_left, right = dest->border_right;
|
||||
int width = dest->width;
|
||||
int height = dest->height;
|
||||
int real_width = dest->real_width;
|
||||
gsize stride = dest->stride;
|
||||
int tmp, tmp2;
|
||||
uint8_t *data;
|
||||
uint64_t v;
|
||||
|
||||
v = (((guint32) val[0]) << 8) | (((guint32) val[1]) << 24) |
|
||||
(((guint64) val[2]) << 40) | (((guint64) val[3]) << 56);
|
||||
|
||||
data = dest->real_pixels;
|
||||
for (i = 0; i < top; i++) {
|
||||
video_scale_orc_splat_u64 ((uint64_t *) data, v, real_width);
|
||||
data += stride;
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
tmp = height;
|
||||
tmp2 = (left + width) * 8;
|
||||
for (i = 0; i < tmp; i++) {
|
||||
video_scale_orc_splat_u64 ((uint64_t *) data, v, left);
|
||||
video_scale_orc_splat_u64 ((uint64_t *) (data + tmp2), v, right);
|
||||
data += stride;
|
||||
}
|
||||
} else {
|
||||
data += stride * height;
|
||||
}
|
||||
|
||||
for (i = 0; i < bottom; i++) {
|
||||
video_scale_orc_splat_u64 ((uint64_t *) data, v, real_width);
|
||||
data += stride;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Image Scaling Functions
|
||||
* Copyright (c) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __VS_FILL_BORDERS_H__
|
||||
#define __VS_FILL_BORDERS_H__
|
||||
|
||||
#include <_stdint.h>
|
||||
#include "vs_image.h"
|
||||
|
||||
G_GNUC_INTERNAL void vs_fill_borders_RGBA (const VSImage *dest, const uint8_t *val);
|
||||
G_GNUC_INTERNAL void vs_fill_borders_RGB (const VSImage *dest, const uint8_t *val);
|
||||
G_GNUC_INTERNAL void vs_fill_borders_YUYV (const VSImage *dest, const uint8_t *val);
|
||||
G_GNUC_INTERNAL void vs_fill_borders_UYVY (const VSImage *dest, const uint8_t *val);
|
||||
G_GNUC_INTERNAL void vs_fill_borders_Y (const VSImage *dest, const uint8_t *val);
|
||||
G_GNUC_INTERNAL void vs_fill_borders_Y16 (const VSImage *dest, const uint16_t val);
|
||||
G_GNUC_INTERNAL void vs_fill_borders_RGB565 (const VSImage *dest, const uint8_t *val);
|
||||
G_GNUC_INTERNAL void vs_fill_borders_RGB555 (const VSImage *dest, const uint8_t *val);
|
||||
G_GNUC_INTERNAL void vs_fill_borders_AYUV64 (const VSImage *dest, const uint8_t *val);
|
||||
|
||||
#endif /* __VS_FILL_BORDERS_H__ */
|
File diff suppressed because it is too large
Load diff
|
@ -1,182 +0,0 @@
|
|||
/*
|
||||
* Image Scaling Functions
|
||||
* Copyright (c) 2005 David A. Schleef <ds@schleef.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __VS_IMAGE_H__
|
||||
#define __VS_IMAGE_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <_stdint.h>
|
||||
|
||||
typedef struct _VSImage VSImage;
|
||||
|
||||
struct _VSImage {
|
||||
uint8_t *real_pixels;
|
||||
int real_width;
|
||||
int real_height;
|
||||
int border_left, border_right;
|
||||
int border_top, border_bottom;
|
||||
uint8_t *pixels;
|
||||
int width;
|
||||
int height;
|
||||
gsize stride;
|
||||
};
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_RGBA (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_RGBA (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_lanczos_AYUV (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf,
|
||||
double sharpness,
|
||||
gboolean dither,
|
||||
int submethod,
|
||||
double a,
|
||||
double sharpen);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_lanczos_AYUV64 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf,
|
||||
double sharpness,
|
||||
gboolean dither,
|
||||
int submethod,
|
||||
double a,
|
||||
double sharpen);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_RGB (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_RGB (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_YUYV (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_YUYV (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_UYVY (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_UYVY (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_NV12 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_NV12 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_Y (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_Y (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_lanczos_Y (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf,
|
||||
double sharpness,
|
||||
gboolean dither,
|
||||
int submethod,
|
||||
double a,
|
||||
double sharpen);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_lanczos_NV (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf,
|
||||
double sharpness,
|
||||
gboolean dither,
|
||||
int submethod,
|
||||
double a,
|
||||
double sharpen);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_RGB565 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_RGB565 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_RGB555 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_RGB555 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_Y16 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_Y16 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_AYUV16 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_AYUV16 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_nearest_AYUV64 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf8);
|
||||
|
||||
G_GNUC_INTERNAL void vs_image_scale_linear_AYUV64 (const VSImage * dest,
|
||||
const VSImage * src,
|
||||
uint8_t * tmpbuf8);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,778 +0,0 @@
|
|||
/*
|
||||
* Image Scaling Functions
|
||||
* Copyright (c) 2005 David A. Schleef <ds@schleef.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "vs_scanline.h"
|
||||
|
||||
#include "gstvideoscaleorc.h"
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* greyscale, i.e., single componenet */
|
||||
|
||||
#define BLEND(a,b,x) (((a) * (65536 - (x)) + (b) * (x)) >> 16)
|
||||
#define BLEND15(a,b,x) (((a) * (32768 - (x)) + (b) * (x)) >> 15)
|
||||
|
||||
void
|
||||
vs_scanline_downsample_Y (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
video_scale_orc_downsample_u8 (dest, src, n);
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_Y (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
video_scale_orc_resample_nearest_u8 (dest, src, *accumulator, increment, n);
|
||||
|
||||
*accumulator += n * increment;
|
||||
}
|
||||
|
||||
#include <glib.h>
|
||||
void
|
||||
vs_scanline_resample_linear_Y (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
video_scale_orc_resample_bilinear_u8 (dest, src, *accumulator, increment, n);
|
||||
|
||||
*accumulator += n * increment;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_Y (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
int n, int x)
|
||||
{
|
||||
uint32_t value = x >> 8;
|
||||
|
||||
if (value == 0) {
|
||||
memcpy (dest, src1, n);
|
||||
} else {
|
||||
video_scale_orc_merge_linear_u8 (dest, src1, src2, value, n);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_downsample_Y16 (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
video_scale_orc_downsample_u16 ((uint16_t *) dest, (uint16_t *) src, n);
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_Y16 (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
int i, j;
|
||||
uint16_t *d = (uint16_t *) dest, *s = (uint16_t *) src;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = (acc + 0x8000) >> 16;
|
||||
d[i] = s[j];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_Y16 (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
int x;
|
||||
uint16_t *d = (uint16_t *) dest, *s = (uint16_t *) src;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = acc >> 16;
|
||||
|
||||
if (j + 1 < src_width) {
|
||||
x = acc & 0xffff;
|
||||
d[i] = BLEND (s[j], s[j + 1], x);
|
||||
} else
|
||||
d[i] = s[j];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_Y16 (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
int n, int x)
|
||||
{
|
||||
uint16_t *d = (uint16_t *) dest;
|
||||
const uint16_t *s1 = (const uint16_t *) src1;
|
||||
const uint16_t *s2 = (const uint16_t *) src2;
|
||||
|
||||
if (x == 0) {
|
||||
memcpy (d, s1, n * 2);
|
||||
} else {
|
||||
video_scale_orc_merge_linear_u16 (d, s1, s2, 65536 - x, x, n);
|
||||
}
|
||||
}
|
||||
|
||||
/* RGBA */
|
||||
|
||||
void
|
||||
vs_scanline_downsample_RGBA (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
video_scale_orc_downsample_u32 (dest, src, n);
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_RGBA (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
video_scale_orc_resample_nearest_u32 (dest, src, *accumulator, increment, n);
|
||||
|
||||
*accumulator += n * increment;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_RGBA (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
video_scale_orc_resample_bilinear_u32 (dest, src, *accumulator, increment, n);
|
||||
|
||||
*accumulator += n * increment;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_RGBA (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
int n, int x)
|
||||
{
|
||||
uint32_t value = x >> 8;
|
||||
|
||||
if (value == 0) {
|
||||
memcpy (dest, src1, n * 4);
|
||||
} else {
|
||||
video_scale_orc_merge_linear_u8 (dest, src1, src2, value, n * 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* RGB */
|
||||
|
||||
void
|
||||
vs_scanline_downsample_RGB (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i * 3 + 0] = (src[i * 6 + 0] + src[i * 6 + 3]) / 2;
|
||||
dest[i * 3 + 1] = (src[i * 6 + 1] + src[i * 6 + 4]) / 2;
|
||||
dest[i * 3 + 2] = (src[i * 6 + 2] + src[i * 6 + 5]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_RGB (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = (acc + 0x8000) >> 16;
|
||||
|
||||
dest[i * 3 + 0] = src[j * 3 + 0];
|
||||
dest[i * 3 + 1] = src[j * 3 + 1];
|
||||
dest[i * 3 + 2] = src[j * 3 + 2];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_RGB (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
int x;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = acc >> 16;
|
||||
|
||||
if (j + 1 < src_width) {
|
||||
x = acc & 0xffff;
|
||||
dest[i * 3 + 0] = BLEND (src[j * 3 + 0], src[j * 3 + 3], x);
|
||||
dest[i * 3 + 1] = BLEND (src[j * 3 + 1], src[j * 3 + 4], x);
|
||||
dest[i * 3 + 2] = BLEND (src[j * 3 + 2], src[j * 3 + 5], x);
|
||||
} else {
|
||||
dest[i * 3 + 0] = src[j * 3 + 0];
|
||||
dest[i * 3 + 1] = src[j * 3 + 1];
|
||||
dest[i * 3 + 2] = src[j * 3 + 2];
|
||||
}
|
||||
acc += increment;
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_RGB (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
int n, int x)
|
||||
{
|
||||
uint32_t value = x >> 8;
|
||||
|
||||
if (value == 0) {
|
||||
memcpy (dest, src1, n * 3);
|
||||
} else {
|
||||
video_scale_orc_merge_linear_u8 (dest, src1, src2, value, n * 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* YUYV */
|
||||
|
||||
/* n is the number of pixels */
|
||||
/* increment is per Y pixel */
|
||||
|
||||
void
|
||||
vs_scanline_downsample_YUYV (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
video_scale_orc_downsample_yuyv (dest, src, n);
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_YUYV (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < n; i += 2) {
|
||||
j = (acc + 0x8000) >> 16;
|
||||
dest[i * 2 + 0] = src[j * 2 + 0];
|
||||
|
||||
j >>= 1;
|
||||
dest[i * 2 + 1] = src[j * 4 + 1];
|
||||
dest[i * 2 + 3] = src[j * 4 + 3];
|
||||
|
||||
acc += increment;
|
||||
|
||||
if (i < n - 1) {
|
||||
j = (acc + 0x8000) >> 16;
|
||||
dest[i * 2 + 2] = src[j * 2 + 0];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_YUYV (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
int i, j, x;
|
||||
|
||||
for (i = 0; i < n; i += 2) {
|
||||
j = acc >> 16;
|
||||
x = acc & 0xffff;
|
||||
|
||||
if (j + 1 < src_width)
|
||||
dest[i * 2 + 0] = BLEND (src[j * 2 + 0], src[j * 2 + 2], x);
|
||||
else
|
||||
dest[i * 2 + 0] = src[j * 2 + 0];
|
||||
|
||||
j >>= 1;
|
||||
if (2 * (j + 1) < src_width) {
|
||||
dest[i * 2 + 1] = BLEND (src[j * 4 + 1], src[j * 4 + 5], x);
|
||||
dest[i * 2 + 3] = BLEND (src[j * 4 + 3], src[j * 4 + 7], x);
|
||||
} else {
|
||||
dest[i * 2 + 1] = src[j * 4 + 1];
|
||||
dest[i * 2 + 3] = src[j * 4 + 3];
|
||||
}
|
||||
|
||||
acc += increment;
|
||||
|
||||
if (i < n - 1) {
|
||||
j = acc >> 16;
|
||||
|
||||
if (j + 1 < src_width) {
|
||||
x = acc & 0xffff;
|
||||
dest[i * 2 + 2] = BLEND (src[j * 2 + 0], src[j * 2 + 2], x);
|
||||
} else
|
||||
dest[i * 2 + 2] = src[j * 2 + 0];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
}
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_YUYV (uint8_t * dest, uint8_t * src1, uint8_t * src2,
|
||||
int n, int x)
|
||||
{
|
||||
int quads = (n + 1) / 2;
|
||||
uint32_t value = x >> 8;
|
||||
|
||||
if (value == 0) {
|
||||
memcpy (dest, src1, quads * 4);
|
||||
} else {
|
||||
video_scale_orc_merge_linear_u8 (dest, src1, src2, value, quads * 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* UYVY */
|
||||
|
||||
/* n is the number of bi-pixels */
|
||||
/* increment is per Y pixel */
|
||||
|
||||
void
|
||||
vs_scanline_downsample_UYVY (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i * 4 + 0] = (src[i * 8 + 0] + src[i * 8 + 4]) / 2;
|
||||
dest[i * 4 + 1] = (src[i * 8 + 1] + src[i * 8 + 3]) / 2;
|
||||
dest[i * 4 + 2] = (src[i * 8 + 2] + src[i * 8 + 6]) / 2;
|
||||
dest[i * 4 + 3] = (src[i * 8 + 5] + src[i * 8 + 7]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_UYVY (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < n; i += 2) {
|
||||
j = (acc + 0x8000) >> 16;
|
||||
dest[i * 2 + 1] = src[j * 2 + 1];
|
||||
|
||||
j >>= 1;
|
||||
dest[i * 2 + 0] = src[j * 4 + 0];
|
||||
dest[i * 2 + 2] = src[j * 4 + 2];
|
||||
|
||||
acc += increment;
|
||||
|
||||
if (i < n - 1) {
|
||||
j = (acc + 0x8000) >> 16;
|
||||
dest[i * 2 + 3] = src[j * 2 + 1];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_UYVY (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
int i, j, x;
|
||||
|
||||
for (i = 0; i < n; i += 2) {
|
||||
j = acc >> 16;
|
||||
x = acc & 0xffff;
|
||||
|
||||
if (j + 1 < src_width)
|
||||
dest[i * 2 + 1] = BLEND (src[j * 2 + 1], src[j * 2 + 3], x);
|
||||
else
|
||||
dest[i * 2 + 1] = src[j * 2 + 1];
|
||||
|
||||
j >>= 1;
|
||||
if (2 * (j + 1) < src_width) {
|
||||
dest[i * 2 + 0] = BLEND (src[j * 4 + 0], src[j * 4 + 4], x);
|
||||
dest[i * 2 + 2] = BLEND (src[j * 4 + 2], src[j * 4 + 6], x);
|
||||
} else {
|
||||
dest[i * 2 + 0] = src[j * 4 + 0];
|
||||
dest[i * 2 + 2] = src[j * 4 + 2];
|
||||
}
|
||||
|
||||
acc += increment;
|
||||
|
||||
if (i < n - 1) {
|
||||
j = acc >> 16;
|
||||
|
||||
if (j + 1 < src_width) {
|
||||
x = acc & 0xffff;
|
||||
dest[i * 2 + 3] = BLEND (src[j * 2 + 1], src[j * 2 + 3], x);
|
||||
} else
|
||||
dest[i * 2 + 3] = src[j * 2 + 1];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_UYVY (uint8_t * dest, uint8_t * src1,
|
||||
uint8_t * src2, int n, int x)
|
||||
{
|
||||
int quads = (n + 1) / 2;
|
||||
uint32_t value = x >> 8;
|
||||
|
||||
if (value == 0) {
|
||||
memcpy (dest, src1, quads * 4);
|
||||
} else {
|
||||
video_scale_orc_merge_linear_u8 (dest, src1, src2, value, quads * 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* NV12 */
|
||||
|
||||
/* n is the number of bi-pixels */
|
||||
|
||||
void
|
||||
vs_scanline_downsample_NV12 (uint8_t * dest, uint8_t * src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i * 2 + 0] = (src[i * 4 + 0] + src[i * 4 + 2]) / 2;
|
||||
dest[i * 2 + 1] = (src[i * 4 + 1] + src[i * 4 + 3]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_NV12 (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = (acc + 0x8000) >> 16;
|
||||
|
||||
dest[i * 2 + 0] = src[j * 2 + 0];
|
||||
dest[i * 2 + 1] = src[j * 2 + 1];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_NV12 (uint8_t * dest, uint8_t * src, int src_width,
|
||||
int n, int *accumulator, int increment)
|
||||
{
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
int x;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = acc >> 16;
|
||||
|
||||
if (j + 1 < src_width) {
|
||||
x = acc & 0xffff;
|
||||
dest[i * 2 + 0] = BLEND (src[j * 2 + 0], src[j * 2 + 2], x);
|
||||
dest[i * 2 + 1] = BLEND (src[j * 2 + 1], src[j * 2 + 3], x);
|
||||
} else {
|
||||
dest[i * 2 + 0] = src[j * 2 + 0];
|
||||
dest[i * 2 + 1] = src[j * 2 + 1];
|
||||
}
|
||||
acc += increment;
|
||||
}
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_NV12 (uint8_t * dest, uint8_t * src1,
|
||||
uint8_t * src2, int n, int x)
|
||||
{
|
||||
uint32_t value = x >> 8;
|
||||
|
||||
if (value == 0) {
|
||||
memcpy (dest, src1, n * 2);
|
||||
} else {
|
||||
video_scale_orc_merge_linear_u8 (dest, src1, src2, value, n * 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* RGB565 */
|
||||
|
||||
/* note that src and dest are uint16_t, and thus endian dependent */
|
||||
|
||||
#define RGB565_R(x) (((x)&0xf800)>>8 | ((x)&0xf800)>>13)
|
||||
#define RGB565_G(x) (((x)&0x07e0)>>3 | ((x)&0x07e0)>>9)
|
||||
#define RGB565_B(x) (((x)&0x001f)<<3 | ((x)&0x001f)>>2)
|
||||
|
||||
#define RGB565(r,g,b) \
|
||||
((((r)<<8)&0xf800) | (((g)<<3)&0x07e0) | (((b)>>3)&0x001f))
|
||||
|
||||
|
||||
void
|
||||
vs_scanline_downsample_RGB565 (uint8_t * dest_u8, uint8_t * src_u8, int n)
|
||||
{
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i] = RGB565 (
|
||||
(RGB565_R (src[i * 2]) + RGB565_R (src[i * 2 + 1])) / 2,
|
||||
(RGB565_G (src[i * 2]) + RGB565_G (src[i * 2 + 1])) / 2,
|
||||
(RGB565_B (src[i * 2]) + RGB565_B (src[i * 2 + 1])) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
|
||||
int src_width, int n, int *accumulator, int increment)
|
||||
{
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int acc = *accumulator;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = (acc + 0x8000) >> 16;
|
||||
dest[i] = src[j];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
|
||||
int src_width, int n, int *accumulator, int increment)
|
||||
{
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
int x;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = acc >> 16;
|
||||
|
||||
if (j + 1 < src_width) {
|
||||
x = acc & 0xffff;
|
||||
dest[i] = RGB565 (BLEND (RGB565_R (src[j]), RGB565_R (src[j + 1]), x),
|
||||
BLEND (RGB565_G (src[j]), RGB565_G (src[j + 1]), x),
|
||||
BLEND (RGB565_B (src[j]), RGB565_B (src[j + 1]), x));
|
||||
} else {
|
||||
dest[i] = RGB565 (RGB565_R (src[j]),
|
||||
RGB565_G (src[j]), RGB565_B (src[j]));
|
||||
}
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_RGB565 (uint8_t * dest_u8, uint8_t * src1_u8,
|
||||
uint8_t * src2_u8, int n, int x)
|
||||
{
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src1 = (uint16_t *) src1_u8;
|
||||
uint16_t *src2 = (uint16_t *) src2_u8;
|
||||
int i;
|
||||
|
||||
if (x == 0) {
|
||||
memcpy (dest, src1, n * 2);
|
||||
} else {
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i] = RGB565 (BLEND (RGB565_R (src1[i]), RGB565_R (src2[i]), x),
|
||||
BLEND (RGB565_G (src1[i]), RGB565_G (src2[i]), x),
|
||||
BLEND (RGB565_B (src1[i]), RGB565_B (src2[i]), x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* RGB555 */
|
||||
|
||||
/* note that src and dest are uint16_t, and thus endian dependent */
|
||||
|
||||
#define RGB555_R(x) (((x)&0x7c00)>>7 | ((x)&0x7c00)>>12)
|
||||
#define RGB555_G(x) (((x)&0x03e0)>>2 | ((x)&0x03e0)>>7)
|
||||
#define RGB555_B(x) (((x)&0x001f)<<3 | ((x)&0x001f)>>2)
|
||||
|
||||
#define RGB555(r,g,b) \
|
||||
((((r)<<7)&0x7c00) | (((g)<<2)&0x03e0) | (((b)>>3)&0x001f))
|
||||
|
||||
void
|
||||
vs_scanline_downsample_RGB555 (uint8_t * dest_u8, uint8_t * src_u8, int n)
|
||||
{
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i] = RGB555 (
|
||||
(RGB555_R (src[i * 2]) + RGB555_R (src[i * 2 + 1])) / 2,
|
||||
(RGB555_G (src[i * 2]) + RGB555_G (src[i * 2 + 1])) / 2,
|
||||
(RGB555_B (src[i * 2]) + RGB555_B (src[i * 2 + 1])) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
|
||||
int src_width, int n, int *accumulator, int increment)
|
||||
{
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int acc = *accumulator;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = (acc + 0x8000) >> 16;
|
||||
|
||||
dest[i] = src[j];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
|
||||
int src_width, int n, int *accumulator, int increment)
|
||||
{
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src = (uint16_t *) src_u8;
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
int x;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = acc >> 16;
|
||||
|
||||
if (j + 1 < src_width) {
|
||||
x = acc & 0xffff;
|
||||
dest[i] = RGB555 (BLEND (RGB555_R (src[j]), RGB555_R (src[j + 1]), x),
|
||||
BLEND (RGB555_G (src[j]), RGB555_G (src[j + 1]), x),
|
||||
BLEND (RGB555_B (src[j]), RGB555_B (src[j + 1]), x));
|
||||
} else {
|
||||
dest[i] = RGB555 (RGB555_R (src[j]),
|
||||
RGB555_G (src[j]), RGB555_B (src[j]));
|
||||
}
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_merge_linear_RGB555 (uint8_t * dest_u8, uint8_t * src1_u8,
|
||||
uint8_t * src2_u8, int n, int x)
|
||||
{
|
||||
uint16_t *dest = (uint16_t *) dest_u8;
|
||||
uint16_t *src1 = (uint16_t *) src1_u8;
|
||||
uint16_t *src2 = (uint16_t *) src2_u8;
|
||||
int i;
|
||||
|
||||
if (x == 0) {
|
||||
memcpy (dest, src1, n * 2);
|
||||
} else {
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i] = RGB555 (BLEND (RGB555_R (src1[i]), RGB555_R (src2[i]), x),
|
||||
BLEND (RGB555_G (src1[i]), RGB555_G (src2[i]), x),
|
||||
BLEND (RGB555_B (src1[i]), RGB555_B (src2[i]), x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_nearest_AYUV64 (uint8_t * dest8, uint8_t * src8,
|
||||
int src_width, int n, int *accumulator, int increment)
|
||||
{
|
||||
guint16 *dest = (guint16 *) dest8;
|
||||
guint16 *src = (guint16 *) src8;
|
||||
int acc = *accumulator;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = (acc + 0x8000) >> 16;
|
||||
|
||||
dest[i * 4 + 0] = src[j * 4 + 0];
|
||||
dest[i * 4 + 1] = src[j * 4 + 1];
|
||||
dest[i * 4 + 2] = src[j * 4 + 2];
|
||||
dest[i * 4 + 3] = src[j * 4 + 3];
|
||||
|
||||
acc += increment;
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
||||
|
||||
void
|
||||
vs_scanline_resample_linear_AYUV64 (uint8_t * dest8, uint8_t * src8,
|
||||
int src_width, int n, int *accumulator, int increment)
|
||||
{
|
||||
guint16 *dest = (guint16 *) dest8;
|
||||
guint16 *src = (guint16 *) src8;
|
||||
int acc = *accumulator;
|
||||
int i;
|
||||
int j;
|
||||
int x;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
j = acc >> 16;
|
||||
x = (acc & 0xffff) >> 1;
|
||||
|
||||
if (j + 1 < src_width) {
|
||||
dest[i * 4 + 0] = BLEND15 (src[j * 4 + 0], src[j * 4 + 4], x);
|
||||
dest[i * 4 + 1] = BLEND15 (src[j * 4 + 1], src[j * 4 + 5], x);
|
||||
dest[i * 4 + 2] = BLEND15 (src[j * 4 + 2], src[j * 4 + 6], x);
|
||||
dest[i * 4 + 3] = BLEND15 (src[j * 4 + 3], src[j * 4 + 7], x);
|
||||
} else {
|
||||
dest[i * 4 + 0] = src[j * 4 + 0];
|
||||
dest[i * 4 + 1] = src[j * 4 + 1];
|
||||
dest[i * 4 + 2] = src[j * 4 + 2];
|
||||
dest[i * 4 + 3] = src[j * 4 + 3];
|
||||
}
|
||||
acc += increment;
|
||||
}
|
||||
|
||||
*accumulator = acc;
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* Image Scaling Functions
|
||||
* Copyright (c) 2005 David A. Schleef <ds@schleef.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __VS_SCANLINE_H__
|
||||
#define __VS_SCANLINE_H__
|
||||
|
||||
#include <_stdint.h>
|
||||
#include <glib.h>
|
||||
|
||||
G_GNUC_INTERNAL void vs_scanline_downsample_Y (uint8_t *dest, uint8_t *src, int n);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_nearest_Y (uint8_t *dest, uint8_t *src, int n, int src_width, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_linear_Y (uint8_t *dest, uint8_t *src, int n, int src_width, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_merge_linear_Y (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
G_GNUC_INTERNAL void vs_scanline_downsample_RGBA (uint8_t *dest, uint8_t *src, int n);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_nearest_RGBA (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_linear_RGBA (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_merge_linear_RGBA (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
G_GNUC_INTERNAL void vs_scanline_downsample_RGB (uint8_t *dest, uint8_t *src, int n);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_nearest_RGB (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_linear_RGB (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_merge_linear_RGB (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
G_GNUC_INTERNAL void vs_scanline_downsample_YUYV (uint8_t *dest, uint8_t *src, int n);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_nearest_YUYV (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_linear_YUYV (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_merge_linear_YUYV (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
G_GNUC_INTERNAL void vs_scanline_downsample_UYVY (uint8_t *dest, uint8_t *src, int n);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_nearest_UYVY (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_linear_UYVY (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_merge_linear_UYVY (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
G_GNUC_INTERNAL void vs_scanline_downsample_NV12 (uint8_t *dest, uint8_t *src, int n);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_nearest_NV12 (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_linear_NV12 (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_merge_linear_NV12 (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
G_GNUC_INTERNAL void vs_scanline_downsample_RGB565 (uint8_t *dest, uint8_t *src, int n);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_nearest_RGB565 (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_linear_RGB565 (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_merge_linear_RGB565 (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
G_GNUC_INTERNAL void vs_scanline_downsample_RGB555 (uint8_t *dest, uint8_t *src, int n);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_nearest_RGB555 (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_linear_RGB555 (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_merge_linear_RGB555 (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
G_GNUC_INTERNAL void vs_scanline_downsample_Y16 (uint8_t *dest, uint8_t *src, int n);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_nearest_Y16 (uint8_t *dest, uint8_t *src, int n, int src_width, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_linear_Y16 (uint8_t *dest, uint8_t *src, int n, int src_width, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_merge_linear_Y16 (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
|
||||
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_nearest_AYUV64 (uint8_t * dest, uint8_t * src,
|
||||
int src_width, int n, int *accumulator, int increment);
|
||||
G_GNUC_INTERNAL void vs_scanline_resample_linear_AYUV64 (uint8_t * dest, uint8_t * src,
|
||||
int src_width, int n, int *accumulator, int increment);
|
||||
|
||||
#endif
|
||||
|
|
@ -140,7 +140,7 @@ check_adder =
|
|||
endif
|
||||
|
||||
if HAVE_ORC
|
||||
check_orc = orc/video orc/audio orc/adder orc/audioconvert orc/volume orc/videoscale orc/videotestsrc
|
||||
check_orc = orc/video orc/audio orc/adder orc/audioconvert orc/volume orc/videotestsrc
|
||||
else
|
||||
check_orc =
|
||||
endif
|
||||
|
@ -230,7 +230,6 @@ check_PROGRAMS = \
|
|||
$(check_typefind) \
|
||||
$(check_videoconvert) \
|
||||
$(check_videorate) \
|
||||
$(check_videoscale) \
|
||||
$(check_videotestsrc) \
|
||||
$(check_volume) \
|
||||
$(check_vorbis) \
|
||||
|
@ -640,9 +639,6 @@ nodist_orc_audioconvert_SOURCES = orc/audioconvert.c
|
|||
orc_volume_CFLAGS = $(ORC_CFLAGS)
|
||||
orc_volume_LDADD = $(ORC_LIBS) -lorc-test-0.4
|
||||
nodist_orc_volume_SOURCES = orc/volume.c
|
||||
orc_videoscale_CFLAGS = $(ORC_CFLAGS)
|
||||
orc_videoscale_LDADD = $(ORC_LIBS) -lorc-test-0.4
|
||||
nodist_orc_videoscale_SOURCES = orc/videoscale.c
|
||||
orc_videotestsrc_CFLAGS = $(ORC_CFLAGS)
|
||||
orc_videotestsrc_LDADD = $(ORC_LIBS) -lorc-test-0.4
|
||||
nodist_orc_videotestsrc_SOURCES = orc/videotestsrc.c
|
||||
|
@ -667,10 +663,6 @@ orc/volume.c: $(top_srcdir)/gst/volume/gstvolumeorc.orc
|
|||
$(MKDIR_P) orc/
|
||||
$(ORCC) --test -o $@ $<
|
||||
|
||||
orc/videoscale.c: $(top_srcdir)/gst/videoscale/gstvideoscaleorc.orc
|
||||
$(MKDIR_P) orc/
|
||||
$(ORCC) --test -o $@ $<
|
||||
|
||||
orc/videotestsrc.c: $(top_srcdir)/gst/videotestsrc/gstvideotestsrcorc.orc
|
||||
$(MKDIR_P) orc/
|
||||
$(ORCC) --test -o $@ $<
|
||||
|
|
Loading…
Reference in a new issue