1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: jpeg_MpDecoder.h 4 5 Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 46347 $ 14 *---------------------------------------------------------------------------*/ 15 16 /* Please see man pages for details 17 18 19 20 */ 21 22 #ifndef NN_JPEG_JPEGMPDECODER_H_ 23 #define NN_JPEG_JPEGMPDECODER_H_ 24 25 #include <nn/util/util_NonCopyable.h> 26 #include <nn/jpeg/CTR/jpeg_MpTypes.h> 27 28 #ifdef __cplusplus 29 30 namespace nn { 31 namespace jpeg { 32 namespace CTR { 33 34 namespace detail { 35 struct JpegMpDecoderWorkObj; 36 } 37 38 /* Please see man pages for details 39 40 */ 41 class JpegMpDecoder : private nn::util::NonCopyable<JpegMpDecoder> 42 { 43 public: 44 /* Please see man pages for details 45 46 47 48 */ 49 50 /* Please see man pages for details 51 52 53 54 55 56 */ 57 static size_t GetWorkBufferSize(); 58 59 /* Please see man pages for details 60 61 62 63 */ JpegMpDecoder()64 JpegMpDecoder() : m_Initialized(false) {} 65 66 /* Please see man pages for details 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 */ 86 bool Initialize(void* workBuffer, size_t workBufferSize); 87 88 /* Please see man pages for details 89 90 91 92 */ Finalize()93 void Finalize() { m_Initialized = false; } 94 95 /* Please see man pages for details 96 97 98 */ ~JpegMpDecoder()99 ~JpegMpDecoder() { Finalize(); } 100 101 /* Please see man pages for details 102 103 104 105 106 107 */ 108 109 /* Please see man pages for details 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 */ GetDstBufferSize(u32 maxWidth,u32 maxHeight,PixelFormat dstPixelFormat)136 static size_t GetDstBufferSize(u32 maxWidth, 137 u32 maxHeight, 138 PixelFormat dstPixelFormat) 139 { 140 size_t size = 0; 141 u64 size64; 142 143 switch (dstPixelFormat) 144 { 145 case PIXEL_FORMAT_YUYV8: 146 // Rounds up to a multiple of width x 2. 147 maxWidth = (maxWidth + 1) & ~1; 148 size = 2; 149 break; 150 151 case PIXEL_FORMAT_CTR_RGB565: 152 size = 2; 153 break; 154 155 case PIXEL_FORMAT_CTR_RGB565_BLOCK8: 156 // Rounds up to a multiple of width and height x 8. 157 maxWidth = (maxWidth + 7) & ~7; 158 maxHeight = (maxHeight + 7) & ~7; 159 size = 2; 160 break; 161 162 case PIXEL_FORMAT_RGB8: 163 case PIXEL_FORMAT_BGR8: 164 size = 3; 165 break; 166 167 case PIXEL_FORMAT_CTR_RGB8_BLOCK8: 168 maxWidth = (maxWidth + 7) & ~7; 169 maxHeight = (maxHeight + 7) & ~7; 170 size = 3; 171 break; 172 173 case PIXEL_FORMAT_RGBA8: 174 case PIXEL_FORMAT_ABGR8: 175 size = 4; 176 break; 177 178 case PIXEL_FORMAT_CTR_RGBA8_BLOCK8: 179 maxWidth = (maxWidth + 7) & ~7; 180 maxHeight = (maxHeight + 7) & ~7; 181 size = 4; 182 break; 183 184 default: 185 // unexpected format 186 size = 0; 187 break; 188 } 189 190 size64 = static_cast<u64>(size) * maxWidth * maxHeight; 191 size = static_cast<size_t>(size64); 192 193 if (size != size64) 194 { 195 size = 0; 196 } 197 198 return size; 199 } 200 201 /* Please see man pages for details 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 */ SetOutputBufferWidth(u32 width)231 void SetOutputBufferWidth(u32 width) 232 { 233 if (m_Initialized) 234 { 235 if (width <= MAX_DECODER_OUTPUT_BUFFER_WIDTH) 236 { 237 m_TemporarySetting.outputBufferWidth = width; 238 } 239 } 240 } 241 242 /* Please see man pages for details 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 */ SetOption(u32 option)262 void SetOption(u32 option) 263 { 264 if (m_Initialized) 265 { 266 m_TemporarySetting.option = option; 267 } 268 } 269 270 /* Please see man pages for details 271 272 273 274 */ GetOption()275 u32 GetOption() 276 { 277 if (m_Initialized) 278 { 279 return m_TemporarySetting.option; 280 } 281 282 return JPEG_DECODER_OPTION_NONE; 283 } 284 285 /* Please see man pages for details 286 287 288 289 290 291 */ 292 293 /* Please see man pages for details 294 295 296 297 */ DoNotCallMe1()298 static void DoNotCallMe1() {} 299 300 /* Please see man pages for details 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 */ 344 size_t StartJpegDecoder(void* dst, 345 size_t dstSize, 346 const u8* src, 347 size_t srcSize, 348 u32 maxWidth, 349 u32 maxHeight, 350 PixelFormat dstPixelFormat, 351 bool decodeThumbnail); 352 353 /* Please see man pages for details 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 */ 420 size_t StartJpegDecoderShrink(void* dst, 421 size_t dstSize, 422 const u8* src, 423 size_t srcSize, 424 u32 maxWidth, 425 u32 maxHeight, 426 PixelFormat dstPixelFormat, 427 bool decodeThumbnail, 428 u32 shrinkLevel); 429 430 /* Please see man pages for details 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 */ 505 size_t StartMpDecoderLR(void* dstL, 506 void* dstR, 507 size_t dstSize, 508 const u8* src, 509 size_t srcSize, 510 u32 maxWidth, 511 u32 maxHeight, 512 PixelFormat dstPixelFormat); 513 514 /* Please see man pages for details 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 */ 550 void StopDecoder(); 551 552 /* Please see man pages for details 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 */ 591 bool ExtractExif(const u8* src, size_t srcSize, bool extractThumbnail); 592 593 /* Please see man pages for details 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 */ 624 bool GetMpRegionsToBuildJpegData(MpRegionsToBuildJpegData* pBuffer, const u8* src, size_t srcSize); 625 626 /* Please see man pages for details 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 */ 645 s32 GetLastError() const; 646 647 /* Please see man pages for details 648 649 650 651 652 653 */ 654 655 /* Please see man pages for details 656 657 658 659 */ DoNotCallMe2()660 static void DoNotCallMe2() {} 661 662 /* Please see man pages for details 663 664 665 666 667 668 */ 669 u32 GetLastWidth() const; 670 671 /* Please see man pages for details 672 673 674 675 676 677 */ 678 u32 GetLastHeight() const; 679 680 /* Please see man pages for details 681 682 683 684 685 686 687 688 689 690 */ 691 u32 GetLastOutputBufferWidth() const; 692 693 /* Please see man pages for details 694 695 696 697 698 699 700 701 */ 702 u32 GetLastOutputBufferHeight() const; 703 704 /* Please see man pages for details 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 */ 720 size_t GetLastDateTime(char* pBuffer) const; 721 722 /* Please see man pages for details 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 */ 738 const char* GetLastDateTimePointer() const; 739 740 /* Please see man pages for details 741 742 743 744 745 746 747 748 749 750 751 752 753 */ 754 const char* GetLastSoftwarePointer() const; 755 756 /* Please see man pages for details 757 758 759 760 761 762 763 764 765 766 767 768 769 */ 770 size_t GetLastSoftwareLength() const; 771 772 /* Please see man pages for details 773 774 775 776 777 778 779 780 781 782 783 784 785 786 */ 787 const u8* GetLastUserMakerNotePointer() const; 788 789 /* Please see man pages for details 790 791 792 793 794 795 796 797 798 799 800 801 802 803 */ 804 size_t GetLastUserMakerNoteSize() const; 805 806 /* Please see man pages for details 807 808 809 810 811 812 813 814 815 816 817 818 819 820 */ 821 bool GetLastTwlPhotoMakerNote(u8* pBuffer) const; 822 823 /* Please see man pages for details 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 */ 841 const u8* GetLastTwlUserMakerNotePointer() const; 842 843 /* Please see man pages for details 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 */ 860 size_t GetLastTwlUserMakerNoteSize() const; 861 862 /* Please see man pages for details 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 */ 879 size_t GetLastImageUid(char* pBuffer); 880 881 /* Please see man pages for details 882 883 884 885 886 887 888 889 890 891 892 */ 893 bool GetLastOrientation(u16* pBuffer); 894 895 /* Please see man pages for details 896 897 898 899 900 901 */ 902 903 /* Please see man pages for details 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 */ 927 bool GetMpIndex(MpIndex* pIndex, const u8* src, size_t srcSize); 928 929 /* Please see man pages for details 930 931 932 933 934 935 936 937 938 939 */ GetMpNumberOfImages(u32 * pNumber,const MpIndex * pIndex)940 static bool GetMpNumberOfImages(u32* pNumber, const MpIndex* pIndex) 941 { 942 NN_ASSERT(pNumber); 943 NN_ASSERT(pIndex); 944 945 if (pIndex->isNumberOfImagesValid) 946 { 947 *pNumber = pIndex->numberOfImages; 948 return true; 949 } 950 951 return false; 952 } 953 954 /* Please see man pages for details 955 956 957 958 959 960 961 962 963 964 965 966 */ GetMpImageUidListSize(const MpIndex * pIndex)967 static size_t GetMpImageUidListSize(const MpIndex* pIndex) 968 { 969 NN_ASSERT(pIndex); 970 971 if (pIndex->imageUidListSize && pIndex->offsetToImageUidList) 972 { 973 return pIndex->imageUidListSize; 974 } 975 976 return 0; 977 } 978 979 /* Please see man pages for details 980 981 982 983 984 985 986 987 988 989 990 991 992 993 */ GetMpImageUidListOffset(const MpIndex * pIndex)994 static size_t GetMpImageUidListOffset(const MpIndex* pIndex) 995 { 996 NN_ASSERT(pIndex); 997 998 if (pIndex->imageUidListSize && pIndex->offsetToImageUidList) 999 { 1000 return pIndex->offsetToImageUidList; 1001 } 1002 1003 return 0; 1004 } 1005 1006 /* Please see man pages for details 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 */ GetMpTotalFrames(u32 * pFrames,const MpIndex * pIndex)1019 static bool GetMpTotalFrames(u32* pFrames, const MpIndex* pIndex) 1020 { 1021 NN_ASSERT(pFrames); 1022 NN_ASSERT(pIndex); 1023 1024 if (pIndex->isTotalFramesValid) 1025 { 1026 *pFrames = pIndex->totalFrames; 1027 return true; 1028 } 1029 1030 return false; 1031 } 1032 1033 /* Please see man pages for details 1034 1035 1036 1037 1038 1039 */ 1040 1041 /* Please see man pages for details 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 */ 1064 static bool GetMpEntry(MpEntry* pEntry, const MpIndex* pIndex, u32 index); 1065 1066 /* Please see man pages for details 1067 1068 1069 1070 1071 1072 1073 1074 */ GetMpImageType(const MpEntry * pEntry)1075 static u32 GetMpImageType(const MpEntry* pEntry) 1076 { 1077 NN_ASSERT(pEntry); 1078 return pEntry->type; 1079 } 1080 1081 /* Please see man pages for details 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 */ GetMpImageSize(const MpEntry * pEntry)1092 static size_t GetMpImageSize(const MpEntry* pEntry) 1093 { 1094 NN_ASSERT(pEntry); 1095 return pEntry->imageDataSize; 1096 } 1097 1098 /* Please see man pages for details 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 */ GetMpImageOffset(const MpEntry * pEntry)1111 static size_t GetMpImageOffset(const MpEntry* pEntry) 1112 { 1113 NN_ASSERT(pEntry); 1114 return pEntry->offsetToImageData; 1115 } 1116 1117 /* Please see man pages for details 1118 1119 1120 1121 1122 1123 1124 */ GetMpDependentImage1EntryNum(const MpEntry * pEntry)1125 static u16 GetMpDependentImage1EntryNum(const MpEntry* pEntry) 1126 { 1127 NN_ASSERT(pEntry); 1128 return pEntry->dependentImage1EntryNum; 1129 } 1130 1131 /* Please see man pages for details 1132 1133 1134 1135 1136 1137 1138 */ GetMpDependentImage2EntryNum(const MpEntry * pEntry)1139 static u16 GetMpDependentImage2EntryNum(const MpEntry* pEntry) 1140 { 1141 NN_ASSERT(pEntry); 1142 return pEntry->dependentImage2EntryNum; 1143 } 1144 1145 /* Please see man pages for details 1146 1147 1148 1149 1150 1151 */ 1152 1153 /* Please see man pages for details 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 */ 1181 bool GetMpAttribute(MpAttribute* pAttr, const u8* src, size_t srcSize); 1182 1183 /* Please see man pages for details 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 */ GetMpIndividualNum(u32 * pBuffer,const MpAttribute * pAttr)1194 static bool GetMpIndividualNum(u32* pBuffer, const MpAttribute* pAttr) 1195 { 1196 NN_ASSERT(pBuffer); 1197 NN_ASSERT(pAttr); 1198 1199 if (pAttr->isMpIndividualNumValid) 1200 { 1201 *pBuffer = pAttr->mpIndividualNum; 1202 return true; 1203 } 1204 1205 return false; 1206 } 1207 1208 /* Please see man pages for details 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 */ GetMpPanOrientation(u32 * pBuffer,const MpAttribute * pAttr)1219 static bool GetMpPanOrientation(u32* pBuffer, const MpAttribute* pAttr) 1220 { 1221 NN_ASSERT(pBuffer); 1222 NN_ASSERT(pAttr); 1223 1224 if (pAttr->isPanOrientationValid) 1225 { 1226 *pBuffer = pAttr->panOrientation; 1227 return true; 1228 } 1229 1230 return false; 1231 } 1232 1233 /* Please see man pages for details 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 */ GetMpPanOverlapH(Rational * pBuffer,const MpAttribute * pAttr)1244 static bool GetMpPanOverlapH(Rational* pBuffer, const MpAttribute* pAttr) 1245 { 1246 NN_ASSERT(pBuffer); 1247 NN_ASSERT(pAttr); 1248 1249 if (pAttr->isPanOverlapHValid) 1250 { 1251 *pBuffer = pAttr->panOverlapH; 1252 return true; 1253 } 1254 1255 return false; 1256 } 1257 1258 /* Please see man pages for details 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 */ GetMpPanOverlapV(Rational * pBuffer,const MpAttribute * pAttr)1269 static bool GetMpPanOverlapV(Rational* pBuffer, const MpAttribute* pAttr) 1270 { 1271 NN_ASSERT(pBuffer); 1272 NN_ASSERT(pAttr); 1273 1274 if (pAttr->isPanOverlapVValid) 1275 { 1276 *pBuffer = pAttr->panOverlapV; 1277 return true; 1278 } 1279 1280 return false; 1281 } 1282 1283 /* Please see man pages for details 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 */ GetMpBaseViewpointNum(u32 * pBuffer,const MpAttribute * pAttr)1294 static bool GetMpBaseViewpointNum(u32* pBuffer, const MpAttribute* pAttr) 1295 { 1296 NN_ASSERT(pBuffer); 1297 NN_ASSERT(pAttr); 1298 1299 if (pAttr->isBaseViewpointNumValid) 1300 { 1301 *pBuffer = pAttr->baseViewpointNum; 1302 return true; 1303 } 1304 1305 return false; 1306 } 1307 1308 /* Please see man pages for details 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 */ GetMpConvergenceAngle(Srational * pBuffer,const MpAttribute * pAttr)1319 static bool GetMpConvergenceAngle(Srational* pBuffer, const MpAttribute* pAttr) 1320 { 1321 NN_ASSERT(pBuffer); 1322 NN_ASSERT(pAttr); 1323 1324 if (pAttr->isConvergenceAngleValid) 1325 { 1326 *pBuffer = pAttr->convergenceAngle; 1327 return true; 1328 } 1329 1330 return false; 1331 } 1332 1333 /* Please see man pages for details 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 */ GetMpBaselineLength(Rational * pBuffer,const MpAttribute * pAttr)1344 static bool GetMpBaselineLength(Rational* pBuffer, const MpAttribute* pAttr) 1345 { 1346 NN_ASSERT(pBuffer); 1347 NN_ASSERT(pAttr); 1348 1349 if (pAttr->isBaselineLengthValid) 1350 { 1351 *pBuffer = pAttr->baselineLength; 1352 return true; 1353 } 1354 1355 return false; 1356 } 1357 1358 /* Please see man pages for details 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 */ GetMpVerticalDivergence(Srational * pBuffer,const MpAttribute * pAttr)1369 static bool GetMpVerticalDivergence(Srational* pBuffer, const MpAttribute* pAttr) 1370 { 1371 NN_ASSERT(pBuffer); 1372 NN_ASSERT(pAttr); 1373 1374 if (pAttr->isVerticalDivergenceValid) 1375 { 1376 *pBuffer = pAttr->verticalDivergence; 1377 return true; 1378 } 1379 1380 return false; 1381 } 1382 1383 /* Please see man pages for details 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 */ GetMpAxisDistanceX(Srational * pBuffer,const MpAttribute * pAttr)1394 static bool GetMpAxisDistanceX(Srational* pBuffer, const MpAttribute* pAttr) 1395 { 1396 NN_ASSERT(pBuffer); 1397 NN_ASSERT(pAttr); 1398 1399 if (pAttr->isAxisDistanceXValid) 1400 { 1401 *pBuffer = pAttr->axisDistanceX; 1402 return true; 1403 } 1404 1405 return false; 1406 } 1407 1408 /* Please see man pages for details 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 */ GetMpAxisDistanceY(Srational * pBuffer,const MpAttribute * pAttr)1419 static bool GetMpAxisDistanceY(Srational* pBuffer, const MpAttribute* pAttr) 1420 { 1421 NN_ASSERT(pBuffer); 1422 NN_ASSERT(pAttr); 1423 1424 if (pAttr->isAxisDistanceYValid) 1425 { 1426 *pBuffer = pAttr->axisDistanceY; 1427 return true; 1428 } 1429 1430 return false; 1431 } 1432 1433 /* Please see man pages for details 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 */ GetMpAxisDistanceZ(Srational * pBuffer,const MpAttribute * pAttr)1444 static bool GetMpAxisDistanceZ(Srational* pBuffer, const MpAttribute* pAttr) 1445 { 1446 NN_ASSERT(pBuffer); 1447 NN_ASSERT(pAttr); 1448 1449 if (pAttr->isAxisDistanceZValid) 1450 { 1451 *pBuffer = pAttr->axisDistanceZ; 1452 return true; 1453 } 1454 1455 return false; 1456 } 1457 1458 /* Please see man pages for details 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 */ GetMpYawAngle(Srational * pBuffer,const MpAttribute * pAttr)1469 static bool GetMpYawAngle(Srational* pBuffer, const MpAttribute* pAttr) 1470 { 1471 NN_ASSERT(pBuffer); 1472 NN_ASSERT(pAttr); 1473 1474 if (pAttr->isYawAngleValid) 1475 { 1476 *pBuffer = pAttr->yawAngle; 1477 return true; 1478 } 1479 1480 return false; 1481 } 1482 1483 /* Please see man pages for details 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 */ GetMpPitchAngle(Srational * pBuffer,const MpAttribute * pAttr)1494 static bool GetMpPitchAngle(Srational* pBuffer, const MpAttribute* pAttr) 1495 { 1496 NN_ASSERT(pBuffer); 1497 NN_ASSERT(pAttr); 1498 1499 if (pAttr->isPitchAngleValid) 1500 { 1501 *pBuffer = pAttr->pitchAngle; 1502 return true; 1503 } 1504 1505 return false; 1506 } 1507 1508 /* Please see man pages for details 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 */ GetMpRollAngle(Srational * pBuffer,const MpAttribute * pAttr)1519 static bool GetMpRollAngle(Srational* pBuffer, const MpAttribute* pAttr) 1520 { 1521 NN_ASSERT(pBuffer); 1522 NN_ASSERT(pAttr); 1523 1524 if (pAttr->isRollAngleValid) 1525 { 1526 *pBuffer = pAttr->rollAngle; 1527 return true; 1528 } 1529 1530 return false; 1531 } 1532 1533 /* Please see man pages for details 1534 1535 1536 1537 1538 1539 */ 1540 1541 /* Please see man pages for details 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 */ 1554 bool GetLastGpsData(GpsData* pBuffer); 1555 1556 /* Please see man pages for details 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 */ GetGpsVersionId(const GpsData * pGps)1567 static const u8* GetGpsVersionId(const GpsData* pGps) 1568 { 1569 NN_ASSERT(pGps); 1570 1571 return pGps->isVersionIdValid ? pGps->versionId : NULL; 1572 } 1573 1574 /* Please see man pages for details 1575 1576 1577 1578 1579 1580 1581 1582 */ GetGpsLatitudeRef(const GpsData * pGps)1583 static char GetGpsLatitudeRef(const GpsData* pGps) 1584 { 1585 NN_ASSERT(pGps); 1586 1587 return pGps->latitudeRef[0]; 1588 } 1589 1590 /* Please see man pages for details 1591 1592 1593 1594 1595 1596 1597 1598 */ GetGpsLatitude(const GpsData * pGps)1599 static const Rational* GetGpsLatitude(const GpsData* pGps) 1600 { 1601 NN_ASSERT(pGps); 1602 1603 return pGps->isLatitudeValid ? pGps->latitude : NULL; 1604 } 1605 1606 /* Please see man pages for details 1607 1608 1609 1610 1611 1612 1613 1614 */ GetGpsLongitudeRef(const GpsData * pGps)1615 static char GetGpsLongitudeRef(const GpsData* pGps) 1616 { 1617 NN_ASSERT(pGps); 1618 1619 return pGps->longitudeRef[0]; 1620 } 1621 1622 /* Please see man pages for details 1623 1624 1625 1626 1627 1628 1629 1630 */ GetGpsLongitude(const GpsData * pGps)1631 static const Rational* GetGpsLongitude(const GpsData* pGps) 1632 { 1633 NN_ASSERT(pGps); 1634 1635 return pGps->isLongitudeValid ? pGps->longitude : NULL; 1636 } 1637 1638 /* Please see man pages for details 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 */ GetGpsAltitudeRef(u8 * pBuffer,const GpsData * pGps)1649 static bool GetGpsAltitudeRef(u8* pBuffer, const GpsData* pGps) 1650 { 1651 NN_ASSERT(pBuffer); 1652 NN_ASSERT(pGps); 1653 1654 if (pGps->isAltitudeRefValid) 1655 { 1656 *pBuffer = pGps->altitudeRef; 1657 } 1658 1659 return pGps->isAltitudeRefValid; 1660 } 1661 1662 /* Please see man pages for details 1663 1664 1665 1666 1667 1668 1669 1670 */ GetGpsAltitude(const GpsData * pGps)1671 static const Rational* GetGpsAltitude(const GpsData* pGps) 1672 { 1673 NN_ASSERT(pGps); 1674 1675 return pGps->isAltitudeValid ? (&pGps->altitude) : NULL; 1676 } 1677 1678 /* Please see man pages for details 1679 1680 1681 1682 1683 1684 1685 1686 */ GetGpsTimeStamp(const GpsData * pGps)1687 static const Rational* GetGpsTimeStamp(const GpsData* pGps) 1688 { 1689 NN_ASSERT(pGps); 1690 1691 return pGps->isTimeStampValid ? pGps->timeStamp : NULL; 1692 } 1693 1694 /* Please see man pages for details 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 */ GetGpsSatellites(const GpsData * pGps)1707 static const char* GetGpsSatellites(const GpsData* pGps) 1708 { 1709 NN_ASSERT(pGps); 1710 1711 return pGps->pSatellites; 1712 } 1713 1714 /* Please see man pages for details 1715 1716 1717 1718 1719 1720 1721 1722 */ GetGpsStatus(const GpsData * pGps)1723 static char GetGpsStatus(const GpsData* pGps) 1724 { 1725 NN_ASSERT(pGps); 1726 1727 return pGps->status[0]; 1728 } 1729 1730 /* Please see man pages for details 1731 1732 1733 1734 1735 1736 1737 1738 */ GetGpsMeasureMode(const GpsData * pGps)1739 static char GetGpsMeasureMode(const GpsData* pGps) 1740 { 1741 NN_ASSERT(pGps); 1742 1743 return pGps->measureMode[0]; 1744 } 1745 1746 /* Please see man pages for details 1747 1748 1749 1750 1751 1752 1753 1754 */ GetGpsDop(const GpsData * pGps)1755 static const Rational* GetGpsDop(const GpsData* pGps) 1756 { 1757 NN_ASSERT(pGps); 1758 1759 return pGps->isDopValid ? (&pGps->dop) : NULL; 1760 } 1761 1762 /* Please see man pages for details 1763 1764 1765 1766 1767 1768 1769 1770 */ GetGpsSpeedRef(const GpsData * pGps)1771 static char GetGpsSpeedRef(const GpsData* pGps) 1772 { 1773 NN_ASSERT(pGps); 1774 1775 return pGps->speedRef[0]; 1776 } 1777 1778 /* Please see man pages for details 1779 1780 1781 1782 1783 1784 1785 1786 */ GetGpsSpeed(const GpsData * pGps)1787 static const Rational* GetGpsSpeed(const GpsData* pGps) 1788 { 1789 NN_ASSERT(pGps); 1790 1791 return pGps->isSpeedValid ? (&pGps->speed) : NULL; 1792 } 1793 1794 /* Please see man pages for details 1795 1796 1797 1798 1799 1800 1801 1802 */ GetGpsTrackRef(const GpsData * pGps)1803 static char GetGpsTrackRef(const GpsData* pGps) 1804 { 1805 NN_ASSERT(pGps); 1806 1807 return pGps->trackRef[0]; 1808 } 1809 1810 /* Please see man pages for details 1811 1812 1813 1814 1815 1816 1817 1818 */ GetGpsTrack(const GpsData * pGps)1819 static const Rational* GetGpsTrack(const GpsData* pGps) 1820 { 1821 NN_ASSERT(pGps); 1822 1823 return pGps->isTrackValid ? (&pGps->track) : NULL; 1824 } 1825 1826 /* Please see man pages for details 1827 1828 1829 1830 1831 1832 1833 1834 */ GetGpsImgDirectionRef(const GpsData * pGps)1835 static char GetGpsImgDirectionRef(const GpsData* pGps) 1836 { 1837 NN_ASSERT(pGps); 1838 1839 return pGps->imgDirectionRef[0]; 1840 } 1841 1842 /* Please see man pages for details 1843 1844 1845 1846 1847 1848 1849 1850 */ GetGpsImgDirection(const GpsData * pGps)1851 static const Rational* GetGpsImgDirection(const GpsData* pGps) 1852 { 1853 NN_ASSERT(pGps); 1854 1855 return pGps->isImgDirectionValid ? (&pGps->imgDirection) : NULL; 1856 } 1857 1858 /* Please see man pages for details 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 */ GetGpsMapDatum(const GpsData * pGps)1871 static const char* GetGpsMapDatum(const GpsData* pGps) 1872 { 1873 NN_ASSERT(pGps); 1874 1875 return pGps->pMapDatum; 1876 } 1877 1878 /* Please see man pages for details 1879 1880 1881 1882 1883 1884 1885 1886 */ GetGpsDestLatitudeRef(const GpsData * pGps)1887 static char GetGpsDestLatitudeRef(const GpsData* pGps) 1888 { 1889 NN_ASSERT(pGps); 1890 1891 return pGps->destLatitudeRef[0]; 1892 } 1893 1894 /* Please see man pages for details 1895 1896 1897 1898 1899 1900 1901 1902 */ GetGpsDestLatitude(const GpsData * pGps)1903 static const Rational* GetGpsDestLatitude(const GpsData* pGps) 1904 { 1905 NN_ASSERT(pGps); 1906 1907 return pGps->isDestLatitudeValid ? pGps->destLatitude : NULL; 1908 } 1909 1910 /* Please see man pages for details 1911 1912 1913 1914 1915 1916 1917 1918 */ GetGpsDestLongitudeRef(const GpsData * pGps)1919 static char GetGpsDestLongitudeRef(const GpsData* pGps) 1920 { 1921 NN_ASSERT(pGps); 1922 1923 return pGps->destLongitudeRef[0]; 1924 } 1925 1926 /* Please see man pages for details 1927 1928 1929 1930 1931 1932 1933 1934 */ GetGpsDestLongitude(const GpsData * pGps)1935 static const Rational* GetGpsDestLongitude(const GpsData* pGps) 1936 { 1937 NN_ASSERT(pGps); 1938 1939 return pGps->isDestLongitudeValid ? pGps->destLongitude : NULL; 1940 } 1941 1942 /* Please see man pages for details 1943 1944 1945 1946 1947 1948 1949 1950 */ GetGpsDestBearingRef(const GpsData * pGps)1951 static char GetGpsDestBearingRef(const GpsData* pGps) 1952 { 1953 NN_ASSERT(pGps); 1954 1955 return pGps->destBearingRef[0]; 1956 } 1957 1958 /* Please see man pages for details 1959 1960 1961 1962 1963 1964 1965 1966 */ GetGpsDestBearing(const GpsData * pGps)1967 static const Rational* GetGpsDestBearing(const GpsData* pGps) 1968 { 1969 NN_ASSERT(pGps); 1970 1971 return pGps->isDestBearingValid ? (&pGps->destBearing) : NULL; 1972 } 1973 1974 /* Please see man pages for details 1975 1976 1977 1978 1979 1980 1981 1982 */ GetGpsDestDistanceRef(const GpsData * pGps)1983 static char GetGpsDestDistanceRef(const GpsData* pGps) 1984 { 1985 NN_ASSERT(pGps); 1986 1987 return pGps->destDistanceRef[0]; 1988 } 1989 1990 /* Please see man pages for details 1991 1992 1993 1994 1995 1996 1997 1998 */ GetGpsDestDistance(const GpsData * pGps)1999 static const Rational* GetGpsDestDistance(const GpsData* pGps) 2000 { 2001 NN_ASSERT(pGps); 2002 2003 return pGps->isDestDistanceValid ? (&pGps->destDistance) : NULL; 2004 } 2005 2006 /* Please see man pages for details 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 */ GetGpsProcessingMethodPointer(const GpsData * pGps)2021 static const u8* GetGpsProcessingMethodPointer(const GpsData* pGps) 2022 { 2023 NN_ASSERT(pGps); 2024 2025 if (pGps->pProcessingMethod && pGps->processingMethodSize) 2026 { 2027 return pGps->pProcessingMethod; 2028 } 2029 2030 return NULL; 2031 } 2032 2033 /* Please see man pages for details 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 */ GetGpsProcessingMethodSize(const GpsData * pGps)2047 static size_t GetGpsProcessingMethodSize(const GpsData* pGps) 2048 { 2049 NN_ASSERT(pGps); 2050 2051 if (pGps->pProcessingMethod && pGps->processingMethodSize) 2052 { 2053 return pGps->processingMethodSize; 2054 } 2055 2056 return 0; 2057 } 2058 2059 /* Please see man pages for details 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 */ GetGpsAreaInformationPointer(const GpsData * pGps)2074 static const u8* GetGpsAreaInformationPointer(const GpsData* pGps) 2075 { 2076 NN_ASSERT(pGps); 2077 2078 if (pGps->pAreaInformation && pGps->areaInformationSize) 2079 { 2080 return pGps->pAreaInformation; 2081 } 2082 2083 return NULL; 2084 } 2085 2086 /* Please see man pages for details 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 */ GetGpsAreaInformationSize(const GpsData * pGps)2100 static size_t GetGpsAreaInformationSize(const GpsData* pGps) 2101 { 2102 NN_ASSERT(pGps); 2103 2104 if (pGps->pAreaInformation && pGps->areaInformationSize) 2105 { 2106 return pGps->areaInformationSize; 2107 } 2108 2109 return 0; 2110 } 2111 2112 /* Please see man pages for details 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 */ GetGpsDateStamp(const GpsData * pGps)2124 static const char* GetGpsDateStamp(const GpsData* pGps) 2125 { 2126 NN_ASSERT(pGps); 2127 2128 return pGps->pDateStamp; 2129 } 2130 2131 /* Please see man pages for details 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 */ GetGpsDifferential(u16 * pBuffer,const GpsData * pGps)2142 static bool GetGpsDifferential(u16* pBuffer, const GpsData* pGps) 2143 { 2144 NN_ASSERT(pBuffer); 2145 NN_ASSERT(pGps); 2146 2147 if (pGps->isDifferentialValid) 2148 { 2149 *pBuffer = pGps->differential; 2150 } 2151 2152 return pGps->isDifferentialValid; 2153 } 2154 2155 /* 2156 2157 */ 2158 2159 protected: 2160 detail::JpegMpDecoderWorkObj* m_pWork; 2161 bool m_Initialized; 2162 bool m_Padding[3]; 2163 2164 detail::JpegMpDecoderTemporarySettingObj m_TemporarySetting; 2165 void ClearTemporarySetting(); 2166 2167 const u8* GetLastMakerNotePointer(u32 index) const; 2168 size_t GetLastMakerNoteSize(u32 index) const; 2169 }; 2170 2171 } // namespace CTR { 2172 } // namespace jpeg { 2173 } // namespace nn { 2174 2175 #endif // __cplusplus 2176 2177 #endif // NN_JPEG_JPEGMPDECODER_H_ 2178