Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87717eaf authored by Dichen Zhang's avatar Dichen Zhang Committed by Android (Google) Code Review
Browse files

Merge "Add JPEG Recovery Map Library"

parents e70fb031 85b37566
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
// 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
+3 −0
Original line number Diff line number Diff line
arifdikici@google.com
dichenzhang@google.com
kyslov@google.com
 No newline at end of file
+76 −0
Original line number Diff line number Diff line
/*
 * 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
+77 −0
Original line number Diff line number Diff line
/*
 * 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
+33 −0
Original line number Diff line number Diff line
// 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
Loading