1e9297d28Sopenharmony_ci/* 2e9297d28Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 3e9297d28Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4e9297d28Sopenharmony_ci * you may not use this file except in compliance with the License. 5e9297d28Sopenharmony_ci * You may obtain a copy of the License at 6e9297d28Sopenharmony_ci * 7e9297d28Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8e9297d28Sopenharmony_ci * 9e9297d28Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10e9297d28Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11e9297d28Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12e9297d28Sopenharmony_ci * See the License for the specific language governing permissions and 13e9297d28Sopenharmony_ci * limitations under the License. 14e9297d28Sopenharmony_ci */ 15e9297d28Sopenharmony_ci 16e9297d28Sopenharmony_ci#include "layer_context.h" 17e9297d28Sopenharmony_ci 18e9297d28Sopenharmony_ci#include <securec.h> 19e9297d28Sopenharmony_ci#include "hdi_log.h" 20e9297d28Sopenharmony_ci 21e9297d28Sopenharmony_ciusing namespace OHOS; 22e9297d28Sopenharmony_ciusing namespace OHOS::Rosen; 23e9297d28Sopenharmony_ci 24e9297d28Sopenharmony_cinamespace { 25e9297d28Sopenharmony_ci#define LOGI(fmt, ...) ::OHOS::HiviewDFX::HiLog::Info( \ 26e9297d28Sopenharmony_ci ::OHOS::HiviewDFX::HiLogLabel {LOG_CORE, 0, "HelloComposer"}, \ 27e9297d28Sopenharmony_ci "%{public}s: " fmt, __func__, ##__VA_ARGS__) 28e9297d28Sopenharmony_ci#define LOGE(fmt, ...) ::OHOS::HiviewDFX::HiLog::Error( \ 29e9297d28Sopenharmony_ci ::OHOS::HiviewDFX::HiLogLabel {LOG_CORE, 0, "HelloComposer"}, \ 30e9297d28Sopenharmony_ci "%{public}s: " fmt, __func__, ##__VA_ARGS__) 31e9297d28Sopenharmony_ci} 32e9297d28Sopenharmony_ci 33e9297d28Sopenharmony_ciLayerContext::LayerContext(GraphicIRect dst, GraphicIRect src, uint32_t zorder, LayerType layerType) 34e9297d28Sopenharmony_ci : dst_(dst), src_(src), zorder_(zorder), cSurface_(IConsumerSurface::Create()), layerType_(layerType) 35e9297d28Sopenharmony_ci{ 36e9297d28Sopenharmony_ci cSurface_->SetDefaultWidthAndHeight(src.w, src.h); 37e9297d28Sopenharmony_ci cSurface_->SetDefaultUsage(BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA); 38e9297d28Sopenharmony_ci 39e9297d28Sopenharmony_ci OHOS::sptr<IBufferProducer> producer = cSurface_->GetProducer(); 40e9297d28Sopenharmony_ci pSurface_ = Surface::CreateSurfaceAsProducer(producer); 41e9297d28Sopenharmony_ci cSurface_->RegisterConsumerListener(this); 42e9297d28Sopenharmony_ci 43e9297d28Sopenharmony_ci hdiLayer_ = HdiLayerInfo::CreateHdiLayerInfo(); 44e9297d28Sopenharmony_ci LOGI("%{public}s: create surface w:%{public}d, h:%{public}d", __func__, src.w, src.h); 45e9297d28Sopenharmony_ci} 46e9297d28Sopenharmony_ci 47e9297d28Sopenharmony_ciLayerContext::~LayerContext() 48e9297d28Sopenharmony_ci{ 49e9297d28Sopenharmony_ci cSurface_ = nullptr; 50e9297d28Sopenharmony_ci pSurface_ = nullptr; 51e9297d28Sopenharmony_ci prevBuffer_ = nullptr; 52e9297d28Sopenharmony_ci hdiLayer_ = nullptr; 53e9297d28Sopenharmony_ci} 54e9297d28Sopenharmony_ci 55e9297d28Sopenharmony_civoid LayerContext::OnBufferAvailable() 56e9297d28Sopenharmony_ci{ 57e9297d28Sopenharmony_ci} 58e9297d28Sopenharmony_ci 59e9297d28Sopenharmony_civoid LayerContext::SetTestClientStatus(bool status) 60e9297d28Sopenharmony_ci{ 61e9297d28Sopenharmony_ci testClient_ = status; 62e9297d28Sopenharmony_ci} 63e9297d28Sopenharmony_ci 64e9297d28Sopenharmony_civoid LayerContext::SetTestRotateStatus(bool status) 65e9297d28Sopenharmony_ci{ 66e9297d28Sopenharmony_ci testRotate_ = status; 67e9297d28Sopenharmony_ci} 68e9297d28Sopenharmony_ci 69e9297d28Sopenharmony_civoid LayerContext::SetTestYUVStatus(bool status) 70e9297d28Sopenharmony_ci{ 71e9297d28Sopenharmony_ci testYUV_ = status; 72e9297d28Sopenharmony_ci} 73e9297d28Sopenharmony_ci 74e9297d28Sopenharmony_civoid LayerContext::SetTestLayerColor(bool status) 75e9297d28Sopenharmony_ci{ 76e9297d28Sopenharmony_ci testLayerColor_ = status; 77e9297d28Sopenharmony_ci} 78e9297d28Sopenharmony_ci 79e9297d28Sopenharmony_ciOHOS::Rosen::LayerType LayerContext::GetLayerType() const 80e9297d28Sopenharmony_ci{ 81e9297d28Sopenharmony_ci return layerType_; 82e9297d28Sopenharmony_ci} 83e9297d28Sopenharmony_ci 84e9297d28Sopenharmony_ciconst std::shared_ptr<HdiLayerInfo> LayerContext::GetHdiLayer() 85e9297d28Sopenharmony_ci{ 86e9297d28Sopenharmony_ci return hdiLayer_; 87e9297d28Sopenharmony_ci} 88e9297d28Sopenharmony_ci 89e9297d28Sopenharmony_ciSurfaceError LayerContext::DrawBufferColor() 90e9297d28Sopenharmony_ci{ 91e9297d28Sopenharmony_ci OHOS::sptr<SurfaceBuffer> buffer; 92e9297d28Sopenharmony_ci int32_t releaseFence = -1; 93e9297d28Sopenharmony_ci BufferRequestConfig config = { 94e9297d28Sopenharmony_ci .width = src_.w, 95e9297d28Sopenharmony_ci .height = src_.h, 96e9297d28Sopenharmony_ci .strideAlignment = 0x8, 97e9297d28Sopenharmony_ci .format = GRAPHIC_PIXEL_FMT_RGBA_8888, 98e9297d28Sopenharmony_ci .usage = pSurface_->GetDefaultUsage(), 99e9297d28Sopenharmony_ci }; 100e9297d28Sopenharmony_ci 101e9297d28Sopenharmony_ci if (layerType_ >= LayerType::LAYER_EXTRA && testYUV_) { 102e9297d28Sopenharmony_ci config.format = GRAPHIC_PIXEL_FMT_YCBCR_420_SP; 103e9297d28Sopenharmony_ci } 104e9297d28Sopenharmony_ci 105e9297d28Sopenharmony_ci SurfaceError ret = pSurface_->RequestBuffer(buffer, releaseFence, config); 106e9297d28Sopenharmony_ci if (ret != 0) { 107e9297d28Sopenharmony_ci LOGE("RequestBuffer failed: %{public}s", SurfaceErrorStr(ret).c_str()); 108e9297d28Sopenharmony_ci return ret; 109e9297d28Sopenharmony_ci } 110e9297d28Sopenharmony_ci 111e9297d28Sopenharmony_ci sptr<SyncFence> tempFence = new SyncFence(releaseFence); 112e9297d28Sopenharmony_ci tempFence->Wait(100); // 100 ms 113e9297d28Sopenharmony_ci 114e9297d28Sopenharmony_ci if (buffer == nullptr) { 115e9297d28Sopenharmony_ci LOGE("%s: buffer is nullptr", __func__); 116e9297d28Sopenharmony_ci return SURFACE_ERROR_NULLPTR; 117e9297d28Sopenharmony_ci } 118e9297d28Sopenharmony_ci 119e9297d28Sopenharmony_ci auto addr = static_cast<uint8_t *>(buffer->GetVirAddr()); 120e9297d28Sopenharmony_ci LOGI("buffer w:%{public}d h:%{public}d stride:%{public}d", buffer->GetWidth(), 121e9297d28Sopenharmony_ci buffer->GetHeight(), buffer->GetBufferHandle()->stride); 122e9297d28Sopenharmony_ci DrawColor(addr, buffer->GetWidth(), buffer->GetHeight()); 123e9297d28Sopenharmony_ci 124e9297d28Sopenharmony_ci BufferFlushConfig flushConfig = { 125e9297d28Sopenharmony_ci .damage = { 126e9297d28Sopenharmony_ci .w = src_.w, 127e9297d28Sopenharmony_ci .h = src_.h, 128e9297d28Sopenharmony_ci }, 129e9297d28Sopenharmony_ci }; 130e9297d28Sopenharmony_ci 131e9297d28Sopenharmony_ci ret = pSurface_->FlushBuffer(buffer, -1, flushConfig); 132e9297d28Sopenharmony_ci if (ret != SURFACE_ERROR_OK) { 133e9297d28Sopenharmony_ci LOGE("FlushBuffer failed"); 134e9297d28Sopenharmony_ci } 135e9297d28Sopenharmony_ci 136e9297d28Sopenharmony_ci return ret; 137e9297d28Sopenharmony_ci} 138e9297d28Sopenharmony_ci 139e9297d28Sopenharmony_civoid LayerContext::FillHDILayer() 140e9297d28Sopenharmony_ci{ 141e9297d28Sopenharmony_ci GraphicLayerAlpha alpha = { .enPixelAlpha = true }; 142e9297d28Sopenharmony_ci hdiLayer_->SetZorder(static_cast<int32_t>(zorder_)); 143e9297d28Sopenharmony_ci hdiLayer_->SetAlpha(alpha); 144e9297d28Sopenharmony_ci if (layerType_ >= LayerType::LAYER_EXTRA) { 145e9297d28Sopenharmony_ci SetLayerTransformType(); 146e9297d28Sopenharmony_ci } 147e9297d28Sopenharmony_ci 148e9297d28Sopenharmony_ci SetLayerCompositionType(); 149e9297d28Sopenharmony_ci std::vector<GraphicIRect> visibleRegions; 150e9297d28Sopenharmony_ci visibleRegions.emplace_back(src_); 151e9297d28Sopenharmony_ci hdiLayer_->SetVisibleRegions(visibleRegions); 152e9297d28Sopenharmony_ci std::vector<GraphicIRect> dirtyRegions; 153e9297d28Sopenharmony_ci dirtyRegions.emplace_back(src_); 154e9297d28Sopenharmony_ci hdiLayer_->SetDirtyRegions(dirtyRegions); 155e9297d28Sopenharmony_ci hdiLayer_->SetLayerSize(dst_); 156e9297d28Sopenharmony_ci 157e9297d28Sopenharmony_ci if (testLayerColor_) { 158e9297d28Sopenharmony_ci hdiLayer_->SetBlendType(GraphicBlendType::GRAPHIC_BLEND_SRC); 159e9297d28Sopenharmony_ci } else { 160e9297d28Sopenharmony_ci hdiLayer_->SetBlendType(GraphicBlendType::GRAPHIC_BLEND_SRCOVER); 161e9297d28Sopenharmony_ci } 162e9297d28Sopenharmony_ci 163e9297d28Sopenharmony_ci hdiLayer_->SetPreMulti(true); 164e9297d28Sopenharmony_ci hdiLayer_->SetCropRect(src_); 165e9297d28Sopenharmony_ci} 166e9297d28Sopenharmony_ci 167e9297d28Sopenharmony_ciSurfaceError LayerContext::FillHDIBuffer() 168e9297d28Sopenharmony_ci{ 169e9297d28Sopenharmony_ci OHOS::sptr<SurfaceBuffer> buffer = nullptr; 170e9297d28Sopenharmony_ci int32_t acquireFence = -1; 171e9297d28Sopenharmony_ci int64_t timestamp; 172e9297d28Sopenharmony_ci Rect damage; 173e9297d28Sopenharmony_ci SurfaceError ret = cSurface_->AcquireBuffer(buffer, acquireFence, timestamp, damage); 174e9297d28Sopenharmony_ci sptr<SyncFence> acquireSyncFence = new SyncFence(acquireFence); 175e9297d28Sopenharmony_ci if (ret != SURFACE_ERROR_OK) { 176e9297d28Sopenharmony_ci LOGE("Acquire buffer failed"); 177e9297d28Sopenharmony_ci return ret; 178e9297d28Sopenharmony_ci } 179e9297d28Sopenharmony_ci 180e9297d28Sopenharmony_ci hdiLayer_->SetSurface(cSurface_); 181e9297d28Sopenharmony_ci 182e9297d28Sopenharmony_ci if (testLayerColor_) { 183e9297d28Sopenharmony_ci if (layerType_ != LayerType::LAYER_LAUNCHER) { 184e9297d28Sopenharmony_ci hdiLayer_->SetBuffer(buffer, acquireSyncFence); 185e9297d28Sopenharmony_ci } else { 186e9297d28Sopenharmony_ci const uint32_t COLOR_R = 255; // 255 is red color 187e9297d28Sopenharmony_ci const uint32_t COLOR_G = 255; // 255 is green color 188e9297d28Sopenharmony_ci const uint32_t COLOR_B = 255; // 255 is blue color 189e9297d28Sopenharmony_ci const uint32_t COLOR_A = 255; // 255 is alpha 190e9297d28Sopenharmony_ci GraphicLayerColor color = { 191e9297d28Sopenharmony_ci .r = COLOR_R, 192e9297d28Sopenharmony_ci .g = COLOR_G, 193e9297d28Sopenharmony_ci .b = COLOR_B, 194e9297d28Sopenharmony_ci .a = COLOR_A 195e9297d28Sopenharmony_ci }; 196e9297d28Sopenharmony_ci 197e9297d28Sopenharmony_ci hdiLayer_->SetLayerColor(color); 198e9297d28Sopenharmony_ci } 199e9297d28Sopenharmony_ci } else { 200e9297d28Sopenharmony_ci hdiLayer_->SetBuffer(buffer, acquireSyncFence); 201e9297d28Sopenharmony_ci } 202e9297d28Sopenharmony_ci 203e9297d28Sopenharmony_ci prevBuffer_ = buffer; 204e9297d28Sopenharmony_ci prevFence_ = acquireSyncFence; 205e9297d28Sopenharmony_ci 206e9297d28Sopenharmony_ci return ret; 207e9297d28Sopenharmony_ci} 208e9297d28Sopenharmony_ci 209e9297d28Sopenharmony_civoid LayerContext::SetLayerTransformType() 210e9297d28Sopenharmony_ci{ 211e9297d28Sopenharmony_ci if (!testRotate_) { 212e9297d28Sopenharmony_ci return; 213e9297d28Sopenharmony_ci } 214e9297d28Sopenharmony_ci 215e9297d28Sopenharmony_ci static int32_t count = 0; 216e9297d28Sopenharmony_ci if (count >= 2000) { // 2000 is max cycle num 217e9297d28Sopenharmony_ci count = 0; 218e9297d28Sopenharmony_ci } 219e9297d28Sopenharmony_ci 220e9297d28Sopenharmony_ci if (count >= 100 && count <= 200) { // 100-200 ROTATE_90 221e9297d28Sopenharmony_ci hdiLayer_->SetTransform(GraphicTransformType::GRAPHIC_ROTATE_90); 222e9297d28Sopenharmony_ci } else if (count >= 500 && count <= 600) { // 500-600 ROTATE_180 223e9297d28Sopenharmony_ci hdiLayer_->SetTransform(GraphicTransformType::GRAPHIC_ROTATE_180); 224e9297d28Sopenharmony_ci } else if (count >= 900 && count <= 1000) { // 900-1000 ROTATE_270 225e9297d28Sopenharmony_ci hdiLayer_->SetTransform(GraphicTransformType::GRAPHIC_ROTATE_270); 226e9297d28Sopenharmony_ci } else if (count >= 1300 && count <= 1400) { // 1300-1400 ROTATE_NONE 227e9297d28Sopenharmony_ci hdiLayer_->SetTransform(GraphicTransformType::GRAPHIC_ROTATE_NONE); 228e9297d28Sopenharmony_ci } 229e9297d28Sopenharmony_ci 230e9297d28Sopenharmony_ci count++; 231e9297d28Sopenharmony_ci} 232e9297d28Sopenharmony_ci 233e9297d28Sopenharmony_civoid LayerContext::SetLayerCompositionType() 234e9297d28Sopenharmony_ci{ 235e9297d28Sopenharmony_ci if (layerType_ >= LayerType::LAYER_EXTRA && testClient_) { 236e9297d28Sopenharmony_ci hdiLayer_->SetCompositionType(GraphicCompositionType::GRAPHIC_COMPOSITION_CLIENT); 237e9297d28Sopenharmony_ci } else if (layerType_ == LayerType::LAYER_LAUNCHER && testLayerColor_) { 238e9297d28Sopenharmony_ci hdiLayer_->SetCompositionType(GraphicCompositionType::GRAPHIC_COMPOSITION_SOLID_COLOR); 239e9297d28Sopenharmony_ci } else { 240e9297d28Sopenharmony_ci hdiLayer_->SetCompositionType(GraphicCompositionType::GRAPHIC_COMPOSITION_DEVICE); 241e9297d28Sopenharmony_ci } 242e9297d28Sopenharmony_ci} 243e9297d28Sopenharmony_ci 244e9297d28Sopenharmony_civoid LayerContext::DrawColor(void *image, int width, int height) 245e9297d28Sopenharmony_ci{ 246e9297d28Sopenharmony_ci if (layerType_ >= LayerType::LAYER_EXTRA) { 247e9297d28Sopenharmony_ci DrawExtraColor(image, static_cast<uint32_t>(width), static_cast<uint32_t>(height)); 248e9297d28Sopenharmony_ci } else { 249e9297d28Sopenharmony_ci DrawBaseColor(image, static_cast<uint32_t>(width), static_cast<uint32_t>(height)); 250e9297d28Sopenharmony_ci } 251e9297d28Sopenharmony_ci} 252e9297d28Sopenharmony_ci 253e9297d28Sopenharmony_civoid LayerContext::DrawExtraColor(void *image, uint32_t width, uint32_t height) 254e9297d28Sopenharmony_ci{ 255e9297d28Sopenharmony_ci frameCounter_ = frameCounter_ % 60; // 60 is cycle size 256e9297d28Sopenharmony_ci if (frameCounter_ == 0) { 257e9297d28Sopenharmony_ci colorIndex_ = colorIndex_ % colors_.size(); 258e9297d28Sopenharmony_ci color_ = colors_[colorIndex_]; 259e9297d28Sopenharmony_ci colorIndex_++; 260e9297d28Sopenharmony_ci } 261e9297d28Sopenharmony_ci frameCounter_++; 262e9297d28Sopenharmony_ci 263e9297d28Sopenharmony_ci YUVPixel pixelValueYUV; 264e9297d28Sopenharmony_ci if (testYUV_) { 265e9297d28Sopenharmony_ci LOGI("DrawExtraColor with PIXEL_FMT_YCBCR_420_SP format."); 266e9297d28Sopenharmony_ci ConvertRBGA2YUV(color_, &pixelValueYUV); 267e9297d28Sopenharmony_ci DrawYUVColor(image, width, height, pixelValueYUV); 268e9297d28Sopenharmony_ci return; 269e9297d28Sopenharmony_ci } 270e9297d28Sopenharmony_ci 271e9297d28Sopenharmony_ci LOGI("DrawExtraColor with GRAPHIC_PIXEL_FMT_RGBA_8888 format."); 272e9297d28Sopenharmony_ci uint32_t *pixel = static_cast<uint32_t *>(image); 273e9297d28Sopenharmony_ci for (uint32_t x = 0; x < width; x++) { 274e9297d28Sopenharmony_ci for (uint32_t y = 0; y < height; y++) { 275e9297d28Sopenharmony_ci if (testRotate_ && x <= 50) { // 0-50 is different color 276e9297d28Sopenharmony_ci *pixel++ = 0xffff1111; 277e9297d28Sopenharmony_ci } else { 278e9297d28Sopenharmony_ci *pixel++ = color_; 279e9297d28Sopenharmony_ci } 280e9297d28Sopenharmony_ci } 281e9297d28Sopenharmony_ci } 282e9297d28Sopenharmony_ci} 283e9297d28Sopenharmony_ci 284e9297d28Sopenharmony_civoid LayerContext::DrawBaseColor(void *image, uint32_t width, uint32_t height) 285e9297d28Sopenharmony_ci{ 286e9297d28Sopenharmony_ci static uint32_t value = 0x00; 287e9297d28Sopenharmony_ci if (layerType_ == LayerType::LAYER_STATUS) { 288e9297d28Sopenharmony_ci value = 0xfff0000f; 289e9297d28Sopenharmony_ci } else if (layerType_ == LayerType::LAYER_LAUNCHER) { 290e9297d28Sopenharmony_ci value = 0xffffffff; 291e9297d28Sopenharmony_ci } else { 292e9297d28Sopenharmony_ci value = 0xff00ffff; 293e9297d28Sopenharmony_ci } 294e9297d28Sopenharmony_ci 295e9297d28Sopenharmony_ci uint32_t *pixel = static_cast<uint32_t *>(image); 296e9297d28Sopenharmony_ci for (uint32_t x = 0; x < width; x++) { 297e9297d28Sopenharmony_ci for (uint32_t y = 0; y < height; y++) { 298e9297d28Sopenharmony_ci *pixel++ = value; 299e9297d28Sopenharmony_ci } 300e9297d28Sopenharmony_ci } 301e9297d28Sopenharmony_ci} 302e9297d28Sopenharmony_ci 303e9297d28Sopenharmony_civoid LayerContext::ConvertRBGA2YUV(uint32_t pixelValueRBGA, YUVPixel *pixelValueYUV) 304e9297d28Sopenharmony_ci{ 305e9297d28Sopenharmony_ci // Get the components of pixelValueRBGA 306e9297d28Sopenharmony_ci uint8_t R = pixelValueRBGA >> RBGA_R_MOVEBITS; 307e9297d28Sopenharmony_ci uint8_t B = pixelValueRBGA >> RBGA_B_MOVEBITS; 308e9297d28Sopenharmony_ci uint8_t G = pixelValueRBGA >> RBGA_G_MOVEBITS; 309e9297d28Sopenharmony_ci 310e9297d28Sopenharmony_ci // Convert pixel from RBGA formate to YUV formate with the formula: 311e9297d28Sopenharmony_ci // fixed formula : Y = 0.299 * R + 0.587 * G + 0.114 * B; 312e9297d28Sopenharmony_ci pixelValueYUV->y = 0.299 * R + 0.587 * G + 0.114 * B; 313e9297d28Sopenharmony_ci // fixed formula : U = -0.169 * R - 0.331 * G + 0.500 * B + 128; 314e9297d28Sopenharmony_ci pixelValueYUV->u = -0.169 * R - 0.331 * G + 0.500 * B + 128; 315e9297d28Sopenharmony_ci // fixed formula : V = 0.500 * R - 0.419 * G - 0.081 * B + 128; 316e9297d28Sopenharmony_ci pixelValueYUV->v = 0.500 * R - 0.419 * G - 0.081 * B + 128; 317e9297d28Sopenharmony_ci} 318e9297d28Sopenharmony_ci 319e9297d28Sopenharmony_civoid LayerContext::DrawYUVColor(void *image, uint32_t width, uint32_t height, YUVPixel pixelValueYUV) 320e9297d28Sopenharmony_ci{ 321e9297d28Sopenharmony_ci uint8_t *pixel = static_cast<uint8_t *>(image); 322e9297d28Sopenharmony_ci width = (width / PIXEL_LINE_ALIGNMENT + 1) * PIXEL_LINE_ALIGNMENT; 323e9297d28Sopenharmony_ci for (uint32_t index = 0; index < width * height * PIXEL_YCBCR420_BYTE; index++) { 324e9297d28Sopenharmony_ci if (index < width * height) { 325e9297d28Sopenharmony_ci *pixel++ = pixelValueYUV.y; 326e9297d28Sopenharmony_ci continue; 327e9297d28Sopenharmony_ci } 328e9297d28Sopenharmony_ci if (index % PIXEL_YCBCR420_UV_NUM == 0) { 329e9297d28Sopenharmony_ci *pixel++ = pixelValueYUV.u; 330e9297d28Sopenharmony_ci } else { 331e9297d28Sopenharmony_ci *pixel++ = pixelValueYUV.v; 332e9297d28Sopenharmony_ci } 333e9297d28Sopenharmony_ci } 334e9297d28Sopenharmony_ci} 335e9297d28Sopenharmony_ci 336