MCPcopy Create free account
hub / github.com/ON4QZ/QSSTV / addToChain

Method addToChain

src/sstv/syncprocessor.cpp:697–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

695
696
697bool syncProcessor::addToChain(esstvMode mode, uint fromIdx)
698{
699 int i;
700 double fract;
701 quint16 lineSpacing;
702
703 samplesPerLine=getLineLength(mode,modifiedClock);
704
705 if(!lineCompare(samplesPerLine,fromIdx,syncArrayIndex,lineSpacing,fract))
706 {
707 return false;
708 }
709
710
711 if((syncArray[syncArrayIndex].diffStartEnd()<syncWidth*MINSYNCWIDTHRATIO)
712 || (syncArray[syncArrayIndex].diffStartEnd()>syncWidth*MAXSYNCWIDTHRATIO)
713 || (syncArray[fromIdx].diffStartEnd()<syncWidth*MINSYNCWIDTHRATIO))
714 {
715
716 return false;
717 }
718
719 if (syncArray[fromIdx].diffStartEnd()>syncWidth*MAXSYNCWIDTHRATIO)
720 {
721 if(fromIdx!=0 || !syncArray[0].retrace)
722 {
723 return false;
724 }
725 }
726 if(syncProcesState==MODEDETECT)
727 {
728 if(lineSpacing>sensitivityArray[sensitivity].maxLineDistanceModeDetect)
729 {
730 return false;
731 }
732 }
733
734 bool found=false;
735 if(matchArray[mode].count()==0) // we don't have a chain yet
736 {
737 matchArray[mode].append(new modeMatchList);
738 matchArray[mode][0]->append(new smatchEntry(fromIdx,syncArrayIndex,lineSpacing,fract,syncArray[fromIdx].end,syncArray[syncArrayIndex].end));
739 // addToLog(QString("Match: mode=%1,new chain=%2 syncIndex=%3 end=%4").arg(getSSTVModeNameShort(mode)).arg(matchArray[mode].count()-1).arg(syncArrayIndex).arg(syncArray[syncArrayIndex].end),LOGSYNCMATCH);
740 }
741 else
742 {
743 // can we append this to an existing chain?
744 for(i=0;i<matchArray[mode].count();i++)
745 {
746 if(matchArray[mode][i]->last()->to==fromIdx)
747 {
748 if((syncProcesState==INSYNC) && (i==0) )
749 {
750 currentModeMatchChanged=true;
751 }
752 matchArray[mode][i]->append(new smatchEntry(fromIdx,syncArrayIndex,lineSpacing,fract,syncArray[fromIdx].end,syncArray[syncArrayIndex].end));
753 // addToLog(QString("Match: mode=%1,chain=%2 syncIndex=%3 end=%4").arg(getSSTVModeNameShort(mode)).arg(i).arg(syncArrayIndex).arg(syncArray[syncArrayIndex].end),LOGSYNCMATCH);
754 found=true;

Callers

nothing calls this directly

Calls 4

getLineLengthFunction · 0.85
diffStartEndMethod · 0.80
countMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected