コード例 #1
0
uint8_t ADMVideoMPD3Dlow::configure(AVDMGenericVideoStream *instream)
{

        _in=instream;
        ELEM_TYPE_FLOAT fluma,fchroma,ftemporal;
#define PX(x) &x
#define OOP(x,y) f##x=(ELEM_TYPE_FLOAT )_param->y;
        
        OOP(luma,param1);
        OOP(chroma,param2);
        OOP(temporal,param3);
        
    diaElemFloat   luma(PX(fluma),QT_TR_NOOP("_Spatial luma strength:"),0.,100.);
    diaElemFloat   chroma(PX(fchroma),QT_TR_NOOP("S_patial chroma strength:"),0.,100.);
    diaElemFloat   temporal(PX(ftemporal),QT_TR_NOOP("_Temporal strength:"),0.,100.);
    
       diaElem *elems[3]={&luma,&chroma,&temporal};
  
   if(  diaFactoryRun(QT_TR_NOOP("MPlayer denoise3d"),3,elems))
        {
#undef OOP
#define OOP(x,y) _param->y=(double) f##x
                OOP(luma,param1);
                OOP(chroma,param2);
                OOP(temporal,param3);
          
                setup();
                return 1;
        }
        return 0;
}
コード例 #2
0
uint8_t ADMVideoDropOut::configure(AVDMGenericVideoStream *instream)
{
	_in=instream;
        
         diaElemUInteger chroma(_param,QT_TR_NOOP("DropOut Threshold"),1,255);    
         diaElem *elems[]={&chroma};
  
    return diaFactoryRun(QT_TR_NOOP("Drop Out"),sizeof(elems)/sizeof(diaElem *),elems);
}
コード例 #3
0
uint8_t ADMVideoLargeMedian::configure(AVDMGenericVideoStream * instream)
{
  diaElemToggle luma(&(_param->luma),QT_TR_NOOP("_Process luma"),QT_TR_NOOP("Process luma plane"));
  diaElemToggle chroma(&(_param->chroma),QT_TR_NOOP("P_rocess chroma"));
  
  diaElem *elems[2]={&luma,&chroma};
  
  return diaFactoryRun(QT_TR_NOOP("Large Median 5x5"),2,elems);
  
}
コード例 #4
0
/**
    \fn configure
*/
bool largeMedian::configure(void)
{
  
  diaElemToggle luma(&(param.luma),QT_TRANSLATE_NOOP("largemedian","_Process luma"),QT_TRANSLATE_NOOP("largemedian","Process luma plane"));
  diaElemToggle chroma(&(param.chroma),QT_TRANSLATE_NOOP("largemedian","P_rocess chroma"));
  
  diaElem *elems[2]={&luma,&chroma};
  
  return diaFactoryRun(QT_TRANSLATE_NOOP("largemedian","Fast Convolution"),2,elems);
}
コード例 #5
0
 uint8_t ADMVideoPalShift::configure( AVDMGenericVideoStream *instream) 
{
  
  diaElemToggle chroma(_reverse,QT_TR_NOOP("_Try reverse"));
    
    diaElem *elems[]={&chroma};
  
    return diaFactoryRun(QT_TR_NOOP("Pal Field Shift"),sizeof(elems)/sizeof(diaElem *),elems);

} 
コード例 #6
0
ファイル: TonalChangeDetect.cpp プロジェクト: m0r13/mixxx
size_t
TonalChangeDetect::getPreferredBlockSize() const
{
    if (!m_step) {
        Chromagram chroma(m_config);
        m_step = chroma.getHopSize();
        m_block = chroma.getFrameSize();
    }

    return m_block;
}
コード例 #7
0
uint8_t AVDMFastVideoConvolution::configure(AVDMGenericVideoStream * instream)
{
  
  //return DIA_getLumaChroma(&(_param->luma),&(_param->chroma)) ; 
  diaElemToggle luma(&(_param->luma),QT_TR_NOOP("_Process luma"),QT_TR_NOOP("Process luma plane"));
  diaElemToggle chroma(&(_param->chroma),QT_TR_NOOP("P_rocess chroma"));
  
  diaElem *elems[2]={&luma,&chroma};
  
  return diaFactoryRun(QT_TR_NOOP("Fast Convolution"),2,elems);
}
コード例 #8
0
uint8_t ADMVideoMaskedSoften::configure( AVDMGenericVideoStream *instream)
{
        _in=instream;
        /*uint32_t luma,chroma;
	uint32_t radius;
	*/
        
        diaElemUInteger luma(&(_param->luma),QT_TR_NOOP("_Luma threshold:"),0,255);
        diaElemUInteger chroma(&(_param->chroma),QT_TR_NOOP("C_hroma threshold:"),0,255);
        diaElemUInteger radius(&(_param->radius),QT_TR_NOOP("_Radius:"),1,60);
	  
    diaElem *elems[3]={&luma,&chroma,&radius};
  
    return diaFactoryRun(QT_TR_NOOP("Soften"),3,elems);
}
コード例 #9
0
int ViolinClassification::chromaCompare()
{
    chroma();
    int first = maxIdx(chromaFreq);
    int aa = chromaFreq[first];
    chromaFreq[first] = 0;
    int second = maxIdx(chromaFreq);
    int diff = abs(first - second);
    if (diff > 6)
        diff = NUMCHROMAGRAM - diff;
    if (diff == 2)
        return 1;
    else if (diff == 1 && aa*1.0/chromaFreq[second]<9)
        return 1;
    return 2;
}
コード例 #10
0
void ViolinClassification::getReady(float* gWavDataIn)
{    
    inputData.clear();
    for (int i=0; i<SAMPLESIZE; i++)
        inputData.push_back(gWavDataIn[i]);
    
    if (valid()){
        normalize(inputData);
        chroma();
        getFeatures();
        doClassify();
        //cout<<classLabel<<endl;
    }
    else
        classLabel = "";    
}
コード例 #11
0
uint8_t AVDMVideoVlad::configure( AVDMGenericVideoStream *instream)
{
UNUSED_ARG(instream);
int i,j;

   diaElemUInteger luma(&(_param->ythresholdMask),QT_TR_NOOP("_Luma temporal threshold:"),0,255);
   diaElemUInteger chroma(&(_param->cthresholdMask),QT_TR_NOOP("Ch_roma temporal threshold:"),0,255);
    
    diaElem *elems[]={&luma,&chroma};
  
    if(diaFactoryRun(QT_TR_NOOP("Temporal Cleaner"),sizeof(elems)/sizeof(diaElem *),elems))
    {
      ythresholdMask = (uint64_t)_param->ythresholdMask;
      cthresholdMask = (uint64_t)_param->cthresholdMask;	   

      EXPAND(	ythresholdMask);
      EXPAND(	cthresholdMask);	
      return 1;
    }
    return 0;
}
コード例 #12
0
void KeyFinderWorkerThread::run(){
	if(!haveParams){
		emit failed("No parameters.");
		return;
	}
	// initialise stream and decode file into it
	AudioStream* astrm = NULL;
  AudioFileDecoder* dec = AudioFileDecoder::getDecoder(filePath.toUtf8().data());
	try{
    astrm = dec->decodeFile(filePath.toUtf8().data());
	}catch(Exception){
		delete astrm;
		delete dec;
		emit failed("Could not decode file.");
		return;
	}
	delete dec;
	emit decoded();

	// make audio stream monaural
	astrm->reduceToMono();
	emit madeMono();

	// downsample if necessary
	if(prefs.getDFactor() > 1){
		Downsampler* ds = Downsampler::getDownsampler(prefs.getDFactor(),astrm->getFrameRate(),prefs.getLastFreq());
		try{
			astrm = ds->downsample(astrm,prefs.getDFactor());
		}catch(Exception){
			delete astrm;
			delete ds;
			emit failed("Downsampler failed.");
			return;
		}
		delete ds;
		emit downsampled();
	}

	// start spectrum analysis
	SpectrumAnalyser* sa = NULL;
  Chromagram* ch = NULL;
  sa = SpectrumAnalyserFactory::getInstance()->getSpectrumAnalyser(astrm->getFrameRate(),prefs);
  ch = sa->chromagram(astrm);
  delete astrm; // note we don't delete the spectrum analyser; it stays in the centralised factory for reuse.
  ch->reduceTuningBins(prefs);
	emit producedFullChromagram(*ch);

	// reduce chromagram
	ch->reduceToOneOctave(prefs);
	emit producedOneOctaveChromagram(*ch);

	// get energy level across track to weight segments
	std::vector<float> loudness(ch->getHops());
	for(int h=0; h<ch->getHops(); h++)
		for(int b=0; b<ch->getBins(); b++)
			loudness[h] += ch->getMagnitude(h,b);

	// get harmonic change signal
	Segmentation* hcdf = Segmentation::getSegmentation(prefs);
	std::vector<double> harmonicChangeSignal = hcdf->getRateOfChange(ch,prefs);
	emit producedHarmonicChangeSignal(harmonicChangeSignal);

	// get track segmentation
  std::vector<int> changes = hcdf->getSegments(harmonicChangeSignal,prefs);
  changes.push_back(ch->getHops()); // It used to be getHops()-1. But this doesn't crash. So we like it.

	// batch output of keychange locations for Beatles experiment
	//for(int i=1; i<changes.size(); i++) // don't want the leading zero
	//	std::cout << filePath.substr(53) << "\t" << std::fixed << std::setprecision(2) << changes[i]*(prefs.getHopSize()/(44100.0/prefs.getDFactor())) << std::endl;
	// end experiment output

	// get key estimates for segments
	KeyClassifier hc(prefs);
	std::vector<int> keys(0);
	std::vector<float> keyWeights(24);
  for(int i=0; i<(signed)changes.size()-1; i++){
    std::vector<double> chroma(ch->getBins());
		for(int j=changes[i]; j<changes[i+1]; j++)
			for(int k=0; k<ch->getBins(); k++)
        chroma[k] += ch->getMagnitude(j,k);
    int key = hc.classify(chroma);
    for(int j=changes[i]; j<changes[i+1]; j++){
			keys.push_back(key);
			if(key < 24) // ignore parts that were classified as silent
				keyWeights[key] += loudness[j];
    }
	}
	keys.push_back(keys[keys.size()-1]); // put last key on again to match length of track
	delete ch;
	emit producedKeyEstimates(keys);

	// get global key
	int mostCommonKey = 24;
	float mostCommonKeyWeight = 0.0;
	for(int i=0; i<(signed)keyWeights.size(); i++){
		if(keyWeights[i] > mostCommonKeyWeight){
			mostCommonKeyWeight = keyWeights[i];
			mostCommonKey = i;
		}
	}
	emit producedGlobalKeyEstimate(mostCommonKey);
	return;
}
コード例 #13
0
TEST (KeyClassifierTest, DetectsSilence) {
  KeyFinder::KeyClassifier kc(simCos, tpS, false);
  std::vector<float> chroma(12);
  ASSERT_EQ(KeyFinder::SILENCE, kc.classify(chroma));
}