diff --git a/index.bs b/index.bs index 539ed85..0be36cc 100755 --- a/index.bs +++ b/index.bs @@ -108,6 +108,7 @@ url: https://www.iso.org/standard/66067.html; spec: HEIF; type: dfn; text: aux_type text: AuxiliaryTypeInfoBox text: AuxiliaryTypeProperty + text: bits_per_channel url: https://www.iso.org/standard/68960.html; spec: ISOBMFF; type: dfn; text: compatible_brands @@ -134,7 +135,7 @@ url: https://www.iso.org/standard/68960.html; spec: ISOBMFF; type: dfn; url: https://www.iso.org/standard/74417.html; spec: MIAF; type: dfn; text: miaf - text: primary image + text: primary image item text: MIAF image item text: MIAF image sequence text: MIAF auxiliary image item @@ -406,7 +407,7 @@ No color space conversion, matrix coefficients, or transfer characteristics func The output reconstructed image is made up of the output samples, whose values shall be each clamped to fit in the number of bits per sample as defined by the '[=pixi=]' property of the reconstructed image item. The [=full_range_flag=] field of the '[=colr=]' property of [=colour_type=] '[=nclx=]' also defines a range of values to clamp to, as defined in [[!CICP]]. -
An 8-bit primary [=MIAF image item=] can be combined with another 8-bit hidden [=MIAF image item=], both used as input image items to a [=Sample Transform Derived Image Item=], with an expression corresponding to ReconstructedSample = 256 × PrimarySample + HiddenSample. The primary [=MIAF image item=] and the [=Sample Transform Derived Image Item=] are both part of the same '[=AVIF/altr=]' group. This will be perceived as a backward-compatible regular 8-bit image to readers not supporting [=Sample Transform Derived Image Items=], and can be decoded as a 16-bit image otherwise, making that pattern a bit-depth extension mechanism.
+NOTE: [[#sato-examples]] contains examples of Sample Transform Derived Image Item usage.
Syntax
@@ -659,7 +660,7 @@ The result of any computation underflowing or overflowing the intermediate bit d [=Sample Transform Derived Image Items=] use the postfix notation to evaluate the result of the whole expression for each reconstructed image item sample. - - The [=sato/tokens=] shall be evaluated in the order they are defined in the metadata (the SampleTransform structure) of the [=Sample Transform Derived Image Item=]. + - The [=sato/tokens=] shall be evaluated in the order they are defined in the metadata (the SampleTransform structure) of the [=Sample Transform Derived Image Item=]. - [=sato/token=] shall be at most [=reference_count=] when evaluating a sample [=sato/operand=] (when 1token32). - There shall be at least one [=sato/token=]. - The stack is empty before evaluating the first [=sato/token=]. @@ -697,12 +698,12 @@ The 'ster' entity group as defined in [[!HEIF]] may be use The brand to identify [=AV1 image items=] is avif. Files that indicate this brand in the [=compatible_brands=] field of the [=FileTypeBox=] shall comply with the following: - - The primary item shall be an [=AV1 Image Item=] or be a derived image that references directly or indirectly one or more items that all are [=AV1 Image Items=]. + - The [=primary image item=] shall be an [=AV1 Image Item=] or be a derived image that references directly or indirectly one or more items that all are [=AV1 Image Items=]. - [=AV1 auxiliary image items=] may be present in the file. Files that conform with these constraints should include the brand [=avif=] in the [=compatible_brands=] field of the [=FileTypeBox=]. -Additionally, the brand avio is defined. If the file indicates the brand [=avio=] in the [=compatible_brands=] field of the [=FileTypeBox=], then the primary item or all the items referenced by the primary item shall be [=AV1 image items=] made only of [=Intra Frames=]. Conversely, if the previous constraint applies, the brand [=avio=] should be used in the [=compatible_brands=] field of the [=FileTypeBox=]. +Additionally, the brand avio is defined. If the file indicates the brand [=avio=] in the [=compatible_brands=] field of the [=FileTypeBox=], then the [=primary image item=] or all the items referenced by the [=primary image item=] shall be [=AV1 image items=] made only of [=Intra Frames=]. Conversely, if the previous constraint applies, the brand [=avio=] should be used in the [=compatible_brands=] field of the [=FileTypeBox=].

AVIF image sequence brands

The brand to identify AVIF image sequences is avis. @@ -732,7 +733,7 @@ NOTE: This constraint further restricts files compared to [[!MIAF]]. The profiles defined in this section are for enabling interoperability between [=AV1 Image File Format=] files and [=AV1 Image File Format=] readers/parsers. A profile imposes a set of specific restrictions and is signaled by brands defined in this specification. -The [=FileTypeBox=] should declare at least one profile that enables decoding of the primary image item. It is not an error for the encoder to include an auxiliary image that is not allowed by the specified profile(s). +The [=FileTypeBox=] should declare at least one profile that enables decoding of the [=primary image item=]. It is not an error for the encoder to include an auxiliary image that is not allowed by the specified profile(s). If '[=avis=]' is declared in the [=FileTypeBox=] and a profile is declared in the [=FileTypeBox=], the profile shall also enable decoding of at least one image sequence track. The profile should allow decoding of any associated auxiliary image sequence tracks, unless it is acceptable to decode the image sequence without its auxiliary image sequence tracks. @@ -1194,7 +1195,91 @@ The "Version(s)" column in the following table lists the version(s) of the boxes - Add information on tmap, grpl and altr - Replace recommendations regarding still picture flags in image items by a note - Add section 4.2.2 "Sample Transform Derived Image Item" + - Add Appendix A "Sample Transform Derived Image Item Examples" - Add restriction on usage of clap property - Adopt MIAF shared constraints - EDITORIAL: Clean up usage of dfn and linking - Clarify required versions of non-essential item properties + +

Appendix A: Sample Transform Derived Image Item Examples

+ +This informative appendix contains example recipes for extending base AVIF features with [=Sample Transform Derived Image Items=]. + +

Bit depth extension

+ +[=Sample Transform Derived Image Items=] allow for more than 12 bits per channel per sample by combining several [=AV1 image items=] in multiple ways. + +

Suffix bit depth extension

+ +The following example describes how to leverage a [=Sample Transform Derived Image Item=] on top of a regular 8-bit [=MIAF image item=] to extend the decoded bit depth to 16 bits. + +Consider the following: + - A [=MIAF image item=] being a losslessly coded image item,
and its '[=pixi=]' property with [=bits_per_channel=]=8, + - Another [=MIAF image item=] being a lossily or losslessly coded image item with the same dimensions and number of samples as the first input image item,
and its '[=pixi=]' property with [=bits_per_channel=]=8, + - A [=Sample Transform Derived Image Item=] with the two items above as input in this order,
and its '[=pixi=]' property with [=bits_per_channel=]=16,
and the following [=SampleTransform=] fields: + - [=sato/version=]=0 + - [=sato/bit_depth=]=2 (signed 32-bit [=sato/constant=]s, stack values and intermediate results) + - [=sato/token_count=]=5 + - [=sato/token=]=0, [=sato/constant=]=256 + - [=sato/token=]=1 (sample from 1st input image item) + - [=sato/token=]=130 (product) + - [=sato/token=]=2 (sample from 2nd input image item) + - [=sato/token=]=128 (sum) + +This is equivalent to the following postfix notation (parentheses for clarity): + +sampleoutput=(256sample1×)sample2+ + +This is equivalent to the following infix notation: + +sampleoutput=256×sample1+sample2 + +Each output sample is equal to the sum of a sample of the first input image item shifted to the left by 8 and of a sample of the second input image item. This can be viewed as a bit depth extension of the first input image item by the second input image item. The first input image item contains the 8 most significant bits and the second input image item contains the 8 least significant bits of the output reconstructed image item which has a bit depth of 16, something that is impossible to achieve with a single [=AV1 image item=]. + +NOTE: If the first input image item is the [=primary image item=] and is enclosed in an '[=AVIF/altr=]' group with the [=Sample Transform Derived Image Item=], the first input image item is also a backward-compatible 8-bit regular coded image item that can be used by readers that do not support [=Sample Transform Derived Image Items=] or do not need extra precision. + +NOTE: The second input image item loses its meaning of least significant part if any of the most significant bits changes, so the first input image item has to be losslessly encoded. The second input image item supports reasonable loss during encoding. + +NOTE: This pattern can be used for reconstructed bit depths beyond 16 by combining more than two input image items or with various input bit depth configurations and operations. + +

Residual bit depth extension

+ +The following example describes how to leverage a [=Sample Transform Derived Image Item=] on top of a regular 12-bit [=MIAF image item=] to extend the decoded bit depth to 16 bits.
+It differs from the [[#sato-example-suffix-bit-depth-extension]] by its slightly longer series of operations allowing its first input image item to be lossily encoded. + +Consider the following: + - A [=MIAF image item=] being a lossily coded image item,
and its '[=pixi=]' property with [=bits_per_channel=]=12, + - Another [=MIAF image item=] being a lossily or losslessly coded image item with the same dimensions and number of samples as the first input image item,
and its '[=pixi=]' property with [=bits_per_channel=]=8,
with the following contraints: +
  • + - sample1sampleoriginal24 + - sample2sampleoriginal-24×sample1+27 + - 0sample1<212 + - 0sample2<28 + - 024×sample1+sample2-27<216

    NOTE: Files that do not respect this constraint will still decode successfully because Clause [[#sample-transform-definition]] mandates the resulting values to be each clamped to fit in the number of bits per sample as defined by the '[=pixi=]' property of the reconstructed image item.

    + - A [=Sample Transform Derived Image Item=] with the two items above as input in this order,
    and its '[=pixi=]' property with [=bits_per_channel=]=16,
    and the following [=SampleTransform=] fields: + - [=sato/version=]=0 + - [=sato/bit_depth=]=2 (signed 32-bit [=sato/constant=]s, stack values and intermediate results) + - [=sato/token_count=]=7 + - [=sato/token=]=0, [=sato/constant=]=16 + - [=sato/token=]=1 (sample from 1st input image item) + - [=sato/token=]=130 (product) + - [=sato/token=]=2 (sample from 2nd input image item) + - [=sato/token=]=128 (sum) + - [=sato/token=]=0, [=sato/constant=]=-128 + - [=sato/token=]=128 (sum) + +This is equivalent to the following postfix notation (parentheses for clarity): + +sampleoutput=((16sample1×)sample2+)128- + +This is equivalent to the following infix notation: + +sampleoutput=16×sample1+sample2-128 + +Each output sample is equal to the sum of a sample of the first input image item shifted to the left by 4 and of a sample of the second input image item offset by -128. This can be viewed as a bit depth extension of the first input image item by the second input image item which contains the residuals to correct the precision loss of the first input image item. + +NOTE: If the first input image item is the [=primary image item=] and is enclosed in an '[=AVIF/altr=]' group with the derived image item, the first input image item is also a backward-compatible 12-bit regular coded image item that can be used by decoding contexts that do not support [=Sample Transform Derived Image Items=] or do not need extra precision. + +NOTE: The first input image item supports reasonable loss during encoding because the second input image item "overlaps" by 4 bits to correct the loss. The second input image item supports reasonable loss during encoding. + +NOTE: This pattern can be used for reconstructed bit depths beyond 16 by combining more than two input image items or with various input bit depth configurations and operations.