Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
imageproc.h
Go to the documentation of this file.
1 /*
2  This file is part of Mitsuba, a physically based rendering system.
3 
4  Copyright (c) 2007-2014 by Wenzel Jakob and others.
5 
6  Mitsuba is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Mitsuba is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 #if !defined(__MITSUBA_RENDER_IMAGEPROC_H_)
21 #define __MITSUBA_RENDER_IMAGEPROC_H_
22 
23 #include <mitsuba/core/sched.h>
24 
26 
27 /**
28  * Abstract parallel process, which performs a certain task (to be defined by
29  * the subclass) on the pixels of an image where work on adjacent pixels
30  * is independent. For preview purposes, a spiraling pattern of square
31  * pixel blocks is generated.
32  *
33  * \ingroup librender
34  */
36 public:
37  // ======================================================================
38  //! @{ \name Implementation of the ParallelProcess interface
39  // ======================================================================
40 
41  virtual EStatus generateWork(WorkUnit *unit, int worker);
42 
43  //! @}
44  // ======================================================================
45 
47 protected:
48  /**
49  * Initialize the image process
50  *
51  * \param offset
52  * Integer offset of the image region to be processed
53  * \param size
54  * Size of the image region to be processed
55  * \param blockSize
56  * Size of the generated square pixel blocks
57  */
58  void init(const Point2i &offset, const Vector2i &size, uint32_t blockSize);
59 
60  /// Protected constructor
61  inline BlockedImageProcess() { }
62  /// Virtual destructor
63  virtual ~BlockedImageProcess() { }
64 protected:
65  enum EDirection {
66  ERight = 0,
69  EUp
70  };
71 
73  Vector2i m_size, m_numBlocks;
75  int m_direction, m_numSteps;
76  int m_stepsLeft, m_numBlocksTotal;
79 };
80 
82 
83 #endif /* __MITSUBA_RENDER_IMAGEPROC_H_ */
int m_blockSize
Definition: imageproc.h:78
virtual EStatus generateWork(WorkUnit *unit, int worker)=0
Generate a piece of work.
EDirection
Definition: imageproc.h:65
int m_stepsLeft
Definition: imageproc.h:76
Definition: imageproc.h:35
EStatus
Return codes used by generateWork() and getReturnStatus()
Definition: sched.h:204
Abstract parallelizable task.
Definition: sched.h:197
#define MTS_NAMESPACE_BEGIN
Definition: platform.h:137
Point2i m_offset
Definition: imageproc.h:72
Abstract work unit – represents a small amount of information that encodes part of a larger processin...
Definition: sched.h:47
Definition: imageproc.h:68
Vector2i m_size
Definition: imageproc.h:73
int m_numSteps
Definition: imageproc.h:75
#define MTS_DECLARE_CLASS()
This macro must be used in the initial definition in classes that derive from Object.
Definition: class.h:158
Definition: fwd.h:99
Definition: imageproc.h:67
int m_numBlocksGenerated
Definition: imageproc.h:77
#define MTS_EXPORT_RENDER
Definition: platform.h:109
Definition: fwd.h:95
#define MTS_NAMESPACE_END
Definition: platform.h:138
Point2i m_curBlock
Definition: imageproc.h:74
virtual ~BlockedImageProcess()
Virtual destructor.
Definition: imageproc.h:63