If a sequence display extension is read with colour_description equal to zero, but a user wants to add one or more of the colour_description elements, then the colour_description elements the user did not explicitly request to be set are set to zero and not to the value equal to unknown/unspecified (namely 2). A value of zero is not only inappropriate, but explicitly forbidden. This is fixed by inferring the right default values during the reading process if the elements are absent; moreover, changing any of the colour_description elements to zero is now no longer possible.
Showing the changes to libavcodec/cbs_mpeg2_syntax_template.c (1 of 3 files). Show all
Unified · Split
| @@ -144,6 +144,10 @@ static int FUNC(sequence_display_extension)(CodedBitstreamContext *ctx, RWContex · 143 unmodified lines | |||
| 144 | uir(8, transfer_characteristics); | 144 | uir(8, transfer_characteristics); |
| 145 | uir(8, matrix_coefficients); | 145 | uir(8, matrix_coefficients); |
| 146 | #endif | 146 | #endif |
| 147 | } else { | ||
| 148 | infer(colour_primaries, 2); | ||
| 149 | infer(transfer_characteristics, 2); | ||
| 150 | infer(matrix_coefficients, 2); | ||
| 147 | } | 151 | } |
| 148 | 152 | ||
| 149 | ui(14, display_horizontal_size); | 153 | ui(14, display_horizontal_size); |