From 3d236d2e7a6501108a9083196500c009226142a1 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 20 Jul 2006 15:12:12 +0000 Subject: Made decoder use the transcoder for the YUV422 => BRG0 conversion in snapshots. --- client/decoder.cc | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/client/decoder.cc b/client/decoder.cc index c456e78..5fdbd80 100644 --- a/client/decoder.cc +++ b/client/decoder.cc @@ -28,6 +28,8 @@ #include "info.h" +#include "transcoder.h" + #define READ_DV_FROM_FILE #include "dv.h" @@ -164,9 +166,9 @@ void Decoder::pframeRelease() G = Y - (0.3455 * (U - 128) - (0.7169 * (V - 128)) B = Y + 1.7790 * (U - 128) */ -#define RED(y, u, v) (y + 1.4075 * (v - 128)) -#define GREEN(y, u, v) (y - (0.3455 * (u - 128)) - (0.7169 * (v - 128))) -#define BLUE(y, u, v) (y + 1.7790 * (u - 128)) +//#define RED(y, u, v) (y + 1.4075 * (v - 128)) +//#define GREEN(y, u, v) (y - (0.3455 * (u - 128)) - (0.7169 * (v - 128))) +//#define BLUE(y, u, v) (y + 1.7790 * (u - 128)) /* R = 1.164(Y - 16) + 1.596(V - 128) @@ -182,32 +184,12 @@ void Decoder::snapshot(unsigned char *rgb) pmutex.lock(); - 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)RED(Y0, U, V); //(Y0 + 1.4075 * (V - 128)); // Red - rgb[pos+1] = (unsigned char)GREEN(Y0, U, V); //(Y0 - (0.3455 * (U - 128) - (0.7169 * (V - 128)))); // Green - rgb[pos+0] = (unsigned char)BLUE(Y0, U, V); //(Y0 + 1.7790 * (U - 128)); // Blue - pos+=4; + Frame frame(pframe, 720*576*2, VF_YUV422); - rgb[pos+3] = 0; // Alpha - rgb[pos+2] = (unsigned char)RED(Y1, U, V); //(Y1 + 1.4075 * (V - 128)); // Red - rgb[pos+1] = (unsigned char)GREEN(Y1, U, V); //(Y1 - (0.3455 * (U - 128) - (0.7169 * (V - 128)))); // Green - rgb[pos+0] = (unsigned char)BLUE(Y1, U, V); //(Y1 + 1.7790 * (U - 128)); // Blue - pos+=4; + Frame *brg0 = transcode(&frame, VF_BRG0, (char*)rgb, 720*576*4); + if(brg0) delete brg0; // We don't need the actual frameoject + else { + // Some error occurred! } pmutex.unlock(); } -- cgit v1.2.3