mirror of https://bitbucket.org/ausocean/av.git
codec/h264/h264dec/nalunit_test.go: added TestNewThreeDAVCExtension
This commit is contained in:
parent
48955967e0
commit
96377f8788
|
@ -50,3 +50,44 @@ func TestNewMVCExtension(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewThreeDAVCExtension(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
in string
|
||||||
|
want ThreeDAVCExtension
|
||||||
|
err error
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
in: "0001 0000" + // u(8) view_idx = 16
|
||||||
|
"1" + // u(1) depth_flag = true
|
||||||
|
"0" + // u(1) non_idr_flag = false
|
||||||
|
"010" + // u(1) temporal_id = 2
|
||||||
|
"1" + // u(1) anchor_pic_flag = true
|
||||||
|
"1", // u(1) inter_view_flag = true
|
||||||
|
want: ThreeDAVCExtension{
|
||||||
|
ViewIdx: 16,
|
||||||
|
DepthFlag: true,
|
||||||
|
NonIdrFlag: false,
|
||||||
|
TemporalID: 2,
|
||||||
|
AnchorPicFlag: true,
|
||||||
|
InterViewFlag: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, test := range tests {
|
||||||
|
inBytes, err := binToSlice(test.in)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("did not expect error %v from binToSlice for test %d", err, i)
|
||||||
|
}
|
||||||
|
|
||||||
|
got, err := NewThreeDAVCExtension(bits.NewBitReader(bytes.NewReader(inBytes)))
|
||||||
|
if err != test.err {
|
||||||
|
t.Errorf("did not get expected error for test %d\nGot: %v\nWant: %v\n", i, err, test.err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !reflect.DeepEqual(*got, test.want) {
|
||||||
|
t.Errorf("did not get expected result for test %d\nGot: %v\nWant: %v\n", i, *got, test.want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue