Less blurry thumbnail scaling
This commit is contained in:
parent
b5856bfa47
commit
b5c9d86fbe
@ -52,6 +52,8 @@ void *ptif_pack(pixel *src, int w, int h, int *result_size);
|
||||
|
||||
pixel *ptif_unpack(void *datain, int size, int *w, int *h);
|
||||
|
||||
pixel *resample_img_nn(pixel *src, int sw, int sh, int rw, int rh);
|
||||
|
||||
pixel *resample_img(pixel *src, int sw, int sh, int rw, int rh);
|
||||
|
||||
pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f);
|
||||
|
@ -140,6 +140,18 @@ pixel *ptif_unpack(void *datain, int size, int *w, int *h){
|
||||
return result;
|
||||
}
|
||||
|
||||
pixel *resample_img_nn(pixel * src, int sw, int sh, int rw, int rh)
|
||||
{
|
||||
int y, x;
|
||||
pixel *q = NULL;
|
||||
q = malloc(rw*rh*PIXELSIZE);
|
||||
for (y=0; y<rh; y++)
|
||||
for (x=0; x<rw; x++){
|
||||
q[rw*y+x] = src[sw*(y*sh/rh)+(x*sw/rw)];
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
||||
pixel *resample_img(pixel *src, int sw, int sh, int rw, int rh)
|
||||
{
|
||||
int y, x;
|
||||
|
@ -1482,8 +1482,8 @@ int main(int argc, char *argv[])
|
||||
free(datares);
|
||||
datares = NULL;
|
||||
}
|
||||
scaled_buf = resample_img(vid_buf, XRES, YRES, XRES/4, YRES/4);
|
||||
datares = ptif_pack(scaled_buf, XRES/4, YRES/4, &res);
|
||||
scaled_buf = resample_img(vid_buf, XRES, YRES, XRES/GRID_Z, YRES/GRID_Z);
|
||||
datares = ptif_pack(scaled_buf, XRES/GRID_Z, YRES/GRID_Z, &res);
|
||||
if(datares!=NULL){
|
||||
f=fopen(ptismallfilename, "wb");
|
||||
fwrite(datares, res, 1, f);
|
||||
|
Loading…
Reference in New Issue
Block a user