📄 mdjp2.cpp
字号:
/* //////////////////////////////////////////////////////////////////////////// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright(c) 2004-2005 Intel Corporation. All Rights Reserved.//////*/#include "mdjp2.h"void SetMRstrImagePalette( const DJP2BoxHeader &boxHeader, MRstrImagePalette &metaPalette){ const DJP2BoxCompMapping &boxCompMapping = boxHeader.CompMapping(); const DJP2BoxPalette &boxPalette = boxHeader.Palette(); if(boxCompMapping.IsEmpty() || boxPalette.IsEmpty()) { metaPalette.Free(); return; } Ipp16u nOfChannels = boxCompMapping.NOfChannels(); Ipp8u nOfChannelIndexes = boxPalette.NOfColumns(); Ipp16u nOfEntries = boxPalette.NOfEntries(); const JP2BitsPerComp* jp2Depth = boxPalette.BitsPerComp(); metaPalette.ReAlloc(nOfChannels, nOfChannelIndexes, nOfEntries); for(Ipp8u channel = 0; channel < nOfChannels; channel++) { Ipp16u component = boxCompMapping.CSComponent (channel); metaPalette.SetComponentIndex(channel, component); if(boxHeader.IsChannelPaletteMappingConformant(channel)) { JP2CompMapType jp2MapType = boxCompMapping.MappingType (channel); Ipp8u channelIndex = boxCompMapping.PaletteColumn(channel); const Ipp64s* jp2EntryVec = boxPalette.Entry(channelIndex); MRstrImageDepth metaDepth(jp2Depth[channelIndex].BitDepth(), jp2Depth[channelIndex].IsSigned()); metaPalette.SetIsChannelMappedDirectly(channel, jp2MapType == JP2V_DIRECT_USE); metaPalette.SetEnumChannelIndex (channel, channelIndex); metaPalette.SetEnumChannelDepth (channelIndex, metaDepth); Copy(jp2EntryVec, metaPalette.EnumChannelLUT (channelIndex), nOfEntries); } else { metaPalette.SetIsChannelMappedDirectly(channel, true); } }}inline void Convert(const JP2RefGridResolution &jp2, MRstrImageResolution &meta){ meta.SetX(MRstrImageAxisResolution(jp2.HorNumerator(), jp2.HorDenominator(), jp2.HorExponent())); meta.SetY(MRstrImageAxisResolution(jp2.VerNumerator(), jp2.VerDenominator(), jp2.VerExponent()));}void SetMRstrImageResolution( const DJP2BoxResolution &boxResolution, MRstrImageResolution &metaCaptureRes, MRstrImageResolution &metaDisplayRes){ if(!boxResolution.Capture().IsEmpty()) { Convert(boxResolution.Capture(), metaCaptureRes); metaCaptureRes.SetIsActual(true); } else metaCaptureRes.SetIsActual(false); if(!boxResolution.Display().IsEmpty()) { Convert(boxResolution.Display(), metaDisplayRes); metaDisplayRes.SetIsActual(true); } else metaDisplayRes.SetIsActual(false);}void ReAllocMetaImageComponents( const DJP2CSMainHeader &csMainHeader, MRstrImage &metaImage){ Ipp16u nOfComponents = csMainHeader.NOfComponents(); metaImage.ReAllocComponents(csMainHeader.ImageRectRG(), csMainHeader.SampleSizeRG(), nOfComponents); for(unsigned int component = 0; component < nOfComponents; component ++) { metaImage.ComponentDepth()[component].SetBitDepth(csMainHeader.BitsPerComp()[component].BitDepth()); metaImage.ComponentDepth()[component].SetSigned (csMainHeader.BitsPerComp()[component].IsSigned()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -