Context initialization based on slice header flag and slice type
Technique for initialization of encoders and decoders. In some cases, the decoder receives a slice and identifies if the slice is either a forward predicted B-slice or a backward predicted B-slice, and not both a forward and backward predicted B-slice, and based upon this identification initializes, using a P-slice technique, a context associated with the slice.
1. A method for decoding video data, the method comprising:
receiving a bitstream of video data including a picture, the picture including a slice;
decoding, from the bitstream, a presence flag in a picture parameter set of the picture, wherein the presence flag indicates whether or not an initialization flag is included in a slice header of the slice;
decoding, from the bitstream, a syntax element in the slice header of the slice indicative of a slice type of the slice;
in a case that the slice type of the slice is a B slice type or a P slice type:
if the presence flag indicates that the initialization flag is included in the slice header of the slice, decoding, from the bitstream, the initialization flag having a flag value that is used to determine a Context-Adaptive Binary Arithmetic Coding (CABAC) context initialization method for the B slice type or the P slice type, wherein the flag value is either a first value or a second value, and
if the presence flag indicates that the initialization flag is not included in the slice header of the slice, assuming the initialization flag to have a default flag value;
initializing a CABAC context to be used for decoding one or more syntax elements associated with the slice, wherein:
in a case that the slice type indicates the B slice type and the flag value is equal to the first value, the CABAC context is initialized by a first initialization method,
in a case that the slice type indicates the B slice type and the flag value is equal to the second value, the CABAC context is initialized by a second initialization method,
in a case that the slice type indicates the P slice type and the flag value is equal to the first value, the CABAC context is initialized by the second initialization method,
in a case that the slice type indicates the P slice type and the flag value is equal to the second value, the CABAC context is initialized by the first initialization method, and
in a case that the slice type indicates an I slice type, the CABAC context is initialized by a third initialization method; and
decoding the one or more syntax elements associated with the slice using the initialized CABAC context.
2. The method of claim 1 , further comprising:
decoding the picture to generate a decoded picture; and
displaying the decoded picture.
3. The method of claim 1 , further comprising:
decoding the bitstream of video data to generate decoded video data; and
displaying the decoded video data.
4. The method of claim 1 , wherein the default flag value is a predetermined one of the first value or the second value.
5. An apparatus for decoding video data, the apparatus comprising one or more processors that configure the apparatus to:
receive a bitstream of video data including a picture, the picture including a slice;
decode, from the bitstream, a presence flag in a picture parameter set of the picture, wherein the presence flag indicates whether or not an initialization flag is included in a slice header of the slice;
decode, from the bitstream, a syntax element in the slice header indicative of a slice type of the slice;
in a case that the slice type of the slice is a B slice type or a P slice type:
if the presence flag indicates that the initialization flag is included in the slice header of the slice, decode, from the bitstream, the initialization flag having a flag value that is used to determine a Context-Adaptive Binary Arithmetic Coding (CABAC) context initialization method for the B slice type or the P slice type, wherein the flag value is either a first value or a second value, and
if the presence flag indicates that the initialization flag is not included in the slide header of the slice, assume the initialization flag to have a default flag value;
initialize a CABAC context to be used for decoding one or more syntax elements associated with the slice, wherein:
in a case that the slice type indicates the B slice type and the flag value is equal to the first value, the CABAC context is initialized by a first initialization method,
in a case that the slice type indicates the B slice type and the flag value is equal to the second value, the CABAC context is initialized by a second initialization method,
in a case that the slice type indicates the P slice type and the flag value is equal to the first value, the CABAC context is initialized by the second initialization method,
in a case that the slice type indicates the P slice type and the flag value is equal to the second value, the CABAC context is initialized by the first initialization method, and
in a case that the slice type indicates an I slice type, the CABAC context is initialized by a third initialization method; and
decode the one or more syntax elements associated with the slice using the initialized CABAC context.
6. The apparatus of claim 5 , wherein the one or more processors further configure the apparatus to:
decode the picture to generate a decoded picture; and
display the decoded picture.
7. The apparatus of claim 5 , wherein the one or more processors further configure the apparatus to:
decode the bitstream of video data to generate decoded video data; and
display the decoded video data.
8. The apparatus of claim 5 , wherein the default flag value is a predetermined one of the first value or the second value.
9. The apparatus of claim 5 , wherein the apparatus further comprises memory, the memory comprising instructions which, when executed by the one or more processors, configures the apparatus as recited in claim 5 .
10. A method for encoding video data, the method comprising:
encoding, in a bitstream, a presence flag in a picture parameter set of a picture, the picture including a slice, wherein the presence flag indicates whether or not an initialization flag is to be included in a slice header of the slice;
encoding, in the bitstream, a syntax element in the slide header of the slice indicative of a slice type of the slice;
in a case that the slice type of the slice is a B slice type and the presence flag indicates that the initialization flag is to be included in the slice header of the slice, determining an initialization method for initializing a Context-Adaptive Binary Arithmetic Coding (CABAC) context to be used for encoding one or more syntax elements associated with the slice to be one of a first initialization method or a second initialization method, and
in a case that the initialization method is a first initialization method, setting a flag value of the initialization flag to a first value,
in a case that the initialization method is a second initialization method, setting the flag value of the initialization flag to a second value, and
encoding, in the bitstream, the initialization flag in the slice header of the slice;
in a case that the slice type of the slice is a P slice type and the presence flag indicates that the initialization flag is to be included in the slide header of the slice, determining the initialization method for initializing the CABAC context to be used for encoding one or more syntax elements associated with the slice to be one of the first initialization method or the second initialization method, and
in a case that the initialization method is the second initialization method, setting the flag value of the initialization flag to the first value,
in a case that the initialization method is the first initialization method, setting the flag value of the initialization flag to the second value, and
encoding, in the bitstream, the initialization flag in the slice header of the slice;
in a case that the slice type of the slice is an I slice type, the initialization method is a third initialization method; and
encoding the one or more syntax elements associated with the slice using the initialized CABAC context.
11. The method of claim 10 , wherein the initialization flag is indicative of the initialization method for slices of the B slice type and the P slice type.
12. The method of claim 10 , further comprising partitioning the picture into a plurality of slices comprising the slice.
13. The method of claim 10 , wherein the first initialization method comprises using a first set of precomputed values to initialize the CABAC context, the second initialization method comprises using a second set of precomputed values to initialize the CABAC context, and the third initialization method comprises using a third set of precomputed values to initialize the CABAC context.
14. The method of claim 10 , further comprising initializing the CABAC context for the slice using the initialization method.
15. An apparatus for encoding video data, the apparatus comprising one or more processors that configure the apparatus to:
encode, in a bitstream, a presence flag in a picture parameter set of a picture, the picture including a slice, wherein the presence flag indicates whether or not an initialization flag is to be included in a slice header of the slice;
encode, in the bitstream, a syntax element in the slice header of the slice indicative of a slice type of the slice;
in a case that the slice type of the slice is a B slice type and the presence flag indicates that the initialization flag is to be included in the slice header of the slice, determine an initialization method for initializing a Context-Adaptive Binary Arithmetic Coding (CABAC) context to be used for encoding one or more syntax elements associated with the slice to be one of a first initialization method or a second initialization method, and
in a case that the initialization method is a first initialization method, set a flag value of the initialization flag to a first value,
in a case that the initialization method is a second initialization method, set the flag value of the initialization flag to a second value, and
encode, in the bitstream, the initialization flag in the slice header of the slice;
in a case that the slice type of the slice is a P slice type and the presence flag indicates that the initialization flag is to be included in the slice header of the slice, determine the initialization method for initializing the CABAC context to be used for encoding one or more syntax elements associated with the slice to be one of the first initialization method or the second initialization method, and
in a case that the initialization method is the second initialization method, set the flag value of the initialization flag to the first value,
in a case that the initialization method is the first initialization method, set the flag value of the initialization flag to the second value, and
encode, in the bitstream, the initialization flag in the slice header of the slice;
in a case that the slice type of the slice is an I slice type, the initialization method is a third initialization method; and
encode the one or more syntax elements associated with the slice using the initialized CABAC context.
16. The apparatus of claim 15 , wherein the initialization flag is indicative of the initialization method for slices of the B slice type and the P slice type.
17. The apparatus of claim 15 , wherein the one or more processors further configure the apparatus to partition the picture into a plurality of slices comprising the slice.
18. The apparatus of claim 15 , wherein the first initialization method comprises using a first set of precomputed values to initialize the CABAC context, the second initialization method comprises using a second set of precomputed values to initialize the CABAC context, and the third initialization method comprises using a third set of precomputed values to initialize the CABAC context.
19. The apparatus of claim 15 , wherein the one or more processors further configure the apparatus to initialize the CABAC context for the slice using the initialization method.
20. The apparatus of claim 15 , wherein the apparatus further comprises memory, the memory comprising instructions which, when executed by the one or more processors, configures the apparatus as recited in claim 15 .