From 1e25a3614c8b979eea601b3f72b7f41b646fb112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbjo=CC=88rn=20Einarsson?= Date: Tue, 5 Nov 2024 21:56:57 +0100 Subject: [PATCH] test: add a little more HEVC testing --- hevc/sps_test.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/hevc/sps_test.go b/hevc/sps_test.go index 9aa82256..6cb113a7 100644 --- a/hevc/sps_test.go +++ b/hevc/sps_test.go @@ -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") + } + }) + } + +}