Codebase list ohcount / 6ef9399e-69b6-464b-98a8-52915e284046/upstream test / src_dir / components.cu
6ef9399e-69b6-464b-98a8-52915e284046/upstream

Tree @6ef9399e-69b6-464b-98a8-52915e284046/upstream (Download .tar.gz)

components.cu @6ef9399e-69b6-464b-98a8-52915e284046/upstreamraw · 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;
}