From 59b31c9b90adac077240290ce45656920fd4118d Mon Sep 17 00:00:00 2001 From: Max Zhang Date: Mon, 23 Sep 2019 13:02:01 -0700 Subject: [PATCH] yukawa: adapt different YCC orders The order of the planes doesn't matter, therefore enable mapper adapter to support YCbCr and YCrCb both. test: manual bug: 141006723 Change-Id: Iad0d5159c1b38b12bc90a07f937db002471aad1e --- .../include/mapper-passthrough/2.0/Gralloc1Hal.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/Gralloc1Hal.h b/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/Gralloc1Hal.h index d9beb4f678..db7e67dd9c 100644 --- a/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/Gralloc1Hal.h +++ b/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/Gralloc1Hal.h @@ -282,14 +282,16 @@ class Gralloc1HalImpl : public Hal { } if (flex.planes[0].component != FLEX_COMPONENT_Y || - flex.planes[1].component != FLEX_COMPONENT_Cb || - flex.planes[2].component != FLEX_COMPONENT_Cr) { + ((flex.planes[1].component != FLEX_COMPONENT_Cb || flex.planes[2].component != FLEX_COMPONENT_Cr) && + (flex.planes[2].component != FLEX_COMPONENT_Cb || flex.planes[1].component != FLEX_COMPONENT_Cr))) { return false; } const auto& y = flex.planes[0]; - const auto& cb = flex.planes[1]; - const auto& cr = flex.planes[2]; + const auto& cb = (flex.planes[1].component == FLEX_COMPONENT_Cb)? + flex.planes[1] : flex.planes[2]; + const auto& cr = (flex.planes[2].component == FLEX_COMPONENT_Cr)? + flex.planes[2] : flex.planes[1]; if (cb.h_increment != cr.h_increment || cb.v_increment != cr.v_increment) { return false;