xoreos  0.0.5
yuv_to_rgb.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef GRAPHICS_YUV_TO_RGB_H
26 #define GRAPHICS_YUV_TO_RGB_H
27 
28 #include "src/common/scopedptr.h"
29 #include "src/common/singleton.h"
30 
31 #include "src/graphics/types.h"
32 
33 namespace Graphics {
34 
35 class YUVToRGBLookup;
36 
37 class YUVToRGBManager : public Common::Singleton<YUVToRGBManager> {
38 public:
43  };
44 
59  void convert420(LuminanceScale scale, byte *dst, int dstPitch, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch);
60 
76  void convert420(LuminanceScale scale, byte *dst, int dstPitch, const byte *ySrc, const byte *uSrc, const byte *vSrc, const byte *aSrc, int yWidth, int yHeight, int yPitch, int uvPitch);
77 
78 private:
82 
84 
86  int16 _colorTab[4 * 256]; // 2048 bytes
87 };
88 
89 } // End of namespace Graphics
90 
91 #define YUVToRGBMan (::Graphics::YUVToRGBManager::instance())
92 
93 #endif // GRAPHICS_YUV_TO_RGB_H
Class and macro for implementing singletons.
LuminanceScale
The scale of the luminance values.
Definition: yuv_to_rgb.h:40
Luminance values range from [0, 255].
Definition: yuv_to_rgb.h:42
void convert420(LuminanceScale scale, byte *dst, int dstPitch, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch)
Convert a YUV420 image to an RGBA surface.
Definition: yuv_to_rgb.cpp:238
Basic graphics types.
int16 _colorTab[4 *256]
Definition: yuv_to_rgb.h:86
int16_t int16
Definition: types.h:201
A simple scoped smart pointer template.
Generic template base class for implementing the singleton design pattern.
Definition: singleton.h:61
Common::ScopedPtr< YUVToRGBLookup > _lookup
Definition: yuv_to_rgb.h:85
A scoped plain pointer, allowing pointer-y access and normal deletion.
Definition: scopedptr.h:120
const YUVToRGBLookup * getLookup(LuminanceScale scale)
Definition: yuv_to_rgb.cpp:184
uint8 byte
Definition: types.h:209