LJp2FileFormat::ExtractFramesBufferMemory

#include "ltwrappr.h"

L_INT LJp2FileFormat::ExtractFramesBufferMemory(pBuffer, uBufferSize, lpBuffer, puBufferSize, puFrames, uNumOfFrames)

L_UINT8 * pBuffer;

pointer to a JPEG 2000 file in memory

L_SIZE_T uBufferSize;

size of the file in memory (in bytes)

L_UINT8 ** lpBuffer;

pointer to a pointer

L_SIZE_T * puBufferSize;

pointer to a variable to be updated

L_UINT32 * puFrames;

frames indices

L_UINT32 uNumOfFrames;

number of frames to be extracted

Extracts the frames that are specified by puFrames from the JPEG 2000 file in memory and save them into a new JPEG 2000 file in a memory buffer that is allocated by the function contains only the extracted frames headers and codestreams directly not through decompressing/compressing process.  

Parameter

Description

pBuffer

Pointer to the JPEG 2000 file in memory to extract frames from it.

uBufferSize

Size of the in memory (in bytes).

lpBuffer

Pointer to a pointer to be updated with an array of bytes that contains a JPEG 2000 file with extracted frames only. You must free this buffer by calling the Windows LocalFree() function.

puBufferSize

Address of a variable to be updated with the size of the memory buffer in bytes.

puFrames

Array of unsigned integers specifies the indices of the frames to be extracted from the input JPEG 2000 file. All indices shall be 0-based. If any frames index is out the frames number the function will return ERROR_INV_PARAMETER.

uNumOfFrames

Number of frames to be extracted. This field specifies the size of puFrames array.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

LJp2FileFormat::ExtractFramesBufferMemory extracts the specified frames from the JPEG 2000 file in memory and save them into a new JPEG 2000 file in a memory buffer that is allocated by the function contains only the extracted frames headers and codestreams directly not through decompressing/compressing process so it saves processor time and memory. This function is very suitable to server application where multiple clients request specific frames of a JPEG 2000 file so instead of decompressing then compressing the frames this function copies only the needed frames data to generate them and saves the data into a new JPEG 2000 file in a memory buffer.

Required DLLs and Libraries

LTJP2
LFJ2K
LTIMGEFX

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LJp2FileFormat::ExtractFrames, LJp2FileFormat::ExtractFramesBuffer, LJp2FileFormat::AppendFrames, LJp2FileFormat::AppendGMLData, LJp2FileFormat::ReadBox, LJp2FileFormat::ReadGMLData, LJp2FileFormat::ReadFrames, LJp2FileFormat::FragmentJpxFile

Topics:

Implementing JPEG 2000 Features

 

Raster Image Functions: Working with JPEG 2000

 

Programming with JPX Features

 

JPX File Comments

 

Raster Image Functions: Working with JPX

Example

This example extracts a frame from JPX file.

L_INT LJp2FileFormat__ExtractFramesBufferMemoryExample(L_UINT8* pFileBuffer, L_SIZE_T uFileSize, L_UINT8** lpFrameBuffer, L_SIZE_T * puFrameSize) 
{ 
   L_INT nRet = 0; 
   LJp2FileFormat Engine; 
   L_JP2_FILEINFO Jp2FileInfo; 
   L_UINT32 puFrames[1]; 
    
   *lpFrameBuffer = NULL; 
   *puFrameSize = 0; 
 
   Jp2FileInfo.uStructSize = sizeof(L_JP2_FILEINFO); 
   nRet = Engine.GetFileInfoMemory( pFileBuffer, uFileSize, &Jp2FileInfo); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /*Extract the second frame*/ 
   puFrames[0] = 0; 
 
   nRet = Engine.ExtractFramesBufferMemory( pFileBuffer, uFileSize, lpFrameBuffer, puFrameSize, puFrames, 1); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /*Free File Info structure*/ 
   nRet = Engine.FreeFileInfo( &Jp2FileInfo); 
   if(nRet != SUCCESS) 
      return nRet; 
    
   return SUCCESS; 
} 

Help Version 20.0.2019.9.23
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help