Adjusting quantization/scaling and inverse quantization/scaling when switching color spaces
Innovations in adaptive encoding and decoding for units of a video sequence can improve coding efficiency when switching between color spaces during encoding and decoding. For example, some of the innovations relate to adjustment of quantization or scaling when an encoder switches color spaces between units within a video sequence during encoding. Other innovations relate to adjustment of inverse quantization or scaling when a decoder switches color spaces between units within a video sequence during decoding.
1. A computer system comprising one or more processing units and memory wherein the computer system implements a video decoder configured to perform operations comprising:
receiving encoded data, as part of a bitstream, for a picture of a video sequence; and
decoding the encoded data to reconstruct the picture, including:
determining a color space for a given unit of the picture, including selecting, based on a signal in the encoded data, between a first color space and a second color space, the first color space being RGB and the second color space being YCoCg, wherein the color space for the given unit is determined to be the second color space;
adjusting intermediate quantization parameter (“QP”) values for color components of the second color space according to per component color space adjustment factors, the per component color space adjustment factors adjusting the intermediate QP values for the color components of the second color space by rule for Y, Co, and Cg components, respectively, the per component color space adjustment factors depending on the second color space without signaling of syntax elements that indicate the per component color space adjustment factors; and
decoding the given unit based at least in part on the adjusted intermediate QP values.
2. The computer system of claim 1 , wherein the given unit is a coding unit.
3. The computer system of claim 1 , wherein the bitstream includes one or more syntax elements that indicate the intermediate QP values before adjustment according to the per component color space adjustment factors.
4. The computer system of claim 3 , wherein the one or more syntax elements that indicate the intermediate QP values before adjustment are signaled at picture level and/or slice level.
5. The computer system of claim 1 , wherein the per component color space adjustment factors are −5, −3, and −5 for Y, Co, and Cg components, respectively.
6. The computer system of claim 1 , wherein the per component color space adjustment factors are different between at least some of the color components of the second color space.
7. The computer system of claim 1 , wherein the decoding the encoded data to reconstruct the picture further includes:
clipping at least one of the intermediate QP values to be in a range defined between a minimum allowed value and a maximum allowed value.
8. One or more non-transitory computer-readable media storing encoded data, as part of a bitstream, for a picture of a video sequence, the encoded data being organized to facilitate decoding the encoded data to reconstruct the picture, with a computer-implemented video decoder, by operations comprising:
determining a color space for a given unit of the picture, including selecting, based on a signal in the encoded data, between a first color space and a second color space, the first color space being RGB and the second color space being YCoCg, wherein the color space for the given unit is determined to be the second color space;
adjusting intermediate quantization parameter (“QP”) values for color components of the second color space according to per component color space adjustment factors, the per component color space adjustment factors adjusting the intermediate QP values for the color components of the second color space by rule for Y, Co, and Cg components, respectively, the per component color space adjustment factors depending on the second color space without signaling of syntax elements that indicate the per component color space adjustment factors; and
decoding the given unit based at least in part on the adjusted intermediate QP values.
9. The one or more computer-readable media of claim 8 , wherein the given unit is a coding unit.
10. The one or more computer-readable media of claim 8 , wherein the bitstream includes one or more syntax elements that indicate the intermediate QP values before adjustment according to the per component color space adjustment factors.
11. The one or more computer-readable media of claim 10 , wherein the one or more syntax elements that indicate the intermediate QP values before adjustment are signaled at picture level and/or slice level.
12. The one or more computer-readable media of claim 8 , wherein the per component color space adjustment factors are −5, −3, and −5 for Y, Co, and Cg components, respectively.
13. The one or more computer-readable media of claim 8 , wherein the per component color space adjustment factors are different between at least some of the color components of the second color space.
14. In a computer system that implements a video encoder, a method comprising:
encoding a picture of a video sequence to produce encoded data, including:
determining a color space for a given unit of the picture, including selecting between a first color space and a second color space, the first color space being RGB and the second color space being YCoCg, wherein the color space for the given unit is determined to be the second color space;
adjusting intermediate quantization parameter (“QP”) values for color components of the second color space according to per component color space adjustment factors, the per component color space adjustment factors adjusting the intermediate QP values for the color components of the second color space by rule for Y, Co, and Cg components, respectively, the per component color space adjustment factors depending on the second color space without signaling of syntax elements that indicate the per component color space adjustment factors; and
encoding the given unit based at least in part on the adjusted intermediate QP values; and
outputting the encoded data as part of a bitstream, the encoded data including a signal that indicates the color space for the given unit.
15. The method of claim 14 , wherein the given unit is a coding unit.
16. The method of claim 14 , wherein the bitstream includes one or more syntax elements that indicate the intermediate QP values before adjustment according to the per component color space adjustment factors.
17. The method of claim 16 , wherein the one or more syntax elements that indicate the intermediate QP values before adjustment are signaled at picture level and/or slice level.
18. The method of claim 14 , wherein the per component color space adjustment factors are −5, −3, and −5 for Y, Co, and Cg components, respectively.
19. The method of claim 14 , wherein the per component color space adjustment factors are different between at least some of the color components of the second color space.
20. The method of claim 14 , wherein the per component color space adjustment factors depend on energy amplification for the respective color components of the second color space in inverse color space conversion operations.