summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraustriancoder <austriancoder>2004-10-10 20:40:08 +0000
committeraustriancoder <austriancoder>2004-10-10 20:40:08 +0000
commitea3e8d835857c20c740df03a9cb609f961944ae8 (patch)
treec29bb0f0c70dfe0b9b093b8ba8b48131e2ffb237
parentfd1596b10c8cc19856c8834f22ed33a2eb73c469 (diff)
downloadvdr-plugin-dxr3-ea3e8d835857c20c740df03a9cb609f961944ae8.tar.gz
vdr-plugin-dxr3-ea3e8d835857c20c740df03a9cb609f961944ae8.tar.bz2
YUV2Rgb is back
-rw-r--r--dxr3tools.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/dxr3tools.h b/dxr3tools.h
index 03708bf..5a8c890 100644
--- a/dxr3tools.h
+++ b/dxr3tools.h
@@ -48,8 +48,46 @@ namespace Tools
}
// ==================================
+ //! convert YUV to Rgb
+ inline unsigned int YUV2Rgb(unsigned int yuv_color)
+ {
+ int Y, Cb, Cr;
+ int Ey, Epb, Epr;
+ int Eg, Eb, Er;
+
+ Y = (yuv_color >> 16) & 0xff;
+ Cb = (yuv_color) & 0xff;
+ Cr = (yuv_color >> 8) & 0xff;
+
+ Ey = (Y - 16);
+ Epb = (Cb - 128);
+ Epr = (Cr - 128);
+
+ Eg = (298 * Ey - 100 * Epb - 208 * Epr) / 256;
+ Eb = (298 * Ey + 516 * Epb) / 256;
+ Er = (298 * Ey + 408 * Epr) / 256;
+
+ if (Eg > 255)
+ Eg = 255;
+ if (Eg < 0)
+ Eg = 0;
+
+ if (Eb > 255)
+ Eb = 255;
+ if (Eb < 0)
+ Eb = 0;
+
+ if (Er > 255)
+ Er = 255;
+ if (Er < 0)
+ Er = 0;
+
+ return Eb | (Eg << 8) | (Er << 16);
+ }
+
+ // ==================================
//! write a string via vdr to OSD
- inline void WriteInfoToOsd(string x)
+ inline void WriteInfoToOsd(std::string x)
{
#if VDRVERSNUM <= 10306
Interface->Info(x.c_str());