filter_kernels: add nearest neighbour scaling

This is useful for playing content containing pixel art that hasn't been
pre-scaled, such as TASVideos' high quality encodes. The implementation is
lifted from <https://code.google.com/p/glumpy/source/browse/glumpy/image/filter.py#413>.
This commit is contained in:
lucy
2014-06-03 23:00:24 +02:00
committed by wm4
parent 35f87dc692
commit a3b466e88d
+6
View File
@@ -106,6 +106,11 @@ void mp_compute_lut(struct filter_kernel *filter, int count, float *out_array)
typedef struct filter_kernel kernel;
static double nearest(kernel *k, double x)
{
return 1.0;
}
static double bilinear(kernel *k, double x)
{
return 1.0 - x;
@@ -254,6 +259,7 @@ static double blackman(kernel *k, double x)
}
const struct filter_kernel mp_filter_kernels[] = {
{"nearest", 0.5, nearest},
{"bilinear_slow", 1, bilinear},
{"hanning", 1, hanning},
{"hamming", 1, hamming},