1
1
mirror of https://github.com/wader/fq.git synced 2024-12-27 15:42:07 +03:00

Merge pull request #203 from wader/avc-sps-chroma-format-map

avc_sps: Add chroma format name mapping
This commit is contained in:
Mattias Wadman 2022-03-18 12:29:39 +01:00 committed by GitHub
commit df4a1e1ee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 6 deletions

View File

@ -263,7 +263,7 @@ $ fq -d matroska dv /avc.mkv
0x000| 00 | . | reserved_zero_2bits: 0 0x1.6-0x1.7 (0.2)
0x000| 0d | . | level_idc: "1.3" (13) 0x2-0x2.7 (1)
0x000| 91 | . | seq_parameter_set_id: 0 0x3-0x3 (0.1)
0x000| 91 | . | chroma_format_idc: 3 0x3.1-0x3.5 (0.5)
0x000| 91 | . | chroma_format_idc: "4:4:4" (3) 0x3.1-0x3.5 (0.5)
0x000| 91 | . | separate_colour_plane_flag: false 0x3.6-0x3.6 (0.1)
0x000| 91 | . | bit_depth_luma: 8 0x3.7-0x3.7 (0.1)
0x000| 9b | . | bit_depth_chroma: 8 0x4-0x4 (0.1)

View File

@ -246,7 +246,7 @@ $ fq -d mp4 dv /avc.mp4
0x000| 00 | . | reserved_zero_2bits: 0 0x1.6-0x1.7 (0.2)
0x000| 0d | . | level_idc: "1.3" (13) 0x2-0x2.7 (1)
0x000| 91 | . | seq_parameter_set_id: 0 0x3-0x3 (0.1)
0x000| 91 | . | chroma_format_idc: 3 0x3.1-0x3.5 (0.5)
0x000| 91 | . | chroma_format_idc: "4:4:4" (3) 0x3.1-0x3.5 (0.5)
0x000| 91 | . | separate_colour_plane_flag: false 0x3.6-0x3.6 (0.1)
0x000| 91 | . | bit_depth_luma: 8 0x3.7-0x3.7 (0.1)
0x000| 9b | . | bit_depth_chroma: 8 0x4-0x4 (0.1)

View File

@ -721,7 +721,7 @@ $ fq -d mp4 dv /dash_video_init.mp4
0x00| 10 | . | reserved_zero_2bits: 0 0x1.6-0x1.7 (0.2)
0x00| 0d | . | level_idc: "1.3" (13) 0x2-0x2.7 (1)
0x00| 91 | . | seq_parameter_set_id: 0 0x3-0x3 (0.1)
0x00| 91 | . | chroma_format_idc: 3 0x3.1-0x3.5 (0.5)
0x00| 91 | . | chroma_format_idc: "4:4:4" (3) 0x3.1-0x3.5 (0.5)
0x00| 91 | . | separate_colour_plane_flag: false 0x3.6-0x3.6 (0.1)
0x00| 91 | . | bit_depth_luma: 8 0x3.7-0x3.7 (0.1)
0x00| 97 | . | bit_depth_chroma: 8 0x4-0x4 (0.1)

View File

@ -205,7 +205,7 @@ $ fq -d mp4 dv /fragmented.mp4
0x000| 10 | . | reserved_zero_2bits: 0 0x1.6-0x1.7 (0.2)
0x000| 0d | . | level_idc: "1.3" (13) 0x2-0x2.7 (1)
0x000| 91 | . | seq_parameter_set_id: 0 0x3-0x3 (0.1)
0x000| 91 | . | chroma_format_idc: 3 0x3.1-0x3.5 (0.5)
0x000| 91 | . | chroma_format_idc: "4:4:4" (3) 0x3.1-0x3.5 (0.5)
0x000| 91 | . | separate_colour_plane_flag: false 0x3.6-0x3.6 (0.1)
0x000| 91 | . | bit_depth_luma: 8 0x3.7-0x3.7 (0.1)
0x000| 97 | . | bit_depth_chroma: 8 0x4-0x4 (0.1)

View File

@ -46,6 +46,13 @@ var avcAspectRatioIdcMap = scalar.UToSymStr{
16: "2:1",
}
var chromaFormatMap = scalar.UToSymStr{
0: "monochrome",
1: "4:2:0",
2: "4:2:2",
3: "4:4:4",
}
func avcVuiParameters(d *decode.D) {
aspectRatioInfoPresentFlag := d.FieldBool("aspect_ratio_info_present_flag")
if aspectRatioInfoPresentFlag {
@ -142,7 +149,7 @@ func avcSPSDecode(d *decode.D, in interface{}) interface{} {
switch profileIdc {
// TODO: ffmpeg has some more (legacy values?)
case 100, 110, 122, 244, 44, 83, 86, 118, 128, 138, 139, 134, 135:
chromaFormatIdc := d.FieldUFn("chroma_format_idc", uEV)
chromaFormatIdc := d.FieldUFn("chroma_format_idc", uEV, chromaFormatMap)
if chromaFormatIdc == 3 {
d.FieldBool("separate_colour_plane_flag")
}

View File

@ -14,7 +14,7 @@ $ fq -d avc_annexb dv /avc_annexb
0x000| 00 | . | reserved_zero_2bits: 0 0x1.6-0x1.7 (0.2)
0x000| 0d | . | level_idc: "1.3" (13) 0x2-0x2.7 (1)
0x000| 91 | . | seq_parameter_set_id: 0 0x3-0x3 (0.1)
0x000| 91 | . | chroma_format_idc: 3 0x3.1-0x3.5 (0.5)
0x000| 91 | . | chroma_format_idc: "4:4:4" (3) 0x3.1-0x3.5 (0.5)
0x000| 91 | . | separate_colour_plane_flag: false 0x3.6-0x3.6 (0.1)
0x000| 91 | . | bit_depth_luma: 8 0x3.7-0x3.7 (0.1)
0x000| 9b | . | bit_depth_chroma: 8 0x4-0x4 (0.1)