* grub-core/video/bitmap_scale.c (scale_bilinear): Increased precision
to eliminate artefacts in bilinear interpolation.
This commit is contained in:
parent
2b131610d0
commit
d999ac72e2
2 changed files with 17 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2013-10-01 Vladimir Testov <vladimir.testov@rosalab.ru>
|
||||||
|
|
||||||
|
* grub-core/video/bitmap_scale.c (scale_bilinear): Increased precision
|
||||||
|
to eliminate artefacts in bilinear interpolation.
|
||||||
|
|
||||||
2013-09-28 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-09-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/video/readers/tga.c: Support paletted tga.
|
* grub-core/video/readers/tga.c: Support paletted tga.
|
||||||
|
|
|
@ -286,18 +286,20 @@ scale_bilinear (struct grub_video_bitmap *dst, struct grub_video_bitmap *src)
|
||||||
{
|
{
|
||||||
/* Get the component's values for the
|
/* Get the component's values for the
|
||||||
four source corner pixels. */
|
four source corner pixels. */
|
||||||
grub_uint8_t f00 = sptr[comp];
|
int f00 = sptr[comp];
|
||||||
grub_uint8_t f10 = sptr[comp + bytes_per_pixel];
|
int f10 = sptr[comp + bytes_per_pixel];
|
||||||
grub_uint8_t f01 = sptr[comp + sstride];
|
int f01 = sptr[comp + sstride];
|
||||||
grub_uint8_t f11 = sptr[comp + sstride + bytes_per_pixel];
|
int f11 = sptr[comp + sstride + bytes_per_pixel];
|
||||||
|
|
||||||
/* Do linear interpolations along the top and bottom
|
/* Count coeffecients. */
|
||||||
rows of the box. */
|
int c00 = (256 - u) * (256 - v);
|
||||||
grub_uint8_t f0y = (256 - v) * f00 / 256 + v * f01 / 256;
|
int c10 = u * (256 - v);
|
||||||
grub_uint8_t f1y = (256 - v) * f10 / 256 + v * f11 / 256;
|
int c01 = (256 - u) * v;
|
||||||
|
int c11 = u * v;
|
||||||
|
|
||||||
/* Interpolate vertically. */
|
/* Interpolate. */
|
||||||
grub_uint8_t fxy = (256 - u) * f0y / 256 + u * f1y / 256;
|
int fxy = c00 * f00 + c01 * f01 + c10 * f10 + c11 * f11;
|
||||||
|
fxy = fxy / (256 * 256);
|
||||||
|
|
||||||
dptr[comp] = fxy;
|
dptr[comp] = fxy;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue