diff options
Diffstat (limited to 'client/decoder.cc')
-rw-r--r-- | client/decoder.cc | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/client/decoder.cc b/client/decoder.cc index ebd5087..c1f3aab 100644 --- a/client/decoder.cc +++ b/client/decoder.cc @@ -159,16 +159,44 @@ void Decoder::pframeRelease() pmutex.unlock(); } -void Decoder::snapshot(char *rgb) +void Decoder::snapshot(unsigned char *rgb) { /* - LibDVWrapper dv; - dv.setOutputBuffer(rgb, DV::BGR0); + R = Y + 1.4075 * (V - 128) + G = Y - (0.3455 * (U - 128) - (0.7169 * (V - 128)) + B = Y + 1.7790 * (U - 128) + */ pmutex.lock(); - dv.decode(pframe); + + unsigned char Y0, Y1, U, V; + + unsigned int byte = 0; + unsigned int pos = 0; + + while(pos < 720*576*4) { + // YUV 4:2:2 packing + // Y0 U0 Y1 V1 Y2 U2 Y3 V3 + // [Y0 U0 V1] [Y1 U0 V1] [Y2 U2 V3] [Y3 U2 V3] + + Y0 = pframe[byte]; byte++; + U = pframe[byte]; byte++; + Y1 = pframe[byte]; byte++; + V = pframe[byte]; byte++; + + rgb[pos+3] = 0; // Alpha + rgb[pos+2] = (unsigned char)(Y0 + 1.4075 * (V - 128)); // Red + rgb[pos+1] = (unsigned char)(Y0 - (0.3455 * (U - 128) - (0.7169 * (V - 128)))); // Green + rgb[pos+0] = (unsigned char)(Y0 + 1.7790 * (U - 128)); // Blue + pos+=4; + + rgb[pos+3] = 0; // Alpha + rgb[pos+2] = (unsigned char)(Y1 + 1.4075 * (V - 128)); // Red + rgb[pos+1] = (unsigned char)(Y1 - (0.3455 * (U - 128) - (0.7169 * (V - 128)))); // Green + rgb[pos+0] = (unsigned char)(Y1 + 1.7790 * (U - 128)); // Blue + pos+=4; + } pmutex.unlock(); - */ } bool Decoder::eventFilter(QObject *o, QEvent *e) @@ -214,3 +242,4 @@ Status Decoder::status() return s; } + |