blob: 7cedae9e0b8c72a6fa7b6b246dd22ae3b83005ad [file] [log] [blame]
Dichen Zhang85b37562022-10-11 11:08:28 -07001/*
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
19namespace android::recoverymap {
20
Dichen Zhang6947d532022-10-22 02:16:21 +000021status_t RecoveryMap::encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
22 jr_uncompressed_ptr uncompressed_yuv_420_image,
Dichen Zhangffa34012022-11-03 23:21:13 +000023 void* dest,
24 int quality,
25 jr_exif_ptr /* exif */,
26 float /* hdr_ratio */) {
Dichen Zhang6947d532022-10-22 02:16:21 +000027 if (uncompressed_p010_image == nullptr
28 || uncompressed_yuv_420_image == nullptr
29 || dest == nullptr) {
Dichen Zhang80b72482022-11-02 01:55:35 +000030 return ERROR_JPEGR_INVALID_NULL_PTR;
Dichen Zhang6947d532022-10-22 02:16:21 +000031 }
32
Dichen Zhangffa34012022-11-03 23:21:13 +000033 if (quality < 0 || quality > 100) {
34 return ERROR_JPEGR_INVALID_INPUT_TYPE;
35 }
36
Dichen Zhang6947d532022-10-22 02:16:21 +000037 // TBD
38 return NO_ERROR;
39}
40
41status_t RecoveryMap::encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
42 jr_uncompressed_ptr uncompressed_yuv_420_image,
43 void* compressed_jpeg_image,
Dichen Zhangffa34012022-11-03 23:21:13 +000044 void* dest,
45 float /* hdr_ratio */) {
Dichen Zhang6947d532022-10-22 02:16:21 +000046
47 if (uncompressed_p010_image == nullptr
48 || uncompressed_yuv_420_image == nullptr
49 || compressed_jpeg_image == nullptr
50 || dest == nullptr) {
Dichen Zhang80b72482022-11-02 01:55:35 +000051 return ERROR_JPEGR_INVALID_NULL_PTR;
Dichen Zhang6947d532022-10-22 02:16:21 +000052 }
53
54 // TBD
55 return NO_ERROR;
56}
57
58status_t RecoveryMap::encodeJPEGR(jr_uncompressed_ptr uncompressed_p010_image,
59 void* compressed_jpeg_image,
Dichen Zhangffa34012022-11-03 23:21:13 +000060 void* dest,
61 float /* hdr_ratio */) {
Dichen Zhang6947d532022-10-22 02:16:21 +000062 if (uncompressed_p010_image == nullptr
63 || compressed_jpeg_image == nullptr
64 || dest == nullptr) {
Dichen Zhang80b72482022-11-02 01:55:35 +000065 return ERROR_JPEGR_INVALID_NULL_PTR;
Dichen Zhang6947d532022-10-22 02:16:21 +000066 }
67
68 // TBD
69 return NO_ERROR;
70}
71
Dichen Zhangffa34012022-11-03 23:21:13 +000072status_t RecoveryMap::decodeJPEGR(void* compressed_jpegr_image,
73 jr_uncompressed_ptr dest,
74 jr_exif_ptr /* exif */,
75 bool /* request_sdr */) {
Dichen Zhang6947d532022-10-22 02:16:21 +000076 if (compressed_jpegr_image == nullptr || dest == nullptr) {
Dichen Zhang80b72482022-11-02 01:55:35 +000077 return ERROR_JPEGR_INVALID_NULL_PTR;
Dichen Zhang6947d532022-10-22 02:16:21 +000078 }
79
80 // TBD
81 return NO_ERROR;
82}
83
84status_t RecoveryMap::decodeRecoveryMap(jr_compressed_ptr compressed_recovery_map,
85 jr_uncompressed_ptr dest) {
Dichen Zhang596a7562022-10-12 14:57:05 -070086 if (compressed_recovery_map == nullptr || dest == nullptr) {
Dichen Zhang80b72482022-11-02 01:55:35 +000087 return ERROR_JPEGR_INVALID_NULL_PTR;
Dichen Zhang596a7562022-10-12 14:57:05 -070088 }
89
90 // TBD
Dichen Zhang6947d532022-10-22 02:16:21 +000091 return NO_ERROR;
Dichen Zhang596a7562022-10-12 14:57:05 -070092}
93
Dichen Zhang6947d532022-10-22 02:16:21 +000094status_t RecoveryMap::encodeRecoveryMap(jr_uncompressed_ptr uncompressed_recovery_map,
95 jr_compressed_ptr dest) {
Dichen Zhang596a7562022-10-12 14:57:05 -070096 if (uncompressed_recovery_map == nullptr || dest == nullptr) {
Dichen Zhang80b72482022-11-02 01:55:35 +000097 return ERROR_JPEGR_INVALID_NULL_PTR;
Dichen Zhang596a7562022-10-12 14:57:05 -070098 }
99
100 // TBD
Dichen Zhang6947d532022-10-22 02:16:21 +0000101 return NO_ERROR;
Dichen Zhang596a7562022-10-12 14:57:05 -0700102}
103
Dichen Zhang6947d532022-10-22 02:16:21 +0000104status_t RecoveryMap::generateRecoveryMap(jr_uncompressed_ptr uncompressed_yuv_420_image,
105 jr_uncompressed_ptr uncompressed_p010_image,
106 jr_uncompressed_ptr dest) {
Dichen Zhang596a7562022-10-12 14:57:05 -0700107 if (uncompressed_yuv_420_image == nullptr
108 || uncompressed_p010_image == nullptr
109 || dest == nullptr) {
Dichen Zhang80b72482022-11-02 01:55:35 +0000110 return ERROR_JPEGR_INVALID_NULL_PTR;
Dichen Zhang596a7562022-10-12 14:57:05 -0700111 }
112
113 // TBD
Dichen Zhang6947d532022-10-22 02:16:21 +0000114 return NO_ERROR;
Dichen Zhang596a7562022-10-12 14:57:05 -0700115}
116
Dichen Zhang6947d532022-10-22 02:16:21 +0000117status_t RecoveryMap::applyRecoveryMap(jr_uncompressed_ptr uncompressed_yuv_420_image,
118 jr_uncompressed_ptr uncompressed_recovery_map,
119 jr_uncompressed_ptr dest) {
Dichen Zhang596a7562022-10-12 14:57:05 -0700120 if (uncompressed_yuv_420_image == nullptr
121 || uncompressed_recovery_map == nullptr
122 || dest == nullptr) {
Dichen Zhang80b72482022-11-02 01:55:35 +0000123 return ERROR_JPEGR_INVALID_NULL_PTR;
Dichen Zhang596a7562022-10-12 14:57:05 -0700124 }
125
126 // TBD
Dichen Zhang6947d532022-10-22 02:16:21 +0000127 return NO_ERROR;
Dichen Zhang596a7562022-10-12 14:57:05 -0700128}
129
Dichen Zhang6947d532022-10-22 02:16:21 +0000130status_t RecoveryMap::extractRecoveryMap(void* compressed_jpegr_image, jr_compressed_ptr dest) {
131 if (compressed_jpegr_image == nullptr || dest == nullptr) {
Dichen Zhang80b72482022-11-02 01:55:35 +0000132 return ERROR_JPEGR_INVALID_NULL_PTR;
Dichen Zhang85b37562022-10-11 11:08:28 -0700133 }
134
135 // TBD
Dichen Zhang6947d532022-10-22 02:16:21 +0000136 return NO_ERROR;
Dichen Zhang85b37562022-10-11 11:08:28 -0700137}
138
Dichen Zhang6947d532022-10-22 02:16:21 +0000139status_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 Zhang80b72482022-11-02 01:55:35 +0000145 return ERROR_JPEGR_INVALID_NULL_PTR;
Dichen Zhang85b37562022-10-11 11:08:28 -0700146 }
147
148 // TBD
Dichen Zhang6947d532022-10-22 02:16:21 +0000149 return NO_ERROR;
Dichen Zhang85b37562022-10-11 11:08:28 -0700150}
151
152} // namespace android::recoverymap