Status SceneAnalyzerP::AnalyzeFrame(SceneAnalyzerFrame *pRef, SceneAnalyzerFrame *pSrc)
{
    bool bSceneChangeDetected;

    // do entire frame analyzis
    AnalyzePicture(&(pRef->m_scaledPic), &(pSrc->m_scaledPic));
    bSceneChangeDetected = pSrc->m_scaledPic.m_bChangeDetected;

    if (PS_PROGRESSIVE != m_params.m_interlaceType)
    {
        Ipp32s frameDev, fieldDev;

        // analyze frame as PROGRESSIVE
        AnalyzePicture(pSrc);
        frameDev = pSrc->m_info.averageDev[SA_INTRA];
        // analyze both fields
        AnalyzePicture(pSrc->m_fields + 0);
        AnalyzePicture(pSrc->m_fields + 1);
        fieldDev = (pSrc->m_fields[0].m_info.averageDev[SA_INTRA] +
                    pSrc->m_fields[1].m_info.averageDev[SA_INTRA] + 1) / 2;

        // compare dispersion of information
        if (frameDev <= fieldDev)
        {
            // it seems to be a frame
            pSrc->m_frameStructure = PS_PROGRESSIVE;
            // this frame does not depend on the structure
            // of the references
            if (bSceneChangeDetected)
            {
                pSrc->m_frameEstimation = PS_PROGRESSIVE;
            }
            // this frame should estimate like structure of the reference frame
            else
            {
                pSrc->m_frameEstimation = pRef->m_frameStructure;
            }
        }
        else
        {
            // it seems to be a couple of fields
            pSrc->m_frameEstimation = pSrc->m_frameStructure;
        }
    }

    // restore frame detection state
    pSrc->m_bChangeDetected = bSceneChangeDetected;

    return UMC_OK;

} // Status SceneAnalyzerP::AnalyzeFrame(SceneAnalyzerFrame *pRef, SceneAnalyzerFrame *pSrc)
Exemplo n.º 2
0
Main::Main(String &outputPath)
{

	// Loop through objects and draw boxes
	Array<String> photofiles;
	String iDir = ".", processedDir = "processed/";
	while (true) {
		FileIO::scanDirForFiles("*.jpg", photofiles, iDir, true);
		int lastTime = clock();
		for (unsigned int j = 0; j < photofiles.size(); j++)
		{
			printf("Processing %s\n",photofiles[j].c_str());

			String root = String(photofiles[j]).replace(".jpg", "");

			AnalyzePicture(root, outputPath);

			printf("Time to process %s was %ld\n\n", photofiles[j].c_str(), (int)clock() - lastTime);
			lastTime = clock();
			String newFileName = processedDir + photofiles[j];
			remove(newFileName.c_str());
			rename(photofiles[j].c_str(), newFileName.c_str());
		}
		photofiles.clear();
		Sleep(1000);
	}
}
Status SceneAnalyzerP::AnalyzeFrame(SceneAnalyzerFrame *pSrc)
{
    // do entire frame analyzis
    AnalyzePicture(&(pSrc->m_scaledPic));

    if(PS_PROGRESSIVE != m_params.m_interlaceType)
    {
        Ipp32s frameDev, fieldDev;

        // analyze frame as PROGRESSIVE
        AnalyzePicture(pSrc);
        frameDev = pSrc->m_info.sumDev[SA_INTRA];
        // analyze both fields
        AnalyzePicture(pSrc->m_fields + 0);
        AnalyzePicture(pSrc->m_fields + 1);
        fieldDev = pSrc->m_fields[0].m_info.sumDev[SA_INTRA] +
                   pSrc->m_fields[1].m_info.sumDev[SA_INTRA];

        // compare dispersion of information
        if (frameDev <= fieldDev)
        {
            // it seems to be a frame
            pSrc->m_frameStructure = PS_PROGRESSIVE;
            pSrc->m_frameEstimation = PS_PROGRESSIVE;
        }
        else
        {
            // it seems to be a couple of fields
            pSrc->m_frameEstimation = pSrc->m_frameStructure;
        }
    }

    // restore frame detection state
    pSrc->m_bChangeDetected = true;

    return UMC_OK;

} // Status SceneAnalyzerP::AnalyzeFrame(SceneAnalyzerFrame *pSrc)