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