From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- mpeglib/lib/util/render/yuvPicture.cpp | 253 +++++++++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 mpeglib/lib/util/render/yuvPicture.cpp (limited to 'mpeglib/lib/util/render/yuvPicture.cpp') diff --git a/mpeglib/lib/util/render/yuvPicture.cpp b/mpeglib/lib/util/render/yuvPicture.cpp new file mode 100644 index 00000000..e79d3bde --- /dev/null +++ b/mpeglib/lib/util/render/yuvPicture.cpp @@ -0,0 +1,253 @@ +/* + describes a picture in yuv format + Copyright (C) 2000 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file COPYRIGHT in this package + + */ + + + +#include "yuvPicture.h" + +#include + +using namespace std; + +static int instanceCnt=0; + +YUVPicture::YUVPicture(int width,int height) { + this->width=width; + this->height=height; + + instance=instanceCnt; + instanceCnt++; + imagePtr=NULL; + + setImageType(PICTURE_YUVMODE_CR_CB); + + + startTimeStamp=new TimeStamp(); + waitTime=new TimeStamp(); + earlyTime=new TimeStamp(); + mpegType=-1; + +} + + +YUVPicture::~YUVPicture() { + delete imagePtr; + delete earlyTime; + delete startTimeStamp; + delete waitTime; +} + + + +int YUVPicture::getHeight() { + return height; +} + + +int YUVPicture::getWidth() { + return width; +} + + + +int YUVPicture::getLumLength() { + return lumLength; +} + + +int YUVPicture::getColorLength() { + return colorLength; +} + +int YUVPicture::getImageSize() { + return imageSize; +} + + + + + + + +void YUVPicture::print(const char* title) { + cout << title <<":"; + printf(" instance:%d ",instance); + printf(" width:%d ",width); + printf(" height:%d ",height); + cout <<" picPerSec:"< "); + } + printf("\n"); + + +} + + +void YUVPicture::setPicturePerSecond(float val) { + this->picPerSec=val; +} + + +float YUVPicture::getPicturePerSecond() { + return picPerSec; +} + + +void YUVPicture::setStartTimeStamp(TimeStamp* aStamp) { + aStamp->copyTo(startTimeStamp); +} + + +TimeStamp* YUVPicture::getStartTimeStamp() { + return startTimeStamp; +} + +void YUVPicture::setWaitTime(TimeStamp* aStamp) { + aStamp->copyTo(waitTime); +} + + +TimeStamp* YUVPicture::getWaitTime() { + return waitTime; +} + +void YUVPicture::setEarlyTime(TimeStamp* earlyTime) { + this->earlyTime=earlyTime; +} + + +TimeStamp* YUVPicture::getEarlyTime() { + return earlyTime; +} + + + +void YUVPicture::setMpegPictureType(int type) { + this->mpegType=type; +} + + +int YUVPicture::getMpegPictureType() { + return mpegType; +} + + +void YUVPicture::setImageType(int imageType) { + + + // + // Reset everything + // + + if (imagePtr != NULL) { + delete [] imagePtr; + imagePtr=NULL; + } + this->imageType=imageType; + + lumLength=0; + colorLength=0; + Cr_mode=NULL; + Cb_mode=NULL; + luminance_mode=NULL; + + + // + // YUV Images + // + if ( (imageType == PICTURE_YUVMODE_CR_CB) || + (imageType == PICTURE_YUVMODE_CB_CR) ) { + + + lumLength=width * height; + colorLength=width * height / 4; + imageSize=lumLength+colorLength+colorLength; + + // the 64 is some "security" space + imagePtr=new unsigned char[imageSize+64]; + + if (imagePtr == NULL) { + cout << "cannot create image"<