1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: jpeg_MpEncoder.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_JPEGMPENCODER_H_ 23 #define NN_JPEG_JPEGMPENCODER_H_ 24 25 #include <nn/util/util_NonCopyable.h> 26 #include <nn/jpeg/CTR/jpeg_MpTypes.h> 27 #include <string.h> 28 29 #ifdef __cplusplus 30 31 namespace nn { 32 namespace jpeg { 33 namespace CTR { 34 35 namespace detail { 36 struct JpegMpEncoderWorkObj; 37 } 38 39 /* Please see man pages for details 40 41 */ 42 class JpegMpEncoder : private nn::util::NonCopyable<JpegMpEncoder> 43 { 44 public: 45 /* Please see man pages for details 46 47 48 49 */ 50 51 /* Please see man pages for details 52 53 54 55 56 57 58 59 60 61 62 63 64 */ 65 static size_t GetWorkBufferSize(u32 numImages = 0); 66 67 /* Please see man pages for details 68 69 70 71 */ JpegMpEncoder()72 JpegMpEncoder() : m_Initialized(false) {} 73 74 /* Please see man pages for details 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 */ 98 bool Initialize(void* workBuffer, size_t workBufferSize, u32 numImages = 0); 99 100 /* Please see man pages for details 101 102 103 104 */ Finalize()105 void Finalize() { m_Initialized = false; } 106 107 /* Please see man pages for details 108 109 110 */ ~JpegMpEncoder()111 ~JpegMpEncoder() { Finalize(); } 112 113 /* Please see man pages for details 114 115 116 117 118 119 */ 120 121 /* Please see man pages for details 122 123 124 125 */ DoNotCallMe1()126 static void DoNotCallMe1() {} 127 128 /* Please see man pages for details 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 */ 168 void SetThumbnailSize(u32 width, u32 height, PixelSampling dstPixelSampling = DEFAULT_THUMBNAIL_PIXEL_SAMPLING) 169 { 170 if (m_Initialized) 171 { 172 m_TemporarySetting.thumbnailWidth = width; 173 m_TemporarySetting.thumbnailHeight = height; 174 m_TemporarySetting.thumbnailSampling = dstPixelSampling; 175 } 176 } 177 178 /* Please see man pages for details 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 */ SetInputBufferWidth(u32 width)210 void SetInputBufferWidth(u32 width) 211 { 212 if (m_Initialized) 213 { 214 if (width <= MAX_ENCODER_INPUT_BUFFER_WIDTH) 215 { 216 m_TemporarySetting.inputBufferWidth = width; 217 } 218 } 219 } 220 221 /* Please see man pages for details 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 */ SetOption(u32 option)274 void SetOption(u32 option) 275 { 276 if (m_Initialized) 277 { 278 m_TemporarySetting.option = option; 279 } 280 } 281 282 /* Please see man pages for details 283 284 285 286 */ GetOption()287 u32 GetOption() 288 { 289 if (m_Initialized) 290 { 291 return m_TemporarySetting.option; 292 } 293 294 return JPEG_ENCODER_OPTION_NONE; 295 } 296 297 /* Please see man pages for details 298 299 300 301 302 303 */ 304 305 /* Please see man pages for details 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 */ SetDateTime(const char * pBuffer)324 void SetDateTime(const char* pBuffer) 325 { 326 if (m_Initialized) 327 { 328 if (pBuffer) 329 { 330 memcpy(m_TemporarySetting.dateTimeBuffer, pBuffer, sizeof(m_TemporarySetting.dateTimeBuffer)); 331 m_TemporarySetting.dateTimeBuffer[sizeof(m_TemporarySetting.dateTimeBuffer) - 1] = '\0'; 332 m_TemporarySetting.isDateTimeSet = true; 333 } 334 else 335 { 336 m_TemporarySetting.isDateTimeSet = false; 337 } 338 } 339 } 340 341 /* Please see man pages for details 342 343 344 345 346 347 348 349 350 */ 351 static void GetDateTimeNow(char* pBuffer); 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 */ SetSoftware(const char * pBuffer)371 void SetSoftware(const char* pBuffer) 372 { 373 if (m_Initialized) 374 { 375 m_TemporarySetting.pSoftware = pBuffer; 376 } 377 } 378 379 /* Please see man pages for details 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 void SetUserMakerNote(const u8* pBuffer, size_t size); 409 410 /* Please see man pages for details 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 */ SetImageUid(const char * pBuffer)431 void SetImageUid(const char* pBuffer) 432 { 433 if (m_Initialized) 434 { 435 if (pBuffer) 436 { 437 memcpy(m_TemporarySetting.imageUidBuffer, pBuffer, sizeof(m_TemporarySetting.imageUidBuffer)); 438 m_TemporarySetting.imageUidBuffer[sizeof(m_TemporarySetting.imageUidBuffer) - 1] = '\0'; 439 m_TemporarySetting.isImageUidSet = true; 440 } 441 else 442 { 443 m_TemporarySetting.isImageUidSet = false; 444 } 445 } 446 } 447 448 /* Please see man pages for details 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 */ SetOrientation(u16 orientation)464 void SetOrientation(u16 orientation) 465 { 466 if (m_Initialized) 467 { 468 m_TemporarySetting.orientation = orientation; 469 m_TemporarySetting.isOrientationSet = true; 470 } 471 } 472 473 /* Please see man pages for details 474 475 476 477 */ ClearOrientation()478 void ClearOrientation() 479 { 480 if (m_Initialized) 481 { 482 m_TemporarySetting.isOrientationSet = false; 483 } 484 } 485 486 /* Please see man pages for details 487 488 489 490 491 492 */ 493 494 /* Please see man pages for details 495 496 497 498 */ DoNotCallMe2()499 static void DoNotCallMe2() {} 500 501 /* Please see man pages for details 502 503 504 505 506 507 508 509 510 511 512 513 514 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 void SetMpTypeFlags(u32 flags = 0, u16 image1 = 0, u16 image2 = 0) 543 { 544 if (m_Initialized) 545 { 546 m_TemporarySetting.isDependentParent = (flags & MP_TYPE_FLAG_DEPENDENT_IMAGE_PARENT) ? true : false; 547 m_TemporarySetting.isDependentChild = (flags & MP_TYPE_FLAG_DEPENDENT_IMAGE_CHILD) ? true : false; 548 m_TemporarySetting.isRepresentativeSet = true; 549 m_TemporarySetting.isRepresentative = (flags & MP_TYPE_FLAG_REPRESENTATIVE_IMAGE) ? true : false; 550 m_TemporarySetting.dependentImage1EntryNum = image1; 551 m_TemporarySetting.dependentImage2EntryNum = image2; 552 } 553 } 554 555 /* Please see man pages for details 556 557 558 559 560 561 */ 562 563 /* Please see man pages for details 564 565 566 567 */ DoNotCallMe3()568 static void DoNotCallMe3() {} 569 570 /* Please see man pages for details 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 */ SetMpIndividualNum(u32 value)589 void SetMpIndividualNum(u32 value) 590 { 591 if (m_Initialized) 592 { 593 m_TemporarySetting.mpAttribute.mpIndividualNum = value; 594 m_TemporarySetting.mpAttribute.isMpIndividualNumValid = true; 595 } 596 } 597 598 /* Please see man pages for details 599 600 601 602 */ ClearMpIndividualNum()603 void ClearMpIndividualNum() 604 { 605 if (m_Initialized) 606 { 607 m_TemporarySetting.mpAttribute.isMpIndividualNumValid = false; 608 } 609 } 610 611 /* Please see man pages for details 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 */ SetMpPanOrientation(u32 value)630 void SetMpPanOrientation(u32 value) 631 { 632 if (m_Initialized) 633 { 634 m_TemporarySetting.mpAttribute.panOrientation = value; 635 m_TemporarySetting.mpAttribute.isPanOrientationValid = true; 636 } 637 } 638 639 /* Please see man pages for details 640 641 642 643 */ ClearMpPanOrientation()644 void ClearMpPanOrientation() 645 { 646 if (m_Initialized) 647 { 648 m_TemporarySetting.mpAttribute.isPanOrientationValid = false; 649 } 650 } 651 652 /* Please see man pages for details 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 */ SetMpPanOverlapH(const Rational * pValue)672 void SetMpPanOverlapH(const Rational* pValue) 673 { 674 if (m_Initialized) 675 { 676 if (pValue) 677 { 678 m_TemporarySetting.mpAttribute.panOverlapH = *pValue; 679 m_TemporarySetting.mpAttribute.isPanOverlapHValid = true; 680 } 681 else 682 { 683 m_TemporarySetting.mpAttribute.isPanOverlapHValid = false; 684 } 685 } 686 } 687 688 /* Please see man pages for details 689 690 691 692 */ ClearMpPanOverlapH()693 void ClearMpPanOverlapH() { SetMpPanOverlapH(NULL); } 694 695 /* Please see man pages for details 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 */ SetMpPanOverlapV(const Rational * pValue)715 void SetMpPanOverlapV(const Rational* pValue) 716 { 717 if (m_Initialized) 718 { 719 if (pValue) 720 { 721 m_TemporarySetting.mpAttribute.panOverlapV = *pValue; 722 m_TemporarySetting.mpAttribute.isPanOverlapVValid = true; 723 } 724 else 725 { 726 m_TemporarySetting.mpAttribute.isPanOverlapVValid = false; 727 } 728 } 729 } 730 731 /* Please see man pages for details 732 733 734 735 */ ClearMpPanOverlapV()736 void ClearMpPanOverlapV() { SetMpPanOverlapV(NULL); } 737 738 /* Please see man pages for details 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 */ SetMpBaseViewpointNum(u32 value)761 void SetMpBaseViewpointNum(u32 value) 762 { 763 if (m_Initialized) 764 { 765 m_TemporarySetting.mpAttribute.baseViewpointNum = value; 766 m_TemporarySetting.mpAttribute.isBaseViewpointNumValid = true; 767 } 768 } 769 770 /* Please see man pages for details 771 772 773 774 */ ClearMpBaseViewpointNum()775 void ClearMpBaseViewpointNum() 776 { 777 if (m_Initialized) 778 { 779 m_TemporarySetting.mpAttribute.isBaseViewpointNumValid = false; 780 } 781 } 782 783 /* Please see man pages for details 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 */ SetMpConvergenceAngle(const Srational * pValue)804 void SetMpConvergenceAngle(const Srational* pValue) 805 { 806 if (m_Initialized) 807 { 808 if (pValue) 809 { 810 m_TemporarySetting.mpAttribute.convergenceAngle = *pValue; 811 m_TemporarySetting.mpAttribute.isConvergenceAngleValid = true; 812 } 813 else 814 { 815 m_TemporarySetting.mpAttribute.isConvergenceAngleValid = false; 816 } 817 } 818 } 819 820 /* Please see man pages for details 821 822 823 824 */ ClearMpConvergenceAngle()825 void ClearMpConvergenceAngle() { SetMpConvergenceAngle(NULL); } 826 827 /* Please see man pages for details 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 */ SetMpBaselineLength(const Rational * pValue)848 void SetMpBaselineLength(const Rational* pValue) 849 { 850 if (m_Initialized) 851 { 852 if (pValue) 853 { 854 m_TemporarySetting.mpAttribute.baselineLength = *pValue; 855 m_TemporarySetting.mpAttribute.isBaselineLengthValid = true; 856 } 857 else 858 { 859 m_TemporarySetting.mpAttribute.isBaselineLengthValid = false; 860 } 861 } 862 } 863 864 /* Please see man pages for details 865 866 867 868 */ ClearMpBaselineLength()869 void ClearMpBaselineLength() { SetMpBaselineLength(NULL); } 870 871 /* Please see man pages for details 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 */ SetMpVerticalDivergence(const Srational * pValue)891 void SetMpVerticalDivergence(const Srational* pValue) 892 { 893 if (m_Initialized) 894 { 895 if (pValue) 896 { 897 m_TemporarySetting.mpAttribute.verticalDivergence = *pValue; 898 m_TemporarySetting.mpAttribute.isVerticalDivergenceValid = true; 899 } 900 else 901 { 902 m_TemporarySetting.mpAttribute.isVerticalDivergenceValid = false; 903 } 904 } 905 } 906 907 /* Please see man pages for details 908 909 910 911 */ ClearMpVerticalDivergence()912 void ClearMpVerticalDivergence() { SetMpVerticalDivergence(NULL); } 913 914 /* Please see man pages for details 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 */ SetMpAxisDistanceX(const Srational * pValue)934 void SetMpAxisDistanceX(const Srational* pValue) 935 { 936 if (m_Initialized) 937 { 938 if (pValue) 939 { 940 m_TemporarySetting.mpAttribute.axisDistanceX = *pValue; 941 m_TemporarySetting.mpAttribute.isAxisDistanceXValid = true; 942 } 943 else 944 { 945 m_TemporarySetting.mpAttribute.isAxisDistanceXValid = false; 946 } 947 } 948 } 949 950 /* Please see man pages for details 951 952 953 954 */ ClearMpAxisDistanceX()955 void ClearMpAxisDistanceX() { SetMpAxisDistanceX(NULL); } 956 957 /* Please see man pages for details 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 */ SetMpAxisDistanceY(const Srational * pValue)977 void SetMpAxisDistanceY(const Srational* pValue) 978 { 979 if (m_Initialized) 980 { 981 if (pValue) 982 { 983 m_TemporarySetting.mpAttribute.axisDistanceY = *pValue; 984 m_TemporarySetting.mpAttribute.isAxisDistanceYValid = true; 985 } 986 else 987 { 988 m_TemporarySetting.mpAttribute.isAxisDistanceYValid = false; 989 } 990 } 991 } 992 993 /* Please see man pages for details 994 995 996 997 */ ClearMpAxisDistanceY()998 void ClearMpAxisDistanceY() { SetMpAxisDistanceY(NULL); } 999 1000 /* Please see man pages for details 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 */ SetMpAxisDistanceZ(const Srational * pValue)1020 void SetMpAxisDistanceZ(const Srational* pValue) 1021 { 1022 if (m_Initialized) 1023 { 1024 if (pValue) 1025 { 1026 m_TemporarySetting.mpAttribute.axisDistanceZ = *pValue; 1027 m_TemporarySetting.mpAttribute.isAxisDistanceZValid = true; 1028 } 1029 else 1030 { 1031 m_TemporarySetting.mpAttribute.isAxisDistanceZValid = false; 1032 } 1033 } 1034 } 1035 1036 /* Please see man pages for details 1037 1038 1039 1040 */ ClearMpAxisDistanceZ()1041 void ClearMpAxisDistanceZ() { SetMpAxisDistanceZ(NULL); } 1042 1043 /* Please see man pages for details 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 */ SetMpYawAngle(const Srational * pValue)1063 void SetMpYawAngle(const Srational* pValue) 1064 { 1065 if (m_Initialized) 1066 { 1067 if (pValue) 1068 { 1069 m_TemporarySetting.mpAttribute.yawAngle = *pValue; 1070 m_TemporarySetting.mpAttribute.isYawAngleValid = true; 1071 } 1072 else 1073 { 1074 m_TemporarySetting.mpAttribute.isYawAngleValid = false; 1075 } 1076 } 1077 } 1078 1079 /* Please see man pages for details 1080 1081 1082 1083 */ ClearMpYawAngle()1084 void ClearMpYawAngle() { SetMpYawAngle(NULL); } 1085 1086 /* Please see man pages for details 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 */ SetMpPitchAngle(const Srational * pValue)1106 void SetMpPitchAngle(const Srational* pValue) 1107 { 1108 if (m_Initialized) 1109 { 1110 if (pValue) 1111 { 1112 m_TemporarySetting.mpAttribute.pitchAngle = *pValue; 1113 m_TemporarySetting.mpAttribute.isPitchAngleValid = true; 1114 } 1115 else 1116 { 1117 m_TemporarySetting.mpAttribute.isPitchAngleValid = false; 1118 } 1119 } 1120 } 1121 1122 /* Please see man pages for details 1123 1124 1125 1126 */ ClearMpPitchAngle()1127 void ClearMpPitchAngle() { SetMpPitchAngle(NULL); } 1128 1129 /* Please see man pages for details 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 */ SetMpRollAngle(const Srational * pValue)1149 void SetMpRollAngle(const Srational* pValue) 1150 { 1151 if (m_Initialized) 1152 { 1153 if (pValue) 1154 { 1155 m_TemporarySetting.mpAttribute.rollAngle = *pValue; 1156 m_TemporarySetting.mpAttribute.isRollAngleValid = true; 1157 } 1158 else 1159 { 1160 m_TemporarySetting.mpAttribute.isRollAngleValid = false; 1161 } 1162 } 1163 } 1164 1165 /* Please see man pages for details 1166 1167 1168 1169 */ ClearMpRollAngle()1170 void ClearMpRollAngle() { SetMpRollAngle(NULL); } 1171 1172 /* Please see man pages for details 1173 1174 1175 1176 1177 1178 */ 1179 1180 /* Please see man pages for details 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 */ InitializeGpsData(GpsData * pGps)1204 static void InitializeGpsData(GpsData* pGps) 1205 { 1206 memset(pGps, 0, sizeof(*pGps)); 1207 // GPS tag version is 2.2. 1208 pGps->versionId[0] = 2; 1209 pGps->versionId[1] = 2; 1210 pGps->isVersionIdValid = true; 1211 } 1212 1213 /* Please see man pages for details 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 */ SetGpsVersionId(GpsData * pGps,const u8 * pVersionId)1229 static void SetGpsVersionId(GpsData* pGps, const u8* pVersionId) 1230 { 1231 NN_ASSERT(pGps); 1232 1233 if (pVersionId) 1234 { 1235 memcpy(pGps->versionId, pVersionId, sizeof(pGps->versionId)); 1236 pGps->isVersionIdValid = true; 1237 } 1238 else 1239 { 1240 pGps->isVersionIdValid = false; 1241 } 1242 } 1243 1244 /* Please see man pages for details 1245 1246 1247 1248 1249 1250 1251 1252 1253 */ ClearGpsVersionId(GpsData * pGps)1254 static void ClearGpsVersionId(GpsData* pGps) { SetGpsVersionId(pGps, NULL); } 1255 1256 /* Please see man pages for details 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 */ SetGpsLatitude(GpsData * pGps,char ref,const Rational * pValue)1272 static void SetGpsLatitude(GpsData* pGps, char ref, const Rational* pValue) 1273 { 1274 NN_ASSERT(pGps); 1275 1276 pGps->latitudeRef[0] = ref; 1277 pGps->latitudeRef[1] = '\0'; 1278 1279 if (pValue) 1280 { 1281 memcpy(pGps->latitude, pValue, sizeof(pGps->latitude)); 1282 pGps->isLatitudeValid = true; 1283 } 1284 else 1285 { 1286 pGps->isLatitudeValid = false; 1287 } 1288 } 1289 1290 /* Please see man pages for details 1291 1292 1293 1294 1295 1296 1297 1298 1299 */ ClearGpsLatitude(GpsData * pGps)1300 static void ClearGpsLatitude(GpsData* pGps) { SetGpsLatitude(pGps, '\0', NULL); } 1301 1302 /* Please see man pages for details 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 */ SetGpsLongitude(GpsData * pGps,char ref,const Rational * pValue)1318 static void SetGpsLongitude(GpsData* pGps, char ref, const Rational* pValue) 1319 { 1320 NN_ASSERT(pGps); 1321 1322 pGps->longitudeRef[0] = ref; 1323 pGps->longitudeRef[1] = '\0'; 1324 1325 if (pValue) 1326 { 1327 memcpy(pGps->longitude, pValue, sizeof(pGps->longitude)); 1328 pGps->isLongitudeValid = true; 1329 } 1330 else 1331 { 1332 pGps->isLongitudeValid = false; 1333 } 1334 } 1335 1336 /* Please see man pages for details 1337 1338 1339 1340 1341 1342 1343 1344 1345 */ ClearGpsLongitude(GpsData * pGps)1346 static void ClearGpsLongitude(GpsData* pGps) { SetGpsLongitude(pGps, '\0', NULL); } 1347 1348 /* Please see man pages for details 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 */ SetGpsAltitude(GpsData * pGps,u8 ref,const Rational * pValue)1366 static void SetGpsAltitude(GpsData* pGps, u8 ref, const Rational* pValue) 1367 { 1368 NN_ASSERT(pGps); 1369 1370 if (pValue) 1371 { 1372 pGps->altitudeRef = ref; 1373 memcpy(&pGps->altitude, pValue, sizeof(pGps->altitude)); 1374 pGps->isAltitudeRefValid = pGps->isAltitudeValid = true; 1375 } 1376 else 1377 { 1378 pGps->isAltitudeRefValid = pGps->isAltitudeValid = false; 1379 } 1380 } 1381 1382 /* Please see man pages for details 1383 1384 1385 1386 1387 1388 1389 1390 1391 */ ClearGpsAltitude(GpsData * pGps)1392 static void ClearGpsAltitude(GpsData* pGps) { SetGpsAltitude(pGps, 0, NULL); } 1393 1394 /* Please see man pages for details 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 */ SetGpsTimeStamp(GpsData * pGps,const Rational * pValue)1407 static void SetGpsTimeStamp(GpsData* pGps, const Rational* pValue) 1408 { 1409 NN_ASSERT(pGps); 1410 1411 if (pValue) 1412 { 1413 memcpy(pGps->timeStamp, pValue, sizeof(pGps->timeStamp)); 1414 pGps->isTimeStampValid = true; 1415 } 1416 else 1417 { 1418 pGps->isTimeStampValid = false; 1419 } 1420 } 1421 1422 /* Please see man pages for details 1423 1424 1425 1426 1427 1428 1429 1430 1431 */ ClearGpsTimeStamp(GpsData * pGps)1432 static void ClearGpsTimeStamp(GpsData* pGps) { SetGpsTimeStamp(pGps, NULL); } 1433 1434 /* Please see man pages for details 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 */ SetGpsSatellites(GpsData * pGps,const char * pSatellites)1448 static void SetGpsSatellites(GpsData* pGps, const char* pSatellites) 1449 { 1450 NN_ASSERT(pGps); 1451 1452 pGps->pSatellites = pSatellites; 1453 } 1454 1455 /* Please see man pages for details 1456 1457 1458 1459 1460 1461 1462 1463 1464 */ ClearGpsSatellites(GpsData * pGps)1465 static void ClearGpsSatellites(GpsData* pGps) { SetGpsSatellites(pGps, NULL); } 1466 1467 /* Please see man pages for details 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 */ SetGpsStatus(GpsData * pGps,char status)1480 static void SetGpsStatus(GpsData* pGps, char status) 1481 { 1482 NN_ASSERT(pGps); 1483 1484 pGps->status[0] = status; 1485 pGps->status[1] = '\0'; 1486 } 1487 1488 /* Please see man pages for details 1489 1490 1491 1492 1493 1494 1495 1496 1497 */ ClearGpsStatus(GpsData * pGps)1498 static void ClearGpsStatus(GpsData* pGps) { SetGpsStatus(pGps, '\0'); } 1499 1500 /* Please see man pages for details 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 */ SetGpsMeasureMode(GpsData * pGps,char measureMode)1513 static void SetGpsMeasureMode(GpsData* pGps, char measureMode) 1514 { 1515 NN_ASSERT(pGps); 1516 1517 pGps->measureMode[0] = measureMode; 1518 pGps->measureMode[1] = '\0'; 1519 } 1520 1521 /* Please see man pages for details 1522 1523 1524 1525 1526 1527 1528 1529 1530 */ ClearGpsMeasureMode(GpsData * pGps)1531 static void ClearGpsMeasureMode(GpsData* pGps) { SetGpsMeasureMode(pGps, '\0'); } 1532 1533 /* Please see man pages for details 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 */ SetGpsDop(GpsData * pGps,const Rational * pValue)1546 static void SetGpsDop(GpsData* pGps, const Rational* pValue) 1547 { 1548 NN_ASSERT(pGps); 1549 1550 if (pValue) 1551 { 1552 memcpy(&pGps->dop, pValue, sizeof(pGps->dop)); 1553 pGps->isDopValid = true; 1554 } 1555 else 1556 { 1557 pGps->isDopValid = false; 1558 } 1559 } 1560 1561 /* Please see man pages for details 1562 1563 1564 1565 1566 1567 1568 1569 1570 */ ClearGpsDop(GpsData * pGps)1571 static void ClearGpsDop(GpsData* pGps) { SetGpsDop(pGps, NULL); } 1572 1573 /* Please see man pages for details 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 */ SetGpsSpeed(GpsData * pGps,char ref,const Rational * pValue)1589 static void SetGpsSpeed(GpsData* pGps, char ref, const Rational* pValue) 1590 { 1591 NN_ASSERT(pGps); 1592 1593 pGps->speedRef[0] = ref; 1594 pGps->speedRef[1] = '\0'; 1595 1596 if (pValue) 1597 { 1598 memcpy(&pGps->speed, pValue, sizeof(pGps->speed)); 1599 pGps->isSpeedValid = true; 1600 } 1601 else 1602 { 1603 pGps->isSpeedValid = false; 1604 } 1605 } 1606 1607 /* Please see man pages for details 1608 1609 1610 1611 1612 1613 1614 1615 1616 */ ClearGpsSpeed(GpsData * pGps)1617 static void ClearGpsSpeed(GpsData* pGps) { SetGpsSpeed(pGps, '\0', NULL); } 1618 1619 /* Please see man pages for details 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 */ SetGpsTrack(GpsData * pGps,char ref,const Rational * pValue)1635 static void SetGpsTrack(GpsData* pGps, char ref, const Rational* pValue) 1636 { 1637 NN_ASSERT(pGps); 1638 1639 pGps->trackRef[0] = ref; 1640 pGps->trackRef[1] = '\0'; 1641 1642 if (pValue) 1643 { 1644 memcpy(&pGps->track, pValue, sizeof(pGps->track)); 1645 pGps->isTrackValid = true; 1646 } 1647 else 1648 { 1649 pGps->isTrackValid = false; 1650 } 1651 } 1652 1653 /* Please see man pages for details 1654 1655 1656 1657 1658 1659 1660 1661 1662 */ ClearGpsTrack(GpsData * pGps)1663 static void ClearGpsTrack(GpsData* pGps) { SetGpsTrack(pGps, '\0', NULL); } 1664 1665 /* Please see man pages for details 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 */ SetGpsImgDirection(GpsData * pGps,char ref,const Rational * pValue)1681 static void SetGpsImgDirection(GpsData* pGps, char ref, const Rational* pValue) 1682 { 1683 NN_ASSERT(pGps); 1684 1685 pGps->imgDirectionRef[0] = ref; 1686 pGps->imgDirectionRef[1] = '\0'; 1687 1688 if (pValue) 1689 { 1690 memcpy(&pGps->imgDirection, pValue, sizeof(pGps->imgDirection)); 1691 pGps->isImgDirectionValid = true; 1692 } 1693 else 1694 { 1695 pGps->isImgDirectionValid = false; 1696 } 1697 } 1698 1699 /* Please see man pages for details 1700 1701 1702 1703 1704 1705 1706 1707 1708 */ ClearGpsImgDirection(GpsData * pGps)1709 static void ClearGpsImgDirection(GpsData* pGps) { SetGpsImgDirection(pGps, '\0', NULL); } 1710 1711 /* Please see man pages for details 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 */ SetGpsMapDatum(GpsData * pGps,const char * pMapDatum)1725 static void SetGpsMapDatum(GpsData* pGps, const char* pMapDatum) 1726 { 1727 NN_ASSERT(pGps); 1728 1729 pGps->pMapDatum = pMapDatum; 1730 } 1731 1732 /* Please see man pages for details 1733 1734 1735 1736 1737 1738 1739 1740 1741 */ ClearGpsMapDatum(GpsData * pGps)1742 static void ClearGpsMapDatum(GpsData* pGps) { SetGpsMapDatum(pGps, NULL); } 1743 1744 /* Please see man pages for details 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 */ SetGpsDestLatitude(GpsData * pGps,char ref,const Rational * pValue)1760 static void SetGpsDestLatitude(GpsData* pGps, char ref, const Rational* pValue) 1761 { 1762 NN_ASSERT(pGps); 1763 1764 pGps->destLatitudeRef[0] = ref; 1765 pGps->destLatitudeRef[1] = '\0'; 1766 1767 if (pValue) 1768 { 1769 memcpy(pGps->destLatitude, pValue, sizeof(pGps->destLatitude)); 1770 pGps->isDestLatitudeValid = true; 1771 } 1772 else 1773 { 1774 pGps->isDestLatitudeValid = false; 1775 } 1776 } 1777 1778 /* Please see man pages for details 1779 1780 1781 1782 1783 1784 1785 1786 1787 */ ClearGpsDestLatitude(GpsData * pGps)1788 static void ClearGpsDestLatitude(GpsData* pGps) { SetGpsDestLatitude(pGps, '\0', NULL); } 1789 1790 /* Please see man pages for details 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 */ SetGpsDestLongitude(GpsData * pGps,char ref,const Rational * pValue)1806 static void SetGpsDestLongitude(GpsData* pGps, char ref, const Rational* pValue) 1807 { 1808 NN_ASSERT(pGps); 1809 1810 pGps->destLongitudeRef[0] = ref; 1811 pGps->destLongitudeRef[1] = '\0'; 1812 1813 if (pValue) 1814 { 1815 memcpy(pGps->destLongitude, pValue, sizeof(pGps->destLongitude)); 1816 pGps->isDestLongitudeValid = true; 1817 } 1818 else 1819 { 1820 pGps->isDestLongitudeValid = false; 1821 } 1822 } 1823 1824 /* Please see man pages for details 1825 1826 1827 1828 1829 1830 1831 1832 1833 */ ClearGpsDestLongitude(GpsData * pGps)1834 static void ClearGpsDestLongitude(GpsData* pGps) { SetGpsDestLongitude(pGps, '\0', NULL); } 1835 1836 /* Please see man pages for details 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 */ SetGpsDestBearing(GpsData * pGps,char ref,const Rational * pValue)1852 static void SetGpsDestBearing(GpsData* pGps, char ref, const Rational* pValue) 1853 { 1854 NN_ASSERT(pGps); 1855 1856 pGps->destBearingRef[0] = ref; 1857 pGps->destBearingRef[1] = '\0'; 1858 1859 if (pValue) 1860 { 1861 memcpy(&pGps->destBearing, pValue, sizeof(pGps->destBearing)); 1862 pGps->isDestBearingValid = true; 1863 } 1864 else 1865 { 1866 pGps->isDestBearingValid = false; 1867 } 1868 } 1869 1870 /* Please see man pages for details 1871 1872 1873 1874 1875 1876 1877 1878 1879 */ ClearGpsDestBearing(GpsData * pGps)1880 static void ClearGpsDestBearing(GpsData* pGps) { SetGpsDestBearing(pGps, '\0', NULL); } 1881 1882 /* Please see man pages for details 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 */ SetGpsDestDistance(GpsData * pGps,char ref,const Rational * pValue)1898 static void SetGpsDestDistance(GpsData* pGps, char ref, const Rational* pValue) 1899 { 1900 NN_ASSERT(pGps); 1901 1902 pGps->destDistanceRef[0] = ref; 1903 pGps->destDistanceRef[1] = '\0'; 1904 1905 if (pValue) 1906 { 1907 memcpy(&pGps->destDistance, pValue, sizeof(pGps->destDistance)); 1908 pGps->isDestDistanceValid = true; 1909 } 1910 else 1911 { 1912 pGps->isDestDistanceValid = false; 1913 } 1914 } 1915 1916 /* Please see man pages for details 1917 1918 1919 1920 1921 1922 1923 1924 1925 */ ClearGpsDestDistance(GpsData * pGps)1926 static void ClearGpsDestDistance(GpsData* pGps) { SetGpsDestDistance(pGps, '\0', NULL); } 1927 1928 /* Please see man pages for details 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 */ SetGpsProcessingMethod(GpsData * pGps,const u8 * pProcessingMethod,size_t processingMethodSize)1944 static void SetGpsProcessingMethod(GpsData* pGps, const u8* pProcessingMethod, size_t processingMethodSize) 1945 { 1946 NN_ASSERT(pGps); 1947 1948 if (pProcessingMethod && processingMethodSize) 1949 { 1950 pGps->pProcessingMethod = pProcessingMethod; 1951 pGps->processingMethodSize = processingMethodSize; 1952 } 1953 else 1954 { 1955 pGps->pProcessingMethod = NULL; 1956 pGps->processingMethodSize = 0; 1957 } 1958 } 1959 1960 /* Please see man pages for details 1961 1962 1963 1964 1965 1966 1967 1968 1969 */ ClearGpsProcessingMethod(GpsData * pGps)1970 static void ClearGpsProcessingMethod(GpsData* pGps) { SetGpsProcessingMethod(pGps, NULL, 0); } 1971 1972 /* Please see man pages for details 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 */ SetGpsAreaInformation(GpsData * pGps,const u8 * pAreaInformation,size_t areaInformationSize)1988 static void SetGpsAreaInformation(GpsData* pGps, const u8* pAreaInformation, size_t areaInformationSize) 1989 { 1990 NN_ASSERT(pGps); 1991 1992 if (pAreaInformation && areaInformationSize) 1993 { 1994 pGps->pAreaInformation = pAreaInformation; 1995 pGps->areaInformationSize = areaInformationSize; 1996 } 1997 else 1998 { 1999 pGps->pAreaInformation = NULL; 2000 pGps->areaInformationSize = 0; 2001 } 2002 } 2003 2004 /* Please see man pages for details 2005 2006 2007 2008 2009 2010 2011 2012 2013 */ ClearGpsAreaInformation(GpsData * pGps)2014 static void ClearGpsAreaInformation(GpsData* pGps) { SetGpsAreaInformation(pGps, NULL, 0); } 2015 2016 /* Please see man pages for details 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 */ SetGpsDateStamp(GpsData * pGps,const char * pDateStamp)2030 static void SetGpsDateStamp(GpsData* pGps, const char* pDateStamp) 2031 { 2032 NN_ASSERT(pGps); 2033 2034 pGps->pDateStamp = pDateStamp; 2035 } 2036 2037 /* Please see man pages for details 2038 2039 2040 2041 2042 2043 2044 2045 2046 */ ClearGpsDateStamp(GpsData * pGps)2047 static void ClearGpsDateStamp(GpsData* pGps) { SetGpsDateStamp(pGps, NULL); } 2048 2049 /* Please see man pages for details 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 */ SetGpsDifferential(GpsData * pGps,u16 differential)2061 static void SetGpsDifferential(GpsData* pGps, u16 differential) 2062 { 2063 NN_ASSERT(pGps); 2064 2065 pGps->differential = differential; 2066 pGps->isDifferentialValid = true; 2067 } 2068 2069 /* Please see man pages for details 2070 2071 2072 2073 2074 2075 2076 2077 2078 */ ClearGpsDifferential(GpsData * pGps)2079 static void ClearGpsDifferential(GpsData* pGps) 2080 { 2081 NN_ASSERT(pGps); 2082 2083 pGps->isDifferentialValid = false; 2084 } 2085 2086 2087 /* Please see man pages for details 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 */ SetGpsData(const GpsData * pGps)2108 void SetGpsData(const GpsData* pGps) 2109 { 2110 if (m_Initialized) 2111 { 2112 m_TemporarySetting.pGpsData = pGps; 2113 } 2114 } 2115 2116 /* Please see man pages for details 2117 2118 2119 2120 */ ClearGpsData()2121 void ClearGpsData() { SetGpsData(NULL); } 2122 2123 /* Please see man pages for details 2124 2125 2126 2127 2128 2129 */ 2130 2131 /* Please see man pages for details 2132 2133 2134 2135 */ DoNotCallMe4()2136 static void DoNotCallMe4() {} 2137 2138 /* Please see man pages for details 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 */ 2174 size_t StartJpegEncoder(u8* dst, 2175 size_t limit, 2176 const void* src, 2177 u32 width, 2178 u32 height, 2179 u32 quality, 2180 PixelSampling dstPixelSampling, 2181 PixelFormat srcPixelFormat, 2182 bool addThumbnail); 2183 2184 /* Please see man pages for details 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 */ 2267 size_t StartMpEncoderLR(u8* dst, 2268 size_t limit, 2269 const void* srcL, 2270 const void* srcR, 2271 u32 width, 2272 u32 height, 2273 u32 quality, 2274 PixelSampling dstPixelSampling, 2275 PixelFormat srcPixelFormat, 2276 bool addThumbnailL, 2277 bool addThumbnailR); 2278 2279 /* Please see man pages for details 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 */ 2391 size_t StartMpEncoderFirst(u8* dst, 2392 size_t limit, 2393 const void* src, 2394 u32 width, 2395 u32 height, 2396 u32 quality, 2397 PixelSampling dstPixelSampling, 2398 PixelFormat srcPixelFormat, 2399 bool addThumbnail, 2400 u32 numImages = 2, 2401 MpTypeCode typeCode = MP_TYPE_CODE_MULTI_VIEW_DISPARITY_IMAGE, 2402 bool addImageUidList = false, 2403 bool addTotalFrames = false); 2404 2405 /* Please see man pages for details 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 */ 2501 size_t StartMpEncoderNext(const void* src, 2502 u32 width, 2503 u32 height, 2504 u32 quality, 2505 PixelSampling dstPixelSampling, 2506 PixelFormat srcPixelFormat, 2507 bool addThumbnail, 2508 MpTypeCode typeCode = MP_TYPE_CODE_MULTI_VIEW_DISPARITY_IMAGE, 2509 bool omitPixelDimensions = false); 2510 2511 /* Please see man pages for details 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 */ 2536 bool GetMpRegionsToBuildJpegData(MpRegionsToBuildJpegData* pBuffer); 2537 2538 /* Please see man pages for details 2539 2540 2541 2542 2543 2544 */ 2545 s32 GetLastError() const; 2546 2547 /* 2548 2549 */ 2550 2551 protected: 2552 detail::JpegMpEncoderWorkObj* m_pWork; 2553 bool m_Initialized; 2554 bool m_Padding[3]; 2555 2556 detail::JpegMpEncoderTemporarySettingObj m_TemporarySetting; 2557 void ClearTemporarySetting(); 2558 2559 void SetMakerNote(const u8* pBuffer, size_t size, u32 index); 2560 }; 2561 2562 } // namespace CTR { 2563 } // namespace jpeg { 2564 } // namespace nn { 2565 2566 #endif // __cplusplus 2567 2568 #endif // NN_JPEG_JPEGMPENCODER_H_ 2569