aboutsummaryrefslogtreecommitdiff
path: root/gst/videoscale/vs_4tap.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/videoscale/vs_4tap.c')
-rw-r--r--gst/videoscale/vs_4tap.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/gst/videoscale/vs_4tap.c b/gst/videoscale/vs_4tap.c
index b770d8f..7097ad7 100644
--- a/gst/videoscale/vs_4tap.c
+++ b/gst/videoscale/vs_4tap.c
@@ -147,7 +147,7 @@ vs_scanline_resample_4tap_Y (uint8_t * dest, uint8_t * src,
j = acc >> 16;
x = (acc & 0xff00) >> 8;
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j - 1, 0)];
+ y = vs_4tap_taps[x][0] * src[j - 1];
y += vs_4tap_taps[x][1] * src[j];
y += vs_4tap_taps[x][2] * src[j + 1];
y += vs_4tap_taps[x][3] * src[j + 2];
@@ -261,7 +261,7 @@ vs_scanline_resample_4tap_Y16 (uint8_t * dest, uint8_t * src,
j = acc >> 16;
x = (acc & 0xff00) >> 8;
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * s[MAX (j - 1, 0)];
+ y = vs_4tap_taps[x][0] * s[j - 1];
y += vs_4tap_taps[x][1] * s[j];
y += vs_4tap_taps[x][2] * s[j + 1];
y += vs_4tap_taps[x][3] * s[j + 2];
@@ -380,7 +380,7 @@ vs_scanline_resample_4tap_RGBA (uint8_t * dest, uint8_t * src,
for (off = 0; off < 4; off++) {
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX ((j - 1) * 4 + off, 0)];
+ y = vs_4tap_taps[x][0] * src[(j - 1) * 4 + off];
y += vs_4tap_taps[x][1] * src[j * 4 + off];
y += vs_4tap_taps[x][2] * src[(j + 1) * 4 + off];
y += vs_4tap_taps[x][3] * src[(j + 2) * 4 + off];
@@ -503,7 +503,7 @@ vs_scanline_resample_4tap_RGB (uint8_t * dest, uint8_t * src,
for (off = 0; off < 3; off++) {
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX ((j - 1) * 3 + off, 0)];
+ y = vs_4tap_taps[x][0] * src[(j - 1) * 3 + off];
y += vs_4tap_taps[x][1] * src[j * 3 + off];
y += vs_4tap_taps[x][2] * src[(j + 1) * 3 + off];
y += vs_4tap_taps[x][3] * src[(j + 2) * 3 + off];
@@ -632,7 +632,7 @@ vs_scanline_resample_4tap_YUYV (uint8_t * dest, uint8_t * src,
x = (acc & 0xffff) >> 8;
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j * 2 + 0 - 2, 0)];
+ y = vs_4tap_taps[x][0] * src[j * 2 + 0 - 2];
y += vs_4tap_taps[x][1] * src[j * 2 + 0];
y += vs_4tap_taps[x][2] * src[j * 2 + 0 + 2];
y += vs_4tap_taps[x][3] * src[j * 2 + 0 + 4];
@@ -684,7 +684,7 @@ vs_scanline_resample_4tap_YUYV (uint8_t * dest, uint8_t * src,
if (2 * i + 1 < n) {
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j * 2 + 0 - 2, 0)];
+ y = vs_4tap_taps[x][0] * src[j * 2 + 0 - 2];
y += vs_4tap_taps[x][1] * src[j * 2 + 0];
y += vs_4tap_taps[x][2] * src[j * 2 + 0 + 2];
y += vs_4tap_taps[x][3] * src[j * 2 + 0 + 4];
@@ -1028,10 +1028,10 @@ vs_scanline_resample_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
acc = *xacc;
for (i = 0; i < n; i++) {
j = acc >> 16;
- x = acc & 0xffff >> 8;
+ x = (acc & 0xffff) >> 8;
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB565_R (src[MAX ((j - 1), 0)]);
+ y = vs_4tap_taps[x][0] * RGB565_R (src[(j - 1)]);
y += vs_4tap_taps[x][1] * RGB565_R (src[j]);
y += vs_4tap_taps[x][2] * RGB565_R (src[(j + 1)]);
y += vs_4tap_taps[x][3] * RGB565_R (src[(j + 2)]);
@@ -1048,7 +1048,7 @@ vs_scanline_resample_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
y_r = CLAMP (y >> SHIFT, 0, 255);
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB565_G (src[MAX ((j - 1), 0)]);
+ y = vs_4tap_taps[x][0] * RGB565_G (src[(j - 1)]);
y += vs_4tap_taps[x][1] * RGB565_G (src[j]);
y += vs_4tap_taps[x][2] * RGB565_G (src[(j + 1)]);
y += vs_4tap_taps[x][3] * RGB565_G (src[(j + 2)]);
@@ -1065,7 +1065,7 @@ vs_scanline_resample_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
y_g = CLAMP (y >> SHIFT, 0, 255);
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB565_B (src[MAX ((j - 1), 0)]);
+ y = vs_4tap_taps[x][0] * RGB565_B (src[(j - 1)]);
y += vs_4tap_taps[x][1] * RGB565_B (src[j]);
y += vs_4tap_taps[x][2] * RGB565_B (src[(j + 1)]);
y += vs_4tap_taps[x][3] * RGB565_B (src[(j + 2)]);
@@ -1081,7 +1081,7 @@ vs_scanline_resample_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
y += (1 << (SHIFT - 1));
y_b = CLAMP (y >> SHIFT, 0, 255);
- dest[i] = RGB565 (y_r, y_b, y_g);
+ dest[i] = RGB565 (y_r, y_g, y_b);
acc += increment;
}
*xacc = acc;
@@ -1128,7 +1128,7 @@ vs_scanline_merge_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src1_u8,
y += (1 << (SHIFT - 1));
y_b = CLAMP (y >> SHIFT, 0, 255);
- dest[i] = RGB565 (y_r, y_b, y_g);
+ dest[i] = RGB565 (y_r, y_g, y_b);
}
}
@@ -1191,8 +1191,8 @@ vs_image_scale_4tap_RGB565 (const VSImage * dest, const VSImage * src,
/* note that src and dest are uint16_t, and thus endian dependent */
-#define RGB555_R(x) (((x)&0x7c00)>>8 | ((x)&0x7c00)>>13)
-#define RGB555_G(x) (((x)&0x03e0)>>3 | ((x)&0x03e0)>>9)
+#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) \
@@ -1213,10 +1213,10 @@ vs_scanline_resample_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
acc = *xacc;
for (i = 0; i < n; i++) {
j = acc >> 16;
- x = acc & 0xffff >> 8;
+ x = (acc & 0xffff) >> 8;
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB555_R (src[MAX ((j - 1), 0)]);
+ y = vs_4tap_taps[x][0] * RGB555_R (src[(j - 1)]);
y += vs_4tap_taps[x][1] * RGB555_R (src[j]);
y += vs_4tap_taps[x][2] * RGB555_R (src[(j + 1)]);
y += vs_4tap_taps[x][3] * RGB555_R (src[(j + 2)]);
@@ -1233,7 +1233,7 @@ vs_scanline_resample_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
y_r = CLAMP (y >> SHIFT, 0, 255);
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB555_G (src[MAX ((j - 1), 0)]);
+ y = vs_4tap_taps[x][0] * RGB555_G (src[(j - 1)]);
y += vs_4tap_taps[x][1] * RGB555_G (src[j]);
y += vs_4tap_taps[x][2] * RGB555_G (src[(j + 1)]);
y += vs_4tap_taps[x][3] * RGB555_G (src[(j + 2)]);
@@ -1250,7 +1250,7 @@ vs_scanline_resample_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
y_g = CLAMP (y >> SHIFT, 0, 255);
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB555_B (src[MAX ((j - 1), 0)]);
+ y = vs_4tap_taps[x][0] * RGB555_B (src[(j - 1)]);
y += vs_4tap_taps[x][1] * RGB555_B (src[j]);
y += vs_4tap_taps[x][2] * RGB555_B (src[(j + 1)]);
y += vs_4tap_taps[x][3] * RGB555_B (src[(j + 2)]);
@@ -1266,7 +1266,7 @@ vs_scanline_resample_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
y += (1 << (SHIFT - 1));
y_b = CLAMP (y >> SHIFT, 0, 255);
- dest[i] = RGB555 (y_r, y_b, y_g);
+ dest[i] = RGB555 (y_r, y_g, y_b);
acc += increment;
}
*xacc = acc;
@@ -1313,7 +1313,7 @@ vs_scanline_merge_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src1_u8,
y += (1 << (SHIFT - 1));
y_b = CLAMP (y >> SHIFT, 0, 255);
- dest[i] = RGB555 (y_r, y_b, y_g);
+ dest[i] = RGB555 (y_r, y_g, y_b);
}
}
@@ -1392,7 +1392,7 @@ vs_scanline_resample_4tap_AYUV64 (uint16_t * dest, uint16_t * src,
for (off = 0; off < 4; off++) {
if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX ((j - 1) * 4 + off, 0)];
+ y = vs_4tap_taps[x][0] * src[(j - 1) * 4 + off];
y += vs_4tap_taps[x][1] * src[j * 4 + off];
y += vs_4tap_taps[x][2] * src[(j + 1) * 4 + off];
y += vs_4tap_taps[x][3] * src[(j + 2) * 4 + off];