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

Commit 48ae29e9 authored by Emilian Peev's avatar Emilian Peev
Browse files

Camera: Correct the U/V plane selection for HEIC streams

'codecUvOffsetDiff' will always result in positive values
which will make the U plane essentially the only possible
destination plane.
Consider the 'codecUPlaneFirst' when selecting the destination plane.

Bug: 348591621
Test: Camera CTS
Change-Id: I4fa7a3e9a0607a44a996e6c5893090b1c328823a
parent ddc2de8f
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1583,7 +1583,7 @@ status_t HeicCompositeStream::copyOneYuvTile(sp<MediaCodecBuffer>& codecBuffer,
        // The chrome plane could be either Cb first, or Cr first. Take the
        // The chrome plane could be either Cb first, or Cr first. Take the
        // smaller address.
        // smaller address.
        uint8_t *src = std::min(yuvBuffer.dataCb, yuvBuffer.dataCr);
        uint8_t *src = std::min(yuvBuffer.dataCb, yuvBuffer.dataCr);
        MediaImage2::PlaneIndex dstPlane = codecUvOffsetDiff > 0 ? MediaImage2::U : MediaImage2::V;
        MediaImage2::PlaneIndex dstPlane = codecUPlaneFirst ? MediaImage2::U : MediaImage2::V;
        for (auto row = top/2; row < (top+height)/2; row++) {
        for (auto row = top/2; row < (top+height)/2; row++) {
            uint8_t *dst = codecBuffer->data() + imageInfo->mPlane[dstPlane].mOffset +
            uint8_t *dst = codecBuffer->data() + imageInfo->mPlane[dstPlane].mOffset +
                    imageInfo->mPlane[dstPlane].mRowInc * (row - top/2);
                    imageInfo->mPlane[dstPlane].mRowInc * (row - top/2);