mirror of https://bitbucket.org/ausocean/av.git
codec/h264/h264dec: added TestNewSVCExtension
This commit is contained in:
parent
aab3473abf
commit
d5776c4496
|
@ -22,7 +22,7 @@ func TestNewMVCExtension(t *testing.T) {
|
|||
"1" + // u(1) anchor_pic_flag = true
|
||||
"0" + // u(1) inter_view_flag = false
|
||||
"1" + // u(1) reserved_one_bit = 1
|
||||
"0 00000000", // Some padding
|
||||
"0", // Some padding
|
||||
want: MVCExtension{
|
||||
NonIdrFlag: false,
|
||||
PriorityID: 2,
|
||||
|
@ -93,3 +93,53 @@ func TestNewThreeDAVCExtension(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSVCExtension(t *testing.T) {
|
||||
tests := []struct {
|
||||
in string
|
||||
want SVCExtension
|
||||
err error
|
||||
}{
|
||||
{
|
||||
in: "0" + // u(1) idr_flag = false
|
||||
"10 0000" + // u(6) priority_id = 32
|
||||
"0" + // u(1) no_inter_layer_pred_flag = false
|
||||
"001" + // u(3) dependency_id = 1
|
||||
"1000" + // u(4) quality_id = 8
|
||||
"010" + // u(3) temporal_id = 2
|
||||
"1" + // u(1) use_ref_base_pic_flag = true
|
||||
"0" + // u(1) discardable_flag = false
|
||||
"0" + // u(1) output_flag = false
|
||||
"11" + // ReservedThree2Bits
|
||||
"0", // padding
|
||||
want: SVCExtension{
|
||||
IdrFlag: false,
|
||||
PriorityID: 32,
|
||||
NoInterLayerPredFlag: false,
|
||||
DependencyID: 1,
|
||||
QualityID: 8,
|
||||
TemporalID: 2,
|
||||
UseRefBasePicFlag: true,
|
||||
DiscardableFlag: false,
|
||||
OutputFlag: false,
|
||||
ReservedThree2Bits: 3,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
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 := NewSVCExtension(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