2012-09-15 10:03:17 +00:00
|
|
|
/*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2012 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Brecht van Lommel
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
#include "BLI_math_color.h"
|
|
|
|
|
2012-10-04 13:39:08 +00:00
|
|
|
#include "ocio_impl.h"
|
2012-09-15 10:03:17 +00:00
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
#define CONFIG_DEFAULT ((OCIO_ConstConfigRcPtr*)1)
|
2012-09-15 10:03:17 +00:00
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
#define PROCESSOR_LINEAR_TO_SRGB ((OCIO_ConstProcessorRcPtr*)1)
|
|
|
|
#define PROCESSOR_SRGB_TO_LINEAR ((OCIO_ConstProcessorRcPtr*)2)
|
|
|
|
#define PROCESSOR_UNKNOWN ((OCIO_ConstProcessorRcPtr*)3)
|
2012-09-15 10:03:17 +00:00
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
#define COLORSPACE_LINEAR ((OCIO_ConstColorSpaceRcPtr*)1)
|
|
|
|
#define COLORSPACE_SRGB ((OCIO_ConstColorSpaceRcPtr*)2)
|
2012-09-15 10:03:17 +00:00
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
typedef struct OCIO_PackedImageDescription {
|
2012-09-15 10:03:17 +00:00
|
|
|
float *data;
|
|
|
|
long width;
|
|
|
|
long height;
|
|
|
|
long numChannels;
|
|
|
|
long chanStrideBytes;
|
|
|
|
long xStrideBytes;
|
|
|
|
long yStrideBytes;
|
2012-10-05 10:05:26 +00:00
|
|
|
} OCIO_PackedImageDescription;
|
2012-09-15 10:03:17 +00:00
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstConfigRcPtr *FallbackImpl::getCurrentConfig(void)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return CONFIG_DEFAULT;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::setCurrentConfig(const OCIO_ConstConfigRcPtr *)
|
2012-09-16 15:17:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstConfigRcPtr *FallbackImpl::configCreateFromEnv(void)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return CONFIG_DEFAULT;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstConfigRcPtr *FallbackImpl::configCreateFromFile(const char *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return CONFIG_DEFAULT;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::configRelease(OCIO_ConstConfigRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int FallbackImpl::configGetNumColorSpaces(OCIO_ConstConfigRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *FallbackImpl::configGetColorSpaceNameByIndex(OCIO_ConstConfigRcPtr *, int index)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
if (index == 0)
|
|
|
|
return "Linear";
|
|
|
|
else if (index == 1)
|
|
|
|
return "sRGB";
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstColorSpaceRcPtr *FallbackImpl::configGetColorSpace(OCIO_ConstConfigRcPtr *, const char *name)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
if (strcmp(name, "scene_linear") == 0)
|
|
|
|
return COLORSPACE_LINEAR;
|
|
|
|
else if (strcmp(name, "color_picking") == 0)
|
|
|
|
return COLORSPACE_SRGB;
|
|
|
|
else if (strcmp(name, "texture_paint") == 0)
|
|
|
|
return COLORSPACE_LINEAR;
|
|
|
|
else if (strcmp(name, "default_byte") == 0)
|
|
|
|
return COLORSPACE_SRGB;
|
|
|
|
else if (strcmp(name, "default_float") == 0)
|
|
|
|
return COLORSPACE_LINEAR;
|
|
|
|
else if (strcmp(name, "default_sequencer") == 0)
|
|
|
|
return COLORSPACE_SRGB;
|
|
|
|
else if (strcmp(name, "Linear") == 0)
|
|
|
|
return COLORSPACE_LINEAR;
|
|
|
|
else if (strcmp(name, "sRGB") == 0)
|
|
|
|
return COLORSPACE_SRGB;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int FallbackImpl::configGetIndexForColorSpace(OCIO_ConstConfigRcPtr *config, const char *name)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstColorSpaceRcPtr *cs = configGetColorSpace(config, name);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
if (cs == COLORSPACE_LINEAR)
|
|
|
|
return 0;
|
|
|
|
else if (cs == COLORSPACE_SRGB)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *FallbackImpl::configGetDefaultDisplay(OCIO_ConstConfigRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return "sRGB";
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int FallbackImpl::configGetNumDisplays(OCIO_ConstConfigRcPtr* config)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *FallbackImpl::configGetDisplay(OCIO_ConstConfigRcPtr *, int index)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
if (index == 0)
|
|
|
|
return "sRGB";
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *FallbackImpl::configGetDefaultView(OCIO_ConstConfigRcPtr *, const char *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return "Default";
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int FallbackImpl::configGetNumViews(OCIO_ConstConfigRcPtr *, const char *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *FallbackImpl::configGetView(OCIO_ConstConfigRcPtr *, const char *, int index)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
if (index == 0)
|
|
|
|
return "Default";
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *FallbackImpl::configGetDisplayColorSpaceName(OCIO_ConstConfigRcPtr *, const char *, const char *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return "sRGB";
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int FallbackImpl::colorSpaceIsInvertible(OCIO_ConstColorSpaceRcPtr *cs)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int FallbackImpl::colorSpaceIsData(OCIO_ConstColorSpaceRcPtr *cs)
|
2012-09-19 15:01:36 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::colorSpaceRelease(OCIO_ConstColorSpaceRcPtr *cs)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstProcessorRcPtr *FallbackImpl::configGetProcessorWithNames(OCIO_ConstConfigRcPtr *config, const char *srcName, const char *dstName)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstColorSpaceRcPtr *cs_src = configGetColorSpace(config, srcName);
|
|
|
|
OCIO_ConstColorSpaceRcPtr *cs_dst = configGetColorSpace(config, dstName);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
if (cs_src == COLORSPACE_LINEAR && cs_dst == COLORSPACE_SRGB)
|
|
|
|
return PROCESSOR_LINEAR_TO_SRGB;
|
|
|
|
else if (cs_src == COLORSPACE_SRGB && cs_dst == COLORSPACE_LINEAR)
|
|
|
|
return PROCESSOR_SRGB_TO_LINEAR;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstProcessorRcPtr *FallbackImpl::configGetProcessor(OCIO_ConstConfigRcPtr *, OCIO_ConstTransformRcPtr *tfm)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_ConstProcessorRcPtr*)tfm;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::processorApply(OCIO_ConstProcessorRcPtr *processor, OCIO_PackedImageDesc *img)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
/* OCIO_TODO stride not respected, channels must be 3 or 4 */
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_PackedImageDescription *desc = (OCIO_PackedImageDescription*)img;
|
2012-09-15 10:03:17 +00:00
|
|
|
int channels = desc->numChannels;
|
|
|
|
float *pixels = desc->data;
|
|
|
|
int width = desc->width;
|
|
|
|
int height = desc->height;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) {
|
|
|
|
for (x = 0; x < width; x++) {
|
|
|
|
float *pixel = pixels + channels * (y * width + x);
|
|
|
|
|
|
|
|
if (channels == 4)
|
2012-10-04 13:39:08 +00:00
|
|
|
processorApplyRGBA(processor, pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
else if (channels == 3)
|
2012-10-04 13:39:08 +00:00
|
|
|
processorApplyRGB(processor, pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::processorApply_predivide(OCIO_ConstProcessorRcPtr *processor, OCIO_PackedImageDesc *img)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
/* OCIO_TODO stride not respected, channels must be 3 or 4 */
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_PackedImageDescription *desc = (OCIO_PackedImageDescription*)img;
|
2012-09-15 10:03:17 +00:00
|
|
|
int channels = desc->numChannels;
|
|
|
|
float *pixels = desc->data;
|
|
|
|
int width = desc->width;
|
|
|
|
int height = desc->height;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) {
|
|
|
|
for (x = 0; x < width; x++) {
|
|
|
|
float *pixel = pixels + channels * (y * width + x);
|
|
|
|
|
|
|
|
if (channels == 4)
|
2012-10-04 13:39:08 +00:00
|
|
|
processorApplyRGBA_predivide(processor, pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
else if (channels == 3)
|
2012-10-04 13:39:08 +00:00
|
|
|
processorApplyRGB(processor, pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::processorApplyRGB(OCIO_ConstProcessorRcPtr *processor, float *pixel)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
if (processor == PROCESSOR_LINEAR_TO_SRGB)
|
|
|
|
linearrgb_to_srgb_v3_v3(pixel, pixel);
|
|
|
|
else if (processor == PROCESSOR_SRGB_TO_LINEAR)
|
|
|
|
srgb_to_linearrgb_v3_v3(pixel, pixel);
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::processorApplyRGBA(OCIO_ConstProcessorRcPtr *processor, float *pixel)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
if (processor == PROCESSOR_LINEAR_TO_SRGB)
|
|
|
|
linearrgb_to_srgb_v4(pixel, pixel);
|
|
|
|
else if (processor == PROCESSOR_SRGB_TO_LINEAR)
|
|
|
|
srgb_to_linearrgb_v4(pixel, pixel);
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::processorApplyRGBA_predivide(OCIO_ConstProcessorRcPtr *processor, float *pixel)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
if (pixel[3] == 1.0f || pixel[3] == 0.0f) {
|
2012-10-04 13:39:08 +00:00
|
|
|
processorApplyRGBA(processor, pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
float alpha, inv_alpha;
|
|
|
|
|
|
|
|
alpha = pixel[3];
|
|
|
|
inv_alpha = 1.0f / alpha;
|
|
|
|
|
|
|
|
pixel[0] *= inv_alpha;
|
|
|
|
pixel[1] *= inv_alpha;
|
|
|
|
pixel[2] *= inv_alpha;
|
|
|
|
|
2012-10-04 13:39:08 +00:00
|
|
|
processorApplyRGBA(processor, pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
pixel[0] *= alpha;
|
|
|
|
pixel[1] *= alpha;
|
|
|
|
pixel[2] *= alpha;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::processorRelease(OCIO_ConstProcessorRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *FallbackImpl::colorSpaceGetName(OCIO_ConstColorSpaceRcPtr *cs)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
if (cs == COLORSPACE_LINEAR)
|
|
|
|
return "Linear";
|
|
|
|
else if (cs == COLORSPACE_SRGB)
|
|
|
|
return "sRGB";
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *FallbackImpl::colorSpaceGetDescription(OCIO_ConstColorSpaceRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *FallbackImpl::colorSpaceGetFamily(OCIO_ConstColorSpaceRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_DisplayTransformRcPtr *FallbackImpl::createDisplayTransform(void)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_DisplayTransformRcPtr*)PROCESSOR_LINEAR_TO_SRGB;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::displayTransformSetInputColorSpaceName(OCIO_DisplayTransformRcPtr *, const char *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::displayTransformSetDisplay(OCIO_DisplayTransformRcPtr *, const char *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::displayTransformSetView(OCIO_DisplayTransformRcPtr *, const char *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::displayTransformSetDisplayCC(OCIO_DisplayTransformRcPtr *, OCIO_ConstTransformRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::displayTransformSetLinearCC(OCIO_DisplayTransformRcPtr *, OCIO_ConstTransformRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::displayTransformRelease(OCIO_DisplayTransformRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_PackedImageDesc *FallbackImpl::createOCIO_PackedImageDesc(float *data, long width, long height, long numChannels,
|
2013-01-08 20:55:07 +00:00
|
|
|
long chanStrideBytes, long xStrideBytes, long yStrideBytes)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_PackedImageDescription *desc = (OCIO_PackedImageDescription*)MEM_callocN(sizeof(OCIO_PackedImageDescription), "OCIO_PackedImageDescription");
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
desc->data = data;
|
|
|
|
desc->width = width;
|
|
|
|
desc->height = height;
|
|
|
|
desc->numChannels = numChannels;
|
|
|
|
desc->chanStrideBytes = chanStrideBytes;
|
|
|
|
desc->xStrideBytes = xStrideBytes;
|
|
|
|
desc->yStrideBytes = yStrideBytes;
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_PackedImageDesc*)desc;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::OCIO_PackedImageDescRelease(OCIO_PackedImageDesc* id)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
MEM_freeN(id);
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ExponentTransformRcPtr *FallbackImpl::createExponentTransform(void)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_ExponentTransformRcPtr*)PROCESSOR_UNKNOWN;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::exponentTransformSetValue(OCIO_ExponentTransformRcPtr *, const float *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::exponentTransformRelease(OCIO_ExponentTransformRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_MatrixTransformRcPtr *FallbackImpl::createMatrixTransform(void)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_MatrixTransformRcPtr*)PROCESSOR_UNKNOWN;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::matrixTransformSetValue(OCIO_MatrixTransformRcPtr *, const float *, const float *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void FallbackImpl::matrixTransformRelease(OCIO_MatrixTransformRcPtr *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-04 13:39:08 +00:00
|
|
|
void FallbackImpl::matrixTransformScale(float * , float * , const float *)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
}
|
2013-03-29 16:02:27 +00:00
|
|
|
|
Bunch of fixes for GLSL display transform
- GLSL shader wasn't aware of alpha predivide option,
always assuming alpha is straight. Gave wrong results
when displaying transparent float buffers.
- GLSL display wasn't aware of float buffers with number
of channels different from 4, crashing when trying to
display image with different number of channels.
This required a bit larger changes, namely now it's
possible to pass format (GL_RGB, GL_RGBAm GL_LUMINANCE)
to glaDrawPixelsTex, This also implied adding format to
glaDrawPixelsAuto and modifying all places where this
functions are called.
Now GLSL will handle both 3 and 4 channels buffers,
single channel images are handled by CPU.
- Replaced hack for render result displaying with a bit
different hack.
Namely CPU conversion will happen only during render,
once render is done GLSL would be used for displaying
render result on a screen.
This is so because of the way renderer updates parts
of the image -- it happens without respect to active
render layer in image user. This is harmless because
only display buffer is modifying, but this is tricky
because we don't have original buffer opened during
rendering.
One more related fix here was about when rendering
multiple layers, wrong image would be displaying when
rendering is done. Added a signal to invalidate
display buffer once rendering is done (only happens
when using multiple layers). This solves issue with
wrong buffer stuck on the display when using regular
CPU display space transform and if GLSL is available
it'll make image displayed with a GLSL shader.
- As an additional change, byte buffers now also uses
GLSL display transform.
So now only dutehr and RGB curves are stoppers for
using GLSL for all kind of display transforms.
2013-04-03 15:59:54 +00:00
|
|
|
bool FallbackImpl::setupGLSLDraw(struct OCIO_GLSLDrawState **state_r, OCIO_ConstProcessorRcPtr *processor, bool predivide)
|
2013-03-29 16:02:27 +00:00
|
|
|
{
|
2013-04-02 17:28:29 +00:00
|
|
|
return false;
|
2013-03-29 16:02:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FallbackImpl::finishGLSLDraw(OCIO_GLSLDrawState *state)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void FallbackImpl::freeGLState(struct OCIO_GLSLDrawState *state_r)
|
|
|
|
{
|
|
|
|
}
|