-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathpps_test.go
77 lines (72 loc) · 1.67 KB
/
pps_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package hevc
import (
"encoding/hex"
"fmt"
"testing"
"github.com/go-test/deep"
)
func TestPPSParser(t *testing.T) {
testCases := []struct {
hexData string
spsID uint32
wanted PPS
}{
{
"4401c0f7c0cc90",
0,
PPS{
CabacInitPresentFlag: true,
TransformSkipEnabledFlag: true,
CuQpDeltaEnabledFlag: true,
LoopFilterAcrossSlicesEnabledFlag: true,
DeblockingFilterControlPresentFlag: true,
},
},
{
"4401c172b46240",
0,
PPS{
SignDataHidingEnabledFlag: true,
CuQpDeltaEnabledFlag: true,
DiffCuQpDeltaDepth: 1,
WeightedPredFlag: true,
LoopFilterAcrossSlicesEnabledFlag: true,
EntropyCodingSyncEnabledFlag: true,
},
},
{
"4401c1ac9383b240",
0,
PPS{
CabacInitPresentFlag: true,
NumRefIdxL0DefaultActiveMinus1: 1,
SignDataHidingEnabledFlag: true,
CuQpDeltaEnabledFlag: true,
DiffCuQpDeltaDepth: 3,
DeblockingFilterControlPresentFlag: true,
DeblockingFilterOverrideEnabledFlag: true,
LoopFilterAcrossSlicesEnabledFlag: true,
SliceChromaQpOffsetsPresentFlag: true,
},
},
}
for i, tc := range testCases {
t.Run(fmt.Sprintf("case %d_%s", i, tc.hexData), func(t *testing.T) {
byteData, err := hex.DecodeString(tc.hexData)
if err != nil {
t.Error(err)
}
spsMap := map[uint32]*SPS{
tc.spsID: nil,
}
got, err := ParsePPSNALUnit(byteData, spsMap)
if err != nil {
t.Error(err)
return
}
if diff := deep.Equal(&tc.wanted, got); diff != nil {
t.Error(diff)
}
})
}
}