/*************************************************************************** * Copyright (C) 2004 by Johan Maes - ON4QZ * * on4qz@telenet.be * * http://users.telenet.be/on4qz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 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 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. * ***************************************************************************/ #include "pdmode.h" #include "configdialog.h" #include "dspfunctions.h" #include "imageview.h" #include "qsstvglobal.h" #include pdMode::pdMode(QObject *parent, const char *name) : modeBase(parent, name) { } pdMode::~pdMode() { } void pdMode::init (sstvMode imode,imageView *p,bool tx,bool initClock) { modeBase::init(imode,p,tx,initClock); visibleLineLength=(((float)(lineTimeTable[9]))/5.-fp-bp-3*blank-syncDuration)/4.; } /*! \fn pdMode::setupLine(int &subln,unsigned char **buf) \brief Decode a PD mode sstv image \param subln every line to display is divided in a number of sublines \param buf pointer to the pixel array. \return next phase off the display */ embState pdMode::setupLine(int &subln,unsigned char **buf) { switch(subln) { case 0: calcPixelPositionTable(YLINEODD,FALSE); *buf=yArray; return PIXELS; case 1: calcPixelPositionTable(REDLINE,FALSE); *buf=redArray; return PIXELS; case 2: calcPixelPositionTable(BLUELINE,FALSE); *buf=blueArray; return PIXELS; case 3: calcPixelPositionTable(YLINEEVEN,FALSE); *buf=greenArray; return PIXELS; case 4: debugPtr->state=stSync; syncPosition=(unsigned int)round(lineTimeTable[lineCounter+1]); return SYNC; default: return ENDOFLINE; } } void pdMode::calcPixelPositionTable(unsigned int colorLine,bool tx) { unsigned int i; int ofx=0; if(tx) ofx=1; double start=0; if(lineCounter!=0) start=lineTimeTable[lineCounter-1]; debugPtr->state=colorLine; switch (colorLine) { case YLINEODD: start+=0; for(i=0;i=activeSSTVParam.numberOfLines) return TRUE; return FALSE; } embState pdMode::txSetupLine(int &subln,unsigned char **buf) { switch(subln) { case 0: calcPixelPositionTable(YLINEODD,TRUE); *buf=yArray; return PIXELS; case 1: txFreq=1500.; txDur=blank; return TXGAP; case 2: calcPixelPositionTable(REDLINE,TRUE); *buf=redArray; return PIXELS; case 3: txFreq=1500; txDur=blank; return TXGAP; case 4: calcPixelPositionTable(BLUELINE,TRUE); *buf=blueArray; return PIXELS; case 5: txFreq=1500; txDur=blank; return TXGAP; case 6: calcPixelPositionTable(YLINEEVEN,TRUE); *buf=greenArray; return PIXELS; case 7: txFreq=1500; txDur=fp; return TXGAP; case 8: txFreq=1200; txDur=syncDuration; return TXGAP; case 9: txFreq=1500; txDur=bp; return TXGAP; default: lineCounter++; return ENDOFLINE; } } void pdMode::getLine() { getLineY(TRUE); }