PageRenderTime 23ms CodeModel.GetById 11ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/src/FreeImage/Source/LibRawLite/libraw/libraw_internal.h

https://bitbucket.org/cabalistic/ogredeps/
C++ Header | 218 lines | 158 code | 40 blank | 20 comment | 8 complexity | f6bb770c69d585015687d587f6c8dacb MD5 | raw file
  1/* -*- C++ -*-
  2 * File: libraw_internal.h
  3 * Copyright 2008-2010 LibRaw LLC (info@libraw.org)
  4 * Created: Sat Mar  8 , 2008
  5 *
  6 * LibRaw internal data structures (not visible outside)
  7
  8LibRaw is free software; you can redistribute it and/or modify
  9it under the terms of the one of three licenses as you choose:
 10
 111. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
 12   (See file LICENSE.LGPL provided in LibRaw distribution archive for details).
 13
 142. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
 15   (See file LICENSE.CDDL provided in LibRaw distribution archive for details).
 16
 173. LibRaw Software License 27032010
 18   (See file LICENSE.LibRaw.pdf provided in LibRaw distribution archive for details).
 19
 20 */
 21
 22#ifndef _LIBRAW_INTERNAL_TYPES_H
 23#define _LIBRAW_INTERNAL_TYPES_H
 24
 25#include <stdio.h>
 26#ifdef __cplusplus
 27
 28#ifdef LIBRAW_LIBRARY_BUILD
 29#ifndef CLASS
 30#define CLASS LibRaw::
 31#endif
 32#endif
 33
 34#else
 35#ifndef CLASS
 36#define CLASS
 37#endif
 38#endif
 39
 40
 41#ifdef __cplusplus
 42
 43#include "libraw_datastream.h"
 44#include "libraw_types.h"
 45
 46class LibRaw_TLS
 47{
 48public:
 49    struct
 50    {
 51         unsigned bitbuf;
 52         int vbits, reset;
 53    }getbits;
 54    struct 
 55    {
 56         UINT64 bitbuf;
 57         int vbits;
 58
 59    }ph1_bits;
 60    struct
 61    {
 62         unsigned pad[128], p;
 63    }sony_decrypt;
 64    uchar jpeg_buffer[4096];
 65    struct
 66    {
 67        uchar buf[0x4000];
 68        int vbits, padding;
 69    }pana_bits;
 70
 71    void init() 
 72        { 
 73            getbits.bitbuf = 0; getbits.vbits = getbits.reset = 0;
 74            ph1_bits.bitbuf = 0; ph1_bits.vbits = 0;
 75            pana_bits.vbits = 0;
 76        }
 77};
 78
 79
 80class LibRaw_constants
 81{
 82  public:
 83    static const float d65_white[3];
 84    static const double xyz_rgb[3][3];
 85};
 86#endif /* __cplusplus */
 87
 88
 89typedef struct
 90{
 91#ifndef __cplusplus
 92    struct
 93#endif
 94    LibRaw_abstract_datastream *input;
 95    FILE        *output;
 96    int         input_internal;
 97    char        *meta_data;
 98    INT64       profile_offset;
 99    INT64       toffset;
100
101} internal_data_t;
102
103
104#define LIBRAW_HISTOGRAM_SIZE 0x2000
105typedef struct
106{
107    int         (*histogram)[LIBRAW_HISTOGRAM_SIZE];
108    unsigned    *oprof;
109} output_data_t;
110
111typedef struct
112{
113    unsigned olympus_exif_cfa;
114    unsigned     unique_id;
115    unsigned tiff_nifds;
116    int  tiff_flip;
117}identify_data_t;
118
119typedef struct
120{
121    short       order; 
122    ushort      sraw_mul[4],cr2_slice[3];
123    unsigned    kodak_cbpp;
124    INT64       strip_offset, data_offset;
125    INT64       meta_offset;
126    unsigned    data_size;
127    unsigned     meta_length;
128    unsigned    thumb_misc;
129    unsigned    fuji_layout;
130    unsigned    tiff_samples;
131    unsigned    tiff_bps;
132    unsigned    tiff_compress;
133    unsigned    zero_after_ff;
134    unsigned    tile_width, tile_length,load_flags;
135    unsigned    data_error;
136}unpacker_data_t;
137
138
139
140typedef struct
141{
142    internal_data_t internal_data;
143    libraw_internal_output_params_t internal_output_params;    
144    output_data_t output_data;
145    identify_data_t identify_data;
146    unpacker_data_t unpacker_data;
147} libraw_internal_data_t;
148
149
150struct decode 
151{
152    struct decode *branch[2];
153    int leaf;
154};
155
156struct tiff_ifd_t 
157{
158    int t_width, t_height, bps, comp, phint, offset, t_flip, samples, bytes,tile_maxbytes;
159};
160
161
162struct jhead {
163  int bits, high, wide, clrs, sraw, psv, restart, vpred[6];
164    ushort *huff[6], *free[4], *row;
165};
166struct tiff_tag {
167  ushort tag, type;
168  int count;
169  union { char c[4]; short s[2]; int i; } val;
170};
171
172struct tiff_hdr {
173  ushort t_order, magic;
174  int ifd;
175  ushort pad, ntag;
176  struct tiff_tag tag[23];
177  int nextifd;
178  ushort pad2, nexif;
179  struct tiff_tag exif[4];
180  ushort pad3, ngps;
181  struct tiff_tag gpst[10];
182  short bps[4];
183  int rat[10];
184  unsigned gps[26];
185  char t_desc[512], t_make[64], t_model[64], soft[32], date[20], t_artist[64];
186};
187
188
189
190#ifdef DEBUG_STAGE_CHECKS
191#define CHECK_ORDER_HIGH(expected_stage) \
192    do { if((imgdata.progress_flags & LIBRAW_PROGRESS_THUMB_MASK) >= expected_stage) {fprintf(stderr,"CHECK_HIGH: check %d >=  %d\n",imgdata.progress_flags & LIBRAW_PROGRESS_THUMB_MASK,expected_stage);return LIBRAW_OUT_OF_ORDER_CALL;} } while(0)
193
194#define CHECK_ORDER_LOW(expected_stage) \
195    do { printf("Checking LOW %d/%d : %d\n",imgdata.progress_flags,expected_stage,imgdata.progress_flags<expected_stage); if( (imgdata.progress_flags&LIBRAW_PROGRESS_THUMB_MASK) < expected_stage ) { printf("failed!\n"); return LIBRAW_OUT_OF_ORDER_CALL;} } while(0)
196#define CHECK_ORDER_BIT(expected_stage) \
197    do { if(imgdata.progress_flags & expected_stage) return LIBRAW_OUT_OF_ORDER_CALL; } while(0)
198
199#define SET_PROC_FLAG(stage) do {imgdata.progress_flags |= stage; fprintf(stderr,"SET_FLAG: %d\n",stage); } while (0)
200
201#else
202
203#define CHECK_ORDER_HIGH(expected_stage) \
204    do { if((imgdata.progress_flags & LIBRAW_PROGRESS_THUMB_MASK) >= expected_stage) \
205            {return LIBRAW_OUT_OF_ORDER_CALL;} } while(0)
206
207#define CHECK_ORDER_LOW(expected_stage) \
208    do { if((imgdata.progress_flags&LIBRAW_PROGRESS_THUMB_MASK) < expected_stage) \
209            return LIBRAW_OUT_OF_ORDER_CALL; } while(0)
210
211#define CHECK_ORDER_BIT(expected_stage) \
212    do { if(imgdata.progress_flags & expected_stage) return LIBRAW_OUT_OF_ORDER_CALL; } while(0)
213
214#define SET_PROC_FLAG(stage) do {imgdata.progress_flags |= stage;} while (0)
215
216#endif
217
218#endif