Commit 58e6f33e authored by Wim Taymans's avatar Wim Taymans
Browse files

videoscale: fix 4tap for RGB15 and RGB16

Fix component ordering, it's wrong in both the scanline and merge
function so it cancels eachother out and isn't really a except for
loss of precision of the green component.
Fix calculation of the filter weight
parent 1ede4551
...@@ -1028,7 +1028,7 @@ vs_scanline_resample_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src_u8, ...@@ -1028,7 +1028,7 @@ vs_scanline_resample_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
acc = *xacc; acc = *xacc;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = acc >> 16; j = acc >> 16;
x = acc & 0xffff >> 8; x = (acc & 0xffff) >> 8;
if (j - 1 >= 0 && j + 2 < src_width) { if (j - 1 >= 0 && j + 2 < src_width) {
y = vs_4tap_taps[x][0] * RGB565_R (src[(j - 1)]); y = vs_4tap_taps[x][0] * RGB565_R (src[(j - 1)]);
...@@ -1081,7 +1081,7 @@ vs_scanline_resample_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src_u8, ...@@ -1081,7 +1081,7 @@ vs_scanline_resample_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
y += (1 << (SHIFT - 1)); y += (1 << (SHIFT - 1));
y_b = CLAMP (y >> SHIFT, 0, 255); 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; acc += increment;
} }
*xacc = acc; *xacc = acc;
...@@ -1128,7 +1128,7 @@ vs_scanline_merge_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src1_u8, ...@@ -1128,7 +1128,7 @@ vs_scanline_merge_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src1_u8,
y += (1 << (SHIFT - 1)); y += (1 << (SHIFT - 1));
y_b = CLAMP (y >> SHIFT, 0, 255); 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);
} }
} }
...@@ -1213,7 +1213,7 @@ vs_scanline_resample_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src_u8, ...@@ -1213,7 +1213,7 @@ vs_scanline_resample_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
acc = *xacc; acc = *xacc;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = acc >> 16; j = acc >> 16;
x = acc & 0xffff >> 8; x = (acc & 0xffff) >> 8;
if (j - 1 >= 0 && j + 2 < src_width) { if (j - 1 >= 0 && j + 2 < src_width) {
y = vs_4tap_taps[x][0] * RGB555_R (src[(j - 1)]); y = vs_4tap_taps[x][0] * RGB555_R (src[(j - 1)]);
...@@ -1266,7 +1266,7 @@ vs_scanline_resample_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src_u8, ...@@ -1266,7 +1266,7 @@ vs_scanline_resample_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
y += (1 << (SHIFT - 1)); y += (1 << (SHIFT - 1));
y_b = CLAMP (y >> SHIFT, 0, 255); 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; acc += increment;
} }
*xacc = acc; *xacc = acc;
...@@ -1313,7 +1313,7 @@ vs_scanline_merge_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src1_u8, ...@@ -1313,7 +1313,7 @@ vs_scanline_merge_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src1_u8,
y += (1 << (SHIFT - 1)); y += (1 << (SHIFT - 1));
y_b = CLAMP (y >> SHIFT, 0, 255); 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);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment