1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*
* dxr3tools.h
*
* Copyright (C) 2004 Christian Gmeiner
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef _DXR3TOOLS_H_
#define _DXR3TOOLS_H_
#include "dxr3vdrincludes.h"
namespace Tools
{
// ==================================
//! convert Rgb to CrCb
inline unsigned int Rgb2YCrCb(unsigned long rgb)
{
float Y,U,V;
float R,G,B;
unsigned int yuv = 0x0;
B = ((rgb >> 16) & 0xFF);
G = ((rgb >> 8) & 0xFF);
R = (rgb & 0xFF);
Y = (0.2578125 * R) + (0.50390625 * G) + (0.09765625 * B) + 16;
U = (0.4375 * R) - (0.3671875 * G) - (0.0703125 * B) + 128;
V =-(0.1484375 * R) - (0.2890625 * G) + (0.4375 * B) + 128;
yuv = (int(Y) << 16) | (int(U) << 8) | int(V);
return yuv;
}
// ==================================
//! write a string via vdr to OSD
inline void WriteInfoToOsd(string x)
{
#if VDRVERSNUM <= 10306
Interface->Info(x.c_str());
#else
Skins.Message(mtInfo, x.c_str());
#endif
}
}
#endif /*_DXR3TOOLS_H_*/
|