Skip to content

Commit

Permalink
test: add a little more HEVC testing
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbee committed Nov 5, 2024
1 parent 8ea759e commit 1e25a36
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions hevc/sps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,43 @@ func TestParseSPSWithNonZeroNumDeltaPocs(t *testing.T) {
}
t.Log(sps)
}

// Use SPS and PPS from https://www.itu.int/wftp3/av-arch/jctvc-site/bitstream_exchange/under_test/
// to get bigger variety of input. Don't consider the actual output, just check that parsing works
func TestSPSandPPS(t *testing.T) {
cases := []struct {
desc string
vps string
sps string
pps string
}{
{
desc: "Zero_and_One_Palette_Size_A_Canon_2",
vps: "40010c01ffff090040000003000c000003000078ac09",
sps: "420101090040000003000c00000300007890007810021cff2d7248db3db643cd81000843",
pps: "4401c194964c08b21bdd",
},
}
for _, c := range cases {
t.Run(c.desc, func(t *testing.T) {
//vpsBytes, _ := hex.DecodeString(c.vps)
spsBytes, _ := hex.DecodeString(c.sps)
ppsBytes, _ := hex.DecodeString(c.pps)

sps, err := ParseSPSNALUnit(spsBytes)
if err != nil {
t.Error("Error parsing SPS Nal unit")
}
spsMap := make(map[uint32]*SPS)
spsMap[uint32(sps.SpsID)] = sps
pps, err := ParsePPSNALUnit(ppsBytes, spsMap)
if err != nil {
t.Error("Error parsing PPS Nal unit")
}
if byte(pps.SeqParameterSetID) != sps.SpsID {
t.Error("PPS SpsID does not match SPS SpsID")
}
})
}

}

0 comments on commit 1e25a36

Please sign in to comment.