mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-20 06:11:04 +00:00
lavc: Use a stricter check for the color properties values
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This commit is contained in:
parent
0a35f128f3
commit
ff9db5cfd1
@ -191,11 +191,13 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
|
||||
sps->color_primaries = get_bits(gb, 8); /* colour_primaries */
|
||||
sps->color_trc = get_bits(gb, 8); /* transfer_characteristics */
|
||||
sps->colorspace = get_bits(gb, 8); /* matrix_coefficients */
|
||||
if (sps->color_primaries >= AVCOL_PRI_NB)
|
||||
|
||||
// Set invalid values to "unspecified"
|
||||
if (!av_color_primaries_name(sps->color_primaries))
|
||||
sps->color_primaries = AVCOL_PRI_UNSPECIFIED;
|
||||
if (sps->color_trc >= AVCOL_TRC_NB)
|
||||
if (!av_color_transfer_name(sps->color_trc))
|
||||
sps->color_trc = AVCOL_TRC_UNSPECIFIED;
|
||||
if (sps->colorspace >= AVCOL_SPC_NB)
|
||||
if (!av_color_space_name(sps->colorspace))
|
||||
sps->colorspace = AVCOL_SPC_UNSPECIFIED;
|
||||
}
|
||||
}
|
||||
|
@ -497,11 +497,11 @@ static void decode_vui(GetBitContext *gb, AVCodecContext *avctx,
|
||||
vui->matrix_coeffs = get_bits(gb, 8);
|
||||
|
||||
// Set invalid values to "unspecified"
|
||||
if (vui->colour_primaries >= AVCOL_PRI_NB)
|
||||
if (!av_color_primaries_name(vui->colour_primaries))
|
||||
vui->colour_primaries = AVCOL_PRI_UNSPECIFIED;
|
||||
if (vui->transfer_characteristic >= AVCOL_TRC_NB)
|
||||
if (!av_color_transfer_name(vui->transfer_characteristic))
|
||||
vui->transfer_characteristic = AVCOL_TRC_UNSPECIFIED;
|
||||
if (vui->matrix_coeffs >= AVCOL_SPC_NB)
|
||||
if (!av_color_space_name(vui->matrix_coeffs))
|
||||
vui->matrix_coeffs = AVCOL_SPC_UNSPECIFIED;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user