Dichen Zhang | 85b3756 | 2022-10-11 11:08:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <jpegrecoverymap/recoverymap.h> |
| 18 | |
| 19 | namespace android::recoverymap { |
| 20 | |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 21 | status_t RecoveryMap::encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image, |
| 22 | jr_uncompressed_ptr uncompressed_yuv_420_image, |
Dichen Zhang | ffa3401 | 2022-11-03 23:21:13 +0000 | [diff] [blame^] | 23 | void* dest, |
| 24 | int quality, |
| 25 | jr_exif_ptr /* exif */, |
| 26 | float /* hdr_ratio */) { |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 27 | if (uncompressed_p010_image == nullptr |
| 28 | || uncompressed_yuv_420_image == nullptr |
| 29 | || dest == nullptr) { |
Dichen Zhang | 80b7248 | 2022-11-02 01:55:35 +0000 | [diff] [blame] | 30 | return ERROR_JPEGR_INVALID_NULL_PTR; |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 31 | } |
| 32 | |
Dichen Zhang | ffa3401 | 2022-11-03 23:21:13 +0000 | [diff] [blame^] | 33 | if (quality < 0 || quality > 100) { |
| 34 | return ERROR_JPEGR_INVALID_INPUT_TYPE; |
| 35 | } |
| 36 | |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 37 | // TBD |
| 38 | return NO_ERROR; |
| 39 | } |
| 40 | |
| 41 | status_t RecoveryMap::encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image, |
| 42 | jr_uncompressed_ptr uncompressed_yuv_420_image, |
| 43 | void* compressed_jpeg_image, |
Dichen Zhang | ffa3401 | 2022-11-03 23:21:13 +0000 | [diff] [blame^] | 44 | void* dest, |
| 45 | float /* hdr_ratio */) { |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 46 | |
| 47 | if (uncompressed_p010_image == nullptr |
| 48 | || uncompressed_yuv_420_image == nullptr |
| 49 | || compressed_jpeg_image == nullptr |
| 50 | || dest == nullptr) { |
Dichen Zhang | 80b7248 | 2022-11-02 01:55:35 +0000 | [diff] [blame] | 51 | return ERROR_JPEGR_INVALID_NULL_PTR; |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | // TBD |
| 55 | return NO_ERROR; |
| 56 | } |
| 57 | |
| 58 | status_t RecoveryMap::encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image, |
| 59 | void* compressed_jpeg_image, |
Dichen Zhang | ffa3401 | 2022-11-03 23:21:13 +0000 | [diff] [blame^] | 60 | void* dest, |
| 61 | float /* hdr_ratio */) { |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 62 | if (uncompressed_p010_image == nullptr |
| 63 | || compressed_jpeg_image == nullptr |
| 64 | || dest == nullptr) { |
Dichen Zhang | 80b7248 | 2022-11-02 01:55:35 +0000 | [diff] [blame] | 65 | return ERROR_JPEGR_INVALID_NULL_PTR; |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | // TBD |
| 69 | return NO_ERROR; |
| 70 | } |
| 71 | |
Dichen Zhang | ffa3401 | 2022-11-03 23:21:13 +0000 | [diff] [blame^] | 72 | status_t RecoveryMap::decodeJPEGR(void* compressed_jpegr_image, |
| 73 | jr_uncompressed_ptr dest, |
| 74 | jr_exif_ptr /* exif */, |
| 75 | bool /* request_sdr */) { |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 76 | if (compressed_jpegr_image == nullptr || dest == nullptr) { |
Dichen Zhang | 80b7248 | 2022-11-02 01:55:35 +0000 | [diff] [blame] | 77 | return ERROR_JPEGR_INVALID_NULL_PTR; |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | // TBD |
| 81 | return NO_ERROR; |
| 82 | } |
| 83 | |
| 84 | status_t RecoveryMap::decodeRecoveryMap(jr_compressed_ptr compressed_recovery_map, |
| 85 | jr_uncompressed_ptr dest) { |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 86 | if (compressed_recovery_map == nullptr || dest == nullptr) { |
Dichen Zhang | 80b7248 | 2022-11-02 01:55:35 +0000 | [diff] [blame] | 87 | return ERROR_JPEGR_INVALID_NULL_PTR; |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | // TBD |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 91 | return NO_ERROR; |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 92 | } |
| 93 | |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 94 | status_t RecoveryMap::encodeRecoveryMap(jr_uncompressed_ptr uncompressed_recovery_map, |
| 95 | jr_compressed_ptr dest) { |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 96 | if (uncompressed_recovery_map == nullptr || dest == nullptr) { |
Dichen Zhang | 80b7248 | 2022-11-02 01:55:35 +0000 | [diff] [blame] | 97 | return ERROR_JPEGR_INVALID_NULL_PTR; |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | // TBD |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 101 | return NO_ERROR; |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 102 | } |
| 103 | |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 104 | status_t RecoveryMap::generateRecoveryMap(jr_uncompressed_ptr uncompressed_yuv_420_image, |
| 105 | jr_uncompressed_ptr uncompressed_p010_image, |
| 106 | jr_uncompressed_ptr dest) { |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 107 | if (uncompressed_yuv_420_image == nullptr |
| 108 | || uncompressed_p010_image == nullptr |
| 109 | || dest == nullptr) { |
Dichen Zhang | 80b7248 | 2022-11-02 01:55:35 +0000 | [diff] [blame] | 110 | return ERROR_JPEGR_INVALID_NULL_PTR; |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | // TBD |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 114 | return NO_ERROR; |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 115 | } |
| 116 | |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 117 | status_t RecoveryMap::applyRecoveryMap(jr_uncompressed_ptr uncompressed_yuv_420_image, |
| 118 | jr_uncompressed_ptr uncompressed_recovery_map, |
| 119 | jr_uncompressed_ptr dest) { |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 120 | if (uncompressed_yuv_420_image == nullptr |
| 121 | || uncompressed_recovery_map == nullptr |
| 122 | || dest == nullptr) { |
Dichen Zhang | 80b7248 | 2022-11-02 01:55:35 +0000 | [diff] [blame] | 123 | return ERROR_JPEGR_INVALID_NULL_PTR; |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | // TBD |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 127 | return NO_ERROR; |
Dichen Zhang | 596a756 | 2022-10-12 14:57:05 -0700 | [diff] [blame] | 128 | } |
| 129 | |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 130 | status_t RecoveryMap::extractRecoveryMap(void* compressed_jpegr_image, jr_compressed_ptr dest) { |
| 131 | if (compressed_jpegr_image == nullptr || dest == nullptr) { |
Dichen Zhang | 80b7248 | 2022-11-02 01:55:35 +0000 | [diff] [blame] | 132 | return ERROR_JPEGR_INVALID_NULL_PTR; |
Dichen Zhang | 85b3756 | 2022-10-11 11:08:28 -0700 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | // TBD |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 136 | return NO_ERROR; |
Dichen Zhang | 85b3756 | 2022-10-11 11:08:28 -0700 | [diff] [blame] | 137 | } |
| 138 | |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 139 | status_t RecoveryMap::appendRecoveryMap(void* compressed_jpeg_image, |
| 140 | jr_compressed_ptr compressed_recovery_map, |
| 141 | void* dest) { |
| 142 | if (compressed_jpeg_image == nullptr |
| 143 | || compressed_recovery_map == nullptr |
| 144 | || dest == nullptr) { |
Dichen Zhang | 80b7248 | 2022-11-02 01:55:35 +0000 | [diff] [blame] | 145 | return ERROR_JPEGR_INVALID_NULL_PTR; |
Dichen Zhang | 85b3756 | 2022-10-11 11:08:28 -0700 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | // TBD |
Dichen Zhang | 6947d53 | 2022-10-22 02:16:21 +0000 | [diff] [blame] | 149 | return NO_ERROR; |
Dichen Zhang | 85b3756 | 2022-10-11 11:08:28 -0700 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | } // namespace android::recoverymap |