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

Commit e46f9bb7 authored by Dichen Zhang's avatar Dichen Zhang
Browse files

jpegr: encode ICC

encode ICC without skia dependency

Bug: b/264715926
Test: jpegr_test
Change-Id: I944e47afdd1c0b24fab353f930a5607b2800b5be
parent c1270f0f
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -29,6 +29,7 @@ cc_library {
    local_include_dirs: ["include"],
    local_include_dirs: ["include"],


    srcs: [
    srcs: [
        "icc.cpp",
        "jpegr.cpp",
        "jpegr.cpp",
        "recoverymapmath.cpp",
        "recoverymapmath.cpp",
        "jpegrutils.cpp",
        "jpegrutils.cpp",
@@ -43,8 +44,6 @@ cc_library {
        "liblog",
        "liblog",
        "libutils",
        "libutils",
    ],
    ],

    static_libs: ["libskia"],
}
}


cc_library {
cc_library {
+584 −0

File added.

Preview size limit exceeded, changes collapsed.

+234 −0

File added.

Preview size limit exceeded, changes collapsed.

+18 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,24 @@


namespace android::jpegrecoverymap {
namespace android::jpegrecoverymap {


static constexpr uint32_t EndianSwap32(uint32_t value) {
    return ((value & 0xFF) << 24) |
           ((value & 0xFF00) << 8) |
           ((value & 0xFF0000) >> 8) |
           (value >> 24);
}
static inline uint16_t EndianSwap16(uint16_t value) {
    return static_cast<uint16_t>((value >> 8) | ((value & 0xFF) << 8));
}

#if USE_BIG_ENDIAN
    #define Endian_SwapBE32(n) EndianSwap32(n)
    #define Endian_SwapBE16(n) EndianSwap16(n)
#else
    #define Endian_SwapBE32(n) (n)
    #define Endian_SwapBE16(n) (n)
#endif

struct jpegr_metadata;
struct jpegr_metadata;
/*
/*
 * Mutable data structure. Holds information for metadata.
 * Mutable data structure. Holds information for metadata.
+4 −16
Original line number Original line Diff line number Diff line
@@ -19,25 +19,13 @@


#include <jpegrecoverymap/jpegrutils.h>
#include <jpegrecoverymap/jpegrutils.h>


namespace android::jpegrecoverymap {
#ifdef USE_BIG_ENDIAN
static constexpr uint32_t EndianSwap32(uint32_t value) {
#undef USE_BIG_ENDIAN
    return ((value & 0xFF) << 24) |
           ((value & 0xFF00) << 8) |
           ((value & 0xFF0000) >> 8) |
           (value >> 24);
}
static inline uint16_t EndianSwap16(uint16_t value) {
    return static_cast<uint16_t>((value >> 8) | ((value & 0xFF) << 8));
}
#define USE_BIG_ENDIAN true
#define USE_BIG_ENDIAN true
#if USE_BIG_ENDIAN
    #define Endian_SwapBE32(n) EndianSwap32(n)
    #define Endian_SwapBE16(n) EndianSwap16(n)
#else
    #define Endian_SwapBE32(n) (n)
    #define Endian_SwapBE16(n) (n)
#endif
#endif


namespace android::jpegrecoverymap {

constexpr size_t kNumPictures = 2;
constexpr size_t kNumPictures = 2;
constexpr size_t kMpEndianSize = 4;
constexpr size_t kMpEndianSize = 4;
constexpr uint16_t kTagSerializedCount = 3;
constexpr uint16_t kTagSerializedCount = 3;
Loading