Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h264: full SPS parsing #253

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add DECODE_SUBOBJECT macro
  • Loading branch information
mildsunrise committed Feb 23, 2024
commit 2a8778c2726be2d5f8894db32b987117d12500a3
1 change: 1 addition & 0 deletions src/descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// and synchronized with descriptor_undef.h.

#define CHECK(r) if(r.Error()) return false;
#define DECODE_SUBOBJECT(lvalue, ...) if (!(lvalue).Decode(__VA_ARGS__)) return false;

#define DUMP_FIELD(field, format) \
Debug("%s" #field "=" format "\n", prefix, (field));
Expand Down
1 change: 1 addition & 0 deletions src/descriptor_undef.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#undef CHECK
#undef DECODE_SUBOBJECT
#undef DUMP_FIELD
#undef DUMP_SUBOBJECT
18 changes: 5 additions & 13 deletions src/h265/h265.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ bool H265ProfileTierLevel::Decode(BitReader& r, bool profilePresentFlag, BYTE ma
{
if (profilePresentFlag)
{
if(!general_profile_tier_level.Decode(r) ||
r.Left() < 8 + (8*2 * (maxNumSubLayersMinus1 > 0)))
DECODE_SUBOBJECT(general_profile_tier_level, r);
if(r.Left() < 8 + (8*2 * (maxNumSubLayersMinus1 > 0)))
{
Error("-H265: PTL information too short\n");
return false;
Expand All @@ -166,11 +166,7 @@ bool H265ProfileTierLevel::Decode(BitReader& r, bool profilePresentFlag, BYTE ma
{
if (sub_layer_profile_present_flag[i])
{
if(!sub_layer_profile_tier_level[i].Decode(r))
{
Error("PTL information for sublayer %zu too short\n", i);
return false;
}
DECODE_SUBOBJECT(sub_layer_profile_tier_level[i], r);
}
if (sub_layer_level_present_flag[i])
{
Expand Down Expand Up @@ -222,10 +218,7 @@ bool H265VideoParameterSet::Decode(const BYTE* buffer,DWORD bufferSize)
return false;
}

if (!profile_tier_level.Decode(r, true, vps_max_sub_layers_minus1))
{
return false;
}
DECODE_SUBOBJECT(profile_tier_level, r, true, vps_max_sub_layers_minus1);
// skip all the following element decode/parse
return true;
}
Expand Down Expand Up @@ -258,8 +251,7 @@ bool H265SeqParameterSet::Decode(const BYTE* buffer,DWORD bufferSize)
if (!MultiLayerExtSpsFlag)
{
CHECK(r); temporal_id_nesting_flag = r.Get(1);
if (!profile_tier_level.Decode(r, true, max_sub_layers_minus1))
return false;
CHECK(r); DECODE_SUBOBJECT(profile_tier_level, r, true, max_sub_layers_minus1);
}
// sps id
seq_parameter_set_id = ExpGolombDecoder::Decode(r);
Expand Down
Loading