Blender V5.3
image_maketx.cpp File Reference
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <memory>
#include <OpenImageIO/Imath.h>
#include <OpenImageIO/color.h>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/filter.h>
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imagebuf.h>
#include <OpenImageIO/imagebufalgo.h>
#include <OpenImageIO/imagebufalgo_util.h>
#include <OpenImageIO/imageio.h>
#include <OpenImageIO/string_view.h>
#include <OpenImageIO/strutil.h>
#include <OpenImageIO/sysutil.h>
#include <OpenImageIO/thread.h>
#include "util/color.h"
#include "util/colorspace.h"
#include "util/image.h"
#include "util/image_maketx.h"
#include "util/image_metadata.h"
#include "util/log.h"
#include "util/md5.h"
#include "util/path.h"
#include "util/tbb.h"
#include "util/types_image.h"

Go to the source code of this file.

Functions

static CCL_NAMESPACE_BEGIN std::string datestring (time_t t)
template<class SRCTYPE>
static void interppixel_NDC (const OIIO::ImageBuf &buf, float x, float y, OIIO::span< float > pixel, bool envlatlmode, OIIO::ImageBuf::ConstIterator< SRCTYPE > &it, OIIO::ImageBuf::WrapMode wrapmode)
template<class SRCTYPE>
static bool resize_block_ (OIIO::ImageBuf &dst, const OIIO::ImageBuf &src, OIIO::ROI roi, bool envlatlmode)
template<class SRCTYPE>
static void halve_scanline (const SRCTYPE *s, const int nchannels, size_t sw, float *dst)
template<class SRCTYPE>
static bool resize_block_2pass (OIIO::ImageBuf &dst, const OIIO::ImageBuf &src, OIIO::ROI roi)
template<typename SRCTYPE>
static bool resize_block (OIIO::ImageBuf &dst, const OIIO::ImageBuf &src, OIIO::ROI roi, bool envlatlmode)
static void fix_latl_edges (OIIO::ImageBuf &buf)
static bool texture_cache_file_outdated (const string &filepath, const string &tx_filepath)
static std::string alpha_type_string (const ImageAlphaType alpha_type)
static std::string format_type_string (const ImageFormatType format_type)
static std::string unique_filename_tx (const string &filepath, const string &texture_cache_path, ustring colorspace, const ImageAlphaType alpha_type, const ImageFormatType format_type, const bool absolute_texture_cache)
bool resolve_tx (const string &filepath, const string &texture_cache_path, ustring colorspace, const ImageAlphaType alpha_type, const ImageFormatType format_type, string &out_filepath, ImageMetaData &out_metadata)
static void write_stats_tx (OIIO::ImageBuf &buf, const bool use_openexr)
template<typename Func>
static void parallel_for_pixels (const int64_t num, const Func &func)
static void clamp_half_tx (OIIO::ImageBuf &buf, const TypeDesc out_format)
static void convert_srgb_tx (OIIO::ImageBuf &buf, const bool from_srgb, const bool unassociate_alpha)
static bool write_buf_tx (std::unique_ptr< ImageOutput > &out, const string &out_filepath, const TypeDesc out_format, const ImageFormatType format_type, const bool compress_as_srgb, const bool unassociate_alpha, const OIIO::ImageOutput::OpenMode mode, OIIO::ImageBuf &buf)
static bool write_mipmap_tx (std::unique_ptr< ImageOutput > &out, const string &out_filepath, const TypeDesc out_format, const ImageFormatType format_type, const bool compress_as_srgb, const bool unassociate_alpha, OIIO::ImageBuf &large_buf)
ustring make_tx_get_file_colorspace (const ImageMetaData &metadata)
static bool make_tx (const string &filepath, const string &out_filepath, ImageMetaData &metadata, const ImageAlphaType alpha_type, const ImageFormatType format_type, const ImageSpec &in_spec)
bool make_tx (const string &filepath, const string &out_filepath, ustring colorspace, const ImageAlphaType alpha_type, const ImageFormatType format_type)

Function Documentation

◆ alpha_type_string()

◆ clamp_half_tx()

void clamp_half_tx ( OIIO::ImageBuf & buf,
const TypeDesc out_format )
static

Definition at line 581 of file image_maketx.cpp.

References assert, clamp(), clamp_half_tx(), and parallel_for_pixels().

Referenced by clamp_half_tx(), and write_buf_tx().

◆ convert_srgb_tx()

void convert_srgb_tx ( OIIO::ImageBuf & buf,
const bool from_srgb,
const bool unassociate_alpha )
static

◆ datestring()

CCL_NAMESPACE_BEGIN std::string datestring ( time_t t)
static

Definition at line 42 of file image_maketx.cpp.

References datestring(), and string_printf().

Referenced by datestring(), and make_tx().

◆ fix_latl_edges()

void fix_latl_edges ( OIIO::ImageBuf & buf)
static

Definition at line 247 of file image_maketx.cpp.

References fix_latl_edges(), x, and y.

Referenced by fix_latl_edges(), and write_buf_tx().

◆ format_type_string()

std::string format_type_string ( const ImageFormatType format_type)
static

◆ halve_scanline()

template<class SRCTYPE>
void halve_scanline ( const SRCTYPE * s,
const int nchannels,
size_t sw,
float * dst )
static

Definition at line 159 of file image_maketx.cpp.

References float, and halve_scanline().

Referenced by halve_scanline(), and resize_block_2pass().

◆ interppixel_NDC()

template<class SRCTYPE>
void interppixel_NDC ( const OIIO::ImageBuf & buf,
float x,
float y,
OIIO::span< float > pixel,
bool envlatlmode,
OIIO::ImageBuf::ConstIterator< SRCTYPE > & it,
OIIO::ImageBuf::WrapMode wrapmode )
static

Definition at line 56 of file image_maketx.cpp.

References floorfrac(), interppixel_NDC(), M_PI, sinf, x, and y.

Referenced by interppixel_NDC(), and resize_block_().

◆ make_tx() [1/2]

◆ make_tx() [2/2]

bool make_tx ( const string & filepath,
const string & out_filepath,
ustring colorspace,
const ImageAlphaType alpha_type,
const ImageFormatType format_type )

◆ make_tx_get_file_colorspace()

◆ parallel_for_pixels()

template<typename Func>
void parallel_for_pixels ( const int64_t num,
const Func & func )
static

Definition at line 572 of file image_maketx.cpp.

References parallel_for_pixels().

Referenced by clamp_half_tx(), convert_srgb_tx(), and parallel_for_pixels().

◆ resize_block()

template<typename SRCTYPE>
bool resize_block ( OIIO::ImageBuf & dst,
const OIIO::ImageBuf & src,
OIIO::ROI roi,
bool envlatlmode )
static

Definition at line 217 of file image_maketx.cpp.

References assert, resize_block(), resize_block_(), and resize_block_2pass().

Referenced by resize_block().

◆ resize_block_()

template<class SRCTYPE>
bool resize_block_ ( OIIO::ImageBuf & dst,
const OIIO::ImageBuf & src,
OIIO::ROI roi,
bool envlatlmode )
static

Definition at line 121 of file image_maketx.cpp.

References assert, float, interppixel_NDC(), resize_block_(), x, and y.

Referenced by resize_block(), resize_block_(), and resize_block_2pass().

◆ resize_block_2pass()

template<class SRCTYPE>
bool resize_block_2pass ( OIIO::ImageBuf & dst,
const OIIO::ImageBuf & src,
OIIO::ROI roi )
static

Definition at line 171 of file image_maketx.cpp.

References assert, halve_scanline(), resize_block_(), resize_block_2pass(), x, and y.

Referenced by resize_block(), and resize_block_2pass().

◆ resolve_tx()

bool resolve_tx ( const string & filepath,
const string & texture_cache_path,
ustring colorspace,
const ImageAlphaType alpha_type,
const ImageFormatType format_type,
string & out_filepath,
ImageMetaData & out_metadata )

◆ texture_cache_file_outdated()

bool texture_cache_file_outdated ( const string & filepath,
const string & tx_filepath )
static

Definition at line 305 of file image_maketx.cpp.

References LOG_INFO, path_is_file(), and texture_cache_file_outdated().

Referenced by resolve_tx(), and texture_cache_file_outdated().

◆ unique_filename_tx()

std::string unique_filename_tx ( const string & filepath,
const string & texture_cache_path,
ustring colorspace,
const ImageAlphaType alpha_type,
const ImageFormatType format_type,
const bool absolute_texture_cache )
static

◆ write_buf_tx()

bool write_buf_tx ( std::unique_ptr< ImageOutput > & out,
const string & out_filepath,
const TypeDesc out_format,
const ImageFormatType format_type,
const bool compress_as_srgb,
const bool unassociate_alpha,
const OIIO::ImageOutput::OpenMode mode,
OIIO::ImageBuf & buf )
static

◆ write_mipmap_tx()

bool write_mipmap_tx ( std::unique_ptr< ImageOutput > & out,
const string & out_filepath,
const TypeDesc out_format,
const ImageFormatType format_type,
const bool compress_as_srgb,
const bool unassociate_alpha,
OIIO::ImageBuf & large_buf )
static

◆ write_stats_tx()

void write_stats_tx ( OIIO::ImageBuf & buf,
const bool use_openexr )
static

Definition at line 464 of file image_maketx.cpp.

References LOG_DEBUG, LOG_INFO, string_printf(), and write_stats_tx().

Referenced by make_tx(), and write_stats_tx().