150 :(CVPixelBufferRef)pixelBuffer
153 SkISize::Make(CVPixelBufferGetWidth(pixelBuffer), CVPixelBufferGetHeight(pixelBuffer));
154 CVMetalTextureRef yMetalTexture = nullptr;
155 {
156 CVReturn cvReturn =
157 CVMetalTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
158 _textureCache,
159 pixelBuffer,
160 nullptr,
161 MTLPixelFormatR8Unorm,
164 0u,
165 &yMetalTexture);
166
167 if (cvReturn != kCVReturnSuccess) {
168 FML_DLOG(
ERROR) <<
"Could not create Metal texture from pixel buffer: CVReturn " << cvReturn;
169 return nullptr;
170 }
171 }
172
173 CVMetalTextureRef uvMetalTexture = nullptr;
174 {
175 CVReturn cvReturn =
176 CVMetalTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
177 _textureCache,
178 pixelBuffer,
179 nullptr,
180 MTLPixelFormatRG8Unorm,
181 textureSize.
width() / 2,
183 1u,
184 &uvMetalTexture);
185
186 if (cvReturn != kCVReturnSuccess) {
187 FML_DLOG(
ERROR) <<
"Could not create Metal texture from pixel buffer: CVReturn " << cvReturn;
188 return nullptr;
189 }
190 }
191
192 id<MTLTexture> yTex = CVMetalTextureGetTexture(yMetalTexture);
193 CVBufferRelease(yMetalTexture);
194
195 id<MTLTexture> uvTex = CVMetalTextureGetTexture(uvMetalTexture);
196 CVBufferRelease(uvMetalTexture);
197
206
214
216 _pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
219
221 yuvColorSpace);
222 }
223
231 width:textureSize.width()
232 height:textureSize.height()];
233 if (!skImage) {
234 return nullptr;
235 }
236
237
239}
@ kRec601_Limited_SkYUVColorSpace
describes SDTV range
@ kJPEG_Full_SkYUVColorSpace
describes full range
static sk_sp< DlImageImpeller > MakeFromYUVTextures(AiksContext *aiks_context, std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)
sk_sp< SkImage > wrapYUVATexture:UVTex:YUVColorSpace:grContext:width:height:(nonnull id< MTLTexture > yTex,[UVTex] nonnull id< MTLTexture > uvTex,[YUVColorSpace] SkYUVColorSpace colorSpace,[grContext] nonnull GrDirectContext *grContext,[width] size_t width,[height] size_t height)
impeller::AiksContext * aiks_context