X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libqscale.h;h=d9e18e7440ed7d8eabb768c02bd54e1e4d0e767b;hb=115192a9fe4206be3bbe897daf0e5fc3e2561fe8;hp=4f0d34672365748f87244d7da34f775df7463321;hpb=c74cc9601b7837a19b5adacc0a67294ecaa3d609;p=qscale diff --git a/libqscale.h b/libqscale.h index 4f0d346..d9e18e7 100644 --- a/libqscale.h +++ b/libqscale.h @@ -6,12 +6,17 @@ typedef struct { /* True image size */ - int width, height; + unsigned width, height; /* Component image sizes (possibly subsampled) */ - int w0, h0; - int w1, h1; - int w2, h2; + unsigned w0, h0; + unsigned w1, h1; + unsigned w2, h2; + + /* Sampling factors */ + unsigned samp_h0, samp_v0; + unsigned samp_h1, samp_v1; + unsigned samp_h2, samp_v2; /* The data itself */ JSAMPLE *data_y, *data_cb, *data_cr; @@ -19,13 +24,21 @@ typedef struct { enum qscale_scaling_filter { LANCZOS = 0, + MITCHELL = 1, +}; + +enum qscale_jpeg_mode { + SEQUENTIAL = 0, + PROGRESSIVE = 1, }; qscale_img *qscale_load_jpeg(const char *filename); -qscale_img *qscale_load_jpeg_from_stdio(FILE *filea); -int qscale_save_jpeg(const qscale_img *image, const char *filename); +qscale_img *qscale_load_jpeg_from_stdio(FILE *file); +int qscale_save_jpeg(const qscale_img *img, const char *filename, unsigned jpeg_quality, enum qscale_jpeg_mode jpeg_mode); +int qscale_save_jpeg_to_stdio(const qscale_img *img, FILE *file, unsigned jpeg_quality, enum qscale_jpeg_mode jpeg_mode); -qscale_img *qscale_scale(qscale_img *source, int width, int height, int samp_h0, int samp_v0, int samp_h1, int samp_v1, int samp_h2, int samp_v2, int jpeg_quality); -void qscale_destroy(qscale_img *image); +qscale_img *qscale_clone(const qscale_img *img); +qscale_img *qscale_scale(qscale_img *src, unsigned width, unsigned height, unsigned samp_h0, unsigned samp_v0, unsigned samp_h1, unsigned samp_v1, unsigned samp_h2, unsigned samp_v2, enum qscale_scaling_filter scaling_filter); +void qscale_destroy(qscale_img *img); #endif /* !defined(_LIBQSCALE_H) */