Codebase list ohcount / 71f18fd0-2918-4673-9432-32d77816000d/main test / src_dir / components.cu
71f18fd0-2918-4673-9432-32d77816000d/main

Tree @71f18fd0-2918-4673-9432-32d77816000d/main (Download .tar.gz)

components.cu @71f18fd0-2918-4673-9432-32d77816000d/mainraw · history · blame

#include <unistd.h>
#include <error.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <assert.h>

#include "components.h"
#include "common.h"

#define THREADS 256

/* Store 3 RGB float components */
__device__ void storeComponents(float *d_r, float *d_g, float *d_b, float r, float g, float b, int pos)
{
    d_r[pos] = (r/255.0f) - 0.5f;
    d_g[pos] = (g/255.0f) - 0.5f;
    d_b[pos] = (b/255.0f) - 0.5f;
}

/* Store 3 RGB intege components */
__device__ void storeComponents(int *d_r, int *d_g, int *d_b, int r, int g, int b, int pos)
{
    d_r[pos] = r - 128;
    d_g[pos] = g - 128;
    d_b[pos] = b - 128;
}