Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd support for 10/12 bits YUV images #3113
Conversation
|
Looks great in general! Is this blocked on 1493198 changes, or the other way around?
webrender_api/src/image.rs, line 142 at r1 (raw file):
does it make sense to have a "bytes per channel" metric if the channels can be tightly packed together? i.e. YUV10 should fit in 4 bytes total, but this metric would make it look like it needs 3 * 2 = 6 bytes webrender_api/src/image.rs, line 154 at r1 (raw file):
are these the proper constants though? if you have a floating-point value in range 0 - 1, and you encode it in N bits, the scaler is (2^N - 1). So if you want to re-scale it from one representation to another, you'd need (2^N - 1) / (2^M -1) instead of just 2^(N-M). Unless, of course, we are doing something to compensate for this when we fill out the A16 image data. |
webrender_api/src/image.rs, line 142 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
YUV format have many shapes and form, this is really the number of bytes per channel's pixel. The size of a pixel with all components would be for YUV420: width*2+(width/2)*2+(width/2)2=width4 I'll remove the method, it's only needed when feeling the planes. webrender_api/src/image.rs, line 154 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
It's encoded on 16 bits. For an image with N bit depth (where N is 10 or 12). We need to multiply by: So yes, they are proper constants, and won't change so long that ColorDepth.bytes_per_pixel=2 |
|
They rely on one another, the need to both go at the same time.
|
webrender_api/src/image.rs, line 142 at r1 (raw file):
|
We define the ColorDepth type in image as ultimately all types of images should support native color bit depth higher than 8 bits. This change requires other patches found in bug 1493198
| @@ -359,6 +373,8 @@ impl TextureCache { | |||
|
|
|||
| self.array_a8_linear | |||
| .update_profile(&mut texture_cache_profile.pages_a8_linear); | |||
| self.array_a16_linear | |||
This comment has been minimized.
This comment has been minimized.
gw3583
Sep 24, 2018
Collaborator
If we only support R16 images via external image handles, then we can actually remove all the array_a16 code completely, and just add the new image format to the unreachable blocks in the texture cache. Do we ever want to support R16 images that are provided by CPU-side buffers? And if we do, perhaps we just want them to be standalone textures, rather than trying to fit them into a texture cache page?
|
@jyavenard Added a couple of questions about the texture cache code above. It's not a blocker - these only allocate texture cache pages lazily - but we could probably remove them if we don't think we want to support that code path. Thoughts? |
|
From discussion on IRC, we decided to keep the texture cache support for now. It should be zero-cost if unused and may end up being used in the future for HDR image support etc. |
|
@bors-servo r=kvark,gw3583 |
|
|
webrender/src/texture_cache.rs, line 376 at r3 (raw file): Previously, gw3583 (Glenn Watson) wrote…
Done. |
Add support for 10/12 bits YUV images We define the ColorDepth type in image as ultimately all types of images should support native color bit depth higher than 8 bits. This change requires other patches found in bug 1493198 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/3113) <!-- Reviewable:end -->
|
|
jyavenard commentedSep 24, 2018
•
edited by larsbergstrom
We define the ColorDepth type in image as ultimately all types of images should support native color bit depth higher than 8 bits.
This change requires other patches found in bug 1493198
This change is