From d0c7e8004c3afa154cf4c3154777d33c95385b83 Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Fri, 18 Oct 2024 17:48:02 +0200 Subject: [PATCH] av1_obu: Decode more of sequence header Also update to golangci/golangci-lint-action@v6 --- .github/workflows/ci.yml | 2 +- doc/formats.md | 2 +- doc/formats.svg | 2264 +++++++++-------- format/av1/av1_ccr.go | 13 +- format/av1/av1_obu.go | 313 ++- ...bu_seq_header_film_grain_chrome_sample_pos | Bin 0 -> 16 bytes ...header_film_grain_chrome_sample_pos.fqtest | 53 + format/matroska/testdata/av1.fqtest | 51 +- format/mp4/testdata/av1.fqtest | 104 +- 9 files changed, 1644 insertions(+), 1158 deletions(-) create mode 100644 format/av1/testdata/av1_obu_seq_header_film_grain_chrome_sample_pos create mode 100644 format/av1/testdata/av1_obu_seq_header_film_grain_chrome_sample_pos.fqtest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90133783..340d4fa0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: with: go-version: "1.23.0" - uses: actions/checkout@v3 - - uses: golangci/golangci-lint-action@v3 + - uses: golangci/golangci-lint-action@v6 with: version: v${{ env.GOLANGCILINT_VERSION }} diff --git a/doc/formats.md b/doc/formats.md index 83b843af..bb58ac93 100644 --- a/doc/formats.md +++ b/doc/formats.md @@ -13,7 +13,7 @@ |[`apple_bookmark`](#apple_bookmark) |Apple BookmarkData || |`ar` |Unix archive |`probe`| |[`asn1_ber`](#asn1_ber) |ASN1 BER (basic encoding rules, also CER and DER) || -|`av1_ccr` |AV1 Codec Configuration Record || +|`av1_ccr` |AV1 Codec Configuration Record |`av1_obu`| |`av1_frame` |AV1 frame |`av1_obu`| |`av1_obu` |AV1 Open Bitstream Unit || |`avc_annexb` |H.264/AVC Annex B |`avc_nalu`| diff --git a/doc/formats.svg b/doc/formats.svg index fe0f3007..5b8878f3 100644 --- a/doc/formats.svg +++ b/doc/formats.svg @@ -4,32 +4,32 @@ - + formats - + adts - -adts - -adts_frame + +adts + +adts_frame adts_frame - -adts_frame - -aac_frame + +adts_frame + +aac_frame adts:e->adts_frame:n - - + + @@ -40,837 +40,851 @@ adts_frame:e->aac_frame:n - - + + apev2 - -apev2 - -image + +apev2 + +image image - -image + +image apev2:e->image:n - - + + - + jpeg - -jpeg - -exif - -icc_profile + +jpeg + +exif + +icc_profile - + image->jpeg:n - - + + mp4 - -mp4 - -aac_frame - -av1_ccr - -av1_frame - -avc_au - -avc_dcr - -flac_frame - -flac_metadatablocks - -hevc_au - -hevc_dcr - -icc_profile - -id3v2 - -image - -jp2c - -jpeg - -mp3_frame - -mpeg_es - -mpeg_pes_packet - -opus_packet - -png - -prores_frame - -protobuf_widevine - -pssh_playready - -vorbis_packet - -vp9_frame - -vpx_ccr + +mp4 + +aac_frame + +av1_ccr + +av1_frame + +avc_au + +avc_dcr + +flac_frame + +flac_metadatablocks + +hevc_au + +hevc_dcr + +icc_profile + +id3v2 + +image + +jp2c + +jpeg + +mp3_frame + +mpeg_es + +mpeg_pes_packet + +opus_packet + +png + +prores_frame + +protobuf_widevine + +pssh_playready + +vorbis_packet + +vp9_frame + +vpx_ccr - + image->mp4:n - - + + jp2c - -jp2c + +jp2c - + image->jp2c:n - - + + png - -png - -icc_profile - -exif + +png + +icc_profile + +exif - + image->png:n - - + + tiff - -tiff - -icc_profile + +tiff + +icc_profile - + image->tiff:n - - + + webp - -webp - -exif - -vp8_frame - -icc_profile - -xml + +webp + +exif + +vp8_frame + +icc_profile + +xml - + image->webp:n - - + + gif - -gif + +gif - + image->gif:n - - + + ar - -ar - -probe + +ar + +probe probe - -probe + +probe ar:e->probe:n - - + + - + probe->adts:n - - + + - + probe->ar:n - - + + - + avi - -avi - -avc_au - -hevc_au - -mp3_frame - -flac_frame + +avi + +avc_au + +hevc_au + +mp3_frame + +flac_frame - + probe->avi:n - - + + - + bitcoin_blkdat - -bitcoin_blkdat - -bitcoin_block + +bitcoin_blkdat + +bitcoin_block - + probe->bitcoin_blkdat:n - - + + - + bzip2 - -bzip2 - -probe + +bzip2 + +probe - + probe->bzip2:n - - + + - + caff - -caff - -probe + +caff + +probe - + probe->caff:n - - + + - + flac - -flac - -flac_metadatablocks - -flac_frame + +flac + +flac_metadatablocks + +flac_frame - + probe->flac:n - - + + - + gzip - -gzip - -probe + +gzip + +probe - + probe->gzip:n - - + + - + probe->jpeg:n - - + + - + macho_fat - -macho_fat - -macho + +macho_fat + +macho - + probe->macho_fat:n - - + + - + macho - -macho + +macho - + probe->macho:n - - + + - + matroska - -matroska - -aac_frame - -av1_ccr - -av1_frame - -avc_au - -avc_dcr - -flac_frame - -flac_metadatablocks - -hevc_au - -hevc_dcr - -image - -mp3_frame - -mpeg_asc - -mpeg_pes_packet - -mpeg_spu - -opus_packet - -vorbis_packet - -vp8_frame - -vp9_cfm - -vp9_frame + +matroska + +aac_frame + +av1_ccr + +av1_frame + +avc_au + +avc_dcr + +flac_frame + +flac_metadatablocks + +hevc_au + +hevc_dcr + +image + +mp3_frame + +mpeg_asc + +mpeg_pes_packet + +mpeg_spu + +opus_packet + +vorbis_packet + +vp8_frame + +vp9_cfm + +vp9_frame - + probe->matroska:n - - + + mp3 - -mp3 - -id3v2 - -id3v1 - -id3v11 - -apev2 - -mp3_frame + +mp3 + +id3v2 + +id3v1 + +id3v11 + +apev2 + +mp3_frame - + probe->mp3:n - - + + - + probe->mp4:n - - + + - + probe->jp2c:n - - + + - + probe->png:n - - + + ogg - -ogg - -ogg_page - -vorbis_packet - -opus_packet - -flac_metadatablock - -flac_frame + +ogg + +ogg_page + +vorbis_packet + +opus_packet + +flac_metadatablock + +flac_frame - + probe->ogg:n - - + + pcap - -pcap - -link_frame - -tcp_stream - -ipv4_packet + +pcap + +link_frame + +tcp_stream + +ipv4_packet - + probe->pcap:n - - + + pcapng - -pcapng - -link_frame - -tcp_stream - -ipv4_packet + +pcapng + +link_frame + +tcp_stream + +ipv4_packet - + probe->pcapng:n - - + + tar - -tar - -probe + +tar + +probe - + probe->tar:n - - + + - + probe->tiff:n - - + + tzx - -tzx - -tap + +tzx + +tap - + probe->tzx:n - - + + wav - -wav - -id3v2 - -id3v1 - -id3v11 + +wav + +id3v2 + +id3v1 + +id3v11 - + probe->wav:n - - + + - + probe->webp:n - - + + xml - -xml + +xml - + probe->xml:n - - + + zip - -zip - -probe + +zip + +probe - + probe->zip:n - - + + aiff - -aiff + +aiff - + probe->aiff:n - - + + apple_bookmark - -apple_bookmark + +apple_bookmark - + probe->apple_bookmark:n - - + + avro_ocf - -avro_ocf + +avro_ocf - + probe->avro_ocf:n - - + + bplist - -bplist + +bplist - + probe->bplist:n - - + + elf - -elf + +elf - + probe->elf:n - - + + fit - -fit + +fit - + probe->fit:n - - + + - + probe->gif:n - - + + html - -html + +html - + probe->html:n - - + + json - -json + +json - + probe->json:n - - + + jsonl - -jsonl + +jsonl - + probe->jsonl:n - - + + leveldb_table - -leveldb_table + +leveldb_table - + probe->leveldb_table:n - - + + luajit - -luajit + +luajit - + probe->luajit:n - - + + midi - -midi + +midi - + probe->midi:n - - + + moc3 - -moc3 + +moc3 - + probe->moc3:n - - + + mpeg_ts - -mpeg_ts + +mpeg_ts - + probe->mpeg_ts:n - - + + nes - -nes + +nes - + probe->nes:n - - + + opentimestamps - -opentimestamps + +opentimestamps - + probe->opentimestamps:n - - + + toml - -toml + +toml - + probe->toml:n - - + + tzif - -tzif + +tzif - + probe->tzif:n - - + + wasm - -wasm + +wasm - + probe->wasm:n - - + + yaml - -yaml + +yaml - + probe->yaml:n - - + + + + + +av1_ccr + +av1_ccr + +av1_obu + + + +av1_obu + +av1_obu + + + +av1_ccr:e->av1_obu:n + + - + av1_frame av1_frame av1_obu - - -av1_obu - -av1_obu - - + av1_frame:e->av1_obu:n - - + + - + avc_annexb avc_annexb @@ -878,61 +892,61 @@ avc_nalu - + avc_nalu - -avc_nalu - -avc_sps - -avc_pps - -avc_sei + +avc_nalu + +avc_sps + +avc_pps + +avc_sei - + avc_annexb:e->avc_nalu:n - - + + - + avc_sps avc_sps - + avc_nalu:e->avc_sps:n - - + + - + avc_pps avc_pps - + avc_nalu:e->avc_pps:n - - + + - + avc_sei avc_sei - + avc_nalu:e->avc_sei:n - - + + - + avc_au avc_au @@ -940,13 +954,13 @@ avc_nalu - + avc_au:e->avc_nalu:n - - + + - + avc_dcr avc_dcr @@ -954,19 +968,19 @@ avc_nalu - + avc_dcr:e->avc_nalu:n - - + + - + avi:e->avc_au:n - - + + - + hevc_au hevc_au @@ -974,13 +988,13 @@ hevc_nalu - + avi:e->hevc_au:n - - + + - + mp3_frame mp3_frame @@ -988,25 +1002,25 @@ mp3_frame_tags - + avi:e->mp3_frame:n - - + + - + flac_frame flac_frame - + avi:e->flac_frame:n - - + + - + hevc_nalu hevc_nalu @@ -1018,7 +1032,7 @@ hevc_sps - + hevc_au:e->hevc_nalu:n @@ -1030,133 +1044,133 @@ mp3_frame_tags - + mp3_frame:e->mp3_frame_tags:n - + bitcoin_block - -bitcoin_block - -bitcoin_transaction + +bitcoin_block + +bitcoin_transaction - + bitcoin_blkdat:e->bitcoin_block:n - - + + - + bitcoin_transaction - -bitcoin_transaction - -bitcoin_script + +bitcoin_transaction + +bitcoin_script - + bitcoin_block:e->bitcoin_transaction:n - - + + - + bitcoin_script - -bitcoin_script + +bitcoin_script - + bitcoin_transaction:e->bitcoin_script:n - - + + - + bsd_loopback_frame - -bsd_loopback_frame - -inet_packet + +bsd_loopback_frame + +inet_packet - + inet_packet - -inet_packet + +inet_packet - + bsd_loopback_frame:e->inet_packet:n - - + + - + ipv4_packet - -ipv4_packet - -ip_packet + +ipv4_packet + +ip_packet - + inet_packet->ipv4_packet:n - - + + - + ipv6_packet - -ipv6_packet - -ip_packet + +ipv6_packet + +ip_packet - + inet_packet->ipv6_packet:n - - + + - + bzip2:e->probe:n - - + + - + caff:e->probe:n - - + + - + ether8023_frame - -ether8023_frame - -inet_packet + +ether8023_frame + +inet_packet - + ether8023_frame:e->inet_packet:n - - + + - + flac:e->flac_frame:n - - + + - + flac_metadatablocks flac_metadatablocks @@ -1164,89 +1178,89 @@ flac_metadatablock - + flac:e->flac_metadatablocks:n - - + + - + flac_metadatablock - -flac_metadatablock - -flac_streaminfo - -flac_picture - -vorbis_comment + +flac_metadatablock + +flac_streaminfo + +flac_picture + +vorbis_comment - + flac_metadatablocks:e->flac_metadatablock:n - - + + - + flac_streaminfo - -flac_streaminfo + +flac_streaminfo - + flac_metadatablock:e->flac_streaminfo:n - - + + - + flac_picture - -flac_picture - -image + +flac_picture + +image - + flac_metadatablock:e->flac_picture:n - - + + - + vorbis_comment - -vorbis_comment - -flac_picture + +vorbis_comment + +flac_picture - + flac_metadatablock:e->vorbis_comment:n - - + + - + flac_picture:e->image:n - - + + - + vorbis_comment:e->flac_picture:n - - + + - + gzip:e->probe:n - - + + - + hevc_annexb hevc_annexb @@ -1254,49 +1268,49 @@ hevc_nalu - + hevc_annexb:e->hevc_nalu:n - + hevc_vps hevc_vps - + hevc_nalu:e->hevc_vps:n - + hevc_pps hevc_pps - + hevc_nalu:e->hevc_pps:n - + hevc_sps hevc_sps - + hevc_nalu:e->hevc_sps:n - + hevc_dcr hevc_dcr @@ -1304,282 +1318,276 @@ hevc_nalu - + hevc_dcr:e->hevc_nalu:n - + id3v2 - -id3v2 - -image + +id3v2 + +image - + id3v2:e->image:n - - + + - + ip_packet - -ip_packet + +ip_packet - + ipv4_packet:e->ip_packet:n - - + + udp_datagram - -udp_datagram - -udp_payload + +udp_datagram + +udp_payload - + ip_packet->udp_datagram:n - - + + icmp - -icmp + +icmp - + ip_packet->icmp:n - - + + icmpv6 - -icmpv6 + +icmpv6 - + ip_packet->icmpv6:n - - + + tcp_segment - -tcp_segment + +tcp_segment - + ip_packet->tcp_segment:n - - + + - + ipv6_packet:e->ip_packet:n - - + + - + exif - -exif + +exif - + jpeg:e->exif:n - - + + - + icc_profile - -icc_profile + +icc_profile - + jpeg:e->icc_profile:n - - + + - + macho_fat:e->macho:n - - + + - + matroska:e->aac_frame:n - - + + - -matroska:e->image:n - - - - - -matroska:e->av1_frame:n - - - - - -matroska:e->avc_au:n - - - - - -matroska:e->avc_dcr:n - - - - - -matroska:e->hevc_au:n - - - - -matroska:e->mp3_frame:n - - - - - -matroska:e->flac_frame:n - - - - - -matroska:e->flac_metadatablocks:n - - - - - -matroska:e->hevc_dcr:n - - - - - -av1_ccr - -av1_ccr +matroska:e->image:n + + - + matroska:e->av1_ccr:n - - + + + + + +matroska:e->av1_frame:n + + + + + +matroska:e->avc_au:n + + + + + +matroska:e->avc_dcr:n + + + + + +matroska:e->hevc_au:n + + + + + +matroska:e->mp3_frame:n + + + + + +matroska:e->flac_frame:n + + + + + +matroska:e->flac_metadatablocks:n + + + + + +matroska:e->hevc_dcr:n + + mpeg_asc - -mpeg_asc + +mpeg_asc - + matroska:e->mpeg_asc:n - - + + mpeg_pes_packet - -mpeg_pes_packet + +mpeg_pes_packet - + matroska:e->mpeg_pes_packet:n - - + + mpeg_spu - -mpeg_spu + +mpeg_spu - + matroska:e->mpeg_spu:n - - + + opus_packet - -opus_packet - -vorbis_comment + +opus_packet + +vorbis_comment - + matroska:e->opus_packet:n - - + + vorbis_packet - -vorbis_packet - -vorbis_comment + +vorbis_packet + +vorbis_comment - + matroska:e->vorbis_packet:n - - + + vp8_frame - -vp8_frame + +vp8_frame - + matroska:e->vp8_frame:n - - + + vp9_cfm - -vp9_cfm + +vp9_cfm - + matroska:e->vp9_cfm:n - - + + @@ -1588,64 +1596,64 @@ vp9_frame - + matroska:e->vp9_frame:n - - + + - + opus_packet:e->vorbis_comment:n - - + + - + vorbis_packet:e->vorbis_comment:n - - + + - + mp3:e->apev2:n - - + + - + mp3:e->mp3_frame:n - - + + - + mp3:e->id3v2:n - - + + id3v1 - -id3v1 + +id3v1 - + mp3:e->id3v1:n - - + + id3v11 - -id3v11 + +id3v11 - + mp3:e->id3v11:n - - + + @@ -1654,7 +1662,7 @@ mp3_frame_vbri - + mp3_frame_tags->mp3_frame_vbri:n @@ -1666,660 +1674,660 @@ mp3_frame_xing - + mp3_frame_tags->mp3_frame_xing:n - + mp4:e->aac_frame:n - + - + mp4:e->image:n - - + + + + + +mp4:e->av1_ccr:n + + - + mp4:e->av1_frame:n - + - + mp4:e->avc_au:n - + - + mp4:e->avc_dcr:n - + - + mp4:e->hevc_au:n - + - + mp4:e->mp3_frame:n - + - + mp4:e->flac_frame:n - + - + mp4:e->flac_metadatablocks:n - + - + mp4:e->hevc_dcr:n - + - + mp4:e->id3v2:n - - + + - + mp4:e->jpeg:n - - + + - + mp4:e->icc_profile:n - - - - - -mp4:e->av1_ccr:n - - + + - + mp4:e->mpeg_pes_packet:n - - + + - + mp4:e->opus_packet:n - - + + - + mp4:e->vorbis_packet:n - - + + - + mp4:e->vp9_frame:n - + - + mp4:e->jp2c:n - - + + mpeg_es - -mpeg_es - -mpeg_asc - -vorbis_packet + +mpeg_es + +mpeg_asc + +vorbis_packet - + mp4:e->mpeg_es:n - - + + - + mp4:e->png:n - - + + prores_frame - -prores_frame + +prores_frame - + mp4:e->prores_frame:n - - + + protobuf_widevine - -protobuf_widevine - -protobuf + +protobuf_widevine + +protobuf - + mp4:e->protobuf_widevine:n - - + + pssh_playready - -pssh_playready + +pssh_playready - + mp4:e->pssh_playready:n - - + + vpx_ccr - -vpx_ccr + +vpx_ccr - + mp4:e->vpx_ccr:n - - + + - + mpeg_es:e->mpeg_asc:n - - + + - + mpeg_es:e->vorbis_packet:n - - + + - + png:e->exif:n - - + + - + png:e->icc_profile:n - - + + protobuf - -protobuf + +protobuf - + protobuf_widevine:e->protobuf:n - - + + mpeg_pes - -mpeg_pes - -mpeg_pes_packet - -mpeg_spu + +mpeg_pes + +mpeg_pes_packet + +mpeg_spu - + mpeg_pes:e->mpeg_pes_packet:n - - + + - + mpeg_pes:e->mpeg_spu:n - - + + - + ogg:e->flac_frame:n - - + + - + ogg:e->flac_metadatablock:n - - + + - + ogg:e->opus_packet:n - - + + - + ogg:e->vorbis_packet:n - - + + ogg_page - -ogg_page + +ogg_page - + ogg:e->ogg_page:n - - + + - + pcap:e->ipv4_packet:n - - + + link_frame - -link_frame + +link_frame - + pcap:e->link_frame:n - - + + tcp_stream - -tcp_stream + +tcp_stream - + pcap:e->tcp_stream:n - - + + - + link_frame->bsd_loopback_frame:n - - + + - + link_frame->ether8023_frame:n - - + + - + link_frame->ipv4_packet:n - - + + - + link_frame->ipv6_packet:n - - + + sll2_packet - -sll2_packet - -inet_packet + +sll2_packet + +inet_packet - + link_frame->sll2_packet:n - - + + sll_packet - -sll_packet - -inet_packet + +sll_packet + +inet_packet - + link_frame->sll_packet:n - - + + rtmp - -rtmp - -amf0 - -mpeg_asc + +rtmp + +amf0 + +mpeg_asc - + tcp_stream->rtmp:n - - + + tls - -tls - -asn1_ber + +tls + +asn1_ber - + tcp_stream->tls:n - - + + dns_tcp - -dns_tcp + +dns_tcp - + tcp_stream->dns_tcp:n - - + + - + pcapng:e->ipv4_packet:n - - + + - + pcapng:e->link_frame:n - - + + - + pcapng:e->tcp_stream:n - - + + - + rtmp:e->mpeg_asc:n - - + + amf0 - -amf0 + +amf0 - + rtmp:e->amf0:n - - + + - + sll2_packet:e->inet_packet:n - - + + - + sll_packet:e->inet_packet:n - - + + - + tar:e->probe:n - - + + - + tiff:e->icc_profile:n - - + + asn1_ber - -asn1_ber + +asn1_ber - + tls:e->asn1_ber:n - - + + tap - -tap + +tap - + tzx:e->tap:n - - + + udp_payload - -udp_payload + +udp_payload - + udp_datagram:e->udp_payload:n - - + + dns - -dns + +dns - + udp_payload->dns:n - - + + - + wav:e->id3v2:n - - + + - + wav:e->id3v1:n - - + + - + wav:e->id3v11:n - - + + - + webp:e->exif:n - - + + - + webp:e->icc_profile:n - - + + - + webp:e->vp8_frame:n - - + + - + webp:e->xml:n - - + + - + zip:e->probe:n - - + + bencode - -bencode + +bencode bits - -bits + +bits bson - -bson + +bson bytes - -bytes + +bytes cbor - -cbor + +cbor csv - -csv + +csv fairplay_spc - -fairplay_spc + +fairplay_spc leveldb_descriptor - -leveldb_descriptor + +leveldb_descriptor leveldb_log - -leveldb_log + +leveldb_log markdown - -markdown + +markdown msgpack - -msgpack + +msgpack negentropy - -negentropy + +negentropy pg_btree - -pg_btree + +pg_btree pg_control - -pg_control + +pg_control pg_heap - -pg_heap + +pg_heap diff --git a/format/av1/av1_ccr.go b/format/av1/av1_ccr.go index dba536da..5c57553f 100644 --- a/format/av1/av1_ccr.go +++ b/format/av1/av1_ccr.go @@ -11,12 +11,17 @@ import ( "github.com/wader/fq/pkg/scalar" ) +var av1CCRav1OBUGroup decode.Group + func init() { interp.RegisterFormat( format.AV1_CCR, &decode.Format{ Description: "AV1 Codec Configuration Record", DecodeFn: ccrDecode, + Dependencies: []decode.Dependency{ + {Groups: []*decode.Group{format.AV1_OBU}, Out: &av1CCRav1OBUGroup}, + }, }) } @@ -39,9 +44,11 @@ func ccrDecode(d *decode.D) any { } else { d.FieldU4("reserved") } - if d.BitsLeft() > 0 { - d.FieldRawLen("config_obus", d.BitsLeft()) - } + d.FieldArray("config_obus", func(d *decode.D) { + for d.BitsLeft() > 0 { + d.FieldFormat("config_obu", &av1CCRav1OBUGroup, nil) + } + }) return nil } diff --git a/format/av1/av1_obu.go b/format/av1/av1_obu.go index 4e189afa..1a2ed553 100644 --- a/format/av1/av1_obu.go +++ b/format/av1/av1_obu.go @@ -29,17 +29,145 @@ const ( ) var obuTypeNames = scalar.UintMapSymStr{ - OBU_SEQUENCE_HEADER: "OBU_SEQUENCE_HEADER", - OBU_TEMPORAL_DELIMITER: "OBU_TEMPORAL_DELIMITER", - OBU_FRAME_HEADER: "OBU_FRAME_HEADER", - OBU_TILE_GROUP: "OBU_TILE_GROUP", - OBU_METADATA: "OBU_METADATA", - OBU_FRAME: "OBU_FRAME", - OBU_REDUNDANT_FRAME_HEADER: "OBU_REDUNDANT_FRAME_HEADER", - OBU_TILE_LIST: "OBU_TILE_LIST", - OBU_PADDING: "OBU_PADDING", + OBU_SEQUENCE_HEADER: "sequence_header", + OBU_TEMPORAL_DELIMITER: "temporal_delimiter", + OBU_FRAME_HEADER: "frame_header", + OBU_TILE_GROUP: "tile_group", + OBU_METADATA: "metadata", + OBU_FRAME: "frame", + OBU_REDUNDANT_FRAME_HEADER: "redundant_frame_header", + OBU_TILE_LIST: "tile_list", + OBU_PADDING: "padding", } +const ( + CP_BT_709 = 1 // BT.709 + CP_UNSPECIFIED = 2 // Unspecified + CP_BT_470_M = 4 // BT.470 System M (historical) + CP_BT_470_B_G = 5 // BT.470 System B, G (historical) + CP_BT_601 = 6 // BT.601 + CP_SMPTE_240 = 7 // SMPTE 240 + CP_GENERIC_FILM = 8 // Generic film (color filters using illuminant C) + CP_BT_2020 = 9 // BT.2020, BT.2100 + CP_XYZ = 10 // SMPTE 428 (CIE 1921 XYZ) + CP_SMPTE_431 = 11 // SMPTE RP 431-2 + CP_SMPTE_432 = 12 // SMPTE EG 432-,1 + CP_EBU_3213 = 22 // EBU Tech. 3213-E +) + +var cpTypeNames = scalar.UintMapSymStr{ + CP_BT_709: "bt_709", + CP_UNSPECIFIED: "unspecified", + CP_BT_470_M: "bt_470_m", + CP_BT_470_B_G: "bt_470_b_g", + CP_BT_601: "bt_601", + CP_SMPTE_240: "smpte_240", + CP_GENERIC_FILM: "generic_film", + CP_BT_2020: "bt_2020", + CP_XYZ: "xyz", + CP_SMPTE_431: "smpte_431", + CP_SMPTE_432: "smpte_432", + CP_EBU_3213: "ebu_3213", +} + +const ( + TC_RESERVED_0 = 0 // For future use + TC_BT_709 = 1 // BT.709 + TC_UNSPECIFIED = 2 // Unspecified + TC_RESERVED_3 = 3 // For future use + TC_BT_470_M = 4 // BT.470 System M (historical) + TC_BT_470_B_G = 5 // BT.470 System B, G (historical) + TC_BT_601 = 6 // BT.601 + TC_SMPTE_240 = 7 // SMPTE 240 M + TC_LINEAR = 8 // Linear + TC_LOG_100 = 9 // Logarithmic (100 : 1 range) + TC_LOG_100_SQRT10 = 10 // Logarithmic (100 * Sqrt(10) : 1 range) + TC_IEC_61966 = 11 // IEC 61966-2-4 + TC_BT_1361 = 12 // BT.1361 + TC_SRGB = 13 // sRGB or sYCC + TC_BT_2020_10_BIT = 14 // BT.2020 10-bit systems + TC_BT_2020_12_BIT = 15 // BT.2020 12-bit systems + TC_SMPTE_2084 = 16 // SMPTE ST 2084, ITU BT.2100 PQ + TC_SMPTE_428 = 17 // SMPTE ST 428 + TC_HLG = 18 // BT.2100 HLG, ARIB STD-B67 +) + +var tcTypeNames = scalar.UintMapSymStr{ + TC_RESERVED_0: "reserved_0", + TC_BT_709: "bt_709", + TC_UNSPECIFIED: "unspecified", + TC_RESERVED_3: "reserved_3", + TC_BT_470_M: "bt_470_m", + TC_BT_470_B_G: "bt_470_b_g", + TC_BT_601: "bt_601", + TC_SMPTE_240: "smpte_240", + TC_LINEAR: "linear", + TC_LOG_100: "log_100", + TC_LOG_100_SQRT10: "log_100_sqrt10", + TC_IEC_61966: "iec_61966", + TC_BT_1361: "bt_1361", + TC_SRGB: "srgb", + TC_BT_2020_10_BIT: "bt_2020_10_bit", + TC_BT_2020_12_BIT: "bt_2020_12_bit", + TC_SMPTE_2084: "smpte_2084", + TC_SMPTE_428: "smpte_428", + TC_HLG: "hlg", +} + +const ( + MC_IDENTITY = 0 // Identity matrix + MC_BT_709 = 1 // BT.709 + MC_UNSPECIFIED = 2 // Unspecified + MC_RESERVED_3 = 3 // For future use + MC_FCC = 4 // US FCC 73.628 + MC_BT_470_B_G = 5 // BT.470 System B, G (historical) + MC_BT_601 = 6 // BT.601 + MC_SMPTE_240 = 7 // SMPTE 240 M + MC_SMPTE_YCGCO = 8 // YCgCo + MC_BT_2020_NCL = 9 // BT.2020 non-constant luminance, BT.2100 YCbCr + MC_BT_2020_CL = 10 // BT.2020 constant luminance + MC_SMPTE_2085 = 11 // SMPTE ST 2085 YDzDx + MC_CHROMAT_NCL = 12 // Chromaticity-derived non-constant luminance + MC_CHROMAT_CL = 13 // Chromaticity-derived constant luminance + MC_ICTCP = 14 // BT.2100 ICtCp +) + +var mcTypeNames = scalar.UintMapSymStr{ + MC_IDENTITY: "identity", + MC_BT_709: "bt_709", + MC_UNSPECIFIED: "unspecified", + MC_RESERVED_3: "reserved_3", + MC_FCC: "fcc", + MC_BT_470_B_G: "bt_470_b_g", + MC_BT_601: "bt_601", + MC_SMPTE_240: "smpte_240", + MC_SMPTE_YCGCO: "smpte_ycgco", + MC_BT_2020_NCL: "bt_2020_ncl", + MC_BT_2020_CL: "bt_2020_cl", + MC_SMPTE_2085: "smpte_2085", + MC_CHROMAT_NCL: "chromat_ncl", + MC_CHROMAT_CL: "chromat_cl", + MC_ICTCP: "ictcp", +} + +const ( + SEQ_PROFILE_MAIN = 0 + SEQ_PROFILE_HIGH = 1 + SEQ_PROFILE_PROFESSIONAL = 2 +) + +var seqProfileNames = scalar.UintMapSymStr{ + SEQ_PROFILE_MAIN: "main", + SEQ_PROFILE_HIGH: "high", + SEQ_PROFILE_PROFESSIONAL: "professional", +} + +// from https://aomediacodec.github.io/av1-spec/#symbols-and-abbreviated-terms +const SELECT_SCREEN_CONTENT_TOOLS = 2 + +// TODO: ignore empty branch lint warnings +// +//nolint:staticcheck func obuDecode(d *decode.D) any { var obuType uint64 var obuSize int64 @@ -68,11 +196,170 @@ func obuDecode(d *decode.D) any { } } - _ = obuType + d.FramedFn(obuSize*8, func(d *decode.D) { + // TODO: this only handles the OBU_SEQUENCE_HEADER case for now + // fro spec https://aomediacodec.github.io/av1-spec/#general-obu-syntax + // if ( obu_type != OBU_SEQUENCE_HEADER && + // obu_type != OBU_TEMPORAL_DELIMITER && + // OperatingPointIdc != 0 && + // obu_extension_flag == 1 ) - if d.BitsLeft() > 0 { - d.FieldRawLen("data", obuSize*8) - } + switch obuType { + case OBU_SEQUENCE_HEADER: + seqProfile := d.FieldU3("seq_profile", seqProfileNames) + d.FieldU1("still_picture") + reducedStillPictureHeader := d.FieldU1("reduced_still_picture_header") + if reducedStillPictureHeader == 1 { + d.FieldU5("seq_level_idx0") // TODO: array as below? + } else { + timingInfoPresentFlag := d.FieldU1("timing_info_present_flag") + if timingInfoPresentFlag == 1 { + // TODO: + return + } + initialDisplayDelayPresentFlag := d.FieldU1("initial_display_delay_present_flag") + operatingPointsCntMinus1 := d.FieldU5("operating_points_cnt_minus_1") + + d.FieldArray("operating_points", func(d *decode.D) { + + for i := uint64(0); i <= operatingPointsCntMinus1; i++ { + + d.FieldStruct("operating_point", func(d *decode.D) { + d.FieldU12("operating_point_idc") + seqLevelIdx := d.FieldU5("seq_level_idx") + + if seqLevelIdx > 7 { + d.FieldU1("seq_tier") + } else { + // nop + } + + }) + + if initialDisplayDelayPresentFlag == 1 { + initialDisplayDelayPresentForThisOp := d.FieldU1("seq_tier") + if initialDisplayDelayPresentForThisOp == 1 { + d.FieldU4("initial_display_delay_minus_1") + } + } + } + + }) + + } + + frameWidthBitsMinus1 := d.FieldU4("frame_width_bits_minus_1") + frameHeightBitsMinus1 := d.FieldU4("frame_height_bits_minus_1") + d.FieldU("max_frame_width_minus_1", int(frameWidthBitsMinus1)+1) + d.FieldU("max_frame_height_minus_1", int(frameHeightBitsMinus1)+1) + + var frameIdNumbersPresentFlag uint64 = 0 + if reducedStillPictureHeader == 1 { + // nop + } else { + frameIdNumbersPresentFlag = d.FieldU1("frame_id_numbers_present_flag") + } + if frameIdNumbersPresentFlag == 1 { + d.FieldU4("delta_frame_id_length_minus_2") + d.FieldU3("additional_frame_id_length_minus_1") + } + d.FieldU1("use_128x128_superblock") + d.FieldU1("enable_filter_intra") + d.FieldU1("enable_intra_edge_filter") + if reducedStillPictureHeader == 1 { + //nop + } else { + d.FieldU1("enable_interintra_compound") + d.FieldU1("enable_masked_compound") + d.FieldU1("enable_warped_motion") + d.FieldU1("enable_dual_filter") + enableOrderHint := d.FieldU1("enable_order_hint") + if enableOrderHint == 1 { + d.FieldU1("enable_jnt_comp") + d.FieldU1("enable_ref_frame_mvs") + } + seqChooseScreenContentTools := d.FieldU1("seq_choose_screen_content_tools") + var seqForceScreenContentTools uint64 = SELECT_SCREEN_CONTENT_TOOLS + if seqChooseScreenContentTools == 1 { + // nop + } else { + seqForceScreenContentTools = d.FieldU1("seq_force_screen_content_tools") + } + if seqForceScreenContentTools > 0 { + seqChooseIntegerMv := d.FieldU1("seq_choose_integer_mv") + if seqChooseIntegerMv == 1 { + // nop + } else { + d.FieldU1("seq_force_integer_mv") + } + } + if enableOrderHint == 1 { + d.FieldU3("order_hint_bits_minus_1") + } + } + d.FieldU1("enable_superres") + d.FieldU1("enable_cdef") + d.FieldU1("enable_restoration") + d.FieldStruct("color_config", func(d *decode.D) { + highBitdepth := d.FieldU1("high_bitdepth") + var twelveBit uint64 + if seqProfile == 2 && highBitdepth == 1 { + twelveBit = d.FieldU1("twelve_bit") + } + var monoChrome uint64 = 0 + if seqProfile == 1 { + // nop + } else { + d.FieldU1("mono_chrome") + } + colorDescriptionPresentFlag := d.FieldU1("color_description_present_flag") + + var colorPrimaries uint64 = 0 + var transferCharacteristics uint64 = 0 + var matrixCoefficients uint64 = 0 + + if colorDescriptionPresentFlag == 1 { + colorPrimaries = d.FieldU8("color_primaries", cpTypeNames) + transferCharacteristics = d.FieldU8("transfer_characteristics", tcTypeNames) + matrixCoefficients = d.FieldU8("matrix_coefficients", mcTypeNames) + } + if monoChrome == 1 { + d.FieldU1("color_range") + } else if colorPrimaries == CP_BT_709 && + transferCharacteristics == TC_SRGB && + matrixCoefficients == MC_IDENTITY { + // nop + } else { + d.FieldU1("color_range") + var subsamplingX uint64 = 0 + var subsamplingY uint64 = 0 + if seqProfile == 0 { + subsamplingX = 1 + subsamplingY = 1 + } else if seqProfile == 1 { + // nop + } else { + if twelveBit == 1 { + subsamplingX = d.FieldU1("subsampling_x") + if subsamplingX == 1 { + subsamplingY = d.FieldU1("subsampling_y") + } + } else { + subsamplingX = 1 + } + } + if subsamplingX == 1 && subsamplingY == 1 { + d.FieldU2("chroma_sample_position") + } + } + d.FieldU1("separate_uv_delta_q") + }) + d.FieldU1("film_grain_params_present") + default: + } + + d.FieldRawLen("data", d.BitsLeft()) + }) return nil } diff --git a/format/av1/testdata/av1_obu_seq_header_film_grain_chrome_sample_pos b/format/av1/testdata/av1_obu_seq_header_film_grain_chrome_sample_pos new file mode 100644 index 0000000000000000000000000000000000000000..82441f94faeee77e60f0ca868332315111718a49 GIT binary patch literal 16 Xcmd<$V_;x#TD|{p;p%4&4i3%$CGQ1| literal 0 HcmV?d00001 diff --git a/format/av1/testdata/av1_obu_seq_header_film_grain_chrome_sample_pos.fqtest b/format/av1/testdata/av1_obu_seq_header_film_grain_chrome_sample_pos.fqtest new file mode 100644 index 00000000..72953bfb --- /dev/null +++ b/format/av1/testdata/av1_obu_seq_header_film_grain_chrome_sample_pos.fqtest @@ -0,0 +1,53 @@ +$ fq -d av1_obu dv av1_obu_seq_header_film_grain_chrome_sample_pos + |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: av1_obu_seq_header_film_grain_chrome_sample_pos (av1_obu) 0x0-0x10 (16) + | | | header{}: 0x0-0x1 (1) +0x00|0a |. | forbidden_bit: 0 0x0-0x0.1 (0.1) +0x00|0a |. | type: "sequence_header" (1) 0x0.1-0x0.5 (0.4) +0x00|0a |. | extension_flag: false 0x0.5-0x0.6 (0.1) +0x00|0a |. | has_size_field: true 0x0.6-0x0.7 (0.1) +0x00|0a |. | reserved_1bit: 0 0x0.7-0x1 (0.1) +0x00| 0e | . | size: 14 0x1-0x2 (1) +0x00| 00 | . | seq_profile: "main" (0) 0x2-0x2.3 (0.3) +0x00| 00 | . | still_picture: 0 0x2.3-0x2.4 (0.1) +0x00| 00 | . | reduced_still_picture_header: 0 0x2.4-0x2.5 (0.1) +0x00| 00 | . | timing_info_present_flag: 0 0x2.5-0x2.6 (0.1) +0x00| 00 | . | initial_display_delay_present_flag: 0 0x2.6-0x2.7 (0.1) +0x00| 00 00 | .. | operating_points_cnt_minus_1: 0 0x2.7-0x3.4 (0.5) + | | | operating_points[0:1]: 0x3.4-0x5.6 (2.2) + | | | [0]{}: operating_point 0x3.4-0x5.6 (2.2) +0x00| 00 00 | .. | operating_point_idc: 0 0x3.4-0x5 (1.4) +0x00| 42 | B | seq_level_idx: 8 0x5-0x5.5 (0.5) +0x00| 42 | B | seq_tier: 0 0x5.5-0x5.6 (0.1) +0x00| 42 ab | B. | frame_width_bits_minus_1: 10 0x5.6-0x6.2 (0.4) +0x00| ab | . | frame_height_bits_minus_1: 10 0x6.2-0x6.6 (0.4) +0x00| ab bf c3 | ... | max_frame_width_minus_1: 1919 0x6.6-0x8.1 (1.3) +0x00| c3 71 | .q | max_frame_height_minus_1: 1079 0x8.1-0x9.4 (1.3) +0x00| 71 | q | frame_id_numbers_present_flag: 0 0x9.4-0x9.5 (0.1) +0x00| 71 | q | use_128x128_superblock: 0 0x9.5-0x9.6 (0.1) +0x00| 71 | q | enable_filter_intra: 0 0x9.6-0x9.7 (0.1) +0x00| 71 | q | enable_intra_edge_filter: 1 0x9.7-0xa (0.1) +0x00| ab | . | enable_interintra_compound: 1 0xa-0xa.1 (0.1) +0x00| ab | . | enable_masked_compound: 0 0xa.1-0xa.2 (0.1) +0x00| ab | . | enable_warped_motion: 1 0xa.2-0xa.3 (0.1) +0x00| ab | . | enable_dual_filter: 0 0xa.3-0xa.4 (0.1) +0x00| ab | . | enable_order_hint: 1 0xa.4-0xa.5 (0.1) +0x00| ab | . | enable_jnt_comp: 0 0xa.5-0xa.6 (0.1) +0x00| ab | . | enable_ref_frame_mvs: 1 0xa.6-0xa.7 (0.1) +0x00| ab | . | seq_choose_screen_content_tools: 1 0xa.7-0xb (0.1) +0x00| e6 | . | seq_choose_integer_mv: 1 0xb-0xb.1 (0.1) +0x00| e6 | . | order_hint_bits_minus_1: 6 0xb.1-0xb.4 (0.3) +0x00| e6 | . | enable_superres: 0 0xb.4-0xb.5 (0.1) +0x00| e6 | . | enable_cdef: 1 0xb.5-0xb.6 (0.1) +0x00| e6 | . | enable_restoration: 1 0xb.6-0xb.7 (0.1) + | | | color_config{}: 0xb.7-0xf.6 (3.7) +0x00| e6 | . | high_bitdepth: 0 0xb.7-0xc (0.1) +0x00| 40 | @ | mono_chrome: 0 0xc-0xc.1 (0.1) +0x00| 40 | @ | color_description_present_flag: 1 0xc.1-0xc.2 (0.1) +0x00| 40 40 | @@ | color_primaries: "bt_709" (1) 0xc.2-0xd.2 (1) +0x00| 40 40 | @@ | transfer_characteristics: "bt_709" (1) 0xd.2-0xe.2 (1) +0x00| 40 43| @C| matrix_coefficients: "bt_709" (1) 0xe.2-0xf.2 (1) +0x00| 43| C| color_range: 0 0xf.2-0xf.3 (0.1) +0x00| 43| C| chroma_sample_position: 0 0xf.3-0xf.5 (0.2) +0x00| 43| C| separate_uv_delta_q: 0 0xf.5-0xf.6 (0.1) +0x00| 43| C| film_grain_params_present: 1 0xf.6-0xf.7 (0.1) +0x00| 43| C| data: raw bits 0xf.7-0x10 (0.1) diff --git a/format/matroska/testdata/av1.fqtest b/format/matroska/testdata/av1.fqtest index 93951359..20764f1d 100644 --- a/format/matroska/testdata/av1.fqtest +++ b/format/matroska/testdata/av1.fqtest @@ -253,6 +253,7 @@ $ fq -d matroska dv av1.mkv 0x0170| 00 | . | reserved = 0: 0 0x179-0x179.3 (0.3) 0x0170| 00 | . | initial_presentation_delay_present: false 0x179.3-0x179.4 (0.1) 0x0170| 00 | . | reserved: 0 0x179.4-0x17a (0.4) + | | | config_obus[0:0]: 0x17a-0x17a (0) | | | [4]{}: element 0x17a-0x221 (167) 0x0170| 12 54 c3 67 | .T.g | id: "tags" (0x1254c367) (Element containing metadata describing Tracks) 0x17a-0x17e (4) | | | type: "master" @@ -372,17 +373,57 @@ $ fq -d matroska dv av1.mkv |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| [0]{}: obu (av1_obu) 0x237-0x246 (15) | | | header{}: 0x237-0x238 (1) 0x0230| 0a | . | forbidden_bit: 0 0x237-0x237.1 (0.1) -0x0230| 0a | . | type: "OBU_SEQUENCE_HEADER" (1) 0x237.1-0x237.5 (0.4) +0x0230| 0a | . | type: "sequence_header" (1) 0x237.1-0x237.5 (0.4) 0x0230| 0a | . | extension_flag: false 0x237.5-0x237.6 (0.1) 0x0230| 0a | . | has_size_field: true 0x237.6-0x237.7 (0.1) 0x0230| 0a | . | reserved_1bit: 0 0x237.7-0x238 (0.1) 0x0230| 0d | . | size: 13 0x238-0x239 (1) -0x0230| 20 00 00 fa 1e 7f de| ......| data: raw bits 0x239-0x246 (13) -0x0240|21 0a d0 20 20 25 |!.. % | +0x0230| 20 | | seq_profile: "high" (1) 0x239-0x239.3 (0.3) +0x0230| 20 | | still_picture: 0 0x239.3-0x239.4 (0.1) +0x0230| 20 | | reduced_still_picture_header: 0 0x239.4-0x239.5 (0.1) +0x0230| 20 | | timing_info_present_flag: 0 0x239.5-0x239.6 (0.1) +0x0230| 20 | | initial_display_delay_present_flag: 0 0x239.6-0x239.7 (0.1) +0x0230| 20 00 | . | operating_points_cnt_minus_1: 0 0x239.7-0x23a.4 (0.5) + | | | operating_points[0:1]: 0x23a.4-0x23c.6 (2.2) + | | | [0]{}: operating_point 0x23a.4-0x23c.6 (2.2) +0x0230| 00 00 | .. | operating_point_idc: 0 0x23a.4-0x23c (1.4) +0x0230| fa | . | seq_level_idx: 31 0x23c-0x23c.5 (0.5) +0x0230| fa | . | seq_tier: 0 0x23c.5-0x23c.6 (0.1) +0x0230| fa 1e | .. | frame_width_bits_minus_1: 8 0x23c.6-0x23d.2 (0.4) +0x0230| 1e | . | frame_height_bits_minus_1: 7 0x23d.2-0x23d.6 (0.4) +0x0230| 1e 7f | .. | max_frame_width_minus_1: 319 0x23d.6-0x23e.7 (1.1) +0x0230| 7f de| ..| max_frame_height_minus_1: 239 0x23e.7-0x23f.7 (1) +0x0230| de| .| frame_id_numbers_present_flag: 0 0x23f.7-0x240 (0.1) +0x0240|21 |! | use_128x128_superblock: 0 0x240-0x240.1 (0.1) +0x0240|21 |! | enable_filter_intra: 0 0x240.1-0x240.2 (0.1) +0x0240|21 |! | enable_intra_edge_filter: 1 0x240.2-0x240.3 (0.1) +0x0240|21 |! | enable_interintra_compound: 0 0x240.3-0x240.4 (0.1) +0x0240|21 |! | enable_masked_compound: 0 0x240.4-0x240.5 (0.1) +0x0240|21 |! | enable_warped_motion: 0 0x240.5-0x240.6 (0.1) +0x0240|21 |! | enable_dual_filter: 0 0x240.6-0x240.7 (0.1) +0x0240|21 |! | enable_order_hint: 1 0x240.7-0x241 (0.1) +0x0240| 0a | . | enable_jnt_comp: 0 0x241-0x241.1 (0.1) +0x0240| 0a | . | enable_ref_frame_mvs: 0 0x241.1-0x241.2 (0.1) +0x0240| 0a | . | seq_choose_screen_content_tools: 0 0x241.2-0x241.3 (0.1) +0x0240| 0a | . | seq_force_screen_content_tools: 0 0x241.3-0x241.4 (0.1) +0x0240| 0a | . | order_hint_bits_minus_1: 5 0x241.4-0x241.7 (0.3) +0x0240| 0a | . | enable_superres: 0 0x241.7-0x242 (0.1) +0x0240| d0 | . | enable_cdef: 1 0x242-0x242.1 (0.1) +0x0240| d0 | . | enable_restoration: 1 0x242.1-0x242.2 (0.1) + | | | color_config{}: 0x242.2-0x245.6 (3.4) +0x0240| d0 | . | high_bitdepth: 0 0x242.2-0x242.3 (0.1) +0x0240| d0 | . | color_description_present_flag: 1 0x242.3-0x242.4 (0.1) +0x0240| d0 20 | . | color_primaries: "unspecified" (2) 0x242.4-0x243.4 (1) +0x0240| 20 20 | | transfer_characteristics: "unspecified" (2) 0x243.4-0x244.4 (1) +0x0240| 20 25 | % | matrix_coefficients: "unspecified" (2) 0x244.4-0x245.4 (1) +0x0240| 25 | % | color_range: 0 0x245.4-0x245.5 (0.1) +0x0240| 25 | % | separate_uv_delta_q: 1 0x245.5-0x245.6 (0.1) +0x0240| 25 | % | film_grain_params_present: 0 0x245.6-0x245.7 (0.1) +0x0240| 25 | % | data: raw bits 0x245.7-0x246 (0.1) |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| [1]{}: obu (av1_obu) 0x246-0x258 (18) | | | header{}: 0x246-0x247 (1) 0x0240| 1a | . | forbidden_bit: 0 0x246-0x246.1 (0.1) -0x0240| 1a | . | type: "OBU_FRAME_HEADER" (3) 0x246.1-0x246.5 (0.4) +0x0240| 1a | . | type: "frame_header" (3) 0x246.1-0x246.5 (0.4) 0x0240| 1a | . | extension_flag: false 0x246.5-0x246.6 (0.1) 0x0240| 1a | . | has_size_field: true 0x246.6-0x246.7 (0.1) 0x0240| 1a | . | reserved_1bit: 0 0x246.7-0x247 (0.1) @@ -392,7 +433,7 @@ $ fq -d matroska dv av1.mkv |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| [2]{}: obu (av1_obu) 0x258-0x13cb (4467) | | | header{}: 0x258-0x259 (1) 0x0250| 22 | " | forbidden_bit: 0 0x258-0x258.1 (0.1) -0x0250| 22 | " | type: "OBU_TILE_GROUP" (4) 0x258.1-0x258.5 (0.4) +0x0250| 22 | " | type: "tile_group" (4) 0x258.1-0x258.5 (0.4) 0x0250| 22 | " | extension_flag: false 0x258.5-0x258.6 (0.1) 0x0250| 22 | " | has_size_field: true 0x258.6-0x258.7 (0.1) 0x0250| 22 | " | reserved_1bit: 0 0x258.7-0x259 (0.1) diff --git a/format/mp4/testdata/av1.fqtest b/format/mp4/testdata/av1.fqtest index c3ef4989..084aa339 100644 --- a/format/mp4/testdata/av1.fqtest +++ b/format/mp4/testdata/av1.fqtest @@ -225,8 +225,57 @@ $ fq -d mp4 dv av1.mp4 0x13c0| 00 | . | reserved = 0: 0 0x13ca-0x13ca.3 (0.3) 0x13c0| 00 | . | initial_presentation_delay_present: false 0x13ca.3-0x13ca.4 (0.1) 0x13c0| 00 | . | reserved: 0 0x13ca.4-0x13cb (0.4) -0x13c0| 0a 0d 20 00 00| .. ..| config_obus: raw bits 0x13cb-0x13da (15) -0x13d0|fa 1e 7f de 21 0a d0 20 20 25 |....!.. % | + | | | config_obus[0:1]: 0x13cb-0x13da (15) + |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| [0]{}: config_obu (av1_obu) 0x13cb-0x13da (15) + | | | header{}: 0x13cb-0x13cc (1) +0x13c0| 0a | . | forbidden_bit: 0 0x13cb-0x13cb.1 (0.1) +0x13c0| 0a | . | type: "sequence_header" (1) 0x13cb.1-0x13cb.5 (0.4) +0x13c0| 0a | . | extension_flag: false 0x13cb.5-0x13cb.6 (0.1) +0x13c0| 0a | . | has_size_field: true 0x13cb.6-0x13cb.7 (0.1) +0x13c0| 0a | . | reserved_1bit: 0 0x13cb.7-0x13cc (0.1) +0x13c0| 0d | . | size: 13 0x13cc-0x13cd (1) +0x13c0| 20 | | seq_profile: "high" (1) 0x13cd-0x13cd.3 (0.3) +0x13c0| 20 | | still_picture: 0 0x13cd.3-0x13cd.4 (0.1) +0x13c0| 20 | | reduced_still_picture_header: 0 0x13cd.4-0x13cd.5 (0.1) +0x13c0| 20 | | timing_info_present_flag: 0 0x13cd.5-0x13cd.6 (0.1) +0x13c0| 20 | | initial_display_delay_present_flag: 0 0x13cd.6-0x13cd.7 (0.1) +0x13c0| 20 00 | . | operating_points_cnt_minus_1: 0 0x13cd.7-0x13ce.4 (0.5) + | | | operating_points[0:1]: 0x13ce.4-0x13d0.6 (2.2) + | | | [0]{}: operating_point 0x13ce.4-0x13d0.6 (2.2) +0x13c0| 00 00| ..| operating_point_idc: 0 0x13ce.4-0x13d0 (1.4) +0x13d0|fa |. | seq_level_idx: 31 0x13d0-0x13d0.5 (0.5) +0x13d0|fa |. | seq_tier: 0 0x13d0.5-0x13d0.6 (0.1) +0x13d0|fa 1e |.. | frame_width_bits_minus_1: 8 0x13d0.6-0x13d1.2 (0.4) +0x13d0| 1e | . | frame_height_bits_minus_1: 7 0x13d1.2-0x13d1.6 (0.4) +0x13d0| 1e 7f | .. | max_frame_width_minus_1: 319 0x13d1.6-0x13d2.7 (1.1) +0x13d0| 7f de | .. | max_frame_height_minus_1: 239 0x13d2.7-0x13d3.7 (1) +0x13d0| de | . | frame_id_numbers_present_flag: 0 0x13d3.7-0x13d4 (0.1) +0x13d0| 21 | ! | use_128x128_superblock: 0 0x13d4-0x13d4.1 (0.1) +0x13d0| 21 | ! | enable_filter_intra: 0 0x13d4.1-0x13d4.2 (0.1) +0x13d0| 21 | ! | enable_intra_edge_filter: 1 0x13d4.2-0x13d4.3 (0.1) +0x13d0| 21 | ! | enable_interintra_compound: 0 0x13d4.3-0x13d4.4 (0.1) +0x13d0| 21 | ! | enable_masked_compound: 0 0x13d4.4-0x13d4.5 (0.1) +0x13d0| 21 | ! | enable_warped_motion: 0 0x13d4.5-0x13d4.6 (0.1) +0x13d0| 21 | ! | enable_dual_filter: 0 0x13d4.6-0x13d4.7 (0.1) +0x13d0| 21 | ! | enable_order_hint: 1 0x13d4.7-0x13d5 (0.1) +0x13d0| 0a | . | enable_jnt_comp: 0 0x13d5-0x13d5.1 (0.1) +0x13d0| 0a | . | enable_ref_frame_mvs: 0 0x13d5.1-0x13d5.2 (0.1) +0x13d0| 0a | . | seq_choose_screen_content_tools: 0 0x13d5.2-0x13d5.3 (0.1) +0x13d0| 0a | . | seq_force_screen_content_tools: 0 0x13d5.3-0x13d5.4 (0.1) +0x13d0| 0a | . | order_hint_bits_minus_1: 5 0x13d5.4-0x13d5.7 (0.3) +0x13d0| 0a | . | enable_superres: 0 0x13d5.7-0x13d6 (0.1) +0x13d0| d0 | . | enable_cdef: 1 0x13d6-0x13d6.1 (0.1) +0x13d0| d0 | . | enable_restoration: 1 0x13d6.1-0x13d6.2 (0.1) + | | | color_config{}: 0x13d6.2-0x13d9.6 (3.4) +0x13d0| d0 | . | high_bitdepth: 0 0x13d6.2-0x13d6.3 (0.1) +0x13d0| d0 | . | color_description_present_flag: 1 0x13d6.3-0x13d6.4 (0.1) +0x13d0| d0 20 | . | color_primaries: "unspecified" (2) 0x13d6.4-0x13d7.4 (1) +0x13d0| 20 20 | | transfer_characteristics: "unspecified" (2) 0x13d7.4-0x13d8.4 (1) +0x13d0| 20 25 | % | matrix_coefficients: "unspecified" (2) 0x13d8.4-0x13d9.4 (1) +0x13d0| 25 | % | color_range: 0 0x13d9.4-0x13d9.5 (0.1) +0x13d0| 25 | % | separate_uv_delta_q: 1 0x13d9.5-0x13d9.6 (0.1) +0x13d0| 25 | % | film_grain_params_present: 0 0x13d9.6-0x13d9.7 (0.1) +0x13d0| 25 | % | data: raw bits 0x13d9.7-0x13da (0.1) | | | [1]{}: box 0x13da-0x13e4 (10) 0x13d0| 00 00 00 0a | .... | size: 10 0x13da-0x13de (4) 0x13d0| 66 69| fi| type: "fiel" (Video field order) 0x13de-0x13e2 (4) @@ -318,17 +367,58 @@ $ fq -d mp4 dv av1.mp4 |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| [0]{}: obu (av1_obu) 0x2c-0x3b (15) | | | header{}: 0x2c-0x2d (1) 0x0020| 0a | . | forbidden_bit: 0 0x2c-0x2c.1 (0.1) -0x0020| 0a | . | type: "OBU_SEQUENCE_HEADER" (1) 0x2c.1-0x2c.5 (0.4) +0x0020| 0a | . | type: "sequence_header" (1) 0x2c.1-0x2c.5 (0.4) 0x0020| 0a | . | extension_flag: false 0x2c.5-0x2c.6 (0.1) 0x0020| 0a | . | has_size_field: true 0x2c.6-0x2c.7 (0.1) 0x0020| 0a | . | reserved_1bit: 0 0x2c.7-0x2d (0.1) 0x0020| 0d | . | size: 13 0x2d-0x2e (1) -0x0020| 20 00| .| data: raw bits 0x2e-0x3b (13) -0x0030|00 fa 1e 7f de 21 0a d0 20 20 25 |.....!.. % | +0x0020| 20 | | seq_profile: "high" (1) 0x2e-0x2e.3 (0.3) +0x0020| 20 | | still_picture: 0 0x2e.3-0x2e.4 (0.1) +0x0020| 20 | | reduced_still_picture_header: 0 0x2e.4-0x2e.5 (0.1) +0x0020| 20 | | timing_info_present_flag: 0 0x2e.5-0x2e.6 (0.1) +0x0020| 20 | | initial_display_delay_present_flag: 0 0x2e.6-0x2e.7 (0.1) +0x0020| 20 00| .| operating_points_cnt_minus_1: 0 0x2e.7-0x2f.4 (0.5) + | | | operating_points[0:1]: 0x2f.4-0x31.6 (2.2) + | | | [0]{}: operating_point 0x2f.4-0x31.6 (2.2) +0x0020| 00| .| operating_point_idc: 0 0x2f.4-0x31 (1.4) +0x0030|00 |. | +0x0030| fa | . | seq_level_idx: 31 0x31-0x31.5 (0.5) +0x0030| fa | . | seq_tier: 0 0x31.5-0x31.6 (0.1) +0x0030| fa 1e | .. | frame_width_bits_minus_1: 8 0x31.6-0x32.2 (0.4) +0x0030| 1e | . | frame_height_bits_minus_1: 7 0x32.2-0x32.6 (0.4) +0x0030| 1e 7f | .. | max_frame_width_minus_1: 319 0x32.6-0x33.7 (1.1) +0x0030| 7f de | .. | max_frame_height_minus_1: 239 0x33.7-0x34.7 (1) +0x0030| de | . | frame_id_numbers_present_flag: 0 0x34.7-0x35 (0.1) +0x0030| 21 | ! | use_128x128_superblock: 0 0x35-0x35.1 (0.1) +0x0030| 21 | ! | enable_filter_intra: 0 0x35.1-0x35.2 (0.1) +0x0030| 21 | ! | enable_intra_edge_filter: 1 0x35.2-0x35.3 (0.1) +0x0030| 21 | ! | enable_interintra_compound: 0 0x35.3-0x35.4 (0.1) +0x0030| 21 | ! | enable_masked_compound: 0 0x35.4-0x35.5 (0.1) +0x0030| 21 | ! | enable_warped_motion: 0 0x35.5-0x35.6 (0.1) +0x0030| 21 | ! | enable_dual_filter: 0 0x35.6-0x35.7 (0.1) +0x0030| 21 | ! | enable_order_hint: 1 0x35.7-0x36 (0.1) +0x0030| 0a | . | enable_jnt_comp: 0 0x36-0x36.1 (0.1) +0x0030| 0a | . | enable_ref_frame_mvs: 0 0x36.1-0x36.2 (0.1) +0x0030| 0a | . | seq_choose_screen_content_tools: 0 0x36.2-0x36.3 (0.1) +0x0030| 0a | . | seq_force_screen_content_tools: 0 0x36.3-0x36.4 (0.1) +0x0030| 0a | . | order_hint_bits_minus_1: 5 0x36.4-0x36.7 (0.3) +0x0030| 0a | . | enable_superres: 0 0x36.7-0x37 (0.1) +0x0030| d0 | . | enable_cdef: 1 0x37-0x37.1 (0.1) +0x0030| d0 | . | enable_restoration: 1 0x37.1-0x37.2 (0.1) + | | | color_config{}: 0x37.2-0x3a.6 (3.4) +0x0030| d0 | . | high_bitdepth: 0 0x37.2-0x37.3 (0.1) +0x0030| d0 | . | color_description_present_flag: 1 0x37.3-0x37.4 (0.1) +0x0030| d0 20 | . | color_primaries: "unspecified" (2) 0x37.4-0x38.4 (1) +0x0030| 20 20 | | transfer_characteristics: "unspecified" (2) 0x38.4-0x39.4 (1) +0x0030| 20 25 | % | matrix_coefficients: "unspecified" (2) 0x39.4-0x3a.4 (1) +0x0030| 25 | % | color_range: 0 0x3a.4-0x3a.5 (0.1) +0x0030| 25 | % | separate_uv_delta_q: 1 0x3a.5-0x3a.6 (0.1) +0x0030| 25 | % | film_grain_params_present: 0 0x3a.6-0x3a.7 (0.1) +0x0030| 25 | % | data: raw bits 0x3a.7-0x3b (0.1) |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| [1]{}: obu (av1_obu) 0x3b-0x4d (18) | | | header{}: 0x3b-0x3c (1) 0x0030| 1a | . | forbidden_bit: 0 0x3b-0x3b.1 (0.1) -0x0030| 1a | . | type: "OBU_FRAME_HEADER" (3) 0x3b.1-0x3b.5 (0.4) +0x0030| 1a | . | type: "frame_header" (3) 0x3b.1-0x3b.5 (0.4) 0x0030| 1a | . | extension_flag: false 0x3b.5-0x3b.6 (0.1) 0x0030| 1a | . | has_size_field: true 0x3b.6-0x3b.7 (0.1) 0x0030| 1a | . | reserved_1bit: 0 0x3b.7-0x3c (0.1) @@ -338,7 +428,7 @@ $ fq -d mp4 dv av1.mp4 |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| [2]{}: obu (av1_obu) 0x4d-0x11c0 (4467) | | | header{}: 0x4d-0x4e (1) 0x0040| 22 | " | forbidden_bit: 0 0x4d-0x4d.1 (0.1) -0x0040| 22 | " | type: "OBU_TILE_GROUP" (4) 0x4d.1-0x4d.5 (0.4) +0x0040| 22 | " | type: "tile_group" (4) 0x4d.1-0x4d.5 (0.4) 0x0040| 22 | " | extension_flag: false 0x4d.5-0x4d.6 (0.1) 0x0040| 22 | " | has_size_field: true 0x4d.6-0x4d.7 (0.1) 0x0040| 22 | " | reserved_1bit: 0 0x4d.7-0x4e (0.1)