Codebase list ohcount / 29f5ec7d-1b44-45ad-9822-90a9c74d506b/main test / src_dir / components.cu
29f5ec7d-1b44-45ad-9822-90a9c74d506b/main

Tree @29f5ec7d-1b44-45ad-9822-90a9c74d506b/main (Download .tar.gz)

components.cu @29f5ec7d-1b44-45ad-9822-90a9c74d506b/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;
}