Compare commits

..

52 Commits

Author SHA1 Message Date
8eb21889bf Fix bug 56275 2022-03-30 21:22:15 +03:00
286eb3fe9a Fix logic bug because of which with memory problems 2022-03-30 15:58:54 +03:00
e88f00c27d Fix build for 32bit platform 2022-03-30 14:05:09 +03:00
258e4cda5a For bug 55777 2022-03-28 17:37:48 +03:00
a2fc2fb9d6 Merge pull request #885 from ONLYOFFICE/fix/v7.1.0-fix-bugs3
fix bug #56304
2022-03-28 11:49:10 +03:00
96a3ac70ca fix bug #56304 2022-03-28 11:34:36 +03:00
61b5ad4e02 Merge pull request #884 from ONLYOFFICE/fix/v7.1.0-fix-bugs-ppt
fix bug #56110
2022-03-28 10:15:21 +03:00
8c0843b218 Add type for qrenderer 2022-03-27 18:28:53 +03:00
d6d117c5dd fix bug #56110 2022-03-25 22:37:15 +03:00
5e8422be62 Merge pull request #881 from ONLYOFFICE/fix/v7.1.0-fix-bugs3
fix bug #56300
2022-03-25 15:55:20 +03:00
b0fd733e95 fix bug #56300 2022-03-25 15:11:37 +03:00
f201a55045 Merge pull request #880 from ONLYOFFICE/fix/v7.1.0-fix-bugs3
fix bug #56057
2022-03-23 20:12:05 +03:00
d03f203553 fix bug #56057 2022-03-23 17:33:34 +03:00
1f24c4fbec Fix standardtester crash 2022-03-22 19:15:00 +03:00
22515b9f0c Rename property 2022-03-22 18:58:37 +03:00
49eff29fac Fix bugs in document info 2022-03-22 15:51:10 +03:00
e3faa6db48 Add getDocumentInfo method 2022-03-22 11:45:18 +03:00
54163e612a Add speed logger to doctrenderer 2022-03-21 22:14:52 +03:00
d05a7233db Merge pull request #877 from ONLYOFFICE/feature/jp2
Feature/jp2
2022-03-20 11:41:44 +03:00
efdc370ca2 Mac build 2022-03-20 11:39:42 +03:00
1d9dc39390 Linux build 2022-03-20 10:54:09 +03:00
f5c5d1fb57 New engine for jpeg2000 2022-03-18 21:54:47 +03:00
1e13179d78 Merge pull request #875 from ONLYOFFICE/fix/v7.1.0-fix-bugs-ppt
Fix/v7.1.0 fix bugs ppt
2022-03-18 11:08:39 +03:00
ff03e6c2a8 Merge remote-tracking branch 'origin/release/v7.1.0' into fix/v7.1.0-fix-bugs-ppt 2022-03-18 11:07:04 +03:00
71e4ddb7b4 Merge branch 'refs/heads/fix/v7.0.0-ppt1' into fix/v7.1.0-fix-bugs-ppt 2022-03-18 10:49:05 +03:00
c1532e8e1f Merge pull request #874 from ONLYOFFICE/fix/v7.1.0-fix-bugs
Fix/v7.1.0 fix bugs
2022-03-17 23:11:51 +03:00
468f5dd0b1 fix bug #54124 2022-03-17 18:05:02 +03:00
a4be4bcc56 fix bug #56098 2022-03-17 17:41:12 +03:00
fe19e83d1e for bug #55915 2022-03-17 15:09:26 +03:00
1928974f0a Merge pull request #873 from ONLYOFFICE/fix/v7.1.0-fix-bugs
Fix/v7.1.0 fix bugs
2022-03-17 09:33:48 +03:00
9161d5d3fb fix bug #56072 2022-03-17 09:32:33 +03:00
2825342c14 fix bug #56071 2022-03-17 09:16:53 +03:00
4b2cc293cf Refactoring pdf 2022-03-16 21:27:35 +03:00
cd75c6e502 Fix typo 2022-03-16 19:40:07 +03:00
9c6fa52d76 Fix bug 55442 2022-03-15 19:51:24 +03:00
1406c5c781 Improve speed of drawing images 2022-03-15 17:13:12 +03:00
224ba9144d fix in bug 54031 default value 2022-03-15 15:35:50 +03:00
35a3c4e803 fix bug #54031 2022-03-15 15:26:35 +03:00
96bdb12014 Merge pull request #872 from ONLYOFFICE/fix/v7.1.0-fix-bugs
fix bug #56025
2022-03-15 09:37:55 +03:00
9a953c7182 fix bug #56025 2022-03-15 09:37:03 +03:00
ede2accb1c add <a:pPr hangingPunct=1> val and correct buChar when buFont.charset==10 2022-03-04 16:08:51 +03:00
a4c2eff0de added simple text shadow 2022-02-09 20:55:52 +03:00
3694c008ea trying to fix 54125 2022-02-07 22:38:51 +03:00
526523c5a3 fix bug #52780 2022-02-04 00:19:42 +03:00
76f4c5bfe3 fix part of #52780 2022-02-02 21:34:37 +03:00
f9f887535f fix bug #55290 2022-02-02 16:41:50 +03:00
84ac4f343d fix bug #54032 2022-02-01 20:46:33 +03:00
bf656716ed correct <a:endParaRPr> for #54032 2022-01-31 22:47:20 +03:00
5d4dbb3eb5 fix bug #52199 2022-01-28 18:37:44 +03:00
dfd40deb5c CShapeElement was replaced by shared_ptr<CElement> 2022-01-28 16:33:02 +03:00
bc28411096 add table txBody and bullets 2022-01-28 15:29:21 +03:00
4dbd3b05e9 add wrap=none 2022-01-28 12:02:19 +03:00
626 changed files with 311900 additions and 1846 deletions

View File

@ -74,8 +74,8 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<IncludePath>D:\_Work\core\Common\3dParty\boost\build\win_64\include;$(IncludePath)</IncludePath>
<LibraryPath>D:\_Work\core\Common\3dParty\boost\build\win_64\lib;$(LibraryPath)</LibraryPath>
<IncludePath>..\..\..\Common\3dParty\boost\build\win_64\include;$(IncludePath)</IncludePath>
<LibraryPath>..\..\..\Common\3dParty\boost\build\win_64\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>

View File

@ -52,24 +52,16 @@ public:
text_position()
{}
text_position(type _Type) : type_(_Type),
has_font_size_(false)
text_position(type _Type) : type_(_Type)
{}
text_position(double _Percent) : type_(Percent),
position_(_Percent),
has_font_size_(false)
text_position(double _Percent) : type_(Percent), position_(_Percent)
{}
text_position(type _Type, double _FontSize) : type_(_Type),
has_font_size_(true),
font_size_(_FontSize)
text_position(type _Type, double _pctFontSize) : type_(_Type), font_size_(_pctFontSize)
{}
text_position(double _Percent, double _FontSize) : type_(Percent),
position_(_Percent),
has_font_size_(true),
font_size_(_FontSize)
text_position(double _Percent, double _pctFontSize) : type_(Percent), position_(_Percent), font_size_(_pctFontSize)
{}
type get_type() const
@ -84,12 +76,12 @@ public:
bool has_font_size() const
{
return has_font_size_;
return font_size_.has_value();
}
const percent & font_size() const
{
return font_size_;
return font_size_.get_value_or(0);
}
static text_position parse(const std::wstring & Str);
@ -98,8 +90,7 @@ private:
type type_;
percent position_;
bool has_font_size_;
percent font_size_;
_CP_OPT(percent) font_size_;
};

View File

@ -834,6 +834,11 @@ void text_format_properties_content::docx_serialize(std::wostream & _rPr, fonts_
_rPr << L"<w:position w:val=\"" << position << "\" />";
}
}
else
{
if (mul < -0.3) _rPr << L"<w:vertAlign w:val=\"subscript\"/>";
else if (mul > 0.3) _rPr << L"<w:vertAlign w:val=\"superscript\"/>";
}
}
if (style_text_position_->has_font_size() && !noNeedSize)
@ -1236,11 +1241,11 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
if (style_text_line_through_type_->get_type() == line_type::Single)
_rPr << L"<w:strike w:val=\"true\" />";
else if (style_text_line_through_type_->get_type() == line_type::Double)
_rPr << L"<w:dstrike w:val=\"true\" />";
_rPr << L"<w:dstrike w:val=\"true\"/>";
}
else if (style_text_line_through_style_ && style_text_line_through_style_->get_type() != line_style::None)
{
_rPr << L"<w:strike w:val=\"true\" />";
_rPr << L"<w:strike w:val=\"true\"/>";
}
}
@ -1256,12 +1261,12 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
bool noNeedSize = false;
if (style_text_position_->get_type() == text_position::Sub)
{
_rPr << L"<w:vertAlign w:val=\"subscript\" />";
_rPr << L"<w:vertAlign w:val=\"subscript\"/>";
noNeedSize = true;
}
if (style_text_position_->get_type() == text_position::Super)
{
_rPr << L"<w:vertAlign w:val=\"superscript\" />";
_rPr << L"<w:vertAlign w:val=\"superscript\"/>";
noNeedSize = true;
}
@ -1282,6 +1287,11 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
_rPr << L"<w:position w:val=\"" << position << "\" />";
}
}
else
{
if (mul < - 0.3) _rPr << L"<w:vertAlign w:val=\"subscript\"/>";
else if (mul > 0.3) _rPr << L"<w:vertAlign w:val=\"superscript\"/>";
}
}
if (style_text_position_->has_font_size() && !noNeedSize)
@ -1293,7 +1303,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
if (!fontSize.empty())
{
needProcessFontSize = false;
_rPr << L"<w:sz w:val=\"" << fontSize << "\" />";
_rPr << L"<w:sz w:val=\"" << fontSize << "\"/>";
}
}
}

View File

@ -310,9 +310,6 @@ void odf_number_styles_context::create_default(int oox_num_fmt, std::wstring for
case 39: formatCode = L"#,##0.00;(#,##0.00)"; state.ods_type =office_value_type::Float; break;
case 40: formatCode = L"#,##0.00;[Red](#,##0.00)"; state.ods_type =office_value_type::Float; break;
case 41: formatCode = L""; state.ods_type =office_value_type::Currency; break;
case 42: formatCode = L""; state.ods_type =office_value_type::Currency; break;
case 45: formatCode = L"mm:ss"; state.ods_type =office_value_type::Time; break;
case 46: formatCode = L"[h]:mm:ss"; state.ods_type =office_value_type::Time; break;
case 47: formatCode = L"mmss.0"; state.ods_type =office_value_type::Time; break;
@ -321,25 +318,25 @@ void odf_number_styles_context::create_default(int oox_num_fmt, std::wstring for
default:
/////////////////////////////////// с неопределенным formatCode .. он задается в файле
if (oox_num_fmt >=5 && oox_num_fmt <=8) state.ods_type =office_value_type::Currency;
if (oox_num_fmt >=43 && oox_num_fmt <=44) state.ods_type =office_value_type::Currency;
if (oox_num_fmt >= 5 && oox_num_fmt <= 8) state.ods_type =office_value_type::Currency;
else if (oox_num_fmt >= 41 && oox_num_fmt <= 44) state.ods_type =office_value_type::Currency;
if (oox_num_fmt >=27 && oox_num_fmt <=31) state.ods_type =office_value_type::Date;
if (oox_num_fmt >=50 && oox_num_fmt <=54) state.ods_type =office_value_type::Date;
if (oox_num_fmt >=57 && oox_num_fmt <=58) state.ods_type =office_value_type::Date;
if (oox_num_fmt ==36) state.ods_type =office_value_type::Date;
else if (oox_num_fmt >= 27 && oox_num_fmt <= 31) state.ods_type =office_value_type::Date;
else if (oox_num_fmt >= 50 && oox_num_fmt <= 54) state.ods_type =office_value_type::Date;
else if (oox_num_fmt >= 57 && oox_num_fmt <= 58) state.ods_type =office_value_type::Date;
else if (oox_num_fmt == 36) state.ods_type =office_value_type::Date;
if (oox_num_fmt >=32 && oox_num_fmt <=35) state.ods_type =office_value_type::Time;
if (oox_num_fmt >=55 && oox_num_fmt <=56) state.ods_type =office_value_type::Time;
else if (oox_num_fmt >= 32 && oox_num_fmt <= 35) state.ods_type =office_value_type::Time;
else if (oox_num_fmt >= 55 && oox_num_fmt <= 56) state.ods_type =office_value_type::Time;
if (oox_num_fmt >=60 && oox_num_fmt <=62) state.ods_type =office_value_type::Float;
if (oox_num_fmt >=69 && oox_num_fmt <=70) state.ods_type =office_value_type::Float;
else if (oox_num_fmt >= 60 && oox_num_fmt <= 62) state.ods_type =office_value_type::Float;
else if (oox_num_fmt >= 69 && oox_num_fmt <= 70) state.ods_type =office_value_type::Float;
if (oox_num_fmt >=67 && oox_num_fmt <=68) state.ods_type =office_value_type::Percentage;
else if (oox_num_fmt >= 67 && oox_num_fmt <= 68) state.ods_type =office_value_type::Percentage;
if (oox_num_fmt >=71 && oox_num_fmt <=74) state.ods_type =office_value_type::Date;
if (oox_num_fmt >=75 && oox_num_fmt <=80) state.ods_type =office_value_type::Time;
if (oox_num_fmt ==81) state.ods_type =office_value_type::Date;
else if (oox_num_fmt >= 71 && oox_num_fmt <= 74) state.ods_type =office_value_type::Date;
else if (oox_num_fmt >= 75 && oox_num_fmt <= 80) state.ods_type =office_value_type::Time;
else if (oox_num_fmt == 81) state.ods_type =office_value_type::Date;
}
boost::algorithm::split(state.format_code, formatCode, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
@ -522,7 +519,7 @@ void odf_number_styles_context::create_numbers(number_format_state & state, offi
if (number_)
{
number_->number_min_integer_digits_ = min_digit;
number_->number_decimal_places_ = min_decimal;
number_->number_decimal_places_ = min_digit ? min_decimal.get_value_or(0) : min_decimal;
if (root_elm && bText)
number_->number_grouping_ = true;
@ -830,9 +827,9 @@ void odf_number_styles_context::detect_format(number_format_state & state)
boost::wsmatch result;
bool b = boost::regex_search(state.format_code[0], result, re);
if (b && result.size() == 3)
if (b && result.size() >= 3)
{
state.currency_str=result[1];
state.currency_str = result[1];
int code = -1;
try
{

View File

@ -2814,11 +2814,9 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
switch(oox_run_pr->m_oVertAlign->m_oVal->GetValue())
{
case SimpleTypes::verticalalignrunSuperscript:
//text_properties->content_.style_text_position_ = odf_types::text_position(odf_types::text_position::Super); break;
text_properties->content_.style_text_position_ = odf_types::text_position(+33.); break;
text_properties->content_.style_text_position_ = odf_types::text_position(odf_types::text_position::Super, 58); break;
case SimpleTypes::verticalalignrunSubscript:
//text_properties->content_.style_text_position_ = odf_types::text_position(odf_types::text_position::Sub); break;
text_properties->content_.style_text_position_ = odf_types::text_position(-33.); break;//по умолчанию 58% - хуже выглядит
text_properties->content_.style_text_position_ = odf_types::text_position(odf_types::text_position::Sub, 58); break;
}
}
if (oox_run_pr->m_oW.IsInit() && oox_run_pr->m_oW->m_oVal.IsInit())

View File

@ -32,6 +32,7 @@ HEADERS += \
../Enums/enums.h \
../PPTFormatLib.h \
../PPTXWriter/Animation.h \
../PPTXWriter/BulletsConverter.h \
../PPTXWriter/TableWriter.h \
../PPTXWriter/TxBodyConverter.h \
../Reader/ClassesAtom.h \
@ -295,5 +296,6 @@ SOURCES += \
SOURCES += \
../../../ASCOfficePPTXFile/Editor/Drawing/Elements.cpp \
../../../ASCOfficePPTXFile/Editor/Drawing/TextAttributesEx.cpp \
../../../Common/3dParty/pole/pole.cpp
../../../Common/3dParty/pole/pole.cpp \
../PPTXWriter/BulletsConverter.cpp

View File

@ -0,0 +1,233 @@
#include "BulletsConverter.h"
#include "StylesWriter.h"
using namespace PPT_FORMAT;
BulletsConverter::BulletsConverter(CRelsGenerator* pRels) : m_pRels(pRels) {}
void BulletsConverter::FillPPr(PPTX::Logic::TextParagraphPr &oPPr, CParagraph &paragraph)
{
oPPr.lvl = paragraph.m_lTextLevel;
auto* pPF = &(paragraph.m_oPFRun);
if (pPF)
ConvertPFRun(oPPr, pPF);
}
void BulletsConverter::ConvertPFRun(PPTX::Logic::TextParagraphPr &oPPr, CTextPFRun *pPF)
{
int leftMargin = 0;
if (pPF->leftMargin.is_init())
{
leftMargin = pPF->leftMargin.get();
oPPr.marL = leftMargin;
}
if (pPF->indent.is_init())
{
if (pPF->hasBullet.get_value_or(false) && pPF->indent.get() != -leftMargin)
{
oPPr.indent = pPF->indent.get() - leftMargin;
}
else
{
oPPr.indent = pPF->indent.get();
}
} else if (pPF->hasBullet.get_value_or(false))
{
oPPr.indent = -leftMargin;
}
if (pPF->textAlignment.is_init())
{
oPPr.algn = new PPTX::Limit::TextAlign;
oPPr.algn->set(CStylesWriter::GetTextAlign(pPF->textAlignment.get()));
}
if (pPF->defaultTabSize.is_init())
{
oPPr.defTabSz = pPF->defaultTabSize.get();
}
if (pPF->textDirection.is_init())
{
if (pPF->textDirection.get() == 1) oPPr.rtl = true;
else oPPr.rtl = false;
}
if (pPF->fontAlign.is_init())
{
oPPr.fontAlgn = new PPTX::Limit::FontAlign;
oPPr.fontAlgn->set(CStylesWriter::GetFontAlign(pPF->fontAlign.get()));
}
if (pPF->wrapFlags.is_init() && pPF->wrapFlags.get() & 0b111)
{
const auto& flags = pPF->wrapFlags.get();
if (flags & 0b100)
oPPr.hangingPunct = true;
}
ConvertTabStops(oPPr.tabLst, pPF->tabStops);
if (pPF->lineSpacing.is_init())
{
LONG val = pPF->lineSpacing.get();
auto pLnSpc = new PPTX::Logic::TextSpacing;
pLnSpc->m_name = L"a:lnSpc";
if (val > 0)
pLnSpc->spcPct = val * 12.5;
else if (val < 0 && val > -13200)
pLnSpc->spcPct = val * -1000;
oPPr.lnSpc = pLnSpc;
}
if (pPF->spaceAfter.is_init())
{
LONG val = pPF->spaceAfter.get();
auto pSpcAft = new PPTX::Logic::TextSpacing;
pSpcAft->m_name = L"a:spcAft";
if (val > 0)
pSpcAft->spcPts = round(12.5 * pPF->spaceAfter.get());
else if (val < 0 && val > -13200)
pSpcAft->spcPts = val * -1000;
oPPr.spcAft = pSpcAft;
}
if (pPF->spaceBefore.is_init())
{
LONG val = pPF->spaceBefore.get();
auto pSpcBef = new PPTX::Logic::TextSpacing;
pSpcBef->m_name = L"a:spcBef";
if (val > 0)
pSpcBef->spcPts = round(12.5 * pPF->spaceBefore.get());
else if (val < 0 && val > -13200)
pSpcBef->spcPct = val * -1000;
oPPr.spcBef = pSpcBef;
}
ConvertAllBullets(oPPr, pPF);
}
void BulletsConverter::ConvertTabStops(std::vector<PPTX::Logic::Tab> &arrTabs, std::vector<std::pair<int, int> > &arrTabStops)
{
for (size_t t = 0 ; t < arrTabStops.size(); t++)
{
PPTX::Logic::Tab tab;
tab.pos = arrTabStops[t].first;
auto pAlgn = new PPTX::Limit::TextTabAlignType;
switch (arrTabStops[t].second)
{
case 1: pAlgn->set(L"ctr"); break;
case 2: pAlgn->set(L"r"); break;
case 3: pAlgn->set(L"dec"); break;
default: pAlgn->set(L"l");
}
tab.algn = pAlgn;
arrTabs.push_back(tab);
}
}
void BulletsConverter::FillBuChar(PPTX::Logic::Bullet &oBullet, WCHAR symbol, CTextPFRun *pPF)
{
auto pBuChar = new PPTX::Logic::BuChar;
pBuChar->Char.clear();
if (pPF != nullptr && pPF->bulletFontProperties.IsInit())
{
const auto& fontProp = *(pPF->bulletFontProperties);
if (fontProp.Charset == 10)
{
symbol &= 0x00ff;
symbol |= 0xf000;
}
}
pBuChar->Char.push_back(symbol);
oBullet.m_Bullet.reset(pBuChar);
}
void BulletsConverter::ConvertAllBullets(PPTX::Logic::TextParagraphPr &oPPr, CTextPFRun *pPF)
{
if (pPF->hasBullet.is_init())
{
if (pPF->hasBullet.get())
{
if (pPF->bulletColor.is_init())
{
FillBuClr(oPPr.buColor, pPF->bulletColor.get());
}
if (pPF->bulletSize.is_init())
{
PPTX::WrapperWritingElement* pBuSize(nullptr);
if (pPF->bulletSize.get() > 24 && pPF->bulletSize.get() < 401)
{
pBuSize = new PPTX::Logic::BuSzPct;
static_cast<PPTX::Logic::BuSzPct*>(pBuSize)->val = pPF->bulletSize.get() * 1000 ;
}
if (pPF->bulletSize.get() < 0 && pPF->bulletSize.get() > -4001)
{
pBuSize = new PPTX::Logic::BuSzPts;
static_cast<PPTX::Logic::BuSzPts*>(pBuSize)->val = - (pPF->bulletSize.get());
}
if (pBuSize != nullptr)
oPPr.buSize.m_Size = pBuSize;
}
if (pPF->bulletFontProperties.is_init())
{
auto pBuFont = new PPTX::Logic::TextFont;
pBuFont->m_name = L"a:buFont";
pBuFont->typeface = pPF->bulletFontProperties->Name;
if ( pPF->bulletFontProperties->PitchFamily > 0)
pBuFont->pitchFamily = std::to_wstring(pPF->bulletFontProperties->PitchFamily);
if ( pPF->bulletFontProperties->Charset > 0)
pBuFont->charset = std::to_wstring(pPF->bulletFontProperties->Charset);
oPPr.buTypeface.m_Typeface.reset(pBuFont);
}
// Bullets (numbering, else picture, else char, else default)
if (pPF->bulletBlip.is_init() && pPF->bulletBlip->tmpImagePath.size() && m_pRels != nullptr)
{
auto strRID = m_pRels->WriteImage(pPF->bulletBlip->tmpImagePath);
if (strRID.empty())
FillBuChar(oPPr.ParagraphBullet, L'\x2022'); // error rId
else
{
auto pBuBlip = new PPTX::Logic::BuBlip;
pBuBlip->blip.embed = new OOX::RId(strRID);
oPPr.ParagraphBullet.m_Bullet.reset(pBuBlip);
}
}
else if (pPF->bulletAutoNum.is_init())
{
auto pBuAutoNum = new PPTX::Logic::BuAutoNum;
oPPr.ParagraphBullet.m_Bullet.reset(pBuAutoNum);
if (pPF->bulletAutoNum->startAt.is_init() && pPF->bulletAutoNum->startAt.get() != 1)
pBuAutoNum->startAt = pPF->bulletAutoNum->startAt.get();
if (pPF->bulletAutoNum->type.is_init())
pBuAutoNum->type = pPF->bulletAutoNum->type.get();
}
else if (pPF->bulletChar.is_init())
{
FillBuChar(oPPr.ParagraphBullet, pPF->bulletChar.get(), pPF);
}
else
{
FillBuChar(oPPr.ParagraphBullet, L'\x2022');
}
}
else
{
oPPr.buTypeface.m_Typeface.reset(new PPTX::Logic::BuNone);
}
}
}
void BulletsConverter::FillBuClr(PPTX::Logic::BulletColor &oBuClr, CColor &oColor)
{
auto pBuClr = new PPTX::Logic::BuClr;
pBuClr->Color.SetRGBColor(oColor.GetR(), oColor.GetG(), oColor.GetB());
oBuClr.m_Color.reset(pBuClr);
}

View File

@ -0,0 +1,56 @@
/*
*(c) Copyright Ascensio System SIA 2010-2019
*
*This program is a free software product. You can redistribute it and/or
*modify it under the terms of the GNU Affero General Public License (AGPL)
*version 3 as published by the Free Software Foundation. In accordance with
*Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
*that Ascensio System SIA expressly excludes the warranty of non-infringement
*of any third-party rights.
*
*This program is distributed WITHOUT ANY WARRANTY; without even the implied
*warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
*details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
*You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
*street, Riga, Latvia, EU, LV-1050.
*
*The interactive user interfaces in modified source and object code versions
*of the Program must display Appropriate Legal Notices, as required under
*Section 5 of the GNU AGPL version 3.
*
*Pursuant to Section 7(b) of the License you must retain the original Product
*logo when distributing the program. Pursuant to Section 7(e) we decline to
*grant you any rights under trademark law for use of our trademarks.
*
*All the Product's GUI elements, including illustrations and icon sets, as
*well as technical writing content are licensed under the terms of the
*Creative Commons Attribution-ShareAlike 4.0 International. See the License
*terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/TextParagraphPr.h"
#include "../../../ASCOfficePPTXFile/Editor/Drawing/TextStructures.h"
#include "ImageManager.h"
namespace PPT_FORMAT
{
class BulletsConverter
{
public:
BulletsConverter(CRelsGenerator* pRels = nullptr);
void FillPPr(PPTX::Logic::TextParagraphPr& oPPr, CParagraph &paragraph);
void ConvertPFRun(PPTX::Logic::TextParagraphPr &oPPr, PPT_FORMAT::CTextPFRun* pPF);
private:
void ConvertTabStops(std::vector<PPTX::Logic::Tab>& arrTabs, std::vector<std::pair<int, int>>& arrTabStops);
void FillBuChar(PPTX::Logic::Bullet& oBullet, WCHAR symbol, CTextPFRun *pPF = nullptr);
void ConvertAllBullets(PPTX::Logic::TextParagraphPr &oPPr, CTextPFRun *pPF);
void FillBuClr(PPTX::Logic::BulletColor& oBuClr, CColor& oColor);
private:
CRelsGenerator* m_pRels;
};
}

View File

@ -614,7 +614,7 @@ void PPT_FORMAT::CPPTXWriter::WriteThemes()
int nStartLayout = 0, nIndexTheme = 0;
if (HasRoundTrips() && m_pDocument->m_arThemes.size())
{
{
std::unordered_set<std::string> writedFilesHash;
for (const auto& oIterSlide : m_pUserInfo->m_mapMasters)
{
@ -644,6 +644,9 @@ void PPT_FORMAT::CPPTXWriter::WriteThemes()
bool CPPTXWriter::HasRoundTrips() const
{
if (m_pUserInfo == nullptr || m_pUserInfo->m_mapMasters.empty() || m_pUserInfo->m_mapMasters.begin()->second == nullptr)
return false;
std::vector<RoundTripTheme12Atom*> arrRTTheme;
std::vector<RoundTripContentMasterInfo12Atom*> arrRTLayouts;
auto pSlide = m_pUserInfo->m_mapMasters.begin()->second;
@ -1018,14 +1021,17 @@ void PPT_FORMAT::CPPTXWriter::WriteTheme(CThemePtr pTheme, int & nIndexTheme, in
WriteColorScheme(oStringWriter, L"Default", pTheme->m_arColorScheme);
oStringWriter.WriteString(std::wstring(L"<a:fontScheme name=\"default\"><a:majorFont><a:latin typeface=\""));
oStringWriter.WriteStringXML(pTheme->m_arFonts[0].Name);
oStringWriter.WriteString(std::wstring(L"\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:majorFont>"));
if (!pTheme->m_arFonts.empty())
{
oStringWriter.WriteString(std::wstring(L"<a:fontScheme name=\"default\"><a:majorFont><a:latin typeface=\""));
oStringWriter.WriteStringXML(pTheme->m_arFonts[0].Name);
oStringWriter.WriteString(std::wstring(L"\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:majorFont>"));
oStringWriter.WriteString(std::wstring(L"<a:minorFont><a:latin typeface=\""));
oStringWriter.WriteString(std::wstring(L"<a:minorFont><a:latin typeface=\""));
if (pTheme->m_arFonts.size() > 1 ) oStringWriter.WriteString (pTheme->m_arFonts[1].Name);
else oStringWriter.WriteStringXML(pTheme->m_arFonts[0].Name);
if (pTheme->m_arFonts.size() > 1 ) oStringWriter.WriteString (pTheme->m_arFonts[1].Name);
else oStringWriter.WriteStringXML(pTheme->m_arFonts[0].Name);
}
oStringWriter.WriteString(std::wstring(L"\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:minorFont>"));
oStringWriter.WriteString(std::wstring(L"</a:fontScheme>"));

View File

@ -31,7 +31,7 @@
*/
#include "ShapeWriter.h"
#include "StylesWriter.h"
#include "TxBodyConverter.h"
#include "BulletsConverter.h"
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Theme.h"
@ -65,7 +65,9 @@ void CStylesWriter::ConvertStyleLevel(PPT_FORMAT::CTextStyleLevel& oLevel, PPT_F
// <a:pPr>
auto pPPr = new PPTX::Logic::TextParagraphPr;
TxBodyConverter::ConvertPFRun(*pPPr, &oLevel.m_oPFRun, nullptr);
BulletsConverter buConverter;
buConverter.ConvertPFRun(*pPPr, &oLevel.m_oPFRun);
std::wstring strPPr = pPPr->toXML().substr(6); // remove <a:pPr
strPPr = strPPr.substr(0, strPPr.size() - 8); // remove </a:pPr>
delete pPPr;
@ -158,6 +160,12 @@ void CStylesWriter::ConvertStyleLevel(PPT_FORMAT::CTextStyleLevel& oLevel, PPT_F
oWriter.WriteString(str3);
}
std::wstring CShapeWriter::getOWriterStr() const
{
return m_oWriter.GetData();
}
PPT_FORMAT::CShapeWriter::CShapeWriter()
{
m_pTheme = NULL;
@ -441,6 +449,7 @@ std::wstring PPT_FORMAT::CShapeWriter::ConvertShadow(CShadow & shadow)
PPT_FORMAT::CStringWriter shadow_writer;
shadow_writer.WriteString(L"<a:effectLst>");
bool needHiddenEffect = false;
if (!Preset.empty())
{
@ -473,22 +482,32 @@ std::wstring PPT_FORMAT::CShapeWriter::ConvertShadow(CShadow & shadow)
}
else
{
// needHiddenEffect = shadow.Visible;
shadow_writer.WriteString(L"<a:outerShdw");
shadow_writer.WriteString(L" rotWithShape=\"0\"");
shadow_writer.WriteString(strDist);
shadow_writer.WriteString(strDir);
if (strSX.empty() && strSY.empty())
{
shadow_writer.WriteString(L" algn=\"ctr\"");
}
shadow_writer.WriteString(strSX);
shadow_writer.WriteString(strSY);
shadow_writer.WriteString(strDir);
shadow_writer.WriteString(strDist);
shadow_writer.WriteString(L" rotWithShape=\"0\"");
shadow_writer.WriteString(L">");
shadow_writer.WriteString(ConvertColor(shadow.Color,shadow.Alpha));
shadow_writer.WriteString(L"</a:outerShdw>");
}
shadow_writer.WriteString(L"</a:effectLst>");
// if (needHiddenEffect)
// {
// std::wstring STRshadow;
// STRshadow = L"<a:extLst><a:ext uri=\"{AF507438-7753-43E0-B8FC-AC1667EBCBE1}\"><a14:hiddenEffects xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\">";
// STRshadow += shadow_writer.GetData();
// STRshadow += L"</a14:hiddenEffects></a:ext><a:ext uri=\"{53640926-AAD7-44D8-BBD7-CCE9431645EC}\"><a14:shadowObscured xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" val=\"1\"/></a:ext></a:extLst>";
// return STRshadow;
// }
return shadow_writer.GetData();
}
@ -1038,7 +1057,7 @@ void PPT_FORMAT::CShapeWriter::Write3dShape()
m_oWriter.WriteString(std::wstring(L"</a:sp3d>"));
}
void PPT_FORMAT::CShapeWriter::WriteTextInfo()
void PPT_FORMAT::CShapeWriter::WriteTextInfo(PPT_FORMAT::CTextCFRun* pLastCF)
{
CShapeElement* pShapeElement = dynamic_cast<CShapeElement*>(m_pElement.get());
if (!pShapeElement) return;
@ -1131,7 +1150,14 @@ void PPT_FORMAT::CShapeWriter::WriteTextInfo()
if (0 == nCount)
{
m_oWriter.WriteString(L"<a:lstStyle/><a:p><a:endParaRPr dirty=\"0\"/></a:p></p:txBody>");
if (pLastCF && pLastCF->Size.is_init())
{
int sz = pLastCF->Size.get() * 100;
m_oWriter.WriteString(L"<a:lstStyle/><a:p><a:endParaRPr dirty=\"0\" sz=\"" + std::to_wstring(sz) + L"\"/></a:p></p:txBody>");
} else
{
m_oWriter.WriteString(L"<a:lstStyle/><a:p><a:endParaRPr dirty=\"0\" sz=\"1400\"/></a:p></p:txBody>");
}
return;
}
m_oWriter.WriteString(L"<a:lstStyle>");
@ -1158,7 +1184,8 @@ void PPT_FORMAT::CShapeWriter::WriteTextInfo()
// <a:pPr>
auto pPPr = new PPTX::Logic::TextParagraphPr;
TxBodyConverter::ConvertPFRun(*pPPr, &pParagraph->m_oPFRun, m_pRels);
BulletsConverter buConverter(m_pRels);
buConverter.FillPPr(*pPPr, *pParagraph);
m_oWriter.WriteString(pPPr->toXML());
delete pPPr;
@ -1186,6 +1213,8 @@ void PPT_FORMAT::CShapeWriter::WriteTextInfo()
}
PPT_FORMAT::CTextCFRun* pCF = &pParagraph->m_arSpans[nSpan].m_oRun;
pLastCF = pCF;
int span_sz = pParagraph->m_arSpans[nSpan].m_strText.length() ;
if ((span_sz==1 && ( pParagraph->m_arSpans[nSpan].m_strText[0] == (wchar_t)13 )) ||
@ -1322,6 +1351,10 @@ void PPT_FORMAT::CShapeWriter::WriteTextInfo()
}
// WriteHyperlink(nIndexPar);
if (pCF->FontShadow.get_value_or(false))
{
m_oWriter.WriteString(L"<a:effectLst><a:outerShdw blurRad=\"38100\" dist=\"38100\" dir=\"2700000\" algn=\"tl\"><a:srgbClr val=\"000000\"><a:alpha val=\"43137\"/></a:srgbClr></a:outerShdw></a:effectLst>");
}
m_oWriter.WriteString(std::wstring(L"</a:rPr>"));

View File

@ -157,8 +157,7 @@ namespace PPT_FORMAT
CShapeWriter();
~CShapeWriter()
{
RELEASEOBJECT(m_pSimpleGraphicsConverter);
RELEASEOBJECT(m_pSimpleGraphicsConverter);
RELEASEOBJECT(m_pSimpleGraphicsConverter);
}
friend class CPPTXWriter;
@ -455,8 +454,9 @@ namespace PPT_FORMAT
std::wstring ConvertTableCell();
void WriteShapeInfo();
void WriteImageInfo();
void WriteTextInfo();
void WriteTextInfo(CTextCFRun *pLastCF = nullptr);
static std::wstring WriteBullets(CTextPFRun* pPF, CRelsGenerator *pRels);
void Write3dShape();
};
std::wstring getOWriterStr() const;
};
}

View File

@ -1,12 +1,15 @@
#include "TableWriter.h"
#include "TxBodyConverter.h"
#include <iostream>
#include <numeric>
#include <algorithm>
#define VECSUM(cont) \
std::accumulate(cont.begin(), cont.end(), decltype(cont)::value_type(0))
TableWriter::TableWriter(CTableElement *pTableElement, CRelsGenerator* pRels) :
m_pTableElement(pTableElement), m_pRels(pRels)
{
}
m_pTableElement(pTableElement), m_pRels(pRels) {}
void TableWriter::Convert(PPTX::Logic::GraphicFrame &oGraphicFrame)
{
@ -56,14 +59,14 @@ void TableWriter::FillTable(PPTX::Logic::Table &oTable)
oTable.tableProperties = new PPTX::Logic::TableProperties;
FillTblPr(oTable.tableProperties.get2());
std::vector<CShapeElement*> arrCells, arrSpliters;
std::vector<CElementPtr> arrCells, arrSpliters;
prepareShapes(arrCells, arrSpliters);
m_nPTable = new ProtoTable(arrCells, arrSpliters, m_pRels);
FillTblGrid(oTable.TableCols , arrCells);
auto protoTable = m_nPTable->getTable();
auto arrHeight = ProtoTable::getHeight(arrCells);
auto arrHeight = ProtoTable::getHeight(arrCells, m_pTableElement->GetHeight());
for (UINT cRow = 0; cRow < protoTable.size(); cRow++)
{
PPTX::Logic::TableRow tr;
@ -73,12 +76,12 @@ void TableWriter::FillTable(PPTX::Logic::Table &oTable)
}
}
std::vector<int> ProtoTable::getWidth(std::vector<CShapeElement*>& arrCells, bool isWidth)
std::vector<int> ProtoTable::getWidth(const std::vector<CElementPtr>& arrCells, long tableWidth, bool isWidth)
{
std::map<double, double> mapLeftWidth;
for (const auto* pCell : arrCells)
for (const auto &ptrCell : arrCells)
{
if (!pCell) continue;
auto pCell = static_cast<CShapeElement*>(ptrCell.get());
double left = pCell->m_rcChildAnchor.left;
double width = pCell->m_rcChildAnchor.right - left;
@ -103,16 +106,21 @@ std::vector<int> ProtoTable::getWidth(std::vector<CShapeElement*>& arrCells, boo
double value = isWidth ? w.second : w.first;
gridWidth.push_back(round(value * multip));
}
if (tableWidth != -1)
{
double resize = (double)tableWidth/VECSUM(gridWidth);
std::transform(gridWidth.begin(), gridWidth.end(), gridWidth.begin(), [resize](int &n){ return n * resize; });
}
return gridWidth;
}
std::vector<int> ProtoTable::getHeight(std::vector<CShapeElement*>& arrCells, bool isHeight)
std::vector<int> ProtoTable::getHeight(const std::vector<CElementPtr>& arrCells, long tableHeight, bool isHeight)
{
std::map<double, double> mapTopHeight;
for (auto* pCell : arrCells)
for (const auto &ptrCell : arrCells)
{
if (!pCell) continue;
auto pCell = static_cast<CShapeElement*>(ptrCell.get());
double top = pCell->m_rcChildAnchor.top;
double height = pCell->m_rcChildAnchor.bottom - top;
@ -138,6 +146,11 @@ std::vector<int> ProtoTable::getHeight(std::vector<CShapeElement*>& arrCells, bo
double value = isHeight ? h.second : h.first;
gridHeight.push_back(round(value * multip));
}
if (tableHeight != -1)
{
double resize = (double)tableHeight/VECSUM(gridHeight);
std::transform(gridHeight.begin(), gridHeight.end(), gridHeight.begin(), [resize](int &n){ return n * resize; });
}
return gridHeight;
}
@ -169,8 +182,8 @@ void ProtoTable::initProtoTable()
}
}
bool ProtoTable::fillProtoTable(std::vector<CShapeElement *> &arrCells,
std::vector<CShapeElement*>& arrSpliters)
bool ProtoTable::fillProtoTable(std::vector<CElementPtr> &arrCells,
std::vector<CElementPtr>& arrSpliters)
{
if (m_table.empty() || m_arrTop.empty() || m_arrLeft.empty())
return false;
@ -181,13 +194,14 @@ bool ProtoTable::fillProtoTable(std::vector<CShapeElement *> &arrCells,
return wasCellsFilled;
}
bool ProtoTable::fillCells(std::vector<CShapeElement *> &arrCells)
bool ProtoTable::fillCells(std::vector<CElementPtr> &arrCells)
{
const UINT countRow = m_arrTop.size();
const UINT countCol = m_arrLeft.size();
for (auto* pCell : arrCells)
for (auto &ptrCell : arrCells)
{
auto pCell = static_cast<CShapeElement*>(ptrCell.get());
int left = pCell->m_rcChildAnchor.left;
int top = pCell->m_rcChildAnchor.top;
int right = pCell->m_rcChildAnchor.right;
@ -219,7 +233,7 @@ bool ProtoTable::fillCells(std::vector<CShapeElement *> &arrCells)
tCell.setRowSpan(posBottomRow - cRow);
}
pParent->setPParent(nullptr);
pParent->setPShape(pCell);
pParent->setPShape(ptrCell);
// pParent->setGridSpan(posRightCol - posCol);
// pParent->setRowSpan(posBottomRow - posRow);
@ -228,10 +242,11 @@ bool ProtoTable::fillCells(std::vector<CShapeElement *> &arrCells)
return true;
}
void ProtoTable::fillBorders(std::vector<CShapeElement *> &arrSpliters)
void ProtoTable::fillBorders(std::vector<CElementPtr> &arrSpliters)
{
for (auto* pBorder : arrSpliters)
for (const auto &ptrBorder : arrSpliters)
{
auto pBorder = static_cast<CShapeElement*>(ptrBorder.get());
int left = pBorder->m_rcChildAnchor.left;
int top = pBorder->m_rcChildAnchor.top;
int right = pBorder->m_rcChildAnchor.right;
@ -242,9 +257,9 @@ void ProtoTable::fillBorders(std::vector<CShapeElement *> &arrSpliters)
findCellPos(top, left, posFirstTop, posFirstLeft);
findCellPos(bottom, right, posLastTop, posLastLeft);
if (!isDefaultBoard(pBorder))
if (!isDefaultBoard(pBorder) || true) // It doesn't need any more bug 54124 reopen #3
{
setBorders(posFirstTop, posFirstLeft, posLastTop, posLastLeft, pBorder);
setBorders(posFirstTop, posFirstLeft, posLastTop, posLastLeft, ptrBorder);
}
}
}
@ -262,7 +277,7 @@ bool ProtoTable::findCellPos(const int top, const int left, UINT &posRow, UINT &
return !(posRow == countRow || posCol == countCol);
}
void ProtoTable::setBorders(const UINT posFRow, const UINT posFCol, const UINT posLRow, const UINT posLCol, CShapeElement* pBorder)
void ProtoTable::setBorders(const UINT posFRow, const UINT posFCol, const UINT posLRow, const UINT posLCol, CElementPtr ptrBorder)
{
const UINT countRow = m_arrTop.size();
@ -272,7 +287,7 @@ void ProtoTable::setBorders(const UINT posFRow, const UINT posFCol, const UINT p
if ((posFRow != posLRow) && (posFCol != posLCol))
{
auto borPos = posFRow > posLRow ? TCell::lnBlToTr : TCell::lnTlToBr;
m_table[posFRow][posFCol].setBorder(borPos, pBorder);
m_table[posFRow][posFCol].setBorder(borPos, ptrBorder);
return;
}
@ -282,9 +297,9 @@ void ProtoTable::setBorders(const UINT posFRow, const UINT posFCol, const UINT p
for (UINT i = posFCol; i < posLCol; i++)
{
if (posFRow < countRow)
m_table[posFRow][i].setBorder(TCell::lnT, pBorder);
m_table[posFRow][i].setBorder(TCell::lnT, ptrBorder);
if (posFRow > 0)
m_table[posFRow-1][i].setBorder(TCell::lnB, pBorder);
m_table[posFRow-1][i].setBorder(TCell::lnB, ptrBorder);
}
return;
@ -296,9 +311,9 @@ void ProtoTable::setBorders(const UINT posFRow, const UINT posFCol, const UINT p
for (UINT i = posFRow; i < posLRow; i++)
{
if (posFCol < countCol)
m_table[i][posFCol].setBorder(TCell::lnL, pBorder);
m_table[i][posFCol].setBorder(TCell::lnL, ptrBorder);
if (posFCol > 0)
m_table[i][posFCol-1].setBorder(TCell::lnR, pBorder);
m_table[i][posFCol-1].setBorder(TCell::lnR, ptrBorder);
}
return;
@ -315,31 +330,33 @@ bool ProtoTable::isDefaultBoard(const CShapeElement *pBorder)
return color.m_lSchemeIndex == 13;
}
std::vector<std::vector<CShapeElement*> > ProtoTable::getRows(std::vector<CShapeElement *> &arrCells)
{
std::vector<std::vector<CShapeElement*> > arrRows;
int rowTop = -1;
for (auto* pCell : arrCells)
{
if (!pCell) continue;
// It was not been used
//std::vector<std::vector<CShapeElement*> > ProtoTable::getRows(std::vector<CShapeElement *> &arrCells)
//{
// std::vector<std::vector<CShapeElement*> > arrRows;
// int rowTop = -1;
// for (auto* pCell : arrCells)
// {
// if (!pCell) continue;
int top = int(pCell->m_rcChildAnchor.top);
if (top != rowTop)
{
rowTop = top;
arrRows.push_back(std::vector<CShapeElement*>());
}
arrRows.back().push_back(pCell);
}
// int top = int(pCell->m_rcChildAnchor.top);
// if (top != rowTop)
// {
// rowTop = top;
// arrRows.push_back(std::vector<CShapeElement*>());
// }
// arrRows.back().push_back(pCell);
// }
return arrRows;
}
// return arrRows;
//}
MProtoTable ProtoTable::getTable() const
{
return m_table;
}
// I dunno What to use TableStyleId for?
void TableWriter::FillTblPr(PPTX::Logic::TableProperties &oTblPr)
{
// oTblPr.TableStyleId = L"{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
@ -347,9 +364,9 @@ void TableWriter::FillTblPr(PPTX::Logic::TableProperties &oTblPr)
// oTblPr.BandRow = true;
}
void TableWriter::FillTblGrid(std::vector<PPTX::Logic::TableCol> &tblGrid, std::vector<CShapeElement*>& arrCells)
void TableWriter::FillTblGrid(std::vector<PPTX::Logic::TableCol> &tblGrid, std::vector<CElementPtr>& arrCells)
{
auto grid = ProtoTable::getWidth(arrCells);
auto grid = ProtoTable::getWidth(arrCells, m_pTableElement->GetWidth());
for (const auto& w : grid)
{
PPTX::Logic::TableCol tc;
@ -358,18 +375,20 @@ void TableWriter::FillTblGrid(std::vector<PPTX::Logic::TableCol> &tblGrid, std::
}
}
void TableWriter::prepareShapes(std::vector<CShapeElement *> &arrCells, std::vector<CShapeElement *> &arrSpliters)
void TableWriter::prepareShapes(std::vector<CElementPtr> &arrCells, std::vector<CElementPtr> &arrSpliters)
{
for (const auto& ptrShape : m_pTableElement->m_pChildElements)
{
auto pShapeEl = dynamic_cast<CShapeElement*>(ptrShape.get());
if (pShapeEl == nullptr) continue;
switch (pShapeEl->m_lShapeType)
{
case 1:
arrCells.push_back(pShapeEl);
arrCells.push_back(ptrShape);
break;
case 20:
arrSpliters.push_back(pShapeEl);
arrSpliters.push_back(ptrShape);
break;
}
}
@ -379,10 +398,11 @@ void TableWriter::FillRow(PPTX::Logic::TableRow &oRow, ProtoTableRow& arrCells)
{
if (arrCells.empty()) return;
CTextCFRun* pLastCF = nullptr;
for (auto& protoCell : arrCells)
{
PPTX::Logic::TableCell cell;
protoCell.FillTc(cell);
protoCell.FillTc(cell, pLastCF);
oRow.Cells.push_back(cell);
}
}
@ -422,14 +442,14 @@ void TableWriter::FillnvPr(PPTX::Logic::NvPr &oNvPr)
oNvPr.extLst.push_back(ext);
}
TCell::TCell(CShapeElement *pShape, int row, int col, CRelsGenerator* pRels, TCell *pParent) :
m_pShape(pShape), m_row(row), m_col(col), m_rowSpan(1), m_gridSpan(1),
TCell::TCell(CElementPtr ptrShape, int row, int col, CRelsGenerator* pRels, TCell *pParent) :
m_ptrSpElCell(ptrShape), m_row(row), m_col(col), m_rowSpan(1), m_gridSpan(1),
m_pParent(pParent), m_parentDirection(none), m_pRels(pRels)
{
setParentDirection();
}
void TCell::FillTc(PPTX::Logic::TableCell &oTc)
void TCell::FillTc(PPTX::Logic::TableCell &oTc, CTextCFRun* pLastCF)
{
if (m_gridSpan > 1)
oTc.GridSpan = m_gridSpan;
@ -437,7 +457,7 @@ void TCell::FillTc(PPTX::Logic::TableCell &oTc)
oTc.RowSpan = m_rowSpan;
oTc.txBody = new PPTX::Logic::TxBody(L"a:txBody");
FillTxBody(oTc.txBody.get2());
FillTxBody(oTc.txBody.get2(), pLastCF);
if (m_pParent)
{
@ -449,12 +469,12 @@ void TCell::FillTc(PPTX::Logic::TableCell &oTc)
FillTcPr(oTc.CellProperties.get2());
}
void TCell::setBorder(TCell::eBorderPossition borderPos, CShapeElement *pBorder)
void TCell::setBorder(TCell::eBorderPossition borderPos, CElementPtr ptrBorder)
{
if (m_pShape)
m_mapBorders[borderPos] = pBorder;
if (m_ptrSpElCell.get())
m_mapBorders[borderPos] = ptrBorder;
else if (m_pParent)
m_pParent->setBorder(borderPos, pBorder);
m_pParent->setBorder(borderPos, ptrBorder);
}
TCell::eMergeDirection TCell::parentDirection() const
@ -464,7 +484,7 @@ TCell::eMergeDirection TCell::parentDirection() const
int TCell::getHeight() const
{
auto pShape = m_pParent ? m_pParent->m_pShape : m_pShape;
auto pShape = m_pParent ? m_pParent->m_ptrSpElCell : m_ptrSpElCell;
double multip = pShape->m_bAnchorEnabled ? 1587.5 : 1;
double height = pShape->m_rcChildAnchor.bottom - pShape->m_rcChildAnchor.top;
@ -506,29 +526,23 @@ void TCell::setGridSpan(int gridSpan)
bool TCell::isRealCell() const
{
if (m_rowSpan == 2 || m_gridSpan == 2 || m_parentDirection != TCell::none)
if ((m_rowSpan == 2 || m_gridSpan == 2) && m_parentDirection != TCell::none)
return false;
return true;
}
void TCell::FillTxBody(PPTX::Logic::TxBody &oTxBody)
void TCell::FillTxBody(PPTX::Logic::TxBody &oTxBody, CTextCFRun* pLastCF)
{
if (m_pShape == nullptr)
{
TxBodyConverter txBodyConverter(nullptr, m_pRels, TxBodyConverter::table);
txBodyConverter.FillTxBody(oTxBody);
} else
{
TxBodyConverter txBodyConverter(m_pShape, m_pRels, TxBodyConverter::table);
txBodyConverter.FillTxBody(oTxBody);
}
TxBodyConverter txBodyConverter(m_ptrSpElCell, m_pRels, pLastCF);
txBodyConverter.FillTxBody(oTxBody);
}
void TCell::FillTcPr(PPTX::Logic::TableCellProperties &oTcPr)
{
auto pShapeEl = static_cast<CShapeElement*>(m_ptrSpElCell.get());
auto pShape = pShapeEl->m_pShape;
//anchor
auto& attr = m_pShape->m_pShape->m_oText.m_oAttributes;
auto& attr = pShape->m_oText.m_oAttributes;
if (attr.m_nTextAlignVertical != -1)
{
auto pAnchor = new PPTX::Limit::TextAnchor;
@ -543,10 +557,10 @@ void TCell::FillTcPr(PPTX::Logic::TableCellProperties &oTcPr)
oTcPr.AnchorCtr = true;
}
oTcPr.MarB = round(m_pShape->m_pShape->m_dTextMarginBottom); // 0
oTcPr.MarT = round(m_pShape->m_pShape->m_dTextMarginY); // 12512
oTcPr.MarL = round(m_pShape->m_pShape->m_dTextMarginX);
oTcPr.MarR = round(m_pShape->m_pShape->m_dTextMarginRight);
oTcPr.MarB = round(pShape->m_dTextMarginBottom); // 0
oTcPr.MarT = round(pShape->m_dTextMarginY); // 12512
oTcPr.MarL = round(pShape->m_dTextMarginX);
oTcPr.MarR = round(pShape->m_dTextMarginRight);
if (true)
{
@ -554,7 +568,7 @@ void TCell::FillTcPr(PPTX::Logic::TableCellProperties &oTcPr)
oTcPr.HorzOverflow->set(L"overflow");
}
auto& brush = m_pShape->m_oBrush;
auto& brush = m_ptrSpElCell->m_oBrush;
auto pSolidFill = new PPTX::Logic::SolidFill;
auto& clr = brush.Color1;
@ -609,9 +623,9 @@ void TCell::SetTcPrInvisibleBorder(PPTX::Logic::TableCellProperties &oTcPr, TCel
ApplyLn(oTcPr, pLn, eBP);
}
bool TCell::isInvisibleBorder(const CShapeElement *pBorder)
bool TCell::isInvisibleBorder(const CElementPtr ptrBorder)
{
const bool isInv = pBorder && pBorder->m_bLine == false;
const bool isInv = ptrBorder && ptrBorder->m_bLine == false;
return isInv;
}
@ -633,18 +647,18 @@ bool TCell::isInvisibleBorders() const
return isInvisibele;
}
void TCell::FillLn(PPTX::Logic::Ln &Ln, TCell::eBorderPossition eBP, CShapeElement *pBorder)
void TCell::FillLn(PPTX::Logic::Ln &Ln, TCell::eBorderPossition eBP, CElementPtr ptrBorder)
{
if (pBorder == nullptr)
if (!ptrBorder)
return;
SetLnName(Ln, eBP);
auto& pen = pBorder->m_oPen;
auto& brush = pBorder->m_oBrush;
auto& pen = ptrBorder->m_oPen;
auto& brush = ptrBorder->m_oBrush;
Ln.w = pen.Size;
if (isInvisibleBorder(pBorder))
if (isInvisibleBorder(ptrBorder))
Ln.Fill.Fill.reset(new PPTX::Logic::NoFill);
else
{
@ -721,20 +735,20 @@ void TCell::setRowSpan(int rowSpan)
m_rowSpan = rowSpan;
}
void TCell::setPShape(CShapeElement *pShape)
void TCell::setPShape(CElementPtr ptrShape)
{
m_pShape = pShape;
m_ptrSpElCell = ptrShape;
m_parentDirection = none;
}
ProtoTable::ProtoTable(std::vector<CShapeElement *> &arrCells,
std::vector<CShapeElement*>& arrSpliters,
ProtoTable::ProtoTable(std::vector<CElementPtr> &arrCells,
std::vector<CElementPtr> &arrSpliters,
CRelsGenerator *pRels) : m_pRels(pRels)
{
m_arrLeft = getWidth(arrCells, false);
m_arrTop = getHeight(arrCells, false);
m_arrLeft = getWidth(arrCells, -1, false);
m_arrTop = getHeight(arrCells, -1, false);
initProtoTable();
fillProtoTable(arrCells, arrSpliters);
}

View File

@ -40,9 +40,9 @@ namespace PPT_FORMAT
class TCell
{
public:
TCell(CShapeElement *pShape, int row, int col, CRelsGenerator* pRels, TCell* pParent = nullptr);
TCell(CElementPtr ptrShape, int row, int col, CRelsGenerator* pRels, TCell* pParent = nullptr);
void FillTc(PPTX::Logic::TableCell &oTc);
void FillTc(PPTX::Logic::TableCell &oTc, CTextCFRun *pLastCF);
enum eMergeDirection {
none = 0b00,
@ -60,13 +60,13 @@ public:
lnTlToBr,
lnBlToTr
};
void setBorder(eBorderPossition borderPos, CShapeElement *pBorder);
void setBorder(eBorderPossition borderPos, CElementPtr ptrBorder);
eMergeDirection parentDirection() const;
int getHeight()const;
void setPParent(TCell *pParent);
void setPShape(CShapeElement *pShape);
void setPShape(CElementPtr ptrShape);
void setRowSpan(int rowSpan);
@ -75,23 +75,22 @@ public:
bool isRealCell()const;
private:
void FillTxBody(PPTX::Logic::TxBody &oTxBody);
void FillTxBody(PPTX::Logic::TxBody &oTxBody, CTextCFRun *pLastCF);
void FillTcPr(PPTX::Logic::TableCellProperties& oTcPr);
void SetTcPrInvisibleBorders(PPTX::Logic::TableCellProperties& oTcPr)const;
void SetTcPrInvisibleBorder(PPTX::Logic::TableCellProperties& oTcPr, eBorderPossition eBP)const;
static bool isInvisibleBorder(const CShapeElement *pBorder);
static bool isInvisibleBorder(const CElementPtr ptrBorder);
bool isInvisibleBorders() const;
void FillLn(PPTX::Logic::Ln& Ln, eBorderPossition eBP, CShapeElement* pBorder);
void FillLn(PPTX::Logic::Ln& Ln, eBorderPossition eBP, CElementPtr ptrBorder);
void SetLnName(PPTX::Logic::Ln& Ln, eBorderPossition eBP) const;
void ApplyLn(PPTX::Logic::TableCellProperties& oTcPr, PPTX::Logic::Ln *pLn, eBorderPossition eBP) const;
void FillMergeDirection(PPTX::Logic::TableCell& oTc);
void setParentDirection();
private:
CShapeElement* m_pShape;
CElementPtr m_ptrSpElCell;
std::map<eBorderPossition, CShapeElement*> m_mapBorders;
std::list<CElementPtr> m_lstVirtBorders;
std::map<eBorderPossition, CElementPtr> m_mapBorders;
// Proto table's coord
int m_row, m_col;
@ -104,7 +103,7 @@ private:
eMergeDirection m_parentDirection;
// Common
CRelsGenerator* m_pRels;
CRelsGenerator* m_pRels;
};
@ -115,28 +114,28 @@ typedef std::vector<ProtoTableRow> MProtoTable;
class ProtoTable
{
public:
ProtoTable(std::vector<CShapeElement *> &arrCells,
std::vector<CShapeElement*>& arrSpliters,
ProtoTable(std::vector<CElementPtr> &arrCells,
std::vector<CElementPtr>& arrSpliters,
CRelsGenerator* pRels);
static std::vector<int> getWidth(std::vector<CShapeElement *> &arrCells, bool isWidth = true);
static std::vector<int> getHeight(std::vector<CShapeElement *> &arrCells, bool isHeight = true);
static std::vector<int> getWidth(const std::vector<CElementPtr> &arrCells, long tableWidth = -1, bool isWidth = true);
static std::vector<int> getHeight(const std::vector<CElementPtr> &arrCells, long tableHeight = -1, bool isHeight = true);
static bool checkRowForZeroHeight(const ProtoTableRow& oRow);
MProtoTable getTable() const;
private:
void initProtoTable();
bool fillProtoTable(std::vector<CShapeElement *> &arrCells, std::vector<CShapeElement *> &arrSpliters);
bool fillCells(std::vector<CShapeElement *> &arrCells);
void fillBorders(std::vector<CShapeElement *> &arrSpliters);
bool fillProtoTable(std::vector<CElementPtr> &arrCells, std::vector<CElementPtr> &arrSpliters);
bool fillCells(std::vector<CElementPtr> &arrCells);
void fillBorders(std::vector<CElementPtr> &arrSpliters);
bool findCellPos(const int top, const int left, UINT& posRow, UINT& posCol);
std::list<TCell *> getParentCellFromTable(const UINT posFRow, const UINT posFCol, const UINT posLRow, const UINT posLCol);
void setBorders(const UINT posFRow, const UINT posFCol, const UINT posLRow, const UINT posLCol, CShapeElement *pBorder);
std::list<TCell*> getParentCellFromTable(const UINT posFRow, const UINT posFCol, const UINT posLRow, const UINT posLCol);
void setBorders(const UINT posFRow, const UINT posFCol, const UINT posLRow, const UINT posLCol, CElementPtr ptrBorder);
bool isDefaultBoard(const CShapeElement *pBorder);
std::vector<std::vector<CShapeElement *> >
getRows(std::vector<CShapeElement *> &arrCells);
getRows(std::vector<CShapeElement *> &arrCells);
private:
std::vector<int> m_arrLeft;
@ -159,9 +158,9 @@ private:
void FillTblPr(PPTX::Logic::TableProperties& oTblPr);
void FillTblGrid(std::vector<PPTX::Logic::TableCol>& tblGrid,
std::vector<CShapeElement *> &arrCells);
void prepareShapes(std::vector<CShapeElement*> &arrCells,
std::vector<CShapeElement*>& arrSpliters);
std::vector<CElementPtr> &arrCells);
void prepareShapes(std::vector<CElementPtr> &arrCells,
std::vector<CElementPtr> &arrSpliters);
void FillRow(PPTX::Logic::TableRow& oRow, ProtoTableRow &arrCells);

View File

@ -6,79 +6,33 @@
using namespace PPT_FORMAT;
TxBodyConverter::TxBodyConverter(CShapeElement *pShapeElement, CRelsGenerator* pRels, TxBodyConverter::eTxType txType) :
m_pShapeElement(pShapeElement), m_pRels(pRels), m_txType(txType),
m_bWordArt(false)
TxBodyConverter::TxBodyConverter(CElementPtr pShapeElement, CRelsGenerator* pRels, CTextCFRun *pLastCF) :
m_bError(false), m_pLastCF(pLastCF)
{
if (pShapeElement && pShapeElement->m_pShape)
pText = &pShapeElement->m_pShape->m_oText;
else
pText = nullptr;
m_bError = !m_oShapeWriter.SetElement(pShapeElement);
if (!m_bError)
{
m_oShapeWriter.SetRelsGenerator(pRels);
}
}
void TxBodyConverter::FillTxBody(PPTX::Logic::TxBody &oTxBody)
{
if (m_pShapeElement == nullptr)
{
if (m_bError)
FillMergedTxBody(oTxBody);
return;
}
switch (m_txType)
{
case shape: ConvertShapeTxBody(oTxBody); break;
case table: ConvertTableTxBody(oTxBody); break;
}
else
ConvertTableTxBody(oTxBody);
}
void TxBodyConverter::ConvertTableTxBody(PPTX::Logic::TxBody &oTxBody)
{
m_oShapeWriter.WriteTextInfo(m_pLastCF);
XmlUtils::CXmlNode xmlReader;
xmlReader.FromXmlString(m_oShapeWriter.getOWriterStr());
oTxBody.fromXML(xmlReader);
oTxBody.m_name = L"a:txBody";
oTxBody.bodyPr = new PPTX::Logic::BodyPr;
FillBodyPr(oTxBody.bodyPr.get2());
size_t nCount = pText->m_arParagraphs.size();
if (nCount == 0)
{
oTxBody.lstStyle = new PPTX::Logic::TextListStyle;
PPTX::Logic::Paragraph paragraph;
unsigned sz = m_pShapeElement->m_rcChildAnchor.GetHeight() * 10;
paragraph.endParaRPr = getNewEndParaRPr(false, sz > 2000 ? 2000 : sz);
oTxBody.Paragrs.push_back(paragraph);
return;
}
if (pText == nullptr)
return;
// todo
oTxBody.lstStyle = new PPTX::Logic::TextListStyle;
if (!m_bWordArt)
FillLstStyles(oTxBody.lstStyle.get2(), pText->m_oStyles);
for (size_t nIndexPar = 0; nIndexPar < nCount; ++nIndexPar)
{
PPTX::Logic::Paragraph p;
FillParagraph(p,pText->m_arParagraphs[nIndexPar]);
oTxBody.Paragrs.push_back(std::move(p));
}
// if (m_pText)
// {
// FillLstStyles(oTxBody.lstStyle.get2(), m_pText->m_oStyles);
// FillParagraphs(oTxBody.Paragrs, m_pText->m_arParagraphs);
// }
}
void TxBodyConverter::ConvertShapeTxBody(PPTX::Logic::TxBody &oTxBody)
{
}
void TxBodyConverter::FillMergedTxBody(PPTX::Logic::TxBody &oTxBody)
@ -92,376 +46,6 @@ void TxBodyConverter::FillMergedTxBody(PPTX::Logic::TxBody &oTxBody)
oTxBody.Paragrs.push_back(paragraph);
}
void TxBodyConverter::FillBodyPr(PPTX::Logic::BodyPr &oBodyPr)
{
CDoubleRect oTextRect;
m_pShapeElement->m_pShape->GetTextRect(oTextRect);
oBodyPr.lIns = oTextRect.left;
oBodyPr.rIns = oTextRect.right;
oBodyPr.tIns = oTextRect.top;
oBodyPr.bIns = oTextRect.bottom;
auto pAnchor = new PPTX::Limit::TextAnchor;
switch (pText->m_oAttributes.m_nTextAlignVertical)
{
case 0: pAnchor->set(L"t"); break;
case 2: pAnchor->set(L"b"); break;
default:
pAnchor->set(L"ctr");
oBodyPr.anchorCtr = false;
}
oBodyPr.anchor = pAnchor;
if (m_pShapeElement->m_pShape->m_oText.m_bAutoFit)
oBodyPr.Fit.type = PPTX::Logic::TextFit::FitSpAuto;
if (pText->m_oAttributes.m_dTextRotate > 0)
oBodyPr.rot = round(pText->m_oAttributes.m_dTextRotate * 60000);
if (pText->m_nTextFlow >= 0)
{
auto *pVert = new PPTX::Limit::TextVerticalType;
switch(pText->m_nTextFlow)
{
case 1:
case 3: pVert->set(L"vert"); break;
case 2: pVert->set(L"vert270"); break;
case 5: pVert->set(L"wordArtVert"); break;
}
oBodyPr.vert = pVert;
}
else if (pText->m_bVertical)
{
auto *pVert = new PPTX::Limit::TextVerticalType;
pVert->set(L"eaVert");
oBodyPr.vert = pVert;
}
std::wstring prstGeom = oox::Spt2ShapeType_mini((oox::MSOSPT)m_pShapeElement->m_lShapeType);
std::wstring prstTxWarp = oox::Spt2WordArtShapeType((oox::MSOSPT)m_pShapeElement->m_lShapeType);
if (prstGeom.size() && prstTxWarp.size())
{
m_bWordArt = true;
auto pPrstTxWarp = new PPTX::Logic::PrstTxWarp;
pPrstTxWarp->prst.set(prstTxWarp);
CPPTShape *pPPTShape = dynamic_cast<CPPTShape *>(m_pShapeElement->m_pShape->getBaseShape().get());
std::wstring strVal;
for (size_t i = 0 ; (pPPTShape) && (i < pPPTShape->m_arAdjustments.size()); i++)
{
PPTX::Logic::Gd gd;
switch(m_pShapeElement->m_lShapeType)
{
case oox::msosptTextFadeUp:
{
double kf = 4.63; //"волшебный"
std::wstring strVal = std::to_wstring(round(kf * pPPTShape->m_arAdjustments[i]));
gd.fmla = L"val";
gd.name = L"adj";
pPrstTxWarp->avLst.push_back(std::move(gd));
}break;
}
}
oBodyPr.prstTxWarp = pPrstTxWarp;
}
}
void TxBodyConverter::FillLstStyles(PPTX::Logic::TextListStyle &oTLS, CTextStyles &oStyles)
{
}
void TxBodyConverter::FillParagraph(PPTX::Logic::Paragraph &p, CParagraph &paragraph)
{
p.pPr = new PPTX::Logic::TextParagraphPr;
FillPPr(p.pPr.get2(), paragraph, m_pRels);
size_t nCountSpans = paragraph.m_arSpans.size();
for (size_t nSpan = 0; nSpan < nCountSpans; ++nSpan)
{
if ((nSpan == (nCountSpans - 1)) && (_T("\n") == paragraph.m_arSpans[nSpan].m_strText || paragraph.m_arSpans[nSpan].m_strText.empty()) )
{
PPT_FORMAT::CTextCFRun* pCF = &paragraph.m_arSpans[nSpan].m_oRun;
if ((pCF->Size.is_init()) && (pCF->Size.get() > 0) && (pCF->Size.get() < 4001))
p.endParaRPr = getNewEndParaRPr(-1, (100 * pCF->Size.get()), L"en-US");
else
p.endParaRPr = getNewEndParaRPr(-1, -1, L"en-US");
continue;
}
int span_sz = paragraph.m_arSpans[nSpan].m_strText.length() ;
if ((span_sz==1 && ( paragraph.m_arSpans[nSpan].m_strText[0] == (wchar_t)13 )) ||
((span_sz==2 && ( paragraph.m_arSpans[nSpan].m_strText[0] == (wchar_t)13 ) &&
( paragraph.m_arSpans[nSpan].m_strText[1] == (wchar_t)13 ))))
continue;
PPTX::Logic::RunElem runElem;
if (paragraph.m_arSpans[nSpan].m_bBreak)
{
auto pBr = new PPTX::Logic::Br;
pBr->rPr = new PPTX::Logic::RunProperties;
FillRPr(pBr->rPr.get2(), paragraph.m_arSpans[nSpan].m_oRun);
runElem.InitRun(pBr);
} else
{
auto pRun = new PPTX::Logic::Run();
FillRun(*pRun, paragraph.m_arSpans[nSpan]);
runElem.InitRun(pRun);
auto pFld = new PPTX::Logic::Fld;
if (m_pShapeElement->m_lPlaceholderType == PT_MasterSlideNumber/* && paragraph.m_arSpans[nSpan].m_bField*/)
{
pFld->id = L"{D038279B-FC19-497E-A7D1-5ADD9CAF016F}";
pFld->type = L"slidenum";
} else if (m_pShapeElement->m_lPlaceholderType == PT_MasterDate && m_pShapeElement->m_nFormatDate == 1/* && pParagraph->m_arSpans[nSpan].m_bField*/)
{
pFld->id = L"{D7E01130-044F-4930-9A27-C729C70D8524}";
pFld->type = L"datetime1";
} else {
delete pFld;
pFld = nullptr;
}
if (pFld)
{
PPTX::Logic::RunElem runElemFld;
runElemFld.InitRun(pFld);
p.RunElems.push_back(std::move(runElemFld));
}
}
p.RunElems.push_back(std::move(runElem));
}
}
void TxBodyConverter::FillPPr(PPTX::Logic::TextParagraphPr &oPPr, CParagraph &paragraph, CRelsGenerator *pRels)
{
oPPr.lvl = paragraph.m_lTextLevel;
auto* pPF = &(paragraph.m_oPFRun);
if (pPF)
ConvertPFRun(oPPr, pPF, pRels);
}
void TxBodyConverter::ConvertPFRun(PPTX::Logic::TextParagraphPr &oPPr, CTextPFRun *pPF, CRelsGenerator* pRels)
{
int leftMargin = 0;
if (pPF->leftMargin.is_init())
{
leftMargin = pPF->leftMargin.get();
oPPr.marL = leftMargin;
}
if (pPF->indent.is_init())
{
if (pPF->hasBullet.get_value_or(false))
oPPr.indent = pPF->indent.get();
else
oPPr.indent = pPF->indent.get() - leftMargin;
}
if (pPF->textAlignment.is_init())
{
oPPr.algn = new PPTX::Limit::TextAlign;
oPPr.algn->set(CStylesWriter::GetTextAlign(pPF->textAlignment.get()));
}
if (pPF->defaultTabSize.is_init())
{
oPPr.defTabSz = pPF->defaultTabSize.get();
}
if (pPF->textDirection.is_init())
{
if (pPF->textDirection.get() == 1) oPPr.rtl = true;
else oPPr.rtl = false;
}
if (pPF->fontAlign.is_init())
{
oPPr.fontAlgn = new PPTX::Limit::FontAlign;
oPPr.fontAlgn->set(CStylesWriter::GetFontAlign(pPF->fontAlign.get()));
}
ConvertTabStops(oPPr.tabLst, pPF->tabStops);
if (pPF->lineSpacing.is_init())
{
LONG val = pPF->lineSpacing.get();
auto pLnSpc = new PPTX::Logic::TextSpacing;
pLnSpc->m_name = L"a:lnSpc";
if (val > 0)
pLnSpc->spcPct = val * 12.5;
else if (val < 0 && val > -13200)
pLnSpc->spcPct = val * -1000;
oPPr.lnSpc = pLnSpc;
}
if (pPF->spaceAfter.is_init())
{
LONG val = pPF->spaceAfter.get();
auto pSpcAft = new PPTX::Logic::TextSpacing;
pSpcAft->m_name = L"a:spcAft";
if (val > 0)
pSpcAft->spcPts = round(12.5 * pPF->spaceAfter.get());
else if (val < 0 && val > -13200)
pSpcAft->spcPts = val * -1000;
oPPr.spcAft = pSpcAft;
}
if (pPF->spaceBefore.is_init())
{
LONG val = pPF->spaceBefore.get();
auto pSpcBef = new PPTX::Logic::TextSpacing;
pSpcBef->m_name = L"a:spcBef";
if (val > 0)
pSpcBef->spcPts = round(12.5 * pPF->spaceBefore.get());
else if (val < 0 && val > -13200)
pSpcBef->spcPct = val * -1000;
oPPr.spcBef = pSpcBef;
}
ConvertAllBullets(oPPr, pPF, pRels);
}
void TxBodyConverter::ConvertTabStops(std::vector<PPTX::Logic::Tab> &arrTabs, std::vector<std::pair<int, int> > &arrTabStops)
{
for (size_t t = 0 ; t < arrTabStops.size(); t++)
{
PPTX::Logic::Tab tab;
tab.pos = arrTabStops[t].first;
auto pAlgn = new PPTX::Limit::TextTabAlignType;
switch (arrTabStops[t].second)
{
case 1: pAlgn->set(L"ctr"); break;
case 2: pAlgn->set(L"r"); break;
case 3: pAlgn->set(L"dec"); break;
default: pAlgn->set(L"l");
}
tab.algn = pAlgn;
arrTabs.push_back(tab);
}
}
void TxBodyConverter::FillBuChar(PPTX::Logic::Bullet &oBullet, WCHAR symbol)
{
auto pBuChar = new PPTX::Logic::BuChar;
pBuChar->Char.clear();
pBuChar->Char.push_back(symbol);
oBullet.m_Bullet.reset(pBuChar);
}
void TxBodyConverter::ConvertAllBullets(PPTX::Logic::TextParagraphPr &oPPr, CTextPFRun *pPF, CRelsGenerator* pRels)
{
if (pPF->hasBullet.is_init())
{
if (pPF->hasBullet.get())
{
if (pPF->bulletColor.is_init())
{
FillBuClr(oPPr.buColor, pPF->bulletColor.get());
}
if (pPF->bulletSize.is_init())
{
PPTX::WrapperWritingElement* pBuSize = NULL;
if (pPF->bulletSize.get() > 24 && pPF->bulletSize.get() < 401)
{
pBuSize = new PPTX::Logic::BuSzPct;
static_cast<PPTX::Logic::BuSzPct*>(pBuSize)->val = pPF->bulletSize.get() * 1000 ;
}
if (pPF->bulletSize.get() < 0 && pPF->bulletSize.get() > -4001)
{
pBuSize = new PPTX::Logic::BuSzPts;
static_cast<PPTX::Logic::BuSzPts*>(pBuSize)->val = - (pPF->bulletSize.get());
}
if (pBuSize)
oPPr.buSize.m_Size = pBuSize;
}
if (pPF->bulletFontProperties.is_init())
{
auto pBuFont = new PPTX::Logic::TextFont;
pBuFont->m_name = L"a:buFont";
pBuFont->typeface = pPF->bulletFontProperties->Name;
if ( pPF->bulletFontProperties->PitchFamily > 0)
pBuFont->pitchFamily = std::to_wstring(pPF->bulletFontProperties->PitchFamily);
if ( pPF->bulletFontProperties->Charset > 0)
pBuFont->charset = std::to_wstring(pPF->bulletFontProperties->Charset);
oPPr.buTypeface.m_Typeface.reset(pBuFont);
}
// Bullets (numbering, else picture, else char, else default)
if (pPF->bulletBlip.is_init() && pPF->bulletBlip->tmpImagePath.size() && pRels != nullptr)
{
auto strRID = pRels->WriteImage(pPF->bulletBlip->tmpImagePath);
if (strRID.empty())
FillBuChar(oPPr.ParagraphBullet, L'\x2022'); // error rId
else
{
auto pBuBlip = new PPTX::Logic::BuBlip;
pBuBlip->blip.embed = new OOX::RId(strRID);
oPPr.ParagraphBullet.m_Bullet.reset(pBuBlip);
}
}
else if (pPF->bulletChar.is_init() && (pPF->bulletAutoNum.is_init() ? pPF->bulletAutoNum->isDefault() : true))
{
FillBuChar(oPPr.ParagraphBullet, pPF->bulletChar.get());
}
else if (pPF->bulletAutoNum.is_init())
{
auto pBuAutoNum = new PPTX::Logic::BuAutoNum;
oPPr.ParagraphBullet.m_Bullet.reset(pBuAutoNum);
if (pPF->bulletAutoNum->startAt.is_init() && pPF->bulletAutoNum->startAt.get() != 1)
pBuAutoNum->startAt = pPF->bulletAutoNum->startAt.get();
if (pPF->bulletAutoNum->type.is_init())
pBuAutoNum->type = pPF->bulletAutoNum->type.get();
}
else
{
FillBuChar(oPPr.ParagraphBullet, L'\x2022');
}
}
else
{
oPPr.buTypeface.m_Typeface.reset(new PPTX::Logic::BuNone);
}
}
}
void TxBodyConverter::FillBuClr(PPTX::Logic::BulletColor &oBuClr, CColor &oColor)
{
auto pBuClr = new PPTX::Logic::BuClr;
pBuClr->Color.SetRGBColor(oColor.GetR(), oColor.GetG(), oColor.GetB());
oBuClr.m_Color.reset(pBuClr);
}
void TxBodyConverter::FillRun(PPTX::Logic::Run &oRun, CSpan &oSpan)
{
oRun.SetText(oSpan.m_strText);
oRun.rPr = new PPTX::Logic::RunProperties;
FillRPr(oRun.rPr.get2(), oSpan.m_oRun);
}
PPTX::Logic::RunProperties *TxBodyConverter::getNewEndParaRPr(const int dirty, const int sz , const std::wstring& lang)
{
auto pEndParaRPr = new PPTX::Logic::RunProperties;
@ -476,227 +60,3 @@ PPTX::Logic::RunProperties *TxBodyConverter::getNewEndParaRPr(const int dirty, c
return pEndParaRPr;
}
void TxBodyConverter::FillRPr(PPTX::Logic::RunProperties &oRPr, CTextCFRun &oCFRun)
{
oRPr.normalizeH = false;
if ((oCFRun.Size.is_init()) && (oCFRun.Size.get() > 0) && (oCFRun.Size.get() < 4001))
{
oRPr.sz = int(100 * oCFRun.Size.get());
} else
{
oRPr.sz = 1800;
}
if (oCFRun.BaseLineOffset.is_init())
{
oRPr.baseline = int(1000 * oCFRun.BaseLineOffset.get());
}
if (oCFRun.FontBold.is_init())
{
oRPr.b = oCFRun.FontBold.get();
}
else
{
oRPr.b = false;
}
if (oCFRun.FontItalic.is_init())
{
oRPr.i = oCFRun.FontItalic.get();
}
if (oCFRun.FontUnderline.is_init())
{
oRPr.u = new PPTX::Limit::TextUnderline;
oRPr.u->set(oCFRun.FontUnderline.get() ? L"sng" : L"none");
}
if (oCFRun.Language.is_init())
{
std::wstring str_lang = msLCID2wstring(oCFRun.Language.get());
if (str_lang.length() > 0)
oRPr.lang = msLCID2wstring(oCFRun.Language.get());
}
if (m_bWordArt)
{//порядок важен - линия, заливка, тень !!!
if (m_pShapeElement->m_bLine)
{
oRPr.ln = new PPTX::Logic::Ln;
ConvertLine(oRPr.ln.get2());
}
// I don't know todo or not
// m_oWriter.WriteString(ConvertBrush(pShapeElement->m_oBrush));
// m_oWriter.WriteString(ConvertShadow(pShapeElement->m_oShadow));
}
else
{
if (oCFRun.Color.is_init())
{
if (oCFRun.Color->m_lSchemeIndex != -1)
{
FillSchemeClr(oRPr.Fill, oCFRun.Color.get());
}
else
{
FillSolidFill(oRPr.Fill, oCFRun.Color.get());
}
}
}
FillEffectLst(oRPr.EffectList, oCFRun);
if (oCFRun.Color.is_init())
FillSolidFill(oRPr.Fill, oCFRun.Color.get());
if (oCFRun.font.font.is_init())
{
auto charset = oCFRun.font.font->Charset;
oRPr.latin = new PPTX::Logic::TextFont;
oRPr.latin->m_name = L"a:latin";
oRPr.latin->typeface = oCFRun.font.font->Name;
if (charset < 128)
oRPr.latin->charset = std::to_wstring(charset);
oRPr.latin->pitchFamily = std::to_wstring(oCFRun.font.font->PitchFamily + 2);
} // todo else for fontRef.is_init() // it's theme
if (oCFRun.font.ea.is_init())
{
auto charset = oCFRun.font.ea->Charset;
oRPr.ea = new PPTX::Logic::TextFont;
oRPr.ea->m_name = L"a:ea";
oRPr.ea->typeface = oCFRun.font.ea->Name;
if (charset < 128)
oRPr.ea->charset = std::to_wstring(oCFRun.font.ea->Charset);
}
if (oCFRun.font.sym.is_init())
{
oRPr.sym = new PPTX::Logic::TextFont;
oRPr.sym->m_name = L"a:sym";
oRPr.sym->typeface = oCFRun.font.sym->Name;
oRPr.sym->charset = std::to_wstring(oCFRun.font.sym->Charset);
}
}
void TxBodyConverter::ConvertLine(PPTX::Logic::Ln &oLn)
{
auto& oPen = m_pShapeElement->m_oPen;
oLn.cmpd = new PPTX::Limit::CompoundLine;
switch(oPen.LineStyle)
{
case 1: oLn.cmpd->set(L"dbl"); break;
case 2: oLn.cmpd->set(L"thickThin"); break;
case 3: oLn.cmpd->set(L"thinThick"); break;
case 4: oLn.cmpd->set(L"tri"); break;
}
oLn.w = oPen.Size;
FillSolidFill(oLn.Fill, oPen.Color);
if (oPen.DashStyle > 0 && oPen.DashStyle < 11)
{
oLn.prstDash = new PPTX::Logic::PrstDash;
oLn.prstDash.get2().val = new PPTX::Limit::PrstDashVal;
auto& val = oLn.prstDash.get2().val;
switch(oPen.DashStyle)
{
case 1: val->set(L"sysDash"); break;
case 2: val->set(L"sysDot"); break;
case 3: val->set(L"sysDashDot"); break;
case 4: val->set(L"sysDashDotDot"); break;
case 5: val->set(L"dot"); break;
case 6: val->set(L"dash"); break;
case 7: val->set(L"lgDash"); break;
case 8: val->set(L"dashDot"); break;
case 9: val->set(L"lgDashDot"); break;
case 10: val->set(L"lgDashDotDot"); break;
}
}
switch(oPen.LineJoin)
{
case 0: oLn.Join.type = PPTX::Logic::eJoin::JoinBevel; break;
case 1: oLn.Join.type = PPTX::Logic::eJoin::JoinMiter; break;
case 2: oLn.Join.type = PPTX::Logic::eJoin::JoinRound; break;
}
oLn.headEnd = new PPTX::Logic::LineEnd;
oLn.tailEnd = new PPTX::Logic::LineEnd;
ConvertLineEnd(oLn.headEnd.get2(), oPen.LineStartCap, oPen.LineStartLength, oPen.LineStartWidth, true);
ConvertLineEnd(oLn.tailEnd.get2(), oPen.LineEndCap, oPen.LineEndLength, oPen.LineEndWidth, false);
}
void TxBodyConverter::ConvertLineEnd(PPTX::Logic::LineEnd &oLine, unsigned char cap, unsigned char length, unsigned char width, bool isHead)
{
if (cap < 1)
return;
if (isHead)
oLine.m_name = L"a:headEnd";
else
oLine.m_name = L"a:tailEnd";
oLine.type = new PPTX::Limit::LineEndType;
switch(cap)
{
case 1: oLine.type->set(L"triangle"); break;
case 2: oLine.type->set(L"stealth"); break;
case 3: oLine.type->set(L"diamond"); break;
case 4: oLine.type->set(L"oval"); break;
case 5: oLine.type->set(L"arrow"); break;
}
oLine.len = new PPTX::Limit::LineEndSize;
switch(length)
{
case 0: oLine.len->set(L"sm"); break;
case 1: oLine.len->set(L"med"); break;
case 2: oLine.len->set(L"lg"); break;
}
oLine.w = new PPTX::Limit::LineEndSize;
switch(width)
{
case 0: oLine.w->set(L"sm"); break;
case 1: oLine.w->set(L"med"); break;
case 2: oLine.w->set(L"lg"); break;
}
}
void TxBodyConverter::ConvertBrush(PPTX::Logic::RunProperties &oRPr)
{
CBrush& brush = m_pShapeElement->m_oBrush;
}
void TxBodyConverter::FillSolidFill(PPTX::Logic::UniFill &oUF, CColor &oColor)
{
auto pSolidFill = new PPTX::Logic::SolidFill;
pSolidFill->Color.SetRGBColor(oColor.GetR(), oColor.GetG(), oColor.GetB());
oUF.Fill.reset(pSolidFill);
}
void TxBodyConverter::FillSchemeClr(PPTX::Logic::UniFill &oUF, CColor &oColor)
{
auto pSolidFill = new PPTX::Logic::SolidFill;
auto pScheme = new PPTX::Logic::SchemeClr;
pScheme->val.set(CStylesWriter::GetColorInScheme(oColor.m_lSchemeIndex));
pSolidFill->Color.Color.reset(pScheme);
oUF.Fill.reset(pSolidFill);
}
void TxBodyConverter::FillEffectLst(PPTX::Logic::EffectProperties &oEList, CTextCFRun &oCFRun)
{
auto pELst = new PPTX::Logic::EffectLst;
if (oCFRun.FontShadow.is_init() && oCFRun.FontShadow.get())
{
pELst->outerShdw = new PPTX::Logic::OuterShdw;
pELst->outerShdw->blurRad = 38100;
pELst->outerShdw->dist = 38100;
pELst->outerShdw->dir = 2700000;
pELst->outerShdw->algn = new PPTX::Limit::RectAlign;
pELst->outerShdw->algn->set(L"tl");
pELst->outerShdw->Color.SetRGBColor(0, 0, 0);
}
oEList.List.reset(pELst);
}

View File

@ -31,63 +31,25 @@
*/
#pragma once
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Elements.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/TxBody.h"
#include "ImageManager.h"
#include "ShapeWriter.h"
namespace PPT_FORMAT
{
class TxBodyConverter
{
public:
enum eTxType
{
shape,
table
};
TxBodyConverter(CShapeElement* pShapeElement, CRelsGenerator* pRels, eTxType txType);
TxBodyConverter(CElementPtr pShapeElement, CRelsGenerator* pRels, CTextCFRun* pLastCF);
void FillTxBody(PPTX::Logic::TxBody& oTxBody);
private:
void ConvertTableTxBody(PPTX::Logic::TxBody& oTxBody);
void ConvertShapeTxBody(PPTX::Logic::TxBody& oTxBody);
void FillMergedTxBody(PPTX::Logic::TxBody& oTxBody);
public:
static void FillPPr(PPTX::Logic::TextParagraphPr& oPPr, CParagraph &paragraph, CRelsGenerator *pRels);
static void ConvertPFRun(PPTX::Logic::TextParagraphPr &oPPr, PPT_FORMAT::CTextPFRun* pPF, CRelsGenerator *pRels);
static void FillMergedTxBody(PPTX::Logic::TxBody& oTxBody);
static PPTX::Logic::RunProperties* getNewEndParaRPr(const int dirty = -1, const int sz = -1, const std::wstring& lang = L"");
private:
void FillBodyPr(PPTX::Logic::BodyPr& oBodyPr);
void FillLstStyles(PPTX::Logic::TextListStyle& oTLS, CTextStyles& oStyles);
void FillParagraph(PPTX::Logic::Paragraph& p, CParagraph& paragraph);
static void ConvertTabStops(std::vector<PPTX::Logic::Tab>& arrTabs, std::vector<std::pair<int, int>>& arrTabStops);
static void FillBuChar(PPTX::Logic::Bullet& oBullet, WCHAR symbol);
static void ConvertAllBullets(PPTX::Logic::TextParagraphPr &oPPr, CTextPFRun *pPF, CRelsGenerator *pRels);
static void FillBuClr(PPTX::Logic::BulletColor& oBuClr, CColor& oColor);
void FillRun(PPTX::Logic::Run& oRun, CSpan &oSpan);
PPTX::Logic::RunProperties* getNewEndParaRPr(const int dirty = -1, const int sz = -1, const std::wstring& lang = L"");
void FillRPr(PPTX::Logic::RunProperties& oRPr, CTextCFRun& oCFRun);
void ConvertLine(PPTX::Logic::Ln& oLn);
void ConvertLineEnd(PPTX::Logic::LineEnd& oLine, unsigned char cap, unsigned char length, unsigned char width, bool isHead);
void ConvertBrush(PPTX::Logic::RunProperties& oRPr);
void FillSolidFill(PPTX::Logic::UniFill& oUF, CColor& oColor);
void FillSchemeClr(PPTX::Logic::UniFill& oUF, CColor& oColor);
void FillEffectLst(PPTX::Logic::EffectProperties &oEList, CTextCFRun& oCFRun);
void FillParagraphs(std::vector<PPTX::Logic::Paragraph>& arrP, std::vector<CParagraph>& arrParagraphs);
void ConvertStyleLevel(PPTX::Logic::TextParagraphPr &oLevel, CTextStyleLevel& oOldLevel, const int& nLevel);
void FillEndParaRPr(PPTX::Logic::RunProperties& oEndPr, CTextPFRun& oPFRun);
void FillCS(PPTX::Logic::TextFont& oCs, CFontProperties& font);
private:
CShapeElement* m_pShapeElement;
CRelsGenerator* m_pRels;
CTextAttributesEx* pText;
eTxType m_txType;
bool m_bWordArt;
CShapeWriter m_oShapeWriter;
bool m_bError;
CTextCFRun* m_pLastCF;
};
}

View File

@ -2799,7 +2799,8 @@ void CRecordShapeContainer::ConvertStyleTextProp9(CTextAttributesEx *pText)
auto& prop9 = arrStyleTextProp9[pp9rt];
if (prop9.m_pf9.m_optBulletAutoNumberScheme.is_init())
if (prop9.m_pf9.m_optBulletAutoNumberScheme.is_init() &&
prop9.m_pf9.m_optfBulletHasAutoNumber.get_value_or(false))
{
auto* pBuAutoNum = new CBulletAutoNum;
pBuAutoNum->type = prop9.m_pf9.m_optBulletAutoNumberScheme->SchemeToStr();

View File

@ -60,8 +60,13 @@ public:
m_nMM = StreamUtils::ReadSHORT(pStream);
m_nExtX = StreamUtils::ReadSHORT(pStream);
m_nExtY = StreamUtils::ReadSHORT(pStream);
pStream->read(m_pData, m_oHeader.RecLen - 6);
std::cout << m_pData << "\n\n";
const int dataLen = m_oHeader.RecLen - 6;
if (dataLen > 6)
{
m_pData = new BYTE[dataLen];
pStream->read(m_pData, dataLen);
}
}
};

View File

@ -36,7 +36,6 @@
namespace PPT_FORMAT
{
struct STextAutoNumberScheme
{
TextAutoNumberSchemeEnum m_eScheme;
@ -104,28 +103,30 @@ struct STextAutoNumberScheme
struct STextPFException9
{
PFMasks m_masks;
int index = -1;
nullable<SHORT> m_optBulletBlipRef;
nullable_bool m_optfBulletHasAutoNumber;
nullable<STextAutoNumberScheme> m_optBulletAutoNumberScheme;
void ReadFromStream(POLE::Stream* pStream){
void ReadFromStream(POLE::Stream* pStream)
{
m_masks.ReadFromStream(pStream);
if (m_masks.m_bulletBlip)
if (m_masks.m_bulletBlip) // 0x0800000 2^23
m_optBulletBlipRef = StreamUtils::ReadSHORT(pStream);
if (m_masks.m_bulletHasScheme)
if (m_masks.m_bulletHasScheme) // 0x2000000 2^25
m_optfBulletHasAutoNumber = (bool)StreamUtils::ReadSHORT(pStream);
if(m_masks.m_bulletScheme)
if(m_masks.m_bulletScheme) // 0x1000000 2^24
{
auto pBulletAutoNumberScheme = new STextAutoNumberScheme;
pBulletAutoNumberScheme->ReadFromStream(pStream);
m_optBulletAutoNumberScheme = pBulletAutoNumberScheme;
}
else if (m_masks.m_bulletHasScheme)
else if (m_optfBulletHasAutoNumber.get_value_or(false))
{
auto pBulletAutoNumberScheme = new STextAutoNumberScheme;
pBulletAutoNumberScheme->m_nStartNum = 1;

View File

@ -494,6 +494,7 @@
<ClCompile Include="..\..\..\ASCOfficePPTXFile\Editor\Drawing\TextAttributesEx.cpp" />
<ClCompile Include="..\PPTFormatLib.cpp" />
<ClCompile Include="..\PPTXWriter\Animation.cpp" />
<ClCompile Include="..\PPTXWriter\BulletsConverter.cpp" />
<ClCompile Include="..\PPTXWriter\Converter.cpp" />
<ClCompile Include="..\PPTXWriter\ShapeWriter.cpp" />
<ClCompile Include="..\PPTXWriter\TableWriter.cpp" />

View File

@ -859,5 +859,8 @@
<ClCompile Include="..\Records\BlipEntityAtom.cpp">
<Filter>Records</Filter>
</ClCompile>
<ClCompile Include="..\PPTXWriter\BulletsConverter.cpp">
<Filter>OOXWriter</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -844,6 +844,16 @@ namespace PPT_FORMAT
return pElement;
}
int GetWidth()const
{
double multip = m_bAnchorEnabled ? 1587.5 : 1;
return round(m_rcAnchor.GetWidth() * multip);
}
int GetHeight()const
{
double multip = m_bAnchorEnabled ? 1587.5 : 1;
return round(m_rcAnchor.GetHeight() * multip);
}
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
{

View File

@ -172,7 +172,7 @@ namespace PPT_FORMAT
NSCommon::nullable_base<bool> FontItalic;
NSCommon::nullable_base<bool> FontUnderline;
NSCommon::nullable_base<bool> FontStrikeout;
NSCommon::nullable_base<bool> FontShadow;
NSCommon::nullable_bool FontShadow;
NSCommon::nullable_base<WORD> fontRef; // fontRef
NSCommon::nullable_base<WORD> eaFontRef; // eaFontRef

View File

@ -76,7 +76,7 @@ namespace PPT_FORMAT
RELEASEMEM(m_pData);
}
void AddSize(size_t nSize)
void AddSize(const size_t nSize)
{
if (NULL == m_pData)
{
@ -156,6 +156,27 @@ namespace PPT_FORMAT
WriteString(wString.c_str(), nLen);
}
// not works
void WriteStringFront(const wchar_t* pString, size_t& nLen)
{
AddSize(nLen);
/// shift data to back
std::rotate(m_pData, m_pData + nLen+1, m_pDataCur + nLen);
// memcpy(m_pDataCur, pString, nLen * sizeof(wchar_t));
// wstring has 4 bytes length (not 2 in WIN32) in linux/macos
memcpy(m_pData, pString, sizeof (wchar_t) * nLen);
m_pDataCur += nLen;
m_lSizeCur += nLen;
}
// not works
void WriteStringFront(const std::wstring & wString)
{
size_t nLen = wString.length();
WriteStringFront(wString.c_str(), nLen);
}
size_t GetCurSize()
{
return m_lSizeCur;
@ -184,7 +205,7 @@ namespace PPT_FORMAT
m_lSizeCur = 0;
}
std::wstring GetData()
std::wstring GetData() const
{
return std::wstring(m_pData, (int)m_lSizeCur);
}

View File

@ -473,7 +473,7 @@ namespace NSShapeImageGen
if (bVector)
{
//copy source vector image
//copy source vector image
OOX::CPath pathSaveItem = strSaveDir + oInfo.GetPath2();
CDirectory::CopyFile(strFileName, pathSaveItem.GetPath());
@ -493,20 +493,20 @@ namespace NSShapeImageGen
oWriterSVG.SetFontManager(m_pFontManager);
oWriterSVG.put_Width(WW);
oWriterSVG.put_Height(HH);
HRESULT hRes = S_OK;
bool bRes = true;
bool bIsBigestSVG = false;
bool bIsRaster = true;
try
{
hRes = pMetafile->DrawOnRenderer(&oWriterSVG, 0, 0, WW, HH);
bRes = pMetafile->DrawOnRenderer(&oWriterSVG, 0, 0, WW, HH);
}
catch (...)
{
hRes = S_FALSE;
bRes = false;
}
if (hRes == S_OK)
if (bRes)
{
oWriterSVG.IsRaster(&bIsRaster);
@ -516,14 +516,14 @@ namespace NSShapeImageGen
bIsBigestSVG = (lSvgDataSize > 5 * 1024 * 1024);
}
if(bIsRaster || bIsBigestSVG || hRes != S_OK)
if (bIsRaster || bIsBigestSVG || !bRes)
{
//случай растрового wmf/emf или г...
//случай растрового wmf/emf или г...
if (lWidth <= 0 || lHeight <= 0)
{
int nMaxPixSize = 1000;
int nMinPixSize = 10;
//usually bound of raster wmf from 0 to 1
//usually bound of raster wmf from 0 to 1
if ((nMinPixSize <= w && w <= nMaxPixSize) && (nMinPixSize <= h && h <= nMaxPixSize))
{
lWidth = -1;

View File

@ -40,9 +40,9 @@ namespace PPTX
class TextWrap : public BaseLimit
{
public:
TextWrap()
TextWrap(const BYTE& src = 1)
{
m_strValue = _T("square");
SetBYTECode(src);
}
_USE_STRING_OPERATOR

View File

@ -123,9 +123,9 @@ namespace PPTX
XmlUtils::CNodeValue oValue;
oValue.WriteNullable(stCondLst);
oValue.WriteNullable(iterate);
oValue.WriteNullable(endCondLst);
oValue.WriteNullable(endSync);
oValue.WriteNullable(iterate);
oValue.WriteNullable(childTnLst);
oValue.WriteNullable(subTnLst);
@ -161,18 +161,18 @@ namespace PPTX
if (stCondLst.IsInit())
stCondLst->toXmlWriter(pWriter);
if (iterate.IsInit())
if (endCondLst.IsInit())
endCondLst->toXmlWriter(pWriter);
if (endSync.IsInit())
endSync->toXmlWriter(pWriter);
if (iterate.IsInit())
iterate->toXmlWriter(pWriter);
if (childTnLst.IsInit())
childTnLst->toXmlWriter(pWriter);
if (endCondLst.IsInit())
endCondLst->toXmlWriter(pWriter);
if (endSync.IsInit())
endSync->toXmlWriter(pWriter);
if (subTnLst.IsInit())
subTnLst->toXmlWriter(pWriter);

View File

@ -86,7 +86,7 @@ void Format::readFields(CFRecord& record)
}
int Format::serialize(std::wostream & stream)
{
if ((ifmt > 4 && ifmt < 9) || (ifmt > 40 && ifmt < 45)) return 0;
if (ifmt < 5 || (ifmt > 8 && ifmt < 23) || (ifmt > 36 && ifmt < 41) || (ifmt > 44 && ifmt < 50)) return 0;
stream << L"<numFmt";
{

View File

@ -808,7 +808,7 @@ void XlsConverter::convert(XLS::FORMATTING* formating)
{
XLS::Format* fmt = dynamic_cast<XLS::Format*>(xls_global_info->m_arNumFormats[i].get());
if (fmt->ifmt < 23 || (fmt->ifmt > 36 && fmt->ifmt < 50))
if (fmt->ifmt < 5 || (fmt->ifmt > 8 && fmt->ifmt < 23) || (fmt->ifmt > 36 && fmt->ifmt < 41) || (fmt->ifmt > 44 && fmt->ifmt < 50))
continue;
std::map<_UINT16, bool>::iterator pFind = xls_global_info->mapUsedFormatCode.find(fmt->ifmt);

View File

@ -3,7 +3,11 @@ v8_version_89 {
CONFIG += c++14
CONFIG += use_v8_monolith
DEFINES += V8_VERSION_89_PLUS
DEFINES += V8_COMPRESS_POINTERS
core_win_32:CONFIG += build_platform_32
core_linux_32:CONFIG += build_platform_32
!build_platform_32:DEFINES += V8_COMPRESS_POINTERS
CORE_V8_PATH_OVERRIDE = $$PWD/../v8_89
}

View File

@ -65,7 +65,14 @@ namespace OOX
// Находим связи(рельсы) с данным файлом
m_pCurRels = new OOX::CRels(oPath);
// Читаем все файлы по рельсам
if (m_pMainDocument)
{
smart_ptr<OOX::File> pFile = dynamic_cast<OOX::File*>(this);
pFile.AddRef();
m_pMainDocument->m_mapContent.insert(std::make_pair(oPath.GetPath(), pFile));
}
// Читаем все файлы по рельсам
Read( *m_pCurRels, oRootPath, oPath.GetDirectory() );
}
@ -76,15 +83,27 @@ namespace OOX
{
if (!oRels.m_arRelations[i]) continue;
std::wstring pathFile = (oPath / oRels.m_arRelations[i]->Target()).GetPath();
if (m_pMainDocument)
{
std::map<std::wstring, smart_ptr<OOX::File>>::iterator pFind = m_pMainDocument->m_mapContent.find(pathFile);
if (pFind != m_pMainDocument->m_mapContent.end())
{
Add(oRels.m_arRelations[i]->rId(), pFind->second);
continue;
}
}
smart_ptr<OOX::File> pFile;
if (m_bSpreadsheets)
pFile = OOX::Spreadsheet::CreateFile( oRootPath, oPath, oRels.m_arRelations[i], m_pMainDocument );
pFile = OOX::Spreadsheet::CreateFile(oRootPath, oPath, oRels.m_arRelations[i], m_pMainDocument);
if (pFile.IsInit() == false || pFile->type() == FileTypes::Unknow)
pFile = OOX::CreateFile( oRootPath, oPath, oRels.m_arRelations[i], m_pMainDocument );
Add( oRels.m_arRelations[i]->rId(), pFile );
pFile = OOX::CreateFile(oRootPath, oPath, oRels.m_arRelations[i], m_pMainDocument);
Add(oRels.m_arRelations[i]->rId(), pFile);
}
}
@ -99,6 +118,8 @@ namespace OOX
}
void IFileContainer::Write(OOX::CRels& oRels, const OOX::CPath& oCurrent, const OOX::CPath& oDir, OOX::CContentTypes& oContent) const
{
const OOX::File* pFileOwner = dynamic_cast<const OOX::File*>(this);
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mapContainer.begin(); pPair != m_mapContainer.end(); ++pPair)
{
smart_ptr<OOX::File> pFile = pPair->second;
@ -112,7 +133,13 @@ namespace OOX
OOX::CPath oDefDir = pFile->DefaultDirectory();
OOX::CPath oName = pFile->DefaultFileName();
if(false == pFile->m_sOutputFilename.empty())
if (pFile->type() == OOX::Spreadsheet::FileTypes::PivotCacheDefinition &&
pFileOwner->type() == OOX::Spreadsheet::FileTypes::PivotTable)
{
oDefDir = L"../" + oDefDir;
}
if (false == pFile->m_sOutputFilename.empty())
oName.SetName(pFile->m_sOutputFilename, false);
boost::unordered_map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(pPair->first);

View File

@ -172,20 +172,27 @@ namespace OOX
}
}
void CParagraph::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_oParagraphProperty = NULL;
ReadAttributes( oReader );
ReadAttributes(oReader);
if (oReader.IsEmptyNode())
return;
int nParentDepth = oReader.GetDepth();
fromXML(nParentDepth, oReader);
}
void CParagraph::fromXML(int nDepth, XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
OOX::Document* document = WritingElement::m_pMainDocument;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
while( oReader.ReadNextSiblingNode(nDepth) )
{
std::wstring sName = oReader.GetName();
WritingElement *pItem = NULL;
@ -307,6 +314,11 @@ namespace OOX
pItem = new CSmartTag( document );
//else if ( _T("w:subDoc") == sName )
// pItem = new CSubDoc( document );
else if (_T("w:sdtContent") == sName)
{
int nDepthChild = oReader.GetDepth();
fromXML(nDepthChild, oReader);
}
if ( pItem )
{

View File

@ -119,7 +119,7 @@ namespace OOX
}
private:
void fromXML(int nDepth, XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
public:

View File

@ -188,7 +188,7 @@ namespace ComplexTypes
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
{//todooo переделать на перебор всех и без неймспейсов
XmlMacroReadAttributeBase( oNode, L"r:id", m_oId );
XmlMacroReadAttributeBase( oNode, L"w:type", m_oType );
@ -228,11 +228,10 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, (L"r:id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, (L"relationships:id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:type"), m_oType )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, (L"id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, (L"type"), m_oType )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
public:

View File

@ -353,92 +353,106 @@ namespace OOX
OOX::Document* document = WritingElement::m_pMainDocument;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
CreateElements(oReader, nParentDepth);
}
void CTbl::CreateElements(XmlUtils::CXmlLiteReader &oReader, int Depth)
{
OOX::Document* document = WritingElement::m_pMainDocument;
while (oReader.ReadNextSiblingNode(Depth))
{
std::wstring sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( document );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( document );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( document );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( document );
if (_T("w:bookmarkEnd") == sName)
pItem = new CBookmarkEnd(document);
else if (_T("w:bookmarkStart") == sName)
pItem = new CBookmarkStart(document);
else if (_T("w:commentRangeEnd") == sName)
pItem = new CCommentRangeEnd(document);
else if (_T("w:commentRangeStart") == sName)
pItem = new CCommentRangeStart(document);
//else if ( _T("w:customXml") == sName )
// pItem = new CCustomXml( document );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( document );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( document );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( document );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( document );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( document );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( document );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( document );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( document );
else if ( _T("w:del") == sName )
pItem = new CDel( document );
else if ( _T("w:ins") == sName )
pItem = new CIns( document );
else if ( _T("w:moveFrom") == sName )
pItem = new CMoveFrom( document );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveFromRangeEnd( document );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveFromRangeStart( document );
else if ( _T("w:moveTo") == sName )
pItem = new CMoveTo( document );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( document );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( document );
else if ( _T("m:oMath") == sName )
pItem = new COMath( document );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( document );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( document );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( document );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( document );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( document );
else if ( _T("w:tblGrid") == sName )
else if (_T("w:customXmlDelRangeEnd") == sName)
pItem = new CCustomXmlDelRangeEnd(document);
else if (_T("w:customXmlDelRangeStart") == sName)
pItem = new CCustomXmlDelRangeStart(document);
else if (_T("w:customXmlInsRangeEnd") == sName)
pItem = new CCustomXmlInsRangeEnd(document);
else if (_T("w:customXmlInsRangeStart") == sName)
pItem = new CCustomXmlInsRangeStart(document);
else if (_T("w:customXmlMoveFromRangeEnd") == sName)
pItem = new CCustomXmlMoveFromRangeEnd(document);
else if (_T("w:customXmlMoveFromRangeStart") == sName)
pItem = new CCustomXmlMoveFromRangeStart(document);
else if (_T("w:customXmlMoveToRangeEnd") == sName)
pItem = new CCustomXmlMoveToRangeEnd(document);
else if (_T("w:customXmlMoveToRangeStart") == sName)
pItem = new CCustomXmlMoveToRangeStart(document);
else if (_T("w:del") == sName)
pItem = new CDel(document);
else if (_T("w:ins") == sName)
pItem = new CIns(document);
else if (_T("w:moveFrom") == sName)
pItem = new CMoveFrom(document);
else if (_T("w:moveFromRangeEnd") == sName)
pItem = new CMoveFromRangeEnd(document);
else if (_T("w:moveFromRangeStart") == sName)
pItem = new CMoveFromRangeStart(document);
else if (_T("w:moveTo") == sName)
pItem = new CMoveTo(document);
else if (_T("w:moveToRangeEnd") == sName)
pItem = new CMoveToRangeEnd(document);
else if (_T("w:moveToRangeStart") == sName)
pItem = new CMoveToRangeStart(document);
else if (_T("m:oMath") == sName)
pItem = new COMath(document);
else if (_T("m:oMathPara") == sName)
pItem = new COMathPara(document);
else if (_T("w:permEnd") == sName)
pItem = new CPermEnd(document);
else if (_T("w:permStart") == sName)
pItem = new CPermStart(document);
else if (_T("w:proofErr") == sName)
pItem = new CProofErr(document);
else if (_T("w:sdt") == sName)
pItem = new CSdt(document);
else if (_T("w:tblGrid") == sName)
{
if (false == m_oTblGrid.IsInit())
{
m_oTblGrid = new CTblGrid( document );
m_oTblGrid = new CTblGrid(document);
}
m_oTblGrid->fromXML(oReader);
}
else if ( _T("w:tblPr") == sName )
else if (_T("w:tblPr") == sName)
{
pItem = m_oTableProperties = new CTableProperty( document );
pItem = m_oTableProperties = new CTableProperty(document);
}
else if ( _T("w:tr") == sName )
else if (_T("w:tr") == sName)
{
pItem = new CTr( document );
m_nCountRow ++;
pItem = new CTr(document);
m_nCountRow++;
}
else if (L"wx:sect" == sName && !oReader.IsEmptyNode())
{
int nWxSectDepth = oReader.GetDepth();
CreateElements(oReader, nWxSectDepth);
}
else if (L"wx:sub-section" == sName && !oReader.IsEmptyNode())
{
int nWxSubSectDepth = oReader.GetDepth();
CreateElements(oReader, nWxSubSectDepth);
}
if ( pItem )
if (pItem)
{
m_arrItems.push_back( pItem );
m_arrItems.push_back(pItem);
pItem->fromXML(oReader);
}
}
}
std::wstring CTbl::toXML() const
{
std::wstring sResult = _T("<w:tbl>");

View File

@ -448,15 +448,16 @@ namespace OOX
WritingElementWithChilds::ClearItems();
}
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual EElementType getType() const
{
return et_w_tbl;
}
int m_nCountRow;
void CreateElements(XmlUtils::CXmlLiteReader &oReader, int Depth);
int m_nCountRow;
nullable<OOX::Logic::CTblGrid> m_oTblGrid;
OOX::Logic::CTableProperty* m_oTableProperties; //todooo - выкинуть из m_arrItems, переделать на nullable<>

View File

@ -33,6 +33,7 @@
#include "../../../../DesktopEditor/xml/include/xmlutils.h"
#include "../../../../ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObject.h"
#include "../Base/SmartPtr.h"
namespace NSBinPptxRW
{
@ -1393,8 +1394,12 @@ namespace OOX
et_x_ListItems,
et_x_ListItem,
et_x_WorkbookPivotCache,
et_x_WorkbookPivotCaches,
et_x_PivotTableDefinition,
et_x_PivotCacheDefinition,
et_x_PivotCacheDefinitionExt,
et_x_PivotCacheRecords,
et_x_ColumnRowFields,
et_x_ColumnRowItems,
@ -1484,6 +1489,8 @@ namespace OOX
et_x_Style2003
};
class File;
class Document
{
public:
@ -1491,6 +1498,8 @@ namespace OOX
virtual ~Document() {}
std::wstring m_sDocumentPath;
std::map<std::wstring, NSCommon::smart_ptr<OOX::File>> m_mapContent;
};
class WritingElement

View File

@ -412,6 +412,8 @@ namespace OOX
nullable<CFormula> m_oFormula;
nullable<CSi> m_oRichText;
nullable<CText> m_oValue;
//-----------------------------
nullable_string m_oCacheValue;
};
//необработано:

View File

@ -85,6 +85,7 @@ public:
bool isRtfFormatFile (unsigned char* pBuffer,int dwBytes);
bool isHtmlFormatFile (unsigned char* pBuffer,int dwBytes, bool testCloseTag);
bool isMultiPartsHtmlFormatFile(unsigned char* pBuffer, int dwBytes);
bool isPdfFormatFile (unsigned char* pBuffer,int dwBytes, std::wstring & documentID);
bool isOpenOfficeFlatFormatFile(unsigned char* pBuffer,int dwBytes);

View File

@ -53,6 +53,21 @@ bool COfficeFileFormatChecker::isRtfFormatFile(unsigned char* pBuffer,int dwByte
return false;
}
bool COfficeFileFormatChecker::isMultiPartsHtmlFormatFile(unsigned char* pBuffer, int dwBytes)
{
if (pBuffer == NULL) return false;
const char *contentTypeFormatLine1 = "Content-Type: multipart/related";
const char *contentTypeFormatLine2 = "Content-Type: text/html"; // может быть и вне заданого буфера (todooo)
std::string xml_string((char*)pBuffer, dwBytes);
if ((std::string::npos != xml_string.find(contentTypeFormatLine1)) && (std::string::npos != xml_string.find(contentTypeFormatLine2)))
{
return true;
}
return false;
}
bool COfficeFileFormatChecker::isHtmlFormatFile(unsigned char* pBuffer, int dwBytes, bool testCloseTag)
{
if (pBuffer == NULL || dwBytes < 4) return false;
@ -93,7 +108,7 @@ bool COfficeFileFormatChecker::isHtmlFormatFile(unsigned char* pBuffer, int dwBy
}
}
}
return false;
return false;
}
bool COfficeFileFormatChecker::isBinaryDoctFormatFile (unsigned char* pBuffer,int dwBytes)
@ -513,6 +528,10 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
{
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS; // without compaund container
}
else if (isMultiPartsHtmlFormatFile(buffer, sizeRead))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
}
//------------------------------------------------------------------------------------------------
file.CloseFile();

View File

@ -9,6 +9,9 @@ INCLUDEPATH += $$PWD
HEADERS += $$PWD/js_base.h
HEADERS += $$PWD/js_logger.h
SOURCES += $$PWD/js_logger.cpp
!use_javascript_core {
HEADERS += $$PWD/v8/v8_base.h

View File

@ -0,0 +1,35 @@
#include "./js_logger.h"
#include <stdio.h>
#include "../../common/File.h"
#include "../../graphics/Timer.h"
namespace NSJSBase
{
std::string g_logger_file = U_TO_UTF8(NSSystemUtils::GetEnvVariable(L"js_speed"));
bool g_logger_enabled = g_logger_file.empty() ? false : true;
unsigned long g_logger_time = 0;
void LOGGER_START_FUNC()
{
g_logger_time = NSTimers::GetTickCount();
}
void LOGGER_LAP_FUNC(const char* details)
{
if (!g_logger_enabled)
return;
unsigned long dwCur = (unsigned long)NSTimers::GetTickCount();
if (g_logger_file.length() == 1)
{
printf(details);
printf(": %d\n", (int)(dwCur - g_logger_time));
}
else
{
FILE* f = fopen(g_logger_file.c_str(), "a+");
fprintf(f, "%s: %d\n", details, (int)(dwCur - g_logger_time));
fclose(f);
}
g_logger_time = dwCur;
}
}

View File

@ -0,0 +1,22 @@
#ifndef _CORE_EXT_JS_LOGGER_H_
#define _CORE_EXT_JS_LOGGER_H_
#include "../../common/SystemUtils.h"
namespace NSJSBase
{
void LOGGER_START_FUNC();
void LOGGER_LAP_FUNC(const char* details);
}
#if 1
#define LOGGER_START NSJSBase::LOGGER_START_FUNC();
#define LOGGER_LAP(__logger_lap_name__) NSJSBase::LOGGER_LAP_FUNC(#__logger_lap_name__);
#define LOGGER_LAP_NAME(__logger_lap_name__) NSJSBase::LOGGER_LAP_FUNC(__logger_lap_name__);
#else
#define LOGGER_START
#define LOGGER_LAP(__logger_lap_name__)
#define LOGGER_LAP_NAME(__logger_lap_name__)
#endif
#endif // _CORE_EXT_JS_LOGGER_H_

View File

@ -274,8 +274,9 @@ namespace NSJSBase
#ifdef V8_INSPECTOR
v8_debug::before(m_internal->m_context, CV8Worker::getInitializer()->getPlatform(), "");
#endif
LOGGER_START
v8::Local<v8::String> _source = CreateV8String(CV8Worker::GetCurrent(), script.c_str());
v8::Local<v8::Script> _script;
if(!scriptPath.empty())
{
@ -289,6 +290,8 @@ namespace NSJSBase
if (!_scriptRetValue.IsEmpty())
_script = _scriptRetValue.ToLocalChecked();
}
LOGGER_LAP("compile")
CJSValueV8* _return = new CJSValueV8();
@ -305,6 +308,8 @@ namespace NSJSBase
if (!retValue.IsEmpty())
_return->value = retValue.ToLocalChecked();
LOGGER_LAP("run")
return _return;
}

View File

@ -6,6 +6,7 @@
#endif
#include "../js_base.h"
#include "../js_logger.h"
#include <iostream>
#include "v8.h"
@ -425,6 +426,8 @@ namespace NSJSBase
#ifdef V8_INSPECTOR
v8_debug::before(V8ContextFirstArg CV8Worker::getInitializer()->getPlatform(), "");
#endif
LOGGER_START
v8::Local<v8::String> _name = CreateV8String(CV8Worker::GetCurrent(), name);
v8::Handle<v8::Value> _func = value->Get(V8ContextFirstArg _name).ToLocalChecked();
@ -454,6 +457,8 @@ namespace NSJSBase
}
}
LOGGER_LAP_NAME(name)
JSSmart<CJSValue> _ret = _return;
return _ret;
}

View File

@ -121,6 +121,7 @@ const long c_nVifFormat = 0x0009;
const long c_nGrRenderer = 0x0010;
const long c_nHtmlRendrerer3 = 0x0011;
const long c_nHtmlRendrererText = 0x0012;
const long c_nQRenderer = 0x0013;
// типы команд
const long c_nCommandLongTypeOnlyText = 0x1000;

View File

@ -35,10 +35,12 @@
"_DestroyTextInfo"
],
"include_path": [
"wasm/src/lib", "../../../agg-2.4/include", "../../../cximage/jasper/include", "../../../cximage/jpeg", "../../../cximage/png", "freetype-2.10.4/include", "freetype-2.10.4/include/freetype", "../../../../OfficeUtils/src/zlib-1.2.11", "../../../../OfficeUtils/src", "../../../../Common/3dParty/icu/icu/source/common", "../../../xml/libxml2/include", "../../../xml/build/qt", "../../../../OfficeUtils/src/zlib-1.2.11/contrib/minizip", "../../../../PdfReader/lib/goo", "../../../../PdfReader/lib/fofi", "../../../../PdfReader/lib/splash", "../../../../PdfReader/lib"
"wasm/src/lib", "../../../agg-2.4/include", "../../../cximage/jasper/include", "../../../cximage/jpeg", "../../../cximage/png", "freetype-2.10.4/include", "freetype-2.10.4/include/freetype", "../../../../OfficeUtils/src/zlib-1.2.11", "../../../../OfficeUtils/src", "../../../../Common/3dParty/icu/icu/source/common", "../../../xml/libxml2/include", "../../../xml/build/qt", "../../../../OfficeUtils/src/zlib-1.2.11/contrib/minizip", "../../../../PdfReader/lib/goo", "../../../../PdfReader/lib/fofi", "../../../../PdfReader/lib/splash", "../../../../PdfReader/lib",
"../../../raster/Jp2/openjpeg", "../../../raster/Jp2/openjpeg/openjpeg-2.4.0/src/lib/openjp2"
],
"define": [
"__linux__", "_LINUX", "UNIX", "FT2_BUILD_LIBRARY", "HAVE_FCNTL_H", "FT_CONFIG_OPTION_SYSTEM_ZLIB", "BUILDING_WASM_MODULE", "U_COMMON_IMPLEMENTATION", "errno=0", "THREADMODEL=0", "DEBUGLVL=0", "HAVE_MBSTATE_T", "HAVE_STDINCLUDES", "HAS_WCHAR", "HAVE_VA_COPY", "LIBXML_READER_ENABLED", "LIBXML_PUSH_ENABLED", "LIBXML_HTML_ENABLED", "LIBXML_XPATH_ENABLED", "LIBXML_OUTPUT_ENABLED", "LIBXML_C14N_ENABLED", "LIBXML_SAX1_ENABLED", "LIBXML_TREE_ENABLED", "LIBXML_XPTR_ENABLED", "IN_LIBXML", "LIBXML_STATIC", "BUILD_ZLIB_AS_SOURCES", "DISABLE_PDF_CONVERTATION", "_ARM_ALIGN_", "_tcsnicmp=strncmp", "_lseek=lseek", "_getcwd=getcwd", "NO_CONSOLE_IO"
"__linux__", "_LINUX", "UNIX", "FT2_BUILD_LIBRARY", "HAVE_FCNTL_H", "FT_CONFIG_OPTION_SYSTEM_ZLIB", "BUILDING_WASM_MODULE", "U_COMMON_IMPLEMENTATION", "errno=0", "THREADMODEL=0", "DEBUGLVL=0", "HAVE_MBSTATE_T", "HAVE_STDINCLUDES", "HAS_WCHAR", "HAVE_VA_COPY", "LIBXML_READER_ENABLED", "LIBXML_PUSH_ENABLED", "LIBXML_HTML_ENABLED", "LIBXML_XPATH_ENABLED", "LIBXML_OUTPUT_ENABLED", "LIBXML_C14N_ENABLED", "LIBXML_SAX1_ENABLED", "LIBXML_TREE_ENABLED", "LIBXML_XPTR_ENABLED", "IN_LIBXML", "LIBXML_STATIC", "BUILD_ZLIB_AS_SOURCES", "DISABLE_PDF_CONVERTATION", "_ARM_ALIGN_", "_tcsnicmp=strncmp", "_lseek=lseek", "_getcwd=getcwd", "NO_CONSOLE_IO",
"USE_EXTERNAL_JPEG2000", "USE_JPIP", "OPJ_STATIC"
],
"compile_files_array": [
{
@ -154,7 +156,12 @@
{
"name": "p",
"folder": "../../../../PdfReader/",
"files": ["PdfReader.cpp", "Src/Adaptors.cpp", "Src/GfxClip.cpp", "Src/RendererOutputDev.cpp", "Resources/BaseFonts.cpp", "lib/fofi/FofiBase.cc", "lib/fofi/FofiEncodings.cc", "lib/fofi/FofiIdentifier.cc", "lib/fofi/FofiTrueType.cc", "lib/fofi/FofiType1.cc", "lib/fofi/FofiType1C.cc", "lib/goo/FixedPoint.cc", "lib/goo/gfile.cc", "lib/goo/GHash.cc", "lib/goo/GList.cc", "lib/goo/gmem.cc", "lib/goo/gmempp.cc", "lib/goo/GString.cc", "lib/goo/parseargs.c", "lib/goo/Trace.cc", "lib/splash/Splash.cc", "lib/splash/SplashBitmap.cc", "lib/splash/SplashClip.cc", "lib/splash/SplashFont.cc", "lib/splash/SplashFontEngine.cc", "lib/splash/SplashFontFile.cc", "lib/splash/SplashFontFileID.cc", "lib/splash/SplashFTFont.cc", "lib/splash/SplashFTFontEngine.cc", "lib/splash/SplashFTFontFile.cc", "lib/splash/SplashPath.cc", "lib/splash/SplashPattern.cc", "lib/splash/SplashScreen.cc", "lib/splash/SplashState.cc", "lib/splash/SplashXPath.cc", "lib/splash/SplashXPathScanner.cc", "lib/xpdf/AcroForm.cc", "lib/xpdf/Annot.cc", "lib/xpdf/Array.cc", "lib/xpdf/BuiltinFont.cc", "lib/xpdf/BuiltinFontTables.cc", "lib/xpdf/Catalog.cc", "lib/xpdf/CharCodeToUnicode.cc", "lib/xpdf/CMap.cc", "lib/xpdf/Decrypt.cc", "lib/xpdf/Dict.cc", "lib/xpdf/DisplayState.cc", "lib/xpdf/Error.cc", "lib/xpdf/FontEncodingTables.cc", "lib/xpdf/Function.cc", "lib/xpdf/Gfx.cc", "lib/xpdf/GfxFont.cc", "lib/xpdf/GfxState.cc", "lib/xpdf/GlobalParams.cc", "lib/xpdf/ImageOutputDev.cc", "lib/xpdf/JArithmeticDecoder.cc", "lib/xpdf/JBIG2Stream.cc", "lib/xpdf/JPXStream.cc", "lib/xpdf/Lexer.cc", "lib/xpdf/Link.cc", "lib/xpdf/NameToCharCode.cc", "lib/xpdf/Object.cc", "lib/xpdf/OptionalContent.cc", "lib/xpdf/Outline.cc", "lib/xpdf/OutputDev.cc", "lib/xpdf/Page.cc", "lib/xpdf/Parser.cc", "lib/xpdf/PDF417Barcode.cc", "lib/xpdf/PDFCore.cc", "lib/xpdf/PDFDoc.cc", "lib/xpdf/PDFDocEncoding.cc", "lib/xpdf/PreScanOutputDev.cc", "lib/xpdf/PSOutputDev.cc", "lib/xpdf/PSTokenizer.cc", "lib/xpdf/SecurityHandler.cc", "lib/xpdf/ShadingImage.cc", "lib/xpdf/SplashOutputDev.cc", "lib/xpdf/Stream.cc", "lib/xpdf/TextOutputDev.cc", "lib/xpdf/TextString.cc", "lib/xpdf/TileCache.cc", "lib/xpdf/TileCompositor.cc", "lib/xpdf/TileMap.cc", "lib/xpdf/UnicodeMap.cc", "lib/xpdf/UnicodeRemapping.cc", "lib/xpdf/UnicodeTypeTable.cc", "lib/xpdf/UTF8.cc", "lib/xpdf/WebFont.cc", "lib/xpdf/XFAScanner.cc", "lib/xpdf/XRef.cc", "lib/xpdf/Zoox.cc"]
"files": ["PdfReader.cpp", "Src/Adaptors.cpp", "Src/GfxClip.cpp", "Src/RendererOutputDev.cpp", "Src/JPXStream2.cpp", "Resources/BaseFonts.cpp", "lib/fofi/FofiBase.cc", "lib/fofi/FofiEncodings.cc", "lib/fofi/FofiIdentifier.cc", "lib/fofi/FofiTrueType.cc", "lib/fofi/FofiType1.cc", "lib/fofi/FofiType1C.cc", "lib/goo/FixedPoint.cc", "lib/goo/gfile.cc", "lib/goo/GHash.cc", "lib/goo/GList.cc", "lib/goo/gmem.cc", "lib/goo/gmempp.cc", "lib/goo/GString.cc", "lib/goo/parseargs.c", "lib/goo/Trace.cc", "lib/splash/Splash.cc", "lib/splash/SplashBitmap.cc", "lib/splash/SplashClip.cc", "lib/splash/SplashFont.cc", "lib/splash/SplashFontEngine.cc", "lib/splash/SplashFontFile.cc", "lib/splash/SplashFontFileID.cc", "lib/splash/SplashFTFont.cc", "lib/splash/SplashFTFontEngine.cc", "lib/splash/SplashFTFontFile.cc", "lib/splash/SplashPath.cc", "lib/splash/SplashPattern.cc", "lib/splash/SplashScreen.cc", "lib/splash/SplashState.cc", "lib/splash/SplashXPath.cc", "lib/splash/SplashXPathScanner.cc", "lib/xpdf/AcroForm.cc", "lib/xpdf/Annot.cc", "lib/xpdf/Array.cc", "lib/xpdf/BuiltinFont.cc", "lib/xpdf/BuiltinFontTables.cc", "lib/xpdf/Catalog.cc", "lib/xpdf/CharCodeToUnicode.cc", "lib/xpdf/CMap.cc", "lib/xpdf/Decrypt.cc", "lib/xpdf/Dict.cc", "lib/xpdf/DisplayState.cc", "lib/xpdf/Error.cc", "lib/xpdf/FontEncodingTables.cc", "lib/xpdf/Function.cc", "lib/xpdf/Gfx.cc", "lib/xpdf/GfxFont.cc", "lib/xpdf/GfxState.cc", "lib/xpdf/GlobalParams.cc", "lib/xpdf/ImageOutputDev.cc", "lib/xpdf/JArithmeticDecoder.cc", "lib/xpdf/JBIG2Stream.cc", "lib/xpdf/JPXStream.cc", "lib/xpdf/Lexer.cc", "lib/xpdf/Link.cc", "lib/xpdf/NameToCharCode.cc", "lib/xpdf/Object.cc", "lib/xpdf/OptionalContent.cc", "lib/xpdf/Outline.cc", "lib/xpdf/OutputDev.cc", "lib/xpdf/Page.cc", "lib/xpdf/Parser.cc", "lib/xpdf/PDF417Barcode.cc", "lib/xpdf/PDFCore.cc", "lib/xpdf/PDFDoc.cc", "lib/xpdf/PDFDocEncoding.cc", "lib/xpdf/PreScanOutputDev.cc", "lib/xpdf/PSOutputDev.cc", "lib/xpdf/PSTokenizer.cc", "lib/xpdf/SecurityHandler.cc", "lib/xpdf/ShadingImage.cc", "lib/xpdf/SplashOutputDev.cc", "lib/xpdf/Stream.cc", "lib/xpdf/TextOutputDev.cc", "lib/xpdf/TextString.cc", "lib/xpdf/TileCache.cc", "lib/xpdf/TileCompositor.cc", "lib/xpdf/TileMap.cc", "lib/xpdf/UnicodeMap.cc", "lib/xpdf/UnicodeRemapping.cc", "lib/xpdf/UnicodeTypeTable.cc", "lib/xpdf/UTF8.cc", "lib/xpdf/WebFont.cc", "lib/xpdf/XFAScanner.cc", "lib/xpdf/XRef.cc", "lib/xpdf/Zoox.cc"]
},
{
"name": "opj",
"folder": "../../../raster/Jp2/openjpeg/openjpeg-2.4.0/src/lib/openjp2/",
"files": ["bio.c", "cidx_manager.c", "cio.c", "dwt.c", "event.c", "function_list.c", "image.c", "invert.c", "j2k.c", "jp2.c", "mct.c", "mqc.c", "openjpeg.c", "opj_clock.c", "opj_malloc.c", "phix_manager.c", "pi.c", "ppix_manager.c", "sparse_array.c", "t1.c", "t2.c", "tcd.c", "tgt.c", "thix_manager.c", "thread.c", "tpix_manager.c", "../../../../opj_bgraframe.cpp"]
},
{
"name": "x",

View File

@ -194,6 +194,11 @@
return this.pages;
};
CFile.prototype["getDocumentInfo"] = function()
{
return this.info;
};
CFile.prototype["getPagePixmap"] = function(pageIndex, width, height, backgroundColor)
{
if (this.pages[pageIndex].fonts.length > 0)

View File

@ -4,16 +4,6 @@
namespace Jpeg2000
{
//extern Image* Jp2ToImage(const std::wstring& wsFileName, DecoderParams* pDecoderParams);
//extern Image* J2kToImage(const std::wstring& wsFileName, DecoderParams* pDecoderParams);
//extern Image* JptToImage(const std::wstring& wsFileName, DecoderParams* pDecoderParams);
//extern Image* Mj2ToImage(const std::wstring& wsFileName, DecoderParams* pDecoderParams);
//extern bool ImageToJ2k(Image *pImage, const std::wstring& wsFilePath, EncoderParams* pEncoderParams);
//extern bool ImageToJ2p(Image *pImage, const std::wstring& wsFilePath, EncoderParams* pEncoderParams);
//extern void Image_Destroy(Image *pImage);
//extern Image* Image_Create(int nComponentsCount, ImageComponentParams *pCompParams, ColorSpace eColorSpace);
void* Malloc(size_t nSize)
{
void *pMemBlock = malloc(nSize);
@ -27,6 +17,46 @@ namespace Jpeg2000
}
return pMemBlock;
}
int check_j2000_type(BYTE* pBuffer, int nSize)
{
if (!pBuffer)
return 0;
int type = 0;
if ((32 <= nSize) && (0x00 == pBuffer[0] && 0x00 == pBuffer[1] && 0x00 == pBuffer[2] && 0x0c == pBuffer[3]
&& 0x6a == pBuffer[4] && 0x50 == pBuffer[5] && 0x20 == pBuffer[6] && 0x20 == pBuffer[7]
&& 0x0d == pBuffer[8] && 0x0a == pBuffer[9] && 0x87 == pBuffer[10] && 0x0a == pBuffer[11]
&& 0x00 == pBuffer[12] && 0x00 == pBuffer[13] && 0x00 == pBuffer[14] /*&& (0x14 == pBuffer[15] || 0x18 == pBuffer[15] )*/
&& 0x66 == pBuffer[16] && 0x74 == pBuffer[17] && 0x79 == pBuffer[18] && 0x70 == pBuffer[19]
&& 0x6a == pBuffer[20] && 0x70 == pBuffer[21] && 0x32 == pBuffer[22] && 0x20 == pBuffer[23]
&& 0x00 == pBuffer[24] && 0x00 == pBuffer[25] && 0x00 == pBuffer[26] && 0x00 == pBuffer[27]
/*&& 0x6a == pBuffer[28] && 0x70 == pBuffer[29] && 0x32 == pBuffer[30] && 0x20 == pBuffer[31]*/))
{
type = 1;
}
if ((4 <= nSize) && (0xff == pBuffer[0] && 0x4f == pBuffer[1] && 0xff == pBuffer[2] && 0x51 == pBuffer[3]))
{
type = 2;
}
if ((32 <= nSize) && (0x00 == pBuffer[0] && 0x00 == pBuffer[1] && 0x00 == pBuffer[2] && 0x0c == pBuffer[3]
&& 0x6a == pBuffer[4] && 0x50 == pBuffer[5] && 0x20 == pBuffer[6] && 0x20 == pBuffer[7]
&& 0x0d == pBuffer[8] && 0x0a == pBuffer[9] && 0x87 == pBuffer[10] && 0x0a == pBuffer[11]
&& 0x00 == pBuffer[12] && 0x00 == pBuffer[13] && 0x00 == pBuffer[14] && 0x18 == pBuffer[15]
&& 0x66 == pBuffer[16] && 0x74 == pBuffer[17] && 0x79 == pBuffer[18] && 0x70 == pBuffer[19]
&& 0x6d == pBuffer[20] && 0x6a == pBuffer[21] && 0x70 == pBuffer[22] && 0x32 == pBuffer[23]
&& 0x00 == pBuffer[24] && 0x00 == pBuffer[25] && 0x00 == pBuffer[26] && 0x00 == pBuffer[27]
&& 0x6d == pBuffer[28] && 0x6a == pBuffer[29] && 0x70 == pBuffer[30] && 0x32 == pBuffer[31]))
{
type = 3;
}
return type;
}
int check_j2000_type(FILE* pFile)
{
if (!pFile)
@ -38,87 +68,105 @@ namespace Jpeg2000
return 0;
size_t nBytesRead = fread(pBuffer, 1, 1024, pFile);
int type =0;
if ((32 <= nBytesRead) && (0x00 == pBuffer[0] && 0x00 == pBuffer[1] && 0x00 == pBuffer[2] && 0x0c == pBuffer[3]
&& 0x6a == pBuffer[4] && 0x50 == pBuffer[5] && 0x20 == pBuffer[6] && 0x20 == pBuffer[7]
&& 0x0d == pBuffer[8] && 0x0a == pBuffer[9] && 0x87 == pBuffer[10] && 0x0a == pBuffer[11]
&& 0x00 == pBuffer[12] && 0x00 == pBuffer[13] && 0x00 == pBuffer[14] /*&& (0x14 == pBuffer[15] || 0x18 == pBuffer[15] )*/
&& 0x66 == pBuffer[16] && 0x74 == pBuffer[17] && 0x79 == pBuffer[18] && 0x70 == pBuffer[19]
&& 0x6a == pBuffer[20] && 0x70 == pBuffer[21] && 0x32 == pBuffer[22] && 0x20 == pBuffer[23]
&& 0x00 == pBuffer[24] && 0x00 == pBuffer[25] && 0x00 == pBuffer[26] && 0x00 == pBuffer[27]
/*&& 0x6a == pBuffer[28] && 0x70 == pBuffer[29] && 0x32 == pBuffer[30] && 0x20 == pBuffer[31]*/))
{
type = 1;
}
if ((4 <= nBytesRead) && (0xff == pBuffer[0] && 0x4f == pBuffer[1] && 0xff == pBuffer[2] && 0x51 == pBuffer[3]))
{
type = 2;
}
if ((32 <= nBytesRead) && (0x00 == pBuffer[0] && 0x00 == pBuffer[1] && 0x00 == pBuffer[2] && 0x0c == pBuffer[3]
&& 0x6a == pBuffer[4] && 0x50 == pBuffer[5] && 0x20 == pBuffer[6] && 0x20 == pBuffer[7]
&& 0x0d == pBuffer[8] && 0x0a == pBuffer[9] && 0x87 == pBuffer[10] && 0x0a == pBuffer[11]
&& 0x00 == pBuffer[12] && 0x00 == pBuffer[13] && 0x00 == pBuffer[14] && 0x18 == pBuffer[15]
&& 0x66 == pBuffer[16] && 0x74 == pBuffer[17] && 0x79 == pBuffer[18] && 0x70 == pBuffer[19]
&& 0x6d == pBuffer[20] && 0x6a == pBuffer[21] && 0x70 == pBuffer[22] && 0x32 == pBuffer[23]
&& 0x00 == pBuffer[24] && 0x00 == pBuffer[25] && 0x00 == pBuffer[26] && 0x00 == pBuffer[27]
&& 0x6d == pBuffer[28] && 0x6a == pBuffer[29] && 0x70 == pBuffer[30] && 0x32 == pBuffer[31]))
{
type = 3;
}
int type = check_j2000_type(pBuffer, nBytesRead);
delete[] pBuffer;
fseek(pFile, 0, SEEK_SET);
return type;
}
int check_j2000_type(BYTE* pBuffer, int nSize)
{
if (!pBuffer)
return 0;
int type = 0;
if ((32 <= nSize) && (0x00 == pBuffer[0] && 0x00 == pBuffer[1] && 0x00 == pBuffer[2] && 0x0c == pBuffer[3]
&& 0x6a == pBuffer[4] && 0x50 == pBuffer[5] && 0x20 == pBuffer[6] && 0x20 == pBuffer[7]
&& 0x0d == pBuffer[8] && 0x0a == pBuffer[9] && 0x87 == pBuffer[10] && 0x0a == pBuffer[11]
&& 0x00 == pBuffer[12] && 0x00 == pBuffer[13] && 0x00 == pBuffer[14] /*&& (0x14 == pBuffer[15] || 0x18 == pBuffer[15] )*/
&& 0x66 == pBuffer[16] && 0x74 == pBuffer[17] && 0x79 == pBuffer[18] && 0x70 == pBuffer[19]
&& 0x6a == pBuffer[20] && 0x70 == pBuffer[21] && 0x32 == pBuffer[22] && 0x20 == pBuffer[23]
&& 0x00 == pBuffer[24] && 0x00 == pBuffer[25] && 0x00 == pBuffer[26] && 0x00 == pBuffer[27]
/*&& 0x6a == pBuffer[28] && 0x70 == pBuffer[29] && 0x32 == pBuffer[30] && 0x20 == pBuffer[31]*/))
{
type = 1;
}
if ((4 <= nSize) && (0xff == pBuffer[0] && 0x4f == pBuffer[1] && 0xff == pBuffer[2] && 0x51 == pBuffer[3]))
{
type = 2;
}
if ((32 <= nSize) && (0x00 == pBuffer[0] && 0x00 == pBuffer[1] && 0x00 == pBuffer[2] && 0x0c == pBuffer[3]
&& 0x6a == pBuffer[4] && 0x50 == pBuffer[5] && 0x20 == pBuffer[6] && 0x20 == pBuffer[7]
&& 0x0d == pBuffer[8] && 0x0a == pBuffer[9] && 0x87 == pBuffer[10] && 0x0a == pBuffer[11]
&& 0x00 == pBuffer[12] && 0x00 == pBuffer[13] && 0x00 == pBuffer[14] && 0x18 == pBuffer[15]
&& 0x66 == pBuffer[16] && 0x74 == pBuffer[17] && 0x79 == pBuffer[18] && 0x70 == pBuffer[19]
&& 0x6d == pBuffer[20] && 0x6a == pBuffer[21] && 0x70 == pBuffer[22] && 0x32 == pBuffer[23]
&& 0x00 == pBuffer[24] && 0x00 == pBuffer[25] && 0x00 == pBuffer[26] && 0x00 == pBuffer[27]
&& 0x6d == pBuffer[28] && 0x6a == pBuffer[29] && 0x70 == pBuffer[30] && 0x32 == pBuffer[31]))
{
type = 3;
}
return type;
}
}
// CJ2kFile
bool ImageToFrame(Image* pImage, CBgraFrame* pFrame, bool isBGRA)
{
int nWidth = pImage->pComponents[0].nWidth;
int nHeight = pImage->pComponents[0].nHeight;
int nBufferSize = 4 /*pImage->nCsiz*/ * nWidth * nHeight;
if (nBufferSize < 1)
return false;
pFrame->put_Width(nWidth);
pFrame->put_Height(nHeight);
pFrame->put_Stride(4 * nWidth);
BYTE* pData = new BYTE[nBufferSize];
if (!pData)
return false;
pFrame->put_Data(pData);
unsigned char* pBufferPtr = (unsigned char*)pData;
unsigned char indR = isBGRA ? 2 : 0;
unsigned char indG = 1;
unsigned char indB = isBGRA ? 0 : 2;
Jpeg2000::ImageComponent* pComponents = pImage->pComponents;
// Пишем данные в pBufferPtr
if (pImage->nCsiz == 3 && pImage->pComponents[0].nXRsiz == pImage->pComponents[1].nXRsiz && pImage->pComponents[1].nXRsiz == pImage->pComponents[2].nXRsiz
&& pImage->pComponents[0].nYRsiz == pImage->pComponents[1].nYRsiz && pImage->pComponents[1].nYRsiz == pImage->pComponents[2].nYRsiz
&& pImage->pComponents[0].nPrecision == pImage->pComponents[1].nPrecision && pImage->pComponents[1].nPrecision == pImage->pComponents[2].nPrecision)
{
int nResW = CeilDivPow2(pImage->pComponents[0].nWidth, pImage->pComponents[0].nFactorDiv2);
int nResH = CeilDivPow2(pImage->pComponents[0].nHeight, pImage->pComponents[0].nFactorDiv2);
int nValue = nWidth * (nResH - 1);
for (int j = 0; j < nResH; ++j)
{
for (int i = 0; i < nResW; ++i)
{
pBufferPtr[indR] = pComponents[0].pData[nValue + i];
pBufferPtr[indG] = pComponents[1].pData[nValue + i];
pBufferPtr[indB] = pComponents[2].pData[nValue + i];
pBufferPtr[3] = 255;
pBufferPtr += 4;
}
nValue -= nWidth;
}
}
else if (pImage->nCsiz >= 4 && pImage->pComponents[0].nXRsiz == pImage->pComponents[1].nXRsiz && pImage->pComponents[1].nXRsiz == pImage->pComponents[2].nXRsiz && pImage->pComponents[2].nXRsiz == pImage->pComponents[3].nXRsiz
&& pImage->pComponents[0].nYRsiz == pImage->pComponents[1].nYRsiz && pImage->pComponents[1].nYRsiz == pImage->pComponents[2].nYRsiz && pImage->pComponents[2].nYRsiz == pImage->pComponents[3].nYRsiz
&& pImage->pComponents[0].nPrecision == pImage->pComponents[1].nPrecision && pImage->pComponents[1].nPrecision == pImage->pComponents[2].nPrecision && pImage->pComponents[2].nPrecision == pImage->pComponents[3].nPrecision)
{
int nResW = CeilDivPow2(pImage->pComponents[0].nWidth, pImage->pComponents[0].nFactorDiv2);
int nResH = CeilDivPow2(pImage->pComponents[0].nHeight, pImage->pComponents[0].nFactorDiv2);
int nValue = nWidth * (nResH - 1);
for (int j = 0; j < nResH; ++j)
{
for (int i = 0; i < nResW; ++i)
{
pBufferPtr[indR] = pComponents[0].pData[nValue + i];
pBufferPtr[indG] = pComponents[1].pData[nValue + i];
pBufferPtr[indB] = pComponents[2].pData[nValue + i];
pBufferPtr[3] = pComponents[3].pData[nValue + i];
pBufferPtr += 4;
}
nValue -= nWidth;
}
}
else // Grayscale
{
int nResW = CeilDivPow2(pImage->pComponents[0].nWidth, pImage->pComponents[0].nFactorDiv2);
int nResH = CeilDivPow2(pImage->pComponents[0].nHeight, pImage->pComponents[0].nFactorDiv2);
int nValue = nWidth * (nResH - 1);
for (int j = 0; j < nResH; ++j)
{
for (int i = 0; i < nResW; ++i)
{
pBufferPtr[0] = pComponents[0].pData[nValue + i];
pBufferPtr[1] = pBufferPtr[0];
pBufferPtr[2] = pBufferPtr[0];
pBufferPtr[3] = 255;
pBufferPtr += 4;
}
nValue -= nWidth;
}
}
return true;
}
bool CJ2kFile::Open(CBgraFrame* pFrame, const std::wstring& wsSrcPath, const std::wstring& wsXmlOptions, bool isBGRA)
{
Image *pImage = NULL;
@ -134,8 +182,6 @@ namespace Jpeg2000
if (!oFile.OpenFile(wsSrcPath))
return false;
DWORD nFileSize = oFile.GetFileSize();
int type = check_j2000_type(oFile.GetFileNative());
oFile.CloseFile();
@ -158,96 +204,10 @@ namespace Jpeg2000
return false;
}
int nWidth = pImage->pComponents[0].nWidth;
int nHeight = pImage->pComponents[0].nHeight;
int nBufferSize = 4 /*pImage->nCsiz*/ * nWidth * nHeight;
bool bFrame = ImageToFrame(pImage, pFrame, isBGRA);
if (nBufferSize < 1)
{
Image_Destroy(pImage);
return false;
}
pFrame->put_Width(nWidth);
pFrame->put_Height(nHeight);
pFrame->put_Stride(4 * nWidth);
BYTE* pData = new BYTE[nBufferSize];
if (!pData)
{
Image_Destroy(pImage);
return false;
}
pFrame->put_Data(pData);
unsigned char* pBufferPtr = (unsigned char*)pData;
long nCreatedBufferSize = nBufferSize;
// Пишем данные в pBufferPtr
if (pImage->nCsiz == 3 && pImage->pComponents[0].nXRsiz == pImage->pComponents[1].nXRsiz && pImage->pComponents[1].nXRsiz == pImage->pComponents[2].nXRsiz
&& pImage->pComponents[0].nYRsiz == pImage->pComponents[1].nYRsiz && pImage->pComponents[1].nYRsiz == pImage->pComponents[2].nYRsiz
&& pImage->pComponents[0].nPrecision == pImage->pComponents[1].nPrecision && pImage->pComponents[1].nPrecision == pImage->pComponents[2].nPrecision)
{
int nResW = CeilDivPow2(pImage->pComponents[0].nWidth, pImage->pComponents[0].nFactorDiv2);
int nResH = CeilDivPow2(pImage->pComponents[0].nHeight, pImage->pComponents[0].nFactorDiv2);
for (int nIndex = 0; nIndex < nResW * nResH; nIndex++)
{
unsigned char nR = pImage->pComponents[0].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
unsigned char nG = pImage->pComponents[1].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
unsigned char nB = pImage->pComponents[2].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
pBufferPtr[0] = isBGRA ? nB : nR;
pBufferPtr[1] = nG;
pBufferPtr[2] = isBGRA ? nR : nB;
pBufferPtr[3] = 255;
pBufferPtr += 4;
}
}
else if (pImage->nCsiz >= 4 && pImage->pComponents[0].nXRsiz == pImage->pComponents[1].nXRsiz && pImage->pComponents[1].nXRsiz == pImage->pComponents[2].nXRsiz && pImage->pComponents[2].nXRsiz == pImage->pComponents[3].nXRsiz
&& pImage->pComponents[0].nYRsiz == pImage->pComponents[1].nYRsiz && pImage->pComponents[1].nYRsiz == pImage->pComponents[2].nYRsiz && pImage->pComponents[2].nYRsiz == pImage->pComponents[3].nYRsiz
&& pImage->pComponents[0].nPrecision == pImage->pComponents[1].nPrecision && pImage->pComponents[1].nPrecision == pImage->pComponents[2].nPrecision && pImage->pComponents[2].nPrecision == pImage->pComponents[3].nPrecision)
{
int nResW = CeilDivPow2(pImage->pComponents[0].nWidth, pImage->pComponents[0].nFactorDiv2);
int nResH = CeilDivPow2(pImage->pComponents[0].nHeight, pImage->pComponents[0].nFactorDiv2);
for (int nIndex = 0; nIndex < nResW * nResH; nIndex++)
{
unsigned char nR = pImage->pComponents[0].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
unsigned char nG = pImage->pComponents[1].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
unsigned char nB = pImage->pComponents[2].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
unsigned char nA = pImage->pComponents[3].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
pBufferPtr[0] = isBGRA ? nB : nR;
pBufferPtr[1] = nG;
pBufferPtr[2] = isBGRA ? nR : nB;
pBufferPtr[3] = nA;
pBufferPtr += 4;
}
}
else // Grayscale
{
int nResW = CeilDivPow2(pImage->pComponents[0].nWidth, pImage->pComponents[0].nFactorDiv2);
int nResH = CeilDivPow2(pImage->pComponents[0].nHeight, pImage->pComponents[0].nFactorDiv2);
for (int nIndex = 0; nIndex < nResW * nResH; nIndex++)
{
unsigned char nG = pImage->pComponents[0].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
pBufferPtr[0] = nG;
pBufferPtr[1] = nG;
pBufferPtr[2] = nG;
pBufferPtr[3] = 255;
pBufferPtr += 4;
}
}
Image_Destroy(pImage);
return true;
Image_Destroy(pImage);
return bFrame;
}
bool CJ2kFile::Open(CBgraFrame* pFrame, BYTE* pBuffer, int nSize, const std::wstring& wsXmlOptions, bool isBGRA)
{
@ -281,95 +241,10 @@ namespace Jpeg2000
return false;
}
int nWidth = pImage->pComponents[0].nWidth;
int nHeight = pImage->pComponents[0].nHeight;
int nBufferSize = 4 /*pImage->nCsiz*/ * nWidth * nHeight;
bool bFrame = ImageToFrame(pImage, pFrame, isBGRA);
if (nBufferSize < 1)
{
Image_Destroy(pImage);
return false;
}
pFrame->put_Width(nWidth);
pFrame->put_Height(nHeight);
pFrame->put_Stride(4 * nWidth);
BYTE* pData = new BYTE[nBufferSize];
if (!pData)
{
Image_Destroy(pImage);
return false;
}
pFrame->put_Data(pData);
unsigned char* pBufferPtr = (unsigned char*)pData;
long nCreatedBufferSize = nBufferSize;
// Пишем данные в pBufferPtr
if (pImage->nCsiz == 3 && pImage->pComponents[0].nXRsiz == pImage->pComponents[1].nXRsiz && pImage->pComponents[1].nXRsiz == pImage->pComponents[2].nXRsiz
&& pImage->pComponents[0].nYRsiz == pImage->pComponents[1].nYRsiz && pImage->pComponents[1].nYRsiz == pImage->pComponents[2].nYRsiz
&& pImage->pComponents[0].nPrecision == pImage->pComponents[1].nPrecision && pImage->pComponents[1].nPrecision == pImage->pComponents[2].nPrecision)
{
int nResW = CeilDivPow2(pImage->pComponents[0].nWidth, pImage->pComponents[0].nFactorDiv2);
int nResH = CeilDivPow2(pImage->pComponents[0].nHeight, pImage->pComponents[0].nFactorDiv2);
for (int nIndex = 0; nIndex < nResW * nResH; nIndex++)
{
unsigned char nR = pImage->pComponents[0].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
unsigned char nG = pImage->pComponents[1].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
unsigned char nB = pImage->pComponents[2].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
pBufferPtr[0] = isBGRA ? nB : nR;
pBufferPtr[1] = nG;
pBufferPtr[2] = isBGRA ? nR : nB;
pBufferPtr[3] = 255;
pBufferPtr += 4;
}
}
else if (pImage->nCsiz >= 4 && pImage->pComponents[0].nXRsiz == pImage->pComponents[1].nXRsiz && pImage->pComponents[1].nXRsiz == pImage->pComponents[2].nXRsiz && pImage->pComponents[2].nXRsiz == pImage->pComponents[3].nXRsiz
&& pImage->pComponents[0].nYRsiz == pImage->pComponents[1].nYRsiz && pImage->pComponents[1].nYRsiz == pImage->pComponents[2].nYRsiz && pImage->pComponents[2].nYRsiz == pImage->pComponents[3].nYRsiz
&& pImage->pComponents[0].nPrecision == pImage->pComponents[1].nPrecision && pImage->pComponents[1].nPrecision == pImage->pComponents[2].nPrecision && pImage->pComponents[2].nPrecision == pImage->pComponents[3].nPrecision)
{
int nResW = CeilDivPow2(pImage->pComponents[0].nWidth, pImage->pComponents[0].nFactorDiv2);
int nResH = CeilDivPow2(pImage->pComponents[0].nHeight, pImage->pComponents[0].nFactorDiv2);
for (int nIndex = 0; nIndex < nResW * nResH; nIndex++)
{
unsigned char nR = pImage->pComponents[0].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
unsigned char nG = pImage->pComponents[1].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
unsigned char nB = pImage->pComponents[2].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
unsigned char nA = pImage->pComponents[3].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
pBufferPtr[0] = isBGRA ? nB : nR;
pBufferPtr[1] = nG;
pBufferPtr[2] = isBGRA ? nR : nB;
pBufferPtr[3] = nA;
pBufferPtr += 4;
}
}
else // Grayscale
{
int nResW = CeilDivPow2(pImage->pComponents[0].nWidth, pImage->pComponents[0].nFactorDiv2);
int nResH = CeilDivPow2(pImage->pComponents[0].nHeight, pImage->pComponents[0].nFactorDiv2);
for (int nIndex = 0; nIndex < nResW * nResH; nIndex++)
{
unsigned char nG = pImage->pComponents[0].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)];
pBufferPtr[0] = nG;
pBufferPtr[1] = nG;
pBufferPtr[2] = nG;
pBufferPtr[3] = 255;
pBufferPtr += 4;
}
}
Image_Destroy(pImage);
return true;
Image_Destroy(pImage);
return bFrame;
}
bool CJ2kFile::Open(BYTE** ppData, int& nComponentsCount, int& nWidth, int& nHeight, const std::wstring& wsSrcPath, const std::wstring& wsXmlOptions)
{

View File

@ -26,330 +26,206 @@ namespace Jpeg2000
//-------------------------------------------------------------------------------------------------------------------------------
// Jpeg2000 -> Image
//-------------------------------------------------------------------------------------------------------------------------------
Image* Jp2ToImage(CReader *pStream, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pJp2 = (void*)Jp2_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pJp2)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJ2k = NULL;
pDInfo->eCodecFormat = codecJP2;
Jp2_SetupDecoder((Jp2Stream*)pDInfo->pJp2, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
Jp2_DestroyDecompress((Jp2Stream*)pDInfo->pJp2);
Free(pDInfo);
return NULL;
}
Image *pImage = Jp2_Decode((Jp2Stream*)pDInfo->pJp2, pStream); // в случае ошибки pImage = NULL
Jp2_DestroyDecompress((Jp2Stream*)pDInfo->pJp2);
Free(pDInfo);
return pImage;
}
Image* J2kToImage(CReader *pStream, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pJ2k = (void*)J2k_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pJ2k)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJp2 = NULL;
pDInfo->eCodecFormat = codecJ2K;
J2k_SetupDecoder((J2kCodestream*)pDInfo->pJ2k, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
}
Image *pImage = J2k_Decode((J2kCodestream*)pDInfo->pJ2k, pStream); // в случае ошибки pImage = NULL
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return pImage;
}
Image* JptToImage(CReader *pStream, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pJ2k = (void*)J2k_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pJ2k)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJp2 = NULL;
pDInfo->eCodecFormat = codecJPT;
J2k_SetupDecoder((J2kCodestream*)pDInfo->pJ2k, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
}
Image *pImage = J2k_DecodeJptStream((J2kCodestream*)pDInfo->pJ2k, pStream); // в случае ошибки pImage = NULL
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return pImage;
}
Image* Mj2ToImage(CReader *pStream, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pMj2 = (void*)Mj2_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pMj2)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJ2k = ((Mj2_Movie*)pDInfo->pMj2)->pJ2k;
pDInfo->eCodecFormat = codecMj2;
Mj2_SetupDecoder((Mj2_Movie*)pDInfo->pMj2, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
Mj2_DestroyDecompress((Mj2_Movie*)pDInfo->pMj2);
Free(pDInfo);
return NULL;
}
Image *pImage = Mj2_Decode((Mj2_Movie*)pDInfo->pMj2, pStream); // в случае ошибки pImage = NULL
Mj2_DestroyDecompress((Mj2_Movie*)pDInfo->pMj2);
Free(pDInfo);
return pImage;
}
// From files
Image* Jp2ToImage(const std::wstring& wsFileName, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pJp2 = (void*)Jp2_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pJp2)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJ2k = NULL;
pDInfo->eCodecFormat = codecJP2;
Jp2_SetupDecoder((Jp2Stream*)pDInfo->pJp2, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
Jp2_DestroyDecompress((Jp2Stream*)pDInfo->pJp2);
Free(pDInfo);
return NULL;
}
CReader *pStream = (CReader *)new CReaderFile(wsFileName, 1);
if (!pStream)
{
Jp2_DestroyDecompress((Jp2Stream*)pDInfo->pJp2);
Free(pDInfo);
return NULL;
}
Image *pImage = Jp2_Decode((Jp2Stream*)pDInfo->pJp2, pStream); // в случае ошибки pImage = NULL
delete (pStream);
Jp2_DestroyDecompress((Jp2Stream*)pDInfo->pJp2);
Free(pDInfo);
return pImage;
CReader *pStream = (CReader *)new CReaderFile(wsFileName, 1);
if (!pStream)
return NULL;
Image* pImage = Jp2ToImage(pStream, pDecoderParams);
delete pStream;
return pImage;
}
Image* J2kToImage(const std::wstring& wsFileName, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pJ2k = (void*)J2k_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pJ2k)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJp2 = NULL;
pDInfo->eCodecFormat = codecJ2K;
J2k_SetupDecoder((J2kCodestream*)pDInfo->pJ2k, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
}
CReader *pStream = (CReader *)new CReaderFile(wsFileName, 1);
if (!pStream)
{
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
}
Image *pImage = J2k_Decode((J2kCodestream*)pDInfo->pJ2k, pStream); // в случае ошибки pImage = NULL
delete (pStream);
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return pImage;
CReader *pStream = (CReader *)new CReaderFile(wsFileName, 1);
if (!pStream)
return NULL;
Image* pImage = J2kToImage(pStream, pDecoderParams);
delete pStream;
return pImage;
}
Image* JptToImage(const std::wstring& wsFileName, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pJ2k = (void*)J2k_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pJ2k)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJp2 = NULL;
pDInfo->eCodecFormat = codecJPT;
J2k_SetupDecoder((J2kCodestream*)pDInfo->pJ2k, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
}
CReader *pStream = (CReader *)new CReaderFile(wsFileName, 1);
if (!pStream)
{
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
}
Image *pImage = J2k_DecodeJptStream((J2kCodestream*)pDInfo->pJ2k, pStream); // в случае ошибки pImage = NULL
delete (pStream);
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
CReader *pStream = (CReader *)new CReaderFile(wsFileName, 1);
if (!pStream)
return NULL;
Image* pImage = JptToImage(pStream, pDecoderParams);
delete pStream;
return pImage;
}
Image* Mj2ToImage(const std::wstring& wsFileName, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pMj2 = (void*)Mj2_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pMj2)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJ2k = ((Mj2_Movie*)pDInfo->pMj2)->pJ2k;
pDInfo->eCodecFormat = codecMj2;
Mj2_SetupDecoder((Mj2_Movie*)pDInfo->pMj2, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
Mj2_DestroyDecompress((Mj2_Movie*)pDInfo->pMj2);
Free(pDInfo);
return NULL;
}
CReader *pStream = (CReader *)new CReaderFile(wsFileName, 1);
if (!pStream)
{
Mj2_DestroyDecompress((Mj2_Movie*)pDInfo->pMj2);
Free(pDInfo);
return NULL;
}
Image *pImage = Mj2_Decode((Mj2_Movie*)pDInfo->pMj2, pStream); // в случае ошибки pImage = NULL
delete (pStream);
Mj2_DestroyDecompress((Mj2_Movie*)pDInfo->pMj2);
Free(pDInfo);
return pImage;
CReader *pStream = (CReader *)new CReaderFile(wsFileName, 1);
if (!pStream)
return NULL;
Image* pImage = Mj2ToImage(pStream, pDecoderParams);
delete pStream;
return pImage;
}
// From buffer
Image* Jp2ToImage(BYTE* pBuffer, int nSize, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pJp2 = (void*)Jp2_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pJp2)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJ2k = NULL;
pDInfo->eCodecFormat = codecJP2;
Jp2_SetupDecoder((Jp2Stream*)pDInfo->pJp2, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
Jp2_DestroyDecompress((Jp2Stream*)pDInfo->pJp2);
Free(pDInfo);
return NULL;
}
CReader *pStream = (CReader *)new CReaderStream(pBuffer, nSize);
if (!pStream)
{
Jp2_DestroyDecompress((Jp2Stream*)pDInfo->pJp2);
Free(pDInfo);
return NULL;
}
Image *pImage = Jp2_Decode((Jp2Stream*)pDInfo->pJp2, pStream); // в случае ошибки pImage = NULL
delete (pStream);
Jp2_DestroyDecompress((Jp2Stream*)pDInfo->pJp2);
Free(pDInfo);
return pImage;
CReader *pStream = (CReader *)new CReaderStream(pBuffer, nSize);
if (!pStream)
return NULL;
Image* pImage = Jp2ToImage(pStream, pDecoderParams);
delete pStream;
return pImage;
}
Image* J2kToImage(BYTE* pBuffer, int nSize, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pJ2k = (void*)J2k_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pJ2k)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJp2 = NULL;
pDInfo->eCodecFormat = codecJ2K;
J2k_SetupDecoder((J2kCodestream*)pDInfo->pJ2k, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
}
CReader *pStream = (CReader *)new CReaderStream(pBuffer, nSize);
if (!pStream)
{
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
}
Image *pImage = J2k_Decode((J2kCodestream*)pDInfo->pJ2k, pStream); // в случае ошибки pImage = NULL
delete (pStream);
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return pImage;
CReader *pStream = (CReader *)new CReaderStream(pBuffer, nSize);
if (!pStream)
return NULL;
Image* pImage = J2kToImage(pStream, pDecoderParams);
delete pStream;
return pImage;
}
Image* JptToImage(BYTE* pBuffer, int nSize, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pJ2k = (void*)J2k_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pJ2k)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJp2 = NULL;
pDInfo->eCodecFormat = codecJPT;
J2k_SetupDecoder((J2kCodestream*)pDInfo->pJ2k, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
}
CReader *pStream = (CReader *)new CReaderStream(pBuffer, nSize);
if (!pStream)
{
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
}
Image *pImage = J2k_DecodeJptStream((J2kCodestream*)pDInfo->pJ2k, pStream); // в случае ошибки pImage = NULL
delete (pStream);
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
Free(pDInfo);
return NULL;
CReader *pStream = (CReader *)new CReaderStream(pBuffer, nSize);
if (!pStream)
return NULL;
Image* pImage = JptToImage(pStream, pDecoderParams);
delete pStream;
return pImage;
}
Image* Mj2ToImage(BYTE* pBuffer, int nSize, DecoderParams* pDecoderParams)
{
DInfo *pDInfo = (DInfo*)Malloc(sizeof(DInfo));
if (!pDInfo)
return NULL;
pDInfo->bIsDecompressor = true;
pDInfo->pMj2 = (void*)Mj2_CreateDecompress((PCommon)pDInfo);
if (!pDInfo->pMj2)
{
Free(pDInfo);
return NULL;
}
pDInfo->pJ2k = ((Mj2_Movie*)pDInfo->pMj2)->pJ2k;
pDInfo->eCodecFormat = codecMj2;
Mj2_SetupDecoder((Mj2_Movie*)pDInfo->pMj2, pDecoderParams);
if (JP2_ERROR_NO_ERROR != pDInfo->nErrorCode)
{
Mj2_DestroyDecompress((Mj2_Movie*)pDInfo->pMj2);
Free(pDInfo);
return NULL;
}
CReader *pStream = (CReader *)new CReaderStream(pBuffer, nSize);
if (!pStream)
{
Mj2_DestroyDecompress((Mj2_Movie*)pDInfo->pMj2);
Free(pDInfo);
return NULL;
}
Image *pImage = Mj2_Decode((Mj2_Movie*)pDInfo->pMj2, pStream); // в случае ошибки pImage = NULL
delete (pStream);
Mj2_DestroyDecompress((Mj2_Movie*)pDInfo->pMj2);
Free(pDInfo);
return pImage;
CReader *pStream = (CReader *)new CReaderStream(pBuffer, nSize);
if (!pStream)
return NULL;
Image* pImage = Mj2ToImage(pStream, pDecoderParams);
delete pStream;
return pImage;
}
//-------------------------------------------------------------------------------------------------------------------------------
// Image -> Jpeg2000

View File

@ -0,0 +1,22 @@
#include "./opj_bgraframe.h"
#include <algorithm>
int main(int argc, char **argv)
{
CBgraFrame oFrame;
if (openjpeg::Parse(L"PATH_TO_IMAGE_SRC", &oFrame, true))
{
int nW = oFrame.get_Width();
int nH = oFrame.get_Height();
int nMax = std::max(nW, nH);
if (nMax > 5000)
{
double dKoef = 5000.0 / nMax;
oFrame.Resize((int)(dKoef * nW), (int)(dKoef * nH), true);
}
oFrame.SaveFile(L"PATH_TO_IMAGE_DST", 4);
}
return 0;
}

View File

@ -0,0 +1,18 @@
# Ignore files and directories made by `cmake .`.
CMakeFiles/
Makefile
cmake_install.cmake
/CMakeCache.txt
/CPackConfig.cmake
/CPackSourceConfig.cmake
/CTestCustom.cmake
/LICENSE.txt
/OpenJPEGConfig.cmake
/libopenjp2.pc
/src/bin/common/opj_apps_config.h
/src/lib/openjp2/opj_config.h
/src/lib/openjp2/opj_config_private.h
scripts/opjstyle*
# Ignore directories made by `make`.
/bin/

View File

@ -0,0 +1,158 @@
language: cpp
matrix:
include:
# OSX
- os: osx
compiler: clang
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1
# Test code style
- os: linux
compiler: clang-3.8
env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_CHECK_STYLE=1 OPJ_CI_SKIP_TESTS=1
addons:
apt:
sources:
- llvm-toolchain-precise-3.8
- ubuntu-toolchain-r-test
packages:
- clang-3.8
- flip
# Performance test with GCC
- os: linux
compiler: g++
dist: precise
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1 OPJ_CI_PERF_TESTS=1
# Test compilation with AVX2
- os: linux
# "sudo: yes" and "dist: trusty" give us a worker with the AVX2 instruction set
sudo: yes
dist: trusty
compiler: clang-3.8
env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_INSTRUCTION_SETS="-mavx2" OPJ_CI_BUILD_CONFIGURATION=Release
addons:
apt:
sources:
- llvm-toolchain-precise-3.8
- ubuntu-toolchain-r-test
packages:
- clang-3.8
# Test multi-threading
- os: linux
compiler: g++
dist: precise
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_NUM_THREADS=2
# Test 32-bit compilation
- os: linux
compiler: g++
env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
dist: trusty
addons:
apt:
packages:
- gcc-multilib
- g++-multilib
# Profile code (gcc -pg)
- os: linux
compiler: g++
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_PROFILE=1
dist: trusty
addons:
apt:
packages:
- valgrind
# Test under ASAN
# Temporarily disabled since broken. See https://github.com/uclouvain/openjpeg/issues/1091
# - os: linux
# compiler: clang
# env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1
# Test with CLang 3.8
- os: linux
compiler: clang-3.8
env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_PERF_TESTS=1 OPJ_CI_BUILD_FUZZERS=1
dist: trusty
addons:
apt:
sources:
- llvm-toolchain-precise-3.8
- ubuntu-toolchain-r-test
packages:
- clang-3.8
# Test with mingw 32 bit
- os: linux
compiler: x86_64-w64-mingw32-g++
env: OPJ_CI_CC=x86_64-w64-mingw32-gcc OPJ_CI_CXX=x86_64-w64-mingw32-g++ OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
dist: trusty
addons:
apt:
packages:
- gcc-mingw-w64-base
- binutils-mingw-w64-i686
- gcc-mingw-w64-i686
- gcc-mingw-w64
- g++-mingw-w64-i686
- gcc-multilib
- g++-multilib
# Test with mingw 64 bit
- os: linux
compiler: x86_64-w64-mingw32-g++
env: OPJ_CI_CC=x86_64-w64-mingw32-gcc OPJ_CI_CXX=x86_64-w64-mingw32-g++ OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
dist: trusty
addons:
apt:
packages:
- gcc-mingw-w64-base
- binutils-mingw-w64-x86-64
- gcc-mingw-w64-x86-64
- gcc-mingw-w64
- g++-mingw-w64-x86-64
# Test with gcc 4.8
- os: linux
compiler: g++-4.8
env: OPJ_CI_CC=gcc-4.8 OPJ_CI_CXX=g++-4.8 OPJ_CI_ABI_CHECK=1
dist: precise
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
- libelf-dev
- elfutils
- texinfo
- exuberant-ctags
install:
- "./tools/travis-ci/install.sh"
script:
- "./tools/travis-ci/run.sh"
- "./tools/travis-ci/abi-check.sh"
before_deploy:
- export OPJ_RELEASE_PKG_FILE=$(ls build/openjpeg-${TRAVIS_TAG}*)
- echo "deploying $OPJ_RELEASE_PKG_FILE to GitHub releases"
deploy:
provider: releases
api_key:
secure: dJXdzoFwk9wYWIKztnXKlVIr1QDmeXtk3oK+2MEzy22fBTKPuphU/cYMvhi5B7sWDwm77f43vbAYO6z7IFmuThwhkuVMD/o+lUyCqGffGeiU1pKpxEvB+LbO/C5asdSnor3RfYdOyo3x4cNlhNtfhXIn7FcAg371yEY6VSIP87adoQcuE+taig0cYWcrNWYGHirHlzEz1utnKwCT/nlhV4nSIWxjwYUp3nt8PAw3RbqQkPPNBniW92g6JA25vLRc3HMD18ISCfNLC2fI6a/dTR+vd+bCySA7JvqeDZnv8SxbVIabu5T+A5CHzHbdp2l2kynPwqHOO47pGa+VfisXEwSsOpa+4EZsPLdwOhaFFnvDwKwR3EjI1TkRVd26IcK61Y5zVZQgalnXBowBEZoI4fT/oEPF7VZMjN3sy/do1U6d5kO0UGqCHCJIVwPeELhwq5z7Ld04K7dSFFVenZhhQKCwxI1o8vgkGNJUWD2Ii6ZLrZKYZ0lC65hr2d39e/KoK3Yh5KHF0cVn6ppBTcUjYr/tdHHO43rwoaf3r1CdAQAYpFvfi3900hl9I/GPwky0YJ6W2QDS2vincwaqWDQ0+WNGf4AKSdx5kCgQU45PSfDb/lxAyXkqmBuI3h/C2ellleaWVL9sGtNRWa/w6WseGMGwfCXgN82XRVM2bgP6pYg=
file_glob: true
file: "${OPJ_RELEASE_PKG_FILE}"
skip_cleanup: true
on:
repo: uclouvain/openjpeg
tags: true
condition: "$OPJ_CI_INCLUDE_IF_DEPLOY = 1"

View File

@ -0,0 +1,21 @@
# Authors of OpenJPEG
See also [THANKS](https://github.com/uclouvain/openjpeg/blob/master/THANKS.md)
David Janssens designed and implemented the first version of OpenJPEG.
Kaori Hagihara designed and implemented the first version of OpenJPIP.
Jerome Fimes implemented the alpha version of OpenJPEG 2.0.
Giuseppe Baruffa added the JPWL functionalities.
Mickaël Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0.
Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities.
Yannick Verschueren,
Herve Drolon,
Francois-Olivier Devaux,
Antonin Descampe
improved the libraries and utilities.

View File

@ -0,0 +1,770 @@
# Changelog
## [v2.4.0](https://github.com/uclouvain/openjpeg/releases/v2.4.0) (2020-12-28)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.3.1...v2.4.0)
**Closed issues:**
- OPENJPEG\_INSTALL\_DOC\_DIR does not control a destination directory where HTML docs would be installed. [\#1309](https://github.com/uclouvain/openjpeg/issues/1309)
- Heap-buffer-overflow in lib/openjp2/pi.c:312 [\#1302](https://github.com/uclouvain/openjpeg/issues/1302)
- Heap-buffer-overflow in lib/openjp2/t2.c:973 [\#1299](https://github.com/uclouvain/openjpeg/issues/1299)
- Heap-buffer-overflow in lib/openjp2/pi.c:623 [\#1293](https://github.com/uclouvain/openjpeg/issues/1293)
- Global-buffer-overflow in lib/openjp2/dwt.c:1980 [\#1286](https://github.com/uclouvain/openjpeg/issues/1286)
- Heap-buffer-overflow in lib/openjp2/tcd.c:2417 [\#1284](https://github.com/uclouvain/openjpeg/issues/1284)
- Heap-buffer-overflow in lib/openjp2/mqc.c:499 [\#1283](https://github.com/uclouvain/openjpeg/issues/1283)
- Openjpeg could not encode 32bit RGB float image [\#1281](https://github.com/uclouvain/openjpeg/issues/1281)
- Openjpeg could not encode 32bit RGB float image [\#1280](https://github.com/uclouvain/openjpeg/issues/1280)
- ISO/IEC 15444-1:2019 \(E\) compared with 'cio.h' [\#1277](https://github.com/uclouvain/openjpeg/issues/1277)
- Test-suite failure due to hash mismatch [\#1264](https://github.com/uclouvain/openjpeg/issues/1264)
- Heap use-after-free [\#1261](https://github.com/uclouvain/openjpeg/issues/1261)
- Memory leak when failing to allocate object... [\#1259](https://github.com/uclouvain/openjpeg/issues/1259)
- Memory leak of Tier 1 handle when OpenJPEG fails to set it as TLS... [\#1257](https://github.com/uclouvain/openjpeg/issues/1257)
- Any plan to build release for CVE-2020-8112/CVE-2020-6851 [\#1247](https://github.com/uclouvain/openjpeg/issues/1247)
- failing to convert 16-bit file: opj\_t2\_encode\_packet\(\): only 5251 bytes remaining in output buffer. 5621 needed. [\#1243](https://github.com/uclouvain/openjpeg/issues/1243)
- CMake+VS2017 Compile OK, thirdparty Compile OK, but thirdparty not install [\#1239](https://github.com/uclouvain/openjpeg/issues/1239)
- New release to solve CVE-2019-6988 ? [\#1238](https://github.com/uclouvain/openjpeg/issues/1238)
- Many tests fail to pass after the update of libtiff to version 4.1.0 [\#1233](https://github.com/uclouvain/openjpeg/issues/1233)
- Another heap buffer overflow in libopenjp2 [\#1231](https://github.com/uclouvain/openjpeg/issues/1231)
- Heap buffer overflow in libopenjp2 [\#1228](https://github.com/uclouvain/openjpeg/issues/1228)
- Endianness of binary volume \(JP3D\) [\#1224](https://github.com/uclouvain/openjpeg/issues/1224)
- New release to resolve CVE-2019-12973 [\#1222](https://github.com/uclouvain/openjpeg/issues/1222)
- how to set the block size,like 128,256 ? [\#1216](https://github.com/uclouvain/openjpeg/issues/1216)
- compress YUV files to motion jpeg2000 standard [\#1213](https://github.com/uclouvain/openjpeg/issues/1213)
- Repair/update Java wrapper, and include in release [\#1208](https://github.com/uclouvain/openjpeg/issues/1208)
- abc [\#1206](https://github.com/uclouvain/openjpeg/issues/1206)
- Slow decoding [\#1202](https://github.com/uclouvain/openjpeg/issues/1202)
- Installation question [\#1201](https://github.com/uclouvain/openjpeg/issues/1201)
- Typo in test\_decode\_area - \*ptilew is assigned instead of \*ptileh [\#1195](https://github.com/uclouvain/openjpeg/issues/1195)
- Creating a J2K file with one POC is broken [\#1191](https://github.com/uclouvain/openjpeg/issues/1191)
- Make fails on Arch Linux [\#1174](https://github.com/uclouvain/openjpeg/issues/1174)
- Heap buffer overflow in opj\_t1\_clbl\_decode\_processor\(\) triggered with Ghostscript [\#1158](https://github.com/uclouvain/openjpeg/issues/1158)
- opj\_stream\_get\_number\_byte\_left: Assertion `p\_stream-\>m\_byte\_offset \>= 0' failed. [\#1151](https://github.com/uclouvain/openjpeg/issues/1151)
- The fuzzer ignores too many inputs [\#1079](https://github.com/uclouvain/openjpeg/issues/1079)
- out of bounds read [\#1068](https://github.com/uclouvain/openjpeg/issues/1068)
**Merged pull requests:**
- Change defined WIN32 [\#1310](https://github.com/uclouvain/openjpeg/pull/1310) ([Jamaika1](https://github.com/Jamaika1))
- docs: fix simple typo, producted -\> produced [\#1308](https://github.com/uclouvain/openjpeg/pull/1308) ([timgates42](https://github.com/timgates42))
- Set ${OPENJPEG\_INSTALL\_DOC\_DIR} to DESTINATION of HTMLs [\#1307](https://github.com/uclouvain/openjpeg/pull/1307) ([lemniscati](https://github.com/lemniscati))
- Use INC\_DIR for OPENJPEG\_INCLUDE\_DIRS \(fixes uclouvain\#1174\) [\#1306](https://github.com/uclouvain/openjpeg/pull/1306) ([matthew-sharp](https://github.com/matthew-sharp))
- pi.c: avoid out of bounds access with POC \(fixes \#1302\) [\#1304](https://github.com/uclouvain/openjpeg/pull/1304) ([rouault](https://github.com/rouault))
- Encoder: grow again buffer size [\#1303](https://github.com/uclouvain/openjpeg/pull/1303) ([zodf0055980](https://github.com/zodf0055980))
- opj\_j2k\_write\_sod\(\): avoid potential heap buffer overflow \(fixes \#1299\) \(probably master only\) [\#1301](https://github.com/uclouvain/openjpeg/pull/1301) ([rouault](https://github.com/rouault))
- pi.c: avoid out of bounds access with POC \(refs https://github.com/uclouvain/openjpeg/issues/1293\#issuecomment-737122836\) [\#1300](https://github.com/uclouvain/openjpeg/pull/1300) ([rouault](https://github.com/rouault))
- opj\_t2\_encode\_packet\(\): avoid out of bound access of \#1297, but likely not the proper fix [\#1298](https://github.com/uclouvain/openjpeg/pull/1298) ([rouault](https://github.com/rouault))
- opj\_t2\_encode\_packet\(\): avoid out of bound access of \#1294, but likely not the proper fix [\#1296](https://github.com/uclouvain/openjpeg/pull/1296) ([rouault](https://github.com/rouault))
- opj\_j2k\_setup\_encoder\(\): validate POC compno0 and compno1 \(fixes \#1293\) [\#1295](https://github.com/uclouvain/openjpeg/pull/1295) ([rouault](https://github.com/rouault))
- Encoder: avoid global buffer overflow on irreversible conversion when… [\#1292](https://github.com/uclouvain/openjpeg/pull/1292) ([rouault](https://github.com/rouault))
- Decoding: deal with some SPOT6 images that have tiles with a single tile-part with TPsot == 0 and TNsot == 0, and with missing EOC [\#1291](https://github.com/uclouvain/openjpeg/pull/1291) ([rouault](https://github.com/rouault))
- Free p\_tcd\_marker\_info to avoid memory leak [\#1288](https://github.com/uclouvain/openjpeg/pull/1288) ([zodf0055980](https://github.com/zodf0055980))
- Encoder: grow again buffer size [\#1287](https://github.com/uclouvain/openjpeg/pull/1287) ([zodf0055980](https://github.com/zodf0055980))
- Encoder: avoid uint32 overflow when allocating memory for codestream buffer \(fixes \#1243\) [\#1276](https://github.com/uclouvain/openjpeg/pull/1276) ([rouault](https://github.com/rouault))
- Java compatibility from 1.5 to 1.6 [\#1263](https://github.com/uclouvain/openjpeg/pull/1263) ([jiapei100](https://github.com/jiapei100))
- opj\_decompress: fix double-free on input directory with mix of valid and invalid images [\#1262](https://github.com/uclouvain/openjpeg/pull/1262) ([rouault](https://github.com/rouault))
- openjp2: Plug image leak when failing to allocate codestream index. [\#1260](https://github.com/uclouvain/openjpeg/pull/1260) ([sebras](https://github.com/sebras))
- openjp2: Plug memory leak when setting data as TLS fails. [\#1258](https://github.com/uclouvain/openjpeg/pull/1258) ([sebras](https://github.com/sebras))
- openjp2: Error out if failing to create Tier 1 handle. [\#1256](https://github.com/uclouvain/openjpeg/pull/1256) ([sebras](https://github.com/sebras))
- Testing for invalid values of width, height, numcomps [\#1254](https://github.com/uclouvain/openjpeg/pull/1254) ([szukw000](https://github.com/szukw000))
- Single-threaded performance improvements in forward DWT for 5-3 and 9-7 \(and other improvements\) [\#1253](https://github.com/uclouvain/openjpeg/pull/1253) ([rouault](https://github.com/rouault))
- Add support for multithreading in encoder [\#1248](https://github.com/uclouvain/openjpeg/pull/1248) ([rouault](https://github.com/rouault))
- Add support for generation of PLT markers in encoder [\#1246](https://github.com/uclouvain/openjpeg/pull/1246) ([rouault](https://github.com/rouault))
- Fix warnings about signed/unsigned casts in pi.c [\#1244](https://github.com/uclouvain/openjpeg/pull/1244) ([rouault](https://github.com/rouault))
- opj\_decompress: add sanity checks to avoid segfault in case of decoding error [\#1240](https://github.com/uclouvain/openjpeg/pull/1240) ([rouault](https://github.com/rouault))
- ignore wrong icc [\#1236](https://github.com/uclouvain/openjpeg/pull/1236) ([szukw000](https://github.com/szukw000))
- Implement writing of IMF profiles [\#1235](https://github.com/uclouvain/openjpeg/pull/1235) ([rouault](https://github.com/rouault))
- tests: add alternate checksums for libtiff 4.1 [\#1234](https://github.com/uclouvain/openjpeg/pull/1234) ([rouault](https://github.com/rouault))
- opj\_tcd\_init\_tile\(\): avoid integer overflow [\#1232](https://github.com/uclouvain/openjpeg/pull/1232) ([rouault](https://github.com/rouault))
- tests/fuzzers: link fuzz binaries using $LIB\_FUZZING\_ENGINE. [\#1230](https://github.com/uclouvain/openjpeg/pull/1230) ([Dor1s](https://github.com/Dor1s))
- opj\_j2k\_update\_image\_dimensions\(\): reject images whose coordinates are beyond INT\_MAX \(fixes \#1228\) [\#1229](https://github.com/uclouvain/openjpeg/pull/1229) ([rouault](https://github.com/rouault))
- Fix resource leaks [\#1226](https://github.com/uclouvain/openjpeg/pull/1226) ([dodys](https://github.com/dodys))
- abi-check.sh: fix false postive ABI error, and display output error log [\#1218](https://github.com/uclouvain/openjpeg/pull/1218) ([rouault](https://github.com/rouault))
- pi.c: avoid integer overflow, resulting in later invalid access to memory in opj\_t2\_decode\_packets\(\) [\#1217](https://github.com/uclouvain/openjpeg/pull/1217) ([rouault](https://github.com/rouault))
- Add check to validate SGcod/SPcoc/SPcod parameter values. [\#1211](https://github.com/uclouvain/openjpeg/pull/1211) ([sebras](https://github.com/sebras))
- Fix buffer overflow reading an image file less than four characters [\#1196](https://github.com/uclouvain/openjpeg/pull/1196) ([robert-ancell](https://github.com/robert-ancell))
- compression: emit POC marker when only one single POC is requested \(f… [\#1192](https://github.com/uclouvain/openjpeg/pull/1192) ([rouault](https://github.com/rouault))
- Fix several potential vulnerabilities [\#1185](https://github.com/uclouvain/openjpeg/pull/1185) ([Young-X](https://github.com/Young-X))
- openjp2/j2k: Report error if all wanted components are not decoded. [\#1164](https://github.com/uclouvain/openjpeg/pull/1164) ([sebras](https://github.com/sebras))
## [v2.3.1](https://github.com/uclouvain/openjpeg/releases/v2.3.1) (2019-04-02)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.3.0...v2.3.1)
**Closed issues:**
- v2.2.0 regression for decoding images where TNsot == 0 [\#1120](https://github.com/uclouvain/openjpeg/issues/1120)
- Int overflow in jp3d [\#1162](https://github.com/uclouvain/openjpeg/issues/1162)
- Heap buffer overflow in opj\_j2k\_update\_image\_data\(\) triggered with Ghostscript [\#1157](https://github.com/uclouvain/openjpeg/issues/1157)
- LINUX install doesn't work when building shared libraries is disabled [\#1155](https://github.com/uclouvain/openjpeg/issues/1155)
- OPENJPEG null ptr dereference in openjpeg-2.3.0/src/bin/jp2/convert.c:2243 [\#1152](https://github.com/uclouvain/openjpeg/issues/1152)
- How to drop certain subbands/layers in DWT [\#1147](https://github.com/uclouvain/openjpeg/issues/1147)
- where is the MQ-Coder ouput stream in t2.c? [\#1146](https://github.com/uclouvain/openjpeg/issues/1146)
- OpenJPEG 2.3 \(and 2.2?\) multi component image fails to decode with KDU v7.10 [\#1132](https://github.com/uclouvain/openjpeg/issues/1132)
- Missing checks for header\_info.height and header\_info.width in function pnmtoimage in src/bin/jpwl/convert.c, which can lead to heap buffer overflow [\#1126](https://github.com/uclouvain/openjpeg/issues/1126)
- Assertion Failure in jp2.c [\#1125](https://github.com/uclouvain/openjpeg/issues/1125)
- Division-by-zero vulnerabilities in the function pi\_next\_pcrl, pi\_next\_cprl and pi\_next\_rpcl in src/lib/openjp3d/pi.c [\#1123](https://github.com/uclouvain/openjpeg/issues/1123)
- Precinct switch \(-c\) doesn't right-shift last record to remaining resolution levels [\#1117](https://github.com/uclouvain/openjpeg/issues/1117)
- Sample: encode J2K a data using streams??? [\#1114](https://github.com/uclouvain/openjpeg/issues/1114)
- HIGH THROUGHPUT JPEG 2000 \(HTJ2K\) [\#1112](https://github.com/uclouvain/openjpeg/issues/1112)
- How to build openjpeg for arm linux? [\#1108](https://github.com/uclouvain/openjpeg/issues/1108)
- crash [\#1106](https://github.com/uclouvain/openjpeg/issues/1106)
- JP2000 returning OPJ\_CLRSPC\_UNKNOWN color space [\#1103](https://github.com/uclouvain/openjpeg/issues/1103)
- Compilation successful but install unsuccessful: Calling executables throws libraries missing error [\#1102](https://github.com/uclouvain/openjpeg/issues/1102)
- fprintf format string requires 1 parameter but only 0 are given [\#1093](https://github.com/uclouvain/openjpeg/issues/1093)
- fprintf format string requires 1 parameter but only 0 are given [\#1092](https://github.com/uclouvain/openjpeg/issues/1092)
- sprintf buffer overflow [\#1088](https://github.com/uclouvain/openjpeg/issues/1088)
- sprintf buffer overflow [\#1085](https://github.com/uclouvain/openjpeg/issues/1085)
- Infinite loop when reading jp2 [\#1081](https://github.com/uclouvain/openjpeg/issues/1081)
- missing format string parameter [\#1074](https://github.com/uclouvain/openjpeg/issues/1074)
- Excessive Iteration in opj\_t1\_encode\_cblks \(src/lib/openjp2/t1.c\) [\#1059](https://github.com/uclouvain/openjpeg/issues/1059)
- Out-of-bound left shift in opj\_j2k\_setup\_encoder \(src/lib/openjp2/j2k.c\) [\#1057](https://github.com/uclouvain/openjpeg/issues/1057)
- Encode image on Unsplash [\#1054](https://github.com/uclouvain/openjpeg/issues/1054)
- Integer overflow in opj\_t1\_encode\_cblks \(src/lib/openjp2/t1.c\) [\#1053](https://github.com/uclouvain/openjpeg/issues/1053)
- Signed Integer Overflow - 68065512 [\#1048](https://github.com/uclouvain/openjpeg/issues/1048)
- Similar vulnerable functions related to CVE-2017-14041 [\#1044](https://github.com/uclouvain/openjpeg/issues/1044)
- \[ERROR\] COD marker already read. No more than one COD marker per tile. [\#1043](https://github.com/uclouvain/openjpeg/issues/1043)
- failing to install latest version of openjpeg from source [\#1041](https://github.com/uclouvain/openjpeg/issues/1041)
- Trouble compressing large raw image [\#1032](https://github.com/uclouvain/openjpeg/issues/1032)
- Download and installed code from 2.3 archive. Installing 2.2? [\#1030](https://github.com/uclouvain/openjpeg/issues/1030)
- missing fclose [\#1029](https://github.com/uclouvain/openjpeg/issues/1029)
- NULL Pointer Access in function imagetopnm of convert.c\(jp2\):1289 [\#860](https://github.com/uclouvain/openjpeg/issues/860)
- NULL Pointer Access in function imagetopnm of convert.c:2226\(jp2\) [\#859](https://github.com/uclouvain/openjpeg/issues/859)
- Heap Buffer Overflow in function imagetotga of convert.c\(jp2\):942 [\#858](https://github.com/uclouvain/openjpeg/issues/858)
**Merged pull requests:**
- abi-check.sh: fix broken download URL [\#1188](https://github.com/uclouvain/openjpeg/pull/1188) ([rouault](https://github.com/rouault))
- opj\_t1\_encode\_cblks: fix UBSAN signed integer overflow [\#1187](https://github.com/uclouvain/openjpeg/pull/1187) ([rouault](https://github.com/rouault))
- convertbmp: detect invalid file dimensions early \(CVE-2018-6616\) [\#1172](https://github.com/uclouvain/openjpeg/pull/1172) ([hlef](https://github.com/hlef))
- color\_apply\_icc\_profile: avoid potential heap buffer overflow [\#1170](https://github.com/uclouvain/openjpeg/pull/1170) ([rouault](https://github.com/rouault))
- Fix multiple potential vulnerabilities and bugs [\#1168](https://github.com/uclouvain/openjpeg/pull/1168) ([Young-X](https://github.com/Young-X))
- Fix several memory and resource leaks [\#1163](https://github.com/uclouvain/openjpeg/pull/1163) ([nforro](https://github.com/nforro))
- Fix some potential overflow issues [\#1161](https://github.com/uclouvain/openjpeg/pull/1161) ([stweil](https://github.com/stweil))
- jp3d/jpwl convert: fix write stack buffer overflow [\#1160](https://github.com/uclouvain/openjpeg/pull/1160) ([hlef](https://github.com/hlef))
- Int overflow fixed [\#1159](https://github.com/uclouvain/openjpeg/pull/1159) ([ichlubna](https://github.com/ichlubna))
- Update knownfailures- files given current configurations [\#1149](https://github.com/uclouvain/openjpeg/pull/1149) ([rouault](https://github.com/rouault))
- CVE-2018-5785: fix issues with zero bitmasks [\#1148](https://github.com/uclouvain/openjpeg/pull/1148) ([hlef](https://github.com/hlef))
- openjp2/jp2: Fix two format strings [\#1143](https://github.com/uclouvain/openjpeg/pull/1143) ([stweil](https://github.com/stweil))
- Changes in pnmtoimage if image data are missing [\#1141](https://github.com/uclouvain/openjpeg/pull/1141) ([szukw000](https://github.com/szukw000))
- Relative path to header files is hardcoded in OpenJPEGConfig.cmake.in file [\#1140](https://github.com/uclouvain/openjpeg/pull/1140) ([bukatlib](https://github.com/bukatlib))
- Cast on uint ceildiv [\#1136](https://github.com/uclouvain/openjpeg/pull/1136) ([reverson](https://github.com/reverson))
- Add -DBUILD\_PKGCONFIG\_FILES to install instructions [\#1133](https://github.com/uclouvain/openjpeg/pull/1133) ([robe2](https://github.com/robe2))
- Fix some typos in code comments and documentation [\#1128](https://github.com/uclouvain/openjpeg/pull/1128) ([stweil](https://github.com/stweil))
- Fix regression in reading files with TNsot == 0 \(refs \#1120\) [\#1121](https://github.com/uclouvain/openjpeg/pull/1121) ([rouault](https://github.com/rouault))
- Use local type declaration for POSIX standard type only for MS compiler [\#1119](https://github.com/uclouvain/openjpeg/pull/1119) ([stweil](https://github.com/stweil))
- Fix Mac builds [\#1104](https://github.com/uclouvain/openjpeg/pull/1104) ([rouault](https://github.com/rouault))
- jp3d: Replace sprintf\(\) by snprintf\(\) in volumetobin\(\) [\#1101](https://github.com/uclouvain/openjpeg/pull/1101) ([kbabioch](https://github.com/kbabioch))
- opj\_mj2\_extract: Rename output\_location to output\_prefix [\#1096](https://github.com/uclouvain/openjpeg/pull/1096) ([kbabioch](https://github.com/kbabioch))
- mj2: Add missing variable to format string in fprintf\(\) invocation in meta\_out.c [\#1094](https://github.com/uclouvain/openjpeg/pull/1094) ([kbabioch](https://github.com/kbabioch))
- Convert files to UTF-8 encoding [\#1090](https://github.com/uclouvain/openjpeg/pull/1090) ([stweil](https://github.com/stweil))
- fix unchecked integer multiplication overflow [\#1080](https://github.com/uclouvain/openjpeg/pull/1080) ([setharnold](https://github.com/setharnold))
- Fixed typos [\#1062](https://github.com/uclouvain/openjpeg/pull/1062) ([radarhere](https://github.com/radarhere))
- Note that seek uses SEEK\_SET behavior. [\#1055](https://github.com/uclouvain/openjpeg/pull/1055) ([ideasman42](https://github.com/ideasman42))
- Some Doxygen tags are removed [\#1050](https://github.com/uclouvain/openjpeg/pull/1050) ([szukw000](https://github.com/szukw000))
- Fix resource leak \(CID 179466\) [\#1047](https://github.com/uclouvain/openjpeg/pull/1047) ([stweil](https://github.com/stweil))
- Changed cmake version test to allow for cmake 2.8.11.x [\#1042](https://github.com/uclouvain/openjpeg/pull/1042) ([radarhere](https://github.com/radarhere))
- Add missing fclose\(\) statement in error condition. [\#1037](https://github.com/uclouvain/openjpeg/pull/1037) ([gfiumara](https://github.com/gfiumara))
## [v2.3.0](https://github.com/uclouvain/openjpeg/releases/v2.3.0) (2017-10-04)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.2.0...v2.3.0)
**Implemented enhancements:**
- Sub-tile decoding: only decode precincts and codeblocks that intersect the window specified in opj_set_decode_area() [\#990](https://github.com/uclouvain/openjpeg/pull/990) ([rouault](https://github.com/rouault))
- Sub-tile decoding: only apply IDWT on areas that participate to the window of interest [\#1001](https://github.com/uclouvain/openjpeg/pull/1001) ([rouault](https://github.com/rouault))
- Sub-tile decoding: memory use reduction and perf improvements [\#1010](https://github.com/uclouvain/openjpeg/pull/1010) ([rouault](https://github.com/rouault))
- Add capability to decode only a subset of all components of an image. [\#1022](https://github.com/uclouvain/openjpeg/pull/1022) ([rouault](https://github.com/rouault))
**Fixed bugs:**
- Setting x offset of decode region to -1 causes opj\_decompress to go into infinite loop [\#736](https://github.com/uclouvain/openjpeg/issues/736)
- Problem decoding multiple tiles with get\_decoded\_tile when cmap/pclr/cdef boxes are present in jp2 file [\#484](https://github.com/uclouvain/openjpeg/issues/484)
- set reduce\_factor\_may\_fail [\#474](https://github.com/uclouvain/openjpeg/issues/474)
- opj\_compress.exe, command line parser, infinite loop [\#469](https://github.com/uclouvain/openjpeg/issues/469)
- Various memory access issues found via fuzzing [\#448](https://github.com/uclouvain/openjpeg/issues/448)
- Multiple warnings when building OpenJPEG \(trunk\) [\#442](https://github.com/uclouvain/openjpeg/issues/442)
- Bulk fuzz-testing report [\#427](https://github.com/uclouvain/openjpeg/issues/427)
- remove all printf from openjpeg / use proper function pointer for logging [\#371](https://github.com/uclouvain/openjpeg/issues/371)
- minor changes, clean-up [\#349](https://github.com/uclouvain/openjpeg/issues/349)
- image-\>numcomps \> 4 [\#333](https://github.com/uclouvain/openjpeg/issues/333)
- Improve support for region of interest [\#39](https://github.com/uclouvain/openjpeg/issues/39)
- Public function to tell kernel type used \(5x3 vs 9x7\) [\#3](https://github.com/uclouvain/openjpeg/issues/3)
- elf binary in source package ? [\#1026](https://github.com/uclouvain/openjpeg/issues/1026)
- opj\_cio\_open [\#1025](https://github.com/uclouvain/openjpeg/issues/1025)
- Building with Visual Studio 2015 [\#1023](https://github.com/uclouvain/openjpeg/issues/1023)
- tcd.cpp\>:1617:33: error: assigning to 'OPJ\_INT32 \*' \(aka 'int \*'\) from incompatible type 'void \*' [\#1021](https://github.com/uclouvain/openjpeg/issues/1021)
- j2k.cpp \> comparison of address of 'p\_j2k-\>m\_cp.tcps\[0\].m\_data' not equal to a null pointer is always true [\#1020](https://github.com/uclouvain/openjpeg/issues/1020)
- Openjpeg 2.2.0 always build shared library even though -DBUILD\_SHARED\_LIBS:bool=off [\#1019](https://github.com/uclouvain/openjpeg/issues/1019)
- missing fclose [\#1018](https://github.com/uclouvain/openjpeg/issues/1018)
- Use opj\_image\_data\_free instead of opj\_free for image-\>comps\[\].data [\#1014](https://github.com/uclouvain/openjpeg/issues/1014)
- malloc poison on some compilers - cross compiling [\#1013](https://github.com/uclouvain/openjpeg/issues/1013)
- Add OPJ\_VERSION\_MAJOR, OPJ\_VERSION\_MINOR, OPJ\_VERSION\_MICRO macros in openjpeg.h [\#1011](https://github.com/uclouvain/openjpeg/issues/1011)
- Encode: do not perform rate control for single-tile lossless [\#1009](https://github.com/uclouvain/openjpeg/issues/1009)
- opj\_set\_decoded\_resolution\_factor\(\): bad interaction with opj\_set\_decode\_area\(\) and/or opj\_decode\(\) [\#1006](https://github.com/uclouvain/openjpeg/issues/1006)
- memory allocation failure with .pgx file [\#999](https://github.com/uclouvain/openjpeg/issues/999)
- Unable to fuzz with raw image as input [\#998](https://github.com/uclouvain/openjpeg/issues/998)
- stack-based buffer overflow write in pgxtoimage \(/convert.c\) [\#997](https://github.com/uclouvain/openjpeg/issues/997)
- freeze with a crafted bmp [\#996](https://github.com/uclouvain/openjpeg/issues/996)
- invalid memory write in tgatoimage \(convert.c\) [\#995](https://github.com/uclouvain/openjpeg/issues/995)
- static build on Windows fails [\#994](https://github.com/uclouvain/openjpeg/issues/994)
- another heap-based buffer overflow in opj\_t2\_encode\_packet \(t2.c\) [\#993](https://github.com/uclouvain/openjpeg/issues/993)
- heap-based buffer overflow in opj\_t2\_encode\_packet \(t2.c\) [\#992](https://github.com/uclouvain/openjpeg/issues/992)
- heap-based buffer overflow in opj\_write\_bytes\_LE \(cio.c\) \(unfixed \#985\) [\#991](https://github.com/uclouvain/openjpeg/issues/991)
- heap overflow in opj\_compress [\#988](https://github.com/uclouvain/openjpeg/issues/988)
- heap overflow in opj\_decompress [\#987](https://github.com/uclouvain/openjpeg/issues/987)
- heap-based buffer overflow in opj\_bio\_byteout \(bio.c\) [\#986](https://github.com/uclouvain/openjpeg/issues/986)
- heap-based buffer overflow in opj\_write\_bytes\_LE \(cio.c\) [\#985](https://github.com/uclouvain/openjpeg/issues/985)
- memory allocation failure in opj\_aligned\_alloc\_n \(opj\_malloc.c\) [\#983](https://github.com/uclouvain/openjpeg/issues/983)
- heap-base buffer overflow in opj\_mqc\_flush \(mqc.c\) [\#982](https://github.com/uclouvain/openjpeg/issues/982)
- Decode fails for JP2s with ICC profile [\#981](https://github.com/uclouvain/openjpeg/issues/981)
- Unit tests failing on Ubuntu 17.04 [\#916](https://github.com/uclouvain/openjpeg/issues/916)
- Encoder crashes on small images [\#901](https://github.com/uclouvain/openjpeg/issues/901)
- openjpeg-1.5.3 fails to compile [\#830](https://github.com/uclouvain/openjpeg/issues/830)
- opj\_compress crops image \(win\) or creates a jp2 which cannot be decompressed \(lin\) [\#716](https://github.com/uclouvain/openjpeg/issues/716)
- -d flag is silently ignored when decoding a single tile [\#693](https://github.com/uclouvain/openjpeg/issues/693)
- transition away from dev-utils [\#628](https://github.com/uclouvain/openjpeg/issues/628)
- update instructions to build with Visual Studio and 64-Bit Visual C++ Toolset. [\#1028](https://github.com/uclouvain/openjpeg/pull/1028) ([quangnh89](https://github.com/quangnh89))
- Add missing newline at end of file [\#1024](https://github.com/uclouvain/openjpeg/pull/1024) ([stweil](https://github.com/stweil))
- merge master into coverity\_scan to update coverity results [\#1008](https://github.com/uclouvain/openjpeg/pull/1008) ([detonin](https://github.com/detonin))
- Use more const qualifiers [\#984](https://github.com/uclouvain/openjpeg/pull/984) ([stweil](https://github.com/stweil))
- Changes in converttif.c for PPC64 [\#980](https://github.com/uclouvain/openjpeg/pull/980) ([szukw000](https://github.com/szukw000))
## [v2.2.0](https://github.com/uclouvain/openjpeg/releases/v2.2.0) (2017-08-10)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.1.2...v2.2.0)
**Implemented enhancements:**
- Memory consumption reduction at decoding side [\#968](https://github.com/uclouvain/openjpeg/pull/968) ([rouault](https://github.com/rouault))
- T1 & DWT multithreading decoding optimizations [\#786](https://github.com/uclouvain/openjpeg/pull/786) ([rouault](https://github.com/rouault))
- Tier1 decoder speed optimizations [\#783](https://github.com/uclouvain/openjpeg/pull/783) ([rouault](https://github.com/rouault))
- Inverse DWT 5x3: lift implementation / SSE accelerated version [\#953](https://github.com/uclouvain/openjpeg/issues/953)
- install static libraries [\#969](https://github.com/uclouvain/openjpeg/pull/969) ([jeroen](https://github.com/jeroen))
- IDWT 5x3 single-pass lifting and SSE2/AVX2 implementation [\#957](https://github.com/uclouvain/openjpeg/pull/957) ([rouault](https://github.com/rouault))
- build both shared and static library [\#954](https://github.com/uclouvain/openjpeg/pull/954) ([jeroen](https://github.com/jeroen))
- T1 flag optimizations \(\#172\) [\#945](https://github.com/uclouvain/openjpeg/pull/945) ([rouault](https://github.com/rouault))
- CMake: add stronger warnings for openjp2 lib/bin by default, and error out on declaration-after-statement [\#936](https://github.com/uclouvain/openjpeg/pull/936) ([rouault](https://github.com/rouault))
- Quiet mode for opj\_decompress via -quiet long parameter. [\#928](https://github.com/uclouvain/openjpeg/pull/928) ([RussellMcOrmond](https://github.com/RussellMcOrmond))
- Implement predictive termination check [\#800](https://github.com/uclouvain/openjpeg/pull/800) ([rouault](https://github.com/rouault))
**Fixed bugs:**
- Several issues spotted by Google OSS Fuzz - [see here](https://github.com/search?l=&q=OSS+Fuzz+author-date%3A2017-07-04..2017-08-01+repo%3Auclouvain%2Fopenjpeg&ref=advsearch&type=Commits&utf8=%E2%9C%93)
- Missing fclose [\#976](https://github.com/uclouvain/openjpeg/issues/976)
- Heap buffer overflow read in openjpeg imagetopnm [\#970](https://github.com/uclouvain/openjpeg/issues/970)
- opj\_decompress opj\_j2k\_update\_image\_data\(\) Segment falut [\#948](https://github.com/uclouvain/openjpeg/issues/948)
- Generic Crash in 1.5.0 [\#941](https://github.com/uclouvain/openjpeg/issues/941)
- Segmentation Faults [\#940](https://github.com/uclouvain/openjpeg/issues/940)
- Assertions thrown [\#939](https://github.com/uclouvain/openjpeg/issues/939)
- Floating Point Errors [\#938](https://github.com/uclouvain/openjpeg/issues/938)
- Division by zero crash [\#937](https://github.com/uclouvain/openjpeg/issues/937)
- malformed jp2 can cause heap-buffer-overflow [\#909](https://github.com/uclouvain/openjpeg/issues/909)
- NULL dereference can cause by malformed file [\#908](https://github.com/uclouvain/openjpeg/issues/908)
- Out of bound read in opj\_j2k\_add\_mct [\#907](https://github.com/uclouvain/openjpeg/issues/907)
- Check bpno\_plus\_one in opj\_t1\_decode\_cblk [\#903](https://github.com/uclouvain/openjpeg/issues/903)
- Undefined-shift in opj\_j2k\_read\_siz [\#902](https://github.com/uclouvain/openjpeg/issues/902)
- opj\_compress v2.1.2 can create images opj\_decompress cannot read [\#891](https://github.com/uclouvain/openjpeg/issues/891)
- Improper usage of opj\_int\_ceildiv can cause overflows [\#889](https://github.com/uclouvain/openjpeg/issues/889)
- Undefined shift in opj\_get\_all\_encoding\_parameters [\#885](https://github.com/uclouvain/openjpeg/issues/885)
- Denial of service \(crash\) due to use-after-free when decoding an illegal JPEG2000 image file v2.1.2 \(2017-04 [\#880](https://github.com/uclouvain/openjpeg/issues/880)
- Denial of service \(crash\) when decoding an illegal JPEG2000 image file v2.1.2 \(2017-03\) [\#879](https://github.com/uclouvain/openjpeg/issues/879)
- bug png 2 j2k [\#868](https://github.com/uclouvain/openjpeg/issues/868)
- Inconsistent compression using cinema settings on folder of non-compliant image [\#864](https://github.com/uclouvain/openjpeg/issues/864)
- Openjpeg-2.1.2 Heap Buffer Overflow Vulnerability due to Insufficient check [\#862](https://github.com/uclouvain/openjpeg/issues/862)
- Heap Buffer Overflow in function pnmtoimage of convert.c [\#861](https://github.com/uclouvain/openjpeg/issues/861)
- CVE-2016-9112 FPE\(Floating Point Exception\) in lib/openjp2/pi.c:523 [\#855](https://github.com/uclouvain/openjpeg/issues/855)
- CVE-2016-5139, CVE-2016-5152, CVE-2016-5158, CVE-2016-5159 [\#854](https://github.com/uclouvain/openjpeg/issues/854)
- Undefined Reference error [\#853](https://github.com/uclouvain/openjpeg/issues/853)
- opj\_compress with lossy compression results in strange pixel values [\#851](https://github.com/uclouvain/openjpeg/issues/851)
- CVE-2016-1626 and CVE-2016-1628 [\#850](https://github.com/uclouvain/openjpeg/issues/850)
- Out-of-Bounds Write in opj\_mqc\_byteout of mqc.c [\#835](https://github.com/uclouvain/openjpeg/issues/835)
- WARNING in tgt\_create tree-\>numnodes == 0, no tree created. [\#794](https://github.com/uclouvain/openjpeg/issues/794)
- Potential overflow when precision is larger than 32 [\#781](https://github.com/uclouvain/openjpeg/issues/781)
- division-by-zero in function opj\_pi\_next\_rpcl of pi.c \(line 366\) [\#780](https://github.com/uclouvain/openjpeg/issues/780)
- division-by-zero in function opj\_pi\_next\_rpcl of pi.c \(line 363\) [\#779](https://github.com/uclouvain/openjpeg/issues/779)
- division-by-zero in function opj\_pi\_next\_pcrl of pi.c \(line 447\) [\#778](https://github.com/uclouvain/openjpeg/issues/778)
- division-by-zero in function opj\_pi\_next\_pcrl of pi.c \(line 444\) [\#777](https://github.com/uclouvain/openjpeg/issues/777)
- Encoding the following file with 32x32 tiling produces jp2 image with artifact [\#737](https://github.com/uclouvain/openjpeg/issues/737)
- division-by-zero \(SIGFPE\) error in opj\_pi\_next\_cprl function \(line 526 of pi.c\) [\#732](https://github.com/uclouvain/openjpeg/issues/732)
- division-by-zero \(SIGFPE\) error in opj\_pi\_next\_cprl function \(line 523 of pi.c\) [\#731](https://github.com/uclouvain/openjpeg/issues/731)
- OpenJpeg 2.1 and 1.4 fails to decompress this file correctly [\#721](https://github.com/uclouvain/openjpeg/issues/721)
- MQ Encode :uninitialized memory access when first pass does not output any bytes [\#709](https://github.com/uclouvain/openjpeg/issues/709)
- Out-of-bounds read in opj\_j2k\_update\_image\_data and opj\_tgt\_reset function [\#704](https://github.com/uclouvain/openjpeg/issues/704)
- Remove opj\_aligned\_malloc / opj\_aligned\_realloc / opj\_aligned\_free? [\#689](https://github.com/uclouvain/openjpeg/issues/689)
- There is an issue with rendering some type of jpeg file. Please ref the link. [\#672](https://github.com/uclouvain/openjpeg/issues/672)
- Null Dereference in tcd\_malloc\_decode\_tile [\#657](https://github.com/uclouvain/openjpeg/issues/657)
- ETS-C1P0-p0\_12.j2k-compare2ref & NR-C1P0-p0\_12.j2k-compare2base failing under windows [\#655](https://github.com/uclouvain/openjpeg/issues/655)
- Memory leak [\#631](https://github.com/uclouvain/openjpeg/issues/631)
- Test 481 reports error in valgrind memcheck [\#612](https://github.com/uclouvain/openjpeg/issues/612)
- reserved identifier violation [\#587](https://github.com/uclouvain/openjpeg/issues/587)
- Buffer overflow when compressing some 16 bits images of the test suite [\#539](https://github.com/uclouvain/openjpeg/issues/539)
- Heap-buffer-overflow in opj\_dwt\_decode\_1 [\#480](https://github.com/uclouvain/openjpeg/issues/480)
- Automated fuzz testing [\#468](https://github.com/uclouvain/openjpeg/issues/468)
- Expected to find EPH marker [\#425](https://github.com/uclouvain/openjpeg/issues/425)
- read: segment too long \(6182\) with max \(35872\) for codeblock 0 \(p=19, b=2, r=5, c=1\) [\#284](https://github.com/uclouvain/openjpeg/issues/284)
- building 64bit version has lots of warnings [\#244](https://github.com/uclouvain/openjpeg/issues/244)
- Wrong encoding of small tiles with high level number [\#239](https://github.com/uclouvain/openjpeg/issues/239)
- Errors raised in pi.c by VS11 analyzer [\#190](https://github.com/uclouvain/openjpeg/issues/190)
- Undocumented optimization found in v2 branch of openjpeg [\#183](https://github.com/uclouvain/openjpeg/issues/183)
- T1 optimisations jpeg2000 [\#172](https://github.com/uclouvain/openjpeg/issues/172)
- Remove OPJ\_NOSANITIZE in opj\_bio\_read\(\) and opj\_bio\_write\(\) \(\#761\) [\#955](https://github.com/uclouvain/openjpeg/pull/955) ([rouault](https://github.com/rouault))
- Fix bypass pterm termall and lossless decomposition issue \(\#891, \#892\) [\#949](https://github.com/uclouvain/openjpeg/pull/949) ([rouault](https://github.com/rouault))
- Escape quotes to ensure README renders on GitHub correctly [\#914](https://github.com/uclouvain/openjpeg/pull/914) ([alexwlchan](https://github.com/alexwlchan))
- Remove spurious .R macros from manpages [\#899](https://github.com/uclouvain/openjpeg/pull/899) ([jwilk](https://github.com/jwilk))
- Remove warnings related to empty tag-trees. [\#893](https://github.com/uclouvain/openjpeg/pull/893) ([rouault](https://github.com/rouault))
**Maintenance-related tasks:**
- Submit OpenJPEG to oss-fuzz [\#965](https://github.com/uclouvain/openjpeg/issues/965)
- Updates for Doxygen to suppress warnings [\#849](https://github.com/uclouvain/openjpeg/issues/849)
- Remove useless knownfailures \(since LAZY encoding is fixed\) [\#964](https://github.com/uclouvain/openjpeg/pull/964) ([rouault](https://github.com/rouault))
- Enable AVX2 at runtime on Travis-CI and AppVeyor [\#963](https://github.com/uclouvain/openjpeg/pull/963) ([rouault](https://github.com/rouault))
- Tests: test opj\_compress in VSC mode \(related to \#172\) [\#935](https://github.com/uclouvain/openjpeg/pull/935) ([rouault](https://github.com/rouault))
- Reformat: apply reformattin on .h files \(\#128\) [\#926](https://github.com/uclouvain/openjpeg/pull/926) ([rouault](https://github.com/rouault))
- Add mechanisms to reformat and check code style, and reformat whole codebase \(\#128\) [\#919](https://github.com/uclouvain/openjpeg/pull/919) ([rouault](https://github.com/rouault))
- Add profiling of CPU and memory usage \(\#912\) [\#918](https://github.com/uclouvain/openjpeg/pull/918) ([rouault](https://github.com/rouault))
- Add performance benchmarking scripts [\#917](https://github.com/uclouvain/openjpeg/pull/917) ([rouault](https://github.com/rouault))
- Fix retrieval of jpylyzer in AppVeyor [\#915](https://github.com/uclouvain/openjpeg/pull/915) ([rouault](https://github.com/rouault))
## [v2.1.2](https://github.com/uclouvain/openjpeg/releases/v2.1.2) (2016-09-28)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.1.1...v2.1.2)
**Closed issues:**
- null ptr dereference in convert.c:1331 [\#843](https://github.com/uclouvain/openjpeg/issues/843)
- Out-of-Bounds Read in function bmp24toimage of convertbmp.c [\#833](https://github.com/uclouvain/openjpeg/issues/833)
- Disable automatic compilation of t1\_generate\_luts in CMakeLists.txt [\#831](https://github.com/uclouvain/openjpeg/issues/831)
- CVE-2016-7163 Integer overflow in opj\_pi\_create\_decode [\#826](https://github.com/uclouvain/openjpeg/issues/826)
- Security Advisory for OpenJPEG [\#810](https://github.com/uclouvain/openjpeg/issues/810)
- Add dashboard with static lib [\#804](https://github.com/uclouvain/openjpeg/issues/804)
- hidden visibility for the static library / building with -DOPJ\_STATIC against shared lib [\#802](https://github.com/uclouvain/openjpeg/issues/802)
- Optimization when building library from source [\#799](https://github.com/uclouvain/openjpeg/issues/799)
- unsigned int16 on Solaris 11.2/sparc [\#796](https://github.com/uclouvain/openjpeg/issues/796)
- appveyor [\#793](https://github.com/uclouvain/openjpeg/issues/793)
- FFMpeg will not link to 2.1.1 release built as shared library [\#766](https://github.com/uclouvain/openjpeg/issues/766)
- API change since v2: opj\_event\_mgr\_t not available [\#754](https://github.com/uclouvain/openjpeg/issues/754)
- openjpeg.h needs dependencies [\#673](https://github.com/uclouvain/openjpeg/issues/673)
- "master" does not build on ubuntu [\#658](https://github.com/uclouvain/openjpeg/issues/658)
- Package 'openjp2', required by 'libopenjpip', not found [\#594](https://github.com/uclouvain/openjpeg/issues/594)
**Merged pull requests:**
- Fix PNM file reading [\#847](https://github.com/uclouvain/openjpeg/pull/847) ([mayeut](https://github.com/mayeut))
- Fix some issues reported by Coverity Scan [\#846](https://github.com/uclouvain/openjpeg/pull/846) ([stweil](https://github.com/stweil))
- Fix potential out-of-bounds read \(coverity\) [\#844](https://github.com/uclouvain/openjpeg/pull/844) ([stweil](https://github.com/stweil))
- Remove TODO for overflow check [\#842](https://github.com/uclouvain/openjpeg/pull/842) ([mayeut](https://github.com/mayeut))
- Add overflow checks for opj\_aligned\_malloc [\#841](https://github.com/uclouvain/openjpeg/pull/841) ([mayeut](https://github.com/mayeut))
- Flags in T1 shall be unsigned [\#840](https://github.com/uclouvain/openjpeg/pull/840) ([mayeut](https://github.com/mayeut))
- Fix some warnings [\#838](https://github.com/uclouvain/openjpeg/pull/838) ([mayeut](https://github.com/mayeut))
- Fix issue 833. [\#834](https://github.com/uclouvain/openjpeg/pull/834) ([trylab](https://github.com/trylab))
- Add overflow checks for opj\_aligned\_malloc [\#832](https://github.com/uclouvain/openjpeg/pull/832) ([mayeut](https://github.com/mayeut))
- Add test for issue 820 [\#829](https://github.com/uclouvain/openjpeg/pull/829) ([mayeut](https://github.com/mayeut))
- Add test for issue 826 [\#827](https://github.com/uclouvain/openjpeg/pull/827) ([mayeut](https://github.com/mayeut))
- Fix coverity 113065 \(CWE-484\) [\#824](https://github.com/uclouvain/openjpeg/pull/824) ([mayeut](https://github.com/mayeut))
- Add sanity check for tile coordinates [\#823](https://github.com/uclouvain/openjpeg/pull/823) ([mayeut](https://github.com/mayeut))
- Add test for PR 818 [\#822](https://github.com/uclouvain/openjpeg/pull/822) ([mayeut](https://github.com/mayeut))
- Update to libpng 1.6.25 [\#821](https://github.com/uclouvain/openjpeg/pull/821) ([mayeut](https://github.com/mayeut))
- CVE-2016-8332: fix incrementing of "l\_tcp-\>m\_nb\_mcc\_records" in opj\_j2k\_read\_mcc [\#820](https://github.com/uclouvain/openjpeg/pull/820) ([mayeut](https://github.com/mayeut))
- Add overflow check in opj\_tcd\_init\_tile [\#819](https://github.com/uclouvain/openjpeg/pull/819) ([mayeut](https://github.com/mayeut))
- Fix leak & invalid behavior of opj\_jp2\_read\_ihdr [\#818](https://github.com/uclouvain/openjpeg/pull/818) ([mayeut](https://github.com/mayeut))
- Add overflow check in opj\_j2k\_update\_image\_data [\#817](https://github.com/uclouvain/openjpeg/pull/817) ([mayeut](https://github.com/mayeut))
- Change 'restrict' define to 'OPJ\_RESTRICT' [\#816](https://github.com/uclouvain/openjpeg/pull/816) ([mayeut](https://github.com/mayeut))
- Switch to clang 3.8 [\#814](https://github.com/uclouvain/openjpeg/pull/814) ([mayeut](https://github.com/mayeut))
- Fix an integer overflow issue [\#809](https://github.com/uclouvain/openjpeg/pull/809) ([trylab](https://github.com/trylab))
- Update to lcms 2.8 [\#808](https://github.com/uclouvain/openjpeg/pull/808) ([mayeut](https://github.com/mayeut))
- Update to libpng 1.6.24 [\#807](https://github.com/uclouvain/openjpeg/pull/807) ([mayeut](https://github.com/mayeut))
- Reenable clang-3.9 build on travis [\#806](https://github.com/uclouvain/openjpeg/pull/806) ([mayeut](https://github.com/mayeut))
- Bit fields type [\#805](https://github.com/uclouvain/openjpeg/pull/805) ([smuehlst](https://github.com/smuehlst))
- Add compilation test for standalone inclusion of openjpeg.h [\#798](https://github.com/uclouvain/openjpeg/pull/798) ([mayeut](https://github.com/mayeut))
- jpwl: Remove non-portable data type u\_int16\_t \(fix issue \#796\) [\#797](https://github.com/uclouvain/openjpeg/pull/797) ([stweil](https://github.com/stweil))
- Fix dependency for pkg-config \(issue \#594\) [\#795](https://github.com/uclouvain/openjpeg/pull/795) ([stweil](https://github.com/stweil))
- Add .gitignore [\#787](https://github.com/uclouvain/openjpeg/pull/787) ([stweil](https://github.com/stweil))
## [v2.1.1](https://github.com/uclouvain/openjpeg/releases/tag/v2.1.1) (2016-07-05)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.1...v2.1.1)
**Implemented enhancements:**
- opj\_malloc replacement [\#625](https://github.com/uclouvain/openjpeg/issues/625)
- backport "-p" and "-force-rgb" options in 1.5 [\#606](https://github.com/uclouvain/openjpeg/issues/606)
- Use travis-ci matrix build [\#581](https://github.com/uclouvain/openjpeg/issues/581)
- Add Coverity Scan analysis [\#580](https://github.com/uclouvain/openjpeg/issues/580)
- Unnecessary rate distortion calculations [\#479](https://github.com/uclouvain/openjpeg/issues/479)
- Add images from various security issues to test suite [\#415](https://github.com/uclouvain/openjpeg/issues/415)
- Coding speed for 9/7 on 32bits platforms \(x86/ARM\) can be improved with a quick fix [\#220](https://github.com/uclouvain/openjpeg/issues/220)
**Fixed bugs:**
- Out-of-Bounds Access in function opj\_tgt\_reset of tgt.c [\#775](https://github.com/uclouvain/openjpeg/issues/775)
- Heap Buffer Overflow in function color\_cmyk\_to\_rgb of color.c [\#774](https://github.com/uclouvain/openjpeg/issues/774)
- division-by-zero \(SIGFPE\) error in opj\_tcd\_init\_tile function \(line 730 of tcd.c\) [\#733](https://github.com/uclouvain/openjpeg/issues/733)
- Out-Of-Bounds Read in sycc422\_to\_rgb function [\#726](https://github.com/uclouvain/openjpeg/issues/726)
- Heap Corruption in opj\_free function [\#725](https://github.com/uclouvain/openjpeg/issues/725)
- Out-Of-Bounds Read in opj\_tcd\_free\_tile function [\#724](https://github.com/uclouvain/openjpeg/issues/724)
- Cannot handle box of undefined size [\#653](https://github.com/uclouvain/openjpeg/issues/653)
- Compilation fails without platform-supplied aligned malloc [\#642](https://github.com/uclouvain/openjpeg/issues/642)
- HP compiler warns about redeclaration of static function [\#640](https://github.com/uclouvain/openjpeg/issues/640)
- Implementation-defined behavior of malloc causes different behavior on Linux and AIX [\#635](https://github.com/uclouvain/openjpeg/issues/635)
- Build on AIX fails because "opj\_includes.h" is included after system headers [\#633](https://github.com/uclouvain/openjpeg/issues/633)
- Compiling with SSE2 on Linux 32-bit causes crashes in OpenJPEG [\#624](https://github.com/uclouvain/openjpeg/issues/624)
- Build on AIX fails because of "restrict" pointers [\#620](https://github.com/uclouvain/openjpeg/issues/620)
- bug in new tif conversion code [\#609](https://github.com/uclouvain/openjpeg/issues/609)
- bin/jp2/convert.c line 1085 Resource leak [\#607](https://github.com/uclouvain/openjpeg/issues/607)
- bin/jp2/convert.c memory leak [\#601](https://github.com/uclouvain/openjpeg/issues/601)
- Resource leak in opj\_j2k\_create\_cstr\_index in case of failure [\#599](https://github.com/uclouvain/openjpeg/issues/599)
- Resource leak in opj\_j2k\_encode in case of failure [\#598](https://github.com/uclouvain/openjpeg/issues/598)
- Resource leak in opj\_j2k\_decode\_one\_tile in case of failure [\#597](https://github.com/uclouvain/openjpeg/issues/597)
- Resource Leak [\#573](https://github.com/uclouvain/openjpeg/issues/573)
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) [\#571](https://github.com/uclouvain/openjpeg/issues/571)
- Use-after-free in opj\_j2k\_write\_mco [\#563](https://github.com/uclouvain/openjpeg/issues/563)
- openjpeg-master-2015-07-30 failed to compile on LINUX [\#556](https://github.com/uclouvain/openjpeg/issues/556)
- PNG images are always read as RGB\(A\) images [\#536](https://github.com/uclouvain/openjpeg/issues/536)
- g4\_colr.j2c not handled properly [\#532](https://github.com/uclouvain/openjpeg/issues/532)
- Bigendian: opj\_compress + opj\_decompress fails [\#518](https://github.com/uclouvain/openjpeg/issues/518)
- Suspicious code in j2k.c [\#517](https://github.com/uclouvain/openjpeg/issues/517)
- Decode times almost double\(!!\) on Visual Studio 2013, 2015 [\#505](https://github.com/uclouvain/openjpeg/issues/505)
- opj\_data/input/nonregression/issue226.j2k [\#500](https://github.com/uclouvain/openjpeg/issues/500)
- opj\_setup\_encoder always returns true [\#497](https://github.com/uclouvain/openjpeg/issues/497)
- Double free in j2k\_read\_ppm\_v3 parsing \(\(presumably invalid\) image. [\#496](https://github.com/uclouvain/openjpeg/issues/496)
- Invalid write in opj\_j2k\_update\_image\_data [\#495](https://github.com/uclouvain/openjpeg/issues/495)
- Undefined printf format specifier %ud used in code [\#494](https://github.com/uclouvain/openjpeg/issues/494)
- Potential double free on malloc failure in opj\_j2k\_copy\_default\_tcp\_and\_create\_tcp\(\) [\#492](https://github.com/uclouvain/openjpeg/issues/492)
- Do not link with -ffast-math [\#488](https://github.com/uclouvain/openjpeg/issues/488)
- Heap-buffer-overflow in opj\_dwt\_decode [\#486](https://github.com/uclouvain/openjpeg/issues/486)
- opj\_dump fails on Windows 7, 64 bits [\#482](https://github.com/uclouvain/openjpeg/issues/482)
- SIGSEGV in opj\_j2k\_update\_image\_data via pdfium\_test [\#481](https://github.com/uclouvain/openjpeg/issues/481)
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#477](https://github.com/uclouvain/openjpeg/issues/477)
- Invalid image causes write past end of heap buffer [\#476](https://github.com/uclouvain/openjpeg/issues/476)
- Assertion `l\_res-\>x0 \>= 0' fails when parsing invalid images [\#475](https://github.com/uclouvain/openjpeg/issues/475)
- Bug on opj\_write\_bytes\_BE function [\#472](https://github.com/uclouvain/openjpeg/issues/472)
- Refactor j2k\_read\_ppm\_v3 function [\#470](https://github.com/uclouvain/openjpeg/issues/470)
- compression: strange precinct dimensions [\#466](https://github.com/uclouvain/openjpeg/issues/466)
- \(:- Console message in opj\_decompress -:\) [\#465](https://github.com/uclouvain/openjpeg/issues/465)
- opj\_decompress fails to decompress any files [\#463](https://github.com/uclouvain/openjpeg/issues/463)
- bio-\>ct is unnecessarily set to zero in opj\_bio\_flush method [\#461](https://github.com/uclouvain/openjpeg/issues/461)
- Maximal unsigned short is 65535, not 65536 [\#460](https://github.com/uclouvain/openjpeg/issues/460)
- OpenJpeg fails to encode components with different precision properly [\#459](https://github.com/uclouvain/openjpeg/issues/459)
- component precision upscaling isn't correct in opj\_decompress [\#458](https://github.com/uclouvain/openjpeg/issues/458)
- Multiple precision components won't get encoded to jp2 if 1 component is unsigned 1 bit [\#457](https://github.com/uclouvain/openjpeg/issues/457)
- Incorrect code in ../bin/jp2/convert.c, function rawtoimage\_common\(...\) [\#456](https://github.com/uclouvain/openjpeg/issues/456)
- \[OpenJPEG-trunk\] opj\_stream\_get\_number\_byte\_left throws assert [\#455](https://github.com/uclouvain/openjpeg/issues/455)
- NR-DEC-kodak\_2layers\_lrcp.j2c-31-decode-md5 fails randomly when running tests in parallel [\#454](https://github.com/uclouvain/openjpeg/issues/454)
- compare\_raw\_files doesn't report an error on invalid arguments / missing input files [\#453](https://github.com/uclouvain/openjpeg/issues/453)
- Forward discrete wavelet transform: implement periodic symmetric extension at boundaries [\#452](https://github.com/uclouvain/openjpeg/issues/452)
- Bug in tiff reading method in convert.c [\#449](https://github.com/uclouvain/openjpeg/issues/449)
- Image in pdf don't display [\#447](https://github.com/uclouvain/openjpeg/issues/447)
- Multiple issues causing opj\_decompress to segfault [\#446](https://github.com/uclouvain/openjpeg/issues/446)
- opj\_compress: 40% of encode time is spent freeing data [\#445](https://github.com/uclouvain/openjpeg/issues/445)
- Multiple warnings when configuring OpenJPEG on MacOS with CMake 3.x \(trunk\) [\#443](https://github.com/uclouvain/openjpeg/issues/443)
- valgrind memleak found [\#437](https://github.com/uclouvain/openjpeg/issues/437)
- global-buffer-overflow src/lib/openjp2/t1.c:1146 opj\_t1\_getwmsedec [\#436](https://github.com/uclouvain/openjpeg/issues/436)
- Warning introduced on trunk r2923 & r2924 [\#435](https://github.com/uclouvain/openjpeg/issues/435)
- heap-buffer-overflow in opj\_t1\_decode\_cblks [\#432](https://github.com/uclouvain/openjpeg/issues/432)
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#431](https://github.com/uclouvain/openjpeg/issues/431)
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#430](https://github.com/uclouvain/openjpeg/issues/430)
- Heap-buffer-overflow in opj\_jp2\_apply\_pclr [\#429](https://github.com/uclouvain/openjpeg/issues/429)
- issue412 revisited [\#428](https://github.com/uclouvain/openjpeg/issues/428)
- Image distorted \(sides look cankered\) [\#423](https://github.com/uclouvain/openjpeg/issues/423)
- openjpeg-2.x-trunk-r2918 is broken in color.c [\#422](https://github.com/uclouvain/openjpeg/issues/422)
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#420](https://github.com/uclouvain/openjpeg/issues/420)
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#418](https://github.com/uclouvain/openjpeg/issues/418)
- UNKNOWN in opj\_read\_bytes\_LE [\#417](https://github.com/uclouvain/openjpeg/issues/417)
- Transparency problem [\#416](https://github.com/uclouvain/openjpeg/issues/416)
- Image with per channel alpha \(cdef\) does not decode properly [\#414](https://github.com/uclouvain/openjpeg/issues/414)
- OpenJPEG crashes with attached image [\#413](https://github.com/uclouvain/openjpeg/issues/413)
- Palette image with cdef fails to decompress [\#412](https://github.com/uclouvain/openjpeg/issues/412)
- Invalid member values from opj\_read\_header or opj\_decode ? [\#411](https://github.com/uclouvain/openjpeg/issues/411)
- MD5 Checksum hangs under valgrind on MacOS X [\#410](https://github.com/uclouvain/openjpeg/issues/410)
- Heap-buffer-overflow in opj\_tcd\_get\_decoded\_tile\_size [\#408](https://github.com/uclouvain/openjpeg/issues/408)
- C++ style comments in trunk/src/lib/openjp2/j2k.c [\#407](https://github.com/uclouvain/openjpeg/issues/407)
- Backport bugfixes from trunk to 2.1 branch [\#405](https://github.com/uclouvain/openjpeg/issues/405)
- Heap-buffer-overflow in parse\_cmdline\_encoder [\#403](https://github.com/uclouvain/openjpeg/issues/403)
- Heap-buffer-overflow in opj\_v4dwt\_interleave\_h [\#400](https://github.com/uclouvain/openjpeg/issues/400)
- Heap-buffer-overflow in opj\_dwt\_decode [\#399](https://github.com/uclouvain/openjpeg/issues/399)
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#398](https://github.com/uclouvain/openjpeg/issues/398)
- Heap-buffer-overflow in opj\_jp2\_apply\_cdef [\#397](https://github.com/uclouvain/openjpeg/issues/397)
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#396](https://github.com/uclouvain/openjpeg/issues/396)
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#395](https://github.com/uclouvain/openjpeg/issues/395)
- Heap-buffer-overflow in opj\_dwt\_decode\_1 [\#394](https://github.com/uclouvain/openjpeg/issues/394)
- Heap-double-free in j2k\_read\_ppm\_v3 [\#393](https://github.com/uclouvain/openjpeg/issues/393)
- Security hole in j2k.c [\#392](https://github.com/uclouvain/openjpeg/issues/392)
- Security: double-free in opj\_tcd\_code\_block\_dec\_deallocate [\#391](https://github.com/uclouvain/openjpeg/issues/391)
- check for negative-size params in code [\#390](https://github.com/uclouvain/openjpeg/issues/390)
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#389](https://github.com/uclouvain/openjpeg/issues/389)
- Heap overflow in OpenJpeg 1.5.2 [\#388](https://github.com/uclouvain/openjpeg/issues/388)
- openjpip.so.6 file too short [\#387](https://github.com/uclouvain/openjpeg/issues/387)
- Corrupted JP3D file [\#386](https://github.com/uclouvain/openjpeg/issues/386)
- variable assigned to itself [\#383](https://github.com/uclouvain/openjpeg/issues/383)
- Null pointer dereferencing [\#382](https://github.com/uclouvain/openjpeg/issues/382)
- bad use of case statement [\#381](https://github.com/uclouvain/openjpeg/issues/381)
- Release 2.1 as a Ubuntu package [\#380](https://github.com/uclouvain/openjpeg/issues/380)
- Bug in libopenjpwl.pc [\#374](https://github.com/uclouvain/openjpeg/issues/374)
- inconsistent tile numbering in decode output message [\#370](https://github.com/uclouvain/openjpeg/issues/370)
- error in code block calculations [\#369](https://github.com/uclouvain/openjpeg/issues/369)
- r2872 fails to compile due to "attempt to use poisoned malloc" error in j2k.c [\#368](https://github.com/uclouvain/openjpeg/issues/368)
- OSX build gives libopenjp2.6.dylib with not-absolute install name id [\#367](https://github.com/uclouvain/openjpeg/issues/367)
- opj\_decompress gives error but successfully decompress in OPJ 2.1 [\#366](https://github.com/uclouvain/openjpeg/issues/366)
- pngtoimage\(\) and imagetopng\(\) have wrong byte order for 16-Bit image [\#365](https://github.com/uclouvain/openjpeg/issues/365)
- PDF crash in chrome - part2 \(due to attachment limit\) [\#364](https://github.com/uclouvain/openjpeg/issues/364)
- PDF crash in chrome - part1 [\#363](https://github.com/uclouvain/openjpeg/issues/363)
- PDF crash in chrome - part0 [\#362](https://github.com/uclouvain/openjpeg/issues/362)
- Compilation fails on Windows with mingw32 gcc4.8 [\#361](https://github.com/uclouvain/openjpeg/issues/361)
- security issue [\#360](https://github.com/uclouvain/openjpeg/issues/360)
- improve memory management [\#359](https://github.com/uclouvain/openjpeg/issues/359)
- how to compress a yuv420 raw data using opj\_compress [\#357](https://github.com/uclouvain/openjpeg/issues/357)
- Some memory allocation are not checked [\#355](https://github.com/uclouvain/openjpeg/issues/355)
- Static library symbols shall be marked as hidden [\#354](https://github.com/uclouvain/openjpeg/issues/354)
- opj\_compress rejects valid bmp files [\#353](https://github.com/uclouvain/openjpeg/issues/353)
- opj\_compress crashes when number of resolutions is set to zero [\#352](https://github.com/uclouvain/openjpeg/issues/352)
- Compilation error under Visual Studio 2003 [\#351](https://github.com/uclouvain/openjpeg/issues/351)
- opj\_compress description example error \[Low priority\] [\#350](https://github.com/uclouvain/openjpeg/issues/350)
- opj\_write\_bytes\_BE is wrong in trunk [\#345](https://github.com/uclouvain/openjpeg/issues/345)
- PART1ONLY option in release.sh doesn't work properly [\#332](https://github.com/uclouvain/openjpeg/issues/332)
- openjpeg crash error [\#330](https://github.com/uclouvain/openjpeg/issues/330)
- openjpeg decompress error [\#329](https://github.com/uclouvain/openjpeg/issues/329)
- openjpeg decompress issue [\#326](https://github.com/uclouvain/openjpeg/issues/326)
- limited tif support [\#322](https://github.com/uclouvain/openjpeg/issues/322)
- asoc value of 65536 is allowed [\#321](https://github.com/uclouvain/openjpeg/issues/321)
- opj\_skip\_from\_file error [\#314](https://github.com/uclouvain/openjpeg/issues/314)
- Heavy quota usage in openjpeg [\#309](https://github.com/uclouvain/openjpeg/issues/309)
- Verify -help actually match letter [\#307](https://github.com/uclouvain/openjpeg/issues/307)
- g3\_colr.j2c not handled [\#288](https://github.com/uclouvain/openjpeg/issues/288)
- reopen/fix issue 165 [\#280](https://github.com/uclouvain/openjpeg/issues/280)
- kakadu conformance tests [\#279](https://github.com/uclouvain/openjpeg/issues/279)
- missing break after case statement in opj\_dwt\_decode\_real [\#274](https://github.com/uclouvain/openjpeg/issues/274)
- Run Coverity on trunk [\#270](https://github.com/uclouvain/openjpeg/issues/270)
- NR-ENC-random-issue-0005.tif-12-encode [\#259](https://github.com/uclouvain/openjpeg/issues/259)
- Use new add\_test signature to handle cross compilation [\#258](https://github.com/uclouvain/openjpeg/issues/258)
- Loss decoding quality in 2.0.0 [\#254](https://github.com/uclouvain/openjpeg/issues/254)
- Decompress that worked in 1.5.1 fails in 2.0 [\#252](https://github.com/uclouvain/openjpeg/issues/252)
- Expected endianness with raw input is not documented leading to SEGFAULT [\#251](https://github.com/uclouvain/openjpeg/issues/251)
- OpenJPEG writes to stderr [\#246](https://github.com/uclouvain/openjpeg/issues/246)
- Inconsistent logging of tile index [\#245](https://github.com/uclouvain/openjpeg/issues/245)
- patch for openjpeg-trunk-r2347 and BIG\_ENDIAN [\#242](https://github.com/uclouvain/openjpeg/issues/242)
- CMAP: MTYP == 0 \(direct use\) not handled properly [\#235](https://github.com/uclouvain/openjpeg/issues/235)
- Black Pixel [\#233](https://github.com/uclouvain/openjpeg/issues/233)
- opj\_compress runtime error after fresh Linux install due to apparent failure to execute ldconfig [\#219](https://github.com/uclouvain/openjpeg/issues/219)
- openjp2 debug works, release build does not [\#217](https://github.com/uclouvain/openjpeg/issues/217)
- openjpeg-branch15-r2299 and openjpeg-trunk-r2299 fail to decode a JP2 file [\#212](https://github.com/uclouvain/openjpeg/issues/212)
- openjpeg-trunk issue with Win7 [\#201](https://github.com/uclouvain/openjpeg/issues/201)
- undefined reference to `opj\_version' [\#200](https://github.com/uclouvain/openjpeg/issues/200)
- In tgt.c we used fprintf not the openjpeg message reporter [\#184](https://github.com/uclouvain/openjpeg/issues/184)
- Windows binaries not working under WinXP [\#176](https://github.com/uclouvain/openjpeg/issues/176)
- add ability to use intel ipp \(performance primitive\) within OpenJPEG [\#164](https://github.com/uclouvain/openjpeg/issues/164)
- Migration guide v2 [\#160](https://github.com/uclouvain/openjpeg/issues/160)
- Cannot decompress JPEG2000Aware3.18.7.3Win32\_kdutranscode6.3.1.j2k [\#158](https://github.com/uclouvain/openjpeg/issues/158)
- Cannot decompress JPEG2000Aware3.18.7.3Win32.j2k [\#157](https://github.com/uclouvain/openjpeg/issues/157)
- openjpeg@googlegroups.com has disappeared [\#153](https://github.com/uclouvain/openjpeg/issues/153)
- OpenJPEG 1.5.0 crashes on a ridiculously big file... [\#151](https://github.com/uclouvain/openjpeg/issues/151)
- opj\_image vs free [\#146](https://github.com/uclouvain/openjpeg/issues/146)
- Windows .dll file invalid [\#140](https://github.com/uclouvain/openjpeg/issues/140)
- Problem with second layer of a 2 layer coded LRCP \(with precincts\) [\#135](https://github.com/uclouvain/openjpeg/issues/135)
- version 1.4 crashes when opening PDF file with JPEG2000 images [\#133](https://github.com/uclouvain/openjpeg/issues/133)
- Setup a win64 dashboard [\#132](https://github.com/uclouvain/openjpeg/issues/132)
- J2KP4files/codestreams\_profile0/p0\_13.j2k question jpeg2000 [\#131](https://github.com/uclouvain/openjpeg/issues/131)
- Out of memory: Kill process 11204 \(opj\_server\) score 917 or sacrifice child [\#123](https://github.com/uclouvain/openjpeg/issues/123)
- FILE\* in opj API is unsafe [\#120](https://github.com/uclouvain/openjpeg/issues/120)
- third-party lib order [\#119](https://github.com/uclouvain/openjpeg/issues/119)
- openjpeg-1.5.0-Darwin-powerpc.dmg is huge ! [\#113](https://github.com/uclouvain/openjpeg/issues/113)
- misleading info in JP2 box lead to wrong number of components [\#110](https://github.com/uclouvain/openjpeg/issues/110)
- Image\_to\_j2k says that j2k files is generated but no file is on the HDD [\#109](https://github.com/uclouvain/openjpeg/issues/109)
- Error in openjpegV1.4 on compiling image\_to\_j2k: crash on reading bmp file [\#108](https://github.com/uclouvain/openjpeg/issues/108)
- Update to abi-compliance-checker 1.96 [\#106](https://github.com/uclouvain/openjpeg/issues/106)
- Decode error on the attached JPEG...works in KDU and with JASPER...please help! [\#101](https://github.com/uclouvain/openjpeg/issues/101)
- Mac binaries v1.4 is broken [\#95](https://github.com/uclouvain/openjpeg/issues/95)
- jp2\_read\_boxhdr\(\) has size bug in version 1 [\#92](https://github.com/uclouvain/openjpeg/issues/92)
- Support for Java JAI Imageio [\#90](https://github.com/uclouvain/openjpeg/issues/90)
- encoding test failing [\#86](https://github.com/uclouvain/openjpeg/issues/86)
- source archive on demand [\#85](https://github.com/uclouvain/openjpeg/issues/85)
- CMakeLists.txt and Makefile.am for JPIP are buggy [\#84](https://github.com/uclouvain/openjpeg/issues/84)
- pclr-cmap-cdef [\#82](https://github.com/uclouvain/openjpeg/issues/82)
- Error when compiling openjpeg\_v1\_4\_sources\_r697 [\#79](https://github.com/uclouvain/openjpeg/issues/79)
- J2K codec issue on Windows Mobile [\#77](https://github.com/uclouvain/openjpeg/issues/77)
- image\_to\_j2k.exe crashes on large .bmp file [\#75](https://github.com/uclouvain/openjpeg/issues/75)
- fatal error C1900 building the project on windows [\#65](https://github.com/uclouvain/openjpeg/issues/65)
- same option but different size [\#54](https://github.com/uclouvain/openjpeg/issues/54)
- Missing openjpegConfigure.h [\#38](https://github.com/uclouvain/openjpeg/issues/38)
- Not an issue in openjpeg, but ... [\#37](https://github.com/uclouvain/openjpeg/issues/37)
- OpenJPEG-1.3.0 pclr, cmap and cdef [\#27](https://github.com/uclouvain/openjpeg/issues/27)
- realloc maybe too big \(t2.c\) [\#26](https://github.com/uclouvain/openjpeg/issues/26)
- libopenjpeg/opj\_malloc.h breaks on FreeBSD/Darwin systems [\#20](https://github.com/uclouvain/openjpeg/issues/20)
- image\_to\_j2k not outputting to win32 console properly [\#18](https://github.com/uclouvain/openjpeg/issues/18)
- \[OpenJPEG\] OpenJPEG\_v13: tiled image part 2 [\#17](https://github.com/uclouvain/openjpeg/issues/17)
- JP2 Color Space modification by Matteo Italia [\#13](https://github.com/uclouvain/openjpeg/issues/13)
- Patch submission \( exotic video formats, and a few things \) [\#12](https://github.com/uclouvain/openjpeg/issues/12)
- 16 bits lossy compression [\#10](https://github.com/uclouvain/openjpeg/issues/10)
- pnm file formats not accepting bitdepth greater than 8 bpp [\#8](https://github.com/uclouvain/openjpeg/issues/8)
- Heap corruption in j2k encoder [\#5](https://github.com/uclouvain/openjpeg/issues/5)
- JPWL crash in marker reallocation\(+patch\), segfault while decoding image with main header protection [\#4](https://github.com/uclouvain/openjpeg/issues/4)
- a couple of small errors in libopenjpeg detected by coverity [\#1](https://github.com/uclouvain/openjpeg/issues/1)
**Closed issues:**
- Shared library build broken on ubuntu [\#728](https://github.com/uclouvain/openjpeg/issues/728)
- opj\_includes.h shouldn't define `\_\_attribute\_\_` [\#727](https://github.com/uclouvain/openjpeg/issues/727)
- Possible website problems due to Jekyll upgrade [\#713](https://github.com/uclouvain/openjpeg/issues/713)
- Stable Release? [\#712](https://github.com/uclouvain/openjpeg/issues/712)
- Meta Issue : try to fix some of these critical bugs before thinking about optimizing the library [\#710](https://github.com/uclouvain/openjpeg/issues/710)
- Tiled encoding broken for images with non power of 2 dimensions [\#702](https://github.com/uclouvain/openjpeg/issues/702)
- install\_name \(still\) not set on OS X [\#700](https://github.com/uclouvain/openjpeg/issues/700)
- Add section in wiki describing where one can get test images [\#699](https://github.com/uclouvain/openjpeg/issues/699)
- Make EvenManager into singleton [\#698](https://github.com/uclouvain/openjpeg/issues/698)
- Remove old branches from repo [\#696](https://github.com/uclouvain/openjpeg/issues/696)
- MQ Coder encode: Conditional jump or move depends on uninitialised value\(s\) [\#695](https://github.com/uclouvain/openjpeg/issues/695)
- Can we add these files to our test suite ? [\#688](https://github.com/uclouvain/openjpeg/issues/688)
- -t and -d command line flags for decode are not documented on OpenJPEG website [\#685](https://github.com/uclouvain/openjpeg/issues/685)
- Decoding at the precinct level [\#676](https://github.com/uclouvain/openjpeg/issues/676)
- Support unscaled 10 bit data for 2K cinema @ 48 FPS, as per DCI standard [\#671](https://github.com/uclouvain/openjpeg/issues/671)
- Use parallel jobs in ctest [\#664](https://github.com/uclouvain/openjpeg/issues/664)
- \[Security\]Multiple Memory error [\#663](https://github.com/uclouvain/openjpeg/issues/663)
- lossy encoding a 16 bit TIF file : severe artifacts in decompressed image [\#660](https://github.com/uclouvain/openjpeg/issues/660)
- opj\_compress and opj\_decompress : get\_next\_file method uses hard-coded unix path separator [\#630](https://github.com/uclouvain/openjpeg/issues/630)
- Uninitialized variable [\#629](https://github.com/uclouvain/openjpeg/issues/629)
- Use of enum variable for bit flags prevents compilation as C++ source [\#619](https://github.com/uclouvain/openjpeg/issues/619)
- Serious problem with quantization during lossy encoding [\#615](https://github.com/uclouvain/openjpeg/issues/615)
- Decompression does not work with sequential data source [\#613](https://github.com/uclouvain/openjpeg/issues/613)
- potential overflow in opj\_tcd\_tile\_t [\#605](https://github.com/uclouvain/openjpeg/issues/605)
- Logical condition [\#596](https://github.com/uclouvain/openjpeg/issues/596)
- file9.jp2 does not dump correctly on 1.5 [\#595](https://github.com/uclouvain/openjpeg/issues/595)
- opj\_compress man page is missing documentation of -jpip option [\#593](https://github.com/uclouvain/openjpeg/issues/593)
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) in 1.5 branch [\#591](https://github.com/uclouvain/openjpeg/issues/591)
- Example: opj\_compress -i image.j2k -o image.pgm [\#577](https://github.com/uclouvain/openjpeg/issues/577)
- Mismatching delete [\#575](https://github.com/uclouvain/openjpeg/issues/575)
- Compilation fails on Win7 [\#546](https://github.com/uclouvain/openjpeg/issues/546)
- NR-JP2-file5.jp2-compare2base fails with third party libcms [\#540](https://github.com/uclouvain/openjpeg/issues/540)
- CTest spits out an error at the end of the test run [\#516](https://github.com/uclouvain/openjpeg/issues/516)
- opj\_uint\_adds\(\) is questionable [\#515](https://github.com/uclouvain/openjpeg/issues/515)
- Might consider renaming this method: [\#491](https://github.com/uclouvain/openjpeg/issues/491)
- opj\_compress run twice gives different fiile sizes for same file [\#490](https://github.com/uclouvain/openjpeg/issues/490)
- Android Support [\#483](https://github.com/uclouvain/openjpeg/issues/483)
- Add SSE2/SSE41 implementations for mct.c [\#451](https://github.com/uclouvain/openjpeg/issues/451)
- Reduce encoder code block memory usage for non 64x64 code block sizes [\#444](https://github.com/uclouvain/openjpeg/issues/444)
- valgrind "Uninitialized Memory Read" & "Uninitialized Memory Conditional" found [\#438](https://github.com/uclouvain/openjpeg/issues/438)
- No way to debug opj\_tcd\_init\_encode\_tile or opj\_tcd\_init\_decode\_tile [\#433](https://github.com/uclouvain/openjpeg/issues/433)
- Add option to call dsymutil on built binaries [\#409](https://github.com/uclouvain/openjpeg/issues/409)
- Allow opj\_compress and opj\_decompress to read/write images over stdin/stdout [\#379](https://github.com/uclouvain/openjpeg/issues/379)
- reduce memory significantly for single tile RGB encoding [\#375](https://github.com/uclouvain/openjpeg/issues/375)
- Switch code repo to github and start using pull request workflow [\#373](https://github.com/uclouvain/openjpeg/issues/373)
- This is a BigTIFF file. This format not supported [\#125](https://github.com/uclouvain/openjpeg/issues/125)
- Add a test suite to check the convert functions [\#99](https://github.com/uclouvain/openjpeg/issues/99)
- Add build config to the dashboard to verify the autotools build [\#88](https://github.com/uclouvain/openjpeg/issues/88)
**Merged pull requests:**
- Correct abi-check.sh for PR [\#791](https://github.com/uclouvain/openjpeg/pull/791) ([mayeut](https://github.com/mayeut))
- Update tcd.c [\#790](https://github.com/uclouvain/openjpeg/pull/790) ([maddin200](https://github.com/maddin200))
- Update lcms2 [\#773](https://github.com/uclouvain/openjpeg/pull/773) ([mayeut](https://github.com/mayeut))
- Use lowercase for cmake commands consistently [\#769](https://github.com/uclouvain/openjpeg/pull/769) ([julienmalik](https://github.com/julienmalik))
- Ignore clang's summary warning [\#768](https://github.com/uclouvain/openjpeg/pull/768) ([julienmalik](https://github.com/julienmalik))
- Fix UBSan gcc warning for first arg to memset non null [\#767](https://github.com/uclouvain/openjpeg/pull/767) ([julienmalik](https://github.com/julienmalik))
- Update to libtiff-4.0.6 [\#764](https://github.com/uclouvain/openjpeg/pull/764) ([mayeut](https://github.com/mayeut))
- Fix warnings [\#763](https://github.com/uclouvain/openjpeg/pull/763) ([mayeut](https://github.com/mayeut))
- Check SSIZ is valid in opj\_j2k\_read\_siz [\#762](https://github.com/uclouvain/openjpeg/pull/762) ([mayeut](https://github.com/mayeut))
- Fix unsigned int overflow reported by UBSan [\#761](https://github.com/uclouvain/openjpeg/pull/761) ([mayeut](https://github.com/mayeut))
- Fix unsigned int overflow reported by UBSan [\#759](https://github.com/uclouvain/openjpeg/pull/759) ([mayeut](https://github.com/mayeut))
- Fix negative shift left reported by UBSan [\#758](https://github.com/uclouvain/openjpeg/pull/758) ([mayeut](https://github.com/mayeut))
- Fix negative shift left reported by UBSan [\#757](https://github.com/uclouvain/openjpeg/pull/757) ([mayeut](https://github.com/mayeut))
- Add clang 3.9 build to Travis matrix [\#753](https://github.com/uclouvain/openjpeg/pull/753) ([julienmalik](https://github.com/julienmalik))
- Fix implicit floating bool conversion [\#752](https://github.com/uclouvain/openjpeg/pull/752) ([julienmalik](https://github.com/julienmalik))
- Do not define \_\_attribute\_\_ in opj\_includes.h [\#751](https://github.com/uclouvain/openjpeg/pull/751) ([mayeut](https://github.com/mayeut))
- Allow to read/write 3/5/7/9/11/13/15 bpp TIF files [\#750](https://github.com/uclouvain/openjpeg/pull/750) ([mayeut](https://github.com/mayeut))
- Fix heap-buffer-overflow in color\_esycc\_to\_rgb [\#748](https://github.com/uclouvain/openjpeg/pull/748) ([mayeut](https://github.com/mayeut))
- update libpng to from 1.6.17 to 1.6.21 [\#747](https://github.com/uclouvain/openjpeg/pull/747) ([julienmalik](https://github.com/julienmalik))
- Update cmake & jpylyzer for travis builds [\#746](https://github.com/uclouvain/openjpeg/pull/746) ([julienmalik](https://github.com/julienmalik))
- Fix Out-Of-Bounds Read in sycc42x\_to\_rgb function [\#745](https://github.com/uclouvain/openjpeg/pull/745) ([mayeut](https://github.com/mayeut))
- cppcheck fix for openjp2 [\#740](https://github.com/uclouvain/openjpeg/pull/740) ([julienmalik](https://github.com/julienmalik))
- Fix uninitialized variable reported by cppcheck [\#735](https://github.com/uclouvain/openjpeg/pull/735) ([julienmalik](https://github.com/julienmalik))
- Remove dead code in opj\_dump [\#734](https://github.com/uclouvain/openjpeg/pull/734) ([julienmalik](https://github.com/julienmalik))
- issue \#695 MQ Encode: ensure that bp pointer never points to uninitialized memory [\#708](https://github.com/uclouvain/openjpeg/pull/708) ([boxerab](https://github.com/boxerab))
- Fix issue 135 [\#706](https://github.com/uclouvain/openjpeg/pull/706) ([mayeut](https://github.com/mayeut))
- Fix implementation of opj\_calloc [\#705](https://github.com/uclouvain/openjpeg/pull/705) ([stweil](https://github.com/stweil))
- \[git/2.1 regression\] Fix opj\_write\_tile\(\) failure when numresolutions=1 [\#690](https://github.com/uclouvain/openjpeg/pull/690) ([rouault](https://github.com/rouault))
- Fix fatal crash on 64 bit Linux [\#687](https://github.com/uclouvain/openjpeg/pull/687) ([stweil](https://github.com/stweil))
- \[libtiff\] Add missing include statement for ssize\_t [\#686](https://github.com/uclouvain/openjpeg/pull/686) ([mayeut](https://github.com/mayeut))
- Fix duplicate article in comments [\#684](https://github.com/uclouvain/openjpeg/pull/684) ([stweil](https://github.com/stweil))
- Fix grammar in comment [\#679](https://github.com/uclouvain/openjpeg/pull/679) ([stweil](https://github.com/stweil))
- Remove whitespace and CR at line endings [\#678](https://github.com/uclouvain/openjpeg/pull/678) ([stweil](https://github.com/stweil))
- Fix typos [\#665](https://github.com/uclouvain/openjpeg/pull/665) ([jwilk](https://github.com/jwilk))
- Add missing source for the JPIP library and executables \(issue \#658\) [\#659](https://github.com/uclouvain/openjpeg/pull/659) ([stweil](https://github.com/stweil))
- Fix undefined size jp2 box handling [\#654](https://github.com/uclouvain/openjpeg/pull/654) ([mayeut](https://github.com/mayeut))
- opj\_decompress: Update error message [\#651](https://github.com/uclouvain/openjpeg/pull/651) ([stweil](https://github.com/stweil))
- Fix support of posix\_memalloc for Linux [\#648](https://github.com/uclouvain/openjpeg/pull/648) ([stweil](https://github.com/stweil))
- Fix typo in comments [\#647](https://github.com/uclouvain/openjpeg/pull/647) ([stweil](https://github.com/stweil))
- Avoid pointer arithmetic with \(void \*\) pointers [\#644](https://github.com/uclouvain/openjpeg/pull/644) ([smuehlst](https://github.com/smuehlst))
- Fix HP compiler warning about redeclaration of function \(\#640\) [\#641](https://github.com/uclouvain/openjpeg/pull/641) ([smuehlst](https://github.com/smuehlst))
- Fix format strings and unneeded assignment [\#638](https://github.com/uclouvain/openjpeg/pull/638) ([stweil](https://github.com/stweil))
- Fix repository for JPEG2000 test data [\#637](https://github.com/uclouvain/openjpeg/pull/637) ([stweil](https://github.com/stweil))
- Update allocation functions [\#636](https://github.com/uclouvain/openjpeg/pull/636) ([mayeut](https://github.com/mayeut))
- Fix OpenJPEG GitHub issue \#633. [\#634](https://github.com/uclouvain/openjpeg/pull/634) ([smuehlst](https://github.com/smuehlst))
- travis-ci: Include add ons in matrix [\#632](https://github.com/uclouvain/openjpeg/pull/632) ([mayeut](https://github.com/mayeut))
- Add Appveyor [\#627](https://github.com/uclouvain/openjpeg/pull/627) ([mayeut](https://github.com/mayeut))
- Use Travis-ci to run ABI check [\#626](https://github.com/uclouvain/openjpeg/pull/626) ([mayeut](https://github.com/mayeut))
- Fix warnings for C++ [\#623](https://github.com/uclouvain/openjpeg/pull/623) ([stweil](https://github.com/stweil))
- Fixed problem that C++ compilation failed because of enum variable. [\#622](https://github.com/uclouvain/openjpeg/pull/622) ([smuehlst](https://github.com/smuehlst))
- Added missing casts for return values of opj\_malloc\(\)/opj\_calloc\(\). [\#618](https://github.com/uclouvain/openjpeg/pull/618) ([smuehlst](https://github.com/smuehlst))
- Add check for seek support before trying TPsot==TNsot workaround [\#617](https://github.com/uclouvain/openjpeg/pull/617) ([mayeut](https://github.com/mayeut))
- Fix some typos found by codespell [\#610](https://github.com/uclouvain/openjpeg/pull/610) ([stweil](https://github.com/stweil))
- Correct leak in color\_cielab\_to\_rgb [\#590](https://github.com/uclouvain/openjpeg/pull/590) ([mayeut](https://github.com/mayeut))
- Add Travis-ci build matrix [\#584](https://github.com/uclouvain/openjpeg/pull/584) ([mayeut](https://github.com/mayeut))
- Correct lossless issue on linux x86 [\#579](https://github.com/uclouvain/openjpeg/pull/579) ([mayeut](https://github.com/mayeut))
- Travis-ci update [\#578](https://github.com/uclouvain/openjpeg/pull/578) ([mayeut](https://github.com/mayeut))
- Correct CMake version requirements [\#572](https://github.com/uclouvain/openjpeg/pull/572) ([mayeut](https://github.com/mayeut))
- Add tests for CMYK/esYCC/CIELab [\#567](https://github.com/uclouvain/openjpeg/pull/567) ([mayeut](https://github.com/mayeut))
- Add support for CIELab, EYCC and CMYK [\#559](https://github.com/uclouvain/openjpeg/pull/559) ([szukw000](https://github.com/szukw000))
- Remove printf/fprintf to stdout/stderr throughout openjp2 lib [\#558](https://github.com/uclouvain/openjpeg/pull/558) ([mayeut](https://github.com/mayeut))
- better -ffast-math handling [\#555](https://github.com/uclouvain/openjpeg/pull/555) ([rdieter](https://github.com/rdieter))
- Add jpylyzer tests for JP2 compression [\#552](https://github.com/uclouvain/openjpeg/pull/552) ([mayeut](https://github.com/mayeut))
- Add COC/QCC in main header when needed [\#551](https://github.com/uclouvain/openjpeg/pull/551) ([mayeut](https://github.com/mayeut))
- Use \_\_emul under msvc x86 for fast 64 = 32 \* 32 [\#550](https://github.com/uclouvain/openjpeg/pull/550) ([mayeut](https://github.com/mayeut))
- Update convert for PNG output [\#549](https://github.com/uclouvain/openjpeg/pull/549) ([mayeut](https://github.com/mayeut))
- Remove some warnings when building [\#548](https://github.com/uclouvain/openjpeg/pull/548) ([mayeut](https://github.com/mayeut))
- Switch to libpng-1.6.17 [\#547](https://github.com/uclouvain/openjpeg/pull/547) ([mayeut](https://github.com/mayeut))
- Add some missing static keywords [\#545](https://github.com/uclouvain/openjpeg/pull/545) ([mayeut](https://github.com/mayeut))
- Switch to libcms2 mm2/Little-CMS@0e8234e090d6aab33f90e2eb0296f30aa0705e57 [\#544](https://github.com/uclouvain/openjpeg/pull/544) ([mayeut](https://github.com/mayeut))
- Prevent overflow when coding 16 bits images [\#543](https://github.com/uclouvain/openjpeg/pull/543) ([mayeut](https://github.com/mayeut))
- Switch to libcms2-2.6 [\#542](https://github.com/uclouvain/openjpeg/pull/542) ([mayeut](https://github.com/mayeut))
- Update PNG support [\#538](https://github.com/uclouvain/openjpeg/pull/538) ([mayeut](https://github.com/mayeut))
- Various Minor fixes [\#537](https://github.com/uclouvain/openjpeg/pull/537) ([mayeut](https://github.com/mayeut))
- Update TIFF conversion to support more bit depth. [\#535](https://github.com/uclouvain/openjpeg/pull/535) ([mayeut](https://github.com/mayeut))
- Add checks for odd looking cmap & for cmap outside jp2h box [\#534](https://github.com/uclouvain/openjpeg/pull/534) ([mayeut](https://github.com/mayeut))
- Refactor opj\_j2k\_read\_ppm & opj\_j2k\_read\_ppt [\#533](https://github.com/uclouvain/openjpeg/pull/533) ([mayeut](https://github.com/mayeut))
- Add option to force component splitting in imagetopnm [\#531](https://github.com/uclouvain/openjpeg/pull/531) ([mayeut](https://github.com/mayeut))
- fix Suspicious code in j2k.c \#517 [\#529](https://github.com/uclouvain/openjpeg/pull/529) ([renevanderark](https://github.com/renevanderark))
- Update zlib to version 1.2.8 [\#528](https://github.com/uclouvain/openjpeg/pull/528) ([mayeut](https://github.com/mayeut))
- Fix opj\_write\_bytes\_BE \(\#518\) [\#521](https://github.com/uclouvain/openjpeg/pull/521) ([manisandro](https://github.com/manisandro))
- Correctly decode files with incorrect tile-part header fields \(TPsot==TNsot\) [\#514](https://github.com/uclouvain/openjpeg/pull/514) ([mayeut](https://github.com/mayeut))
- Fixed typos [\#510](https://github.com/uclouvain/openjpeg/pull/510) ([radarhere](https://github.com/radarhere))
- Formatted the readme file [\#507](https://github.com/uclouvain/openjpeg/pull/507) ([htmfilho](https://github.com/htmfilho))
## [version.2.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.1) (2014-04-29)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0.1...version.2.1)
## [version.2.0.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0.1) (2014-04-22)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.2...version.2.0.1)
## [version.1.5.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.2) (2014-03-28)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0...version.1.5.2)
## [version.2.0](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0) (2014-03-28)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.1...version.2.0)
## [version.1.5.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.1) (2012-09-13)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5...version.1.5.1)
## [version.1.5](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5) (2012-02-07)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.3...version.1.5)
## [version.1.3](https://github.com/uclouvain/openjpeg/releases/tag/version.1.3) (2011-07-03)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.4...version.1.3)
## [version.1.4](https://github.com/uclouvain/openjpeg/releases/tag/version.1.4) (2011-07-03)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.2...version.1.4)
## [version.1.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.2) (2007-06-04)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.1...version.1.2)
## [version.1.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.1) (2007-01-31)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.0...version.1.1)
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

View File

@ -0,0 +1,7 @@
set(CTEST_PROJECT_NAME "OPENJPEG")
set(CTEST_NIGHTLY_START_TIME "3:00:00 UTC")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=OPENJPEG")
set(CTEST_DROP_SITE_CDASH TRUE)

View File

@ -0,0 +1,138 @@
# OpenJPEG installation
The build method maintained by OpenJPEG is [CMake](https://cmake.org/).
## UNIX/LINUX - MacOS (terminal) - WINDOWS (cygwin, MinGW)
To build the library, type from source tree directory:
```
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
```
Binaries are then located in the 'bin' directory.
To install the library, type with root privileges:
```
make install
make clean
```
To build the html documentation, you need doxygen to be installed on your system.
It will create an "html" directory in TOP\_LEVEL/build/doc)
```
make doc
```
Main available cmake flags:
* To specify the install path: '-DCMAKE\_INSTALL\_PREFIX=/path'
* To build the shared libraries and links the executables against it: '-DBUILD\_SHARED\_LIBS:bool=on' (default: 'ON')
> Note: when using this option, static libraries are not built and executables are dynamically linked.
* PKG_CONFIG files are by default built for Unix compile, you can force to build on other platforms by adding: '-DBUILD_PKGCONFIG_FILES=on'
* To build the CODEC executables: '-DBUILD\_CODEC:bool=on' (default: 'ON')
* To build opjstyle (internal version of astyle) for OpenJPEG development: '-DWITH_ASTYLE=ON'
* [OBSOLETE] To build the MJ2 executables: '-DBUILD\_MJ2:bool=on' (default: 'OFF')
* [OBSOLETE] To build the JPWL executables and JPWL library: '-DBUILD\_JPWL:bool=on' (default: 'OFF')
* [OBSOLETE] To build the JPIP client (java compiler recommended) library and executables: '-DBUILD\_JPIP:bool=on' (default: 'OFF')
* [OBSOLETE] To build the JPIP server (need fcgi) library and executables: '-DBUILD\_JPIP\_SERVER:bool=on' (default: 'OFF')
* To enable testing (and automatic result upload to http://my.cdash.org/index.php?project=OPENJPEG):
```
cmake . -DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory' -DBUILDNAME:STRING='name_of_the_build'
make
make Experimental
```
Note : test data is available on the following github repo: https://github.com/uclouvain/openjpeg-data
If '-DOPJ\_DATA\_ROOT:PATH' option is omitted, test files will be automatically searched in '${CMAKE\_SOURCE\_DIR}/../data'.
Note 2 : to execute the encoding test suite, kakadu binaries are needed to decode encoded image and compare it to the baseline. Kakadu binaries are freely available for non-commercial purposes at http://www.kakadusoftware.com. kdu\_expand will need to be in your PATH for cmake to find it.
Note 3 : OpenJPEG encoder and decoder (not the library itself !) depends on several libraries: png, tiff, lcms, z. If these libraries are not found on the system, they are automatically built from the versions available in the source tree. You can force the use of these embedded version with BUILD\_THIRDPARTY:BOOL=ON. On a Debian-like system you can also simply install these libraries with:
```
sudo apt-get install liblcms2-dev libtiff-dev libpng-dev libz-dev
```
Note 4 : On MacOS, if it does not work, try adding the following flag to the cmake command :
```
-DCMAKE_OSX_ARCHITECTURES:STRING=i386
```
## MacOS (XCode) - WINDOWS (VisualStudio, etc)
You can use cmake to generate the project files for the IDE you are using (VC2010, XCode, etc).
Type `cmake --help` for available generators on your platform.
Examples for Windows with Visual Studio C++ compiler:
If using directly the cl compiler:
```
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
```
To compile a 64-bit application, open 64-Bit Visual C\+\+ toolset on the command line and run cmake. For further information, please refer to: [How to: Enable a 64-Bit Visual C\+\+ Toolset on the Command Line](https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx).
If you do not want directly use the cl compiler, you could use:
```
cmake -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
```
To create Visual Studio solution (.sln) and project files (.vcproj / .vcxproj):
```
cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
```
64-bit application:
```
cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE:string="Release" -DBUILD_SHARED_LIBS:bool=on -DCMAKE_INSTALL_PREFIX:path="%USERPROFILE%" -DCMAKE_LIBRARY_PATH:path="%USERPROFILE%" -DCMAKE_INCLUDE_PATH:path="%USERPROFILE%\include" ..
```
# Enabling CPU specific optimizations
For Intel/AMD processors, OpenJPEG implements optimizations using the SSE4.1
instruction set (for example, for the 9x7 inverse MCT transform) and the AVX2
instruction set (for example, for the 5x3 inverse discrete wavelet transform).
Currently, those optimizations are only available if OpenJPEG is built to
use those instruction sets (and the resulting binary will only run on compatible
CPUs)
With gcc/clang, it is possible to enable those instruction sets with the following :
```
cmake -DCMAKE_C_FLAGS="-O3 -msse4.1 -DNDEBUG" ..
```
```
cmake -DCMAKE_C_FLAGS="-O3 -mavx2 -DNDEBUG" ..
```
(AVX2 implies SSE4.1)
Or if the binary is dedicated to run on the machine where it has
been compiled :
```
cmake -DCMAKE_C_FLAGS="-O3 -march=native -DNDEBUG" ..
```
# Modifying OpenJPEG
Before committing changes, run:
```scripts/prepare-commit.sh```
# Using OpenJPEG
To use openjpeg exported cmake file, simply create your application doing:
```
$ cat CMakeLists.txt
find_package(OpenJPEG REQUIRED)
include_directories(${OPENJPEG_INCLUDE_DIRS})
add_executable(myapp myapp.c)
target_link_libraries(myapp ${OPENJPEG_LIBRARIES})
```

View File

@ -0,0 +1,39 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2003-2009, Francois-Olivier Devaux
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
* Copyright (c) 2012, CS Systemes d'Information, France
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

View File

@ -0,0 +1,121 @@
# OpenJPEG NEWS
More details in the [CHANGELOG](https://github.com/uclouvain/openjpeg/blob/master/CHANGELOG.md)
## OpenJPEG 2.4.0 (December 2021)
No API/ABI break compared to v2.3.1, but additional symbols for subset of components decoding (hence the MINOR version bump).
* Encoder: add support for multithreading [\#1248](https://github.com/uclouvain/openjpeg/pull/1248)
* Encoder: add support for generation of PLT markers [\#1246](https://github.com/uclouvain/openjpeg/pull/1246)
* Encoder: single-threaded performance improvements in forward DWT for 5-3 and 9-7 (and other improvements) [\#1253](https://github.com/uclouvain/openjpeg/pull/1253)
* Encoder: support IMF profiles [\#1235](https://github.com/uclouvain/openjpeg/pull/1235)
* Many bug fixes (including security fixes)
## OpenJPEG 2.3.1 (April 2019)
No API/ABI break compared to v2.3.0
* Many bug fixes (including security fixes)
## OpenJPEG 2.3.0 (October 2017)
No API/ABI break compared to v2.2.0 but additional symbols for subset of components decoding (hence the MINOR version bump).
* Sub-tile decoding: when setting a window of interest through the API function opj_set_decode_area(), only codeblocks that intersect this window are now decoded (i.e. MCT, IDWT, and entropy decoding are only done on the window of interest). Moreover, memory allocation now depends on the size of the window of interest (instead of the full tile size).
[\#990](https://github.com/uclouvain/openjpeg/pull/990) [\#1001](https://github.com/uclouvain/openjpeg/pull/1001) [\#1010](https://github.com/uclouvain/openjpeg/pull/1010)
* Ability to decode only a subset of components. This adds the following function `opj_set_decoded_components(opj_codec_t p_codec, OPJ_UINT32 numcomps, const OPJ_UINT32 comps_indices, OPJ_BOOL apply_color_transforms)` and equivalent `opj_decompress -c compno[,compno]*`
option.
[\#1022](https://github.com/uclouvain/openjpeg/pull/1022)
* Many bug fixes (including security fixes)
## OpenJPEG 2.2.0 (August 2017)
No API/ABI break compared to v2.1.2 but additional symbols for multithreading support (hence the MINOR version bump).
### Codebase improvements
* Memory consumption reduction at decoding side [\#968](https://github.com/uclouvain/openjpeg/pull/968)
* Multi-threading support at decoding side [\#786](https://github.com/uclouvain/openjpeg/pull/786)
* Tier-1 speed optimizations (encoder and decoder) [\#945](https://github.com/uclouvain/openjpeg/pull/945)
* Tier-1 decoder further optimization [\#783](https://github.com/uclouvain/openjpeg/pull/783)
* Inverse 5x3 DWT speed optimization: single-pass lifting and SSE2/AVX2 implementation [\#957](https://github.com/uclouvain/openjpeg/pull/957)
* Fixed a bug that prevented OpenJPEG to compress losslessly in some situations [\#949](https://github.com/uclouvain/openjpeg/pull/949)
* Fixed BYPASS/LAZY, RESTART/TERMALL and PTERM mode switches
* Many other bug fixes (including security fixes)
### Maintenance improvements
* Benchmarking scripts to automatically compare the speed of latest OpenJPEG build with latest release and/or Kakadu binaries [\#917](https://github.com/uclouvain/openjpeg/pull/917)
* CPU and RAM usage profiling scripts [\#918](https://github.com/uclouvain/openjpeg/pull/918)
* Codebase reformatting (with astyle) and scripts to automatically check that new commits comply with formatting guidelines [\#919](https://github.com/uclouvain/openjpeg/pull/919)
* Register OpenJPEG at Google OSS Fuzz initiative, so as to automatically have OpenJPEG tested against Google fuzzer [\#965](https://github.com/uclouvain/openjpeg/issues/965)
## OpenJPEG 2.1.2 (September 2016)
* Bug fixes (including security fixes)
* No API/ABI break compared to v2.1.1
## OpenJPEG 2.1.1 (July 2016)
* Huge amount of critical bugfixes
* Speed improvements
* No API/ABI break compared to v2.1
## OpenJPEG 2.1.0 (April 2014)
### New Features
* Digital Cinema profiles have been fixed and updated
* New option to disable MCT if needed
* extended RAW support: it is now possible to input raw images
with subsampled color components (422, 420, etc)
* New way to deal with profiles
### API/ABI modifications
(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details)
* Removed deprecated functions
* opj_stream_create_default_file_stream(FILE*,...)
* opj_stream_create_file_stream(FILE*,...)
* opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data)
* Added
* opj_stream_create_default_file_stream(char*,...)
* opj_stream_create_file_stream(char*,...)
* opj_stream_destroy(opj_stream_t*)
* opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data,
... opj_stream_free_user_data_fn p_function)
* JPEG 2000 profiles and Part-2 extensions defined through '#define'
* Changed
* 'alpha' field added to 'opj_image_comp' structure
* 'OPJ_CLRSPC_EYCC' added to enum COLOR_SPACE
* 'OPJ_CLRSPC_CMYK' added to enum COLOR_SPACE
* 'OPJ_CODEC_JPP' and 'OPJ_CODEC_JPX' added to CODEC_FORMAT
(not yet used in use)
* 'max_cs_size' and 'rsiz' fields added to opj_cparameters_t
### Misc
* OpenJPEG is now officially conformant with JPEG 2000 Part-1
and will soon become official reference software at the
JPEG committee.
* Huge amount of bug fixes. See CHANGES for details.
## OpenJPEG 2.0.0
### New Features
* streaming capabilities
* merge JP3D
### API modifications
(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details)
* Use a 64bits capable API
### Misc
* removed autotools build system
* folders hierarchies reorganisation
* Huge amount of bug fixes. See CHANGES for details.

View File

@ -0,0 +1,83 @@
# OPENJPEG Library and Applications
## What is OpenJPEG ?
OpenJPEG is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of [JPEG 2000](http://www.jpeg.org/jpeg2000), a still-image compression standard from the Joint Photographic Experts Group ([JPEG](http://www.jpeg.org)). Since April 2015, it is officially recognized by ISO/IEC and ITU-T as a [JPEG 2000 Reference Software](http://www.itu.int/rec/T-REC-T.804-201504-I!Amd2).
## Who can use the code ?
[![badge-license]][link-license]
Anyone. As the OpenJPEG code is released under the [BSD 2-clause "Simplified" License][link-license], anyone can use or modify the code, even for commercial applications. The only restriction is to retain the copyright in the sources or in the binaries documentation. Of course, if you modified the code in a way that might be of interest for other users, you are encouraged to share it (through a [github pull request](https://github.com/uclouvain/openjpeg/pulls) or by filling an [issue](https://github.com/uclouvain/openjpeg/issues)) but this is not a requirement.
## How to install and use OpenJPEG ?
API Documentation needs a major refactoring. Meanwhile, you can check [installation](https://github.com/uclouvain/openjpeg/wiki/Installation) instructions and [codec documentation](https://github.com/uclouvain/openjpeg/wiki/DocJ2KCodec).
## Current Status
[![badge-build]][link-build]
[![badge-msvc-build]][link-msvc-build]
[![badge-coverity]][link-coverity]
## Who are the developers ?
The library is developed and maintained by the Image and Signal Processing Group ([ISPGroup](http://sites.uclouvain.be/ispgroup/)), in the Université catholique de Louvain ([UCL](http://www.uclouvain.be/en-index.html), with the support of the [CNES](https://cnes.fr/), the [CS](http://www.c-s.fr/) company and the [intoPIX](http://www.intopix.com) company. The JPWL module has been developed by the Digital Signal Processing Lab ([DSPLab](http://dsplab.diei.unipg.it/)) of the University of Perugia, Italy ([UNIPG](http://www.unipg.it/)).
## Details on folders hierarchy
* src
* lib
* openjp2: contains the sources of the openjp2 library (Part 1 & 2)
* openjpwl: contains the additional sources if you want to build a JPWL-flavoured library.
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
* openjp3d: JP3D implementation
* openmj2: MJ2 implementation
* bin: contains all applications that use the openjpeg library
* common: common files to all applications
* jp2: a basic codec
* mj2: motion jpeg 2000 executables
* jpip: OpenJPIP applications (server and dec server)
* java: a Java client viewer for JPIP
* jp3d: JP3D applications
* tcltk: a test tool for JP3D
* wx
* OPJViewer: gui for displaying j2k files (based on wxWidget)
* wrapping
* java: java jni to use openjpeg in a java program
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
* doc: doxygen documentation setup file and man pages
* tests: configuration files and utilities for the openjpeg test suite. All test images are located in [openjpeg-data](https://github.com/uclouvain/openjpeg-data) repository.
* cmake: cmake related files
* scripts: scripts for developers
See [LICENSE][link-license] for license and copyright information.
See [INSTALL](https://github.com/uclouvain/openjpeg/blob/master/INSTALL.md) for installation procedures.
See [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) for user visible changes in successive releases.
## API/ABI
An API/ABI timeline is automatically updated [here][link-api-timeline].
OpenJPEG strives to provide a stable API/ABI for your applications. As such it
only exposes a limited subset of its functions. It uses a mechanism of
exporting/hiding functions. If you are unsure which functions you can use in
your applications, you should compile OpenJPEG using something similar to gcc:
`-fvisibility=hidden` compilation flag.
See also: http://gcc.gnu.org/wiki/Visibility
On windows, MSVC directly supports export/hiding function and as such the only
API available is the one supported by OpenJPEG.
[comment-license]: https://img.shields.io/github/license/uclouvain/openjpeg.svg "https://img.shields.io/badge/license-BSD--2--Clause-blue.svg"
[badge-license]: https://img.shields.io/badge/license-BSD--2--Clause-blue.svg "BSD 2-clause \"Simplified\" License"
[link-license]: https://github.com/uclouvain/openjpeg/blob/master/LICENSE "BSD 2-clause \"Simplified\" License"
[badge-build]: https://travis-ci.org/uclouvain/openjpeg.svg?branch=master "Build Status"
[link-build]: https://travis-ci.org/uclouvain/openjpeg "Build Status"
[badge-msvc-build]: https://ci.appveyor.com/api/projects/status/github/uclouvain/openjpeg?branch=master&svg=true "Windows Build Status"
[link-msvc-build]: https://ci.appveyor.com/project/detonin/openjpeg/branch/master "Windows Build Status"
[badge-coverity]: https://scan.coverity.com/projects/6383/badge.svg "Coverity Scan Build Status"
[link-coverity]: https://scan.coverity.com/projects/uclouvain-openjpeg "Coverity Scan Build Status"
[link-api-timeline]: http://www.openjpeg.org/abi-check/timeline/openjpeg "OpenJPEG API/ABI timeline"

View File

@ -0,0 +1,39 @@
# OpenJPEG THANKS file
Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements,
or submitting actual code. Here is a list of these people. Help me keep
it complete and exempt of errors.
* Giuseppe Baruffa
* Ben Boeckel
* Aaron Boxer
* David Burken
* Matthieu Darbois
* Rex Dieter
* Herve Drolon
* Antonin Descampe
* Francois-Olivier Devaux
* Parvatha Elangovan
* Jerôme Fimes
* Bob Friesenhahn
* Kaori Hagihara
* Luc Hermitte
* Luis Ibanez
* David Janssens
* Hans Johnson
* Callum Lerwick
* Ke Liu (Tencent's Xuanwu LAB)
* Sebastien Lugan
* Benoit Macq
* Mathieu Malaterre
* Julien Malik
* Arnaud Maye
* Vincent Nicolas
* Aleksander Nikolic (Cisco Talos)
* Glenn Pearson
* Even Rouault
* Dzonatas Sol
* Winfried Szukalski
* Vincent Torri
* Yannick Verschueren
* Peter Wimmer

View File

@ -0,0 +1,41 @@
version: 2.4.0.{build}
branches:
except:
- coverity_scan
skip_tags: false
clone_depth: 50
environment:
matrix:
- OPJ_CI_ARCH: x64
OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS)
OPJ_CI_INSTRUCTION_SETS: "/arch:AVX2"
- OPJ_CI_ARCH: x86
OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS)
OPJ_CI_INCLUDE_IF_DEPLOY: 1
- OPJ_CI_ARCH: x64
OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS)
OPJ_CI_INCLUDE_IF_DEPLOY: 1
- OPJ_CI_ARCH: x86
OPJ_CI_VSCOMNTOOLS: $(VS100COMNTOOLS)
install:
- cmd: c:\cygwin\bin\bash ./tools/travis-ci/install.sh
build_script:
- cmd: >-
"%OPJ_CI_VSCOMNTOOLS%..\..\VC\vcvarsall.bat" %OPJ_CI_ARCH%
bash ./tools/travis-ci/run.sh
test: off
#before_deploy:
#- cmd: c:\cygwin\bin\bash ./tools/travis-ci/before_deploy.sh
deploy:
#release: openjpeg-$(appveyor_repo_tag_name)
description: 'OpenJPEG $(appveyor_repo_tag_name) has been released. More info [here](https://github.com/uclouvain/openjpeg/blob/$(appveyor_repo_tag_name)/NEWS) and a detailed view [here](https://github.com/uclouvain/openjpeg/blob/$(appveyor_repo_tag_name)/CHANGES).'
provider: GitHub
auth_token:
secure: XUL+IoRRw8U/4tupa/fMpinxurft7WRQHZiWHMLO5iuFbwZ+C3vCjVVVM+5Ebky7 # your encrypted token from GitHub
artifact: /.*\.zip/ # upload all zip packages to release assets
draft: true
prerelease: false
on:
appveyor_repo_tag: true # deploy on tag push only
OPJ_CI_INCLUDE_IF_DEPLOY: 1

View File

@ -0,0 +1,40 @@
#----------------------------------------------------------------------
#
# For further details regarding this file,
# see http://www.cmake.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest
#
# and
# http://www.kitware.com/blog/home/post/27
#
#----------------------------------------------------------------------
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
set(CTEST_CUSTOM_COVERAGE_EXCLUDE
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
# Exclude files from the Testing directories
".*/tests/.*"
# Exclude files from the ThirdParty Utilities directories
".*/thirdparty/.*"
)
set(CTEST_CUSTOM_WARNING_EXCEPTION
${CTEST_CUSTOM_WARNING_EXCEPTION}
# Ignore clang's summary warning, assuming prior text has matched some
# other warning expression:
"[0-9,]+ warnings? generated."
# Suppress warning caused by intentional messages about deprecation
".*warning,.* is deprecated"
# java also warns about deprecated API
".*java.*deprecation"
".*deprecation.*"
# suppress warnings caused by 3rd party libs:
".*thirdparty.*"
"libtiff.*has no symbols"
"libpng.*has no symbols"
)

View File

@ -0,0 +1,26 @@
# Ensure that an include file is provided by the system
# Add the check about the mandatory status to the check_include_file macro
# provided by cmake
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
macro(ensure_file_include INCLUDE_FILENAME VARIABLE_NAME MANDATORY_STATUS)
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
CHECK_INCLUDE_FILE(${INCLUDE_FILENAME} ${VARIABLE_NAME})
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
# "VARIABLE_NAME_VALUE=${${VARIABLE_NAME}} \n"
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
if (NOT ${${VARIABLE_NAME}})
if (${MANDATORY_STATUS})
message(FATAL_ERROR "The file ${INCLUDE_FILENAME} is mandatory but not found on your system")
endif()
endif()
endmacro()

View File

@ -0,0 +1,16 @@
# cppcheck
#
# Copyright (c) 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
find_program(CPPCHECK_EXECUTABLE
cppcheck
)
mark_as_advanced(
CPPCHECK_EXECUTABLE
)

View File

@ -0,0 +1,20 @@
# Look for the header file.
find_path(FCGI_INCLUDE_DIR NAMES fastcgi.h)
# Look for the library.
find_library(FCGI_LIBRARY NAMES fcgi)
# Handle the QUIETLY and REQUIRED arguments and set FCGI_FOUND to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FCGI DEFAULT_MSG FCGI_LIBRARY FCGI_INCLUDE_DIR)
# Copy the results to the output variables.
if(FCGI_FOUND)
set(FCGI_LIBRARIES ${FCGI_LIBRARY})
set(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
else()
set(FCGI_LIBRARIES)
set(FCGI_INCLUDE_DIRS)
endif()
mark_as_advanced(FCGI_INCLUDE_DIR FCGI_LIBRARY)

View File

@ -0,0 +1,12 @@
#
# this module looks for JPYLYZER
# http://jpylyzer.openpreservation.org
#
find_program(JPYLYZER_EXECUTABLE
jpylyzer
)
mark_as_advanced(
JPYLYZER_EXECUTABLE
)

View File

@ -0,0 +1,24 @@
#
# this module looks for KAKADU
# http://www.kakadusoftware.com/
#
#
# Copyright (c) 2006-2014 Mathieu Malaterre <mathieu.malaterre@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
find_program(KDU_EXPAND_EXECUTABLE
kdu_expand
)
find_program(KDU_COMPRESS_EXECUTABLE
kdu_compress
)
mark_as_advanced(
KDU_EXPAND_EXECUTABLE
KDU_COMPRESS_EXECUTABLE
)

View File

@ -0,0 +1,31 @@
# - Find LCMS library
# Find the native LCMS includes and library
# Once done this will define
#
# LCMS_INCLUDE_DIR - Where to find lcms.h, etc.
# LCMS_LIBRARIES - Libraries to link against to use LCMS.
# LCMS_FOUND - If false, do not try to use LCMS.
#
# also defined, but not for general use are
# LCMS_LIBRARY, where to find the LCMS library.
#=============================================================================
#=============================================================================
find_path(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
set(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
find_library(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR)
if(LCMS_FOUND)
set( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
set( LCMS_LIBRARIES ${LCMS_LIBRARY} )
endif()

View File

@ -0,0 +1,31 @@
# - Find LCMS2 library
# Find the native LCMS2 includes and library
# Once done this will define
#
# LCMS2_INCLUDE_DIR - Where to find lcms2.h, etc.
# LCMS2_LIBRARIES - Libraries to link against to use LCMS2.
# LCMS2_FOUND - If false, do not try to use LCMS2.
#
# also defined, but not for general use are
# LCMS2_LIBRARY - Where to find the LCMS2 library.
#=============================================================================
#=============================================================================
find_path(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
set(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
find_library(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
if(LCMS2_FOUND)
set( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
set( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
endif()

View File

@ -0,0 +1,9 @@
# JPIP test driver
#message(STATUS "${D_URL}")
file(DOWNLOAD
"${D_URL}"
"${D_FILE}"
LOG log
EXPECTED_MD5 "${EXPECTED_MD5}"
)
message(STATUS "LOG: ${log}")

View File

@ -0,0 +1,72 @@
# package bundler
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
if(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
set(CMAKE_INSTALL_MFC_LIBRARIES 0)
set(CMAKE_INSTALL_DEBUG_LIBRARIES 0)
if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
endif()
include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake)
endif()
set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.")
set(OPJ_PACKAGE_CONTACT "openjpeg users <openjpeg@googlegroups.com>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${OPJ_PACKAGE_DESCRIPTION_SUMMARY})
set(CPACK_PACKAGE_VENDOR "OpenJPEG Team")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE"
"${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" COPYONLY
)
# For PackageMaker on MacOSX it is important to have a file extension:
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${OPENJPEG_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${OPENJPEG_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${OPENJPEG_VERSION_BUILD}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "openjpeg-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
# Make this explicit here, rather than accepting the CPack default value,
# so we can refer to it:
set(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
if(NOT DEFINED CPACK_SYSTEM_NAME)
# make sure package is not Cygwin-unknown, for Cygwin just
# cygwin is good for the system name
if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
set(CPACK_SYSTEM_NAME Cygwin)
else()
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
endif()
endif()
if(${CPACK_SYSTEM_NAME} MATCHES Windows)
if(CMAKE_CL_64)
set(CPACK_SYSTEM_NAME win64-x64)
else()
set(CPACK_SYSTEM_NAME win32-x86)
endif()
endif()
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
# default to source package - system, on cygwin system is not
# needed
if(CYGWIN)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
else()
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
endif()
endif()
set(CPACK_BUNDLE_NAME "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
if(APPLE)
configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
set(CPACK_BUNDLE_PLIST
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
#include(BundleUtilities)
endif()
include(CPack)
endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")

View File

@ -0,0 +1,49 @@
#-----------------------------------------------------------------------------
#
# OPENJPEGConfig.cmake - CMake configuration file for external projects.
#
# This file is configured by OPENJPEG and used by the UseOPENJPEG.cmake
# module to load OPENJPEG's settings for an external project.
@OPENJPEG_CONFIG_INSTALL_ONLY@
# The OPENJPEG version number.
set(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@")
set(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
set(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
# The libraries.
set(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARY_NAME@")
# The CMake macros dir.
set(OPENJPEG_CMAKE_DIR "@OPENJPEG_INSTALL_PACKAGE_DIR@")
# The configuration options.
set(OPENJPEG_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
# The "use" file.
set(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@")
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
# This is an install tree
include(${SELF_DIR}/OpenJPEGTargets.cmake)
set(INC_DIR "@CMAKE_INSTALL_PREFIX@/@OPENJPEG_INSTALL_INCLUDE_DIR@")
get_filename_component(OPENJPEG_INCLUDE_DIRS "${INC_DIR}" ABSOLUTE)
else()
if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
# This is a build tree
set( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@)
include(${SELF_DIR}/OpenJPEGExports.cmake)
else()
message(FATAL_ERROR "ooops")
endif()
endif()
set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake)
# Backward compatible part:
set(OPENJPEG_FOUND TRUE)

View File

@ -0,0 +1,11 @@
#include <sys/types.h>
/* Cause a compile-time error if off_t is smaller than 64 bits */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
int main(int argc, char **argv)
{
return 0;
}

View File

@ -0,0 +1,23 @@
#cmakedefine _LARGEFILE_SOURCE
#cmakedefine _LARGE_FILES
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
/* Cause a compile-time error if off_t is smaller than 64 bits,
* and make sure we have ftello / fseeko.
*/
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
FILE *fp = fopen(argv[0],"r");
off_t offset = ftello( fp );
fseeko( fp, offset, SEEK_CUR );
fclose(fp);
return 0;
}

View File

@ -0,0 +1,134 @@
# - Define macro to check large file support
#
# OPJ_TEST_LARGE_FILES(VARIABLE)
#
# VARIABLE will be set to true if off_t is 64 bits, and fseeko/ftello present.
# This macro will also defines the necessary variable enable large file support, for instance
# _LARGE_FILES
# _LARGEFILE_SOURCE
# _FILE_OFFSET_BITS 64
# OPJ_HAVE_FSEEKO
#
# However, it is YOUR job to make sure these defines are set in a #cmakedefine so they
# end up in a config.h file that is included in your source if necessary!
#
# Adapted from Gromacs project (http://www.gromacs.org/)
# by Julien Malik
#
macro(OPJ_TEST_LARGE_FILES VARIABLE)
if(NOT DEFINED ${VARIABLE})
# On most platforms it is probably overkill to first test the flags for 64-bit off_t,
# and then separately fseeko. However, in the future we might have 128-bit filesystems
# (ZFS), so it might be dangerous to indiscriminately set e.g. _FILE_OFFSET_BITS=64.
message(STATUS "Checking for 64-bit off_t")
# First check without any special flags
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c")
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present")
endif()
if(NOT FILE64_OK)
# Test with _FILE_OFFSET_BITS=64
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64" )
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present with _FILE_OFFSET_BITS=64")
set(_FILE_OFFSET_BITS 64)
endif()
endif()
if(NOT FILE64_OK)
# Test with _LARGE_FILES
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_LARGE_FILES" )
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present with _LARGE_FILES")
set(_LARGE_FILES 1)
endif()
endif()
if(NOT FILE64_OK)
# Test with _LARGEFILE_SOURCE
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE" )
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present with _LARGEFILE_SOURCE")
set(_LARGEFILE_SOURCE 1)
endif()
endif()
#if(NOT FILE64_OK)
# # now check for Windows stuff
# try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
# "${PROJECT_SOURCE_DIR}/cmake/TestWindowsFSeek.c")
# if(FILE64_OK)
# message(STATUS "Checking for 64-bit off_t - present with _fseeki64")
# set(HAVE__FSEEKI64 1)
# endif()
#endif()
if(NOT FILE64_OK)
message(STATUS "Checking for 64-bit off_t - not present")
endif()
set(_FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} CACHE INTERNAL "Result of test for needed _FILE_OFFSET_BITS=64")
set(_LARGE_FILES ${_LARGE_FILES} CACHE INTERNAL "Result of test for needed _LARGE_FILES")
set(_LARGEFILE_SOURCE ${_LARGEFILE_SOURCE} CACHE INTERNAL "Result of test for needed _LARGEFILE_SOURCE")
# Set the flags we might have determined to be required above
configure_file("${PROJECT_SOURCE_DIR}/cmake/TestLargeFiles.c.cmake.in"
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
message(STATUS "Checking for fseeko/ftello")
# Test if ftello/fseeko are available
try_compile(FSEEKO_COMPILE_OK
"${PROJECT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
if(FSEEKO_COMPILE_OK)
message(STATUS "Checking for fseeko/ftello - present")
endif()
if(NOT FSEEKO_COMPILE_OK)
# glibc 2.2 needs _LARGEFILE_SOURCE for fseeko (but not for 64-bit off_t...)
try_compile(FSEEKO_COMPILE_OK
"${PROJECT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c"
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE" )
if(FSEEKO_COMPILE_OK)
message(STATUS "Checking for fseeko/ftello - present with _LARGEFILE_SOURCE")
set(_LARGEFILE_SOURCE ${_LARGEFILE_SOURCE} CACHE INTERNAL "Result of test for needed _LARGEFILE_SOURCE")
endif()
endif()
if(FSEEKO_COMPILE_OK)
set(OPJ_HAVE_FSEEKO ON CACHE INTERNAL "Result of test for fseeko/ftello")
else()
message(STATUS "Checking for fseeko/ftello - not found")
set(OPJ_HAVE_FSEEKO OFF CACHE INTERNAL "Result of test for fseeko/ftello")
endif()
if(FILE64_OK AND FSEEKO_COMPILE_OK)
message(STATUS "Large File support - found")
set(${VARIABLE} ON CACHE INTERNAL "Result of test for large file support")
else()
message(STATUS "Large File support - not found")
set(${VARIABLE} OFF CACHE INTERNAL "Result of test for large file support")
endif()
endif()
endmacro()

View File

@ -0,0 +1,11 @@
#include <stdio.h>
int main()
{
__int64 off=0;
_fseeki64(NULL, off, SEEK_SET);
return 0;
}

View File

@ -0,0 +1,39 @@
{
<Appears with libpng uses with Ubuntu10.04 (hulk)>
Memcheck:Cond
fun:deflate
obj:/lib/libpng12.so.0.42.0
obj:/lib/libpng12.so.0.42.0
obj:/lib/libpng12.so.0.42.0
fun:png_write_row
fun:imagetopng
fun:main
}
{
<Appears with libpng uses with Ubuntu10.04 (hulk)>
Memcheck:Value8
fun:crc32
obj:/lib/libpng12.so.0.42.0
fun:png_write_chunk
obj:/lib/libpng12.so.0.42.0
obj:/lib/libpng12.so.0.42.0
obj:/lib/libpng12.so.0.42.0
obj:/lib/libpng12.so.0.42.0
fun:png_write_row
fun:imagetopng
fun:main
}
{
<Appears with libpng uses with Ubuntu10.04 (hulk)>
Memcheck:Param
write(buf)
fun:__write_nocancel
fun:_IO_file_write@@GLIBC_2.2.5
fun:_IO_do_write@@GLIBC_2.2.5
fun:_IO_file_close_it@@GLIBC_2.2.5
fun:fclose@@GLIBC_2.2.5
fun:imagetopng
fun:main
}

View File

@ -0,0 +1,279 @@
# Doxyfile 1.7.1
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = OpenJPEG
PROJECT_NUMBER = @OPENJPEG_VERSION@
OUTPUT_DIRECTORY = @OPENJPEG_BINARY_DIR@/doc
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH = C://
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = @OPENJPEG_SOURCE_DIR@/src/lib/openjp2 \
@OPENJPEG_SOURCE_DIR@/src/lib/openjpip \
@OPENJPEG_BINARY_DIR@/doc
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.h \
*.c \
*.dox
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = */.svn/*
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = @OPENJPEG_SOURCE_DIR@/doc
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = ./html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
HTML_DYNAMIC_SECTIONS = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
SEARCHENGINE = NO
SERVER_BASED_SEARCH = NO
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = USE_JPWL \
USE_JPSEC
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -0,0 +1,62 @@
/*
* $Id$
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2011, Mickael Savinaud, Communications & Systemes <mickael.savinaud@c-s.fr>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*! \mainpage OpenJPEG v@OPENJPEG_VERSION@ Documentation
*
* \section intro Introduction
* This manual documents the low-level OpenJPEG C API.\n
* The OpenJPEG library is an open-source JPEG 2000 library developed in order to promote the use of JPEG 2000.\n
* This documents is focused on the main part of the library which try to implement Part 1 and Part 2 of the JPEG2000 norm.\n
*
* \section home Home page
*
* The Home Page of the OpenJPEG project can be found at:
*
* http://www.openjpeg.org/
*
* The source code repository is available here:
*
* http://github.com/uclouvain/openjpeg
*
* The OpenJPEG mailing list is located here:
*
* http://groups.google.com/group/openjpeg
*
* The test files repository is available here:
*
* http://github.com/uclouvain/openjpeg-data
*
* \section license License
* This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n
* The only restriction is to retain the copyright in the sources or the binaries documentation.\n
* Neither the author, nor the university accept any responsibility for any kind of error or data loss which may occur during usage.
*
* \author OpenJPEG Team
*
*/

View File

@ -0,0 +1,222 @@
'\" t
'\" The line above instructs most `man' programs to invoke tbl
'\"
'\" Separate paragraphs; not the same as PP which resets indent level.
.de SP
.if t .sp .5
.if n .sp
..
'\"
'\" Replacement em-dash for nroff (default is too short).
.ie n .ds m " -
.el .ds m \(em
'\"
'\" Placeholder macro for if longer nroff arrow is needed.
.ds RA \(->
'\"
'\" Decimal point set slightly raised
.if t .ds d \v'-.15m'.\v'+.15m'
.if n .ds d .
'\"
'\" Enclosure macro for examples
.de EX
.SP
.nf
.ft CW
..
.de EE
.ft R
.SP
.fi
..
.TH opj_compress 1 "Version 2.1.1" "opj_compress" "converts to jpeg2000 files"
.P
.SH NAME
opj_compress \-
This program reads in an image of a certain type and converts it to a
jpeg2000 file. It is part of the OpenJPEG library.
.SP
Valid input image extensions are
.B .bmp, .pgm, .pgx, .png, .pnm, .ppm, .raw, .tga, .tif \fR. For PNG resp. TIF it needs libpng resp. libtiff .
.SP
Valid output image extensions are
.B .j2k, .jp2
.SH SYNOPSIS
.P
.B opj_compress \-i \fRinfile.bmp \fB-o \fRoutfile.j2k
.P
.B opj_compress \-ImgDir \fRdirectory_name \fB-OutFor \fRjp2
.P
.B opj_compress \-h \fRPrint a help message and exit.
.P
See JPWL OPTIONS for special options
.SH OPTIONS
.TP
.B \-\^b " n,n"
(Size of code block (e.g. \-b 32,32). Default: 64 x 64)
.TP
.B \-\^c " n"
(Size of precinct (e.g. \-c 128,128). Default: 2^15 x 2^15)
.TP
.B \-\^cinema2K " fps"
Digital Cinema 2K profile compliant codestream. Valid \fBfps\fR values are 24 or 48.
.TP
.B \-\^cinema4K
Digital Cinema 4K profile compliant codestream. Does not need an fps: default is 24 fps.
.TP
.B \-\^d " X,Y"
(Offset of image origin (e.g. \-d 150,300))
.TP
.B \-\^h
Print a help message and exit.
.TP
.B \-\^i " name"
(input file name)
.TP
.B \-\^n " n"
(Number of resolutions. Default: 6)
.TP
.B \-\^o " name"
(output file name)
.TP
.B \-\^p " name"
Progression order. \fBname\fR can be one out of:LRCP, RLCP, RPCL, PCRL, CPRL. Default: LRCP.
.TP
.B \-\^q " n"
different psnr for successive layers
.br
.B Note: \fR(options \-r and \-q cannot be used together)
.TP
.B \-\^r " n"
different compression ratio(s) for successive layers. The rate specified for each quality level is the desired compression factor.
.br
.B Note: \fR(options \-r and \-q cannot be used together)
.TP
.B \-\^s " X,Y"
sub-sampling factor (e.g. \-s 2,2). Default: No sub-sampling in x or y direction.
.br
.B Remark: \fRsub-sampling bigger than 2 can produce errors.
.TP
.B \-\^t " W,H"
(Size of tile (e.g. \-t 512,512) )
.TP
.B \-\^x " name"
(Create index file and fill it. Default: no index file)
.TP
.B \-\^EPH
(Write EPH marker after each header packet. Default:no EPH)
.TP
.B \-\^F " rawWidth,rawHeight,rawComp,rawBitDepth,s_or_u"
characteristics of the raw input image
.TP
.B \-\^I
(Use the irreversible DWT 9-7. Default: Reversible DWT 5-3)
.TP
.B \-\^ImgDir " directory_name"
(directory containing input files)
.TP
.B \-\^M " n"
mode switch with values: 1, 2, 4, 8, 16, 32. Default:No mode switch activated.
.br
\fIMeaning:\fR
.br
BYPASS(1)
.br
RESET(2)
.br
RESTART(4)
.br
VSC(8)
.br
ERTERM(16)
.br
SEGMARK(32)
.br
Values can be added: RESTART(4) + RESET(2) + SEGMARK(32) = \-M 38
.TP
.B \-\^OutFor "ext"
(extension for output files)
.TP
.B \-\^POC "TtileNr=resolutionStart, componentStart, layerEnd, resolutionEnd, componentEnd, progressionOrder"
(see Examples)
.TP
.B \-\^ROI "c=n,U=n"
quantization indices upshifted for component c (0 or 1 or 2) with a value of U (>= 0 and <= 37)
.br
e.g. \fB-ROI c=0,U=25\fR
.TP
.B \-\^SOP
(Write SOP marker before each packet. Default: No SOP marker in the codestream.)
.TP
.B \-\^T "X,Y"
(Offset of the origin of the tiles (e.g. \-T 100,75) )
.TP
.B \-\^W
(see JPWL OPTIONS)
.P
.SH JPWL OPTIONS
Options usable only if the library has been compiled with \fB-DUSE_JPWL\fR
.P
.B \-W h<tilepart><=type>, s<tilepart><=method>, a=<addr>, z=<size>, g=<range>, p<tilepart:pack><=type>
.P
.B h\fR selects the header error protection (EPB): \fBtype\fR can be
[0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS]
if \fBtilepart\fR is absent, it is for main and tile headers
if \fBtilepart\fR is present, it applies from that tile
onwards, up to the next h<> spec, or to the last tilepart
in the codestream (max. 16 specs)
.P
.B p \fRselects the packet error protection (EEP/UEP with EPBs)
to be applied to raw data: \fBtype\fR can be
[0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS]
if \fBtilepart:pack\fR is absent, it is from tile 0, packet 0
if \fBtilepart:pack\fR is present, it applies from that tile
and that packet onwards, up to the next packet spec
or to the last packet in the last tilepart in the stream
(max. 16 specs)
.P
.B s \fRenables sensitivity data insertion (ESD): \fBmethod\fR can be
[\-1=NO ESD 0=RELATIVE ERROR 1=MSE 2=MSE REDUCTION 3=PSNR
4=PSNR INCREMENT 5=MAXERR 6=TSE 7=RESERVED]
if \fBtilepart\fR is absent, it is for main header only
if \fBtilepart\fR is present, it applies from that tile
onwards, up to the next s<> spec, or to the last tilepart
in the codestream (max. 16 specs)
.P
.B g \fRdetermines the addressing mode: \fBrange\fR can be
[0=PACKET 1=BYTE RANGE 2=PACKET RANGE]
.P
.B a \fRdetermines the size of data addressing: \fBaddr\fR can be
2/4 bytes (small/large codestreams). If not set, auto-mode
.P
.B z \fRdetermines the size of sensitivity values: \fBsize\fR can be
1/2 bytes, for the transformed pseudo-floating point value
.P
.SH EXAMPLES
.P
.B opj_compress \-i \fRfile.bmp \fB-o \fRfile.j2k \fB-r \fR20,10,1 (compress 20x, then 10x, then lossless).
.P
.B opj_compress \-i \fRfile.ppm \fB-o \fRfile.j2k \fB-q \fR30,40,50
.P
.B opj_compress \-i \fRfile.pgx \fB-o \fRfile.j2k \fB-POC \fRT1=0,0,1,5,3,CPRL
.P
.B opj_compress \-i \fRlena.raw \fB-o \fRlena.j2k \fB-F \fR512,512,3,8,u
.P
.SH AUTHORS
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
.br
Copyright (c) 2002-2014, Professor Benoit Macq
.br
Copyright (c) 2001-2003, David Janssens
.br
Copyright (c) 2002-2003, Yannick Verschueren
.br
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
.br
Copyright (c) 2005, Herve Drolon, FreeImage Team
.br
Copyright (c) 2006-2007, Parvatha Elangovan
.P
.SH "SEE ALSO"
opj_decompress(1) opj_dump(1)

View File

@ -0,0 +1,119 @@
'\" t
'\" The line above instructs most `man' programs to invoke tbl
'\"
'\" Separate paragraphs; not the same as PP which resets indent level.
.de SP
.if t .sp .5
.if n .sp
..
'\"
'\" Replacement em-dash for nroff (default is too short).
.ie n .ds m " -
.el .ds m \(em
'\"
'\" Placeholder macro for if longer nroff arrow is needed.
.ds RA \(->
'\"
'\" Decimal point set slightly raised
.if t .ds d \v'-.15m'.\v'+.15m'
.if n .ds d .
'\"
'\" Enclosure macro for examples
.de EX
.SP
.nf
.ft CW
..
.de EE
.ft R
.SP
.fi
..
.TH opj_decompress 1 "Version 2.1.1" "opj_decompress" "converts jpeg2000 files"
.P
.SH NAME
opj_decompress \-
This program reads in a jpeg2000 image and converts it to another
image type. It is part of the OpenJPEG library.
.SP
Valid input image extensions are
.B .j2k, .jp2, .j2c, .jpt
.SP
Valid output image extensions are
.B .bmp, .pgm, .pgx, .png, .pnm, .ppm, .raw, .tga, .tif \fR. For PNG resp. TIF it needs libpng resp. libtiff .
.SH SYNOPSIS
.P
.B opj_decompress \-i \fRinfile.j2k \fB-o \fRoutfile.png
.P
.B opj_decompress \-ImgDir \fRimages/ \fB-OutFor \fRbmp
.P
.B opj_decompress \-h \fRPrint help message and exit
.P
See JPWL OPTIONS for special options
.SH OPTIONS
.TP
.B \-\^i "name"
(jpeg2000 input file name)
.TP
.B \-\^l "n"
n is the maximum number of quality layers to decode. See LAYERS below)
.TP
.B \-\^o "name"
(output file name with extension)
.TP
.B \-\^r "n"
(n is the highest resolution level to be discarded. See REDUCTION below)
.TP
.B \-\^x "name"
(use name as index file and fill it)
.TP
.B \-\^ImgDir "directory_name"
(directory containing input files)
.TP
.B \-\^OutFor "ext"
(extension for output files)
.P
.SH JPIP OPTIONS
Options usable only if the library has been compiled with
.B BUILD_JPIP
.TP
.B -jpip
Embed index table box into the output JP2 file (compulsory for JPIP)
.TP
.B -TP R
Partition a tile into tile parts of different resolution levels (compulsory for JPT-stream)
.P
.SH JPWL OPTIONS
Options usable only if the library has been compiled with
.B BUILD_JPWL
.TP
.B -W c\fR[=Nc] (Nc is the number of expected components in the codestream; default:3)
.TP
.B -W t\fR[=Nt] (Nt is the maximum number of tiles in the codestream; default:8192)
.TP
.B -W c\fR[=Nc]\fB, t\fR[=Nt] \fR(same as above)
.P
.SH REDUCTION
Set the number of highest resolution levels to be discarded.
The image resolution is effectively divided by 2 to the power of the number of discarded levels. The reduce factor is limited by the smallest total number of decomposition levels among tiles.
.SH TILES
Set the maximum number of quality layers to decode. If there are less quality layers than the specified number, all the quality layers are decoded.
.P
'\".SH BUGS
.SH AUTHORS
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
.br
Copyright (c) 2002-2014, Professor Benoit Macq
.br
Copyright (c) 2001-2003, David Janssens
.br
Copyright (c) 2002-2003, Yannick Verschueren
.br
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
.br
Copyright (c) 2005, Herve Drolon, FreeImage Team
.br
Copyright (c) 2006-2007, Parvatha Elangovan
.P
.SH "SEE ALSO"
opj_compress(1) opj_dump(1)

View File

@ -0,0 +1,62 @@
'\" t
'\" The line above instructs most `man' programs to invoke tbl
'\"
'\" Separate paragraphs; not the same as PP which resets indent level.
.de SP
.if t .sp .5
.if n .sp
..
'\"
'\" Replacement em-dash for nroff (default is too short).
.ie n .ds m " -
.el .ds m \(em
'\"
'\" Placeholder macro for if longer nroff arrow is needed.
.ds RA \(->
'\"
'\" Decimal point set slightly raised
.if t .ds d \v'-.15m'.\v'+.15m'
.if n .ds d .
'\"
'\" Enclosure macro for examples
.de EX
.SP
.nf
.ft CW
..
.de EE
.ft R
.SP
.fi
..
.TH opj_dump 1 "Version 2.1.1" "opj_dump" "dumps jpeg2000 files"
.P
.SH NAME
opj_dump \-
This program reads in a jpeg2000 image and dumps the contents to stdout. It is part of the OpenJPEG library.
.SP
Valid input image extensions are
.B .j2k, .jp2, .jpt
.SP
.SH SYNOPSIS
.P
.B opj_dump \-i \fRinfile.j2k
.P
.B opj_dump \-ImgDir \fRimages/ \fRDump all files in images/
.P
.B opj_dump \-h \fRPrint help message and exit
.P
.SH OPTIONS
.TP
.B \-\^i "name"
(jpeg2000 input file name)
.TP
.B \-\^ImgDir "directory_name"
(directory containing jpeg2000 input files)
.P
'\".SH BUGS
.SH AUTHORS
Copyright (c) 2010, Mathieu Malaterre
.P
.SH "SEE ALSO"
opj_compress(1) opj_decompress(1)

View File

@ -0,0 +1,337 @@
'\" t
'\" The line above instructs most `man' programs to invoke tbl
'\"
'\" Separate paragraphs; not the same as PP which resets indent level.
.de SP
.if t .sp .5
.if n .sp
..
'\"
'\" Replacement em-dash for nroff (default is too short).
.ie n .ds m " -
.el .ds m \(em
'\"
'\" Placeholder macro for if longer nroff arrow is needed.
.ds RA \(->
'\"
'\" Decimal point set slightly raised
.if t .ds d \v'-.15m'.\v'+.15m'
.if n .ds d .
'\"
'\" Enclosure macro for examples
.de EX
.SP
.nf
.ft CW
..
.de EE
.ft R
.SP
.fi
..
.TH libopenjp2 3 "Oct 2010" "Version 1.4.0" "Oct 2010"
.P
.SH NAME
libopenjp2 -
a library for reading and writing JPEG2000 image files.
.SP
.SH SYNOPSIS
.P
.B #include <openjpeg.h>
.P
.SS CONVERSION FORMATS
.B PGX: imagetopgx() \fR/\fB pgxtoimage()
.P
.B PXM: imagetopnm() \fR/\fB pnmtoimage()
.P
.B BMP: imagetobmp() \fR/\fB bmptoimage()
.P
.B TIF: imagetotif() \fR/\fB tiftoimage()
.P
.B RAW: imagetoraw() \fR/\fB rawtoimage()
.P
.B TGA: imagetotga() \fR/\fB tgatoimage()
.P
.B PNG: imagetopng() \fR/\fB pngtoimage()
.P
.B YUV: imagetoyuv() \fR/\fB yuvtoimage() \fR(MJ2)
.P
.SS READ
.B opj_set_default_decoder_parameters(opj_dparameters_t *\fIparams\fB);
.P
.B opj_dinfo_t *opj_create_decompress(OPJ_CODEC_FORMAT \fIformat\fB);
.P
.B opj_event_mgr_t *opj_set_event_mgr(opj_common_ptr \fIinfo\fB, opj_event_mgr_t *\fIevent_mgr\fB, void *\fIcontext\fB);
.P
.B void opj_setup_decoder(opj_dinfo_t *\fIdinfo\fB, opj_dparameters_t * \fIparams\fB);
.P
.B opj_cio_t *opj_cio_open(opj_common_ptr \fIinfo\fB, unsigned char *\fIbuf\fB, int \fIbuf_len\fB);
.P
.B opj_image_t *opj_decode(opj_dinfo_t *\fIdinfo\fB, opj_cio_t *\fIcio\fB);
.P
.B void opj_cio_close(opj_cio_t *\fIcio\fB);
.P
.B void opj_destroy_decompress(opj_dinfo_t *\fIdinfo\fB);
.P
.B void opj_image_destroy(opj_image_t *\fIimage\fB);
.P
.SS WRITE
.B void opj_set_default_encoder_parameters(opj_cparameters_t *\fIparams\fB);
.P
/*
.B opj_image_t *FORMATtoimage(const char *\fIfname\fB, opj_cparameters_t *\fIparams\fB);
.P
*/
.br
.B opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT \fIformat\fB);
.P
.B opj_event_mgr_t *opj_set_event_mgr(opj_common_ptr \fIinfo\fB, opj_event_mgr_t *\fIevent_mgr\fB, void *\fIcontext\fB);
.P
.B void opj_setup_encoder(opj_cinfo_t *\fIcinfo\fB, opj_cparameters_t *\fIparams\fB, opj_image_t *\fIimage\fB);
.P
.B opj_cio_t *opj_cio_open(opj_common_ptr \fIcinfo\fB, \fINULL\fB, \fI0\fB);
.P
.B bool opj_encode(opj_cinfo_t *\fIcinfo\fB, opj_cio_t *\fIcio\fB, opj_image_t *\fIimage\fB, char *\fIindex\fB);
.P
.B void opj_cio_close(opj_cio_t *\fIcio\fB);
.P
.B void opj_destroy_compress(opj_cinfo_t *\fIcinfo\fB);
.P
.B void opj_image_destroy(opj_image_t *\fIimage\fB);
.P
.SS GENERAL
.P
.B void opj_image_create(int \fInumcmpts\fB, opj_image_cmptparm_t *\fIcmptparms\fB, OPJ_COLOR_SPACE \fIclrspc\fB);
.P
.B int cio_tell(opj_cio_t *\fIcio\fB);
.P
.B void cio_seek(opj_cio_t *\fIcio\fB, int \fIpos\fB);
.P
.B opj_image_t *opj_decode_with_info(opj_dinfo_t *\fIdinfo\fB, opj_cio_t *\fIcio\fB, opj_codestream_info_t *\fIcstr_info\fB);
.P
.B bool opj_encode_with_info(opj_cinfo_t *\fIcinfo\fB, opj_cio_t *\fIcio\fB, opj_image_t *\fIimage\fB, opj_codestream_info_t *\fIcstr_info\fB);
.P
.B void opj_destroy_cstr_info(opj_codestream_info_t *\fIcstr_info\fB);
.P
.B const char *opj_version(\fIvoid\fB);
.P
.SH OPJ_CODEC_FORMAT
.P
.B CODEC_J2K\fR or \fBCODEC_JPT\fR or \fBCODEC_JP2
.P
.SH OPJ_COLOR_SPACE
.P
.B CLRSPC_UNKNOWN\fR or \fBCLRSPC_UNSPECIFIED\fR or \fBCLRSPC_SRGB\fR or \fBCLRSPC_GRAY\fR or \fBCLRSPC_SYCC
.P
.SH DECOMPRESSION PARAMETERS
.p
typedef struct opj_dparameters
.br
{
/*
Set the number of highest resolution levels to be discarded.
The image resolution is effectively divided by 2 to the power
of the number of discarded levels.
The reduce factor is limited by the smallest total number of
decomposition levels among tiles.
if != 0, then original dimension divided by 2^(reduce);
if == 0 or not used, image is decoded to the full resolution
*/
\fBint\fR cp_reduce;
/*
Set the maximum number of quality layers to decode.
If there are less quality layers than the specified number,
all the quality layers are decoded.
if != 0, then only the first "layer" layers are decoded;
if == 0 or not used, all the quality layers are decoded
*/
\fBint\fR cp_layer;
/*command line encoder parameters (not used inside the library) */
/* input file name */
\fBchar\fR infile[OPJ_PATH_LEN];
/* output file name */
\fBchar\fR outfile[OPJ_PATH_LEN];
/* input file format: see OPJ_CODEC_FORMAT */
\fBint\fR decod_format;
/* output file format */
\fBint\fR cod_format;
/*JPWL decoding parameters */
/* activates the JPWL correction capabilities */
\fBbool\fR jpwl_correct;
/* expected number of components */
\fBint\fR jpwl_exp_comps;
/* maximum number of tiles */
\fBint\fR jpwl_max_tiles;
/*
Specify whether the decoding should be done on the entire
codestream, or be limited to the main header
Limiting the decoding to the main header makes it possible
to extract the characteristics of the codestream
if == NO_LIMITATION, the entire codestream is decoded;
if == LIMIT_TO_MAIN_HEADER, only the main header is decoded;
*/
\fBOPJ_LIMIT_DECODING\fR cp_limit_decoding;
.br
} opj_dparameters_t;
.SH COMPRESSION PARAMETERS
.P
typedef struct opj_cparameters
.br
{
/* size of tile: tile_size_on = false (not in argument)
or tile_size_on = true (in argument) */
\fBbool\fR tile_size_on;
/* XTOsiz */
\fBint\fR cp_tx0;
/* YTOsiz */
\fBint\fR cp_ty0;
/* XTsiz */
\fBint\fR cp_tdx;
/* YTsiz */
\fBint\fR cp_tdy;
/* allocation by rate/distortion */
\fBint\fR cp_disto_alloc;
/* allocation by fixed layer */
\fBint\fR cp_fixed_alloc;
/* add fixed_quality */
\fBint\fR cp_fixed_quality;
/* fixed layer */
\fBint *\fRcp_matrice;
/* comment for coding */
\fBchar *\fRcp_comment;
/* coding style */
\fBint\fR csty;
/* progression order:
PROG_UNKNOWN, LRCP(default), RLCP, RPCL, PCRL, CPRL */
\fBOPJ_PROG_ORDER\fR prog_order;
/* progression order changes */
\fBopj_poc_t\fR POC[32];
/* number of progression order changes (POC), default: 0 */
\fBint\fR numpocs;
/* number of layers */
\fBint\fR tcp_numlayers;
/* rates of layers */
\fBfloat\fR tcp_rates[100];
/* different psnr for successive layers */
\fBfloat\fR tcp_distoratio[100];
/* number of resolutions */
\fBint\fR numresolution;
/* initial code block width, default: 64 */
\fBint\fR cblockw_init;
/* initial code block height, default: 64 */
\fBint\fR cblockh_init;
/* mode switch (cblk_style) */
/* 1 : use the irreversible DWT 9-7,
0 : use lossless compression (default) */
\fBint\fR irreversible;
/* region of interest: affected component in [0..3],
-1 means no ROI */
\fBint\fR roi_compno;
/* region of interest: upshift value */
\fBint\fR roi_shift;
/* number of precinct size specifications */
\fBint\fR res_spec;
/* initial precinct width */
\fBint\fR prcw_init[J2K_MAXRLVLS];
/* initial precinct height */
\fBint\fR prch_init[J2K_MAXRLVLS];
/*command line encoder parameters (not used inside the library) */
/* input file name */
\fBchar\fR infile[OPJ_PATH_LEN];
/* output file name */
\fBchar\fR outfile[OPJ_PATH_LEN];
/* DEPRECATED. Index generation is now handeld with the
opj_encode_with_info() function. Set to NULL */
\fBint\fR index_on;
/* DEPRECATED. Index generation is now handeld with the
opj_encode_with_info() function. Set to NULL */
\fBchar\fR index[OPJ_PATH_LEN];
/* subimage encoding: origin image offset in x direction */
\fBint\fR image_offset_x0;
/* subimage encoding: origin image offset in y direction */
\fBint\fR image_offset_y0;
/* subsampling value for dx */
\fBint\fR subsampling_dx;
/* subsampling value for dy */
\fBint\fR subsampling_dy;
/* input file format */
\fBint\fR decod_format;
/* output file format: see OPJ_CODEC_FORMAT */
\fBint\fR cod_format;
/*JPWL encoding parameters */
/* enables writing of EPC in MH, thus activating JPWL */
\fBbool\fR jpwl_epc_on;
/* error protection method for MH (0,1,16,32,37-128) */
\fBint\fR jpwl_hprot_MH;
/* tile number of header protection specification (>=0) */
\fBint\fR jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS];
/* error protection methods for TPHs (0,1,16,32,37-128) */
\fBint\fR jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS];
/* tile number of packet protection specification (>=0) */
\fBint\fR jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS];
/* packet number of packet protection specification (>=0) */
\fBint\fR jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS];
/* error protection methods for packets (0,1,16,32,37-128) */
\fBint\fR jpwl_pprot[JPWL_MAX_NO_PACKSPECS];
/* enables writing of ESD, (0=no/1/2 bytes) */
\fBint\fR jpwl_sens_size;
/* sensitivity addressing size (0=auto/2/4 bytes) */
\fBint\fR jpwl_sens_addr;
/* sensitivity range (0-3) */
\fBint\fR jpwl_sens_range;
/* sensitivity method for MH (-1=no,0-7) */
\fBint\fR jpwl_sens_MH;
/* tile number of sensitivity specification (>=0) */
\fBint\fR jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS];
/* sensitivity methods for TPHs (-1=no,0-7) */
\fBint\fR jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS];
/* Digital Cinema compliance: OFF-not compliant,
CINEMA2K_24, CINEMA2K_48, CINEMA4K_24 */
\fBOPJ_CINEMA_MODE\fR cp_cinema;
/* Maximum rate for each component.
If == 0, component size limitation is not considered */
\fBint\fR max_comp_size;
/* Profile name*/
\fBOPJ_RSIZ_CAPABILITIES\fR cp_rsiz;
/* Tile part generation*/
\fBchar\fR tp_on;
/* Flag for Tile part generation*/
\fBchar\fR tp_flag;
/* MCT (multiple component transform) */
\fBchar\fR tcp_mct;
.br
} opj_cparameters_t;
'\".SH OPTIONS
'\".SH BUGS
.SH AUTHORS
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
Copyright (c) 2002-2014, Professor Benoit Macq
Copyright (c) 2001-2003, David Janssens
Copyright (c) 2002-2003, Yannick Verschueren
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
Copyright (c) 2005, Herve Drolon, FreeImage Team
Copyright (c) 2006-2007, Parvatha Elangovan
.P
.SH "SEE ALSO"
\fBimage_to_j2k\fR(1) \fBj2k_to_image\fR(1) \fBj2k_dump\fR(1)
\fBJPWL_image_to_j2k\fR(1) \fBJPWL_j2k_to_image\fR(1)
\fBextract_j2k_from_mj2\fR(1) \fBwrap_j2k_in_mj2\fR(1)
\fBframes_to_mj2\fR(1) \fBmj2_to_frames\fR(1)

View File

@ -0,0 +1,94 @@
/*
* $Id$
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*! \page openjpippage OpenJPIP v@OPENJPEG_VERSION@ Documentation
*
* \section Introduction
* This manual documents the low-level OpenJPIP C API.\n
* OpenJPIP software is an implementation of JPEG 2000 Part9: Interactivity tools, APIs and protocols (JPIP).\n
* ( For more info about JPIP, check the website: http://www.jpeg.org/jpeg2000/j2kpart9.html)\n
*
* This whole documents covers the following six programs.\n
* - opj_server.c JPIP server supporting HTTP connection and JPT/JPP-stream
* - opj_dec_server.c Server to decode JPT/JPP-stream and communicate locally with JPIP client, which is coded in java
* - opj_jpip_addxml.c To Embed metadata into JP2 file
* - opj_jpip_transcode.c To Convert JPT/JPP-stream to JP2 or J2K
* - opj_jpip_test.c To test index code format of a JP2 file
*
* \section License
* This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n
* The only restriction is to retain the copyright in the sources or the binaries documentation.\n
* Neither the author, nor the university accept any responsibility for any kind of error or data loss which may occur during usage.
*
*
* \section reqlibs Required libraries
* - OpenJPEG library
* - FastCGI development kit (C libraries) at server (http://www.fastcgi.com)
* - libcURL library
*
* We tested this software with a virtual server running on the same Linux machine as the clients.
*
*
* \section compilenotes Compiling Notes
* When you are making opj_server, set anything (e.g. yes) to the parameter jpipserver to define itself in the Makefile, which enables to make it in server mode.\n
* Otherwise do not define (or do not set to) the parameter jpipserver.\n
* Be sure that any object files and library file libopenjpip.a are not reused to compile in the two different mode (server mode and non server mode).\n
* In other words, do make clean before making new targets which are in different modes as previous make.\n
*
*
* \section sysarchtect System Architecture
* JPIP protocol is implemented between the JPIP server program (opj_server) and the JPIP client java program (opj_viewer).\n
* Figure below represents the overview of our system architecture.\n
* The JPIP server parses JPIP query and sends corresponding JPT/JPP-stream.
* The JPIP client viewer is an image viewer with GUI to publish JPIP requests and receive JPT/JPP-stream.\n
* Particularly, our system has the image decoding module implemented on a server (opj_dec_server, Image decoding Server).
* Image decoding Server and JPIP client viewer communicate closely.
* This specific architecture enables sharing cache of image codestream data among all viewers connected to the same Image decoding Server not only locally but also remotely.
*
* \image html jpip_architect.png "OpenJPIP system architecture"
*
* JPIP server follows up the client cache during a session. \n
* Concretely, the JPIP server models cache in each session, to which Channel IDs are associated.
* A Channel ID identifies a JPIP client viewer.
* And, new viewers can belong to a session by referring to one of its channel ID.
* The Image decoding Server maintains the association between channel IDs and targets, and provides a reference channel ID to a Viewer on demand.\n
*
* Typical requests and replies among JPIP server, JPIP client, and Image decoding server is presented below.\n
* The JPIP server parses HTTP query and sends corresponding JPT/JPP-stream back to the JPIP client (Viewer).
* JPT/JPP-stream is unreadable by JPIP client, and it is directly passed to Image decoding Server, and which provides the image in raw format (PGM or PPM) to the JPIP client.
* The Image decoding Server handles the decoding and caching of JPT/JPP-stream.
* JPIP client can read PGM and PPM images natively.
* Before connecting to the JPIP server, every JPIP client checks local cache data of the requesting image with the image decoding server.
* If its cache exists, the image decoding server provides ChannelID (CID), which identifies the image and its cache model on the JPIP server, and the whole system can continue the session using the CID.
*
* \image html jpip_protocol.png "Message Sequence Chart of OpenJPIP implementation"
*
* \author Kaori Hagihara UCL/SST/ICTM/ELEN
*/

View File

@ -0,0 +1,11 @@
--convert-tabs
--lineend=linux
--indent=spaces=4
--style=kr
--add-braces
--max-code-length=80
--break-after-logical
--pad-header
--pad-oper
--unpad-paren
--suffix=none

View File

@ -0,0 +1,117 @@
#!/bin/bash
###########################################################################
# astyle.sh
# ---------------------
# Date : August 2008
# Copyright : (C) 2008 by Juergen E. Fischer
# Email : jef at norbit dot de
###########################################################################
# #
# 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. #
# #
###########################################################################
for ASTYLE in ${OPJSTYLE} $(dirname $0)/opjstyle $(dirname $0)/RelWithDebInfo/opjstyle
do
if type -p $ASTYLE >/dev/null; then
break
fi
ASTYLE=
done
if [ -z "$ASTYLE" ]; then
echo "opjstyle not found - please enable WITH_ASTYLE in cmake and build it" >&2
exit 1
fi
if type -p tput >/dev/null; then
elcr="$ASTYLEPROGRESS$(tput el)$(tput cr)"
else
elcr="$ASTYLEPROGRESS \r"
fi
if ! type -p flip >/dev/null; then
if type -p dos2unix >/dev/null; then
flip() {
dos2unix -k $2
}
else
echo "flip not found" >&2
flip() {
:
}
fi
fi
if ! type -p autopep8 >/dev/null; then
echo "autopep8 not found" >&2
autopep8() {
:
}
fi
ASTYLEOPTS=$(dirname $0)/astyle.options
if type -p cygpath >/dev/null; then
ASTYLEOPTS="$(cygpath -w $ASTYLEOPTS)"
fi
set -e
astyleit() {
$ASTYLE --options="$ASTYLEOPTS" "$1"
#modified=$1.unify_includes_modified
#cp "$1" "$modified"
#scripts/unify_includes.pl "$modified"
#scripts/doxygen_space.pl "$modified"
#diff "$1" "$modified" >/dev/null || mv "$modified" "$1"
#rm -f "$modified"
}
for f in "$@"; do
case "$f" in
thirdparty/*)
echo -ne "$f skipped $elcr"
continue
;;
*.cpp|*.h|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.hpp)
if [ -x "$f" ]; then
chmod a-x "$f"
fi
cmd=astyleit
;;
*.py)
#cmd="autopep8 --in-place --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701"
echo -ne "Formatting $f $elcr"
cmd="autopep8 --in-place --ignore=E261,E265,E402,E501"
;;
*)
echo -ne "$f skipped $elcr"
continue
;;
esac
if ! [ -f "$f" ]; then
echo "$f not found" >&2
continue
fi
if [[ -f $f && `head -c 3 $f` == $'\xef\xbb\xbf' ]]; then
mv $f $f.bom
tail -c +4 $f.bom > $f
echo "removed BOM from $f"
fi
modified=$f.flip_modified
cp "$f" "$modified"
flip -ub "$modified"
diff "$f" "$modified" >/dev/null || mv "$modified" "$f"
rm -f "$modified"
eval "$cmd '$f'"
done

View File

@ -0,0 +1,112 @@
#!/usr/bin/env bash
###########################################################################
# prepare-commit.sh
# ---------------------
# Date : August 2008
# Copyright : (C) 2008 by Juergen E. Fischer
# Email : jef at norbit dot de
###########################################################################
# #
# 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. #
# #
###########################################################################
TOPLEVEL=$(git rev-parse --show-toplevel)
PATH=$TOPLEVEL/scripts:$PATH
cd $TOPLEVEL
# GNU prefix command for mac os support (gsed, gsplit)
GP=
if [[ "$OSTYPE" =~ darwin* ]]; then
GP=g
fi
if ! type -p astyle.sh >/dev/null; then
echo astyle.sh not found
exit 1
fi
if ! type -p colordiff >/dev/null; then
colordiff()
{
cat "$@"
}
fi
if [ "$1" = "-c" ]; then
echo "Cleaning..."
remove_temporary_files.sh
fi
set -e
# determine changed files
MODIFIED=$(git status --porcelain| ${GP}sed -ne "s/^ *[MA] *//p" | sort -u)
#MODIFIED=$(find src -name "*.h")
if [ -z "$MODIFIED" ]; then
echo nothing was modified
exit 0
fi
# save original changes
REV=$(git log -n1 --pretty=%H)
git diff >sha-$REV.diff
ASTYLEDIFF=astyle.$REV.diff
>$ASTYLEDIFF
# reformat
i=0
N=$(echo $MODIFIED | wc -w)
for f in $MODIFIED; do
(( i++ )) || true
case "$f" in
thirdparty/*)
echo $f skipped
continue
;;
*.cpp|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.sip|*.py)
;;
*)
continue
;;
esac
m=$f.$REV.prepare
cp $f $m
ASTYLEPROGRESS=" [$i/$N]" astyle.sh $f
if diff -u $m $f >>$ASTYLEDIFF; then
# no difference found
rm $m
fi
done
if [ -s "$ASTYLEDIFF" ]; then
if tty -s; then
# review astyle changes
colordiff <$ASTYLEDIFF | less -r
else
echo "Files changed (see $ASTYLEDIFF)"
fi
exit 1
else
rm $ASTYLEDIFF
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached HEAD --
exit 0
# vim: set ts=8 noexpandtab :

View File

@ -0,0 +1,41 @@
#!/bin/bash
###########################################################################
# remove_git_confict_files.sh
# ---------------------
# Date : April 2012
# Copyright : (C) 2012 by Tim Sutton
# Email : tim at kartoza dot com
###########################################################################
# #
# 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. #
# #
###########################################################################
#
# A simple script to get rid of QGIS related temporary files left in
# your QGIS source folder by git
# Tim Sutton, May 2008
find . \
\( \
-name "*.orig" \
-o -name "*.prepare" \
-o -name "*.sortinc" \
-o -name "*.unify_includes_modified" \
-o -name "*.nocopyright" \
-o -name "astyle*.diff" \
-o -name "sha-*.diff" \
-o -name "*.astyle" \
-o -name "sha*.diff" \
-o -name "*.bom" \
-o -name "*.bak" \
-o -name "*.rej" \
-o -name "*.orig" \
-o -name "*.new" \
-o -name "*~" \
\) \
-print \
-delete

View File

@ -0,0 +1,79 @@
#!/bin/bash
cd $(git rev-parse --show-toplevel)
export PATH=$PATH:$PWD/scripts
if [ -z "$TRAVIS_COMMIT_RANGE" ]; then
echo "No commit range given"
exit 0
fi
if ! type -p astyle.sh >/dev/null; then
echo astyle.sh not found
exit 1
fi
set -e
ASTYLEDIFF=/tmp/astyle.diff
>$ASTYLEDIFF
if [[ ! -z $TRAVIS_PULL_REQUEST_BRANCH ]]; then
# if on a PR, just analyse the changed files
echo "TRAVIS PR BRANCH: $TRAVIS_PULL_REQUEST_BRANCH"
FILES=$(git diff --diff-filter=AM --name-only $(git merge-base HEAD master) | tr '\n' ' ' )
elif [[ ! -z $TRAVIS_COMMIT_RANGE ]]; then
echo "TRAVIS COMMIT RANGE: $TRAVIS_COMMIT_RANGE"
FILES=$(git diff --diff-filter=AM --name-only ${TRAVIS_COMMIT_RANGE/.../..} | tr '\n' ' ' )
fi
for f in $FILES; do
if ! [ -f "$f" ]; then
echo "$f was removed." >>/tmp/ctest-important.log
continue
fi
echo "Checking $f" >>/tmp/ctest-important.log
case "$f" in
thirdparty*)
echo "$f skipped"
continue
;;
*.cpp|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.sip|*.py)
;;
*)
continue
;;
esac
m="$f.prepare"
cp "$f" "$m"
astyle.sh "$f"
if diff -u "$m" "$f" >>$ASTYLEDIFF; then
rm "$m"
else
echo "File $f needs indentation"
fi
done
if [ -s "$ASTYLEDIFF" ]; then
echo
echo "Required indentation updates:"
cat "$ASTYLEDIFF"
cat <<EOF
Tips to prevent and resolve:
* Enable WITH_ASTYLE in your cmake configuration to format C++ code
* Install autopep8 (>= 1.2.1) to format python code
* Use "scripts/astyle.sh file" to fix the now badly indented files
* Consider using scripts/prepare-commit.sh as pre-commit hook to avoid this
in the future (ln -s scripts/prepare-commit.sh .git/hooks/pre-commit) or
run it manually before each commit.
EOF
exit 1
fi

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,47 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _OPJ_COLOR_H_
#define _OPJ_COLOR_H_
extern void color_sycc_to_rgb(opj_image_t *img);
extern void color_apply_icc_profile(opj_image_t *image);
extern void color_cielab_to_rgb(opj_image_t *image);
extern void color_cmyk_to_rgb(opj_image_t *image);
extern void color_esycc_to_rgb(opj_image_t *image);
#endif /* _OPJ_COLOR_H_ */

View File

@ -0,0 +1,55 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _OPJ_FORMAT_DEFS_H_
#define _OPJ_FORMAT_DEFS_H_
#define J2K_CFMT 0
#define JP2_CFMT 1
#define JPT_CFMT 2
#define PXM_DFMT 10
#define PGX_DFMT 11
#define BMP_DFMT 12
#define YUV_DFMT 13
#define TIF_DFMT 14
#define RAW_DFMT 15 /* MSB / Big Endian */
#define TGA_DFMT 16
#define PNG_DFMT 17
#define RAWL_DFMT 18 /* LSB / Little Endian */
#endif /* _OPJ_FORMAT_DEFS_H_ */

View File

@ -0,0 +1,15 @@
#include "opj_config_private.h"
/* create opj_apps_config.h for CMake */
#cmakedefine OPJ_HAVE_LIBPNG @HAVE_LIBPNG@
#cmakedefine OPJ_HAVE_PNG_H @HAVE_PNG_H@
#cmakedefine OPJ_HAVE_LIBTIFF @HAVE_LIBTIFF@
#cmakedefine OPJ_HAVE_TIFF_H @HAVE_TIFF_H@
#cmakedefine OPJ_HAVE_LIBLCMS1
#cmakedefine OPJ_HAVE_LIBLCMS2
#cmakedefine OPJ_HAVE_LCMS1_H
#cmakedefine OPJ_HAVE_LCMS2_H

View File

@ -0,0 +1,277 @@
/*
* The copyright in this software is being made available under the 3-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* last review : october 29th, 2002 */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)opj_getopt.c 8.3 (Berkeley) 4/27/95";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "opj_getopt.h"
int opj_opterr = 1, /* if error message should be printed */
opj_optind = 1, /* index into parent argv vector */
opj_optopt, /* character checked for validity */
opj_optreset; /* reset getopt */
char *opj_optarg; /* argument associated with option */
#define BADCH (int)'?'
#define BADARG (int)':'
static char EMSG[] = {""};
/* As this class remembers its values from one Java call to the other, reset the values before each use */
void opj_reset_options_reading(void)
{
opj_opterr = 1;
opj_optind = 1;
}
/*
* getopt --
* Parse argc/argv argument vector.
*/
int opj_getopt(int nargc, char *const *nargv, const char *ostr)
{
# define __progname nargv[0]
static char *place = EMSG; /* option letter processing */
const char *oli = NULL; /* option letter list index */
if (opj_optreset || !*place) { /* update scanning pointer */
opj_optreset = 0;
if (opj_optind >= nargc || *(place = nargv[opj_optind]) != '-') {
place = EMSG;
return (-1);
}
if (place[1] && *++place == '-') { /* found "--" */
++opj_optind;
place = EMSG;
return (-1);
}
} /* option letter okay? */
if ((opj_optopt = (int) * place++) == (int) ':' ||
!(oli = strchr(ostr, opj_optopt))) {
/*
* if the user didn't specify '-' as an option,
* assume it means -1.
*/
if (opj_optopt == (int) '-') {
return (-1);
}
if (!*place) {
++opj_optind;
}
if (opj_opterr && *ostr != ':') {
fprintf(stderr,
"%s: illegal option -- %c\n", __progname, opj_optopt);
return (BADCH);
}
}
if (*++oli != ':') { /* don't need argument */
opj_optarg = NULL;
if (!*place) {
++opj_optind;
}
} else { /* need an argument */
if (*place) { /* no white space */
opj_optarg = place;
} else if (nargc <= ++opj_optind) { /* no arg */
place = EMSG;
if (*ostr == ':') {
return (BADARG);
}
if (opj_opterr) {
fprintf(stderr,
"%s: option requires an argument -- %c\n",
__progname, opj_optopt);
return (BADCH);
}
} else { /* white space */
opj_optarg = nargv[opj_optind];
}
place = EMSG;
++opj_optind;
}
return (opj_optopt); /* dump back option letter */
}
int opj_getopt_long(int argc, char * const argv[], const char *optstring,
const opj_option_t *longopts, int totlen)
{
static int lastidx, lastofs;
const char *tmp;
int i, len;
char param = 1;
again:
if (opj_optind >= argc || !argv[opj_optind] || *argv[opj_optind] != '-') {
return -1;
}
if (argv[opj_optind][0] == '-' && argv[opj_optind][1] == 0) {
if (opj_optind >= (argc - 1)) { /* no more input parameters */
param = 0;
} else { /* more input parameters */
if (argv[opj_optind + 1][0] == '-') {
param = 0; /* Missing parameter after '-' */
} else {
param = 2;
}
}
}
if (param == 0) {
++opj_optind;
return (BADCH);
}
if (argv[opj_optind][0] == '-') { /* long option */
char* arg;
const opj_option_t* o;
o = longopts;
len = sizeof(longopts[0]);
if (param > 1) {
if (opj_optind + 1 >= argc) {
return -1;
}
arg = argv[opj_optind + 1];
opj_optind++;
} else {
arg = argv[opj_optind] + 1;
}
if (strlen(arg) > 1) {
for (i = 0; i < totlen; i = i + len, o++) {
if (!strcmp(o->name, arg)) { /* match */
if (o->has_arg == 0) {
if ((argv[opj_optind + 1]) && (!(argv[opj_optind + 1][0] == '-'))) {
fprintf(stderr, "%s: option does not require an argument. Ignoring %s\n", arg,
argv[opj_optind + 1]);
++opj_optind;
}
} else {
opj_optarg = argv[opj_optind + 1];
if (opj_optarg) {
if (opj_optarg[0] ==
'-') { /* Has read next input parameter: No arg for current parameter */
if (opj_opterr) {
fprintf(stderr, "%s: option requires an argument\n", arg);
return (BADCH);
}
}
}
if (!opj_optarg && o->has_arg == 1) { /* no argument there */
if (opj_opterr) {
fprintf(stderr, "%s: option requires an argument \n", arg);
return (BADCH);
}
}
++opj_optind;
}
++opj_optind;
if (o->flag) {
*(o->flag) = o->val;
} else {
return o->val;
}
return 0;
}
}/*(end for)String not found in the list*/
fprintf(stderr, "Invalid option %s\n", arg);
++opj_optind;
return (BADCH);
} else { /*Single character input parameter*/
if (*optstring == ':') {
return ':';
}
if (lastidx != opj_optind) {
lastidx = opj_optind;
lastofs = 0;
}
opj_optopt = argv[opj_optind][lastofs + 1];
if ((tmp = strchr(optstring, opj_optopt))) { /*Found input parameter in list*/
if (*tmp == 0) { /* apparently, we looked for \0, i.e. end of argument */
++opj_optind;
goto again;
}
if (tmp[1] == ':') { /* argument expected */
if (tmp[2] == ':' ||
argv[opj_optind][lastofs + 2]) { /* "-foo", return "oo" as opj_optarg */
if (!*(opj_optarg = argv[opj_optind] + lastofs + 2)) {
opj_optarg = 0;
}
goto found;
}
opj_optarg = argv[opj_optind + 1];
if (opj_optarg) {
if (opj_optarg[0] ==
'-') { /* Has read next input parameter: No arg for current parameter */
if (opj_opterr) {
fprintf(stderr, "%s: option requires an argument\n", arg);
++opj_optind;
return (BADCH);
}
}
}
if (!opj_optarg) { /* missing argument */
if (opj_opterr) {
fprintf(stderr, "%s: option requires an argument\n", arg);
++opj_optind;
return (BADCH);
}
}
++opj_optind;
} else {/*Argument not expected*/
++lastofs;
return opj_optopt;
}
found:
++opj_optind;
return opj_optopt;
} else { /* not found */
fprintf(stderr, "Invalid option %s\n", arg);
++opj_optind;
return (BADCH);
}/*end of not found*/
}/* end of single character*/
}/*end '-'*/
fprintf(stderr, "Invalid option\n");
++opj_optind;
return (BADCH);;
}/*end function*/

View File

@ -0,0 +1,28 @@
/* last review : october 29th, 2002 */
#ifndef _GETOPT_H_
#define _GETOPT_H_
typedef struct opj_option {
const char *name;
int has_arg;
int *flag;
int val;
} opj_option_t;
#define NO_ARG 0
#define REQ_ARG 1
#define OPT_ARG 2
extern int opj_opterr;
extern int opj_optind;
extern int opj_optopt;
extern int opj_optreset;
extern char *opj_optarg;
extern int opj_getopt(int nargc, char *const *nargv, const char *ostr);
extern int opj_getopt_long(int argc, char * const argv[], const char *optstring,
const opj_option_t *longopts, int totlen);
extern void opj_reset_options_reading(void);
#endif /* _GETOPT_H_ */

View File

@ -0,0 +1,72 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2015, Matthieu Darbois
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OPJ_STRING_H
#define OPJ_STRING_H
#include <errno.h>
#include <string.h>
/* strnlen is not standard, strlen_s is C11... */
/* keep in mind there still is a buffer read overflow possible */
static size_t opj_strnlen_s(const char *src, size_t max_len)
{
size_t len;
if (src == NULL) {
return 0U;
}
for (len = 0U; (*src != '\0') && (len < max_len); src++, len++);
return len;
}
/* should be equivalent to C11 function except for the handler */
/* keep in mind there still is a buffer read overflow possible */
static int opj_strcpy_s(char* dst, size_t dst_size, const char* src)
{
size_t src_len = 0U;
if ((dst == NULL) || (dst_size == 0U)) {
return EINVAL;
}
if (src == NULL) {
dst[0] = '\0';
return EINVAL;
}
src_len = opj_strnlen_s(src, dst_size);
if (src_len >= dst_size) {
return ERANGE;
}
memcpy(dst, src, src_len);
dst[src_len] = '\0';
return 0;
}
#endif /* OPJ_STRING_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,126 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __J2K_CONVERT_H
#define __J2K_CONVERT_H
/**@name RAW component encoding parameters */
/*@{*/
typedef struct raw_comp_cparameters {
/** subsampling in X direction */
int dx;
/** subsampling in Y direction */
int dy;
/*@}*/
} raw_comp_cparameters_t;
/**@name RAW image encoding parameters */
/*@{*/
typedef struct raw_cparameters {
/** width of the raw image */
int rawWidth;
/** height of the raw image */
int rawHeight;
/** number of components of the raw image */
int rawComp;
/** bit depth of the raw image */
int rawBitDepth;
/** signed/unsigned raw image */
OPJ_BOOL rawSigned;
/** raw components parameters */
raw_comp_cparameters_t *rawComps;
/*@}*/
} raw_cparameters_t;
/* Component precision clipping */
void clip_component(opj_image_comp_t* component, OPJ_UINT32 precision);
/* Component precision scaling */
void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision);
/* planar / interleaved conversions */
typedef void (* convert_32s_CXPX)(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst,
OPJ_SIZE_T length);
extern const convert_32s_CXPX convert_32s_CXPX_LUT[5];
typedef void (* convert_32s_PXCX)(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst,
OPJ_SIZE_T length, OPJ_INT32 adjust);
extern const convert_32s_PXCX convert_32s_PXCX_LUT[5];
/* bit depth conversions */
typedef void (* convert_XXx32s_C1R)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst,
OPJ_SIZE_T length);
extern const convert_XXx32s_C1R convert_XXu32s_C1R_LUT[9]; /* up to 8bpp */
typedef void (* convert_32sXXx_C1R)(const OPJ_INT32* pSrc, OPJ_BYTE* pDst,
OPJ_SIZE_T length);
extern const convert_32sXXx_C1R convert_32sXXu_C1R_LUT[9]; /* up to 8bpp */
/* TGA conversion */
opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters);
int imagetotga(opj_image_t * image, const char *outfile);
/* BMP conversion */
opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters);
int imagetobmp(opj_image_t *image, const char *outfile);
/* TIFF conversion*/
opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters);
int imagetotif(opj_image_t *image, const char *outfile);
/**
Load a single image component encoded in PGX file format
@param filename Name of the PGX file to load
@param parameters *List ?*
@return Returns a greyscale image if successful, returns NULL otherwise
*/
opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters);
int imagetopgx(opj_image_t *image, const char *outfile);
opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters);
int imagetopnm(opj_image_t *image, const char *outfile, int force_split);
/* RAW conversion */
int imagetoraw(opj_image_t * image, const char *outfile);
int imagetorawl(opj_image_t * image, const char *outfile);
opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters,
raw_cparameters_t *raw_cp);
opj_image_t* rawltoimage(const char *filename, opj_cparameters_t *parameters,
raw_cparameters_t *raw_cp);
/* PNG conversion*/
extern int imagetopng(opj_image_t *image, const char *write_idf);
extern opj_image_t* pngtoimage(const char *filename,
opj_cparameters_t *parameters);
#endif /* __J2K_CONVERT_H */

Some files were not shown because too many files have changed in this diff Show More