Commit 6bed680f authored by Amir Mohammadi's avatar Amir Mohammadi

initial attempt to replace netpbm with pnmio

parent 602d7adc
This diff is collapsed.
This diff is collapsed.
/*
* File : pnmio.h
* Description: Header file for pnmio.c.
* Author : Nikolaos Kavvadias <nikolaos.kavvadias@gmail.com>
* Copyright : (C) Nikolaos Kavvadias 2012, 2013, 2014, 2015, 2016
* Website : http://www.nkavvadias.com
*
* This file is part of libpnmio, and is distributed under the terms of the
* Modified BSD License.
*
* A copy of the Modified BSD License is included with this distribution
* in the file LICENSE.
* libpnmio is free software: you can redistribute it and/or modify it under the
* terms of the Modified BSD License.
* libpnmio is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the Modified BSD License for more details.
*
* You should have received a copy of the Modified BSD License along with
* libpnmio. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PNMIO_H
#define PNMIO_H
#include <stdio.h>
/* PNM/PFM image data file format definitions. */
#define PBM_ASCII 1
#define PGM_ASCII 2
#define PPM_ASCII 3
#define PBM_BINARY 4
#define PGM_BINARY 5
#define PPM_BINARY 6
#define PAM 7 /* reserved */
/* 8-15: reserved */
#define PFM_RGB 16 /* F */
#define PFM_GREYSCALE 17 /* f */
#define IS_BIGENDIAN(x) ((*(char*)&x) == 0)
#define IS_LITTLE_ENDIAN (1 == *(unsigned char *)&(const int){1})
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/* PNM/PFM API. */
int get_pnm_type(FILE *f);
void read_pbm_header(FILE *f, int *img_xdim, int *img_ydim, int *is_ascii);
void read_pgm_header(FILE *f, int *img_xdim, int *img_ydim, int *img_colors,
int *is_ascii);
void read_ppm_header(FILE *f, int *img_xdim, int *img_ydim, int *img_colors,
int *is_ascii);
void read_pfm_header(FILE *f, int *img_xdim, int *img_ydim, int *img_type,
int *endianess);
void read_pbm_data(FILE *f, int *img_in, int is_ascii);
void read_pgm_data(FILE *f, int *img_in, int is_ascii);
void read_ppm_data(FILE *f, int *img_in, int is_ascii);
void read_pfm_data(FILE *f, float *img_in, int img_type, int endianess);
void write_pbm_file(FILE *f, int *img_out, char *img_out_fname,
int x_size, int y_size, int x_scale_val, int y_scale_val, int linevals,
int is_ascii);
void write_pgm_file(FILE *f, int *img_out, char *img_out_fname,
int x_size, int y_size, int x_scale_val, int y_scale_val,
int img_colors, int linevals, int is_ascii);
void write_ppm_file(FILE *f, int *img_out, char *img_out_fname,
int x_size, int y_size, int x_scale_val, int y_scale_val,
int img_colors, int is_ascii);
void write_pfm_file(FILE *f, float *img_out, char *img_out_fname,
int x_size, int y_size, int img_type, int endianess);
/* Helper/auxiliary functions. */
int ReadFloat(FILE *fptr, float *f, int swap);
int WriteFloat(FILE *fptr, float *f, int swap);
int floatEqualComparison(float A, float B, float maxRelDiff);
float frand(void);
int log2ceil(int inpval);
#endif /* PNMIO_H */
......@@ -456,6 +456,7 @@ setup(
"bob/io/image/png.cpp",
"bob/io/image/jpeg.cpp",
"bob/io/image/bmp.cpp",
"bob/io/image/pnmio.c",
"bob/io/image/netpbm.cpp",
"bob/io/image/main.cpp",
],
......
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