- From: Christopher Cameron <ccameron@google.com>
- Date: Tue, 14 Feb 2023 10:59:55 +0100
- To: Lars Borg <borg@adobe.com>
- Cc: Pierre-Anthony Lemieux <pal@sandflow.com>, "public-colorweb@w3.org" <public-colorweb@w3.org>, Chris Needham <chris.needham@bbc.co.uk>
- Message-ID: <CAGnfxj_yvX7g20Gw5YdHzwYYGX9tKnq9rV45OjY5FPb=_Z=Wpg@mail.gmail.com>
RE changing to Uint8ClampedArray instead of Float32Array by default: I view this as fixing a bug in the proposal. Changing the type that is returned by a call sets up naive users of the API for A Bad Time in many ways. On Tue, Feb 14, 2023 at 1:24 AM Lars Borg <borg@adobe.com> wrote: > In today's call there was a Q: > Q: Can float16 represent unsigned integers (such as video signals) > accurately up to bit depth N? > A: Float16 can represent unsigned integers accurately up to bit depth 11, > or 2047. > > Details: > In float16 the mantissa field is 10 bits long. The most significant > mantissa bit is implied, not stored, and set to 1. The largest mantissa is > thus x7FF = 2047 = 11 bits. > A 12bit unsigned integer signal stored as float16 would lose the LSB for > 1023 values in range x801 to xFFF, while values up to x800 would be stored > losslessly. > This holds true whether the integer values are scaled to float with a > divisor of 1, 2,... 2^N, or 2^N-1. > If the divisor is 2^N-1, the value must be rounded or truncated when > converting back to integer. > > Lars > > -----Original Message----- > From: Pierre Lemieux <pal@sandflow.com <mailto:pal@sandflow.com>> > Date: Monday, February 13, 2023 at 1:16 PM > To: "public-colorweb@w3.org <mailto:public-colorweb@w3.org>" < > public-colorweb@w3.org <mailto:public-colorweb@w3.org>> > Cc: Chris Needham <chris.needham@bbc.co.uk <mailto:chris.needham@bbc.co.uk>>, > Christopher Cameron <ccameron@google.com <mailto:ccameron@google.com>> > Subject: Proposed reply to WHATWG comments re: Float16Array + HTML Canvas > Resent-From: <public-colorweb@w3.org <mailto:public-colorweb@w3.org>> > Resent-Date: Monday, February 13, 2023 at 1:16 PM > > > EXTERNAL: Use caution when clicking on links or opening attachments. > > > > > Good morning/evening, > > > Per our earlier call, below is the proposed response to the WHATWG > feedback, which I plan to post by 2023-02-14 COB unless objections are > raised. > > > Best, > > > -- Pierre > > > """ > Can you confirm that the concern is with selecting Float32Array as the > default readback type? If so, we are considering using > Uint8ClampedArray as the default readback type instead, opening the > door for Float16Array and other types to be offered down the line. > > > We are also happy to support the Float16Array proposal in TC 39. Let > us know how to best coordinate the effort/proceed. > > > In the meantime, are there objections to supporting Float32Array as > one of the (non-default) readback types, while the Float16Array > proposal makes its way through the TC 39 process? > """ > > > > > > > On Mon, Feb 13, 2023 at 12:28 PM Christopher Cameron > <ccameron@google.com <mailto:ccameron@google.com>> wrote: > > > > Alternative proposal: Make the default readback format always be > Uint8ClampedArray. > > > > For color space, we had the default readback color space match the > canvas' color space. > > > > The plus side that a naive getImageData-then-putImageData doesn't lose > data. > > The minus side is that a naive application may assume all ImageDatas are > sRGB, and get slightly-incorrect results. > > > > For the type, I think there's a strong case for Uint8ClampedArray being > the universal default. > > > > The plus side is that a naive getImageData+putImageData doesn't lose > data. > > The minus side is that a naive application will assume all ImageDatas > are Uint8ClampedArray and just crash (or worse) when given data that > floating point. > > > > The guiding principle is "make naive use of non-default canvases work > reasonably". To think of it, defaulting to Float16Array is pretty > dangerous, and breaks this principle. > > > > On Wed, Feb 8, 2023 at 10:08 PM Chris Needham <chris.needham@bbc.co.uk > <mailto:chris.needham@bbc.co.uk>> wrote: > >> > >> Hi Pierre, > >> > >> > Is there a concrete timeline for Float16Array, which would cause the > Color CG to revisit its recommendations? > >> > >> Can we answer this question rather than ask Anne? > > > > > > In some emails, someone said "maybe a year". So creating a dependency on > Float16Array puts this project on ice for a year. And that's only if > multiple browsers decide that float16 is worth staffing immediately (very > unlikely). > > > > Of note is that WebGL and WebGPU can create floating point canvases > today (well, almost today, for WebGL), and so it will be acceptable to > leave this feature out of reach to "simpler" applications that use 2D > canvas. > > > > > >> > >> Can we progress Float16Array within TC39? It's currently a stage 1 > proposal: > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftc39%2Fproposals%2Fblob%2Fmain%2Fstage-1-proposals.md&data=05%7C01%7Cborg%40adobe.com%7C1ad998daefba43f9858a08db0e184a68%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C638119269715896653%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NPqBbKS3BPkcUSoVfHfUG3qH%2BLLeHozVrSLZeISnF6Y%3D&reserved=0 > < > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftc39%2Fproposals%2Fblob%2Fmain%2Fstage-1-proposals.md&data=05%7C01%7Cborg%40adobe.com%7C1ad998daefba43f9858a08db0e184a68%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C638119269715896653%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NPqBbKS3BPkcUSoVfHfUG3qH%2BLLeHozVrSLZeISnF6Y%3D&reserved=0 > > > >> > >> See > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftc39.es%2Fprocess-document%2F&data=05%7C01%7Cborg%40adobe.com%7C1ad998daefba43f9858a08db0e184a68%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C638119269715896653%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cO%2Bl9ZNMZQjQ604sd3TUwLgIZppehqnaxAQVPRvqPkI%3D&reserved=0 > < > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftc39.es%2Fprocess-document%2F&data=05%7C01%7Cborg%40adobe.com%7C1ad998daefba43f9858a08db0e184a68%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C638119269715896653%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cO%2Bl9ZNMZQjQ604sd3TUwLgIZppehqnaxAQVPRvqPkI%3D&reserved=0> > for description of their process stages. > >> > >> Here's the last discussion in TC39, from 2017: > >> > >> > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftc39%2Fnotes%2Fblob%2FHEAD%2Fmeetings%2F2017-05%2Fmay-23.md%2316ig-float16-on-typedarrays-dataview-mathhfround-for-stage-1&data=05%7C01%7Cborg%40adobe.com%7C1ad998daefba43f9858a08db0e184a68%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C638119269715896653%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ZjJXIXO4oJNDwg57AJPpmbiZuPh8est%2Fix%2Bc9AvGoyM%3D&reserved=0 > < > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftc39%2Fnotes%2Fblob%2FHEAD%2Fmeetings%2F2017-05%2Fmay-23.md%2316ig-float16-on-typedarrays-dataview-mathhfround-for-stage-1&data=05%7C01%7Cborg%40adobe.com%7C1ad998daefba43f9858a08db0e184a68%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C638119269715896653%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ZjJXIXO4oJNDwg57AJPpmbiZuPh8est%2Fix%2Bc9AvGoyM%3D&reserved=0 > > > >> > >> and discission prior to that: > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fesdiscuss.org%2Ftopic%2Ffloat16array&data=05%7C01%7Cborg%40adobe.com%7C1ad998daefba43f9858a08db0e184a68%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C638119269715896653%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uxJP5MclogKptNG4rLYdvhrF5RWpSuKjGyZAQF8p8zA%3D&reserved=0 > < > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fesdiscuss.org%2Ftopic%2Ffloat16array&data=05%7C01%7Cborg%40adobe.com%7C1ad998daefba43f9858a08db0e184a68%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C638119269715896653%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uxJP5MclogKptNG4rLYdvhrF5RWpSuKjGyZAQF8p8zA%3D&reserved=0 > > > >> > >> There were open questions, can we help answer them to move the proposal > forward? > >> > >> Thanks, > >> > >> Chris > >> > >> -----Original Message----- > >> From: Pierre-Anthony Lemieux <pal@sandflow.com <mailto:pal@sandflow.com > >> > >> Sent: 08 February 2023 18:59 > >> To: public-colorweb@w3.org <mailto:public-colorweb@w3.org> > >> Subject: WHATWG comments re: Float16Array + HTML Canvas > >> > >> Good morning/evening, > >> > >> FYI. See the comment at [1]. > >> > >> [1] > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fwhatwg%2Fhtml%2Fissues%2F8708%23issuecomment-1423026968&data=05%7C01%7Cborg%40adobe.com%7C1ad998daefba43f9858a08db0e184a68%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C638119269716052885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=e9RJQV0LSpydxks9jCbge08HuieApEC9Kyd%2FSIlAm8I%3D&reserved=0 > < > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fwhatwg%2Fhtml%2Fissues%2F8708%23issuecomment-1423026968&data=05%7C01%7Cborg%40adobe.com%7C1ad998daefba43f9858a08db0e184a68%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C638119269716052885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=e9RJQV0LSpydxks9jCbge08HuieApEC9Kyd%2FSIlAm8I%3D&reserved=0 > > > >> > >> I suggest we reply. > >> > >> Below is a first pass at such a reply: > >> > >> """ > >> - the objective is to achieve bit depth greater than 8 bit in Canvas, > which is needed for native HDR imagery, among other things. This is needed > today. > >> > >> - the suggestion to add support today for Float32Array today was with > the understanding that support for Float16Array could not be added today > because it required a change in JS > >> > >> Is there a concrete timeline for Float16Array, which would cause the > Color CG to revisit its recommendations? > >> """ > >> > >> Please provide feedback by Monday COB. > >> > >> Best, > >> > >> -- Pierre > >> > > > > >
Received on Tuesday, 14 February 2023 10:00:20 UTC