1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: jpeg_MpEncoder.h 4 5 Copyright (C)2009-2010 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: 28853 $ 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 */ SetSoftware(const char * pBuffer)369 void SetSoftware(const char* pBuffer) 370 { 371 if (m_Initialized) 372 { 373 m_TemporarySetting.pSoftware = pBuffer; 374 } 375 } 376 377 /* Please see man pages for details 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 void SetUserMakerNote(const u8* pBuffer, size_t size); 407 408 /* Please see man pages for details 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 */ SetImageUid(const char * pBuffer)429 void SetImageUid(const char* pBuffer) 430 { 431 if (m_Initialized) 432 { 433 if (pBuffer) 434 { 435 memcpy(m_TemporarySetting.imageUidBuffer, pBuffer, sizeof(m_TemporarySetting.imageUidBuffer)); 436 m_TemporarySetting.imageUidBuffer[sizeof(m_TemporarySetting.imageUidBuffer) - 1] = '\0'; 437 m_TemporarySetting.isImageUidSet = true; 438 } 439 else 440 { 441 m_TemporarySetting.isImageUidSet = false; 442 } 443 } 444 } 445 446 /* Please see man pages for details 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 */ SetOrientation(u16 orientation)462 void SetOrientation(u16 orientation) 463 { 464 if (m_Initialized) 465 { 466 m_TemporarySetting.orientation = orientation; 467 m_TemporarySetting.isOrientationSet = true; 468 } 469 } 470 471 /* Please see man pages for details 472 473 474 475 */ ClearOrientation()476 void ClearOrientation() 477 { 478 if (m_Initialized) 479 { 480 m_TemporarySetting.isOrientationSet = false; 481 } 482 } 483 484 /* Please see man pages for details 485 486 487 488 489 490 */ 491 492 /* Please see man pages for details 493 494 495 496 */ DoNotCallMe2()497 static void DoNotCallMe2() {} 498 499 /* Please see man pages for details 500 501 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 void SetMpTypeFlags(u32 flags = 0, u16 image1 = 0, u16 image2 = 0) 541 { 542 if (m_Initialized) 543 { 544 m_TemporarySetting.isDependentParent = (flags & MP_TYPE_FLAG_DEPENDENT_IMAGE_PARENT) ? true : false; 545 m_TemporarySetting.isDependentChild = (flags & MP_TYPE_FLAG_DEPENDENT_IMAGE_CHILD) ? true : false; 546 m_TemporarySetting.isRepresentativeSet = true; 547 m_TemporarySetting.isRepresentative = (flags & MP_TYPE_FLAG_REPRESENTATIVE_IMAGE) ? true : false; 548 m_TemporarySetting.dependentImage1EntryNum = image1; 549 m_TemporarySetting.dependentImage2EntryNum = image2; 550 } 551 } 552 553 /* Please see man pages for details 554 555 556 557 558 559 */ 560 561 /* Please see man pages for details 562 563 564 565 */ DoNotCallMe3()566 static void DoNotCallMe3() {} 567 568 /* Please see man pages for details 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 */ SetMpIndividualNum(u32 value)587 void SetMpIndividualNum(u32 value) 588 { 589 if (m_Initialized) 590 { 591 m_TemporarySetting.mpAttribute.mpIndividualNum = value; 592 m_TemporarySetting.mpAttribute.isMpIndividualNumValid = true; 593 } 594 } 595 596 /* Please see man pages for details 597 598 599 600 */ ClearMpIndividualNum()601 void ClearMpIndividualNum() 602 { 603 if (m_Initialized) 604 { 605 m_TemporarySetting.mpAttribute.isMpIndividualNumValid = false; 606 } 607 } 608 609 /* Please see man pages for details 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 */ SetMpPanOrientation(u32 value)628 void SetMpPanOrientation(u32 value) 629 { 630 if (m_Initialized) 631 { 632 m_TemporarySetting.mpAttribute.panOrientation = value; 633 m_TemporarySetting.mpAttribute.isPanOrientationValid = true; 634 } 635 } 636 637 /* Please see man pages for details 638 639 640 641 */ ClearMpPanOrientation()642 void ClearMpPanOrientation() 643 { 644 if (m_Initialized) 645 { 646 m_TemporarySetting.mpAttribute.isPanOrientationValid = false; 647 } 648 } 649 650 /* Please see man pages for details 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 */ SetMpPanOverlapH(const Rational * pValue)670 void SetMpPanOverlapH(const Rational* pValue) 671 { 672 if (m_Initialized) 673 { 674 if (pValue) 675 { 676 m_TemporarySetting.mpAttribute.panOverlapH = *pValue; 677 m_TemporarySetting.mpAttribute.isPanOverlapHValid = true; 678 } 679 else 680 { 681 m_TemporarySetting.mpAttribute.isPanOverlapHValid = false; 682 } 683 } 684 } 685 686 /* Please see man pages for details 687 688 689 690 */ ClearMpPanOverlapH()691 void ClearMpPanOverlapH() { SetMpPanOverlapH(NULL); } 692 693 /* Please see man pages for details 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 */ SetMpPanOverlapV(const Rational * pValue)713 void SetMpPanOverlapV(const Rational* pValue) 714 { 715 if (m_Initialized) 716 { 717 if (pValue) 718 { 719 m_TemporarySetting.mpAttribute.panOverlapV = *pValue; 720 m_TemporarySetting.mpAttribute.isPanOverlapVValid = true; 721 } 722 else 723 { 724 m_TemporarySetting.mpAttribute.isPanOverlapVValid = false; 725 } 726 } 727 } 728 729 /* Please see man pages for details 730 731 732 733 */ ClearMpPanOverlapV()734 void ClearMpPanOverlapV() { SetMpPanOverlapV(NULL); } 735 736 /* Please see man pages for details 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 */ SetMpBaseViewpointNum(u32 value)759 void SetMpBaseViewpointNum(u32 value) 760 { 761 if (m_Initialized) 762 { 763 m_TemporarySetting.mpAttribute.baseViewpointNum = value; 764 m_TemporarySetting.mpAttribute.isBaseViewpointNumValid = true; 765 } 766 } 767 768 /* Please see man pages for details 769 770 771 772 */ ClearMpBaseViewpointNum()773 void ClearMpBaseViewpointNum() 774 { 775 if (m_Initialized) 776 { 777 m_TemporarySetting.mpAttribute.isBaseViewpointNumValid = false; 778 } 779 } 780 781 /* Please see man pages for details 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 */ SetMpConvergenceAngle(const Srational * pValue)802 void SetMpConvergenceAngle(const Srational* pValue) 803 { 804 if (m_Initialized) 805 { 806 if (pValue) 807 { 808 m_TemporarySetting.mpAttribute.convergenceAngle = *pValue; 809 m_TemporarySetting.mpAttribute.isConvergenceAngleValid = true; 810 } 811 else 812 { 813 m_TemporarySetting.mpAttribute.isConvergenceAngleValid = false; 814 } 815 } 816 } 817 818 /* Please see man pages for details 819 820 821 822 */ ClearMpConvergenceAngle()823 void ClearMpConvergenceAngle() { SetMpConvergenceAngle(NULL); } 824 825 /* Please see man pages for details 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 */ SetMpBaselineLength(const Rational * pValue)846 void SetMpBaselineLength(const Rational* pValue) 847 { 848 if (m_Initialized) 849 { 850 if (pValue) 851 { 852 m_TemporarySetting.mpAttribute.baselineLength = *pValue; 853 m_TemporarySetting.mpAttribute.isBaselineLengthValid = true; 854 } 855 else 856 { 857 m_TemporarySetting.mpAttribute.isBaselineLengthValid = false; 858 } 859 } 860 } 861 862 /* Please see man pages for details 863 864 865 866 */ ClearMpBaselineLength()867 void ClearMpBaselineLength() { SetMpBaselineLength(NULL); } 868 869 /* Please see man pages for details 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 */ SetMpVerticalDivergence(const Srational * pValue)889 void SetMpVerticalDivergence(const Srational* pValue) 890 { 891 if (m_Initialized) 892 { 893 if (pValue) 894 { 895 m_TemporarySetting.mpAttribute.verticalDivergence = *pValue; 896 m_TemporarySetting.mpAttribute.isVerticalDivergenceValid = true; 897 } 898 else 899 { 900 m_TemporarySetting.mpAttribute.isVerticalDivergenceValid = false; 901 } 902 } 903 } 904 905 /* Please see man pages for details 906 907 908 909 */ ClearMpVerticalDivergence()910 void ClearMpVerticalDivergence() { SetMpVerticalDivergence(NULL); } 911 912 /* Please see man pages for details 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 */ SetMpAxisDistanceX(const Srational * pValue)932 void SetMpAxisDistanceX(const Srational* pValue) 933 { 934 if (m_Initialized) 935 { 936 if (pValue) 937 { 938 m_TemporarySetting.mpAttribute.axisDistanceX = *pValue; 939 m_TemporarySetting.mpAttribute.isAxisDistanceXValid = true; 940 } 941 else 942 { 943 m_TemporarySetting.mpAttribute.isAxisDistanceXValid = false; 944 } 945 } 946 } 947 948 /* Please see man pages for details 949 950 951 952 */ ClearMpAxisDistanceX()953 void ClearMpAxisDistanceX() { SetMpAxisDistanceX(NULL); } 954 955 /* Please see man pages for details 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 */ SetMpAxisDistanceY(const Srational * pValue)975 void SetMpAxisDistanceY(const Srational* pValue) 976 { 977 if (m_Initialized) 978 { 979 if (pValue) 980 { 981 m_TemporarySetting.mpAttribute.axisDistanceY = *pValue; 982 m_TemporarySetting.mpAttribute.isAxisDistanceYValid = true; 983 } 984 else 985 { 986 m_TemporarySetting.mpAttribute.isAxisDistanceYValid = false; 987 } 988 } 989 } 990 991 /* Please see man pages for details 992 993 994 995 */ ClearMpAxisDistanceY()996 void ClearMpAxisDistanceY() { SetMpAxisDistanceY(NULL); } 997 998 /* Please see man pages for details 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 */ SetMpAxisDistanceZ(const Srational * pValue)1018 void SetMpAxisDistanceZ(const Srational* pValue) 1019 { 1020 if (m_Initialized) 1021 { 1022 if (pValue) 1023 { 1024 m_TemporarySetting.mpAttribute.axisDistanceZ = *pValue; 1025 m_TemporarySetting.mpAttribute.isAxisDistanceZValid = true; 1026 } 1027 else 1028 { 1029 m_TemporarySetting.mpAttribute.isAxisDistanceZValid = false; 1030 } 1031 } 1032 } 1033 1034 /* Please see man pages for details 1035 1036 1037 1038 */ ClearMpAxisDistanceZ()1039 void ClearMpAxisDistanceZ() { SetMpAxisDistanceZ(NULL); } 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 */ SetMpYawAngle(const Srational * pValue)1061 void SetMpYawAngle(const Srational* pValue) 1062 { 1063 if (m_Initialized) 1064 { 1065 if (pValue) 1066 { 1067 m_TemporarySetting.mpAttribute.yawAngle = *pValue; 1068 m_TemporarySetting.mpAttribute.isYawAngleValid = true; 1069 } 1070 else 1071 { 1072 m_TemporarySetting.mpAttribute.isYawAngleValid = false; 1073 } 1074 } 1075 } 1076 1077 /* Please see man pages for details 1078 1079 1080 1081 */ ClearMpYawAngle()1082 void ClearMpYawAngle() { SetMpYawAngle(NULL); } 1083 1084 /* Please see man pages for details 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 */ SetMpPitchAngle(const Srational * pValue)1104 void SetMpPitchAngle(const Srational* pValue) 1105 { 1106 if (m_Initialized) 1107 { 1108 if (pValue) 1109 { 1110 m_TemporarySetting.mpAttribute.pitchAngle = *pValue; 1111 m_TemporarySetting.mpAttribute.isPitchAngleValid = true; 1112 } 1113 else 1114 { 1115 m_TemporarySetting.mpAttribute.isPitchAngleValid = false; 1116 } 1117 } 1118 } 1119 1120 /* Please see man pages for details 1121 1122 1123 1124 */ ClearMpPitchAngle()1125 void ClearMpPitchAngle() { SetMpPitchAngle(NULL); } 1126 1127 /* Please see man pages for details 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 */ SetMpRollAngle(const Srational * pValue)1147 void SetMpRollAngle(const Srational* pValue) 1148 { 1149 if (m_Initialized) 1150 { 1151 if (pValue) 1152 { 1153 m_TemporarySetting.mpAttribute.rollAngle = *pValue; 1154 m_TemporarySetting.mpAttribute.isRollAngleValid = true; 1155 } 1156 else 1157 { 1158 m_TemporarySetting.mpAttribute.isRollAngleValid = false; 1159 } 1160 } 1161 } 1162 1163 /* Please see man pages for details 1164 1165 1166 1167 */ ClearMpRollAngle()1168 void ClearMpRollAngle() { SetMpRollAngle(NULL); } 1169 1170 /* Please see man pages for details 1171 1172 1173 1174 1175 1176 */ 1177 1178 /* Please see man pages for details 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 */ InitializeGpsData(GpsData * pGps)1202 static void InitializeGpsData(GpsData* pGps) 1203 { 1204 memset(pGps, 0, sizeof(*pGps)); 1205 // GPS tag version 2.2. 1206 pGps->versionId[0] = 2; 1207 pGps->versionId[1] = 2; 1208 pGps->isVersionIdValid = true; 1209 } 1210 1211 /* Please see man pages for details 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 */ SetGpsVersionId(GpsData * pGps,const u8 * pVersionId)1227 static void SetGpsVersionId(GpsData* pGps, const u8* pVersionId) 1228 { 1229 NN_ASSERT(pGps); 1230 1231 if (pVersionId) 1232 { 1233 memcpy(pGps->versionId, pVersionId, sizeof(pGps->versionId)); 1234 pGps->isVersionIdValid = true; 1235 } 1236 else 1237 { 1238 pGps->isVersionIdValid = false; 1239 } 1240 } 1241 1242 /* Please see man pages for details 1243 1244 1245 1246 1247 1248 1249 1250 1251 */ ClearGpsVersionId(GpsData * pGps)1252 static void ClearGpsVersionId(GpsData* pGps) { SetGpsVersionId(pGps, NULL); } 1253 1254 /* Please see man pages for details 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 */ SetGpsLatitude(GpsData * pGps,char ref,const Rational * pValue)1270 static void SetGpsLatitude(GpsData* pGps, char ref, const Rational* pValue) 1271 { 1272 NN_ASSERT(pGps); 1273 1274 pGps->latitudeRef[0] = ref; 1275 pGps->latitudeRef[1] = '\0'; 1276 1277 if (pValue) 1278 { 1279 memcpy(pGps->latitude, pValue, sizeof(pGps->latitude)); 1280 pGps->isLatitudeValid = true; 1281 } 1282 else 1283 { 1284 pGps->isLatitudeValid = false; 1285 } 1286 } 1287 1288 /* Please see man pages for details 1289 1290 1291 1292 1293 1294 1295 1296 1297 */ ClearGpsLatitude(GpsData * pGps)1298 static void ClearGpsLatitude(GpsData* pGps) { SetGpsLatitude(pGps, '\0', NULL); } 1299 1300 /* Please see man pages for details 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 */ SetGpsLongitude(GpsData * pGps,char ref,const Rational * pValue)1316 static void SetGpsLongitude(GpsData* pGps, char ref, const Rational* pValue) 1317 { 1318 NN_ASSERT(pGps); 1319 1320 pGps->longitudeRef[0] = ref; 1321 pGps->longitudeRef[1] = '\0'; 1322 1323 if (pValue) 1324 { 1325 memcpy(pGps->longitude, pValue, sizeof(pGps->longitude)); 1326 pGps->isLongitudeValid = true; 1327 } 1328 else 1329 { 1330 pGps->isLongitudeValid = false; 1331 } 1332 } 1333 1334 /* Please see man pages for details 1335 1336 1337 1338 1339 1340 1341 1342 1343 */ ClearGpsLongitude(GpsData * pGps)1344 static void ClearGpsLongitude(GpsData* pGps) { SetGpsLongitude(pGps, '\0', NULL); } 1345 1346 /* Please see man pages for details 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 */ SetGpsAltitude(GpsData * pGps,u8 ref,const Rational * pValue)1364 static void SetGpsAltitude(GpsData* pGps, u8 ref, const Rational* pValue) 1365 { 1366 NN_ASSERT(pGps); 1367 1368 if (pValue) 1369 { 1370 pGps->altitudeRef = ref; 1371 memcpy(&pGps->altitude, pValue, sizeof(pGps->altitude)); 1372 pGps->isAltitudeRefValid = pGps->isAltitudeValid = true; 1373 } 1374 else 1375 { 1376 pGps->isAltitudeRefValid = pGps->isAltitudeValid = false; 1377 } 1378 } 1379 1380 /* Please see man pages for details 1381 1382 1383 1384 1385 1386 1387 1388 1389 */ ClearGpsAltitude(GpsData * pGps)1390 static void ClearGpsAltitude(GpsData* pGps) { SetGpsAltitude(pGps, 0, NULL); } 1391 1392 /* Please see man pages for details 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 */ SetGpsTimeStamp(GpsData * pGps,const Rational * pValue)1405 static void SetGpsTimeStamp(GpsData* pGps, const Rational* pValue) 1406 { 1407 NN_ASSERT(pGps); 1408 1409 if (pValue) 1410 { 1411 memcpy(pGps->timeStamp, pValue, sizeof(pGps->timeStamp)); 1412 pGps->isTimeStampValid = true; 1413 } 1414 else 1415 { 1416 pGps->isTimeStampValid = false; 1417 } 1418 } 1419 1420 /* Please see man pages for details 1421 1422 1423 1424 1425 1426 1427 1428 1429 */ ClearGpsTimeStamp(GpsData * pGps)1430 static void ClearGpsTimeStamp(GpsData* pGps) { SetGpsTimeStamp(pGps, NULL); } 1431 1432 /* Please see man pages for details 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 */ SetGpsSatellites(GpsData * pGps,const char * pSatellites)1446 static void SetGpsSatellites(GpsData* pGps, const char* pSatellites) 1447 { 1448 NN_ASSERT(pGps); 1449 1450 pGps->pSatellites = pSatellites; 1451 } 1452 1453 /* Please see man pages for details 1454 1455 1456 1457 1458 1459 1460 1461 1462 */ ClearGpsSatellites(GpsData * pGps)1463 static void ClearGpsSatellites(GpsData* pGps) { SetGpsSatellites(pGps, NULL); } 1464 1465 /* Please see man pages for details 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 */ SetGpsStatus(GpsData * pGps,char status)1478 static void SetGpsStatus(GpsData* pGps, char status) 1479 { 1480 NN_ASSERT(pGps); 1481 1482 pGps->status[0] = status; 1483 pGps->status[1] = '\0'; 1484 } 1485 1486 /* Please see man pages for details 1487 1488 1489 1490 1491 1492 1493 1494 1495 */ ClearGpsStatus(GpsData * pGps)1496 static void ClearGpsStatus(GpsData* pGps) { SetGpsStatus(pGps, '\0'); } 1497 1498 /* Please see man pages for details 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 */ SetGpsMeasureMode(GpsData * pGps,char measureMode)1511 static void SetGpsMeasureMode(GpsData* pGps, char measureMode) 1512 { 1513 NN_ASSERT(pGps); 1514 1515 pGps->measureMode[0] = measureMode; 1516 pGps->measureMode[1] = '\0'; 1517 } 1518 1519 /* Please see man pages for details 1520 1521 1522 1523 1524 1525 1526 1527 1528 */ ClearGpsMeasureMode(GpsData * pGps)1529 static void ClearGpsMeasureMode(GpsData* pGps) { SetGpsMeasureMode(pGps, '\0'); } 1530 1531 /* Please see man pages for details 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 */ SetGpsDop(GpsData * pGps,const Rational * pValue)1544 static void SetGpsDop(GpsData* pGps, const Rational* pValue) 1545 { 1546 NN_ASSERT(pGps); 1547 1548 if (pValue) 1549 { 1550 memcpy(&pGps->dop, pValue, sizeof(pGps->dop)); 1551 pGps->isDopValid = true; 1552 } 1553 else 1554 { 1555 pGps->isDopValid = false; 1556 } 1557 } 1558 1559 /* Please see man pages for details 1560 1561 1562 1563 1564 1565 1566 1567 1568 */ ClearGpsDop(GpsData * pGps)1569 static void ClearGpsDop(GpsData* pGps) { SetGpsDop(pGps, NULL); } 1570 1571 /* Please see man pages for details 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 */ SetGpsSpeed(GpsData * pGps,char ref,const Rational * pValue)1587 static void SetGpsSpeed(GpsData* pGps, char ref, const Rational* pValue) 1588 { 1589 NN_ASSERT(pGps); 1590 1591 pGps->speedRef[0] = ref; 1592 pGps->speedRef[1] = '\0'; 1593 1594 if (pValue) 1595 { 1596 memcpy(&pGps->speed, pValue, sizeof(pGps->speed)); 1597 pGps->isSpeedValid = true; 1598 } 1599 else 1600 { 1601 pGps->isSpeedValid = false; 1602 } 1603 } 1604 1605 /* Please see man pages for details 1606 1607 1608 1609 1610 1611 1612 1613 1614 */ ClearGpsSpeed(GpsData * pGps)1615 static void ClearGpsSpeed(GpsData* pGps) { SetGpsSpeed(pGps, '\0', NULL); } 1616 1617 /* Please see man pages for details 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 */ SetGpsTrack(GpsData * pGps,char ref,const Rational * pValue)1633 static void SetGpsTrack(GpsData* pGps, char ref, const Rational* pValue) 1634 { 1635 NN_ASSERT(pGps); 1636 1637 pGps->trackRef[0] = ref; 1638 pGps->trackRef[1] = '\0'; 1639 1640 if (pValue) 1641 { 1642 memcpy(&pGps->track, pValue, sizeof(pGps->track)); 1643 pGps->isTrackValid = true; 1644 } 1645 else 1646 { 1647 pGps->isTrackValid = false; 1648 } 1649 } 1650 1651 /* Please see man pages for details 1652 1653 1654 1655 1656 1657 1658 1659 1660 */ ClearGpsTrack(GpsData * pGps)1661 static void ClearGpsTrack(GpsData* pGps) { SetGpsTrack(pGps, '\0', NULL); } 1662 1663 /* Please see man pages for details 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 */ SetGpsImgDirection(GpsData * pGps,char ref,const Rational * pValue)1679 static void SetGpsImgDirection(GpsData* pGps, char ref, const Rational* pValue) 1680 { 1681 NN_ASSERT(pGps); 1682 1683 pGps->imgDirectionRef[0] = ref; 1684 pGps->imgDirectionRef[1] = '\0'; 1685 1686 if (pValue) 1687 { 1688 memcpy(&pGps->imgDirection, pValue, sizeof(pGps->imgDirection)); 1689 pGps->isImgDirectionValid = true; 1690 } 1691 else 1692 { 1693 pGps->isImgDirectionValid = false; 1694 } 1695 } 1696 1697 /* Please see man pages for details 1698 1699 1700 1701 1702 1703 1704 1705 1706 */ ClearGpsImgDirection(GpsData * pGps)1707 static void ClearGpsImgDirection(GpsData* pGps) { SetGpsImgDirection(pGps, '\0', NULL); } 1708 1709 /* Please see man pages for details 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 */ SetGpsMapDatum(GpsData * pGps,const char * pMapDatum)1723 static void SetGpsMapDatum(GpsData* pGps, const char* pMapDatum) 1724 { 1725 NN_ASSERT(pGps); 1726 1727 pGps->pMapDatum = pMapDatum; 1728 } 1729 1730 /* Please see man pages for details 1731 1732 1733 1734 1735 1736 1737 1738 1739 */ ClearGpsMapDatum(GpsData * pGps)1740 static void ClearGpsMapDatum(GpsData* pGps) { SetGpsMapDatum(pGps, NULL); } 1741 1742 /* Please see man pages for details 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 */ SetGpsDestLatitude(GpsData * pGps,char ref,const Rational * pValue)1758 static void SetGpsDestLatitude(GpsData* pGps, char ref, const Rational* pValue) 1759 { 1760 NN_ASSERT(pGps); 1761 1762 pGps->destLatitudeRef[0] = ref; 1763 pGps->destLatitudeRef[1] = '\0'; 1764 1765 if (pValue) 1766 { 1767 memcpy(pGps->destLatitude, pValue, sizeof(pGps->destLatitude)); 1768 pGps->isDestLatitudeValid = true; 1769 } 1770 else 1771 { 1772 pGps->isDestLatitudeValid = false; 1773 } 1774 } 1775 1776 /* Please see man pages for details 1777 1778 1779 1780 1781 1782 1783 1784 1785 */ ClearGpsDestLatitude(GpsData * pGps)1786 static void ClearGpsDestLatitude(GpsData* pGps) { SetGpsDestLatitude(pGps, '\0', NULL); } 1787 1788 /* Please see man pages for details 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 */ SetGpsDestLongitude(GpsData * pGps,char ref,const Rational * pValue)1804 static void SetGpsDestLongitude(GpsData* pGps, char ref, const Rational* pValue) 1805 { 1806 NN_ASSERT(pGps); 1807 1808 pGps->destLongitudeRef[0] = ref; 1809 pGps->destLongitudeRef[1] = '\0'; 1810 1811 if (pValue) 1812 { 1813 memcpy(pGps->destLongitude, pValue, sizeof(pGps->destLongitude)); 1814 pGps->isDestLongitudeValid = true; 1815 } 1816 else 1817 { 1818 pGps->isDestLongitudeValid = false; 1819 } 1820 } 1821 1822 /* Please see man pages for details 1823 1824 1825 1826 1827 1828 1829 1830 1831 */ ClearGpsDestLongitude(GpsData * pGps)1832 static void ClearGpsDestLongitude(GpsData* pGps) { SetGpsDestLongitude(pGps, '\0', NULL); } 1833 1834 /* Please see man pages for details 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 */ SetGpsDestBearing(GpsData * pGps,char ref,const Rational * pValue)1850 static void SetGpsDestBearing(GpsData* pGps, char ref, const Rational* pValue) 1851 { 1852 NN_ASSERT(pGps); 1853 1854 pGps->destBearingRef[0] = ref; 1855 pGps->destBearingRef[1] = '\0'; 1856 1857 if (pValue) 1858 { 1859 memcpy(&pGps->destBearing, pValue, sizeof(pGps->destBearing)); 1860 pGps->isDestBearingValid = true; 1861 } 1862 else 1863 { 1864 pGps->isDestBearingValid = false; 1865 } 1866 } 1867 1868 /* Please see man pages for details 1869 1870 1871 1872 1873 1874 1875 1876 1877 */ ClearGpsDestBearing(GpsData * pGps)1878 static void ClearGpsDestBearing(GpsData* pGps) { SetGpsDestBearing(pGps, '\0', NULL); } 1879 1880 /* Please see man pages for details 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 */ SetGpsDestDistance(GpsData * pGps,char ref,const Rational * pValue)1896 static void SetGpsDestDistance(GpsData* pGps, char ref, const Rational* pValue) 1897 { 1898 NN_ASSERT(pGps); 1899 1900 pGps->destDistanceRef[0] = ref; 1901 pGps->destDistanceRef[1] = '\0'; 1902 1903 if (pValue) 1904 { 1905 memcpy(&pGps->destDistance, pValue, sizeof(pGps->destDistance)); 1906 pGps->isDestDistanceValid = true; 1907 } 1908 else 1909 { 1910 pGps->isDestDistanceValid = false; 1911 } 1912 } 1913 1914 /* Please see man pages for details 1915 1916 1917 1918 1919 1920 1921 1922 1923 */ ClearGpsDestDistance(GpsData * pGps)1924 static void ClearGpsDestDistance(GpsData* pGps) { SetGpsDestDistance(pGps, '\0', NULL); } 1925 1926 /* Please see man pages for details 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 */ SetGpsProcessingMethod(GpsData * pGps,const u8 * pProcessingMethod,size_t processingMethodSize)1942 static void SetGpsProcessingMethod(GpsData* pGps, const u8* pProcessingMethod, size_t processingMethodSize) 1943 { 1944 NN_ASSERT(pGps); 1945 1946 if (pProcessingMethod && processingMethodSize) 1947 { 1948 pGps->pProcessingMethod = pProcessingMethod; 1949 pGps->processingMethodSize = processingMethodSize; 1950 } 1951 else 1952 { 1953 pGps->pProcessingMethod = NULL; 1954 pGps->processingMethodSize = 0; 1955 } 1956 } 1957 1958 /* Please see man pages for details 1959 1960 1961 1962 1963 1964 1965 1966 1967 */ ClearGpsProcessingMethod(GpsData * pGps)1968 static void ClearGpsProcessingMethod(GpsData* pGps) { SetGpsProcessingMethod(pGps, NULL, 0); } 1969 1970 /* Please see man pages for details 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 */ SetGpsAreaInformation(GpsData * pGps,const u8 * pAreaInformation,size_t areaInformationSize)1986 static void SetGpsAreaInformation(GpsData* pGps, const u8* pAreaInformation, size_t areaInformationSize) 1987 { 1988 NN_ASSERT(pGps); 1989 1990 if (pAreaInformation && areaInformationSize) 1991 { 1992 pGps->pAreaInformation = pAreaInformation; 1993 pGps->areaInformationSize = areaInformationSize; 1994 } 1995 else 1996 { 1997 pGps->pAreaInformation = NULL; 1998 pGps->areaInformationSize = 0; 1999 } 2000 } 2001 2002 /* Please see man pages for details 2003 2004 2005 2006 2007 2008 2009 2010 2011 */ ClearGpsAreaInformation(GpsData * pGps)2012 static void ClearGpsAreaInformation(GpsData* pGps) { SetGpsAreaInformation(pGps, NULL, 0); } 2013 2014 /* Please see man pages for details 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 */ SetGpsDateStamp(GpsData * pGps,const char * pDateStamp)2028 static void SetGpsDateStamp(GpsData* pGps, const char* pDateStamp) 2029 { 2030 NN_ASSERT(pGps); 2031 2032 pGps->pDateStamp = pDateStamp; 2033 } 2034 2035 /* Please see man pages for details 2036 2037 2038 2039 2040 2041 2042 2043 2044 */ ClearGpsDateStamp(GpsData * pGps)2045 static void ClearGpsDateStamp(GpsData* pGps) { SetGpsDateStamp(pGps, NULL); } 2046 2047 /* Please see man pages for details 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 */ SetGpsDifferential(GpsData * pGps,u16 differential)2059 static void SetGpsDifferential(GpsData* pGps, u16 differential) 2060 { 2061 NN_ASSERT(pGps); 2062 2063 pGps->differential = differential; 2064 pGps->isDifferentialValid = true; 2065 } 2066 2067 /* Please see man pages for details 2068 2069 2070 2071 2072 2073 2074 2075 2076 */ ClearGpsDifferential(GpsData * pGps)2077 static void ClearGpsDifferential(GpsData* pGps) 2078 { 2079 NN_ASSERT(pGps); 2080 2081 pGps->isDifferentialValid = false; 2082 } 2083 2084 2085 /* Please see man pages for details 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 */ SetGpsData(const GpsData * pGps)2106 void SetGpsData(const GpsData* pGps) 2107 { 2108 if (m_Initialized) 2109 { 2110 m_TemporarySetting.pGpsData = pGps; 2111 } 2112 } 2113 2114 /* Please see man pages for details 2115 2116 2117 2118 */ ClearGpsData()2119 void ClearGpsData() { SetGpsData(NULL); } 2120 2121 /* Please see man pages for details 2122 2123 2124 2125 2126 2127 */ 2128 2129 /* Please see man pages for details 2130 2131 2132 2133 */ DoNotCallMe4()2134 static void DoNotCallMe4() {} 2135 2136 /* Please see man pages for details 2137 2138 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 size_t StartJpegEncoder(u8* dst, 2173 size_t limit, 2174 const void* src, 2175 u32 width, 2176 u32 height, 2177 u32 quality, 2178 PixelSampling dstPixelSampling, 2179 PixelFormat srcPixelFormat, 2180 bool addThumbnail); 2181 2182 /* Please see man pages for details 2183 2184 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 size_t StartMpEncoderLR(u8* dst, 2266 size_t limit, 2267 const void* srcL, 2268 const void* srcR, 2269 u32 width, 2270 u32 height, 2271 u32 quality, 2272 PixelSampling dstPixelSampling, 2273 PixelFormat srcPixelFormat, 2274 bool addThumbnailL, 2275 bool addThumbnailR); 2276 2277 /* Please see man pages for details 2278 2279 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 size_t StartMpEncoderFirst(u8* dst, 2390 size_t limit, 2391 const void* src, 2392 u32 width, 2393 u32 height, 2394 u32 quality, 2395 PixelSampling dstPixelSampling, 2396 PixelFormat srcPixelFormat, 2397 bool addThumbnail, 2398 u32 numImages = 2, 2399 MpTypeCode typeCode = MP_TYPE_CODE_MULTI_VIEW_DISPARITY_IMAGE, 2400 bool addImageUidList = false, 2401 bool addTotalFrames = false); 2402 2403 /* Please see man pages for details 2404 2405 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 size_t StartMpEncoderNext(const void* src, 2500 u32 width, 2501 u32 height, 2502 u32 quality, 2503 PixelSampling dstPixelSampling, 2504 PixelFormat srcPixelFormat, 2505 bool addThumbnail, 2506 MpTypeCode typeCode = MP_TYPE_CODE_MULTI_VIEW_DISPARITY_IMAGE, 2507 bool omitPixelDimensions = false); 2508 2509 /* Please see man pages for details 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 */ 2534 bool GetMpRegionsToBuildJpegData(MpRegionsToBuildJpegData* pBuffer); 2535 2536 /* Please see man pages for details 2537 2538 2539 2540 2541 2542 */ 2543 s32 GetLastError() const; 2544 2545 /* 2546 2547 */ 2548 2549 protected: 2550 detail::JpegMpEncoderWorkObj* m_pWork; 2551 bool m_Initialized; 2552 bool m_Padding[3]; 2553 2554 detail::JpegMpEncoderTemporarySettingObj m_TemporarySetting; 2555 void ClearTemporarySetting(); 2556 2557 void SetMakerNote(const u8* pBuffer, size_t size, u32 index); 2558 }; 2559 2560 } // namespace CTR { 2561 } // namespace jpeg { 2562 } // namespace nn { 2563 2564 #endif // __cplusplus 2565 2566 #endif // NN_JPEG_JPEGMPENCODER_H_ 2567