Skip to content

Latest commit

 

History

History
263 lines (248 loc) · 11.5 KB

06.bitstream.syntax.md

File metadata and controls

263 lines (248 loc) · 11.5 KB

Syntax structures

General

This section presents the syntax structures in a tabular form. The meaning of each of the syntax elements is presented in [Section 6][].

AOMedia ITU-T T.35 metadata syntax

| --------------------------------------------------------- | ---------------- | | metadata_aom_itu_t_t35( ) { | Type | @@itu_t_t35_country_code | f(8) | @@itu_t_t35_terminal_provider_code | f(16) | @@itu_t_t35_terminal_provider_oriented_code | f(8) | if ( itu_t_t35_terminal_provider_oriented_code == 0x01 ) { | av1_film_grain_param_sets( ) | } | } {:.syntax }

Film grain parameter sets syntax

| ----------------------------------------------------------------- | ---------------- | | av1_film_grain_param_sets( ) { | Type | @@afgs1_enable_flag | f(1) | if( !afgs1_enable_flag ) { | return | } | /* Add reserved bits so that av1_film_grain_payload is byte aligned */ | @@reserved_4bits | f(4) | @@num_film_grain_sets_minus1 | f(3) | for ( i = 0; i < num_film_grain_sets_minus1 + 1; i++ ) { | | av1_film_grain_payload( ) | } | selectedParamSet = select_film_grain_param_set( ) | load_grain_params( selectedParamSet ) | } {:.syntax }

Film grain parameter payload syntax

| ----------------------------------------------------------------- | ---------------- | | av1_film_grain_payload( ) { | Type | /* Store the current bit-stream position / | startPosition = get_position( ) | | / Receive the payload size. Note that when update_grain is equal to 0, | film grain parameter messages will be 21 bits. Receive the
| size of these messages with 3 bits so that there is no additional | overhead for byte alignment in this case. / | | @@payload_less_than_4byte_flag | f(1) | n = payload_less_than_4byte_flag ? 2 : 8 | @@payload_size | f(n) | | / Receive the film grain parameters / | av1_film_grain_params( ) | | / Determine the number of bits consumed by the payload */ | currentPosition = get_position( ) | payloadBits = currentPosition - startPosition |
| / * Zero pad (and byte align) to the payload size */ | padding_bits( payload_size * 8 - payloadBits ) | } {:.syntax }

Film grain parameters syntax

| --------------------------------------------------------- | ---------------- | | av1_film_grain_params( ) { | Type | @@film_grain_param_set_idx | f(3) | @@apply_grain_flag | f(1) | if ( !apply_grain_flag ) { | load_grain_params( film_grain_param_set_idx ) | apply_grain_flag = 0 | save_grain_params( film_grain_param_set_idx ) | return | } | @@grain_seed | f(16) | @@update_grain_flag | f(1) | if ( !update_grain_flag ) { | tempGrainSeed = grain_seed | load_grain_params( film_grain_param_set_idx ) | apply_grain_flag = 1 | grain_seed = tempGrainSeed | save_grain_params( film_grain_param_set_idx ) | return | } | @@apply_units_resolution_log2 | f(4) | @@apply_horz_resolution | f(12) | @@apply_vert_resolution | f(12) | @@luma_only_flag | f(1) | SubX = SubY = 0 | if ( !luma_only_flag ) { | subsampling_x | f(1) | SubX = subsampling_x | subsampling_y | f(1) | SubY = subsampling_y | } | @@video_signal_characteristics_flag | f(1) | if (video_signal_characteristics_flag) | @@bit_depth_minus8 | f(3) | BitDepth = bit_depth_minus8 + 8 | @@cicp_info_present_flag | f(1) | if ( cicp_info_present_flag ) { | color_primaries | f(8) | transfer_characteristics | f(8) | matrix_coefficients | f(8) | video_full_range_flag | f(1) | } | } | @@predict_scaling_flag | f(1) | if (predict_scaling_flag) { | @@predict_y_scaling_flag | f(1) | } else { | predict_y_scaling_flag = 0 | } | if (predict_y_scaling_flag) { | @@y_scaling_mult | f(9) | @@y_scaling_add | f(9) | @@bits_per_y_scaling_res | f(3) | if (bits_per_y_scaling_res) { | bitsRes = bits_per_y_scaling_res | for ( i = 0; i < numYPointsInRef; i++ ) | @@point_y_scaling_res[ i ] | f(bitsRes) | @@y_scaling_res_granularity | f(3) | } | } else { | @@num_y_points | f(4) | if (num_y_points) { | @@point_y_value_increment_bits_minus1 | f(3) | bitsIncr = point_y_value_increment_bits_minus1 + 1 | point_y_scaling_bits_minus5 |f(2) | bitsScal = point_y_scaling_bits_minus5 + 5 | for ( i = 0; i < num_y_points; i++ ) { | @@point_y_value_increment[ i ] | f(bitsIncr) | @@point_y_scaling[ i ] | f(bitsScal) | } | } | } | if ( luma_only_flag ) { | chroma_scaling_from_luma_flag = 0 | } else { | @@chroma_scaling_from_luma_flag | f(1) | } | if ( luma_only_flag || chroma_scaling_from_luma_flag ) { | num_cb_points = 0 | num_cr_points = 0 | } else { | if (predict_scaling_flag) { | @@predict_cb_scaling_flag | f(1) | } else | predict_cb_scaling_flag = 0 | if (predict_cb_scaling_flag) { | @@cb_scaling_mult | f(9) | @@cb_scaling_add | f(9) | @@bits_per_cb_scaling_res | f(3) | if (bits_per_cb_scaling_res) { | bitsRes = bits_per_cb_scaling_res | for ( i = 0; i < numCbPointsInRef; i++ ) | @@point_cb_scaling_res[ i ] | f(bitsRes) | @@cb_scaling_res_granularity | f(3) | } | } else { | @@num_cb_points | f(4) | if (num_cb_points) { | @@point_cb_value_increment_bits_minus1 | f(3) | bitsIncr = point_cb_value_increment_bits_minus1 + 1 | point_cb_scaling_bits_minus5 |f(2) | bitsScal = point_cb_scaling_bits_minus5 + 5 | cb_scaling_offset |f(8) | for ( i = 0; i < num_cb_points; i++ ) { | @@point_cb_value_increment[ i ] | f(bitsIncr) | @@point_cb_scaling[ i ] | f(bitsScal) | } | } | } | if (predict_scaling_flag) { | @@predict_cr_scaling_flag | f(1) | } else | predict_cr_scaling_flag = 0 | if (predict_cr_scaling_flag) { | @@cr_scaling_mult | f(9) | @@cr_scaling_add | f(9) | @@bits_per_cr_scaling_res | f(3) | if (bits_per_cr_scaling_res) { | bitsRes = bits_per_cr_scaling_res | for ( i = 0; i < numCrPointsInRef; i++ ) | @@point_cr_scaling_res[ i ] | f(bitsRes) | @@cr_scaling_res_granularity | f(3) | } | } else { | @@num_cr_points | f(4) | if (num_cr_points) { | @@point_cr_value_increment_bits_minus1 | f(3) | bitsIncr = point_cr_value_increment_bits_minus1 + 1 | point_cr_scaling_bits_minus5 |f(2) | bitsScal = point_cr_scaling_bits_minus5 + 5 | cr_scaling_offset |f(8) | for ( i = 0; i < num_cr_points; i++ ) { | @@point_cr_value_increment[ i ] | f(bitsIncr) | @@point_cr_scaling[ i ] | f(bitsScal) | } | } | } | } | @@grain_scaling_minus8 | f(2) | @@ar_coeff_lag | f(2) | numPosLuma = 2 * ar_coeff_lag * ( ar_coeff_lag + 1 ) | if ( num_y_points || predict_y_scaling_flag ) { | numPosChroma = numPosLuma + 1 | bits_per_ar_coeff_y_minus5 | f(2) | BitsArY = bits_per_ar_coeff_y_minus5 + 5 | for ( i = 0; i < numPosLuma; i++ ) | @@ar_coeffs_y[ i ] | f(BitsArY) | } else { | numPosChroma = numPosLuma | } | if ( chroma_scaling_from_luma_flag || num_cb_points || predict_cb_scaling_flag ) { | bits_per_ar_coeff_cb_minus5 | f(2) | BitsArCb = bits_per_ar_coeff_cb_minus5 + 5 | for ( i = 0; i < numPosChroma; i++ ) | @@ar_coeffs_cb[ i ] | f(BitsArCb) | } | if ( chroma_scaling_from_luma_flag || num_cr_points || predict_cr_scaling_flag ) { | bits_per_ar_coeff_cr_minus5 | f(2) | BitsArCr = bits_per_ar_coeff_cr_minus5 + 5 | for ( i = 0; i < numPosChroma; i++ ) | @@ar_coeffs_cr[ i ] | f(BitsArCr) | } | @@ar_coeff_shift_minus6 | f(2) | @@grain_scale_shift | f(2) | if ( num_cb_points && !predict_cb_scaling_flag) { | @@cb_mult | f(8) | @@cb_luma_mult | f(8) | @@cb_offset | f(9) | } | if ( num_cr_points && !predict_cr_scaling_flag ) { | @@cr_mult | f(8) | @@cr_luma_mult | f(8) | @@cr_offset | f(9) | } | @@overlap_flag | f(1) | @@clip_to_restricted_range_flag | f(1) | process_grain_params( ) | save_grain_params( film_grain_param_set_idx ) | } {:.syntax }

Padding bits syntax

| ----------------------------------------------------------------- | ---------------- | | padding_bits( nbBits ) { | Type | while( nbBits > 0 ) { | @@padding_zero_bit | f(1) | nbBits-- | } | } {:.syntax }