|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toutputproperties.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzBase includes
|
|
Toshihiro Shimizu |
890ddd |
#include "trasterfx.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tiio.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tproperty.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Local namespace stuff
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline void deleteValue(const std::pair<std::string, *="" tpropertygroup=""> &p)</std::string,>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
delete p.second;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} // namespace
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// TOutputProperties implementation
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TOutputProperties::TOutputProperties()
|
|
Toshihiro Shimizu |
890ddd |
: m_path(TFilePath("+outputs") + ".tif"), m_renderSettings(), m_frameRate(24), m_from(0), m_to(-1), m_offset(0), m_step(1), m_whichLevels(false), m_multimediaRendering(0), m_maxTileSizeIndex(0), m_threadIndex(2), m_subcameraPreview(false)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_renderSettings = new TRenderSettings();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TOutputProperties::TOutputProperties(const TOutputProperties &src)
|
|
Toshihiro Shimizu |
890ddd |
: m_path(src.m_path), m_formatProperties(src.m_formatProperties), m_renderSettings(new TRenderSettings(*src.m_renderSettings)), m_frameRate(src.m_frameRate), m_from(src.m_from), m_to(src.m_to), m_whichLevels(src.m_whichLevels), m_offset(src.m_offset), m_step(src.m_step), m_multimediaRendering(src.m_multimediaRendering), m_maxTileSizeIndex(src.m_maxTileSizeIndex), m_threadIndex(src.m_threadIndex), m_subcameraPreview(src.m_subcameraPreview)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Shinya Kitaoka |
3bfa54 |
std::map<std::string, *="" tpropertygroup="">::iterator ft, fEnd = m_formatProperties.end();</std::string,>
|
|
Toshihiro Shimizu |
890ddd |
for (ft = m_formatProperties.begin(); ft != fEnd; ++ft) {
|
|
Toshihiro Shimizu |
890ddd |
if (ft->second)
|
|
Toshihiro Shimizu |
890ddd |
ft->second = ft->second->clone();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TOutputProperties::~TOutputProperties()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
delete m_renderSettings;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::for_each(m_formatProperties.begin(), m_formatProperties.end(),
|
|
Toshihiro Shimizu |
890ddd |
::deleteValue);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TOutputProperties &TOutputProperties::operator=(const TOutputProperties &src)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_path = src.m_path;
|
|
Toshihiro Shimizu |
890ddd |
m_from = src.m_from;
|
|
Toshihiro Shimizu |
890ddd |
m_to = src.m_to;
|
|
Toshihiro Shimizu |
890ddd |
m_frameRate = src.m_frameRate;
|
|
Toshihiro Shimizu |
890ddd |
m_whichLevels = src.m_whichLevels;
|
|
Toshihiro Shimizu |
890ddd |
m_offset = src.m_offset;
|
|
Toshihiro Shimizu |
890ddd |
m_step = src.m_step;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_multimediaRendering = src.m_multimediaRendering;
|
|
Toshihiro Shimizu |
890ddd |
m_maxTileSizeIndex = src.m_maxTileSizeIndex;
|
|
Toshihiro Shimizu |
890ddd |
m_threadIndex = src.m_threadIndex;
|
|
Toshihiro Shimizu |
890ddd |
m_subcameraPreview = src.m_subcameraPreview;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
delete m_renderSettings;
|
|
Toshihiro Shimizu |
890ddd |
m_renderSettings = new TRenderSettings(*src.m_renderSettings);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::for_each(m_formatProperties.begin(), m_formatProperties.end(),
|
|
Toshihiro Shimizu |
890ddd |
::deleteValue);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
3bfa54 |
std::map<std::string, *="" tpropertygroup="">::const_iterator sft, sfEnd = src.m_formatProperties.end();</std::string,>
|
|
Toshihiro Shimizu |
890ddd |
for (sft = src.m_formatProperties.end(); sft != sfEnd; ++sft)
|
|
Toshihiro Shimizu |
890ddd |
m_formatProperties[sft->first] = sft->second->clone();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return *this;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath TOutputProperties::getPath() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_path;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TOutputProperties::setPath(const TFilePath &fp)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_path = fp;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TOutputProperties::setOffset(int off)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_offset = off;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool TOutputProperties::getRange(int &r0, int &r1, int &step) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
step = m_step;
|
|
Toshihiro Shimizu |
890ddd |
if (m_from > m_to) {
|
|
Toshihiro Shimizu |
890ddd |
r0 = 0;
|
|
Toshihiro Shimizu |
890ddd |
r1 = -1;
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
r0 = m_from;
|
|
Toshihiro Shimizu |
890ddd |
r1 = m_to;
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TOutputProperties::setRange(int r0, int r1, int step)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(0 <= r0 && r0 <= r1 || r0 == 0 && r1 == -1);
|
|
Toshihiro Shimizu |
890ddd |
m_from = r0;
|
|
Toshihiro Shimizu |
890ddd |
m_to = r1;
|
|
Toshihiro Shimizu |
890ddd |
m_step = step;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TOutputProperties::setFrameRate(double fps)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_frameRate = fps;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
3bfa54 |
TPropertyGroup *TOutputProperties::getFileFormatProperties(std::string ext)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Shinya Kitaoka |
3bfa54 |
std::map<std::string, *="" tpropertygroup="">::const_iterator it;</std::string,>
|
|
Toshihiro Shimizu |
890ddd |
it = m_formatProperties.find(ext);
|
|
Toshihiro Shimizu |
890ddd |
if (it == m_formatProperties.end()) {
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *ret = Tiio::makeWriterProperties(ext);
|
|
Toshihiro Shimizu |
890ddd |
m_formatProperties[ext] = ret;
|
|
Toshihiro Shimizu |
890ddd |
return ret;
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
return it->second;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
3bfa54 |
void TOutputProperties::getFileFormatPropertiesExtensions(std::vector<std::string> &v) const</std::string>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
v.reserve(m_formatProperties.size());
|
|
Shinya Kitaoka |
3bfa54 |
std::map<std::string, *="" tpropertygroup="">::const_iterator it;</std::string,>
|
|
Toshihiro Shimizu |
890ddd |
for (it = m_formatProperties.begin(); it != m_formatProperties.end(); ++it)
|
|
Toshihiro Shimizu |
890ddd |
v.push_back(it->first);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TOutputProperties::setRenderSettings(const TRenderSettings &renderSettings)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(renderSettings.m_bpp == 32 || renderSettings.m_bpp == 64);
|
|
Toshihiro Shimizu |
890ddd |
assert(renderSettings.m_gamma > 0);
|
|
Toshihiro Shimizu |
890ddd |
assert(renderSettings.m_quality == TRenderSettings::StandardResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::ImprovedResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::HighResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Triangle_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Mitchell_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Cubic5_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Cubic75_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Cubic1_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Hann2_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Hann3_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Hamming2_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Hamming3_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Lanczos2_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Lanczos3_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Gauss_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::ClosestPixel_FilterResampleQuality ||
|
|
Toshihiro Shimizu |
890ddd |
renderSettings.m_quality == TRenderSettings::Bilinear_FilterResampleQuality);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
*m_renderSettings = renderSettings;
|
|
Toshihiro Shimizu |
890ddd |
}
|