Example #1
0
static gboolean
output_equal (MateOutputInfo *output1, MateOutputInfo *output2)
{
    g_assert (output1 != NULL);
    g_assert (output2 != NULL);

    if (!output_match (output1, output2))
	return FALSE;

    if (output1->on != output2->on)
	return FALSE;

    if (output1->on)
    {
	if (output1->width != output2->width)
	    return FALSE;
	
	if (output1->height != output2->height)
	    return FALSE;
	
	if (output1->rate != output2->rate)
	    return FALSE;
	
	if (output1->x != output2->x)
	    return FALSE;
	
	if (output1->y != output2->y)
	    return FALSE;
	
	if (output1->rotation != output2->rotation)
	    return FALSE;
    }

    return TRUE;
}
Example #2
0
void match_naive()
{
	int i, j, k;
	struct timeval start, end;

	#ifdef DEBUG_PRINT
		fprintf(stderr, "Naïve matches:\n");
	#endif

	START_CHRONO;

	#pragma omp for
	for (i = 0; i < n_transactions; i++)
	{
		for (j = 0; j < n_rules; j++)
		{
			for (k = 0; k < TRANSACTIONS_LEN; k++)
			{
				if (transactions[i][k] != rules[j][k] && rules[j][k] != WILDCARD)
					break;

			}

			if (k == TRANSACTIONS_LEN)
				output_match(i, j);

		}
	}

	STOP_CHRONO;

	#ifdef DEBUG_PRINT
		fprintf(stderr, "\n[Naïve] Took %ld ms to match %d transactions (%.2lf transactions per second)!\n", GET_CHRONO, n_transactions, n_transactions * 1000 / (GET_CHRONO + 0.001));
	#endif
}
Example #3
0
/* Match means "these configurations apply to the same hardware
 * setups"
 */
gboolean
mate_rr_config_match (MateRRConfig *c1, MateRRConfig *c2)
{
    int i;

    for (i = 0; c1->outputs[i] != NULL; ++i)
    {
	MateOutputInfo *output1 = c1->outputs[i];
	MateOutputInfo *output2;

	output2 = find_output (c2, output1->name);
	if (!output2 || !output_match (output1, output2))
	    return FALSE;
    }
    
    return TRUE;
}
Example #4
0
static void describe_payload(const uint8_t *data, int size,
                             AVIOContext *out, int *entries,
                             HintSampleQueue *queue)
{
    /* Describe the payload using different constructors */
    while (size > 0) {
        int match_sample, match_offset, match_len, pos;
        if (find_sample_match(data, size, queue, &pos, &match_sample,
                              &match_offset, &match_len) < 0)
            break;
        output_immediate(data, pos, out, entries);
        data += pos;
        size -= pos;
        output_match(out, match_sample, match_offset, match_len, entries);
        data += match_len;
        size -= match_len;
    }
    output_immediate(data, size, out, entries);
}