dng_area_task Class Reference

Abstract class for rectangular processing operations with support for partitioning across multiple processing resources and observing memory constraints. More...

#include <dng_area_task.h>

Inheritance diagram for dng_area_task:

dng_filter_task

List of all members.


Public Member Functions

virtual uint32 MaxThreads () const
virtual uint32 MinTaskArea () const
virtual dng_point UnitCell () const
virtual dng_point MaxTileSize () const
virtual dng_rect RepeatingTile1 () const
virtual dng_rect RepeatingTile2 () const
virtual dng_rect RepeatingTile3 () const
virtual void Start (uint32 threadCount, const dng_point &tileSize, dng_memory_allocator *allocator, dng_abort_sniffer *sniffer)
virtual void Process (uint32 threadIndex, const dng_rect &tile, dng_abort_sniffer *sniffer)=0
virtual void Finish (uint32 threadCount)
dng_point FindTileSize (const dng_rect &area) const
void ProcessOnThread (uint32 threadIndex, const dng_rect &area, const dng_point &tileSize, dng_abort_sniffer *sniffer)

Static Public Member Functions

static void Perform (dng_area_task &task, const dng_rect &area, dng_memory_allocator *allocator, dng_abort_sniffer *sniffer)

Protected Attributes

uint32 fMaxThreads
uint32 fMinTaskArea
dng_point fUnitCell
dng_point fMaxTileSize

Detailed Description

Abstract class for rectangular processing operations with support for partitioning across multiple processing resources and observing memory constraints.

Member Function Documentation

dng_point dng_area_task::FindTileSize ( const dng_rect &  area  )  const

Find tile size taking into account repeating tiles, unit cell, and maximum tile size.

Parameters:
area Computation area for which to find tile size.
Return values:
Tile size as height and width in point.

References MaxTileSize(), RepeatingTile1(), RepeatingTile2(), RepeatingTile3(), and UnitCell().

Referenced by Perform().

void dng_area_task::Finish ( uint32  threadCount  )  [virtual]

Task computation finalization and teardown method. Called after all resources have completed processing. Can be overridden to accumulate results and free resources allocated in Start.

Parameters:
threadCount Number of threads used for processing. Same as value passed to Start.

Referenced by Perform().

virtual uint32 dng_area_task::MaxThreads (  )  const [inline, virtual]

Getter for the maximum number of threads (resources) that can be used for processing

Return values:
Number of threads, minimum of 1, that can be used for this task.

virtual dng_point dng_area_task::MaxTileSize (  )  const [inline, virtual]

Getter for maximum size of a tile for processing. Often processing will need to allocate temporary buffers or use other resources that are either fixed or in limited supply. The maximum tile size forces further partitioning if the tile is bigger than this size.

Return values:
Maximum tile size allowed for this area task.

Referenced by FindTileSize().

virtual uint32 dng_area_task::MinTaskArea (  )  const [inline, virtual]

Getter for minimum area of a partitioned rectangle. Often it is not profitable to use more resources if it requires partitioning the input into chunks that are too small, as the overhead increases more than the speedup. This method can be ovreridden for a specific task to indicate the smallest area for partitioning. Default is 256x256 pixels.

Return values:
Minimum area for a partitoned tile in order to give performant operation. (Partitions can be smaller due to small inputs and edge cases.)

void dng_area_task::Perform ( dng_area_task task,
const dng_rect &  area,
dng_memory_allocator allocator,
dng_abort_sniffer sniffer 
) [static]

Default resource partitioner that assumes a single resource to be used for processing. Implementations that are aware of multiple processing resources should override (replace) this method. This is usually done in dng_host::PerformAreaTask .

Parameters:
task The task to perform.
area The area on which mage processing should be performed.
allocator dng_memory_allocator to use for allocating temporary buffers, etc.
sniffer dng_abort_sniffer to use to check for user cancellation and progress updates.

References FindTileSize(), Finish(), ProcessOnThread(), and Start().

Referenced by dng_host::PerformAreaTask().

virtual void dng_area_task::Process ( uint32  threadIndex,
const dng_rect &  tile,
dng_abort_sniffer sniffer 
) [pure virtual]

Process one tile or fully partitioned area. This method is overridden by derived classes to implement the actual image processing. Note that the sniffer can be ignored if it is certain that a processing task will complete very quickly. This method should never be called directly but rather accessed via Process. There is no allocator parameter as all allocation should be done in Start.

Parameters:
threadIndex 0 to threadCount - 1 index indicating which thread this is. (Can be used to get a thread-specific buffer allocated in the Start method.)
tile Area to process.
sniffer dng_abort_sniffer to use to check for user cancellation and progress updates.

Implemented in dng_filter_task.

Referenced by ProcessOnThread().

void dng_area_task::ProcessOnThread ( uint32  threadIndex,
const dng_rect &  area,
const dng_point &  tileSize,
dng_abort_sniffer sniffer 
)

Handle one resource's worth of partitioned tiles. Called after thread partitioning has already been done. Area may be further subdivided to handle maximum tile size, etc. It will be rare to override this method.

Parameters:
threadIndex 0 to threadCount - 1 index indicating which thread this is.
area Tile area partitioned to this resource.
tileSize 
sniffer dng_abort_sniffer to use to check for user cancellation and progress updates.

References Process(), RepeatingTile1(), RepeatingTile2(), RepeatingTile3(), and dng_abort_sniffer::SniffForAbort().

Referenced by Perform().

dng_rect dng_area_task::RepeatingTile1 (  )  const [virtual]

Getter for RepeatingTile1. RepeatingTile1, RepeatingTile2, and RepeatingTile3 are used to establish a set of 0 to 3 tile patterns for which the resulting partitions that the final Process method is called on will not cross tile boundaries in any of the tile patterns. This can be used for a processing routine that needs to read from two tiles and write to a third such that all the tiles are aligned and sized in a certain way. A RepeatingTile value is valid if it is non-empty. Higher numbered RepeatingTile patterns are only used if all lower ones are non-empty. A RepeatingTile pattern must be a multiple of UnitCell in size for all constraints of the partitionerr to be met.

Referenced by FindTileSize(), and ProcessOnThread().

dng_rect dng_area_task::RepeatingTile2 (  )  const [virtual]

Getter for RepeatingTile2. RepeatingTile1, RepeatingTile2, and RepeatingTile3 are used to establish a set of 0 to 3 tile patterns for which the resulting partitions that the final Process method is called on will not cross tile boundaries in any of the tile patterns. This can be used for a processing routine that needs to read from two tiles and write to a third such that all the tiles are aligned and sized in a certain way. A RepeatingTile value is valid if it is non-empty. Higher numbered RepeatingTile patterns are only used if all lower ones are non-empty. A RepeatingTile pattern must be a multiple of UnitCell in size for all constraints of the partitionerr to be met.

Referenced by FindTileSize(), and ProcessOnThread().

dng_rect dng_area_task::RepeatingTile3 (  )  const [virtual]

Getter for RepeatingTile3. RepeatingTile1, RepeatingTile2, and RepeatingTile3 are used to establish a set of 0 to 3 tile patterns for which the resulting partitions that the final Process method is called on will not cross tile boundaries in any of the tile patterns. This can be used for a processing routine that needs to read from two tiles and write to a third such that all the tiles are aligned and sized in a certain way. A RepeatingTile value is valid if it is non-empty. Higher numbered RepeatingTile patterns are only used if all lower ones are non-empty. A RepeatingTile pattern must be a multiple of UnitCell in size for all constraints of the partitionerr to be met.

Referenced by FindTileSize(), and ProcessOnThread().

void dng_area_task::Start ( uint32  threadCount,
const dng_point &  tileSize,
dng_memory_allocator allocator,
dng_abort_sniffer sniffer 
) [virtual]

Task startup method called before any processing is done on partitions. The Start method is called before any processing is done and can be overridden to allocate temporary buffers, etc.

Parameters:
threadCount Total number of threads that will be used for processing. Less than or equal to MaxThreads.
tileSize Size of source tiles which will be processed. (Not all tiles will be this size due to edge conditions.)
allocator dng_memory_allocator to use for allocating temporary buffers, etc.
sniffer Sniffer to test for user cancellation and to set up progress.

Reimplemented in dng_filter_task.

Referenced by Perform().

virtual dng_point dng_area_task::UnitCell (  )  const [inline, virtual]

Getter for dimensions of which partitioned tiles should be a multiple. Various methods of processing prefer certain alignments. The partitioning attempts to construct tiles such that the sizes are a multiple of the dimensions of this point.

Return values:
a point giving preferred alignment in x and y

Referenced by FindTileSize().


The documentation for this class was generated from the following files:

Copyright © 2006-2009 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google