mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
videoscale: Fix linear scaling for one byte components
Fixes bug #577054.
This commit is contained in:
parent
954b1713e1
commit
ab7d52c053
1 changed files with 15 additions and 13 deletions
|
@ -61,27 +61,29 @@ vs_scanline_resample_nearest_Y (uint8_t * dest, uint8_t * src, int src_width,
|
||||||
*accumulator = acc;
|
*accumulator = acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
void
|
void
|
||||||
vs_scanline_resample_linear_Y (uint8_t * dest, uint8_t * src, int src_width,
|
vs_scanline_resample_linear_Y (uint8_t * dest, uint8_t * src, int src_width,
|
||||||
int n, int *accumulator, int increment)
|
int n, int *accumulator, int increment)
|
||||||
{
|
{
|
||||||
uint32_t vals[2];
|
int acc = *accumulator;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int x;
|
||||||
|
|
||||||
vals[0] = *accumulator;
|
for (i = 0; i < n; i++) {
|
||||||
vals[1] = increment;
|
j = acc >> 16;
|
||||||
|
x = acc & 0xffff;
|
||||||
|
|
||||||
if (src_width % 2 == 0) {
|
if (j + 1 < src_width)
|
||||||
oil_resample_linear_u8 (dest, src, n, vals);
|
dest[i] = (src[j] * (65536 - x) + src[j + 1] * x) >> 16;
|
||||||
} else if (src_width > 1) {
|
else
|
||||||
if (n > 1)
|
dest[i] = src[j];
|
||||||
oil_resample_linear_u8 (dest, src, n - 1, vals);
|
|
||||||
dest[n - 1] = src[vals[0] >> 16];
|
acc += increment;
|
||||||
vals[0] += increment;
|
|
||||||
} else {
|
|
||||||
oil_splat_u8 (dest, 1, &src[0], n);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*accumulator = vals[0];
|
*accumulator = acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue