Exemple #1
0
static void
run_multiply()
{
        struct timespec ts_start, ts_stop;
        double runtime_ref, runtime_sse;

        printf("Starting SSE run...\n");
        util_monotonic_time(&ts_start);
        /* vec_c = mat_a * vec_b */
        matvec_sse();
        util_monotonic_time(&ts_stop);
        runtime_sse = util_time_diff(&ts_start, &ts_stop);
        printf("SSE run completed in %.2f s\n",
               runtime_sse);

        printf("Starting reference run...\n");
        util_monotonic_time(&ts_start);
	matvec_ref();
        util_monotonic_time(&ts_stop);
        runtime_ref = util_time_diff(&ts_start, &ts_stop);
        printf("Reference run completed in %.2f s\n",
               runtime_ref);

        printf("Speedup: %.2f\n",
               runtime_ref / runtime_sse);


	if (verify_result())
	    printf("OK\n");
	else
	    printf("MISMATCH\n");
}
Exemple #2
0
static int pause_toggle_sdl(video_player_h h)
{
    player_ctx_t *ctx = (player_ctx_t *)h;

    if (!ctx)
        return 0;

    if (ctx->common.state == PLAYER_PAUSE)
    {
        struct timespec end_pause;
        uint32_t diff;

        ctx->common.state = PLAYER_PLAY;
        clock_gettime(CLOCK_MONOTONIC, &end_pause);
        diff = util_time_diff(&end_pause, &ctx->common.start_pause);
        util_time_add(&ctx->common.base_time, diff);
    }
    else
    {
        ctx->common.state = PLAYER_PAUSE;
        clock_gettime(CLOCK_MONOTONIC, &ctx->common.start_pause);
    }

    return (ctx->common.state == PLAYER_PAUSE);
}
Exemple #3
0
static ret_code_t schedule_sdl(video_player_h h, media_buffer_t *buf)
{
    player_ctx_t *ctx = (player_ctx_t *)h;

    if (ctx->common.first_pkt)
    {
        clock_gettime(CLOCK_MONOTONIC, &ctx->common.base_time);
        ctx->common.first_pkt = 0;
    }
    else if (buf->pts_ms != AV_NOPTS_VALUE)
    {
        struct timespec curr_time;
        int diff;

        clock_gettime(CLOCK_MONOTONIC, &curr_time);
        diff = util_time_diff(&curr_time, &ctx->common.base_time);
        DBG_V("Current PTS=%lld time diff=%d\n", buf->pts_ms, diff);
        if (diff > 0 && buf->pts_ms > diff)
        {
            diff = buf->pts_ms - diff;
            if (diff > 5000)
            {
                DBG_W("The frame requests %d msec wait. Drop it and continue\n", diff);
                decode_release_video_buffer(ctx->common.demux_ctx, buf);
                return L_FAILED;
            }
            DBG_V("Going to sleep for %d ms\n", diff);
            msleep_wait(ctx->common.sched, diff);
        }
    }
    return L_OK;
}