mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-06 06:22:29 +00:00
codecparsers: bitwriter: Fix some coverity issues of H265 bitwriter.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2287>
This commit is contained in:
parent
f55b36e6aa
commit
abf19020a4
1 changed files with 6 additions and 12 deletions
|
@ -137,11 +137,6 @@ _h265_bit_writer_profile_tier_level (const GstH265ProfileTierLevel * ptl,
|
||||||
|
|
||||||
GST_DEBUG ("writing profile_tier_level");
|
GST_DEBUG ("writing profile_tier_level");
|
||||||
|
|
||||||
if (maxNumSubLayersMinus1 > 0) {
|
|
||||||
GST_WARNING ("sub layers are not supported now");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE_BITS (bw, ptl->profile_space, 2);
|
WRITE_BITS (bw, ptl->profile_space, 2);
|
||||||
WRITE_BITS (bw, ptl->tier_flag, 1);
|
WRITE_BITS (bw, ptl->tier_flag, 1);
|
||||||
WRITE_BITS (bw, ptl->profile_idc, 5);
|
WRITE_BITS (bw, ptl->profile_idc, 5);
|
||||||
|
@ -376,7 +371,7 @@ _h265_bit_writer_vps (const GstH265VPS * vps, GstBitWriter * bw,
|
||||||
|
|
||||||
for (i = (vps->sub_layer_ordering_info_present_flag ? 0 :
|
for (i = (vps->sub_layer_ordering_info_present_flag ? 0 :
|
||||||
vps->max_sub_layers_minus1); i <= vps->max_sub_layers_minus1; i++) {
|
vps->max_sub_layers_minus1); i <= vps->max_sub_layers_minus1; i++) {
|
||||||
WRITE_UE_MAX (bw, vps->max_dec_pic_buffering_minus1[i], G_MAXUINT32 - 1);
|
WRITE_UE (bw, vps->max_dec_pic_buffering_minus1[i]);
|
||||||
WRITE_UE_MAX (bw, vps->max_num_reorder_pics[i],
|
WRITE_UE_MAX (bw, vps->max_num_reorder_pics[i],
|
||||||
vps->max_dec_pic_buffering_minus1[i]);
|
vps->max_dec_pic_buffering_minus1[i]);
|
||||||
WRITE_UE_MAX (bw, vps->max_latency_increase_plus1[i], G_MAXUINT32 - 1);
|
WRITE_UE_MAX (bw, vps->max_latency_increase_plus1[i], G_MAXUINT32 - 1);
|
||||||
|
@ -908,7 +903,7 @@ _h265_bit_writer_sps (const GstH265SPS * sps,
|
||||||
WRITE_UE_MAX (bw, sps->max_dec_pic_buffering_minus1[i], 16);
|
WRITE_UE_MAX (bw, sps->max_dec_pic_buffering_minus1[i], 16);
|
||||||
WRITE_UE_MAX (bw, sps->max_num_reorder_pics[i],
|
WRITE_UE_MAX (bw, sps->max_num_reorder_pics[i],
|
||||||
sps->max_dec_pic_buffering_minus1[i]);
|
sps->max_dec_pic_buffering_minus1[i]);
|
||||||
WRITE_UE_MAX (bw, sps->max_latency_increase_plus1[i], G_MAXUINT32 - 1);
|
WRITE_UE (bw, sps->max_latency_increase_plus1[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The limits are calculted based on the profile_tier_level constraint
|
/* The limits are calculted based on the profile_tier_level constraint
|
||||||
|
@ -1263,10 +1258,10 @@ _h265_bit_writer_pps (const GstH265PPS * pps, GstBitWriter * bw,
|
||||||
pps->sps->bit_depth_luma_minus8 - 2 : 0;
|
pps->sps->bit_depth_luma_minus8 - 2 : 0;
|
||||||
MaxBitDepthC = pps->sps->bit_depth_chroma_minus8 > 2 ?
|
MaxBitDepthC = pps->sps->bit_depth_chroma_minus8 > 2 ?
|
||||||
pps->sps->bit_depth_chroma_minus8 - 2 : 0;
|
pps->sps->bit_depth_chroma_minus8 - 2 : 0;
|
||||||
WRITE_SE_RANGE (bw, pps->pps_extension_params.log2_sao_offset_scale_luma, 0,
|
WRITE_UE_MAX (bw, pps->pps_extension_params.log2_sao_offset_scale_luma,
|
||||||
MaxBitDepthY);
|
MaxBitDepthY);
|
||||||
WRITE_SE_RANGE (bw, pps->pps_extension_params.log2_sao_offset_scale_chroma,
|
WRITE_UE_MAX (bw, pps->pps_extension_params.log2_sao_offset_scale_chroma,
|
||||||
0, MaxBitDepthC);
|
MaxBitDepthC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pps->pps_multilayer_extension_flag) {
|
if (pps->pps_multilayer_extension_flag) {
|
||||||
|
@ -2140,8 +2135,7 @@ gst_h265_bit_writer_aud (guint8 pic_type, gboolean start_code,
|
||||||
gboolean have_space = TRUE;
|
gboolean have_space = TRUE;
|
||||||
GstBitWriter bw;
|
GstBitWriter bw;
|
||||||
|
|
||||||
g_return_val_if_fail (pic_type >= 0 && pic_type <= 2,
|
g_return_val_if_fail (pic_type <= 2, GST_H265_BIT_WRITER_ERROR);
|
||||||
GST_H265_BIT_WRITER_ERROR);
|
|
||||||
g_return_val_if_fail (data != NULL, GST_H265_BIT_WRITER_ERROR);
|
g_return_val_if_fail (data != NULL, GST_H265_BIT_WRITER_ERROR);
|
||||||
g_return_val_if_fail (size != NULL, GST_H265_BIT_WRITER_ERROR);
|
g_return_val_if_fail (size != NULL, GST_H265_BIT_WRITER_ERROR);
|
||||||
g_return_val_if_fail (*size > 0, GST_H265_BIT_WRITER_ERROR);
|
g_return_val_if_fail (*size > 0, GST_H265_BIT_WRITER_ERROR);
|
||||||
|
|
Loading…
Reference in a new issue