mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
video-scaler: add support for copy
When no scalers are given, simply do a copy of the requested area.
This commit is contained in:
parent
3046935e03
commit
330fb44a6f
1 changed files with 29 additions and 12 deletions
|
@ -1353,18 +1353,18 @@ no_func:
|
||||||
* @src: source pixels
|
* @src: source pixels
|
||||||
* @src_stride: source pixels stride
|
* @src_stride: source pixels stride
|
||||||
* @dest: destination pixels
|
* @dest: destination pixels
|
||||||
* @dest_stride: sinationource pixels stride
|
* @dest_stride: destination pixels stride
|
||||||
* @x: the horizontal destination offset
|
* @x: the horizontal destination offset
|
||||||
* @y: the vertical destination offset
|
* @y: the vertical destination offset
|
||||||
* @width: the number of pixels to scale
|
* @width: the number of output pixels to scale
|
||||||
* @height: the number of lines to scale
|
* @height: the number of output lines to scale
|
||||||
*
|
*
|
||||||
* Scale a rectangle of pixels in @src with @src_stride to @dest with
|
* Scale a rectangle of pixels in @src with @src_stride to @dest with
|
||||||
* @dest_stride using the horizontal scaler @hscaler and the vertical
|
* @dest_stride using the horizontal scaler @hscaler and the vertical
|
||||||
* scaler @vscale.
|
* scaler @vscale.
|
||||||
*
|
*
|
||||||
* One of @hscale and @vscale can be NULL to only perform scaling in
|
* One or both of @hscale and @vscale can be NULL to only perform scaling in
|
||||||
* one dimension.
|
* one dimension or do a copy without scaling.
|
||||||
*
|
*
|
||||||
* @x and @y are the coordinates in the destination image to process.
|
* @x and @y are the coordinates in the destination image to process.
|
||||||
*/
|
*/
|
||||||
|
@ -1379,7 +1379,6 @@ gst_video_scaler_2d (GstVideoScaler * hscale, GstVideoScaler * vscale,
|
||||||
GstVideoScalerVFunc vfunc;
|
GstVideoScalerVFunc vfunc;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
g_return_if_fail (hscale != NULL || vscale != NULL);
|
|
||||||
g_return_if_fail (src != NULL);
|
g_return_if_fail (src != NULL);
|
||||||
g_return_if_fail (dest != NULL);
|
g_return_if_fail (dest != NULL);
|
||||||
|
|
||||||
|
@ -1392,13 +1391,31 @@ gst_video_scaler_2d (GstVideoScaler * hscale, GstVideoScaler * vscale,
|
||||||
#define TMP_LINE(s,i,v) ((guint8 *)(s->tmpline1) + (((i) % (v)) * (sizeof (gint32) * width * n_elems)))
|
#define TMP_LINE(s,i,v) ((guint8 *)(s->tmpline1) + (((i) % (v)) * (sizeof (gint32) * width * n_elems)))
|
||||||
|
|
||||||
if (vscale == NULL) {
|
if (vscale == NULL) {
|
||||||
if (hscale->tmpwidth < width)
|
if (hscale == NULL) {
|
||||||
realloc_tmplines (hscale, n_elems, width);
|
guint xo, xw;
|
||||||
|
guint8 *s, *d;
|
||||||
|
|
||||||
/* only horizontal scaling */
|
xo = x * n_elems;
|
||||||
for (i = y; i < height; i++) {
|
xw = width * n_elems;
|
||||||
hfunc (hscale, LINE (src, src_stride, i), LINE (dest, dest_stride, i),
|
|
||||||
x, width, n_elems);
|
s = LINE (src, src_stride, y) + xo;
|
||||||
|
d = LINE (dest, dest_stride, y) + xo;
|
||||||
|
|
||||||
|
/* no scaling, do memcpy */
|
||||||
|
for (i = y; i < height; i++) {
|
||||||
|
memcpy (d, s, xw);
|
||||||
|
d += dest_stride;
|
||||||
|
s += src_stride;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (hscale->tmpwidth < width)
|
||||||
|
realloc_tmplines (hscale, n_elems, width);
|
||||||
|
|
||||||
|
/* only horizontal scaling */
|
||||||
|
for (i = y; i < height; i++) {
|
||||||
|
hfunc (hscale, LINE (src, src_stride, i), LINE (dest, dest_stride, i),
|
||||||
|
x, width, n_elems);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
guint v_taps;
|
guint v_taps;
|
||||||
|
|
Loading…
Reference in a new issue