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\xfc\xb1\xf7\xc8\xdc`\xf92뇝f\xc6\xe1[\xd7\xe9\xff\xfd\x81\xc3.\x14\x13\x96`.\x1c!\x9c8\x8dҮ\xc8\x7f${i\t><4\x05\xf7\x86\xa8%\x90T\xeb\x18\x1b\x88(\xe6$\xbcѐ|쫉\xf8e\x84Ҍ\xca\xd7\xfd\x03\xe1S\v\tpT\xa0\x9dg_nV\xceb\xbc\xfd\xc9\xd8\xdd'o\x13\xf6l\xabs}k\xb1\xafT\xb0\xa1\x85\x9a\r\xba\xc9\xe85\x8a\x9dga@\xa5s-\xaf#\x9a59=\xe1\xc5?>\x0f攏\xc8\x03->\x9d\xbc]#\xd7\x02\x1a`\x11.\x82\xd7g\x99\xb5o4*\xe6.\xecQ\xfd\xd49\x11\xdaě\xcc(\x7f\xeeī\x91%O\xbdm\xd1\x05\x97\rY\xca)\xcc\xd8b\xb6/b\x1e]0\x10\xef\xfa\xbc\xb6\xeftm\x9e\xfb\xc0\x9e\a\x98Oep\x961\x83\xb5\xcd\x04\x9b!\x84\xa9\xfbv\xd9\xf7,\a48Nm\x01rn\xb3*\x00\x8e{'>\x81\xbe\xdf睝M\x8c0^֊g\xfe#!\x00\xe9\t\xc4\uec3c\xf4YLe\x8a\x95\xd5\xc8I1b\xb3\x83\xc1\x9d\x12h>\xbb/;\xbe\x97y*")
diff --git a/testdata/fuzz/FuzzDecodeSample/seed-main_intra_cabac b/testdata/fuzz/FuzzDecodeSample/seed-main_intra_cabac
new file mode 100644
index 0000000..b470282
--- /dev/null
+++ b/testdata/fuzz/FuzzDecodeSample/seed-main_intra_cabac
@@ -0,0 +1,2 @@
+go test fuzz v1
+[]byte("\x00\x00\x00\x15gM@\n\xdc,N\x84\x00\x00\x03\x00\x04\x00\x00\x03\x00P\x01\x99|\xc20\xba\xfeh,\xb6\xf1e )\xbeN\xac\xe5\xc0\x97\a\x9b\x18Q\xc35B&ܢ\xe0ҹ\xb6ϵ\x0fn\xcexd\xc2f\xa4ؔ\x91\x1b\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4;\x93L\x947\xa8\xe69\x98\x9b8\xae\x10Q\xa4\x96\xbbL\xf9å\xad\x00\x1a\xbeB`܃W\x06\xfd\x1a\xeeO]\x8c\\b\x1b\xfd\x9e\xe3\xaaӇ# \x90\xe4")
diff --git a/testdata/fuzz/FuzzDecodeSample/seed-main_ip_fade b/testdata/fuzz/FuzzDecodeSample/seed-main_ip_fade
new file mode 100644
index 0000000..60ae2e5
--- /dev/null
+++ b/testdata/fuzz/FuzzDecodeSample/seed-main_ip_fade
@@ -0,0 +1,2 @@
+go test fuzz v1
+[]byte("\x00\x00\x00\x16gM@\n\xdb\v\x13\xa1\x00\x00\x03\x00\x01\x00\x00\x03\x00\x14\x0f\x12&\xe0\x00\x00\x00\x04h\xea̲\x00\x00\x022\x06\x05\xff\xff.\xdcE\xe9\xbd\xe6\xd9H\xb7\x96,\xd8 \xd9#\xee\xefx264 - core 164 r3204 373697b - H.264/MPEG-4 AVC codec - Copyleft 2003-2025 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=10 keyint_min=1 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=26 ip_ratio=1.40 aq=0\x00\x80\x00\x00\x05\xdce\x88\x84?\xadn\xda\xc4\xf1Z\x80.\xee\xa9\\ \x9e\xa7\x90~\x13\xff\x19\x9am\xb4\x96\x18a\xe1\xc8RވD8\x16r\xe7+)\xee/\xed\xdc*\xad,\x15\xcd\xdc\xf2\b̋ZsӷY쒍\xae\xf0\xb4\x8bl\xa4\x15{;֚\b\xb1R\xbe\xde\xfa=R\xb5\xc2\x16eŵ\xa9$^\xf2U\xef=\xfcP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r\x92R{7\xf8\xe8QDNI\xb3#\xef}\x1a\xab\x0f\x88\xf9ݭe\xf0\xe5\x81\xd1#\x1c\x96\xee5\x90锡\x89D\xd9\\\xc0\xe0\xd05ؒ\xef\x17\x92\xffߒ\xf4\v\xf0\x89ʐ\x01\x15\xb7\xdd\xfe\x14\x98\x13\xe8\xf5u\xb9\xcf^\xaaKk[\xfc\r\x96\xabI\xe9\xach\xba\x85\xe7\xd6\xca4;\x93L\x947\xa8\xe69\x98\x9b8\xae\x10Q\xa4\x96\xbbL\xf9å\xad\x00\x1a\xbeB`܃W\x06\xfd\x1a\xeeO]\x8c\\b\x1b\xfd\x9e\xe3\xaaӇ# \x90\xe4")
diff --git a/testdata/fuzz/FuzzDecodeSample/seed-main_ip_weightp b/testdata/fuzz/FuzzDecodeSample/seed-main_ip_weightp
new file mode 100644
index 0000000..60ae2e5
--- /dev/null
+++ b/testdata/fuzz/FuzzDecodeSample/seed-main_ip_weightp
@@ -0,0 +1,2 @@
+go test fuzz v1
+[]byte("\x00\x00\x00\x16gM@\n\xdb\v\x13\xa1\x00\x00\x03\x00\x01\x00\x00\x03\x00\x14\x0f\x12&\xe0\x00\x00\x00\x04h\xea̲\x00\x00\x022\x06\x05\xff\xff.\xdcE\xe9\xbd\xe6\xd9H\xb7\x96,\xd8 \xd9#\xee\xefx264 - core 164 r3204 373697b - H.264/MPEG-4 AVC codec - Copyleft 2003-2025 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=10 keyint_min=1 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=26 ip_ratio=1.40 aq=0\x00\x80\x00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3jA\x81F\xe0\t\xb0ٚd\x86\x88u9!:\x10k\xf6\xe4\x1d_\xad\xa7\xb9\xd1\xf7\xb24\xdd\xd5\xd1\xea\xca!T7,\x8f\xc1t2SJ\xbf\x00&\xb02\x80\x93\xe0\v\x02M\xbe\x9aLwǾP\x00vr~ì\xe10E,u\x13(\x16`\xf2\x01͒\xcb\xef\x9e&\x02\a\xdd\xecwP\x1a\xe2\xe5T$\xb3\x8b\x93Tr\x92R{7\xf8\xe8QDNI\xb3#\xef}\x1a\xab\x0f\x88\xf9ݭe\xf0\xe5\x81\xd1#\x1c\x96\xee5\x90锡\x89D\xd9\\\xc0\xe0\xd05ؒ\xef\x17\x92\xffߒ\xf4\v\xf0\x89ʐ\x01\x15\xb7\xdd\xfe\x14\x98\x13\xe8\xf5u\xb9\xcf^\xaaKk[\xfc\r\x96\xabI\xe9\xach\xba\x85\xe7\xd6\xca4;\x93L\x947\xa8\xe69\x98\x9b8\xae\x10Q\xa4\x96\xbbL\xf9å\xad\x00\x1a\xbeB`܃W\x06\xfd\x1a\xeeO]\x8c\\b\x1b\xfd\x9e\xe3\xaaӇ# \x90\xe4")
diff --git a/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_cabac b/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_cabac
new file mode 100644
index 0000000..4637ce8
--- /dev/null
+++ b/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_cabac
@@ -0,0 +1,2 @@
+go test fuzz v1
+[]byte("\x00\x00\x00\x15gM@\n酉Ѐ\x00\x00\x03\x00\x80\x00\x00\n\a\x89\x12\x9c\x00\x00\x00\x04hꌲ\x00\x00\x02}\x06\x05\xff\xffy\xdcE\xe9\xbd\xe6\xd9H\xb7\x96,\xd8 \xd9#\xee\xefx264 - core 164 r3204 373697b - H.264/MPEG-4 AVC codec - Copyleft 2003-2025 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=2 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=0 open_gop=0 weightp=0 keyint=10 keyint_min=1 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=26 ip_ratio=1.40 pb_ratio=1.30 aq=0\x00\x80\x00\x00\x05\xdce\x88\x84\x01\xff\xadn\xda\xc4\xf1Z\x80.\xee\xa9\\ \x9e\xa7\x90~\x13\xff\x19\x9am\xb4\x96\x18a\xe1\xc8RވD8\x16r\xe7+)\xee/\xed\xdc*\xad,\x15\xcd\xdc\xf2\b̋ZsӷY쒍\xae\xf0\xb4\x8bl\xa4\x15{;֚\b\xb1R\xbe\xde\xfa=R\xb5\xc2\x16eŵ\xa9$^\xf2U\xef=\xfcP\xac\x86\xb8\xac.\x7f9l\x12\xc5\x19\xc9`@\xbc\xd0M)\xa8\xd5\x1e\xd8^\x12u\xe5\x04É\xd6D\xd3M\x1d\xeaX\xeaaZ\x81\xc7\x17\x0e\xe4f\x88\n\x1e_\x84\xe1\rq\x15\x8e4\xf7\x1c\xb4\xa4\x99?\n\xb4\xfe\t\x1d\xdbr\x80c\xa4\x85\xb2y%Ӭ\x11\xe5\xca\xc9aI\xbf\x8d\x94\x96~\xbf_\xac9ѩ\xee,`ڂ\xb2\xccd?*\xedv\x04\x80\xb3\xca?\xae\xd8\x14=(0\xfb㰁@\v\x99\x8f\x1f\xe7\xb4V\x811%\xaf\xbd\x93\xe3\x88_\x17\xea}\xe1\x83U\xe2\xf7\xe9l\f=g4\r\xea\xe1\x1exY\xeb\xee\x8e\xd8@\xc8\xc1\n\xbfP\xab\xa4\xd1'\x95ZX\xf1\xcb\b\xec.\x91W/+\xa8\xcc1ml\xe4\n\xeb&q\xf2\x044Y\xf0\xa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\xbdH\x88\xc8i\x8c\x10x\x1b\x95\x17\xec\xcf\xe3&\xca\vG\xb1N\xae\xc4\x19\x0e\x99\x9c#\x04ٟ\x837%y\xd0u\xb6\x87@6bÕ+\x8b\xa9\xc2.eQ\xa2\xff\x92\xc5\x13\xe7\t\xa7\\E\xad\xb2D\xbf\xd6\xc3N\x8f\xf6\x19Ū\xe8P\x86\xf9\x8c\xeeߖ\xeb\xcd+\xf5\x9d~<=\xecm\x90\xbcT\xd0r\x98fx\xb8\xa7\xab\x1b\xa4\xa5\xd3jA\x81F\xe0\t\xb0ٚd\x86\x88u9!:\x10k\xf6\xe4\x1d_\xad\xa7\xb9\xd1\xf7\xb24\xdd\xd5\xd1\xea\xca!T7,\x8f\xc1t2SJ\xbf\x00&\xb02\x80\x93\xe0\v\x02M\xbe\x9aLwǾP\x00vr~ì\xe10E,u\x13(\x16`\xf2\x01͒\xcb\xef\x9e&\x02\a\xdd\xecwP\x1a\xe2\xe5T$\xb3\x8b\x93Tr\x92R{7\xf8\xe8QDNI\xb3#\xef}\x1a\xab\x0f\x88\xf9ݭe\xf0\xe5\x81\xd1#\x1c\x96\xee5\x90锡\x89D\xd9\\\xc0\xe0\xd05ؒ\xef\x17\x92\xffߒ\xf4\v\xf0\x89ʐ\x01\x15\xb7\xdd\xfe\x14\x98\x13\xe8\xf5u\xb9\xcf^\xaaKk[\xfc\r\x96\xabI\xe9\xach\xba\x85\xe7\xd6\xca4;\x93L\x947\xa8\xe69\x98\x9b8\xae\x10Q\xa4\x96\xbbL\xf9å\xad\x00\x1a\xbeB`܃W\x06\xfd\x1a\xeeO]\x8c\\b\x1b\xfd\x9e\xe3\xaaӇ# \x90")
diff --git a/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_cavlc b/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_cavlc
new file mode 100644
index 0000000..5ff7f44
--- /dev/null
+++ b/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_cavlc
@@ -0,0 +1,2 @@
+go test fuzz v1
+[]byte("\x00\x00\x00\x15gM@\n酉Ѐ\x00\x00\x03\x00\x80\x00\x00\n\a\x89\x12\x9c\x00\x00\x00\x04hʌ\xb2\x00\x00\x02}\x06\x05\xff\xffy\xdcE\xe9\xbd\xe6\xd9H\xb7\x96,\xd8 \xd9#\xee\xefx264 - core 164 r3204 373697b - H.264/MPEG-4 AVC codec - Copyleft 2003-2025 - http://www.videolan.org/x264.html - options: cabac=0 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=2 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=0 open_gop=0 weightp=0 keyint=10 keyint_min=1 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=26 ip_ratio=1.40 pb_ratio=1.30 aq=0\x00\x80\x00\x00\x05\xdce\x88\x84\x01\xfe!\x11W\x06\x04/\xc0B\x8c\x84\x00\x02֠Q\xa5\x00\x04\xa1zq\xf9N\xa5\xf1\xeb\x15\xffൗ\xe6\xa46g\x12\xd7;tG\x11<\x18\xbc\x86R\xf0NR\xff\xf1\x7f;\t\x1f#\x0f\x98\x97+\xff\xdc\x03n\x94^\x9a3N\x9f\xbe\xb5\x1aA\x82)\xa9\x1b\xa3\xd5\xebq4\x18t1\"\xb2z\xbd@>c\x11\xb1\xc0*\xe3\xfb\xe5\x00\xf1LT\xe7\x00\x88O\xf7\xc0\x80\x00@\x00\x00\x04\x00\x00\x82a\x00\x01Q|\x000\x007cq\"P\xa2xS\tRL\x03\xc3\\\xf0d\x8d\xb8\x80\x1c\x95\xbf\xb9\x80\x02\xe8#\xaaF\xd4\xc0\b\xd3hP\x931\xdf\x05\xf0\x18B?Nɵ-\x80\b$\x99\xff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\xf7\xca\x00xV/\xad\xa1\xda\xdf\xf7\xc0\x80\x00@\x14\x00\x10\x02F\x02 \x01\x932C\xdc\x054mLD`\xc8\xf4\x03\x86\xd4\xd8\x02\xb8\x82T\x8d\xa9\x88\x00\x02\x82\xf1\xc3-1\xb56|\xd0%\x1bS+\x1a\xe4\n6\xa6\xc0\x00\xb2\x8aM\xc0ژ\x80\x00H\xa3\x97t6\xa7\x1a\x87\xf8\a\x1f\x80\xf4\xee\xf3$\x831\n6\xb6w\xf1\x03\n-CLp#\x1e\xb0\x9d\x1e\xaf|\x80\x00\xf1\x18\xae\xa6\x87\xed\xfd\xff\xbe(\x00\b\x1cx@\x00|\x01\x06\x83\x01\x00\x01\xd0`P\xe8\x14\x82\x19\x06\x95\xb0\xa4\x0eu\xfc\x1f\x023\x99\xdbC0\x02EH\x1e\x18;6\xb8p\xa4\x1f\xc1\xe0Ə\x97\xb8\xad\x983\xfb\xbf\xff\x88|7\x81\xc2\a\x14\x83\xe0\xe0\x04\x00\xe4@\x0e\x928\x01\x82n\x06ڂ\x02\x00\x02\x04\xa6\x02\x82\x80\x00\x80(\x00\b\x13\x80\x00\x82P\x1c\x86%\xcc\x00\x86Ȉ\x13\xbc\xe4\x0ev\x06\a\x00\x02`0}\xcc\x01\x1b/\x000\t_\xc0\x93\xc4b\xbe\xf8\x7f\xfc\x15\xe2\x80\x00\x80\xb7\x06\x00\x02@\x00x\x80\x00 \xa8\x00\x02$\xb0q\x00L`\xe2\x00\x98\x83\x80\x00\x80\x18\x00\b\x181\x83\x80\x00\x80\x18\x00\b\x181\x11\x8b\xf6\x00\x1c\x04!\xf6\x1a\xf8\x93\xbep\xfe$\x91\x02@\x00\xa8\x00\x18\f\x84\a\x10\x808\x10\x00\x04<\xc0\xe4\x01\xc0\xb0\x00 D\x90W\x12\x80\f\xf6YD+\x85\x80\r\x86!\x00\xc1q\x80w\xff\xff\x9f\xf0\"\x7fEo-\xf2#\xabW\xf80D\x80\x0eC\b\x12\x18\x82Ay\x1a\xe0\x9fc\xc9\xd8\n\n#\xfc\x18\x17\xbf\x12*\xdeeO\xf1\xc7\xe8o\xbe\xfbC\xd9\xef~y#\x03\x9e\n\x03g\xf1\x9e\xfe\xa5\x97\xcbc\xb44\x8a\x17,9\xf3\x8f\xc0r\x8c\x04#\xfct\x10\xf9\xe0\x0f\xaf\x12H\xdc)\xc8 M\xd47f\x93G\xd9\xce\xf5#r\x03\xac\xe4\b\x86i}\xa8\x87\xe3\x05\u0083\xb1\x9c\xfc>\xff\xb6\x90\x92XD\x06\xa3\a\xe0L\xd2\xe3\xaeBX\xb7S\a\xe1y\xaf\x0fs\xae\fK\x90")
diff --git a/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_pyramid b/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_pyramid
new file mode 100644
index 0000000..f8f40b7
--- /dev/null
+++ b/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_pyramid
@@ -0,0 +1,2 @@
+go test fuzz v1
+[]byte("\x00\x00\x00\x17gM@\n\xec\xa1bt \x00\x00\x03\x00 \x00\x00\x03\x02\x81\xe2D\xb2\xc0\x00\x00\x00\x05h\xeb\xe2K \x00\x00\x02}\x06\x05\xff\xffy\xdcE\xe9\xbd\xe6\xd9H\xb7\x96,\xd8 \xd9#\xee\xefx264 - core 164 r3204 373697b - H.264/MPEG-4 AVC codec - Copyleft 2003-2025 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 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=25 keyint_min=2 scenecut=40 intra_refresh=0 rc=cqp mbtree=0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\xa4XB\x81\xfe\x8f\x0fq)gZ\x8f\xdd\x1e5A̬w\xe8\x9cI\xd3\x1e>\xec\xb8\xdd\xc1\xd9`\xae\xd9\x0f\xabd\v\xea\x02\x1c݆x\x91\xb7,\xb2\x05[\xd9ΧX\xe3\v\xc2庌\x11C\xd8z#\xecu\xf2,\xebb}\x93W\t,\xab\xaa\xf9\x97\xb3\xa4\x86\xfc\xd7s\x84!ʪ\x97\xa0fً\tv(`\xae[Ro\xd5\xdchT\xf1O\xbbn\xfaF)\x16b\xc4&\xbb\xa9\xcf[\vܭ\x12\xe33\xe7\xce5\xfe\xb3\x81\xe9\xa7G\xe2\xae̵R\x85\xec(H\xafp\aZ\x98\xd7\xc2ކ\x04'\xfa\x1fv\xb0Ֆo\x12\t\x05_\xd0\xd2 k\xf3/b;\by\f\x1d\xa7Ṩ\xfa\x03\x91\x90ь\xa8r\xd9\xc5v\xfa\xbe>\x80Q㭘\xc0pl\x0e\x92\xe4\x89'\xba\v7I\x9a\x02\x87 6\xcf\xd0@\xd32/\xed\x81\b\xfd\xc03O\x9eos\xa0\a\xa3\xb1g\"\xb7\xb0ߕ\xc7\xecN\xf5\xc6n)@:\xd9\x15\xe0\x9a8*\xbb,y1\x1d\xe0\xe1\x93\r\x84\xbc\xf2Q\xcdk\xdc#\x0e˿B\x1c\n\xb9\x9b\xc6\xd7\x15gL\x12\xcf\x06\xef|\xf5")
diff --git a/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_temporal b/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_temporal
new file mode 100644
index 0000000..3c931a7
--- /dev/null
+++ b/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_temporal
@@ -0,0 +1,2 @@
+go test fuzz v1
+[]byte("\x00\x00\x00\x15gM@\n酉Ѐ\x00\x00\x03\x00\x80\x00\x00\n\a\x89\x12\x9c\x00\x00\x00\x04hꌲ\x00\x00\x02}\x06\x05\xff\xffy\xdcE\xe9\xbd\xe6\xd9H\xb7\x96,\xd8 \xd9#\xee\xefx264 - core 164 r3204 373697b - H.264/MPEG-4 AVC codec - Copyleft 2003-2025 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=2 b_pyramid=0 b_adapt=1 b_bias=0 direct=2 weightb=0 open_gop=0 weightp=0 keyint=10 keyint_min=1 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=26 ip_ratio=1.40 pb_ratio=1.30 aq=0\x00\x80\x00\x00\x05\xdce\x88\x84\x01\xff\xadn\xda\xc4\xf1Z\x80.\xee\xa9\\ \x9e\xa7\x90~\x13\xff\x19\x9am\xb4\x96\x18a\xe1\xc8RވD8\x16r\xe7+)\xee/\xed\xdc*\xad,\x15\xcd\xdc\xf2\b̋ZsӷY쒍\xae\xf0\xb4\x8bl\xa4\x15{;֚\b\xb1R\xbe\xde\xfa=R\xb5\xc2\x16eŵ\xa9$^\xf2U\xef=\xfcP\xac\x86\xb8\xac.\x7f9l\x12\xc5\x19\xc9`@\xbc\xd0M)\xa8\xd5\x1e\xd8^\x12u\xe5\x04É\xd6D\xd3M\x1d\xeaX\xeaaZ\x81\xc7\x17\x0e\xe4f\x88\n\x1e_\x84\xe1\rq\x15\x8e4\xf7\x1c\xb4\xa4\x99?\n\xb4\xfe\t\x1d\xdbr\x80c\xa4\x85\xb2y%Ӭ\x11\xe5\xca\xc9aI\xbf\x8d\x94\x96~\xbf_\xac9ѩ\xee,`ڂ\xb2\xccd?*\xedv\x04\x80\xb3\xca?\xae\xd8\x14=(0\xfb㰁@\v\x99\x8f\x1f\xe7\xb4V\x811%\xaf\xbd\x93\xe3\x88_\x17\xea}\xe1\x83U\xe2\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ed-main_ipb_weightb b/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_weightb
new file mode 100644
index 0000000..e818072
--- /dev/null
+++ b/testdata/fuzz/FuzzDecodeSample/seed-main_ipb_weightb
@@ -0,0 +1,2 @@
+go test fuzz v1
+[]byte("\x00\x00\x00\x15gM@\n酉Ѐ\x00\x00\x03\x00\x80\x00\x00\n\a\x89\x12\x9c\x00\x00\x00\x04hꬲ\x00\x00\x02}\x06\x05\xff\xffy\xdcE\xe9\xbd\xe6\xd9H\xb7\x96,\xd8 \xd9#\xee\xefx264 - core 164 r3204 373697b - H.264/MPEG-4 AVC codec - Copyleft 2003-2025 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=2 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=0 keyint=10 keyint_min=1 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=26 ip_ratio=1.40 pb_ratio=1.30 aq=0\x00\x80\x00\x00\x05\xdce\x88\x84\x01\xff\xadn\xda\xc4\xf1Z\x80.\xee\xa9\\ \x9e\xa7\x90~\x13\xff\x19\x9am\xb4\x96\x18a\xe1\xc8RވD8\x16r\xe7+)\xee/\xed\xdc*\xad,\x15\xcd\xdc\xf2\b̋ZsӷY쒍\xae\xf0\xb4\x8bl\xa4\x15{;֚\b\xb1R\xbe\xde\xfa=R\xb5\xc2\x16eŵ\xa9$^\xf2U\xef=\xfcP\xac\x86\xb8\xac.\x7f9l\x12\xc5\x19\xc9`@\xbc\xd0M)\xa8\xd5\x1e\xd8^\x12u\xe5\x04É\xd6D\xd3M\x1d\xeaX\xeaaZ\x81\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ؒ\xef\x17\x92\xffߒ\xf4\v\xf0\x89ʐ\x01\x15\xb7\xdd\xfe\x14\x98\x13\xe8\xf5u\xb9\xcf^\xaaKk[\xfc\r\x96\xabI\xe9\xach\xba\x85\xe7\xd6\xca4;\x93L\x947\xa8\xe69\x98\x9b8\xae\x10Q\xa4\x96\xbbL\xf9å\xad\x00\x1a\xbeB`܃W\x06\xfd\x1a\xeeO]\x8c\\b\x1b\xfd\x9e\xe3\xaaӇ# \x90")
diff --git a/testdata/fuzz/FuzzParseAVCC/seed-base_intra_nodb b/testdata/fuzz/FuzzParseAVCC/seed-base_intra_nodb
new file mode 100644
index 0000000..0d33792
--- /dev/null
+++ b/testdata/fuzz/FuzzParseAVCC/seed-base_intra_nodb
@@ -0,0 +1,2 @@
+go test fuzz v1
+[]byte("\x01B\xc0\n\xff\xe1\x00\x15gB\xc0\n\xdc,N\x84\x00\x00\x03\x00\x04\x00\x00\x03\x00P 0 {
+ return fmt.Errorf("%d statement blocks were never run", len(missed))
+ }
+ return nil
+ },
+ }
+}
+
+// Uncovered returns the blocks of a Go coverage profile (go help testflag,
+// -coverprofile) that hold statements but ran zero times, and the statement
+// count of the whole profile. A profile with no statements is an error, so a
+// package that was not measured cannot pass.
+func Uncovered(r io.Reader) (missed []string, total int, err error) {
+ sc := bufio.NewScanner(r)
+ first := true
+ for sc.Scan() {
+ line := sc.Text()
+ if first {
+ first = false
+ if !strings.HasPrefix(line, "mode:") {
+ return nil, 0, fmt.Errorf("not a coverage profile: %q", line)
+ }
+ continue
+ }
+ // file:startLine.startCol,endLine.endCol numStatements count
+ fields := strings.Fields(line)
+ if len(fields) != 3 {
+ return nil, 0, fmt.Errorf("malformed profile line %q", line)
+ }
+ n, err1 := strconv.Atoi(fields[1])
+ c, err2 := strconv.Atoi(fields[2])
+ if err1 != nil || err2 != nil {
+ return nil, 0, fmt.Errorf("malformed profile line %q", line)
+ }
+ total += n
+ if n > 0 && c == 0 {
+ missed = append(missed, fields[0])
+ }
+ }
+ if err := sc.Err(); err != nil {
+ return nil, 0, err
+ }
+ if total == 0 {
+ return nil, 0, fmt.Errorf("the profile holds no statements")
+ }
+ return missed, total, nil
+}
diff --git a/tools/covergate/main_test.go b/tools/covergate/main_test.go
new file mode 100644
index 0000000..b63baf2
--- /dev/null
+++ b/tools/covergate/main_test.go
@@ -0,0 +1,76 @@
+// Copyright (c) 2026, go-avkit
+// SPDX-License-Identifier: BSD-3-Clause
+
+package main
+
+import (
+ "bytes"
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+const full = "mode: set\na.go:1.1,2.2 3 1\nb.go:4.1,5.2 2 7\n"
+
+func TestUncovered(t *testing.T) {
+ missed, total, err := Uncovered(strings.NewReader(full))
+ if err != nil || len(missed) != 0 || total != 5 {
+ t.Fatalf("full profile: %v %d %v", missed, total, err)
+ }
+ // 1 statement of 1000 not run is 99.9%: the rounded print would say
+ // 100.0%, this must not.
+ missed, _, err = Uncovered(strings.NewReader(full + "c.go:9.1,9.9 1 0\nd.go:1.1,1.2 0 0\n"))
+ if err != nil || len(missed) != 1 || missed[0] != "c.go:9.1,9.9" {
+ t.Fatalf("missed %v err %v", missed, err)
+ }
+ for _, bad := range []string{"", "nonsense\n", "mode: set\nonly two\n", "mode: set\na.go:1.1,2.2 x 1\n", "mode: set\n"} {
+ if _, _, err := Uncovered(strings.NewReader(bad)); err == nil {
+ t.Errorf("%q accepted", bad)
+ }
+ }
+}
+
+func TestRootCmd(t *testing.T) {
+ dir := t.TempDir()
+ write := func(name, body string) string {
+ p := filepath.Join(dir, name)
+ if err := os.WriteFile(p, []byte(body), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ return p
+ }
+ run := func(args ...string) (string, string, error) {
+ var out, errb bytes.Buffer
+ cmd := RootCmd()
+ cmd.SetArgs(args)
+ cmd.SetOut(&out)
+ cmd.SetErr(&errb)
+ err := cmd.Execute()
+ return out.String(), errb.String(), err
+ }
+ if out, _, err := run(write("ok.out", full)); err != nil || !strings.Contains(out, "0 of 5") {
+ t.Fatalf("ok: %q %v", out, err)
+ }
+ if _, errs, err := run(write("bad.out", full+"c.go:9.1,9.9 1 0\n")); err == nil || !strings.Contains(errs, "c.go:9.1,9.9") {
+ t.Fatalf("bad: %q %v", errs, err)
+ }
+ if _, _, err := run(filepath.Join(dir, "missing")); err == nil {
+ t.Fatal("a missing profile passed")
+ }
+ if _, _, err := run(write("junk.out", "junk\n")); err == nil {
+ t.Fatal("junk passed")
+ }
+}
+
+func TestMain(t *testing.T) {
+ var code int
+ old := osExit
+ osExit = func(c int) { code = c }
+ defer func() { osExit = old }()
+ os.Args = []string{"covergate"}
+ main()
+ if code != 1 {
+ t.Fatalf("exit code %d", code)
+ }
+}
diff --git a/tools/go.mod b/tools/go.mod
new file mode 100644
index 0000000..912ca59
--- /dev/null
+++ b/tools/go.mod
@@ -0,0 +1,22 @@
+module github.com/go-avkit/decode/tools
+
+go 1.27.1
+
+require (
+ github.com/go-avkit/avkit v0.13.0
+ github.com/go-avkit/decode v0.0.0
+ github.com/spf13/cobra v1.10.2
+)
+
+require (
+ github.com/Eyevinn/mp4ff v0.62.0 // indirect
+ github.com/asticode/go-astikit v0.30.0 // indirect
+ github.com/asticode/go-astits v1.17.0 // indirect
+ github.com/at-wat/ebml-go v0.19.4 // indirect
+ github.com/ebitengine/purego v0.9.0 // indirect
+ github.com/inconshreveable/mousetrap v1.1.0 // indirect
+ github.com/oops1/go.264 v1.12.0 // indirect
+ github.com/spf13/pflag v1.0.9 // indirect
+)
+
+replace github.com/go-avkit/decode => ..
diff --git a/tools/go.sum b/tools/go.sum
new file mode 100644
index 0000000..18a82c4
--- /dev/null
+++ b/tools/go.sum
@@ -0,0 +1,34 @@
+github.com/Eyevinn/mp4ff v0.62.0 h1:Vx4U0xUfSdcwEgw1wBbTZ53+yZhlJpT7eIAkLUDaxmM=
+github.com/Eyevinn/mp4ff v0.62.0/go.mod h1:97zsDIJUiDTYqKpqq/b1K9foamxXmvsgE4GdPrPK3ks=
+github.com/asticode/go-astikit v0.30.0 h1:DkBkRQRIxYcknlaU7W7ksNfn4gMFsB0tqMJflxkRsZA=
+github.com/asticode/go-astikit v0.30.0/go.mod h1:h4ly7idim1tNhaVkdVBeXQZEE3L0xblP7fCWbgwipF0=
+github.com/asticode/go-astits v1.17.0 h1:KrDxalNhZ/GJkbgVweD5xxCA9XoaW7tHuFiJB/sAZxs=
+github.com/asticode/go-astits v1.17.0/go.mod h1:psImoC1BhcAWIsyM/RnbO1OgUW+XSf8fZpFvF5McDyo=
+github.com/at-wat/ebml-go v0.19.4 h1:6F767ThzH/JqNUsF79PwRFP0pwUF5ALXWJ6pXuiolI8=
+github.com/at-wat/ebml-go v0.19.4/go.mod h1:wu3fQj+DWo6SOOl9c4yDi+gFs9Oa96Z2B5qxo1OxFYY=
+github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
+github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/ebitengine/purego v0.9.0 h1:mh0zpKBIXDceC63hpvPuGLiJ8ZAa3DfrFTudmfi8A4k=
+github.com/ebitengine/purego v0.9.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
+github.com/go-avkit/avkit v0.13.0 h1:aeRvSvu4beVmToykL9YiqeZN3MIQA3aXsbN/w0gRCBY=
+github.com/go-avkit/avkit v0.13.0/go.mod h1:e6vXhNYj/ccY7454oZNTeSuKA7C4cBPA3usz3d6jxjA=
+github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
+github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
+github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
+github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+github.com/oops1/go.264 v1.12.0 h1:72uGb5MAyX83lSrK3aMvxYtxdQHOct7E4bD8YoJxbBU=
+github.com/oops1/go.264 v1.12.0/go.mod h1:9QWDhblzn+OCeWpxJLpIfr/G/N5MSf849wVixp4Hzas=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
+github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
+github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
+github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/tools/jvt/clip.go b/tools/jvt/clip.go
new file mode 100644
index 0000000..4d990fc
--- /dev/null
+++ b/tools/jvt/clip.go
@@ -0,0 +1,33 @@
+// Copyright (c) 2026, go-avkit
+// SPDX-License-Identifier: BSD-3-Clause
+
+package main
+
+import (
+ "fmt"
+ "os/exec"
+ "strconv"
+
+ "github.com/spf13/cobra"
+)
+
+// clipCmd cuts the first N video packets of a real file, stream copy, into a
+// new file. The first N packets in decoding order are self-contained (every
+// reference of a picture precedes it), so ffmpeg and this decoder are asked for
+// the same N pictures, and a two-hour film is not decoded to test a decoder.
+func clipCmd() *cobra.Command {
+ var n int
+ c := &cobra.Command{
+ Use: "clip SRC DST", Short: "stream-copy the first N video packets of SRC into DST", Args: cobra.ExactArgs(2),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ out, err := exec.Command("ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-i", args[0],
+ "-map", "0:v:0", "-c", "copy", "-frames:v", strconv.Itoa(n), "-an", "-sn", args[1]).CombinedOutput()
+ if err != nil {
+ return fmt.Errorf("ffmpeg: %w: %.200s", err, out)
+ }
+ return nil
+ },
+ }
+ c.Flags().IntVar(&n, "frames", 900, "number of video packets to keep")
+ return c
+}
diff --git a/tools/jvt/diff.go b/tools/jvt/diff.go
new file mode 100644
index 0000000..ed570eb
--- /dev/null
+++ b/tools/jvt/diff.go
@@ -0,0 +1,127 @@
+// Copyright (c) 2026, go-avkit
+// SPDX-License-Identifier: BSD-3-Clause
+
+package main
+
+import (
+ "crypto/md5"
+ "fmt"
+ "io"
+ "os"
+ "path/filepath"
+
+ "github.com/go-avkit/decode"
+ "github.com/spf13/cobra"
+)
+
+// diffCmd says where picture INDEX of a stream first goes wrong against the
+// suite's own reference yuv: how many macroblocks differ and which come first.
+// It is how a defect is localised before anything is explained.
+func diffCmd() *cobra.Command {
+ var dir string
+ c := &cobra.Command{
+ Use: "diff NAME INDEX", Short: "locate the macroblocks of one picture that differ from the reference yuv", Args: cobra.ExactArgs(2),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ var idx int
+ if _, err := fmt.Sscan(args[1], &idx); err != nil {
+ return err
+ }
+ path, err := fetchStream(dir, args[0])
+ if err != nil {
+ return err
+ }
+ return diffPicture(cmd.OutOrStdout(), path, idx)
+ },
+ }
+ c.Flags().StringVar(&dir, "dir", "", "directory of downloaded streams")
+ _ = c.MarkFlagRequired("dir")
+ return c
+}
+
+func diffPicture(w io.Writer, path string, idx int) error {
+ data, err := os.ReadFile(path)
+ if err != nil {
+ return err
+ }
+ d, err := decode.New(decode.Config{MaxFrameMBs: 1 << 17}, 4)
+ if err != nil {
+ return err
+ }
+ defer d.Close()
+ var frames []decode.Frame
+ fs, err := d.DecodeAnnexB(data)
+ frames = append(frames, fs...)
+ if err == nil {
+ fs, err = d.Flush()
+ frames = append(frames, fs...)
+ }
+ if err != nil {
+ return err
+ }
+ y := refYUV(path)
+ if y == "" {
+ return fmt.Errorf("no reference yuv beside %s", filepath.Base(path))
+ }
+ ref, err := os.ReadFile(y)
+ if err != nil {
+ return err
+ }
+ if len(frames) > 0 && idx < 0 {
+ // INDEX -1: list every picture that differs.
+ size := len(frames[0].Y) + len(frames[0].Cb) + len(frames[0].Cr)
+ var bad []int
+ for i, f := range frames {
+ if (i+1)*size > len(ref) || frameMD5(f) != fmt.Sprintf("%x", md5.Sum(ref[i*size:(i+1)*size])) {
+ bad = append(bad, i)
+ }
+ }
+ fmt.Fprintf(w, "%d of %d pictures differ: %v\n", len(bad), len(frames), bad)
+ // Pictures that are right but in the wrong place point at output order
+ // (POC), not at decoding.
+ where := map[string]int{}
+ for i := 0; (i+1)*size <= len(ref); i++ {
+ where[fmt.Sprintf("%x", md5.Sum(ref[i*size:(i+1)*size]))] = i
+ }
+ moved := 0
+ var sample []string
+ for _, i := range bad {
+ if j, ok := where[frameMD5(frames[i])]; ok {
+ moved++
+ if len(sample) < 12 {
+ sample = append(sample, fmt.Sprintf("%d->%d", i, j))
+ }
+ }
+ }
+ fmt.Fprintf(w, "%d of the differing pictures exist elsewhere in the reference (ours->reference): %v\n", moved, sample)
+ return nil
+ }
+ if idx < 0 || idx >= len(frames) {
+ return fmt.Errorf("picture %d of %d", idx, len(frames))
+ }
+ f := frames[idx]
+ size := len(f.Y) + len(f.Cb) + len(f.Cr)
+ if (idx+1)*size > len(ref) {
+ return fmt.Errorf("reference yuv holds %d pictures", len(ref)/size)
+ }
+ ref = ref[idx*size : (idx+1)*size]
+ mbw := (f.Width + 15) / 16
+ bad := map[int]int{}
+ var order []int
+ for i := range f.Y {
+ if f.Y[i] != ref[i] {
+ mb := (i/f.Width/16)*mbw + (i%f.Width)/16
+ if bad[mb] == 0 {
+ order = append(order, mb)
+ }
+ bad[mb]++
+ }
+ }
+ fmt.Fprintf(w, "%dx%d, %d macroblocks, %d differ in luma\n", f.Width, f.Height, mbw*((f.Height+15)/16), len(order))
+ for i, mb := range order {
+ if i == 12 {
+ break
+ }
+ fmt.Fprintf(w, " MB %d (x %d, y %d): %d samples\n", mb, mb%mbw, mb/mbw, bad[mb])
+ }
+ return nil
+}
diff --git a/tools/jvt/main.go b/tools/jvt/main.go
new file mode 100644
index 0000000..d2bcd65
--- /dev/null
+++ b/tools/jvt/main.go
@@ -0,0 +1,489 @@
+// Copyright (c) 2026, go-avkit
+// SPDX-License-Identifier: BSD-3-Clause
+
+// Command jvt measures the decoder against ffmpeg.
+//
+// jvt fetch -dir D NAME... download and unpack JVT conformance streams (ITU-T H.264.1)
+// jvt compare -dir D -manifests M NAME...
+// decode each stream, compare every picture's MD5 with ffmpeg's
+// framemd5, write M/NAME.md5 and print the table
+// jvt file PATH the same for a real MP4/MKV file; prints hashes only
+//
+// Nothing here is part of the library: it is the oracle harness, kept apart
+// (its own module) so the library's dependencies and coverage gate stay small.
+package main
+
+import (
+ "archive/zip"
+ "bufio"
+ "bytes"
+ "context"
+ "crypto/md5"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "io"
+ "net/http"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/go-avkit/avkit/container"
+ "github.com/go-avkit/decode"
+ "github.com/spf13/cobra"
+)
+
+const baseURL = "https://www.itu.int/wftp3/av-arch/jvt-site/draft_conformance/AVCv1/"
+
+var osExit = os.Exit
+
+const (
+ maxZip = 300 << 20
+ maxExtract = 1 << 30
+)
+
+var bitstreamExt = map[string]bool{".264": true, ".jvt": true, ".avc": true, ".26l": true, ".h264": true, ".jsv": true, ".bit": true, ".bits": true}
+
+func main() {
+ if err := RootCmd().Execute(); err != nil {
+ osExit(1)
+ }
+}
+
+// RootCmd builds the command tree.
+func RootCmd() *cobra.Command {
+ root := &cobra.Command{Use: "jvt", Short: "measure the H.264 decoder against ffmpeg", SilenceUsage: true}
+ var dir, manifests string
+ fetch := &cobra.Command{
+ Use: "fetch NAME...", Short: "download and unpack JVT conformance streams", Args: cobra.MinimumNArgs(1),
+ RunE: func(cmd *cobra.Command, names []string) error {
+ for _, n := range names {
+ if _, err := fetchStream(dir, n); err != nil {
+ return fmt.Errorf("%s: %w", n, err)
+ }
+ fmt.Fprintln(cmd.OutOrStdout(), "fetched", n)
+ }
+ return nil
+ },
+ }
+ compare := &cobra.Command{
+ Use: "compare NAME...", Short: "decode and compare with ffmpeg's framemd5", Args: cobra.MinimumNArgs(1),
+ RunE: func(cmd *cobra.Command, names []string) error {
+ out := cmd.OutOrStdout()
+ fmt.Fprintln(out, "bitstream | profile | frames(ours/ffmpeg) | match")
+ bad := 0
+ for _, n := range names {
+ r := compareStream(dir, manifests, n)
+ fmt.Fprintln(out, r.row())
+ if !r.Match {
+ bad++
+ }
+ }
+ if bad > 0 {
+ return fmt.Errorf("%d of %d bitstreams do not match", bad, len(names))
+ }
+ return nil
+ },
+ }
+ for _, c := range []*cobra.Command{fetch, compare} {
+ c.Flags().StringVar(&dir, "dir", "", "durable directory for downloaded streams")
+ _ = c.MarkFlagRequired("dir")
+ }
+ compare.Flags().StringVar(&manifests, "manifests", "", "directory to write NAME.md5 into (empty: do not write)")
+ file := &cobra.Command{
+ Use: "file PATH...", Short: "compare real MP4/MKV files; prints hashes only", Args: cobra.MinimumNArgs(1),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ var failed error
+ for _, p := range args {
+ start := time.Now()
+ r, err := compareFile(p)
+ fmt.Fprintf(cmd.OutOrStdout(), "%s | %s | frames %d/%d | match %v | md5-of-md5s %s | ours %.1fs | %v\n",
+ filepath.Base(p), r.Profile, r.Ours, r.Ref, r.Match, r.Digest, r.Seconds, err)
+ _ = start
+ if err != nil || !r.Match {
+ failed = errors.New("a file did not match")
+ }
+ }
+ return failed
+ },
+ }
+ bits := &cobra.Command{
+ Use: "bits PATH...", Short: "compare raw bitstream files; writes PATH-without-extension.md5 beside each", Args: cobra.MinimumNArgs(1),
+ RunE: func(cmd *cobra.Command, paths []string) error {
+ bad := 0
+ for _, p := range paths {
+ name := strings.TrimSuffix(filepath.Base(p), filepath.Ext(p))
+ r := compareBitstream(result{Name: name, Profile: "?"}, p, filepath.Dir(p))
+ fmt.Fprintln(cmd.OutOrStdout(), r.row())
+ if !r.Match {
+ bad++
+ }
+ }
+ if bad > 0 {
+ return fmt.Errorf("%d of %d bitstreams do not match", bad, len(paths))
+ }
+ return nil
+ },
+ }
+ root.AddCommand(fetch, compare, file, bits, diffCmd(), clipCmd(), seedsCmd())
+ return root
+}
+
+// fetchStream downloads NAME.zip into dir/NAME and unpacks it, returning the
+// bitstream's path. It is a no-op when the bitstream is already there.
+func fetchStream(dir, name string) (string, error) {
+ dst := filepath.Join(dir, name)
+ if p, err := findBitstream(dst); err == nil {
+ return p, nil
+ }
+ if err := os.MkdirAll(dst, 0o755); err != nil {
+ return "", err
+ }
+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
+ defer cancel()
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, baseURL+name+".zip", nil)
+ if err != nil {
+ return "", err
+ }
+ resp, err := http.DefaultClient.Do(req)
+ if err != nil {
+ return "", err
+ }
+ defer resp.Body.Close()
+ if resp.StatusCode != http.StatusOK {
+ return "", fmt.Errorf("HTTP %d", resp.StatusCode)
+ }
+ body, err := io.ReadAll(io.LimitReader(resp.Body, maxZip+1))
+ if err != nil {
+ return "", err
+ }
+ if len(body) > maxZip {
+ return "", errors.New("zip larger than the bound")
+ }
+ if err := unzip(body, dst); err != nil {
+ return "", err
+ }
+ return findBitstream(dst)
+}
+
+// unzip extracts a flat archive into dst, by base name (so no entry can leave
+// dst), within a total size bound.
+func unzip(body []byte, dst string) error {
+ zr, err := zip.NewReader(bytes.NewReader(body), int64(len(body)))
+ if err != nil {
+ return err
+ }
+ var total int64
+ for _, f := range zr.File {
+ if f.FileInfo().IsDir() {
+ continue
+ }
+ rc, err := f.Open()
+ if err != nil {
+ return err
+ }
+ data, err := io.ReadAll(io.LimitReader(rc, maxExtract-total+1))
+ rc.Close()
+ if err != nil {
+ return err
+ }
+ if total += int64(len(data)); total > maxExtract {
+ return errors.New("archive expands past the bound")
+ }
+ if err := os.WriteFile(filepath.Join(dst, filepath.Base(f.Name)), data, 0o644); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// findBitstream returns the H.264 bitstream in dir: the largest file with a
+// bitstream extension.
+func findBitstream(dir string) (string, error) {
+ entries, err := os.ReadDir(dir)
+ if err != nil {
+ return "", err
+ }
+ best, size := "", int64(-1)
+ for _, e := range entries {
+ if !bitstreamExt[strings.ToLower(filepath.Ext(e.Name()))] {
+ continue
+ }
+ if info, err := e.Info(); err == nil && info.Size() > size {
+ best, size = filepath.Join(dir, e.Name()), info.Size()
+ }
+ }
+ if best == "" {
+ return "", fmt.Errorf("no bitstream in %s", dir)
+ }
+ return best, nil
+}
+
+// result is one row of the table.
+type result struct {
+ Name, Profile string
+ Ours, Ref int
+ Match bool
+ Err string
+ Digest string
+ Seconds float64 // decode time of our decoder, wall clock
+}
+
+func (r result) row() string {
+ s := fmt.Sprintf("%s | %s | %d/%d | %v", r.Name, r.Profile, r.Ours, r.Ref, r.Match)
+ if r.Err != "" {
+ s += " | " + r.Err
+ }
+ return s
+}
+
+func compareStream(dir, manifests, name string) result {
+ r := result{Name: name, Profile: "?"}
+ path, err := fetchStream(dir, name)
+ if err != nil {
+ r.Err = err.Error()
+ return r
+ }
+ return compareBitstream(r, path, manifests)
+}
+
+// compareBitstream decodes the raw bitstream at path and compares it with ffmpeg.
+func compareBitstream(r result, path, manifests string) result {
+ data, err := os.ReadFile(path)
+ if err != nil {
+ r.Err = err.Error()
+ return r
+ }
+ r.Profile = profileOf(data)
+ ref, err := ffmpegMD5s(path, true)
+ if err != nil {
+ r.Err = "ffmpeg: " + err.Error()
+ return r
+ }
+ r.Ref = len(ref)
+ ours, size, err := decodeAnnexBSize(data)
+ r.Ours = len(ours)
+ if err != nil {
+ r.Err = err.Error()
+ }
+ r.Match = err == nil && equal(ours, ref)
+ if err == nil && !r.Match {
+ r.Err = fmt.Sprintf("first difference at picture %d", firstDiff(ours, ref))
+ }
+ if y := refYUV(path); y != "" {
+ if yref, yerr := yuvMD5s(y, size); yerr == nil {
+ r.Err += fmt.Sprintf(" [conformance yuv: %d pictures, ours equal %v, ffmpeg equal %v]",
+ len(yref), equal(ours, yref), equal(ref, yref))
+ }
+ }
+ if r.Match && manifests != "" {
+ if err := writeManifest(filepath.Join(manifests, r.Name+".md5"), ref); err != nil {
+ r.Err = err.Error()
+ }
+ }
+ return r
+}
+
+func compareFile(path string) (result, error) {
+ r := result{Name: filepath.Base(path)}
+ data, err := os.ReadFile(path)
+ if err != nil {
+ return r, err
+ }
+ rd, err := container.NewReader(data)
+ if err != nil {
+ return r, err
+ }
+ var id uint32
+ for _, t := range rd.File().Tracks {
+ if t.Kind == container.Video {
+ id = t.ID
+ break
+ }
+ }
+ start := time.Now()
+ frames, err := decode.DecodeTrack(rd, id, decode.Config{MaxFrameMBs: 1 << 17})
+ r.Seconds = time.Since(start).Seconds()
+ for _, t := range rd.File().Tracks {
+ if t.ID == id {
+ r.Profile = fmt.Sprintf("%s %dx%d", t.Codec, t.Width, t.Height)
+ }
+ }
+ ours := make([]string, len(frames))
+ for i, f := range frames {
+ ours[i] = frameMD5(f)
+ }
+ r.Ours = len(ours)
+ if err != nil {
+ return r, err
+ }
+ ref, err := ffmpegMD5s(path, false)
+ if err != nil {
+ return r, err
+ }
+ r.Ref = len(ref)
+ r.Match = equal(ours, ref)
+ sum := md5.Sum([]byte(strings.Join(ours, "\n")))
+ r.Digest = hex.EncodeToString(sum[:])
+ return r, nil
+}
+
+// firstDiff is the index of the first picture where a and b differ, or the
+// length of the shorter when one is a prefix of the other.
+func firstDiff(a, b []string) int {
+ for i := range min(len(a), len(b)) {
+ if a[i] != b[i] {
+ return i
+ }
+ }
+ return min(len(a), len(b))
+}
+
+func equal(a, b []string) bool {
+ if len(a) != len(b) {
+ return false
+ }
+ for i := range a {
+ if a[i] != b[i] {
+ return false
+ }
+ }
+ return true
+}
+
+func frameMD5(f decode.Frame) string {
+ h := md5.New()
+ h.Write(f.Y)
+ h.Write(f.Cb)
+ h.Write(f.Cr)
+ return hex.EncodeToString(h.Sum(nil))
+}
+
+// decodeAnnexB decodes a whole raw stream, returning each picture's MD5 in
+// display order. Pictures decoded before an error are kept.
+func decodeAnnexB(data []byte) ([]string, error) {
+ out, _, err := decodeAnnexBSize(data)
+ return out, err
+}
+
+// decodeAnnexBSize also returns the byte size of one picture.
+func decodeAnnexBSize(data []byte) (out []string, size int, err error) {
+ d, err := decode.New(decode.Config{MaxFrameMBs: 1 << 17}, 4)
+ if err != nil {
+ return nil, 0, err
+ }
+ defer d.Close()
+ add := func(fs []decode.Frame) {
+ for _, f := range fs {
+ out = append(out, frameMD5(f))
+ size = len(f.Y) + len(f.Cb) + len(f.Cr)
+ }
+ }
+ const chunk = 1 << 20
+ for len(data) > 0 {
+ n := min(chunk, len(data))
+ fs, err := d.DecodeAnnexB(data[:n])
+ add(fs)
+ if err != nil {
+ return out, size, err
+ }
+ data = data[n:]
+ }
+ fs, err := d.Flush()
+ add(fs)
+ return out, size, err
+}
+
+// yuvMD5s hashes a conformance suite's own reference output, a concatenation
+// of size-byte pictures, so that ffmpeg is not the only witness.
+func yuvMD5s(path string, size int) ([]string, error) {
+ data, err := os.ReadFile(path)
+ if err != nil || size <= 0 {
+ return nil, fmt.Errorf("no reference yuv (%v)", err)
+ }
+ var out []string
+ for ; len(data) >= size; data = data[size:] {
+ s := md5.Sum(data[:size])
+ out = append(out, hex.EncodeToString(s[:]))
+ }
+ return out, nil
+}
+
+// refYUV finds the suite's reference output beside a bitstream.
+func refYUV(bitstream string) string {
+ m, _ := filepath.Glob(filepath.Join(filepath.Dir(bitstream), "*.yuv"))
+ if len(m) == 1 {
+ return m[0]
+ }
+ return ""
+}
+
+// ffmpegMD5s runs ffmpeg -f framemd5 and returns the MD5 column. forceH264
+// names the raw demuxer for bare bitstreams, whose extension may be foreign.
+func ffmpegMD5s(path string, forceH264 bool) ([]string, error) {
+ args := []string{"-hide_banner", "-loglevel", "error", "-threads", "1"}
+ if forceH264 {
+ args = append(args, "-f", "h264")
+ }
+ args = append(args, "-i", path, "-map", "0:v:0", "-fps_mode", "passthrough", "-pix_fmt", "yuv420p", "-f", "framemd5", "-")
+ var stderr bytes.Buffer
+ cmd := exec.Command("ffmpeg", args...)
+ cmd.Stderr = &stderr
+ out, err := cmd.Output()
+ if err != nil {
+ // ffmpeg repeats one message per slice; the first line says it all.
+ first, _, _ := strings.Cut(strings.TrimSpace(stderr.String()), "\n")
+ return nil, fmt.Errorf("%w: %.120s", err, first)
+ }
+ return parseFrameMD5(out)
+}
+
+// parseFrameMD5 reads ffmpeg's framemd5 text: comment lines start with #, the
+// others are "stream, dts, pts, duration, size, md5".
+func parseFrameMD5(out []byte) ([]string, error) {
+ var md5s []string
+ sc := bufio.NewScanner(bytes.NewReader(out))
+ for sc.Scan() {
+ line := strings.TrimSpace(sc.Text())
+ if line == "" || line[0] == '#' {
+ continue
+ }
+ f := strings.Split(line, ",")
+ if len(f) != 6 {
+ return nil, fmt.Errorf("framemd5 line %q has %d fields", line, len(f))
+ }
+ md5s = append(md5s, strings.TrimSpace(f[5]))
+ }
+ return md5s, sc.Err()
+}
+
+func writeManifest(path string, md5s []string) error {
+ var b strings.Builder
+ b.WriteString("# ffmpeg -f framemd5 md5 column, display order; frames=" + strconv.Itoa(len(md5s)) + "\n")
+ for _, m := range md5s {
+ b.WriteString(m + "\n")
+ }
+ return os.WriteFile(path, []byte(b.String()), 0o644)
+}
+
+// profileOf names the profile and level of the first SPS: profile_idc and
+// constraint flags (H.264 clause 7.3.2.1, seq_parameter_set_data).
+func profileOf(data []byte) string {
+ for i := 0; i+6 < len(data); i++ {
+ if data[i] == 0 && data[i+1] == 0 && data[i+2] == 1 && data[i+3]&0x1f == 7 {
+ idc, flags, level := data[i+4], data[i+5], data[i+6]
+ name := map[byte]string{66: "Baseline", 77: "Main", 88: "Extended", 100: "High", 110: "High10", 122: "High4:2:2", 244: "High4:4:4P"}[idc]
+ if name == "" {
+ name = "profile" + strconv.Itoa(int(idc))
+ }
+ if idc == 66 && flags&0x40 != 0 {
+ name = "ConstrainedBaseline"
+ }
+ return fmt.Sprintf("%s L%d.%d", name, level/10, level%10)
+ }
+ }
+ return "?"
+}
diff --git a/tools/jvt/main_test.go b/tools/jvt/main_test.go
new file mode 100644
index 0000000..6ca5409
--- /dev/null
+++ b/tools/jvt/main_test.go
@@ -0,0 +1,111 @@
+// Copyright (c) 2026, go-avkit
+// SPDX-License-Identifier: BSD-3-Clause
+
+package main
+
+import (
+ "archive/zip"
+ "bytes"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "slices"
+ "strings"
+ "testing"
+)
+
+func TestParseFrameMD5(t *testing.T) {
+ out := "#format: frame checksums\n#version: 2\n\n0, 0, 0, 1, 38016, aaaa\n0, 1, 1, 1, 38016, bbbb\n"
+ got, err := parseFrameMD5([]byte(out))
+ if err != nil || !slices.Equal(got, []string{"aaaa", "bbbb"}) {
+ t.Fatalf("%v %v", got, err)
+ }
+ if _, err := parseFrameMD5([]byte("0, 1, 2\n")); err == nil {
+ t.Fatal("a short line was accepted")
+ }
+}
+
+func TestProfileOf(t *testing.T) {
+ cases := map[string]struct {
+ sps []byte
+ want string
+ }{
+ "cb": {[]byte{0, 0, 1, 0x67, 66, 0xc0, 12}, "ConstrainedBaseline L1.2"},
+ "main": {[]byte{0, 0, 0, 1, 0x67, 77, 0, 31}, "Main L3.1"},
+ "odd": {[]byte{0, 0, 1, 0x67, 55, 0, 10}, "profile55 L1.0"},
+ "none": {[]byte{1, 2, 3}, "?"},
+ }
+ for name, c := range cases {
+ if got := profileOf(c.sps); got != c.want {
+ t.Errorf("%s: %q, want %q", name, got, c.want)
+ }
+ }
+}
+
+func TestUnzipAndFind(t *testing.T) {
+ var buf bytes.Buffer
+ zw := zip.NewWriter(&buf)
+ for name, body := range map[string]string{"x/../../evil.264": "evil", "readme.txt": "r", "dir/": ""} {
+ w, err := zw.Create(name)
+ if err != nil {
+ t.Fatal(err)
+ }
+ w.Write([]byte(body))
+ }
+ zw.Close()
+ dir := filepath.Join(t.TempDir(), "s")
+ if err := os.MkdirAll(dir, 0o755); err != nil {
+ t.Fatal(err)
+ }
+ if err := unzip(buf.Bytes(), dir); err != nil {
+ t.Fatal(err)
+ }
+ p, err := findBitstream(dir)
+ if err != nil || filepath.Dir(p) != dir || filepath.Base(p) != "evil.264" {
+ t.Fatalf("%q %v: an entry escaped or was missed", p, err)
+ }
+ if err := unzip([]byte("not a zip"), dir); err == nil {
+ t.Fatal("garbage unzipped")
+ }
+ if _, err := findBitstream(t.TempDir()); err == nil {
+ t.Fatal("empty dir has a bitstream")
+ }
+ if _, err := findBitstream(filepath.Join(dir, "missing")); err == nil {
+ t.Fatal("missing dir has a bitstream")
+ }
+}
+
+func TestEqualAndManifest(t *testing.T) {
+ if !equal([]string{"a"}, []string{"a"}) || equal([]string{"a"}, []string{"b"}) || equal([]string{"a"}, nil) {
+ t.Fatal("equal")
+ }
+ p := filepath.Join(t.TempDir(), "m.md5")
+ if err := writeManifest(p, []string{"x", "y"}); err != nil {
+ t.Fatal(err)
+ }
+ b, _ := os.ReadFile(p)
+ if !strings.HasPrefix(string(b), "# ffmpeg") || !strings.HasSuffix(string(b), "x\ny\n") {
+ t.Fatalf("%q", b)
+ }
+}
+
+// With ffmpeg installed the bits command must agree on a committed stream.
+func TestBitsAgainstFFmpeg(t *testing.T) {
+ if _, err := exec.LookPath("ffmpeg"); err != nil {
+ t.Skip("no ffmpeg")
+ }
+ var out bytes.Buffer
+ cmd := RootCmd()
+ cmd.SetOut(&out)
+ cmd.SetArgs([]string{"bits", "../../testdata/streams/base_ip_qp26.264"})
+ // bits writes its manifest beside the stream; it must reproduce the one
+ // that is committed.
+ before, _ := os.ReadFile("../../testdata/streams/base_ip_qp26.md5")
+ if err := cmd.Execute(); err != nil {
+ t.Fatal(err, out.String())
+ }
+ after, _ := os.ReadFile("../../testdata/streams/base_ip_qp26.md5")
+ if !bytes.Equal(before, after) || !strings.Contains(out.String(), "10/10 | true") {
+ t.Fatalf("%s", out.String())
+ }
+}
diff --git a/tools/jvt/seeds.go b/tools/jvt/seeds.go
new file mode 100644
index 0000000..e096671
--- /dev/null
+++ b/tools/jvt/seeds.go
@@ -0,0 +1,125 @@
+// Copyright (c) 2026, go-avkit
+// SPDX-License-Identifier: BSD-3-Clause
+
+package main
+
+import (
+ "bytes"
+ "encoding/binary"
+ "fmt"
+ "os"
+ "path/filepath"
+ "strings"
+
+ "github.com/spf13/cobra"
+)
+
+// seedsCmd writes the fuzz corpus the library's fuzz targets start from, in the
+// "go test fuzz v1" file format, one file per stream and target. Real streams
+// cut short are what a decoder meets when a file is truncated, and are a far
+// better start than random bytes: the parameter sets and slice headers are
+// already well formed, so mutation reaches the macroblock layer.
+func seedsCmd() *cobra.Command {
+ return &cobra.Command{
+ Use: "seeds STREAMS_DIR CORPUS_DIR", Short: "write the committed fuzz corpus from the test streams", Args: cobra.ExactArgs(2),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ streams, err := filepath.Glob(filepath.Join(args[0], "*.264"))
+ if err != nil || len(streams) == 0 {
+ return fmt.Errorf("no streams in %s", args[0])
+ }
+ for _, s := range streams {
+ data, err := os.ReadFile(s)
+ if err != nil {
+ return err
+ }
+ name := strings.TrimSuffix(filepath.Base(s), ".264")
+ nals := splitNALs(data)
+ if err := writeSeed(args[1], "FuzzDecodeAnnexB", name, head(data, 1500)); err != nil {
+ return err
+ }
+ if err := writeSeed(args[1], "FuzzDecodeSample", name, firstUnit(nals, 4)); err != nil {
+ return err
+ }
+ if err := writeSeed(args[1], "FuzzParseAVCC", name, avccOf(nals)); err != nil {
+ return err
+ }
+ }
+ fmt.Fprintf(cmd.OutOrStdout(), "wrote %d seeds per target\n", len(streams))
+ return nil
+ },
+ }
+}
+
+func head(b []byte, n int) []byte { return b[:min(n, len(b))] }
+
+func writeSeed(dir, target, name string, data []byte) error {
+ d := filepath.Join(dir, target)
+ if err := os.MkdirAll(d, 0o755); err != nil {
+ return err
+ }
+ body := fmt.Sprintf("go test fuzz v1\n[]byte(%q)\n", data)
+ return os.WriteFile(filepath.Join(d, "seed-"+name), []byte(body), 0o644)
+}
+
+// splitNALs cuts an Annex B stream into NAL units without start codes.
+func splitNALs(b []byte) [][]byte {
+ var nals [][]byte
+ start := -1
+ for i := 0; i+2 < len(b); i++ {
+ if b[i] == 0 && b[i+1] == 0 && b[i+2] == 1 {
+ if start >= 0 {
+ nals = append(nals, bytes.TrimRight(b[start:i], "\x00"))
+ }
+ start = i + 3
+ i += 2
+ }
+ }
+ if start >= 0 {
+ nals = append(nals, b[start:])
+ }
+ return nals
+}
+
+// firstUnit is the stream's first sample as length-prefixed NAL units: every NAL
+// before the second slice, each cut to 1500 bytes with its length corrected.
+func firstUnit(nals [][]byte, size int) []byte {
+ var out []byte
+ slices := 0
+ for _, n := range nals {
+ if t := n[0] & 31; t == 1 || t == 5 {
+ if slices++; slices > 1 {
+ break
+ }
+ }
+ n = head(n, 1500)
+ out = binary.BigEndian.AppendUint32(out, uint32(len(n)))
+ out = append(out, n...)
+ }
+ return out
+}
+
+// avccOf builds an avcC record from the stream's first SPS and PPS.
+func avccOf(nals [][]byte) []byte {
+ var sps, pps []byte
+ for _, n := range nals {
+ switch n[0] & 31 {
+ case 7:
+ if sps == nil {
+ sps = n
+ }
+ case 8:
+ if pps == nil {
+ pps = n
+ }
+ }
+ }
+ if len(sps) < 4 || pps == nil {
+ return nil
+ }
+ b := []byte{1, sps[1], sps[2], sps[3], 0xff, 0xe1}
+ b = binary.BigEndian.AppendUint16(b, uint16(len(sps)))
+ b = append(b, sps...)
+ b = append(b, 1)
+ b = binary.BigEndian.AppendUint16(b, uint16(len(pps)))
+ return append(b, pps...)
+}
diff --git a/track_test.go b/track_test.go
new file mode 100644
index 0000000..247ffc0
--- /dev/null
+++ b/track_test.go
@@ -0,0 +1,78 @@
+// Copyright (c) 2026, go-avkit
+// SPDX-License-Identifier: BSD-3-Clause
+
+package decode
+
+import (
+ "bytes"
+ "errors"
+ "slices"
+ "testing"
+
+ "github.com/go-avkit/avkit/container"
+)
+
+// mp4 muxes a stream's access units into an MP4 with avkit's own muxer.
+func mp4(t *testing.T, path string, offset int32) []byte {
+ t.Helper()
+ aus := accessUnits(splitNALs(readFile(t, path)))
+ sps, pps, samples := parameterSets(aus)
+ var buf bytes.Buffer
+ m := container.NewProgressiveMuxer(&buf)
+ id, err := m.AddTrack(container.TrackConfig{
+ Kind: container.Video, Codec: "avc1", Timescale: 1000, Width: 176, Height: 144, SPS: sps, PPS: pps,
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ for i, s := range samples {
+ if err := m.WriteSample(id, container.Sample{
+ Data: prefixed(s, 4), Duration: 40, Sync: i == 0, CompositionOffset: offset,
+ }); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := m.Close(); err != nil {
+ t.Fatal(err)
+ }
+ return buf.Bytes()
+}
+
+func TestDecodeTrack(t *testing.T) {
+ path := "testdata/streams/base_ip_qp26.264"
+ r, err := container.NewReader(mp4(t, path, 80))
+ if err != nil {
+ t.Fatal(err)
+ }
+ frames, err := DecodeTrack(r, r.TrackIDs()[0], Config{})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !slices.Equal(sums(frames), reference(t, path)) {
+ t.Fatal("pictures differ from ffmpeg")
+ }
+ for i, f := range frames {
+ if want := int64(i)*40 + 80; f.PTS != want {
+ t.Fatalf("picture %d: PTS %d, want %d", i, f.PTS, want)
+ }
+ }
+}
+
+func TestDecodeTrackErrors(t *testing.T) {
+ path := "testdata/streams/base_ip_qp26.264"
+ r, err := container.NewReader(mp4(t, path, 0))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := DecodeTrack(r, 99, Config{}); err == nil {
+ t.Error("an unknown track was decoded")
+ }
+ // A frame size over the limit is refused when the track's SPS is loaded.
+ if _, err := DecodeTrack(r, r.TrackIDs()[0], Config{MaxFrameMBs: 1}); !errors.Is(err, ErrOverLimit) {
+ t.Errorf("limit: %v", err)
+ }
+ // A sample that decodes to an error stops the walk, keeping what was out.
+ if _, err := DecodeTrack(r, r.TrackIDs()[0], Config{MaxSampleBytes: 100}); !errors.Is(err, ErrOverLimit) {
+ t.Errorf("sample limit: %v", err)
+ }
+}