diff options
| -rw-r--r-- | libs/jpegrecoverymap/Android.bp | 34 | ||||
| -rw-r--r-- | libs/jpegrecoverymap/OWNERS | 3 | ||||
| -rw-r--r-- | libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h | 76 | ||||
| -rw-r--r-- | libs/jpegrecoverymap/recoverymap.cpp | 77 | ||||
| -rw-r--r-- | libs/jpegrecoverymap/tests/Android.bp | 33 | ||||
| -rw-r--r-- | libs/jpegrecoverymap/tests/recoverymap_test.cpp | 22 |
6 files changed, 245 insertions, 0 deletions
diff --git a/libs/jpegrecoverymap/Android.bp b/libs/jpegrecoverymap/Android.bp new file mode 100644 index 0000000000..285f8d56dc --- /dev/null +++ b/libs/jpegrecoverymap/Android.bp @@ -0,0 +1,34 @@ +// Copyright 2022 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_native_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_native_license"], +} + +cc_library_static { + name: "libjpegrecoverymap", + vendor_available: true, + + export_include_dirs: ["include"], + local_include_dirs: ["include"], + + srcs: [ + "recoverymap.cpp", + ], +}
\ No newline at end of file diff --git a/libs/jpegrecoverymap/OWNERS b/libs/jpegrecoverymap/OWNERS new file mode 100644 index 0000000000..6ace354d0b --- /dev/null +++ b/libs/jpegrecoverymap/OWNERS @@ -0,0 +1,3 @@ +arifdikici@google.com +dichenzhang@google.com +kyslov@google.com
\ No newline at end of file diff --git a/libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h b/libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h new file mode 100644 index 0000000000..c5f8e9acd3 --- /dev/null +++ b/libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h @@ -0,0 +1,76 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace android::recoverymap { + +class RecoveryMap { +public: + /* + * This method is called in the decoding pipeline. It will decode the recovery map. + * + * input: compressed recovery map + * output: uncompressed recovery map + */ + void* decodeRecoveryMap(void* compressed_recovery_map); + + /* + * This method is called in the encoding pipeline. It will encode the recovery map. + * + * input: uncompressed recovery map + * output: compressed recovery map + */ + void* encodeRecoveryMap(void* uncompressed_recovery_map); + + /* + * This method is called in the encoding pipeline. It will take the uncompressed 8-bit and + * 10-bit yuv images as input, and calculate the uncompressed recovery map. + * + * input: uncompressed yuv_420 image, uncompressed p010 image + * output: uncompressed recovery map + */ + void* generateRecoveryMap(void* uncompressed_yuv_420_image, void* uncompressed_p010_image); + + /* + * This method is called in the decoding pipeline. It will take the uncompressed (decoded) + * 8-bit yuv image and the uncompressed(decoded) recovery map as input, and calculate the + * 10-bit recovered image (in p010 color format). + * + * input: uncompressed yuv_420 image, uncompressed recovery map + * output: uncompress p010 image + */ + void* applyRecoveryMap(void* uncompressed_yuv_420_image, void* uncompressed_recovery_map); + + /* + * This method is called in the decoding pipeline. It will read XMP metadata to find the start + * position of the compressed recovery map, and will extract the compressed recovery map. + * + * input: compressed JPEG-G image (8-bit JPEG + compressed recovery map) + * output: compressed recovery map + */ + void* extractRecoveryMap(void* compressed_jpeg_g_image); + + /* + * This method is called in the encoding pipeline. It will take the standard 8-bit JPEG image + * and the compressed recovery map as input, and update the XMP metadata with the end of JPEG + * marker, and append the compressed gian map after the JPEG. + * + * input: compressed 8-bit JPEG image (standard JPEG), compressed recovery map + * output: compressed JPEG-G image (8-bit JPEG + compressed recovery map) + */ + void* appendRecoveryMap(void* compressed_jpeg_image, void* compressed_recovery_map); +}; + +} // namespace android::recoverymap
\ No newline at end of file diff --git a/libs/jpegrecoverymap/recoverymap.cpp b/libs/jpegrecoverymap/recoverymap.cpp new file mode 100644 index 0000000000..3e95a31871 --- /dev/null +++ b/libs/jpegrecoverymap/recoverymap.cpp @@ -0,0 +1,77 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <jpegrecoverymap/recoverymap.h> + +namespace android::recoverymap { + +void* RecoveryMap::decodeRecoveryMap(void* compressed_recovery_map) { + if (compressed_recovery_map == nullptr) { + return nullptr; + } + + // TBD + return nullptr; +} + +void* RecoveryMap::encodeRecoveryMap(void* uncompressed_recovery_map) { + if (uncompressed_recovery_map == nullptr) { + return nullptr; + } + + // TBD + return nullptr; +} + +void* RecoveryMap::generateRecoveryMap( + void* uncompressed_yuv_420_image, void* uncompressed_p010_image) { + if (uncompressed_yuv_420_image == nullptr || uncompressed_p010_image == nullptr) { + return nullptr; + } + + // TBD + return nullptr; +} + +void* RecoveryMap::applyRecoveryMap( + void* uncompressed_yuv_420_image, void* uncompressed_recovery_map) { + if (uncompressed_yuv_420_image == nullptr || uncompressed_recovery_map == nullptr) { + return nullptr; + } + + // TBD + return nullptr; +} + +void* RecoveryMap::extractRecoveryMap(void* compressed_jpeg_g_image) { + if (compressed_jpeg_g_image == nullptr) { + return nullptr; + } + + // TBD + return nullptr; +} + +void* RecoveryMap::appendRecoveryMap(void* compressed_jpeg_image, void* compressed_recovery_map) { + if (compressed_jpeg_image == nullptr || compressed_recovery_map == nullptr) { + return nullptr; + } + + // TBD + return nullptr; +} + +} // namespace android::recoverymap diff --git a/libs/jpegrecoverymap/tests/Android.bp b/libs/jpegrecoverymap/tests/Android.bp new file mode 100644 index 0000000000..79bf723ea8 --- /dev/null +++ b/libs/jpegrecoverymap/tests/Android.bp @@ -0,0 +1,33 @@ +// Copyright 2022 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_native_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_native_license"], +} + +cc_test { + name: "libjpegrecoverymap_test", + test_suites: ["device-tests"], + srcs: [ + "recoverymap_test.cpp", + ], + static_libs: [ + "libjpegrecoverymap", + ], +}
\ No newline at end of file diff --git a/libs/jpegrecoverymap/tests/recoverymap_test.cpp b/libs/jpegrecoverymap/tests/recoverymap_test.cpp new file mode 100644 index 0000000000..c436138cdc --- /dev/null +++ b/libs/jpegrecoverymap/tests/recoverymap_test.cpp @@ -0,0 +1,22 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <jpegrecoverymap/recoverymap.h> + +namespace android { + +// Add new tests here. +} // namespace android |