~ubuntu-branches/ubuntu/oneiric/imagemagick/oneiric-updates

« back to all changes in this revision

Viewing changes to coders/dpx.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-06-15 11:05:28 UTC
  • mfrom: (6.2.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110615110528-08jgo07a4846xh8d
Tags: 8:6.6.0.4-3ubuntu1
* Resynchronise with Debian (LP: #797595).  Remaining changes:
  - Make ufraw-batch (universe) a suggestion instead of a recommendation.
  - Make debian/rules install target depend on check; they cannot reliably
    be run in parallel.
  - Don't set MAKEFLAGS in debian/rules; just pass it to the build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
370
370
%
371
371
*/
372
372
 
373
 
static size_t GetBytesPerRow(size_t columns,
374
 
  size_t samples_per_pixel,size_t bits_per_pixel,
 
373
static size_t GetBytesPerRow(unsigned long columns,
 
374
  unsigned long samples_per_pixel,unsigned long bits_per_pixel,
375
375
  MagickBooleanType pad)
376
376
{
377
377
  size_t
513
513
  }
514
514
}
515
515
 
516
 
static void TimeCodeToString(const size_t timestamp,char *code)
 
516
static void TimeCodeToString(const unsigned long timestamp,char *code)
517
517
{
518
518
#define TimeFields  7
519
519
 
520
520
  unsigned int
521
521
    shift;
522
522
 
523
 
  register ssize_t
 
523
  register long
524
524
    i;
525
525
 
526
526
  *code='\0';
539
539
 
540
540
static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
541
541
{
 
542
  CacheView
 
543
    *image_view;
 
544
 
542
545
  char
543
546
    magick[4],
544
547
    value[MaxTextExtent];
549
552
  Image
550
553
    *image;
551
554
 
552
 
  ssize_t
 
555
  long
553
556
    row,
554
557
    y;
555
558
 
565
568
  QuantumType
566
569
    quantum_type;
567
570
 
568
 
  register ssize_t
 
571
  register long
569
572
    i;
570
573
 
571
574
  ssize_t
577
580
  unsigned char
578
581
    component_type;
579
582
 
580
 
  size_t
 
583
  unsigned long
581
584
    samples_per_pixel;
582
585
 
583
586
  /*
900
903
      dpx.television.interlace=(unsigned char) ReadBlobByte(image);
901
904
      offset++;
902
905
      if (dpx.television.interlace != 0)
903
 
        (void) FormatImageProperty(image,"dpx:television.interlace","%.20g",
904
 
          (double) dpx.television.interlace);
 
906
        (void) FormatImageProperty(image,"dpx:television.interlace","%ld",(long)
 
907
          dpx.television.interlace);
905
908
      dpx.television.field_number=(unsigned char) ReadBlobByte(image);
906
909
      offset++;
907
910
      if (dpx.television.field_number != 0)
908
 
        (void) FormatImageProperty(image,"dpx:television.field_number","%.20g",
909
 
          (double) dpx.television.field_number);
 
911
        (void) FormatImageProperty(image,"dpx:television.field_number","%ld",
 
912
          (long) dpx.television.field_number);
910
913
      dpx.television.video_signal=(unsigned char) ReadBlobByte(image);
911
914
      offset++;
912
915
      if (dpx.television.video_signal != 0)
913
 
        (void) FormatImageProperty(image,"dpx:television.video_signal","%.20g",
914
 
          (double) dpx.television.video_signal);
 
916
        (void) FormatImageProperty(image,"dpx:television.video_signal","%ld",
 
917
          (long) dpx.television.video_signal);
915
918
      dpx.television.padding=(unsigned char) ReadBlobByte(image);
916
919
      offset++;
917
920
      if (dpx.television.padding != 0)
985
988
          StringInfo
986
989
            *profile;
987
990
 
988
 
           profile=AcquireStringInfo(dpx.file.user_size);
 
991
           profile=AcquireStringInfo(dpx.file.user_size-sizeof(dpx.user.id));
989
992
           offset+=ReadBlob(image,GetStringInfoLength(profile),
990
993
             GetStringInfoDatum(profile));
991
 
           (void) SetImageProfile(image,"dpx",profile);
 
994
           (void) SetImageProfile(image,"dpx:user.data",profile);
992
995
           profile=DestroyStringInfo(profile);
993
996
        }
994
997
    }
995
 
  for ( ; offset < (ssize_t) dpx.file.image_offset; offset++)
 
998
  for ( ; offset < (long) dpx.file.image_offset; offset++)
996
999
    (void) ReadBlobByte(image);
997
1000
  /*
998
1001
    Read DPX image header.
1076
1079
  SetQuantumQuantum(quantum_info,32);
1077
1080
  SetQuantumPack(quantum_info,dpx.image.image_element[0].packing == 0 ?
1078
1081
    MagickTrue : MagickFalse);
1079
 
  for (y=0; y < (ssize_t) image->rows; y++)
 
1082
  image_view=AcquireCacheView(image);
 
1083
#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP > 200505)
 
1084
  #pragma omp parallel for schedule(static) shared(row,status,quantum_type)
 
1085
#endif
 
1086
  for (y=0; y < (long) image->rows; y++)
1080
1087
  {
1081
 
    ssize_t
 
1088
    long
1082
1089
      offset;
1083
1090
 
1084
1091
    MagickBooleanType
1099
1106
    if (status == MagickFalse)
1100
1107
      continue;
1101
1108
    pixels=GetQuantumPixels(quantum_info);
 
1109
#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP > 200505)
 
1110
  #pragma omp critical (MagickCore_ReadDPXImage)
 
1111
#endif
1102
1112
    {
1103
1113
      count=ReadBlob(image,extent,pixels);
1104
1114
      if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
1107
1117
          MagickBooleanType
1108
1118
            proceed;
1109
1119
 
1110
 
          proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) row,
1111
 
                image->rows);
 
1120
          proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
1112
1121
          if (proceed == MagickFalse)
1113
1122
            status=MagickFalse;
1114
1123
        }
1116
1125
    }
1117
1126
    if (count != (ssize_t) extent)
1118
1127
      status=MagickFalse;
1119
 
    q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
 
1128
    q=QueueCacheViewAuthenticPixels(image_view,0,offset,image->columns,1,
 
1129
      exception);
1120
1130
    if (q == (PixelPacket *) NULL)
1121
1131
      {
1122
1132
        status=MagickFalse;
1123
1133
        continue;
1124
1134
      }
1125
 
    length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1126
 
      quantum_type,pixels,exception);
1127
 
    sync=SyncAuthenticPixels(image,exception);
 
1135
    length=ImportQuantumPixels(image,image_view,quantum_info,quantum_type,
 
1136
      pixels,exception);
 
1137
    sync=SyncCacheViewAuthenticPixels(image_view,exception);
1128
1138
    if (sync == MagickFalse)
1129
1139
      status=MagickFalse;
1130
1140
  }
 
1141
  image_view=DestroyCacheView(image_view);
1131
1142
  quantum_info=DestroyQuantumInfo(quantum_info);
1132
1143
  if (status == MagickFalse)
1133
1144
    ThrowReaderException(CorruptImageError,"UnableToReadImageData");
1159
1170
%
1160
1171
%  The format of the RegisterDPXImage method is:
1161
1172
%
1162
 
%      size_t RegisterDPXImage(void)
 
1173
%      unsigned long RegisterDPXImage(void)
1163
1174
%
1164
1175
*/
1165
 
ModuleExport size_t RegisterDPXImage(void)
 
1176
ModuleExport unsigned long RegisterDPXImage(void)
1166
1177
{
1167
1178
  MagickInfo
1168
1179
    *entry;
1252
1263
  char
1253
1264
    buffer[2];
1254
1265
 
1255
 
  register ssize_t
 
1266
  register long
1256
1267
    i;
1257
1268
 
1258
1269
  unsigned int
1287
1298
  DPXInfo
1288
1299
    dpx;
1289
1300
 
1290
 
  ssize_t
 
1301
  long
1291
1302
    horizontal_factor,
1292
1303
    vertical_factor,
1293
1304
    y;
1313
1324
  register const PixelPacket
1314
1325
    *p;
1315
1326
 
1316
 
  register ssize_t
 
1327
  register long
1317
1328
    i;
1318
1329
 
1319
1330
  size_t
1348
1359
        flags;
1349
1360
 
1350
1361
      flags=ParseGeometry(image_info->sampling_factor,&geometry_info);
1351
 
      horizontal_factor=(ssize_t) geometry_info.rho;
1352
 
      vertical_factor=(ssize_t) geometry_info.sigma;
 
1362
      horizontal_factor=(long) geometry_info.rho;
 
1363
      vertical_factor=(long) geometry_info.sigma;
1353
1364
      if ((flags & SigmaValue) == 0)
1354
1365
        vertical_factor=horizontal_factor;
1355
1366
      if ((horizontal_factor != 1) && (horizontal_factor != 2) &&
1372
1383
  dpx.file.magic=0x53445058U;
1373
1384
  offset+=WriteBlobLong(image,dpx.file.magic);
1374
1385
  dpx.file.image_offset=0x2000U;
1375
 
  profile=GetImageProfile(image,"dpx");
 
1386
  profile=GetImageProfile(image,"dpx:user.data");
1376
1387
  if (profile != (StringInfo *) NULL)
1377
1388
    {
1378
 
      if (GetStringInfoLength(profile) > 1048576)
1379
 
        ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
1380
1389
      dpx.file.image_offset+=(unsigned int) GetStringInfoLength(profile);
1381
1390
      dpx.file.image_offset=(((dpx.file.image_offset+0x2000-1)/0x2000)*0x2000);
1382
1391
    }
1409
1418
    dpx.file.timestamp);
1410
1419
  offset+=WriteBlob(image,sizeof(dpx.file.timestamp),(unsigned char *)
1411
1420
    dpx.file.timestamp);
1412
 
  (void) strncpy(dpx.file.creator,GetMagickVersion((size_t *) NULL),
 
1421
  (void) strncpy(dpx.file.creator,GetMagickVersion((unsigned long *) NULL),
1413
1422
    sizeof(dpx.file.creator));
1414
1423
  value=GetDPXProperty(image_info,image,"dpx:file.creator");
1415
1424
  if (value != (const char *) NULL)
1810
1819
      extent=GetBytesPerRow(image->columns,1UL,image->depth,MagickTrue);
1811
1820
    }
1812
1821
  pixels=GetQuantumPixels(quantum_info);
1813
 
  for (y=0; y < (ssize_t) image->rows; y++)
 
1822
  for (y=0; y < (long) image->rows; y++)
1814
1823
  {
1815
1824
    p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
1816
1825
    if (p == (const PixelPacket *) NULL)
1820
1829
    count=WriteBlob(image,extent,pixels);
1821
1830
    if (count != (ssize_t) extent)
1822
1831
      break;
1823
 
    status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
1824
 
                image->rows);
 
1832
    status=SetImageProgress(image,SaveImageTag,y,image->rows);
1825
1833
    if (status == MagickFalse)
1826
1834
      break;
1827
1835
  }