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

Commit e911f2e3 authored by Susmitha Gummalla's avatar Susmitha Gummalla Committed by Shuzhen Wang
Browse files

Camera: Update max HEIC buffer calculation

--Update buffer size calculation to use 512 aligned width
  and height as HEIC images are tiled as 512x512

Bug: 173763227
CRs-Fixed: 2785345
Test: Camera CTS
Change-Id: I84ebd19bf01cf2a1de529b5b91f7882305d6ce37
parent b228994b
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#define LOG_TAG "Camera3-HeicCompositeStream"
#define ATRACE_TAG ATRACE_TAG_CAMERA
#define ALIGN(x, mask) ( ((x) + (mask) - 1) & ~((mask) - 1) )
//#define LOG_NDEBUG 0

#include <linux/memfd.h>
@@ -1380,7 +1381,9 @@ status_t HeicCompositeStream::initializeCodec(uint32_t width, uint32_t height,
    mOutputWidth = width;
    mOutputHeight = height;
    mAppSegmentMaxSize = calcAppSegmentMaxSize(cameraDevice->info());
    mMaxHeicBufferSize = mOutputWidth * mOutputHeight * 3 / 2 + mAppSegmentMaxSize;
    mMaxHeicBufferSize =
        ALIGN(mOutputWidth, HeicEncoderInfoManager::kGridWidth) *
        ALIGN(mOutputHeight, HeicEncoderInfoManager::kGridHeight) * 3 / 2 + mAppSegmentMaxSize;

    return OK;
}
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ public:
    bool isSizeSupported(int32_t width, int32_t height,
            bool* useHeic, bool* useGrid, int64_t* stall, AString* hevcName) const;

    // kGridWidth and kGridHeight should be 2^n
    static const auto kGridWidth = 512;
    static const auto kGridHeight = 512;
private: