IWICJpegFrameDecode::SetIndexing method (wincodec.h)

Enables indexing of the JPEG for efficient random access.


HRESULT SetIndexing(
  WICJpegIndexingOptions options,
  UINT                   horizontalIntervalSize



Type: WICJpegIndexingOptions

A value specifying whether indexes should be generated immediately or deferred until a future call to IWICBitmapSource::CopyPixels.


Type: UINT

The granularity of the indexing, in pixels.

Return value


Returns S_OK upon successful completion.


This method enables efficient random-access to the image pixels at the expense of memory usage. The amount of memory required for indexing depends on the requested index granularity. Unless SetIndexing is called, it is much more efficient to access a JPEG by progressing through its pixels top-down during calls to IWICBitmapSource::CopyPixels.

This method will fail if indexing is unsupported on the file. IWICJpegFrameDecode::DoesSupportIndexing should be called to first determine whether indexing is supported. If this method is called multiple times, the final call changes the index granularity to the requested size.

The provided interval size controls horizontal spacing of index entries. This value is internally rounded up according to the JPEG’s MCU (minimum coded unit) size, which is typically either 8 or 16 unscaled pixels. The vertical size of the index interval is always equal to one MCU size.

Indexes can be generated immediately, or during future calls to IWICBitmapSource::CopyPixels to reduce redundant decompression work.


Requirement Value
Minimum supported client Windows 10 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header wincodec.h
Library Windowscodecs.lib
DLL Windowscodecs.dll

See also