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)
900
903
dpx.television.interlace=(unsigned char) ReadBlobByte(image);
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);
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);
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);
917
920
if (dpx.television.padding != 0)
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);
995
for ( ; offset < (ssize_t) dpx.file.image_offset; offset++)
998
for ( ; offset < (long) dpx.file.image_offset; offset++)
996
999
(void) ReadBlobByte(image);
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)
1086
for (y=0; y < (long) image->rows; y++)
1084
1091
MagickBooleanType
1099
1106
if (status == MagickFalse)
1101
1108
pixels=GetQuantumPixels(quantum_info);
1109
#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP > 200505)
1110
#pragma omp critical (MagickCore_ReadDPXImage)
1103
1113
count=ReadBlob(image,extent,pixels);
1104
1114
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
1107
1117
MagickBooleanType
1110
proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) row,
1120
proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
1112
1121
if (proceed == MagickFalse)
1113
1122
status=MagickFalse;
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,
1120
1130
if (q == (PixelPacket *) NULL)
1122
1132
status=MagickFalse;
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,
1137
sync=SyncCacheViewAuthenticPixels(image_view,exception);
1128
1138
if (sync == MagickFalse)
1129
1139
status=MagickFalse;
1141
image_view=DestroyCacheView(image_view);
1131
1142
quantum_info=DestroyQuantumInfo(quantum_info);
1132
1143
if (status == MagickFalse)
1133
1144
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
1160
1171
% The format of the RegisterDPXImage method is:
1162
% size_t RegisterDPXImage(void)
1173
% unsigned long RegisterDPXImage(void)
1165
ModuleExport size_t RegisterDPXImage(void)
1176
ModuleExport unsigned long RegisterDPXImage(void)
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)
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);
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);
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++)
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)
1823
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
1832
status=SetImageProgress(image,SaveImageTag,y,image->rows);
1825
1833
if (status == MagickFalse)