/* CINELERRA dcraw.c */ static int CLASS fcol(int row,int col); #if 0 static char *my_memmem(char *haystack,size_t haystacklen,char *needle,size_t needlelen); static char *my_strcasestr(char *haystack,const char *needle); #endif static void CLASS merror(void *ptr,const char *where); static void CLASS derror(void); static ushort CLASS sget2(uchar *s); static ushort CLASS get2(void); static unsigned CLASS sget4(uchar *s); static unsigned CLASS get4(void); static unsigned CLASS getint(int type); static float CLASS int_to_float(int i); static double CLASS getreal(int type); static void CLASS read_shorts(ushort *pixel,int count); static void CLASS cubic_spline(const int *x_,const int *y_,const int len); static void CLASS canon_600_fixed_wb(int temp); static int CLASS canon_600_color(int ratio[2],int mar); static void CLASS canon_600_auto_wb(void); static void CLASS canon_600_coeff(void); static void CLASS canon_600_load_raw(void); static void CLASS canon_600_correct(void); static int CLASS canon_s2is(void); static unsigned CLASS getbithuff(int nbits,ushort *huff); static ushort *CLASS make_decoder_ref(const uchar **source); static ushort *CLASS make_decoder(const uchar *source); static void CLASS crw_init_tables(unsigned table,ushort *huff[2]); static int CLASS canon_has_lowbits(void); static void CLASS canon_load_raw(void); static int CLASS ljpeg_start(struct jhead *jh,int info_only); static void CLASS ljpeg_end(struct jhead *jh); static int CLASS ljpeg_diff(ushort *huff); static ushort *CLASS ljpeg_row(int jrow,struct jhead *jh); static void CLASS lossless_jpeg_load_raw(void); static void CLASS canon_sraw_load_raw(void); static void CLASS adobe_copy_pixel(unsigned row,unsigned col,ushort **rp); static void CLASS ljpeg_idct(struct jhead *jh); static void CLASS lossless_dng_load_raw(void); static void CLASS packed_dng_load_raw(void); static void CLASS pentax_load_raw(void); static void CLASS nikon_load_raw(void); static void CLASS nikon_yuv_load_raw(void); static int CLASS nikon_e995(void); static int CLASS nikon_e2100(void); static void CLASS nikon_3700(void); static int CLASS minolta_z2(void); static void CLASS ppm_thumb(void); static void CLASS ppm16_thumb(void); static void CLASS layer_thumb(void); static void CLASS rollei_thumb(void); static void CLASS rollei_load_raw(void); static int CLASS raw(unsigned row,unsigned col); static void CLASS phase_one_flat_field(int is_float,int nc); static void CLASS phase_one_correct(void); static void CLASS phase_one_load_raw(void); static unsigned CLASS ph1_bithuff(int nbits,ushort *huff); static void CLASS phase_one_load_raw_c(void); static void CLASS hasselblad_load_raw(void); static void CLASS leaf_hdr_load_raw(void); static void CLASS unpacked_load_raw(void); static void CLASS sinar_4shot_load_raw(void); static void CLASS imacon_full_load_raw(void); static void CLASS packed_load_raw(void); static void CLASS nokia_load_raw(void); static void CLASS canon_rmf_load_raw(void); static unsigned CLASS pana_bits(int nbits); static void CLASS panasonic_load_raw(void); static void CLASS olympus_load_raw(void); static void CLASS minolta_rd175_load_raw(void); static void CLASS quicktake_100_load_raw(void); static void CLASS kodak_radc_load_raw(void); static void CLASS kodak_jpeg_load_raw(void); static void CLASS lossy_dng_load_raw(void); #ifndef NO_JPEG static int boolean fill_input_buffer(j_decompress_ptr cinfo); #endif static void CLASS kodak_jpeg_load_raw(void); static void CLASS lossy_dng_load_raw(void); static void CLASS kodak_dc120_load_raw(void); static void CLASS eight_bit_load_raw(void); static void CLASS kodak_c330_load_raw(void); static void CLASS kodak_c603_load_raw(void); static void CLASS kodak_262_load_raw(void); static int CLASS kodak_65000_decode(short *out,int bsize); static void CLASS kodak_65000_load_raw(void); static void CLASS kodak_ycbcr_load_raw(void); static void CLASS kodak_rgb_load_raw(void); static void CLASS kodak_thumb_load_raw(void); static void CLASS sony_decrypt(unsigned *data,int len,int start,int key); static void CLASS sony_load_raw(void); static void CLASS sony_arw_load_raw(void); static void CLASS sony_arw2_load_raw(void); static void CLASS samsung_load_raw(void); static void CLASS samsung2_load_raw(void); static void CLASS samsung3_load_raw(void); static void CLASS smal_decode_segment(unsigned seg[2][2],int holes); static void CLASS smal_v6_load_raw(void); static int CLASS median4(int *p); static void CLASS fill_holes(int holes); static void CLASS smal_v9_load_raw(void); static void CLASS redcine_load_raw(void); static void CLASS foveon_decoder(unsigned size,unsigned code); static void CLASS foveon_thumb(void); static void CLASS foveon_sd_load_raw(void); static void CLASS foveon_huff(ushort *huff); static void CLASS foveon_dp_load_raw(void); static void CLASS foveon_load_camf(void); static const char *CLASS foveon_camf_param(const char *block,const char *param); static void *CLASS foveon_camf_matrix(unsigned dim[3],const char *name); static int CLASS foveon_fixed(void *ptr,int size,const char *name); static float CLASS foveon_avg(short *pix,int range[2],float cfilt); static short *CLASS foveon_make_curve(double max,double mul,double filt); static void CLASS foveon_make_curves(short **curvep,float dq[3],float div[3],float filt); static int CLASS foveon_apply_curve(short *curve,int i); static void CLASS foveon_interpolate(void); static void CLASS crop_masked_pixels(void); static void CLASS remove_zeroes(void); static void CLASS bad_pixels(const char *cfname); static void CLASS subtract(const char *fname); static void CLASS gamma_curve(double pwr,double ts,int mode,int imax); static void CLASS pseudoinverse (double (*in)[3],double (*out)[3],int size); static void CLASS cam_xyz_coeff(float rgb_cam[3][4],double cam_xyz[4][3]); #ifdef COLORCHECK static void CLASS colorcheck(void); #endif static void CLASS hat_transform(float *temp,float *base,int st,int size,int sc); static void CLASS wavelet_denoise(void); static void CLASS scale_colors(void); static void CLASS pre_interpolate(void); static void CLASS border_interpolate(int border); static void CLASS lin_interpolate(void); static void CLASS vng_interpolate(void); static void CLASS ppg_interpolate(void); static void CLASS cielab(ushort rgb[3],short lab[3]); static void CLASS xtrans_interpolate(int passes); static void CLASS ahd_interpolate(void); static void CLASS median_filter(void); static void CLASS blend_highlights(void); static void CLASS recover_highlights(void); static void CLASS tiff_get(unsigned base,unsigned *tag,unsigned *type,unsigned *len,unsigned *save); static void CLASS parse_thumb_note(int base,unsigned toff,unsigned tlen); static void CLASS parse_makernote(int base,int uptag); static void CLASS get_timestamp(int reversed); static void CLASS parse_exif(int base); static void CLASS parse_gps(int base); static void CLASS romm_coeff(float romm_cam[3][3]); static void CLASS parse_mos(int offset); static void CLASS linear_table(unsigned len); static void CLASS parse_kodak_ifd(int base); static int CLASS parse_tiff_ifd(int base); static int CLASS parse_tiff(int base); static void CLASS apply_tiff(void); static void CLASS parse_minolta(int base); static void CLASS parse_external_jpeg(void); static void CLASS ciff_block_1030(void); static void CLASS parse_ciff(int offset,int length,int depth); static void CLASS parse_rollei(void); static void CLASS parse_sinar_ia(void); static void CLASS parse_phase_one(int base); static void CLASS parse_fuji(int offset); static int CLASS parse_jpeg(int offset); static void CLASS parse_riff(void); static void CLASS parse_qt(int end); static void CLASS parse_smal(int offset,int fsize); static void CLASS parse_cine(void); static void CLASS parse_redcine(void); static char *CLASS foveon_gets(int offset,char *str,int len); static void CLASS parse_foveon(void); static void CLASS adobe_coeff(const char *make,const char *model); static void CLASS simple_coeff(int index); static short CLASS guess_byte_order(int words); static float CLASS find_green(int bps,int bite,int off0,int off1); static void CLASS identify(void); #ifndef NO_LCMS static void CLASS apply_profile(const char *input,const char *output); #endif static void CLASS convert_to_rgb(void); static void CLASS fuji_rotate(void); static void CLASS stretch(void); static int CLASS flip_index(int row, int col); static void CLASS tiff_set(struct tiff_hdr *th,ushort *ntag,ushort tag,ushort type,int count,int val); static void CLASS tiff_head(struct tiff_hdr *th,int full); static void CLASS jpeg_thumb(void); static void CLASS write_ppm_tiff(void); static void CLASS write_cinelerra(FILE *ofp);