Commit 765e1fd8 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Изменения для компиляции под linux.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62542 954022d7-b5bf-4e40-9824-e11837661b57
parent 833ead66
#pragma once
#pragma once
#include "Types.h"
#include "Utils.h"
......@@ -7,7 +7,7 @@ namespace Jpeg2000
{
//-------------------------------------------------------------------------------------------------------------------------------
// (. Annex C Table C-2)
// Данный массив содержит все возможные состояния (см. Annex C Table C-2)
static MQCoderState aoMQCoderStates[47 * 2] =
{
{ 0x5601, 0, &aoMQCoderStates[2], &aoMQCoderStates[3] },
......@@ -107,7 +107,7 @@ namespace Jpeg2000
};
//-------------------------------------------------------------------------------------------------------------------------------
//
// Вспомогательные функции
//-------------------------------------------------------------------------------------------------------------------------------
static void MQC_ByteOut(MQCoder *pMQCoder)
{
......@@ -305,7 +305,7 @@ namespace Jpeg2000
//-------------------------------------------------------------------------------------------------------------------------------
//
// Основные функции
//-------------------------------------------------------------------------------------------------------------------------------
MQCoder* MQC_Create()
{
......@@ -383,7 +383,7 @@ namespace Jpeg2000
}
void MQC_BypassInitEncoder(MQCoder *pMQCoder)
{
// TO DO:
// TO DO: Данная функция не польностью протестирована
pMQCoder->nCregister = 0;
pMQCoder->nCt = 8;
......@@ -394,7 +394,7 @@ namespace Jpeg2000
}
void MQC_BypassEncoder(MQCoder *pMQCoder, int nValue)
{
// TO DO:
// TO DO: Данная функция не польностью протестирована
pMQCoder->nCt--;
pMQCoder->nCregister = pMQCoder->nCregister + (nValue << pMQCoder->nCt);
......@@ -414,7 +414,7 @@ namespace Jpeg2000
int MQC_BypassFlushEncoder(MQCoder *pMQCoder)
{
// TO DO:
// TO DO: Данная функция не польностью протестирована
unsigned char nBitPadding = 0;
if (pMQCoder->nCt != 0)
......
#pragma once
#pragma once
#include "Types.h"
#include "Utils.h"
......@@ -17,7 +17,7 @@ namespace Jpeg2000
//-------------------------------------------------------------------------------------------------------------------------------
// 5-3 -
// Таблицы норм для обратимого 5-3 веэвлет-преобразования
static const double c_aDWT_NormsRev[4][10] =
{
{ 1.000, 1.500, 2.750, 5.375, 10.68, 21.34, 42.67, 85.33, 170.7, 341.3 },
......@@ -26,7 +26,7 @@ namespace Jpeg2000
{ .7186, .9218, 1.586, 3.043, 6.019, 12.01, 24.00, 47.97, 95.93 }
};
// 9-7 -
// Таблицы норм для необратимого 9-7 веэвлет-преобразования
static const double c_aDWT_NormsIrr[4][10] =
{
{ 1.000, 1.965, 4.177, 8.403, 16.90, 33.84, 67.69, 135.3, 270.6, 540.9 },
......@@ -36,7 +36,7 @@ namespace Jpeg2000
};
//-------------------------------------------------------------------------------------------------------------------------------
//
// Вспомогательные функции
//-------------------------------------------------------------------------------------------------------------------------------
static void DWT_DeinterleaveHor(int *pA, int *pB, int nDn, int nSn, int nCase)
......@@ -236,7 +236,7 @@ namespace Jpeg2000
}
//-------------------------------------------------------------------------------------------------------------------------------
//
// Основные функции
//-------------------------------------------------------------------------------------------------------------------------------
void DWT_EncodeRev(TileComp *pTileComponent)
{
......@@ -249,10 +249,10 @@ namespace Jpeg2000
for (int nIndex = 0; nIndex < nLevel; nIndex++)
{
int nResW; //
int nResH; //
int nResW1; // 1 ,
int nResH1; // 1 ,
int nResW; // Ширина для данного уровня разрешения
int nResH; // Высота для данного уровня разрешения
int nResW1; // Ширина для уровня разрешения на 1 меньше, чем данный
int nResH1; // Высота для уровня разрешения на 1 меньше, чем данный
int nCaseCol; // 0 = non inversion on horizontal filtering, 1 = inversion between low-pass and high-pass filtering
int nCaseRow; // 0 = non inversion on vertical filtering, 1 = inversion between low-pass and high-pass filtering
......@@ -315,10 +315,10 @@ namespace Jpeg2000
for (int nIndex = nLevel - 1; nIndex >= nStop; nIndex--)
{
int nResW; //
int nResH; //
int nResW1; // 1 ,
int nResH1; // 1 ,
int nResW; // Ширина для данного уровня разрешения
int nResH; // Высота для данного уровня разрешения
int nResW1; // Ширина для уровня разрешения на 1 меньше, чем данный
int nResH1; // Высота для уровня разрешения на 1 меньше, чем данный
int nCaseCol; // 0 = non inversion on horizontal filtering, 1 = inversion between low-pass and high-pass filtering
int nCaseRow; // 0 = non inversion on vertical filtering, 1 = inversion between low-pass and high-pass filtering
......@@ -395,10 +395,10 @@ namespace Jpeg2000
for (int nIndex = 0; nIndex < nLevel; nIndex++)
{
int nResW; //
int nResH; //
int nResW1; // 1 ,
int nResH1; // 1 ,
int nResW; // Ширина для данного уровня разрешения
int nResH; // Высота для данного уровня разрешения
int nResW1; // Ширина для уровня разрешения на 1 меньше, чем данный
int nResH1; // Высота для уровня разрешения на 1 меньше, чем данный
int nCaseCol; // 0 = non inversion on horizontal filtering, 1 = inversion between low-pass and high-pass filtering
int nCaseRow; // 0 = non inversion on vertical filtering, 1 = inversion between low-pass and high-pass filtering
......@@ -461,10 +461,10 @@ namespace Jpeg2000
for (int nIndex = nLevel - 1; nIndex >= nStop; nIndex--)
{
int nResW; //
int nResH; //
int nResW1; // 1 ,
int nResH1; // 1 ,
int nResW; // Ширина для данного уровня разрешения
int nResH; // Высота для данного уровня разрешения
int nResW1; // Ширина для уровня разрешения на 1 меньше, чем данный
int nResH1; // Высота для уровня разрешения на 1 меньше, чем данный
int nCaseCol; // 0 = non inversion on horizontal filtering, 1 = inversion between low-pass and high-pass filtering
int nCaseRow; // 0 = non inversion on vertical filtering, 1 = inversion between low-pass and high-pass filtering
......
#pragma once
#pragma once
#include "Types.h"
#include "Utils.h"
......@@ -42,7 +42,7 @@ namespace Jpeg2000
pImage->eColorSpace = eColorSpace;
pImage->nCsiz = nComponentsCount;
//
// Выделяем память под компоненты
pImage->pComponents = (ImageComponent*)Malloc(pImage->nCsiz * sizeof(ImageComponent));
if (!pImage->pComponents)
......@@ -75,7 +75,7 @@ namespace Jpeg2000
}
else
{
// TO DO:
// TO DO: Выдать сообщение об ошибке
}
return pImage;
......
This diff is collapsed.
#include "J2kFile.h"
#include "J2kFile.h"
#include "J2kIncludes.h"
#include "Utils.h"
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 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);
//extern void Image_Destroy(Image *pImage);
//extern Image* Image_Create(int nComponentsCount, ImageComponentParams *pCompParams, ColorSpace eColorSpace);
void* Malloc(size_t nSize)
{
......@@ -90,7 +90,7 @@ namespace Jpeg2000
DecoderParams oParameters;
//
// Установим стандартные значения параметров
ApplyDecoderOptions(&oParameters, wsXmlOptions);
///////////////////////////////////////////////////////////////////////////////////
......@@ -149,7 +149,7 @@ namespace Jpeg2000
unsigned char* pBufferPtr = (unsigned char*)pData;
long nCreatedBufferSize = nBufferSize;
// pBufferPtr
// Пишем данные в 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)
......@@ -216,7 +216,7 @@ namespace Jpeg2000
}
bool CJ2kFile::Save(CBgraFrame* pFrame, const std::wstring& wsDstPath, const std::wstring& wsXmlOptions)
{
// TODO: , .
// TODO: Запись не реализована, надо доделать.
return false;
if (!pFrame)
......@@ -227,12 +227,12 @@ namespace Jpeg2000
BYTE* pSourceBuffer = pFrame->get_Data();
LONG lBufferSize = 4 * lWidth * lHeight;
// Xml
// Далее обрабатываем Xml с параметрами компрессии
EncoderParams oParameters;
int nFormat = ApplyEncoderOptions(&oParameters, wsXmlOptions);
// TODO: -
ImageComponentParams aComponentParams[3]; // (RGB)
// TODO: Добавить возможность записи альфа-канала
ImageComponentParams aComponentParams[3]; // Пока пусть будет максимально три компоненты (RGB)
Image *pImage = NULL;
int nComponentsCount = oParameters.nComponentsCount;
......@@ -248,7 +248,7 @@ namespace Jpeg2000
aComponentParams[nIndex].nHeight = (int)lHeight;
}
// Image
// Создаем структуру Image
pImage = Image_Create(nComponentsCount, &aComponentParams[0], csRGB);
if (!pImage)
return false;
......
// J2kFile.h : Declaration of the CJ2kFile
// J2kFile.h : Declaration of the CJ2kFile
#pragma once
......@@ -23,7 +23,7 @@ namespace Jpeg2000
pParameters->nReduce = 0;
pParameters->nLayer = 0;
// TODO:
// TODO: Сделать чтение параметров декодирования
//if (sXml.GetLength() > 0)
//{
// XmlUtils::CXmlNode oMainNode;
......@@ -64,20 +64,20 @@ namespace Jpeg2000
long ApplyEncoderOptions(EncoderParams *pParameters, const std::wstring& sXml)
{
int nFormat = 0; // J2k
//
// Сначала выставляем стандартные значения параметров
memset(pParameters, 0, sizeof(EncoderParams));
pParameters->nComponentsCount = 3;
pParameters->nResolutionsCount = 6;
pParameters->nCodeBlockHeightInit = 64;
pParameters->nCodeBlockWidthInit = 64;
pParameters->eProgOrder = poLRCP;
pParameters->nROIComponentIndex = -1; // ROI
pParameters->nROIComponentIndex = -1; // Нет ROI
pParameters->nSubSamplingDx = 1;
pParameters->nSubSamplingDy = 1;
pParameters->bTileSizeOn = false;
pParameters->sComment = "Manufactured by Online Media Technologies Ltd.";
// TODO:
// TODO: Сделать чтение параметров кодирования
//if (sXml.GetLength() > 0)
//{
// XmlUtils::CXmlNode oMainNode;
......@@ -187,7 +187,7 @@ namespace Jpeg2000
// // SOPmarker
// if (oSaveNode.GetNode(_T("SOPmarker"), oCurNode))
// {
// // , - ImageInfo
// // Пока отключим, потом надо будет добавить - для этого нужно выделять память для стрктуры ImageInfo
// //pParameters->nCodingStyle |= 0x02;
// }
......@@ -211,7 +211,7 @@ namespace Jpeg2000
// if (oSaveNode.GetNode(_T("Comment"), oCurNode))
// {
// sValue = oCurNode.GetAttribute(_T("value"));
// // TO DO:
// // TO DO: Неправильное копирование строки
// USES_CONVERSION;
// pParameters->sComment = W2A(sValue.GetBuffer());
// }
......@@ -320,13 +320,13 @@ namespace Jpeg2000
//}
//
// Проверим кооректность введенных параметров
// nDistoAlloc, nFixedQuality, nFixedAlloc
// Параметры nDistoAlloc, nFixedQuality, nFixedAlloc нельзя использовать вместе
if ((pParameters->nDistoAlloc || pParameters->nFixedAlloc || pParameters->nFixedQuality) && (!(pParameters->nDistoAlloc ^ pParameters->nFixedAlloc ^ pParameters->nFixedQuality)))
return -1;
// ,
// Если параметры не заданы, тогда по умолчанию ставим компрессию без потерь
if (0 == pParameters->nLayersCount)
{
pParameters->afRates[0] = 0;
......@@ -340,7 +340,7 @@ namespace Jpeg2000
{
if (-1 == pParameters->aoPOC[nIndex].ePpoc)
{
// TO DO: ,
// TO DO: Выдать ошибку, что порядок не задан
}
}
......
#pragma once
#pragma once
#include "Types.h"
#include "ArithmeticCoder.h"
......@@ -59,7 +59,7 @@ namespace Jpeg2000
return NULL;
}
Image *pImage = Jp2_Decode((Jp2Stream*)pDInfo->pJp2, pStream); // pImage = NULL
Image *pImage = Jp2_Decode((Jp2Stream*)pDInfo->pJp2, pStream); // в случае ошибки pImage = NULL
delete (pStream);
Jp2_DestroyDecompress((Jp2Stream*)pDInfo->pJp2);
......@@ -100,7 +100,7 @@ namespace Jpeg2000
return NULL;
}
Image *pImage = J2k_Decode((J2kCodestream*)pDInfo->pJ2k, pStream); // pImage = NULL
Image *pImage = J2k_Decode((J2kCodestream*)pDInfo->pJ2k, pStream); // в случае ошибки pImage = NULL
delete (pStream);
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
......@@ -141,7 +141,7 @@ namespace Jpeg2000
return NULL;
}
Image *pImage = J2k_DecodeJptStream((J2kCodestream*)pDInfo->pJ2k, pStream); // pImage = NULL
Image *pImage = J2k_DecodeJptStream((J2kCodestream*)pDInfo->pJ2k, pStream); // в случае ошибки pImage = NULL
delete (pStream);
J2k_DestroyDecompress((J2kCodestream*)pDInfo->pJ2k);
......@@ -181,7 +181,7 @@ namespace Jpeg2000
return NULL;
}
Image *pImage = Mj2_Decode((Mj2_Movie*)pDInfo->pMj2, pStream); // pImage = NULL
Image *pImage = Mj2_Decode((Mj2_Movie*)pDInfo->pMj2, pStream); // в случае ошибки pImage = NULL
delete (pStream);
Mj2_DestroyDecompress((Mj2_Movie*)pDInfo->pMj2);
......
#pragma once
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------
#include "Types.h"
......@@ -8,7 +8,7 @@
namespace Jpeg2000
{
//-------------------------------------------------------------------------------------------------------------------------------
//
// Вспомогательные функции
//-------------------------------------------------------------------------------------------------------------------------------
static bool Jp2_ReadBoxHeader(PCommon pCodecInfo, CReader *pStream, Jp2Box *pBox)
{
......@@ -111,7 +111,7 @@ namespace Jpeg2000
pStream->Write(pJp2->nWidth, 4); // WIDTH
pStream->Write(pJp2->nComponentsCount, 2); // NC
pStream->Write(pJp2->nBPC, 1); // BPC
pStream->Write(pJp2->nCompressionType, 1); // C ( 7 )
pStream->Write(pJp2->nCompressionType, 1); // C ( это значение всегда равно 7 )
pStream->Write(pJp2->nColorSpaceUnk, 1); // UnkC, colorspace unknown
pStream->Write(pJp2->nIPR, 1); // IPR
......@@ -228,12 +228,13 @@ namespace Jpeg2000
{
pJp2->nEnumCS = pStream->Read(4); // EnumCS
pJp2->oColor.has_colr = TRUE;
pJp2->oColor.has_colr = true;
}
else if (pJp2->nMethod == 2) {
else if (pJp2->nMethod == 2)
{
/* ICC profile */
__int32 it_icc_value = 0;
__int32 icc_len = oBox.nLength - 3;
int it_icc_value = 0;
int icc_len = oBox.nLength - 3;
pJp2->oColor.icc_profile_len = icc_len;
pJp2->oColor.icc_profile_buf = (BYTE*)Malloc(icc_len);
......@@ -249,14 +250,14 @@ namespace Jpeg2000
pJp2->oColor.icc_profile_buf[it_icc_value] = (BYTE)pStream->Read(1); /* icc values */
}
pJp2->oColor.has_colr = TRUE;
pJp2->oColor.has_colr = true;
}
else// if (jp2->meth > 2)
{
/* ISO/IEC 15444-1:2004 (E), Table I.9 Legal METH values:
/* ISO/IEC 15444-1:2004 (E), Table I.9 ­ Legal METH values:
conforming JP2 reader shall ignore the entire Colour Specification box.*/
//"COLR BOX meth value is not a regular value (%d), so we will ignore the entire Colour Specification box. \n", jp2->meth);
// PROFILE
// Пропускаем PROFILE
int nSkipLen = oBox.nInitPos + oBox.nLength - pStream->Tell();
if (nSkipLen < 0)
{
......@@ -363,8 +364,8 @@ namespace Jpeg2000
{
// return false;
// Box , -
// .
// По спецификации данный Box является необходимым, но мы все-таки
// попробуем прочитать изображение со стандартными параметрами.
pStream->Seek(nCurPos);
pJp2->nApprox = 0;
......@@ -546,7 +547,7 @@ namespace Jpeg2000
//-------------------------------------------------------------------------------------------------------------------------------
// Jp2
// Декодирование потока Jp2
//-------------------------------------------------------------------------------------------------------------------------------
void Jp2_DestroyDecompress(Jp2Stream *pJp2)
{
......@@ -596,27 +597,27 @@ namespace Jpeg2000
PCommon pCodecInfo = pJp2->pCodecInfo;
// JP2
// Декодируем JP2
if (!Jp2_ReadStruct(pJp2, pStream))
{
Event_Message(EVT_ERROR, "Failed to decode jp2 structure\n");
return NULL;
}
// J2K
// Декодируем J2K
Image *pImage = J2k_Decode(pJp2->pJ2k, pStream);
if (!pImage)
{
Event_Message(EVT_ERROR, "Failed to decode J2K image\n");
}
//// ..????
////приведение цветовой схемы..????
return pImage;
}
//-------------------------------------------------------------------------------------------------------------------------------
// Jp2
// Кодирование в поток Jp2
//-------------------------------------------------------------------------------------------------------------------------------
void Jp2_DestroyCompress(Jp2Stream *pJp2)
{
......@@ -700,7 +701,7 @@ namespace Jpeg2000
if (nDepth0 != depth)
pJp2->nBPC = 255;
}
pJp2->nCompressionType = 7; // C ( 7)
pJp2->nCompressionType = 7; // C (всегда 7)
pJp2->nColorSpaceUnk = 0; // UnkC
pJp2->nIPR = 0; // IRP
......@@ -722,7 +723,7 @@ namespace Jpeg2000
if (pJp2->nMethod == 1)
{
if (pImage->eColorSpace == 1)
pJp2->nEnumCS = 16; // sRGB ( 6196621 )
pJp2->nEnumCS = 16; // sRGB ( 61966–2–1 )
else if (pImage->eColorSpace == 2)
pJp2->nEnumCS = 17; // Greyscale
else if (pImage->eColorSpace == 3)
......
#pragma once
#pragma once
#include "Types.h"
......@@ -12,15 +12,6 @@ namespace Jpeg2000
{
if (sFormatString != NULL)
{
char sMessage[MSG_SIZE]={};
va_list sArg;
memset(sMessage, 0, MSG_SIZE);
va_start(sArg, sFormatString);
int nLength = (strlen(sFormatString) > MSG_SIZE) ? MSG_SIZE : strlen(sFormatString);
vsprintf(sMessage, sFormatString, sArg);
va_end(sArg);
// TODO: print sMessage/*, pCodecInfo->pClientData*/
}
......
#pragma once
#pragma once
#include "Types.h"
#include "Reader.h"
......@@ -6,7 +6,7 @@
namespace Jpeg2000
{
//-------------------------------------------------------------------------------------------------------------------------------
//
// Вспомогательные функции
//-------------------------------------------------------------------------------------------------------------------------------
static unsigned int JPT_ReadVBASInfo(CReader *pStream, unsigned int nValue)
{
......@@ -34,7 +34,7 @@ namespace Jpeg2000
}
//-------------------------------------------------------------------------------------------------------------------------------
//
// Основные функции
//-------------------------------------------------------------------------------------------------------------------------------
void JPT_InitMessageHeader(JPTMessageHeader *pHeader)
{
......
#pragma once
#pragma once
#include "Types.h"
namespace Jpeg2000
{
//-------------------------------------------------------------------------------------------------------------------------------
// Motion JPEG 2000 (MJ2)
// Данные функции предназначены для чтения Motion JPEG 2000 (MJ2)
//-------------------------------------------------------------------------------------------------------------------------------
static bool Mj2_ReadBoxHeader(Mj2_Box* pBox, CReader * pStream)
......@@ -104,7 +104,7 @@ namespace Jpeg2000
//>>>>
// MDAT
// Достаем первую картинку в потоке MDAT
Jp2Box oTempBox;
Jp2_ReadBoxHeader(pMovie->pCodecInfo, pStream, &oTempBox);
do
......@@ -124,7 +124,7 @@ namespace Jpeg2000
int nJ2kCodestreamOffset = pStream->Tell();
int nJ2kCodestreamLength = oTempBox.nLength - 8;
// J2K
// Декодируем J2K
*ppImage = J2k_Decode(pMovie->pJ2k, pStream);
if (!*ppImage)
{
......@@ -159,8 +159,8 @@ namespace Jpeg2000
Event_Message(EVT_ERROR, "Error: Only Version 0 handled in MVHD box\n");
}
// TO DO:
// . fcd15444-3.pdf .15
// TO DO: Здесь в зависимости от версии разное число байт должно читаться
// см. fcd15444-3.pdf стр.15
pMovie->unCreationTime = pStream->Read(4); // Creation Time
pMovie->unModificationTime = pStream->Read(4); // Modification Time
......@@ -206,8 +206,8 @@ namespace Jpeg2000
return false;
}
// TO DO:
// . fcd15444-3.pdf .16
// TO DO: Здесь в зависимости от версии разное число байт должно читаться
// см. fcd15444-3.pdf стр.16
if (0 != pStream->Read(1)) // Version = 0
{
......@@ -217,7 +217,7 @@ namespace Jpeg2000
int nFlag = pStream->Read(3);
if (!(1 == nFlag || 2 == nFlag || 3 == nFlag || 4 == nFlag)) // nFlags = 1, 2, 3 4
if (!(1 == nFlag || 2 == nFlag || 3 == nFlag || 4 == nFlag)) // nFlags = 1, 2, 3 или 4
{
Event_Message(EVT_ERROR, "Error with flag in TKHD box: Expected flag 1,2,3 or 4\n");
return false;
......@@ -268,7 +268,7 @@ namespace Jpeg2000
return 1;
}
// TO DO: Version = 1
// TO DO: Сделать поодержку Version = 1
if (0 != pStream->Read(1)) // Version = 0
{
Event_Message(EVT_ERROR, "Error: Only Version 0 handled in MDHD box\n");
......@@ -486,9 +486,9 @@ namespace Jpeg2000
return false;
}
if (1 != pStream->Read(3)) // flags = 1,
if (1 != pStream->Read(3)) // Если flags = 1, то медиа данные в файле
{
// TO DO:
// TO DO: Сделать нормальное чтение строк
pTrack->pUrl[nUrlNum].anLocation[0] = pStream->Read(4);
pTrack->pUrl[nUrlNum].anLocation[1] = pStream->Read(4);
pTrack->pUrl[nUrlNum].anLocation[2] = pStream->Read(4);
......@@ -525,9 +525,9 @@ namespace Jpeg2000
return false;
}
if (1 != pStream->Read(3)) // flags = 1,
if (1 != pStream->Read(3)) // Если flags = 1, то медиа данные в файле
{
// TO DO:
// TO DO: Сделать нормальное чтение строк
pTrack->pUrn[nUrnNum].anName[0] = pStream->Read(4);
pTrack->pUrn[nUrnNum].anName[1] = pStream->Read(4);
pTrack->pUrn[nUrnNum].anName[2] = pStream->Read(4);
......@@ -778,7 +778,7 @@ namespace Jpeg2000
int nSampleSize = pStream->Read(4); // SampleSize
if (0 != nSampleSize) //
if (0 != nSampleSize) // У всех самплов одинаковый размер
{
pTrack->unSameSampleSize = 1;
......@@ -857,7 +857,7 @@ namespace Jpeg2000
static bool Mj2_ReadSTCO(Mj2_TrackParams* pTrack, CReader * pStream)
{
// TO DO: 'co64'
// TO DO: Сделать чтение 'co64'
Mj2_Box oBox;
Mj2_ReadBoxHeader(&oBox, pStream);
if (MJ2_STCO != oBox.nType)
......@@ -1185,13 +1185,13 @@ namespace Jpeg2000
}
else if (1 == pTrack->nTrackType)
{
// TO DO:
// TO DO: Релизовать
int nSkipLen = pStream->Read(4);
pStream->Skip(nSkipLen - 4);
}
else if (2 == pTrack->nTrackType)
{
// TO DO:
// TO DO: Реализовать
int nSkipLen = pStream->Read(4);
pStream->Skip(nSkipLen - 4);
}
......@@ -1403,7 +1403,7 @@ namespace Jpeg2000
{
case MJ2_MDAT:
// TO DO: MDAT MOOV
// TO DO: Связать данные в MDAT с данными MOOV
if (!Mj2_ReadMDAT(pMovie, pStream, ppImage, oBox))
return false;
......@@ -1440,7 +1440,7 @@ namespace Jpeg2000
}
//-------------------------------------------------------------------------------------------------------------------------------
// Mj2
// Декодирование потока Mj2
//-------------------------------------------------------------------------------------------------------------------------------
void Mj2_DestroyDecompress(Mj2_Movie* pMovie)
{
......@@ -1531,7 +1531,7 @@ namespace Jpeg2000
PCommon pCodecInfo = pMovie->pCodecInfo;
Image *pImage = NULL;
// JP2
// Декодируем JP2
if (!Mj2_ReadStruct(pMovie, pStream, &pImage))
{
Event_Message(EVT_ERROR, "Failed to decode jp2 structure\n");
......
#pragma once
#pragma once
#include "Types.h"
#include "Utils.h"
......@@ -6,7 +6,7 @@
namespace Jpeg2000
{
//-------------------------------------------------------------------------------------------------------------------------------
//
// Вспомогательные функции
//-------------------------------------------------------------------------------------------------------------------------------
static bool PI_NextLRCP(PacketIterator *pPI)
{
......@@ -53,7 +53,6 @@ namespace Jpeg2000
return false;
}
static bool PI_NextRLCP(PacketIterator *pPI)
{
PacketComponent *pComponent = NULL;
......@@ -99,12 +98,12 @@ namespace Jpeg2000
return false;
}
static bool PI_NextRPCL(PacketIterator *pPI)
{
PacketComponent *pComponent = NULL;
PacketResolution *pResolution = NULL;
long nIndex = 0;
int nLevel, nTileResX0, nTileResY0, nTileResX1, nTileResY1, nResPX, nResPY, nPCR_i, nPCR_j;
if (!pPI->nFirst)
{
......@@ -144,21 +143,21 @@ namespace Jpeg2000
continue;
}
pResolution = &pComponent->pResolutions[pPI->nIndexResolution];
int nLevel = pComponent->nResolutionsCount - 1 - pPI->nIndexResolution;
nLevel = pComponent->nResolutionsCount - 1 - pPI->nIndexResolution;
int nTileResX0 = CeilDiv(pPI->nTileX0, pComponent->nDx << nLevel);
int nTileResY0 = CeilDiv(pPI->nTileY0, pComponent->nDy << nLevel);
int nTileResX1 = CeilDiv(pPI->nTileX1, pComponent->nDx << nLevel);
int nTileResY1 = CeilDiv(pPI->nTileY1, pComponent->nDy << nLevel);
nTileResX0 = CeilDiv(pPI->nTileX0, pComponent->nDx << nLevel);
nTileResY0 = CeilDiv(pPI->nTileY0, pComponent->nDy << nLevel);
nTileResX1 = CeilDiv(pPI->nTileX1, pComponent->nDx << nLevel);
nTileResY1 = CeilDiv(pPI->nTileY1, pComponent->nDy << nLevel);
int nResPX = pResolution->nDx + nLevel;
int nResPY = pResolution->nDy + nLevel;
nResPX = pResolution->nDx + nLevel;
nResPY = pResolution->nDy + nLevel;
if ((!(pPI->nX % (pComponent->nDx << nResPX) == 0) || (pPI->nX == pPI->nTileX0 && (nTileResX0 << nLevel) % (1 << nResPX))))
{
continue;
}
// TO DO: (1 << nResPX)
// TO DO: Проверить здесь последнее деление на (1 << nResPX)
if ((!(pPI->nY % (pComponent->nDy << nResPY) == 0) || (pPI->nY == pPI->nTileY0 && (nTileResY0 << nLevel) % (1 << nResPX))))
{
continue;
......@@ -171,8 +170,8 @@ namespace Jpeg2000
if ((nTileResX0 == nTileResX1) || (nTileResY0 == nTileResY1))
continue;
int nPCR_i = FloorDivPow2(CeilDiv(pPI->nX, pComponent->nDx << nLevel), pResolution->nDx) - FloorDivPow2(nTileResX0, pResolution->nDx);
int nPCR_j = FloorDivPow2(CeilDiv(pPI->nY, pComponent->nDy << nLevel), pResolution->nDy) - FloorDivPow2(nTileResY0, pResolution->nDy);
nPCR_i = FloorDivPow2(CeilDiv(pPI->nX, pComponent->nDx << nLevel), pResolution->nDx) - FloorDivPow2(nTileResX0, pResolution->nDx);
nPCR_j = FloorDivPow2(CeilDiv(pPI->nY, pComponent->nDy << nLevel), pResolution->nDy) - FloorDivPow2(nTileResY0, pResolution->nDy);
pPI->nIndexPrecinct = nPCR_i + nPCR_j * pResolution->nWidth;
for (pPI->nIndexLayer = 0; pPI->nIndexLayer < pPI->oPOC.nLYEpoc; pPI->nIndexLayer++)
......@@ -192,12 +191,12 @@ namespace Jpeg2000
return false;
}
static bool PI_NextPCRL(PacketIterator *pPI)
{
PacketComponent *pComponent = NULL;
PacketResolution *pResolution = NULL;
long nIndex = 0;
int nLevel, nTileResX0, nTileResY0, nTileResX1, nTileResY1, nResPX, nResPY, nPRC_i, nPRC_j;
if (!pPI->nFirst)
{
......@@ -234,21 +233,21 @@ namespace Jpeg2000
for (pPI->nIndexResolution = pPI->oPOC.nRSpoc; pPI->nIndexResolution < min(pPI->oPOC.nREpoc, pComponent->nResolutionsCount); pPI->nIndexResolution++)
{
pResolution = &pComponent->pResolutions[pPI->nIndexResolution];
int nLevel = pComponent->nResolutionsCount - 1 - pPI->nIndexResolution;
nLevel = pComponent->nResolutionsCount - 1 - pPI->nIndexResolution;
int nTileResX0 = CeilDiv(pPI->nTileX0, pComponent->nDx << nLevel);
int nTileResY0 = CeilDiv(pPI->nTileY0, pComponent->nDy << nLevel);
int nTileResX1 = CeilDiv(pPI->nTileX1, pComponent->nDx << nLevel);
int nTileResY1 = CeilDiv(pPI->nTileY1, pComponent->nDy << nLevel);
nTileResX0 = CeilDiv(pPI->nTileX0, pComponent->nDx << nLevel);
nTileResY0 = CeilDiv(pPI->nTileY0, pComponent->nDy << nLevel);
nTileResX1 = CeilDiv(pPI->nTileX1, pComponent->nDx << nLevel);
nTileResY1 = CeilDiv(pPI->nTileY1, pComponent->nDy << nLevel);
int nResPX = pResolution->nDx + nLevel;
int nResPY = pResolution->nDy + nLevel;
nResPX = pResolution->nDx + nLevel;
nResPY = pResolution->nDy + nLevel;
if ((!(pPI->nX % (pComponent->nDx << nResPX) == 0) || (pPI->nX == pPI->nTileX0 && (nTileResX0 << nLevel) % (1 << nResPX))))
{
continue;
}
// TO DO: (1 << nResPX)
// TO DO: Проверить здесь последнее деление на (1 << nResPX)
if ((!(pPI->nY % (pComponent->nDy << nResPY) == 0) || (pPI->nY == pPI->nTileY0 && (nTileResY0 << nLevel) % (1 << nResPX))))
{
continue;
......@@ -261,8 +260,8 @@ namespace Jpeg2000
if ((nTileResX0 == nTileResX1) || (nTileResY0 == nTileResY1))
continue;
int nPRC_i = FloorDivPow2(CeilDiv(pPI->nX, pComponent->nDx << nLevel), pResolution->nDx) - FloorDivPow2(nTileResX0, pResolution->nDx);
int nPRC_j = FloorDivPow2(CeilDiv(pPI->nY, pComponent->nDy << nLevel), pResolution->nDy) - FloorDivPow2(nTileResY0, pResolution->nDy);
nPRC_i = FloorDivPow2(CeilDiv(pPI->nX, pComponent->nDx << nLevel), pResolution->nDx) - FloorDivPow2(nTileResX0, pResolution->nDx);
nPRC_j = FloorDivPow2(CeilDiv(pPI->nY, pComponent->nDy << nLevel), pResolution->nDy) - FloorDivPow2(nTileResY0, pResolution->nDy);
pPI->nIndexPrecinct = nPRC_i + nPRC_j * pResolution->nWidth;
for (pPI->nIndexLayer = 0; pPI->nIndexLayer < pPI->oPOC.nLYEpoc; pPI->nIndexLayer++)
......@@ -282,12 +281,12 @@ namespace Jpeg2000
return false;
}
static bool PI_NextCPRL(PacketIterator *pPI)
{
PacketComponent *pComponent = NULL;
PacketResolution *pResolution = NULL;
long nIndex = 0;
int nLevel, nTileResX0, nTileResY0, nTileResX1, nTileResY1, nResPX, nResPY, nPRC_i, nPRC_j;
if (!pPI->nFirst)
{
......@@ -320,20 +319,20 @@ namespace Jpeg2000
for (pPI->nIndexResolution = pPI->oPOC.nRSpoc; pPI->nIndexResolution < min(pPI->oPOC.nREpoc, pComponent->nResolutionsCount); pPI->nIndexResolution++)
{
pResolution = &pComponent->pResolutions[pPI->nIndexResolution];
int nLevel = pComponent->nResolutionsCount - 1 - pPI->nIndexResolution;
nLevel = pComponent->nResolutionsCount - 1 - pPI->nIndexResolution;
int nTileResX0 = CeilDiv(pPI->nTileX0, pComponent->nDx << nLevel);
int nTileResY0 = CeilDiv(pPI->nTileY0, pComponent->nDy << nLevel);
int nTileResX1 = CeilDiv(pPI->nTileX1, pComponent->nDx << nLevel);
int nTileResY1 = CeilDiv(pPI->nTileY1, pComponent->nDy << nLevel);
int nResPX = pResolution->nDx + nLevel;
int nResPY = pResolution->nDy + nLevel;
nTileResX0 = CeilDiv(pPI->nTileX0, pComponent->nDx << nLevel);
nTileResY0 = CeilDiv(pPI->nTileY0, pComponent->nDy << nLevel);
nTileResX1 = CeilDiv(pPI->nTileX1, pComponent->nDx << nLevel);
nTileResY1 = CeilDiv(pPI->nTileY1, pComponent->nDy << nLevel);
nResPX = pResolution->nDx + nLevel;
nResPY = pResolution->nDy + nLevel;
if ((!(pPI->nX % (pComponent->nDx << nResPX) == 0) || (pPI->nX == pPI->nTileX0 && (nTileResX0 << nLevel) % (1 << nResPX))))
{
continue;
}
// TO DO: (1 << nResPX)
// TO DO: Проверить здесь последнее деление на (1 << nResPX)
if ((!(pPI->nY % (pComponent->nDy << nResPY) == 0) || (pPI->nY == pPI->nTileY0 && (nTileResY0 << nLevel) % (1 << nResPX))))
{
continue;
......@@ -346,8 +345,8 @@ namespace Jpeg2000
if ((nTileResX0 == nTileResX1) || (nTileResY0 == nTileResY1))
continue;
int nPRC_i = FloorDivPow2(CeilDiv(pPI->nX, pComponent->nDx << nLevel), pResolution->nDx) - FloorDivPow2(nTileResX0, pResolution->nDx);
int nPRC_j = FloorDivPow2(CeilDiv(pPI->nY, pComponent->nDy << nLevel), pResolution->nDy) - FloorDivPow2(nTileResY0, pResolution->nDy);
nPRC_i = FloorDivPow2(CeilDiv(pPI->nX, pComponent->nDx << nLevel), pResolution->nDx) - FloorDivPow2(nTileResX0, pResolution->nDx);
nPRC_j = FloorDivPow2(CeilDiv(pPI->nY, pComponent->nDy << nLevel), pResolution->nDy) - FloorDivPow2(nTileResY0, pResolution->nDy);
pPI->nIndexPrecinct = nPRC_i + nPRC_j * pResolution->nWidth;
for (pPI->nIndexLayer = 0; pPI->nIndexLayer < pPI->oPOC.nLYEpoc; pPI->nIndexLayer++)
......@@ -367,9 +366,8 @@ namespace Jpeg2000
return false;
}
//-------------------------------------------------------------------------------------------------------------------------------
//
// Основные функции
//-------------------------------------------------------------------------------------------------------------------------------
void PI_Destroy(PacketIterator *pPI, CodingParams *pCodingParams, int nTileIndex)
{
......
#pragma once
#pragma once
#include "Types.h"
#include "Utils.h"
......
#include "Types.h"
#include "Types.h"
#include "Reader.h"
namespace Jpeg2000
......@@ -42,7 +42,7 @@ namespace Jpeg2000
return *pStream->pCurPos++;
}
//-------------------------------------------------------------------------------------------------------------------------------
//
// Основные функции
//-------------------------------------------------------------------------------------------------------------------------------
ByteIO* ByteIO_Open(PCommon pInfo, unsigned char *pBuffer, int nLength)
{
......@@ -62,7 +62,7 @@ namespace Jpeg2000
}
else if (!pBuffer && !nLength && pInfo)
{
//
// Выделяем память для закодировнного изображения
pStream->nMode = STREAM_WRITE;
switch (pInfo->eCodecFormat)
{
......@@ -90,7 +90,7 @@ namespace Jpeg2000
return NULL;
}
//
// Инициализируем поток
pStream->pStart = pStream->pBuffer;
pStream->pEnd = pStream->pBuffer + pStream->nLength;
pStream->pCurPos = pStream->pBuffer;
......
#pragma once
#pragma once
#include "../../common/File.h"
......@@ -8,18 +8,18 @@ namespace Jpeg2000
// Byte input-output (Stream IO)
//-------------------------------------------------------------------------------------------------------------------------------
#define STREAM_READ 0x0001 //
#define STREAM_WRITE 0x0002 //
#define STREAM_READ 0x0001 // Поток открыт для чтения
#define STREAM_WRITE 0x0002 // Поток открыт для записи
typedef struct TByteIO
{
int nMode; // ( STREAM_READ OPJ_STREAM_WRITE )
unsigned char *pBuffer; //
int nLength; //
int nMode; // Чтение или запись ( STREAM_READ или OPJ_STREAM_WRITE )
unsigned char *pBuffer; // Указатель на начало буфера
int nLength; // Размер буфера в байтах
unsigned char *pStart; //
unsigned char *pEnd; //
unsigned char *pCurPos; //
unsigned char *pStart; // Указатель на начало потока
unsigned char *pEnd; // Указатель на конец потока
unsigned char *pCurPos; // Указатель не текущую позицию в потоке
} ByteIO;
......
#pragma once
#pragma once
#include "Types.h"
#include "JpgEvent.h"
......@@ -11,7 +11,7 @@ namespace Jpeg2000
//-------------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------------
//
// Вспомогательные функции
//-------------------------------------------------------------------------------------------------------------------------------
static int BitIO_ByteOut(BitIO *pBIO)
{
......@@ -61,7 +61,7 @@ namespace Jpeg2000
//-------------------------------------------------------------------------------------------------------------------------------
//
// Основные функции
//-------------------------------------------------------------------------------------------------------------------------------
BitIO* BitIO_Create()
{
......
#pragma once
#pragma once
#include "Stream.h"
......@@ -39,7 +39,7 @@ namespace Jpeg2000
anVer[nLevelsCount + 1] = (anVer[nLevelsCount] + 1) / 2;
pTree->nNodesCount += nCurLevelCount;
++nLevelsCount;
// TO DO: ( nLevelsCount + 1 < 32 )
// TO DO: ѕоставить дополнительную проверку ( nLevelsCount + 1 < 32 )
} while (nCurLevelCount > 1);
// ADD
......
#pragma once
#pragma once
#include "DWT.h"
#include "ArithmeticCoder.h"
......@@ -7,7 +7,7 @@
namespace Jpeg2000
{
//-------------------------------------------------------------------------------------------------------------------------------
//
// Вспомогательные функции
//-------------------------------------------------------------------------------------------------------------------------------
static int Tier1_GetContextIndexZC(Tier1 *pTier1, int nF, int nOrient)
......@@ -273,6 +273,7 @@ namespace Jpeg2000
{
MQCoder *pMQCoder = pTier1->pMQCoder;
int nFlag = nVSC ? ((*pFlags) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*pFlags);
int nValue = 0;
if (nPartial)
{
goto LABEL_PARTIAL;
......@@ -280,7 +281,7 @@ namespace Jpeg2000
if (!(*pFlags & (T1_SIG | T1_VISIT)))
{
MQC_SetCurContext(pMQCoder, Tier1_GetContextIndexZC(pTier1, nFlag, nOrient));
int nValue = abs(*pData) & nOne ? 1 : 0;
nValue = abs(*pData) & nOne ? 1 : 0;
MQC_Encode(pMQCoder, nValue);
if (nValue)
{
......@@ -295,11 +296,11 @@ namespace Jpeg2000
}
*pFlags &= ~T1_VISIT;
}
static void Tier1_DecoderClnPassStep(Tier1 *pTier1, int *pFlags, int *pData, int nOrient, int nOnePlusHalf, int nPartial, int nVSC)
{
MQCoder *pMQCoder = pTier1->pMQCoder;
int nFlag = nVSC ? ((*pFlags) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*pFlags);
int nValue = 0;
if (nPartial)
{
goto LABEL_PARTIAL;
......@@ -311,7 +312,7 @@ namespace Jpeg2000
{
LABEL_PARTIAL:
MQC_SetCurContext(pMQCoder, Tier1_GetContextIndexSC(pTier1, nFlag));
int nValue = MQC_Decode(pMQCoder) ^ Tier1_GetSPB(pTier1, nFlag);
nValue = MQC_Decode(pMQCoder) ^ Tier1_GetSPB(pTier1, nFlag);
*pData = nValue ? -nOnePlusHalf : nOnePlusHalf;
Tier1_UpdateFlags(pFlags, nValue);
*pFlags |= T1_SIG;
......@@ -903,7 +904,7 @@ namespace Jpeg2000
//-------------------------------------------------------------------------------------------------------------------------------
//
// Основные функции
//-------------------------------------------------------------------------------------------------------------------------------
Tier1* Tier1_Create(PCommon pCodecInfo)
{
......@@ -932,7 +933,7 @@ namespace Jpeg2000
return NULL;
}
//
// Инициализируем таблицы
Tier1_InitLuts(pTier1);
}
return pTier1;
......
#pragma once
#pragma once
#include "Reader.h"
#include "PacketIterator.h"
......@@ -8,7 +8,7 @@
namespace Jpeg2000
{
//-------------------------------------------------------------------------------------------------------------------------------
//
// Вспомогательные функции
//-------------------------------------------------------------------------------------------------------------------------------
static void Tier2_PutCommaCode(BitIO *pBIO, int nLen)
{
......@@ -83,7 +83,7 @@ namespace Jpeg2000
unsigned char *pSOP = (unsigned char *)Malloc(6 * sizeof(unsigned char));
pSOP[0] = 255; // ff
pSOP[1] = 145; // 91
pSOP[2] = 0; // 4
pSOP[2] = 0; // Длина всегда 4 байта
pSOP[3] = 4; //
pSOP[4] = (pImageInfo->nPacketCount % 65536) / 256;
pSOP[5] = (pImageInfo->nPacketCount % 65536) % 256;
......@@ -148,13 +148,13 @@ namespace Jpeg2000
BitIO_Write(pBitStream, pLayer->nPassesCount != 0, 1);
}
// CodeBlock , CodeBlock
// Если CodeBlock не включен, тогда переходми к следующему CodeBlock
if (!pLayer->nPassesCount)
{
continue;
}
// CodeBlock --> Zero bit-planes
// Если это первое появление CodeBlock --> тогда обрабытываем информацию о Zero bit-planes
if (!pCodeBlock->nPassesCount)
{
pCodeBlock->nLenBitsCount = 3;
......@@ -319,7 +319,7 @@ namespace Jpeg2000
}
}
// SOP
// SOP маркер
if (pTCP->nCodingStyle & J2K_CP_CSTY_SOP)
{
if ((*pSrcPointer) != 0xff || (*(pSrcPointer + 1) != 0x91))
......@@ -331,10 +331,10 @@ namespace Jpeg2000
pSrcPointer += 6;
}
// TO DO : Nsop
// TO DO : Добавить проверку значения Nsop
}
// PPT/PPM, Packet header PPT/PPM.
// Когда используются пакеты PPT/PPM, Packet header хранится в маркерах PPT/PPM.
BitIO *pBitStream = BitIO_Create();
if (!pBitStream)
......@@ -350,7 +350,7 @@ namespace Jpeg2000
pBuffer = pTCP->pPPTData;
BitIO_InitDecoder(pBitStream, pBuffer, pTCP->nPPTLength);
}
else //
else // Обычный случай
{
pBuffer = pSrcPointer;
BitIO_InitDecoder(pBitStream, pBuffer, pSrc + nLen - pBuffer);
......@@ -364,7 +364,7 @@ namespace Jpeg2000
pBuffer += BitIO_WrittenBytesCount(pBitStream);
BitIO_Destroy(pBitStream);
// EPH
// EPH маркер
if (pTCP->nCodingStyle & J2K_CP_CSTY_EPH)
{
if ((*pBuffer) != 0xff || (*(pBuffer + 1) != 0x92))
......@@ -407,7 +407,7 @@ namespace Jpeg2000
CodeBlock *pCodeBlock = &pPrecinct->pCodeBlocks[nCodeBlockIndex];
TCDSegment *pSegment = NULL;
// CodeBlock --> TagTree
// Если CodeBlock не был включен ранее --> TagTree
if (!pCodeBlock->nSegmentsCount)
{
nIncluded = TGT_Decode(pBitStream, pPrecinct->pInclTree, nCodeBlockIndex, nLayerIndex + 1);
......@@ -423,7 +423,7 @@ namespace Jpeg2000
continue;
}
// CodeBlock --> zero-bitplane tagtree
// Если CodeBlock не был включен ранее --> zero-bitplane tagtree
if (!pCodeBlock->nSegmentsCount)
{
int nIndex;
......@@ -475,7 +475,7 @@ namespace Jpeg2000
pBuffer += BitIO_WrittenBytesCount(pBitStream);
BitIO_Destroy(pBitStream);
// EPH
// EPH маркер
if (pTCP->nCodingStyle & J2K_CP_CSTY_EPH)
{
if ((*pBuffer) != 0xff || (*(pBuffer + 1) != 0x92))
......@@ -568,7 +568,7 @@ namespace Jpeg2000
//-------------------------------------------------------------------------------------------------------------------------------
//
// Основные функции
//-------------------------------------------------------------------------------------------------------------------------------
int Tier2_EncodePackets(Tier2 *pTier2, int nTileIndex, Tile *pTile, int nMaxLayers, unsigned char *pDst, int nLen, ImageInfo *pImageInfo)
{
......@@ -605,7 +605,7 @@ namespace Jpeg2000
pDstPointer += nShift;
}
//
// Индексация
if (pImageInfo && pImageInfo->nIndexOn)
{
if (pImageInfo->nIndexWrite)
......
This diff is collapsed.
This diff is collapsed.
#pragma once
#pragma once
namespace Jpeg2000
{
......@@ -7,9 +7,9 @@ namespace Jpeg2000
return 0;
// LARGE_INTEGER oFreq, oTime;
//// oFreq - CPU
//// oFreq - скорость часов у CPU
// QueryPerformanceFrequency( &oFreq );
// // oTime - ( oFreq)
// // oTime - текущее время(в смысле oFreq)
// QueryPerformanceCounter ( &oTime ) ;
// return ( oTime.QuadPart /(double) oFreq.QuadPart ) ;
}
......@@ -30,25 +30,25 @@ namespace Jpeg2000
return nValue;
}
// nA nB
// Делим nA на nB и округляем в большую сторону
static __inline int CeilDiv(int nA, int nB)
{
return (nA + nB - 1) / nB;
}
// nA 2^nB
// Делим nA на 2^nB и округляем в большую сторону
static __inline int CeilDivPow2(int nA, int nB)
{
return (nA + (1 << nB) - 1) >> nB;
}
// nA 2^nB
// Делим nA на 2^nB и округляем в меньшую сторону
static __inline int FloorDivPow2(int nA, int nB)
{
return nA >> nB;
}
// 2 nA
// Берем логарифм по основанию 2 от числа nA и округляем в меньшую сторону
static __inline int FloorLog2(int nA)
{
int nL;
......@@ -67,7 +67,7 @@ namespace Jpeg2000
static const double c_adNormRCT[3] ={ 1.732, .8292, .8292 };
static const double c_adNormICT[3] ={ 1.732, 1.805, 1.573 };
// - (Annex G.2.1)
// Применяем обратимое много-компонентное преобразование к изображению (Annex G.2.1)
static void ForwardRCT(int *pRed, int *pGreen, int *pBlue, int nSamplesCount)
{
for (int nIndex = 0; nIndex < nSamplesCount; nIndex++)
......@@ -85,7 +85,7 @@ namespace Jpeg2000
}
}
// - (Annex G.2.2)
// Применяем обратимое много-компонентное обратное преобазование к изображению (Annex G.2.2)
static void InverseRCT(int *pRed, int *pGreen, int *pBlue, int nSamplesCount)
{
for (int nIndex = 0; nIndex < nSamplesCount; nIndex++)
......@@ -109,7 +109,7 @@ namespace Jpeg2000
return c_adNormRCT[nComponentIndex];
}
// - (Annex G.3.1)
// Применяем необратимое много-компонентное преобразование к изображению (Annex G.3.1)
static void ForwardICT(int *pRed, int *pGreen, int *pBlue, int nSamplesCount)
{
for (int nIndex = 0; nIndex < nSamplesCount; nIndex++)
......@@ -127,7 +127,7 @@ namespace Jpeg2000
}
}
// - (Annex G.3.2)
// Применяем необратимое много-компонентное обратное преобазование к изображению (Annex G.3.2)
static void InverseICT(int *pRed, int *pGreen, int *pBlue, int nSamplesCount)
{
for (int nIndex = 0; nIndex < nSamplesCount; nIndex++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment