Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Plugin and Companion App SDK
Viewing all articles
Browse latest Browse all 54282

PS Custom Format Plugin - Issue Reading Files > 2GB &< 4GB

$
0
0

Is this issue fixable within our format plugin code, or is it  a photoshop limitation?

 

 

I am new to Photoshop & Photoshop Plugins.  I have reviewed the sdk photoshop documentation & searched web on this subject.

 

I am working with a photoshop format plugin written by my predecessor who is no longer here.

 

The plugin is modeled after the simpleFormat plugin.

The plugin is being used on systems running Photoshop CS6 & CC on 64bit Windows 7 with 8GB or more memory.

The plugin allows a file of our format to be opened, read and written.

 

------------------------------------------------------------------------------------------ --------------------------------------------------------------

ISSUE:

The plugin works fine reading  files < 2GB or > 4GB.  For files between 2GB and 4GB, the call to allocate memory fails.

------------------------------------------------------------------------------------------ --------------------------------------------------------------

 

In the plugin's PIPL structure:   the FormatMaxSize {32767, 32767} and PluginMaxSize {PlugInMaxSize { 2147483647, 2147483647 }

 

----------------------------------------------------------------------

In the plugin code;  the DoReadStart() method opens the file and reads the file header information.  This works fine.

Next, in the DoReadContinue() method: SPsBuffer->New(&bufferSize, buffersize) is returning NULL.     see below.

 

void PluginMain (const int16 selector,

                                                                         FormatRecordPtr formatParamBlock,

                                                                         intptr_t * data,

                                                                         int16 * result)

{

...

    gFormatRecord = reinterpret_cast<FormatRecordPtr>(formatParamBlock);

          gPluginRef = reinterpret_cast<SPPluginRef>(gFormatRecord->plugInRef);

          gResult = result;

          gDataHandle = data;

...



sSPBasic = ((FormatRecordPtr)formatParamBlock)->sSPBasic;

...

 



if (gCountResources == NULL ||

            gGetResources == NULL ||

            gAddResource == NULL ||




gFormatRecord->advanceState == NULL)


{



*gResult = errPlugInHostInsufficient;



return;


}

 

 



// new for Photoshop 8, big documents, rows and columns are now > 30000 pixels


if (gFormatRecord->HostSupports32BitCoordinates)


        gFormatRecord->PluginUsing32BitCoordinates = true;

 

 

...

}

 

 

 

static void DoReadPrepare()

{

     gFormatRecord->maxData = 0

}

 

static void DoReadContinue (void)

{

 

          int32 done;

          int32 total;

          int32 row;

          VPoint imageSize = GetFormatImageSize();

 

          /* Set up the buffer & progress variables. */

          done = 0;

          total = imageSize.v;

 

    Ptr pixelData        = NULL;

    Ptr rawData          = NULL;

    Ptr uncompressedData = NULL;

    int64* offsetTable   = NULL;

 

 

/* allocate the pixel buffer. */

          unsigned32 bufferSize = gFormatRecord->planes * imageSize.v * imageSize.h;

          pixelData = sPSBuffer->New( &bufferSize, bufferSize );            <======   This allocation fails for file sizes > 2GB & < 4GB.

 

          if (pixelData == NULL)

          {

                    *gResult = memFullErr;

                    //return;

                    if(*gResult == memFullErr) { goto ReadContinueCleanUp; }

          }


Viewing all articles
Browse latest Browse all 54282

Trending Articles