MCPcopy Create free account
hub / github.com/OSGeo/gdal / DumpRESxBox

Function DumpRESxBox

gcore/gdaljp2structure.cpp:713–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711}
712
713static void DumpRESxBox(CPLXMLNode *psBox, GDALJP2Box &oBox,
714 DumpContext *psDumpContext)
715{
716 GIntBig nBoxDataLength = oBox.GetDataLength();
717 GByte *pabyBoxData = oBox.ReadBoxData();
718 char chC = oBox.GetType()[3];
719 if (pabyBoxData)
720 {
721 CPLXMLNode *psDecodedContent =
722 CPLCreateXMLNode(psBox, CXT_Element, "DecodedContent");
723 GIntBig nRemainingLength = nBoxDataLength;
724 GByte *pabyIter = pabyBoxData;
725 GUInt16 nNumV = 0;
726 GUInt16 nNumH = 0;
727 GUInt16 nDenomV = 1;
728 GUInt16 nDenomH = 1;
729 GUInt16 nExpV = 0;
730 GUInt16 nExpH = 0;
731 CPLXMLNode *psLastChild = nullptr;
732 if (nRemainingLength >= 2)
733 {
734 GUInt16 nVal;
735 memcpy(&nVal, pabyIter, 2);
736 CPL_MSBPTR16(&nVal);
737 nNumV = nVal;
738 AddField(psDecodedContent, psLastChild, psDumpContext,
739 CPLSPrintf("VR%cN", chC), nVal);
740 pabyIter += 2;
741 nRemainingLength -= 2;
742 }
743 if (nRemainingLength >= 2)
744 {
745 GUInt16 nVal;
746 memcpy(&nVal, pabyIter, 2);
747 CPL_MSBPTR16(&nVal);
748 nDenomV = nVal;
749 AddField(psDecodedContent, psLastChild, psDumpContext,
750 CPLSPrintf("VR%cD", chC), nVal);
751 pabyIter += 2;
752 nRemainingLength -= 2;
753 }
754 if (nRemainingLength >= 2)
755 {
756 GUInt16 nVal;
757 memcpy(&nVal, pabyIter, 2);
758 CPL_MSBPTR16(&nVal);
759 nNumH = nVal;
760 AddField(psDecodedContent, psLastChild, psDumpContext,
761 CPLSPrintf("HR%cN", chC), nVal);
762 pabyIter += 2;
763 nRemainingLength -= 2;
764 }
765 if (nRemainingLength >= 2)
766 {
767 GUInt16 nVal;
768 memcpy(&nVal, pabyIter, 2);
769 CPL_MSBPTR16(&nVal);
770 nDenomH = nVal;

Callers 1

Calls 9

CPLCreateXMLNodeFunction · 0.85
AddFieldFunction · 0.85
CPLSPrintfFunction · 0.85
powFunction · 0.85
AddElementFunction · 0.85
ReadBoxDataMethod · 0.80
GetDataLengthMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected