Skip to content

Commit

Permalink
Editorial improvements for semantics (#50)
Browse files Browse the repository at this point in the history
- Consistent use of specified and inferred
- Consistent use of minusX semantics
- Other small improvemnts

Co-authored-by: Andrey Norkin <40504168+andrey-norkin@users.noreply.github.com>
  • Loading branch information
asegallamz and andrey-norkin authored Jan 5, 2024
1 parent 3b39a3c commit 1125c0d
Showing 1 changed file with 49 additions and 50 deletions.
99 changes: 49 additions & 50 deletions 07.bitstream.semantics.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ should not refer to the film grain parameters associated with higher scalability
from the previous frame in the display order and not the coding order.
{:.alert .alert-info }

**film_grain_param_set_idx** is an index of a film grain parameter set. Up to 8 separate film grain parameter
**film_grain_param_set_idx** specifies the index of a film grain parameter set. Up to 8 separate film grain parameter
sets may be simultaneously stored by the film grain processing module.

**Note:** An encoder may use film_grain_param_set_idx to differentiate between up to 8 separate film grain models.
Expand All @@ -132,26 +132,25 @@ av1_film_grain_params_function shall be stored in the memory location denoted by

**grain_seed** specifies the starting value for the pseudo-random numbers used during film grain synthesis.

**update_grain_flag** equal to 1 means that a new set of parameters is sent.
update_grain_flag equal to 0 means that the previous set of parameters in the frame display order should be used.
**update_grain_flag** equal to 1 specifies the presence of a new set of film grain parameters. update_grain_flag equal to 0
specifies that the previous set of parameters in the frame display order should be used.

It is a requirement of bitstream conformance that for every distinct value of film_grain_param_set_idx used in a coded video
sequence, the first frame in the display order with that value of film_grain_param_set_idx that has apply_grain_flag flag equal to 1
have update_grain_flag equal to 1.

**Note:** This requirement means that film grain parameters associated with a particular film_grain_param_set_idx value can only
be infered from previously signaled parameters in the display order with the same value of film_grain_param_set_idx
be inferred from previously signaled parameters in the display order with the same value of film_grain_param_set_idx
in the current coded video sequence.
{:.alert .alert-info }

**tempGrainSeed** is a temporary variable that is used to avoid losing the value of grain_seed when load_grain_params is called.
When update_grain_flag is equal to 0, a previous set of parameters should be used for everything except grain_seed.
**tempGrainSeed** is a temporary variable that is used to preserve the value of grain_seed when load_grain_params is called.

**apply_units_resolution_log2** indicates the units used for indicating apply_horz_resolution and apply_vert_resolution.
**apply_units_resolution_log2** specifies the units used for indicating apply_horz_resolution and apply_vert_resolution.

**apply_vert_resolution** indicates the luma vertical resolution corresponding to the film grain synthesis parameters in units of 1 << apply_units_resolution_log2 luma samples.
**apply_vert_resolution** specifies the luma vertical resolution corresponding to the film grain synthesis parameters in units of 1 << apply_units_resolution_log2 luma samples.

**apply_horz_resolution** indicates the luma horizontal resolution corresponding to the film grain synthesis parameters in units of 1 << apply_units_resolution_log2 luma samples.
**apply_horz_resolution** specifies the luma horizontal resolution corresponding to the film grain synthesis parameters in units of 1 << apply_units_resolution_log2 luma samples.

**luma_only_flag** equal to 1 specifies that the film grain synthesis parameters do not include U and V color planes. luma_only_flag
equal to 0 specifies that the film grain synthesis parameters do include U and V color planes.
Expand Down Expand Up @@ -232,25 +231,26 @@ set may be predicted from scaling functions that belong to other film grain para
It is a requirement of the specification conformance that the film grain parameters set at the
decoded picture resolution have the predict_scaling_flag flag equal to zero.

**film_grain_param_set_idx_for_prediction** specifies an index of a film grain parameter set that is used
**film_grain_param_set_idx_for_prediction** specifies the index of a film grain parameter set that is used
for prediction of scaling functions of the current film grain parameter set.

It is a requirement of the conformance to the current specification that the values of the film grain parameter
set with index film_grain_param_set_idx_for_prediction has been initialized with values of the scaling functions that in the current coded video sequence.

**predict_y_scaling_flag** equal to 0 indicates that the luma scaling functions in the current film grain parameter set are
not predicted from a different film grain parameter set. predict_y_scaling_flag equal to 1 indicates that the luma scaling
**predict_y_scaling_flag** equal to 0 specifies that the luma scaling functions in the current film grain parameter set are
not predicted from a different film grain parameter set. predict_y_scaling_flag equal to 1 specifies that the luma scaling

functions in the current film grain
parameter set are predicted from a different film grain parameter set indicated by film_grain_param_set_idx_for_prediction.

**y_scaling_mult** specifies a multiplier used for predicting the luma film grain scaling function.
**y_scaling_mult** specifies the multiplier used for predicting the luma film grain scaling function.

**y_scaling_add** specifies an addition / intercept parameter used for predicting the luma film grain scaling function.
**y_scaling_add** specifies the addition parameter used for predicting the luma film grain scaling function.

**num_y_points_in_ref** specifies the number of points for the piecewise linear scaling function of the luma component
in the film grain parameter set referenced with film_grain_param_set_idx_for_prediction.

**bits_per_y_scaling_res** specifies the number of bits used for encoding of differences / residuals for point_y_scaling.
**bits_per_y_scaling_res** specifies the number of bits used for encoding point_y_scaling_res[ i ].

**point_y_scaling_res[ i ]** specifies the prediction difference of the parameters. The parameter is signaled using
bits_per_y_scaling_res bits and is in the [-2 bits_per_y_value_res-1, 2bits_per_y_value_res-1-1] range.
Expand Down Expand Up @@ -283,9 +283,9 @@ scaling function of the luma component.
It is a requirement of bitstream conformance that num_y_points is less than or equal to 14.
[AMT]: # (Why need to talk about conformance? Why also restrict the value to up to 14? Same for chroma)

**point_y_value_increment_bits_minus1** specifies the number of bits minus 1 that will be spent on signaling the increments of point_y_values.
**point_y_value_increment_bits_minus1** plus 1 specifies the number of bits used for encoding point_y_values_increment[ i ].

**point_y_scaling_bits_minus5** specifies the number of bits minus 5 that will be spent on signaling point_y_scaling[ i ].
**point_y_scaling_bits_minus5** plus 5 specifies the number of bits used for encoding point_y_scaling[ i ].

**point_y_value_increment[ i ]** is the increment of point_y_value [ i ] relative to the point_y_value [ i - 1 ].
point_y_value[ i ] represents the x (luma value) coordinate for the i-th point of the piecewise linear scaling function for the luma component. The values are signaled on the scale of 0..255. (In case of 10-bit video, these values correspond to luma values divided by 4. In case of 12-bit video, these values correspond to luma values divided by 16.)
Expand All @@ -311,22 +311,22 @@ linear scaling function for luma component.
**chroma_scaling_from_luma_flag** equal to 1 specifies that the chroma scaling is inferred from the luma scaling.
chroma_scaling_from_luma_flag equal to 0 specifies that the chroma scaling is signaled independently.

**predict_cb_scaling_flag** equal to 0 indicates that the Cb scaling functions in the current film grain parameter
set are not predicted from a different film grain parameter set. predict_cb_scaling_flag equal to 1 indicates that
**predict_cb_scaling_flag** equal to 0 specifies that the Cb scaling functions in the current film grain parameter
set are not predicted from a different film grain parameter set. predict_cb_scaling_flag equal to 1 specifies that
the Cb scaling functions in the current film grain parameter set are predicted from a film grain parameter set
indicated by film_grain_param_set_idx_for_prediction.

If predict_cb_scaling_flag is equal to 1, variables cb_mult, cb_luma_mult, and cb_offset are set equal to variables
cb_mult, cb_luma_mult, and cb_offset in the film grain parameter set indicated by film_grain_param_set_idx_for_prediction.

**cb_scaling_mult** specifies a multiplier used for predicting the Cb film grain scaling function.
**cb_scaling_mult** specifies the multiplier used for predicting the Cb film grain scaling function.

**cb_scaling_add** specifies an addition / intercept parameter used for predicting the Cb film grain scaling function.
**cb_scaling_add** specifies the addition parameter used for predicting the Cb film grain scaling function.

**num_cb_points_in_ref** specifies the number of points for the piecewise linear scaling function of the luma
component in the film grain parameter set referenced with film_grain_param_set_idx_for_prediction.

**bits_per_cb_scaling_res** specifies the number of bits used for encoding of differences / residuals for point_cb_scaling.
**bits_per_cb_scaling_res** specifies the number of bits used for encoding point_cb_scaling_res[ i ].

**point_cb_scaling_res[ i ]** specifies the prediction difference of the parameters. The parameter is signaled
using bits_per_cb_scaling_res bits and is in the [-2 bits_per_cb_value_res-1, 2bits_per_cb_value_res-1-1] range.
Expand Down Expand Up @@ -364,13 +364,13 @@ It is a requirement of bitstream conformance that num_cb_points is less than or
This means that the chroma scaling also needs to support up to 14 points.
{:.alert .alert-info }

**point_cb_value_increment_bits_minus1** specifies the number of bits minus 1 that will be spent on signaling the increments of point_cb_values.
**point_cb_value_increment_bits_minus1** plus 1 specifies the number of bits used to signal point_cb_values[ i ].

**point_cb_scaling_bits_minus5** specifies the number of bits minus 5 that will be spent on signaling point_cb_scaling[ i ]
**point_cb_scaling_bits_minus5** plus 5 specifies the number of bits used to signal point_cb_scaling[ i ]

**cb_scaling_offset** specifies the offset applied to obtain point_cb_scaling[ i ] values.

**point_cb_value_increment[ i ]** is the increment of point_cb_value [ i ] relative to the point_cb_value [ i - 1 ].
**point_cb_value_increment[ i ]** specifies the increment of point_cb_value [ i ] relative to the point_cb_value [ i - 1 ].

point_cb_value[ i ] represents the x coordinate for the i-th point of the piece-wise linear
scaling function for cb component. The values are signaled on the scale of 0..255.
Expand All @@ -391,23 +391,22 @@ for ( i = 0; i < num_cb_points; i++ )
point_cb_scaling[ i ] = point_cb_scaling[ i ] + cb_scaling_offset.
~~~~~

**predict_cr_scaling_flag** equal to 0 indicates that the Cr scaling functions in the current film grain
**predict_cr_scaling_flag** equal to 0 specifies that the Cr scaling functions in the current film grain
parameter set are not predicted from a different film grain parameter set. predict_cr_scaling_flag equal
to 1 indicates that the Cr scaling functions in the current film grain parameter set are predicted
to 1 specifies that the Cr scaling functions in the current film grain parameter set are predicted
from a film grain parameter set indicated by film_grain_param_set_idx_for_prediction.

If predict_cr_scaling_flag is equal to 1, variables cr_mult, cr_luma_mult, and cr_offset are set equal
to variables cr_mult, cr_luma_mult, and cr_offset in the film grain parameter set indicated by film_grain_param_set_idx_for_prediction.

**cr_scaling_mult** specifies a multiplier used for predicting the Cr film grain scaling function.
**cr_scaling_mult** specifies the multiplier used for predicting the Cr film grain scaling function.

**cr_scaling_add** specifies an addition / intercept parameter used for predicting the Cr film grain scaling function.
**cr_scaling_add** specifies the addition parameter used for predicting the Cr film grain scaling function.

**num_cr_points_in_ref** specifies the number of points for the piecewise linear scaling function of
the luma component in the film grain parameter set referenced with film_grain_param_set_idx_for_prediction.

**bits_per_cr_scaling_res** specifies the number of bits used for encoding of differences / residuals
for point_cb_scaling.
**bits_per_cr_scaling_res** specifies the number of bits used for encoding point_cb_scaling[ i ].

**point_cr_scaling_res[ i ]** specifies the prediction difference of the parameters. The parameter
is signaled using bits_per_cb_scaling_res bits and is in the [-2 bits_per_cr_value_res-1, 2bits_per_cr_value_res-1-1] range.
Expand Down Expand Up @@ -459,13 +458,13 @@ it is a requirement of bitstream conformance that num_cr_points is not equal to
There is no restriction for 4:2:2 or 4:4:4 chroma subsampling.
{:.alert .alert-info }

**point_cr_value_increment_bits_minus1** specifies the number of bits minus 1 that will be spent on signaling the increments of point_cr_value.
**point_cr_value_increment_bits_minus1** plus 1 specifies the number of bits that used to signal point_cr_value_increment[ i ].

**point_cr_scaling_bits_minus5** specifies the number of bits minus 5 that will be spent on signaling point_cr_scaling[ i ]
**point_cr_scaling_bits_minus5** plus 5 specifies the number of bits used to signal point_cr_scaling[ i ]

**cr_scaling_offset** specifies the offset applied to obtain point_cr_scaling[ i ] values.

**point_cr_value_increment[ i ]** is the increment of point_cr_value [ i ] relative to the point_cr_value [ i - 1 ].
**point_cr_value_increment[ i ]** specifies the increment of point_cr_value [ i ] relative to the point_cr_value [ i - 1 ].

point_cr_value[ i ] represents the x coordinate for the i-th point of the piece-wise linear
scaling function for cr component. The values are signaled on the scale of 0..255.
Expand All @@ -486,24 +485,24 @@ for ( i = 0; i < num_cr_points; i++ )
point_cr_scaling[ i ] = point_cr_scaling[ i ] + cr_scaling_offset.
~~~~~

**grain_scaling_minus_8** represents the shift – 8 applied to the values of the chroma
**grain_scaling_minus_8** plus 8 specifies the shift applied to the values of the chroma
component. The grain_scaling_minus_8 can take values of 0..3 and determines the
range and quantization step of the standard deviation of film grain.

**ar_coeff_lag** specifies the number of auto-regressive coefficients for
luma and chroma.

**bits_per_ar_coeff_y_minus5** specifies the number of bits minus 5 that will be spent on signaling ar_coeffs_y.
**bits_per_ar_coeff_y_minus5** plus 5 specifies the number of bits used to signal ar_coeffs_y[ i ].

**ar_coeffs_y[ i ]** specifies auto-regressive coefficients used for the Y plane.
**ar_coeffs_y[ i ]** specifies the auto-regressive coefficients used for the Y plane.

The values of AR coefficients for the Y component are derived as follows
~~~~~ c
for ( i = 0; i < numPosLuma; i++ )
ar_coeffs_y[ i ] = ar_coeffs_y[ i ] - (1<<(BitsArY - 1)).
~~~~~

**bits_per_ar_coeff_cb_minus5** specifies the number of bits minus 5 that will be spent on signaling ar_coeffs_cb.
**bits_per_ar_coeff_cb_minus5** plus 5 specifies the number of bits used to ar_coeffs_cb[ i ].

**ar_coeffs_cb[ i ]** specifies auto-regressive coefficients used for the Cb plane.

Expand All @@ -513,9 +512,9 @@ for ( i = 0; i < numPosChroma; i++ )
ar_coeffs_cb[ i ] = ar_coeffs_cb[ i ] - (1<<(BitsArCb - 1)).
~~~~~

**bits_per_ar_coeff_cr_minus5** specifies the number of bits minus 5 that will be spent on signaling ar_coeffs_cr.
**bits_per_ar_coeff_cr_minus5** plus 5 specifies the number of bits used to singal ar_coeffs_cr[ i ].

**ar_coeffs_cr[ i ]** specifies auto-regressive coefficients used for the Cr plane.
**ar_coeffs_cr[ i ]** specifies the auto-regressive coefficients used for the Cr plane.

The values of AR coefficients for the Cr component are derived as follows
~~~~~ c
Expand All @@ -530,31 +529,31 @@ respectively.
**grain_scale_shift** specifies how much the Gaussian random numbers should be scaled down during
the grain synthesis process.

**cb_mult** represents a multiplier for the cb component used in the derivation of the input
**cb_mult** specifies the multiplier for the cb component used in the derivation of the input
index to the cb component scaling function.

**cb_luma_mult** represents a multiplier for the average luma component used in the
**cb_luma_mult** specifies the multiplier for the average luma component used in the
derivation of the input index to the cb component scaling function.

**cb_offset** represents an offset used in the derivation of the input index to the cb component
**cb_offset** specifies the offset used in the derivation of the input index to the cb component
scaling function.

**cr_mult** represents a multiplier for the cr component used in the derivation of the input index
**cr_mult** specifies the multiplier for the cr component used in the derivation of the input index
to the cr component scaling function.

**cr_luma_mult** represents a multiplier for the average luma component used in the
**cr_luma_mult** specifies the multiplier for the average luma component used in the
derivation of the input index to the cr component scaling function.

**cr_offset** represents an offset used in the derivation of the input index to the cr component
**cr_offset** specifies the offset used in the derivation of the input index to the cr component
scaling function.

**overlap_flag** equal to 1 indicates that the overlap between film grain blocks shall be
applied. overlap_flag equal to 0 indicates that the overlap between film grain blocks shall
**overlap_flag** equal to 1 specifies that the overlap between film grain blocks shall be
applied. overlap_flag equal to 0 specifies that the overlap between film grain blocks shall
not be applied.

**clip_to_restricted_range_flag** equal to 1 indicates that clipping to the restricted (studio)
**clip_to_restricted_range_flag** equal to 1 specifies that clipping to the restricted (studio)
range is applied to the sample values after adding the film grain (see the semantics for color_range for an explanation of studio swing).
clip_to_restricted_range_flag equal to 0 indicates that clipping to the full range shall be
clip_to_restricted_range_flag equal to 0 specifies that clipping to the full range shall be
applied to the sample values after adding the film grain.

### Padding bits semantics
Expand Down

0 comments on commit 1125c0d

Please sign in to comment.