Skip to content

Commit

Permalink
fix chroma_format_idc value for baseline profile (#103)
Browse files Browse the repository at this point in the history
* fix chroma_format_idc value for baseline profile

* fix test code
  • Loading branch information
hsnks100 authored Jan 10, 2024
1 parent 3937359 commit 1e7cfdf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/codecs/h264/sps.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ func (s *SPS) Unmarshal(buf []byte) error {
}

default:
s.ChromaFormatIdc = 0
s.ChromaFormatIdc = 1
s.SeparateColourPlaneFlag = false
s.BitDepthLumaMinus8 = 0
s.BitDepthChromaMinus8 = 0
Expand Down
9 changes: 6 additions & 3 deletions pkg/codecs/h264/sps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func TestSPSUnmarshal(t *testing.T) {
},
SPS{
ProfileIdc: 66,
ChromaFormatIdc: 1,
ConstraintSet0Flag: true,
ConstraintSet1Flag: true,
LevelIdc: 40,
Expand All @@ -122,7 +123,7 @@ func TestSPSUnmarshal(t *testing.T) {
},
},
1920,
1084,
1080,
30,
},
{
Expand Down Expand Up @@ -368,6 +369,7 @@ func TestSPSUnmarshal(t *testing.T) {
},
SPS{
ProfileIdc: 77,
ChromaFormatIdc: 1,
LevelIdc: 41,
Log2MaxFrameNumMinus4: 5,
Log2MaxPicOrderCntLsbMinus4: 5,
Expand Down Expand Up @@ -420,7 +422,7 @@ func TestSPSUnmarshal(t *testing.T) {
},
},
1920,
1084,
1080,
25,
},
{
Expand All @@ -434,6 +436,7 @@ func TestSPSUnmarshal(t *testing.T) {
},
SPS{
ProfileIdc: 77,
ChromaFormatIdc: 1,
ConstraintSet1Flag: true,
LevelIdc: 40,
Log2MaxFrameNumMinus4: 1,
Expand Down Expand Up @@ -475,7 +478,7 @@ func TestSPSUnmarshal(t *testing.T) {
},
},
1920,
1084,
1080,
25,
},
} {
Expand Down
11 changes: 6 additions & 5 deletions pkg/formats/fmp4/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"testing"

"github.com/aler9/writerseeker"
"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
"github.com/stretchr/testify/require"

"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
)

var testSPS = []byte{
Expand Down Expand Up @@ -391,7 +392,7 @@ var casesInit = []struct {
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x07, 0x80, 0x00, 0x00, 0x04, 0x3c, 0x00, 0x00,
0x07, 0x80, 0x00, 0x00, 0x04, 0x38, 0x00, 0x00,
0x00, 0x00, 0x01, 0x88,
'm', 'd', 'i', 'a',
0x00, 0x00, 0x00, 0x20,
Expand Down Expand Up @@ -426,7 +427,7 @@ var casesInit = []struct {
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x04,
0x3c, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00,
0x38, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -1321,7 +1322,7 @@ var casesInit = []struct {
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x07, 0x80, 0x00, 0x00, 0x04, 0x3c, 0x00, 0x00,
0x07, 0x80, 0x00, 0x00, 0x04, 0x38, 0x00, 0x00,
0x00, 0x00, 0x01, 0x88,
'm', 'd', 'i', 'a',
0x00, 0x00, 0x00, 0x20,
Expand Down Expand Up @@ -1354,7 +1355,7 @@ var casesInit = []struct {
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x04,
0x3c, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00,
0x38, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down

0 comments on commit 1e7cfdf

Please sign in to comment.