//---------------------------------------------------------------------------------------
bool ScoreComparer::are_equal(ImoScore* pA, ImoScore* pB)
{
    //top level method: compares two scores and returns true if both are equal.
    //In case of differences the LCD (longest Common Subsequence) and the
    //SES (Shortest Edit Script) are computed.

    initialize();

    m_pScoreA = pA;
    m_pScoreB = pB;

    m_N = encode(pA, &m_A);
    m_M = encode(pB, &m_B);

    if (encodings_are_equal())
        return true;    //both scores are equal

    //scores are different. Find LCS and SES
    allocate_v_matrix();
    find_lcs();
    if (m_D > 0)
    {
        find_optimal_path();
        compute_differences();
    }
    else
    {
        //nothing in common between both scores
        set_full_differences();
    }

    return false;
}
Exemple #2
0
Fichier : ex10a.c Projet : jd7h/des
//startup code
void startup()
{
    //begin task
    rt_printf("Creating timertask...\n");
    rt_task_create(&timertask,"timertask",0,50,T_JOINABLE);
    rt_printf("Setting period...\n");
    rt_task_set_periodic(&timertask,TM_NOW,PERIOD);
    rt_task_start(&timertask,&timer,NULL);

    /* debug code
    int i;
    for(i = 0;i<MEASUREMENTS;i++)
    {
    	rt_printf("%d\t%u\n",i,exec_times[i]);
    }
    */
    rt_task_join(&timertask);
    compute_differences();
    write_RTIMES("time_diff.csv",MEASUREMENTS-1,exec_diff);
}