[Bf-blender-cvs] [02a32419a5b] tmp-ocio-v2: Changed precision to double to match ociov2
Jeroen Bakker
noreply at git.blender.org
Fri Nov 27 09:19:13 CET 2020
Commit: 02a32419a5b2ec69653e0a9c3298b223304d1c68
Author: Jeroen Bakker
Date: Fri Nov 27 09:18:51 2020 +0100
Branches: tmp-ocio-v2
https://developer.blender.org/rB02a32419a5b2ec69653e0a9c3298b223304d1c68
Changed precision to double to match ociov2
===================================================================
M intern/opencolorio/fallback_impl.cc
M intern/opencolorio/ocio_capi.cc
M intern/opencolorio/ocio_capi.h
M intern/opencolorio/ocio_impl.cc
M intern/opencolorio/ocio_impl.h
M source/blender/imbuf/intern/colormanagement.c
===================================================================
diff --git a/intern/opencolorio/fallback_impl.cc b/intern/opencolorio/fallback_impl.cc
index a6b93ac4959..7b4395603f0 100644
--- a/intern/opencolorio/fallback_impl.cc
+++ b/intern/opencolorio/fallback_impl.cc
@@ -155,10 +155,10 @@ struct FallbackTransform {
FallbackTransform *linear_transform;
FallbackTransform *display_transform;
/* Exponent transform. */
- float exponent[4];
+ double exponent[4];
/* Matrix transform. */
- float matrix[16];
- float offset[4];
+ double matrix[16];
+ double offset[4];
MEM_CXX_CLASS_ALLOC_FUNCS("FallbackTransform");
};
@@ -618,7 +618,7 @@ void FallbackImpl::groupTransformSetDirection(OCIO_GroupTransformRcPtr * /*gt*/,
}
void FallbackImpl::groupTransformPushBack(OCIO_GroupTransformRcPtr *gt,
- OCIO_ConstTransformRcPtr *transform)
+ OCIO_TransformRcPtr *transform)
{
FallbackGroupTransform *group = (FallbackGroupTransform *)gt;
group->list.push_back((FallbackTransform *)transform);
@@ -652,10 +652,10 @@ OCIO_ExponentTransformRcPtr *FallbackImpl::createExponentTransform(void)
}
void FallbackImpl::exponentTransformSetValue(OCIO_ExponentTransformRcPtr *et,
- const float *exponent)
+ const double *exponent)
{
FallbackTransform *transform = (FallbackTransform *)et;
- copy_v4_v4(transform->exponent, exponent);
+ copy_v4_v4_db(transform->exponent, exponent);
}
void FallbackImpl::exponentTransformRelease(OCIO_ExponentTransformRcPtr * /*et*/)
@@ -670,25 +670,25 @@ OCIO_MatrixTransformRcPtr *FallbackImpl::createMatrixTransform(void)
}
void FallbackImpl::matrixTransformSetValue(OCIO_MatrixTransformRcPtr *mt,
- const float *m44,
- const float *offset4)
+ const double *m44,
+ const double *offset4)
{
FallbackTransform *transform = (FallbackTransform *)mt;
- copy_m4_m4((float(*)[4])transform->matrix, (float(*)[4])m44);
- copy_v4_v4(transform->offset, offset4);
+ copy_m4_m4_db((double(*)[4])transform->matrix, (double(*)[4])m44);
+ copy_v4_v4_db(transform->offset, offset4);
}
void FallbackImpl::matrixTransformRelease(OCIO_MatrixTransformRcPtr * /*mt*/)
{
}
-void FallbackImpl::matrixTransformScale(float *m44, float *offset4, const float *scale4)
+void FallbackImpl::matrixTransformScale(double *m44, double *offset4, const double *scale4)
{
if (scale4 == NULL) {
return;
}
if (m44 != NULL) {
- memset(m44, 0, 16 * sizeof(float));
+ memset(m44, 0, 16 * sizeof(double));
m44[0] = scale4[0];
m44[5] = scale4[1];
m44[10] = scale4[2];
diff --git a/intern/opencolorio/ocio_capi.cc b/intern/opencolorio/ocio_capi.cc
index 84c36de364c..07b56810e8c 100644
--- a/intern/opencolorio/ocio_capi.cc
+++ b/intern/opencolorio/ocio_capi.cc
@@ -317,7 +317,7 @@ void OCIO_groupTransformSetDirection(OCIO_GroupTransformRcPtr *gt, const bool fo
impl->groupTransformSetDirection(gt, forward);
}
-void OCIO_groupTransformPushBack(OCIO_GroupTransformRcPtr *gt, OCIO_ConstTransformRcPtr *tr)
+void OCIO_groupTransformPushBack(OCIO_GroupTransformRcPtr *gt, OCIO_TransformRcPtr *tr)
{
impl->groupTransformPushBack(gt, tr);
}
@@ -347,7 +347,7 @@ OCIO_ExponentTransformRcPtr *OCIO_createExponentTransform(void)
return impl->createExponentTransform();
}
-void OCIO_exponentTransformSetValue(OCIO_ExponentTransformRcPtr *et, const float *exponent)
+void OCIO_exponentTransformSetValue(OCIO_ExponentTransformRcPtr *et, const double *exponent)
{
impl->exponentTransformSetValue(et, exponent);
}
@@ -363,8 +363,8 @@ OCIO_MatrixTransformRcPtr *OCIO_createMatrixTransform(void)
}
void OCIO_matrixTransformSetValue(OCIO_MatrixTransformRcPtr *mt,
- const float *m44,
- const float *offset4)
+ const double *m44,
+ const double *offset4)
{
impl->matrixTransformSetValue(mt, m44, offset4);
}
@@ -374,7 +374,7 @@ void OCIO_matrixTransformRelease(OCIO_MatrixTransformRcPtr *mt)
impl->matrixTransformRelease(mt);
}
-void OCIO_matrixTransformScale(float *m44, float *offset4, const float *scale4f)
+void OCIO_matrixTransformScale(double *m44, double *offset4, const double *scale4f)
{
impl->matrixTransformScale(m44, offset4, scale4f);
}
diff --git a/intern/opencolorio/ocio_capi.h b/intern/opencolorio/ocio_capi.h
index 57799222788..9343ea7cada 100644
--- a/intern/opencolorio/ocio_capi.h
+++ b/intern/opencolorio/ocio_capi.h
@@ -46,6 +46,7 @@ OCIO_DECLARE_HANDLE(OCIO_ConstContextRcPtr);
OCIO_DECLARE_HANDLE(OCIO_PackedImageDesc);
OCIO_DECLARE_HANDLE(OCIO_DisplayTransformRcPtr);
OCIO_DECLARE_HANDLE(OCIO_ConstTransformRcPtr);
+OCIO_DECLARE_HANDLE(OCIO_TransformRcPtr);
OCIO_DECLARE_HANDLE(OCIO_ColorSpaceTransformRcPtr);
OCIO_DECLARE_HANDLE(OCIO_ExponentTransformRcPtr);
OCIO_DECLARE_HANDLE(OCIO_MatrixTransformRcPtr);
@@ -202,7 +203,7 @@ void OCIO_PackedImageDescRelease(OCIO_PackedImageDesc *p);
OCIO_GroupTransformRcPtr *OCIO_createGroupTransform(void);
void OCIO_groupTransformSetDirection(OCIO_GroupTransformRcPtr *gt, const bool forward);
-void OCIO_groupTransformPushBack(OCIO_GroupTransformRcPtr *gt, OCIO_ConstTransformRcPtr *tr);
+void OCIO_groupTransformPushBack(OCIO_GroupTransformRcPtr *gt, OCIO_TransformRcPtr *tr);
void OCIO_groupTransformRelease(OCIO_GroupTransformRcPtr *gt);
OCIO_ColorSpaceTransformRcPtr *OCIO_createColorSpaceTransform(void);
@@ -210,16 +211,16 @@ void OCIO_colorSpaceTransformSetSrc(OCIO_ColorSpaceTransformRcPtr *ct, const cha
void OCIO_colorSpaceTransformRelease(OCIO_ColorSpaceTransformRcPtr *ct);
OCIO_ExponentTransformRcPtr *OCIO_createExponentTransform(void);
-void OCIO_exponentTransformSetValue(OCIO_ExponentTransformRcPtr *et, const float *exponent);
+void OCIO_exponentTransformSetValue(OCIO_ExponentTransformRcPtr *et, const double *exponent);
void OCIO_exponentTransformRelease(OCIO_ExponentTransformRcPtr *et);
OCIO_MatrixTransformRcPtr *OCIO_createMatrixTransform(void);
void OCIO_matrixTransformSetValue(OCIO_MatrixTransformRcPtr *mt,
- const float *m44,
- const float *offset4);
+ const double *m44,
+ const double *offset4);
void OCIO_matrixTransformRelease(OCIO_MatrixTransformRcPtr *mt);
-void OCIO_matrixTransformScale(float *m44, float *offset4, const float *scale4);
+void OCIO_matrixTransformScale(double *m44, double *offset4, const double *scale4);
int OCIO_supportGLSLDraw(void);
int OCIO_setupGLSLDraw(struct OCIO_GLSLDrawState **state_r,
diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc
index 0e25c89f5d7..38c34f9a990 100644
--- a/intern/opencolorio/ocio_impl.cc
+++ b/intern/opencolorio/ocio_impl.cc
@@ -35,6 +35,7 @@ using namespace OCIO_NAMESPACE;
#include "MEM_guardedalloc.h"
+#include "BLI_math.h"
#include "BLI_math_color.h"
#include "ocio_impl.h"
@@ -805,8 +806,14 @@ OCIO_PackedImageDesc *OCIOImpl::createOCIO_PackedImageDesc(float *data,
{
try {
void *mem = MEM_mallocN(sizeof(PackedImageDesc), __func__);
- PackedImageDesc *id = new (mem) PackedImageDesc(
- data, width, height, numChannels, chanStrideBytes, xStrideBytes, yStrideBytes);
+ PackedImageDesc *id = new (mem) PackedImageDesc(data,
+ width,
+ height,
+ numChannels,
+ BIT_DEPTH_F32,
+ chanStrideBytes,
+ xStrideBytes,
+ yStrideBytes);
return (OCIO_PackedImageDesc *)id;
}
@@ -837,9 +844,9 @@ void OCIOImpl::groupTransformSetDirection(OCIO_GroupTransformRcPtr *gt, const bo
(*(GroupTransformRcPtr *)gt)->setDirection(dir);
}
-void OCIOImpl::groupTransformPushBack(OCIO_GroupTransformRcPtr *gt, OCIO_ConstTransformRcPtr *tr)
+void OCIOImpl::groupTransformPushBack(OCIO_GroupTransformRcPtr *gt, OCIO_TransformRcPtr *tr)
{
- (*(GroupTransformRcPtr *)gt)->push_back(*(ConstTransformRcPtr *)tr);
+ (*(GroupTransformRcPtr *)gt)->appendTransform(*(TransformRcPtr *)tr);
}
void OCIOImpl::groupTransformRelease(OCIO_GroupTransformRcPtr *gt)
@@ -876,9 +883,12 @@ OCIO_ExponentTransformRcPtr *OCIOImpl::createExponentTransform(void)
return (OCIO_ExponentTransformRcPtr *)et;
}
-void OCIOImpl::exponentTransformSetValue(OCIO_ExponentTransformRcPtr *et, const float *exponent)
+void OCIOImpl::exponentTransformSetValue(OCIO_ExponentTransformRcPtr *et, const double *exponent)
{
- (*(ExponentTransformRcPtr *)et)->setValue(exponent);
+ // TODO: should we eliminate this copy?
+ double e[4];
+ copy_v4_v4_db(e, exponent);
+ (*(ExponentTransformRcPtr *)et)->setValue(e);
}
void OCIOImpl::exponentTransformRelease(OCIO_ExponentTransformRcPtr *et)
@@ -896,10 +906,11 @@ OCIO_MatrixTransformRcPtr *OCIOImpl::createMatrixTransform(void)
}
void OCIOImpl::matrixTransformSetValue(OCIO_MatrixTransformRcPtr *mt,
- const float *m44,
- const float *offset4)
+ const double *m44,
+ const double *offset4)
{
- (*(MatrixTransformRcPtr *)mt)->setValue(m44, offset4);
+ (*(MatrixTransformRcPtr *)mt)->setMatrix(m44);
+ (*(MatrixTransformRcPtr *)mt)->setOffset(offset4);
}
void OCIOImpl::matrixTransformRelease(OCIO_MatrixTransformRcPtr *mt)
@@ -907,7 +918,7 @@ void OCIOImpl::matrixTransformRelease(OCIO_MatrixTransformRcPtr *mt)
OBJECT_GUARDED_DELETE((MatrixTransformRcPtr *)mt, MatrixTransformRcPtr);
}
-void OCIOImpl::matrixTransformScale(float *m44, float *offset4, const float *scale4f)
+void OCIOImpl::matrixTransf
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list