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

Commit 9766c8de authored by Lajos Molnar's avatar Lajos Molnar Committed by Automerger Merge Worker
Browse files

stagefright:ColorConverter: add support for BT.601/709/2020 limited and full range am: 9dab9ece

parents e1036abe 9dab9ece
Loading
Loading
Loading
Loading
+327 −248

File changed.

Preview size limit exceeded, changes collapsed.

+15 −3
Original line number Diff line number Diff line
@@ -47,15 +47,20 @@ struct ColorConverter {
            size_t dstCropLeft, size_t dstCropTop,
            size_t dstCropRight, size_t dstCropBottom);

    struct Coeffs; // matrix coefficients

private:
    struct ColorSpace {
        uint32_t mStandard;
        uint32_t mRange;
        uint32_t mTransfer;

        bool isBt709();
        bool isBt2020();
        bool isJpeg();
        bool isBt2020() const;

        // libyuv helper methods
        bool isH420() const;
        bool isI420() const;
        bool isJ420() const;
    };

    struct BitmapParams {
@@ -84,6 +89,9 @@ private:
    uint8_t *initClip();
    uint16_t *initClip10Bit();

    // returns the YUV2RGB matrix coefficients according to the color aspects and bit depth
    const struct Coeffs *getMatrix() const;

    status_t convertCbYCrY(
            const BitmapParams &src, const BitmapParams &dst);

@@ -111,6 +119,10 @@ private:
    status_t convertYUV420SemiPlanar(
            const BitmapParams &src, const BitmapParams &dst);

    status_t convertYUV420SemiPlanarBase(
            const BitmapParams &src, const BitmapParams &dst,
            const uint8_t *src_y, const uint8_t *src_u, size_t row_inc, bool isNV21 = false);

    status_t convertTIYUV420PackedSemiPlanar(
            const BitmapParams &src, const BitmapParams &dst);