~ubuntu-branches/ubuntu/karmic/lcms/karmic

« back to all changes in this revision

Viewing changes to src/cmssamp.c

  • Committer: Bazaar Package Importer
  • Author(s): Oleksandr Moskalenko
  • Date: 2008-07-24 14:29:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080724142936-9fgs00bge01jgdl5
Tags: 1.17.dfsg-1
Removed Adobe sRGB profiles from the testdbed and python/testbed
directories (Closes: #491995).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
2
//  Little cms
3
 
//  Copyright (C) 1998-2006 Marti Maria
 
3
//  Copyright (C) 1998-2007 Marti Maria
4
4
//
5
5
// Permission is hereby granted, free of charge, to any person obtaining 
6
6
// a copy of this software and associated documentation files (the "Software"), 
91
91
// This routine does a sweep on whole input space, and calls its callback
92
92
// function on knots. returns TRUE if all ok, FALSE otherwise.
93
93
 
94
 
BOOL LCMSEXPORT cmsSample3DGrid(LPLUT Lut, _cmsSAMPLER Sampler, LPVOID Cargo, DWORD dwFlags)
 
94
LCMSBOOL LCMSEXPORT cmsSample3DGrid(LPLUT Lut, _cmsSAMPLER Sampler, LPVOID Cargo, DWORD dwFlags)
95
95
{
96
96
   int i, t, nTotalPoints, Colorant, index;
97
97
   WORD In[MAXCHANNELS], Out[MAXCHANNELS];
116
116
                                                &Lut -> In16params);
117
117
        }
118
118
 
 
119
                for (t=0; t < (int) Lut -> OutputChan; t++)
 
120
                     Out[t] = Lut->T[index + t];
119
121
 
120
 
        // if (dwFlags & SAMPLER_INSPECT) {
 
122
        if (dwFlags & SAMPLER_HASTL2) {
121
123
 
122
124
             for (t=0; t < (int) Lut -> OutputChan; t++)
123
 
                        Out[t] = Lut->T[index + t];
124
 
        // }
 
125
                     Out[t] = cmsLinearInterpLUT16(Out[t],
 
126
                                                   Lut -> L2[t],
 
127
                                                   &Lut -> Out16params);               
 
128
        }       
125
129
 
126
130
 
127
131
        if (!Sampler(In, Out, Cargo))
226
230
       LPLUT Grid;
227
231
       int nGridPoints;
228
232
       DWORD dwFormatIn, dwFormatOut;
 
233
       DWORD SaveFormatIn, SaveFormatOut;
229
234
       int ChannelsIn, ChannelsOut;
230
235
       LPLUT SaveGamutLUT;
231
236
 
 
237
 
232
238
       // Remove any gamut checking
233
239
       SaveGamutLUT = p ->Gamut;
234
240
       p ->Gamut = NULL;
247
253
       dwFormatIn   = (CHANNELS_SH(ChannelsIn)|BYTES_SH(2));
248
254
       dwFormatOut  = (CHANNELS_SH(ChannelsOut)|BYTES_SH(2));
249
255
 
250
 
       p -> FromInput = _cmsIdentifyInputFormat(p, dwFormatIn);
251
 
       p -> ToOutput  = _cmsIdentifyOutputFormat(p, dwFormatOut);
 
256
       SaveFormatIn  = p ->InputFormat;
 
257
       SaveFormatOut = p ->OutputFormat;
 
258
 
 
259
       p -> InputFormat  = dwFormatIn;
 
260
       p -> OutputFormat = dwFormatOut;
 
261
       p -> FromInput    = _cmsIdentifyInputFormat(p, dwFormatIn);
 
262
       p -> ToOutput     = _cmsIdentifyOutputFormat(p, dwFormatOut);
252
263
 
253
264
       // Fix gamut & gamma possible mismatches. 
254
265
           
259
270
                
260
271
           _cmsComputePrelinearizationTablesFromXFORM(hOne, 1, Grid);
261
272
       }
262
 
        
263
 
            
 
273
                    
264
274
       // Attention to this typecast! we can take the luxury to
265
275
       // do this since cmsHTRANSFORM is only an alias to a pointer
266
276
       // to the transform struct.
268
278
       if (!cmsSample3DGrid(Grid, XFormSampler, (LPVOID) p, Grid -> wFlags)) {
269
279
 
270
280
                cmsFreeLUT(Grid);
271
 
                return NULL;
272
 
       }
273
 
      
274
 
      
275
 
       p ->Gamut = SaveGamutLUT;
 
281
                Grid = NULL;
 
282
       }      
 
283
      
 
284
       p ->Gamut        = SaveGamutLUT;
 
285
       p ->InputFormat  = SaveFormatIn; 
 
286
       p ->OutputFormat = SaveFormatOut;
 
287
 
276
288
       return Grid;
277
289
}
278
290
 
440
452
    return OldVal;
441
453
}
442
454
 
 
455
#pragma warning(disable: 4550)
443
456
 
444
457
// Get a pointer to callback on depending of strategy
445
458
static
624
637
 
625
638
 
626
639
 
627
 
BOOL _cmsFixWhiteMisalignment(_LPcmsTRANSFORM p)
 
640
LCMSBOOL _cmsFixWhiteMisalignment(_LPcmsTRANSFORM p)
628
641
{
629
642
 
630
643
       WORD *WhitePointIn, *WhitePointOut, *BlackPointIn, *BlackPointOut;