| 587 | } |
| 588 | |
| 589 | static void DumpCMAPBox(CPLXMLNode *psBox, GDALJP2Box &oBox, |
| 590 | DumpContext *psDumpContext) |
| 591 | { |
| 592 | GIntBig nBoxDataLength = oBox.GetDataLength(); |
| 593 | GByte *pabyBoxData = oBox.ReadBoxData(); |
| 594 | if (pabyBoxData) |
| 595 | { |
| 596 | CPLXMLNode *psDecodedContent = |
| 597 | CPLCreateXMLNode(psBox, CXT_Element, "DecodedContent"); |
| 598 | GIntBig nRemainingLength = nBoxDataLength; |
| 599 | GByte *pabyIter = pabyBoxData; |
| 600 | int nIndex = 0; |
| 601 | CPLXMLNode *psLastChild = nullptr; |
| 602 | while (nRemainingLength >= 2 + 1 + 1 && |
| 603 | nIndex < knbMaxJPEG2000Components) |
| 604 | { |
| 605 | GUInt16 nVal; |
| 606 | memcpy(&nVal, pabyIter, 2); |
| 607 | CPL_MSBPTR16(&nVal); |
| 608 | AddField(psDecodedContent, psLastChild, psDumpContext, |
| 609 | CPLSPrintf("CMP%d", nIndex), nVal); |
| 610 | pabyIter += 2; |
| 611 | nRemainingLength -= 2; |
| 612 | |
| 613 | AddField(psDecodedContent, psLastChild, psDumpContext, |
| 614 | CPLSPrintf("MTYP%d", nIndex), *pabyIter, |
| 615 | (*pabyIter == 0) ? "Direct use" |
| 616 | : (*pabyIter == 1) ? "Palette mapping" |
| 617 | : nullptr); |
| 618 | pabyIter += 1; |
| 619 | nRemainingLength -= 1; |
| 620 | |
| 621 | AddField(psDecodedContent, psLastChild, psDumpContext, |
| 622 | CPLSPrintf("PCOL%d", nIndex), *pabyIter); |
| 623 | pabyIter += 1; |
| 624 | nRemainingLength -= 1; |
| 625 | |
| 626 | nIndex++; |
| 627 | } |
| 628 | if (nRemainingLength > 0) |
| 629 | AddElement( |
| 630 | psDecodedContent, psLastChild, psDumpContext, |
| 631 | CPLCreateXMLElementAndValue( |
| 632 | nullptr, "RemainingBytes", |
| 633 | CPLSPrintf("%d", static_cast<int>(nRemainingLength)))); |
| 634 | } |
| 635 | CPLFree(pabyBoxData); |
| 636 | } |
| 637 | |
| 638 | static void DumpCDEFBox(CPLXMLNode *psBox, GDALJP2Box &oBox, |
| 639 | DumpContext *psDumpContext) |
no test coverage detected