Skip to content

Add definitions / diagrams for subtle video frame concepts #166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chcunningham opened this issue Apr 5, 2021 · 5 comments
Open

Add definitions / diagrams for subtle video frame concepts #166

chcunningham opened this issue Apr 5, 2021 · 5 comments
Assignees
Labels
editorial changes to wording, grammar, etc that don't modify the intended behavior need-definition An issues where something needs to be specified normatively

Comments

@chcunningham
Copy link
Collaborator

Including coded size, crop size, display size, stride...

chcunningham added a commit that referenced this issue Apr 5, 2021
Making it symmetric w/ AudioFrame.
Adds clone/close
Adds [[resource reference]]
Updates constructors accordingly (and fix cruft/obsolete steps).
Removes destroy (replaced by close).

Fixes #129 (in comboniation w/ PR #162).
Notes issues #165 and #166 for follow up.
chcunningham referenced this issue in dalecurtis/html Apr 16, 2021
Adding VideoFrame as a CanvasImageSource allows drawImage(),
createImageBitmap(), and texImage() to interoperate with VideoFrames.
VideoFrames are effectively the same as the existing point-in-time
capture done for HTMLVideoElement on each of these interfaces.

This adds a non-normative reference on the WebCodecs spec for the
VideoFrame interface and associated properties to accomplish this.

Bug: w3c/webcodecs#158
@chcunningham chcunningham added the editorial changes to wording, grammar, etc that don't modify the intended behavior label May 12, 2021
@chcunningham
Copy link
Collaborator Author

Triage note: marking 'editorial', as there is broad consensus on what these terms / concepts mean, this issue merely tracks the need to document that better.

@padenot padenot added the need-definition An issues where something needs to be specified normatively label May 17, 2021
@padenot
Copy link
Collaborator

padenot commented May 17, 2021

I agree, from a high-level POV, but this needs to be precisely specified, because we all know small details matter when shipping APIs on the Web.

That said, it's not hard to spec I assume, granted we use the commonly accepted definitions, an attempt below:

The coded width is the size of a horizontal pixel line, that is bigger or equal to the stride. The coded height is the size of a vertical pixel line, that is bigger or equal to the height of the picture (but is that useful ?). The coded height x the coded width allows knowing how much memory an image occupies in practice. Then this memory interpreted by the metadata found on VideoFrame: a crop rectangle is applied (trimming off what's outside the cropped region), and then scaling is applied via displayWidth and displayHeight. Scaling is defined as being the linear transform we all know.

It can well be that the type of scaling needs to be specified, maybe by using https://html.spec.whatwg.org/#resizequality ?

@chcunningham
Copy link
Collaborator Author

Thanks @padenot. I think those definitions match my expectation. @sandersdan to double check.

One small nit

The coded width is the size of a horizontal pixel line, that is bigger or equal to the stride.

I think this should be <= to the stride.

Re: display scaling, I defer to @sandersdan.

@padenot padenot self-assigned this May 18, 2021
@sandersdan
Copy link
Contributor

sandersdan commented May 18, 2021

The coded width is the size of a horizontal pixel line, that is bigger or equal to the stride.

There is no inherent relationship because codedWidth is measured in samples and stride is measured in bytes. codedWidth is also a measurement of the whole frame while stride is per-plane.

What is always true is that planeCodedWidth * planeSampleBytes <= planeStride.

There is still some discussion happening re: display size in #94. The current proposal is to treat the display size as a display aspect ratio, and then apply the usual 'scale up in exactly one dimension to match' approach that <video> uses. To be clear, I expect the attributes on VideoFrame to be the actual display dimensions, but they may be scaled compared to the VideoDecoderConfig/VideoFrameInit.

(Perhaps in the future we would add a pixelWidth/pixelHeight for cases that prefer using a pixel aspect ratio.)

@padenot
Copy link
Collaborator

padenot commented May 19, 2021

We can only work on this after #165 then. Thanks for the comment outlining my mistake. I'll work on a PR to add this precisely with all the comments taken into account.

@w3c w3c deleted a comment from Bman7714 May 8, 2024
@w3c w3c deleted a comment from Bman7714 May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial changes to wording, grammar, etc that don't modify the intended behavior need-definition An issues where something needs to be specified normatively
Projects
None yet
Development

No branches or pull requests

3 participants