HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //opt/resolve/Developer/DaVinciCTL/Matrix.dctl
// Example to demonstrate the usage of user defined matrix type to transform color

__CONSTANT__ float NORM[] = {1.0f / 3.0f, 1.0f / 3.0f, 1.0f / 3.0f};

typedef struct
{
    float c00, c01, c02;
    float c10, c11, c12;
} Matrix;

__DEVICE__ float2 applyTransformMatrix(const Matrix p_InMatrix, __CONSTANTREF__ float* p_InConstant)
{
    float2 result;
    result.x = _saturatef(p_InMatrix.c00 * p_InConstant[0] + p_InMatrix.c01 * p_InConstant[1] + p_InMatrix.c02 * p_InConstant[2]);
    result.y = _saturatef(p_InMatrix.c10 * p_InConstant[0] + p_InMatrix.c11 * p_InConstant[1] + p_InMatrix.c12 * p_InConstant[2]);
    return result;
}

__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B)
{
    Matrix mat;
    mat.c00 = p_R * 1.2f;
    mat.c01 = p_G * 0.5f;
    mat.c02 = p_B * 0.8f;

    mat.c10 = _logf(p_R);
    mat.c11 = trunc(p_G);
    mat.c12 = _sqrtf(p_B);

    const float2 result = applyTransformMatrix(mat, &NORM[0]);
    const float b = _fmaxf(mat.c02, mat.c12);

    return make_float3(result.x, result.y, b);
}