Skip to content

Commit

Permalink
[Decode] Only decode basic layer when input is multi-layer
Browse files Browse the repository at this point in the history
  • Loading branch information
yawenyan authored and gfxVPLsdm committed Sep 23, 2024
1 parent 5e1dbc7 commit 0039e3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2012-2020 Intel Corporation
// Copyright (c) 2012-2024 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -331,7 +331,7 @@ UMC::Status H265HeadersBitstream::GetVideoParamSet(H265VideoParamSet *pcVPS)
}

pcVPS->vps_max_layer_id = GetBits(6);
if (pcVPS->vps_max_layer_id >= MAX_NUH_LAYER_ID)
if (pcVPS->vps_max_layer_id > MAX_NUH_LAYER_ID)
throw h265_exception(UMC::UMC_ERR_INVALID_STREAM);

pcVPS->vps_num_layer_sets = GetVLCElementU() + 1;
Expand Down Expand Up @@ -2102,8 +2102,10 @@ UMC::Status H265HeadersBitstream::GetNALUnitType(NalUnitType &nal_unit_type, uin

nal_unit_type = (NalUnitType)GetBits(6);
uint32_t nuh_layer_id = GetBits(6);
if (nuh_layer_id)
if (nuh_layer_id > MAX_NUH_LAYER_ID)
throw h265_exception(UMC::UMC_ERR_INVALID_STREAM);
if (nuh_layer_id)
return UMC::UMC_ERR_UNSUPPORTED;//only support layer 0 which is the basic layer

uint32_t const nuh_temporal_id_plus1 = GetBits(3);
if (!nuh_temporal_id_plus1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1432,9 +1432,10 @@ UMC::Status TaskSupplier_H265::DecodeHeaders(UMC::MediaDataEx *nalUnit)
NalUnitType nal_unit_type;
uint32_t temporal_id = 0;

bitStream.GetNALUnitType(nal_unit_type, temporal_id);

switch(nal_unit_type)
umcRes = bitStream.GetNALUnitType(nal_unit_type, temporal_id);
if (umcRes != UMC::UMC_OK)
return umcRes;
switch (nal_unit_type)
{
case NAL_UT_VPS:
umcRes = xDecodeVPS(&bitStream);
Expand Down

0 comments on commit 0039e3a

Please sign in to comment.