Commit Graph

18 Commits

Author SHA1 Message Date
Brian Salomon
0c0b5a6bb2 Remove SkYUVASizeInfo, make SkYUVAIndex a private part of SkYUVAInfo
Bug: skia:10632
Change-Id: If4dd7779b0856f6d0b441381bf7f2f51527cdb9d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352497
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-01-12 15:06:26 +00:00
Brian Salomon
fcc4e85f3c Remove SkYUVAInfo::PlanarConfig
Bug: skia:10632
Change-Id: I72b4379c82fd7dc4c7169387014f8fffbb86e23f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334161
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-11-18 14:26:14 +00:00
Brian Salomon
e4387382c2 Split SkYUVAInfo::PlanarConfig into PlaneConfig and Subsampling enums
Sometimes it's helpful to think about subsampling separately from
how the channels are spread across planes.

Bug: skia:10632
Change-Id: Ib03f71195f9706ef6def418b1f2125c29e0cf738
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334102
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-11-11 22:42:36 +00:00
Brian Salomon
bd3792de72 Add SkYUVAInfo-based promise texture image factory
Bug: skia:10632
Change-Id: I6a31f2d712f704850ba5246208dc8a4a6e6916eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333519
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-11-11 14:38:55 +00:00
Brian Salomon
694ff17357 Revert "Revert changes to unbreak bots."
This reverts commit 49721c8437.

Reason for revert: fixed double usage of plane release context in
 YUVUtils.

Original change's description:
> Revert changes to unbreak bots.
>
> f01a9d9020
> is the culprit
>
>
> Revert "GrRefCntedCallback has Make function."
>
> This reverts commit b2c42140ea.
>
> Revert "Add SkImage::MakeFromYUVATexturesCopyToExternal"
>
> This reverts commit f01a9d9020.
>
> Bug: skia:10632
> Change-Id: Ief076f168b63ff8ca15b607163a13d5f52a733d2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331798
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com

Change-Id: I41cdfe0d5b8587f85fae0c804c059c0d6ff92800


Bug: skia:10632
Change-Id: I41cdfe0d5b8587f85fae0c804c059c0d6ff92800
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331876
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-11-05 14:35:23 +00:00
Brian Salomon
49721c8437 Revert changes to unbreak bots.
f01a9d9020
is the culprit


Revert "GrRefCntedCallback has Make function."

This reverts commit b2c42140ea.

Revert "Add SkImage::MakeFromYUVATexturesCopyToExternal"

This reverts commit f01a9d9020.

Bug: skia:10632
Change-Id: Ief076f168b63ff8ca15b607163a13d5f52a733d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331798
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-11-03 18:52:45 +00:00
Brian Salomon
f01a9d9020 Add SkImage::MakeFromYUVATexturesCopyToExternal
Updated API for creating a RGBA texture-backed image from RGBA texture
planes with user-provided backing store using GrYUVABackendTextures.

Ultimately we would like to remove all such APIs and have the client
make a SkSurface and draw a YUVA texture image to the surface but
a recent attempt to do that in Chrome caused a not yet understood
perf regression.

Add wacky_yuv_formats variation that tests new api.

Bug: skia:10632
Change-Id: I89411216948682f13281a91a7575d5f345badda7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329956
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-11-03 15:03:21 +00:00
Brian Salomon
7db7139f40 Revert "Revert "Move all YUVA image creation in GMs into sk_gpu_test::LazyYUVImage.""
This reverts commit 839fb228ac.

Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-Clang-arm-Debug-Chromebook_GLES
Bug: skia:10632
Change-Id: I7c9fc21f03dfd0537fed6074e550dd8a500a12b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327623
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-16 14:58:13 +00:00
Brian Salomon
839fb228ac Revert "Move all YUVA image creation in GMs into sk_gpu_test::LazyYUVImage."
This reverts commit db0288d747.

Reason for revert: undeclared tuple size

Original change's description:
> Move all YUVA image creation in GMs into sk_gpu_test::LazyYUVImage.
>
> LazyYUVImage now supports making images from a generator and from
> textures. It uses ManagedBackendTexture to manage texture plane
> lifetime via ref-counting.
>
> Adds some supporting utility functions to SkYUVAInfo and
> SkYUVAPixmaps.
>
> Eases transition of forthcoming MakeFromYUVATextures API change.
>
> Bug: skia:10632
>
> Change-Id: I8cfd747c27076d1627da6ea8a169e554a96049e0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326720
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,robertphillips@google.com

Change-Id: Icdfb70f7dadd97eace8f88d5a886d31534102f5f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327622
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-16 13:37:43 +00:00
Brian Salomon
db0288d747 Move all YUVA image creation in GMs into sk_gpu_test::LazyYUVImage.
LazyYUVImage now supports making images from a generator and from
textures. It uses ManagedBackendTexture to manage texture plane
lifetime via ref-counting.

Adds some supporting utility functions to SkYUVAInfo and
SkYUVAPixmaps.

Eases transition of forthcoming MakeFromYUVATextures API change.

Bug: skia:10632

Change-Id: I8cfd747c27076d1627da6ea8a169e554a96049e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326720
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-16 13:19:01 +00:00
Brian Salomon
94f65d784c Expand SkYUVAInfo::PlanarConfig/SkYUVAPixmapInfo::DataType values.
Now supports all plane configurations tested by WackyYUVFormatsGM.

Added WackyYUVFormatsGM that tests YUVA interface on SkImageGenerator.


Change-Id: I8326f098f1453b9702f04ff366431a516ca160c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317097
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-18 20:43:12 +00:00
Brian Salomon
c2a9a9716e New version of SkImage::MakeFromYUVAPixmaps()
Takes SkYUVAPixmaps. Still implemented in terms of SkYUVAIndex[4]
internally.

Replace all internal use cases except wacky_yuv_formats.

Takes GrRecordingContext rather than GrContext.

SkVideoDecoder updated to take GrRecordingContext.

Bug: skia:10632

Change-Id: I6e9b9b6a4f11333bce6f87c1ebff0acb297f6540
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316837
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-15 16:13:50 +00:00
Brian Salomon
c6655070d0 SK_API on SkYUVAPixmaps::SupportedDataTypes.
Bug: skia:10632
Change-Id: I346529e6ef0d5f859b6959199dd05ddde2d72ebe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315598
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-08 14:46:10 +00:00
Brian Salomon
59c60b0cb3 Reland "Add idea of DataType to SkYUVAPixmapInfo."
This is a reland of ed63444587

Original change's description:
> Add idea of DataType to SkYUVAPixmapInfo.
> 
> DataType describes the data type of YUVA channels
> independent of how they are grouped into planes.
> 
> Adds mapping functions between SkColorType/channel count
> and DataType.
> 
> SkYUVAPixmapInfo can be constructed from DataType and will
> choose appropriate SkColorTypes for each plane.
> 
> Valid SkYUVAPixmapInfos now have the same DataType for each
> plane (could relax this in the future, esp for alpha plane).
> 
> SkYUVAPixmapInfo::SupportedDataTypes specifies the supported
> combinations of SkYUVAInfo::PlanarConfig and
> kYUVAPixmapInfo::DataType supported by a GrContext (based on
> supported texture formats).
> 
> SkImageGenerator/SkCodec YUVA query API now takes a
> SupportedDataTypes.
> 
> Change-Id: I8791234638e6ba3396d1e7960b7bc210edc6dd57
> Bug: skia:10632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314276
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:10632
Change-Id: I35b55b7477c11c822fdb3729a9f84acff1eb785d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315284
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-03 18:05:17 +00:00
Michael Ludwig
c7fa895e50 Revert "Add idea of DataType to SkYUVAPixmapInfo."
This reverts commit ed63444587.

Reason for revert: trying to unblock android roller, which incorrectly thinks this has a merge conflict: https://b.corp.google.com/issues/167576324

Original change's description:
> Add idea of DataType to SkYUVAPixmapInfo.
> 
> DataType describes the data type of YUVA channels
> independent of how they are grouped into planes.
> 
> Adds mapping functions between SkColorType/channel count
> and DataType.
> 
> SkYUVAPixmapInfo can be constructed from DataType and will
> choose appropriate SkColorTypes for each plane.
> 
> Valid SkYUVAPixmapInfos now have the same DataType for each
> plane (could relax this in the future, esp for alpha plane).
> 
> SkYUVAPixmapInfo::SupportedDataTypes specifies the supported
> combinations of SkYUVAInfo::PlanarConfig and
> kYUVAPixmapInfo::DataType supported by a GrContext (based on
> supported texture formats).
> 
> SkImageGenerator/SkCodec YUVA query API now takes a
> SupportedDataTypes.
> 
> Change-Id: I8791234638e6ba3396d1e7960b7bc210edc6dd57
> Bug: skia:10632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314276
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,scroggo@google.com

Change-Id: I72c39539a4766f10cac3ca3cdef6c503a8319ff1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314895
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-09-02 21:26:39 +00:00
Brian Salomon
ed63444587 Add idea of DataType to SkYUVAPixmapInfo.
DataType describes the data type of YUVA channels
independent of how they are grouped into planes.

Adds mapping functions between SkColorType/channel count
and DataType.

SkYUVAPixmapInfo can be constructed from DataType and will
choose appropriate SkColorTypes for each plane.

Valid SkYUVAPixmapInfos now have the same DataType for each
plane (could relax this in the future, esp for alpha plane).

SkYUVAPixmapInfo::SupportedDataTypes specifies the supported
combinations of SkYUVAInfo::PlanarConfig and
kYUVAPixmapInfo::DataType supported by a GrContext (based on
supported texture formats).

SkImageGenerator/SkCodec YUVA query API now takes a
SupportedDataTypes.

Change-Id: I8791234638e6ba3396d1e7960b7bc210edc6dd57
Bug: skia:10632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314276
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-02 13:21:45 +00:00
Brian Salomon
ffd61ca012 Simpler SkYUVAPixmapInfo construction
Bug: skia:10632
Change-Id: I40636d004f8458b3eb578caeeb9e77594ce8bc54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313908
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-08-31 13:45:46 +00:00
Brian Salomon
be0e42cb8f New helpers for SkYUVAInfo when used with pixmaps.
SkYUVAPixmapInfo is a SkYUVAInfo with per-plane color types and row
bytes. It describes a set of pixmaps that make up a planar image.
Consolidates validity checks of the SkYUVAInfo with the color types
and row bytes. It can provide SkImageInfos for each plane and also
assist with configuring planes to share a common allocation.

SkYUVAPixmaps is a collection of SkPixmaps that are valid for a
SkYUVAInfo. It can either wrap existing SkPixmaps or allocate and
own the memory. It consolidates validity checking of SkPixmaps with
the SkYUVAInfo. Replaces sk_gpu_test::YUVAPixmaps.

Minor tweaks to SkYUVAInfo naming, parameter order consistency, adds a
hasAlpha() method.

Bug: skia:10632
Change-Id: Ib0f48b8448fff22805fd0c04e07887d0b7338b76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312886
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-08-27 15:39:56 +00:00