1
1
mirror of https://github.com/wader/fq.git synced 2024-11-21 23:04:07 +03:00

decode: Fix MapRawToScalar regression

This commit is contained in:
Mattias Wadman 2021-11-17 17:14:19 +01:00
parent 986d5ecc50
commit c083a9e475
6 changed files with 21 additions and 23 deletions

View File

@ -4,17 +4,17 @@
# x264 - core 161 r3020 d198931 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
( ..
| select(format == "avc_sei" and .uuid == "x264")
| .data
| tostring[0:-1]
| . as $full
| split("options: ")[1]
| ( [ .
| split(" ")[]
| split("=")
| {key: .[0], value: .[1]}
] | from_entries
) + {
full: $full
}
| select(format == "avc_sei" and .uuid == "x264")
| .data
| tostring[0:-1]
| . as $full
| split("options: ")[1]
| ( [ .
| split(" ")[]
| split("=")
| {key: .[0], value: .[1]}
] | from_entries
) + {
full: $full
}
) // "No x264 SEI found"

View File

@ -462,7 +462,7 @@ $ fq -d matroska verbose /avc.mkv
| | | sei: {} (avc_sei) 0x0-0x2ab.7 (684)
0x000|05 |. | payload_type: "user_data_unregistered" (5) 0x0-0x0.7 (1)
0x000| ff ff a9 | ... | payload_size: 679 0x1-0x3.7 (3)
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: raw bits 0x4-0x13.7 (16)
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: "x264" (raw bits) 0x4-0x13.7 (16)
0x010|d9 23 ee ef |.#.. |
0x010| 78 32 36 34 20 2d 20 63 6f 72 65 20| x264 - core | data: raw bits 0x14-0x2aa.7 (663)
0x020|31 36 31 20 72 33 30 32 30 20 64 31 39 38 39 33|161 r3020 d19893|

View File

@ -404,7 +404,7 @@ $ fq -d mp4 verbose /avc.mp4
| | | sei: {} (avc_sei) 0x0-0x2ab.7 (684)
0x000|05 |. | payload_type: "user_data_unregistered" (5) 0x0-0x0.7 (1)
0x000| ff ff a9 | ... | payload_size: 679 0x1-0x3.7 (3)
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: raw bits 0x4-0x13.7 (16)
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: "x264" (raw bits) 0x4-0x13.7 (16)
0x010|d9 23 ee ef |.#.. |
0x010| 78 32 36 34 20 2d 20 63 6f 72 65 20| x264 - core | data: raw bits 0x14-0x2aa.7 (663)
0x020|31 36 31 20 72 33 30 32 30 20 64 31 39 38 39 33|161 r3020 d19893|

View File

@ -1109,7 +1109,7 @@ $ fq -d mp4 verbose /fragmented.mp4
| | | sei: {} (avc_sei) 0x0-0x25b.7 (604)
0x000|05 |. | payload_type: "user_data_unregistered" (5) 0x0-0x0.7 (1)
0x000| ff ff 59 | ..Y | payload_size: 599 0x1-0x3.7 (3)
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: raw bits 0x4-0x13.7 (16)
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: "x264" (raw bits) 0x4-0x13.7 (16)
0x010|d9 23 ee ef |.#.. |
0x010| 78 32 36 34 20 2d 20 63 6f 72 65 20| x264 - core | data: raw bits 0x14-0x25a.7 (583)
0x020|31 36 31 20 72 33 30 33 39 20 35 34 34 63 36 31|161 r3039 544c61|

View File

@ -91,7 +91,7 @@ $ fq -d avc_annexb verbose /avc_annexb
| | | sei: {} (avc_sei) 0x0-0x2ab.7 (684)
0x000|05 |. | payload_type: "user_data_unregistered" (5) 0x0-0x0.7 (1)
0x000| ff ff a9 | ... | payload_size: 679 0x1-0x3.7 (3)
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: raw bits 0x4-0x13.7 (16)
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: "x264" (raw bits) 0x4-0x13.7 (16)
0x010|d9 23 ee ef |.#.. |
0x010| 78 32 36 34 20 2d 20 63 6f 72 65 20| x264 - core | data: raw bits 0x14-0x2aa.7 (663)
0x020|31 36 31 20 72 33 30 33 39 20 35 34 34 63 36 31|161 r3039 544c61|

View File

@ -128,10 +128,7 @@ func (d *D) MapURangeToScalar(rm map[[2]uint64]Scalar) func(s Scalar) (Scalar, e
func (d *D) MapSRangeToScalar(rm map[[2]int64]Scalar) func(s Scalar) (Scalar, error) {
return func(s Scalar) (Scalar, error) {
n, ok := s.Actual.(int64)
if !ok {
return s, nil
}
n := s.ActualS()
for r, rs := range rm {
if n >= r[0] && n <= r[1] {
ns := rs
@ -151,8 +148,7 @@ type BytesToScalar []struct {
func (d *D) MapRawToScalar(btss BytesToScalar) func(s Scalar) (Scalar, error) {
return func(s Scalar) (Scalar, error) {
// TODO: check type assert?
ab, err := s.Actual.(*bitio.Buffer).Bytes()
ab, err := s.ActualBitBuf().Bytes()
if err != nil {
return s, err
}
@ -160,6 +156,7 @@ func (d *D) MapRawToScalar(btss BytesToScalar) func(s Scalar) (Scalar, error) {
if bytes.Equal(ab, bs.Bytes) {
ns := bs.Scalar
ns.Actual = s.Actual
s = ns
break
}
}
@ -388,6 +385,7 @@ func (d *D) tryText(nBytes int, e encoding.Encoding) (string, error) {
// read length prefixed text (ex pascal short string)
// lBits length prefix
// fixedBytes if != -1 read nBytes but trim to length
//nolint:unparam
func (d *D) tryTextLenPrefixed(lenBits int, fixedBytes int, e encoding.Encoding) (string, error) {
p := d.Pos()
l, err := d.bits(lenBits)