]> git.nihav.org Git - nihav.git/commitdiff
indeo5: fix off-by-one error in recombine_plane()
authorKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 13 Oct 2022 16:21:33 +0000 (18:21 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 13 Oct 2022 16:22:10 +0000 (18:22 +0200)
nihav-indeo/src/codecs/indeo5.rs

index 0c6d65eeed8c48d9dcbf1b89969fb07c5505adfe..2d1e9bd0dcc6baf359d7ed218e57a6e76484025f 100644 (file)
@@ -401,7 +401,7 @@ impl IndeoXParser for Indeo5Parser {
         let filt_lo = |a: i16, b: i16| a + b;
         let filt_hi = |a: i16, b: i16, c: i16| a - b * 6 + c;
 
         let filt_lo = |a: i16, b: i16| a + b;
         let filt_hi = |a: i16, b: i16, c: i16| a - b * 6 + c;
 
-        for _ in 0..(h/2) {
+        for _ in 0..(h/2)-1 {
             let mut b0_1 = src[idx0];
             let mut b0_2 = src[idx0 + sstride];
             let mut b1_1 = src[bidx1];
             let mut b0_1 = src[idx0];
             let mut b0_2 = src[idx0 + sstride];
             let mut b1_1 = src[bidx1];
@@ -423,7 +423,7 @@ impl IndeoXParser for Indeo5Parser {
             let mut b3_9 = b3_8;
             let mut b3_7;
 
             let mut b3_9 = b3_8;
             let mut b3_7;
 
-            for x in 0..(w/2) {
+            for x in 0..(w/2)-1 {
                 b2_1 = b2_2;
                 b2_2 = b2_3;
                 b2_4 = b2_5;
                 b2_1 = b2_2;
                 b2_2 = b2_3;
                 b2_4 = b2_5;
@@ -748,106 +748,106 @@ mod test {
         // sample: https://samples.mplayerhq.hu/V-codecs/IV50/sample.avi
         test_decoding("avi", "indeo5", "assets/Indeo/IV5/sample.avi", Some(100),
                       &dmx_reg, &dec_reg, ExpectedTestResult::MD5Frames(vec![
         // sample: https://samples.mplayerhq.hu/V-codecs/IV50/sample.avi
         test_decoding("avi", "indeo5", "assets/Indeo/IV5/sample.avi", Some(100),
                       &dmx_reg, &dec_reg, ExpectedTestResult::MD5Frames(vec![
-                           [0xd73ef6e2, 0x099dc18f, 0x46450af9, 0x1b390a48],
-                           [0xbe3295d6, 0xf4afd9fd, 0x820d35e8, 0x4b593c9a],
-                           [0x415e5aed, 0x33afb9a2, 0x14ae9308, 0x53e906d3],
-                           [0x7fa94dd3, 0x58582fc3, 0xe39977bc, 0xd88036d5],
-                           [0x8eef68f7, 0xace88c0c, 0x3f6e4388, 0xfcd82f46],
-                           [0xfe22fcc6, 0x8c4666ab, 0xd9888786, 0x7d9adbc8],
-                           [0x37f8b6bc, 0xaea9e94a, 0x05a98f2e, 0x2dce51fa],
-                           [0x37492cbd, 0x8fd516fa, 0x48a0bcd1, 0x5eb6584f],
-                           [0x6f464159, 0xa2af785b, 0xb440493b, 0x86b21911],
-                           [0x3a52de08, 0x9f5762b0, 0xe58a6979, 0x0abb295e],
-                           [0xe8f56414, 0x36e76d76, 0xd0927365, 0x15dc5327],
-                           [0x0fc17e06, 0x8cb6581c, 0x86eb730d, 0x9bedf951],
-                           [0x54fb3627, 0xc02bffc6, 0x87748ee5, 0x8b12d57d],
-                           [0x8e4fd3a5, 0x3a7b9cd7, 0x0a4ba1a0, 0x48e10237],
-                           [0xce87ea8b, 0x1ec40c98, 0x12c9a682, 0x57d02bf0],
-                           [0x7024e691, 0x6bc493ba, 0x617a7a91, 0x65997b4c],
-                           [0xb8d53b7c, 0x132ffec9, 0x827cf176, 0x68e97292],
-                           [0x12ed76a9, 0x11eced60, 0x473a364f, 0x1e197803],
-                           [0x6c23ba3a, 0x12e2f7e3, 0x8fc0c2bc, 0x20726bb2],
-                           [0x3307e5e6, 0x3e4fa871, 0x55df1d59, 0xbe055301],
-                           [0x8198ee6c, 0x82a33414, 0x9fd8c430, 0x1fca7b93],
-                           [0x557662c2, 0xeb3226fc, 0x2a125be4, 0xd475ffa9],
-                           [0x850c0326, 0x7a0105e5, 0x37799945, 0x927d1237],
-                           [0xe770097e, 0xabd460f4, 0x3d9260e0, 0x5a8132e2],
-                           [0xdb6644e7, 0xde6986eb, 0x12cc4916, 0x977d2177],
-                           [0xd58ced6c, 0x91c0e7b6, 0x8c5926fc, 0x2dbf3117],
-                           [0x6e76dd5f, 0x088884f0, 0x8f94451f, 0xc8df4daf],
-                           [0x726b2f8f, 0xd44af9ba, 0x1e188962, 0xd37c1a38],
-                           [0x84035565, 0xd2370a8c, 0x8ecb4a3f, 0xd6758196],
-                           [0xa1e75a16, 0xc9e230ed, 0x23de50f3, 0x2366967a],
-                           [0x690a2a91, 0xfa4acef1, 0xd3de6dd0, 0x973031d9],
-                           [0xb392e62a, 0x22b0d3f2, 0x0e975a86, 0x14d6dcb3],
-                           [0x5e002202, 0xc80e236e, 0x0b484e02, 0x00035f47],
-                           [0x4fc0f301, 0x8ec0d33d, 0xe71a12dd, 0xe799731f],
-                           [0x278c9096, 0xec7fa833, 0x2094d81f, 0x52e21165],
-                           [0xd55238a8, 0xf040101a, 0x1152b6fe, 0x661c9e64],
-                           [0x3699d16e, 0x89d9f2d7, 0x9ad59597, 0x7361ee21],
-                           [0x1419c93c, 0x91b75784, 0x18f7121d, 0xec2c6b78],
-                           [0x07c435da, 0x05f18557, 0xf28ce1e0, 0x43cadcba],
-                           [0x2015269d, 0x52cad948, 0xd6485611, 0x06fe33d7],
-                           [0x0cea56f3, 0x82c30841, 0x9b2a8cab, 0x8a6f07cb],
-                           [0x81f82aa9, 0x233060d5, 0x00f4171e, 0xe14c0c2a],
-                           [0x9b2f8b08, 0x7d091eac, 0x09dcb2c3, 0xa7670405],
-                           [0x99c97f75, 0xf91c6b12, 0xfbad7705, 0x1c6e6f27],
-                           [0xc762b89c, 0xbf44a194, 0xb2a54dc2, 0xae2103e4],
-                           [0xba4f52ed, 0xe35aff77, 0x50d8c9d3, 0xeb382d32],
-                           [0x9bc9d9a0, 0x7cb4c594, 0xbc1af6f4, 0x1f718229],
-                           [0x5f19eea2, 0x6260982e, 0x393fb360, 0x71abe746],
-                           [0xd13f2fcc, 0x88a6a714, 0xf4f53d55, 0xf42b11ba],
-                           [0x4208b476, 0xaf06ffce, 0x38e59bfe, 0x588567a2],
-                           [0xbedfb7b7, 0x8300a39d, 0x964a3c0f, 0x577d52d7],
-                           [0x18e5a6f2, 0x7ec85996, 0x27694f30, 0x7717748a],
-                           [0xb5e6d70f, 0xc43261bb, 0xd4e6ae7c, 0xcc11f79c],
-                           [0xc808cba7, 0xbb042416, 0x2f01ebe1, 0x7d176a38],
-                           [0x03353805, 0x4b6e9d66, 0x25933123, 0x4213aaf7],
-                           [0x189a6da5, 0x04a4cbe6, 0xea3c9d09, 0x153fdee2],
-                           [0x41f8ac6b, 0xb476356b, 0xc70b67d0, 0x28caf359],
-                           [0x4514b6a4, 0x788545ff, 0x4ee9139b, 0xa45bedf9],
-                           [0x2a39be04, 0xac9921cb, 0x685c1bf9, 0x904bdab2],
-                           [0x2c18f3ef, 0x416c0335, 0x0face768, 0x1b9d5cd2],
-                           [0x898cd63f, 0x60af727f, 0x6bdf1be6, 0x0df05cfe],
-                           [0x8a06787b, 0x7cee2f8b, 0xdc8aac77, 0x2e0e740a],
-                           [0x3d340571, 0xbf1c8d4c, 0xddc23f69, 0xd1903942],
-                           [0x7d179e85, 0x54048c4d, 0xba047d33, 0x2e9e5edb],
-                           [0x65e26600, 0x87c8421d, 0xa77e2c6c, 0x32b4971a],
-                           [0x69041052, 0xa4858c7b, 0x904d84f7, 0xb4ad3dcf],
-                           [0x3ea0246d, 0x533e752d, 0x1d55798a, 0x30e17e72],
-                           [0x4254a700, 0x07365f23, 0x0f9da313, 0xaecd38ce],
-                           [0xa5756d9d, 0x79f31387, 0x0ded3654, 0xa7299663],
-                           [0x4ef027c9, 0xeebb1383, 0x26a55289, 0x3746969d],
-                           [0xdc6acadf, 0x23e1b6e1, 0x07fcdc26, 0x9914b684],
-                           [0x52bb8b80, 0x1a5688ae, 0xd429662d, 0x1cc1485d],
-                           [0x76b35f59, 0x24b64e5b, 0xbcbeaee7, 0xf568a832],
-                           [0x0756d15f, 0x9cc288bf, 0x9f882a3c, 0xfe7c7161],
-                           [0x0503113a, 0x95e716ff, 0x304cf65e, 0x490725e8],
-                           [0x7db7ba62, 0x08e4e77d, 0xc9db6413, 0xea3f1a39],
-                           [0x7cef6d67, 0xc94867e6, 0x5c674de6, 0x5eb74081],
-                           [0x7573b799, 0x069d4f03, 0x63b537a1, 0xdfe25db6],
-                           [0xc401e705, 0x834828bc, 0xd99da4a1, 0xd0f3bee8],
-                           [0x02817844, 0xada6433e, 0x31761e98, 0x901ccf68],
-                           [0x8f9432b4, 0x9f860957, 0xcba54c86, 0x8beb8209],
-                           [0x6a46e58c, 0x7d299228, 0x5c001d12, 0xd8db2a00],
-                           [0x0c12586d, 0x866d8ca9, 0x849bbb17, 0x5af63ea2],
-                           [0xe48671b6, 0xc4377063, 0xc4d03c02, 0x621bd894],
-                           [0x5f7f82eb, 0xcdb5abf5, 0x325f2d9d, 0x24a5d200],
-                           [0xec6b6fe7, 0x347316c4, 0x6241904a, 0x4e2497a5],
-                           [0xf661b7fd, 0xa00e2fc7, 0x90e11456, 0x507fef21],
-                           [0x77c7addd, 0x67148dce, 0x1cd27059, 0xefbf4abf],
-                           [0x11270d9c, 0xb352779d, 0x81f21055, 0xae93a8b6],
-                           [0x3d1f0aaf, 0x3b4aa6d8, 0xca1c160c, 0x6fe4f2bd],
-                           [0x17c6bec4, 0x54b568cd, 0xd19c78d6, 0x9a3d897a],
-                           [0xc4ab4ca6, 0xbf3b2573, 0xb4d837dd, 0x4dfab799],
-                           [0x6fd5645d, 0xa34978b2, 0x6696dd1a, 0x665ca09b],
-                           [0x87984bb9, 0xd4d3bc30, 0x7f8bb7a8, 0x2d83b303],
-                           [0x21fb5d58, 0x1ee47d1a, 0x97200d83, 0x1d596a88],
-                           [0x2656f329, 0x497693be, 0xca971ddf, 0x410d4092],
-                           [0xd285c512, 0xfc1ed632, 0x63c43ec2, 0xac5766d1],
-                           [0x46fb80ee, 0xcfeecdaa, 0x7237a433, 0x5708ff56],
-                           [0x4fccd9c8, 0x7b1a4f31, 0x51516a80, 0x27bf3cae],
-                           [0xd649d2f5, 0xebadf1f7, 0x6b34e8ce, 0xb87e82f1],
-                           [0x6eb0aec6, 0xfbe9cb51, 0x39e695b4, 0xa6e46e70]]));
+                            [0xcb451428, 0x5c8b1519, 0x96a81eda, 0x0c9cccf0],
+                            [0x7554e11f, 0x3b60d661, 0x3bcd14b5, 0x036dcc16],
+                            [0x92a20e68, 0x83418e5c, 0x640b6786, 0x9c867622],
+                            [0x0b2cde46, 0x67b68ac5, 0xc152edc6, 0xda591ac3],
+                            [0x9034354b, 0x81c66b57, 0xcb671505, 0x0062a75f],
+                            [0x38606276, 0x547b83df, 0x4a22f079, 0x2afb8362],
+                            [0x0d3fe5df, 0xadc8b042, 0x4ee9cb0d, 0xf9b79b11],
+                            [0x2b0b1ddb, 0x612a163a, 0x47b5afc8, 0xeb4c79a5],
+                            [0x8eadd17e, 0xc4c8c932, 0x57508232, 0x643e1498],
+                            [0x0dcc7da2, 0x7b059de2, 0x0ff46dd9, 0x04c11f77],
+                            [0xe358728a, 0xe42fc515, 0x8f5cc35f, 0x02973436],
+                            [0x66847a32, 0x884b41f0, 0x0c3062bc, 0xb58d923b],
+                            [0x555b2711, 0xbcb54b64, 0x5a6141e5, 0xa7b5cc44],
+                            [0x0f326348, 0x5d36cb21, 0xe7f8210d, 0x8a43c2c5],
+                            [0x4e7b18a3, 0x42146bbb, 0x04c4cf2b, 0x78fe3c0d],
+                            [0x220f0721, 0xe681444a, 0x974bf97b, 0x9b658cfe],
+                            [0x2d5a5f22, 0x23bd1ed8, 0xed383633, 0x5905422d],
+                            [0x982ae872, 0x17b8f765, 0x3d1735af, 0xa2872d9f],
+                            [0x743a2819, 0x392d856e, 0xf2ee64ca, 0x63101b79],
+                            [0x0c9e0aa7, 0x79414f6b, 0x162c19a6, 0x86d69b96],
+                            [0x3eae05ad, 0xbff350bb, 0x97e8a205, 0xfa8e42b2],
+                            [0x0ccae893, 0xdfcf9885, 0xef39d053, 0x0a655a73],
+                            [0x75e98d11, 0x83fab601, 0xe836a6d2, 0xb2a7c7cb],
+                            [0x1565b1ce, 0x8ab813c5, 0xb1658413, 0xeebaf068],
+                            [0xe2bb47dd, 0xc3c277a7, 0x8c6bd4be, 0xbbca989d],
+                            [0xea97912e, 0xcd224d66, 0x76fd31c2, 0x7a854abf],
+                            [0x8eebb842, 0x0534b043, 0xf55a3b65, 0x3868b974],
+                            [0x82c55a0b, 0x5d18c3c8, 0xbdc40fd1, 0x5d11f2e2],
+                            [0xda46bff0, 0xedc1e115, 0x77cb8b8a, 0xf5fd6ddf],
+                            [0x7c9c19e9, 0x4188e742, 0xd8c2cbaf, 0x0ecd1aaa],
+                            [0x33145d5b, 0x0c8e2f61, 0x2ab4b213, 0xf1cf9ebe],
+                            [0x64f561e1, 0xae2aa75b, 0xe4d56a57, 0xdcc54d10],
+                            [0x25545f02, 0x8c271a6a, 0x6b676110, 0xa348628b],
+                            [0x8c33d2d7, 0x7dfc25a0, 0xbdb68979, 0xac7ce8f1],
+                            [0x8adc7126, 0x71c4d390, 0x4b47aeed, 0x444dbd2b],
+                            [0xaab41fbc, 0x2c6de4d8, 0x83b61f31, 0xc68879b1],
+                            [0x90961b3a, 0x9a1d4b51, 0xbf34d9d1, 0xe90137a7],
+                            [0x2e988439, 0x2d7e67ec, 0x9bfd6405, 0xd851ee32],
+                            [0x3b2b45e8, 0x76225018, 0xa2632614, 0x06234ca9],
+                            [0xd52dc6af, 0x36c0d185, 0x90f4a9d2, 0x0b024990],
+                            [0x5ed3ebb2, 0xb19b49a2, 0xd691c27a, 0x7d52941c],
+                            [0xcb22479a, 0x3713b23d, 0x24abe31b, 0x45877b4e],
+                            [0x143aa9f1, 0xe7709011, 0xa6ef993b, 0x8e4f33e2],
+                            [0xc8b1ad16, 0x820b4f85, 0xe9d1482a, 0x806af90c],
+                            [0x4f1eda2b, 0xa73eac8c, 0x8004e66b, 0xa0804e11],
+                            [0x668ceb7b, 0xad020ed3, 0x90687534, 0x96eded7e],
+                            [0x8bbd77d0, 0x29fc1ae4, 0xc41fb7cf, 0x31b08f08],
+                            [0x02d07857, 0x4ed79f55, 0x89cfe082, 0x97167616],
+                            [0xd99dbf57, 0x87ef7406, 0x59c9abdf, 0xf664be32],
+                            [0x6d2bd834, 0x6b61d6e5, 0x3fd282ce, 0xbc877248],
+                            [0xb4dbab3f, 0x7006dded, 0x39608927, 0x9773b83e],
+                            [0x6e1f21e8, 0xff1a76c0, 0x197dd40b, 0x3cedee3d],
+                            [0x551f64b8, 0x98161c0f, 0xb93103a7, 0xac12366e],
+                            [0x6854311c, 0x6bc09f24, 0x226ec3e9, 0x91507815],
+                            [0xb106d988, 0x6c9cda70, 0xebf972ce, 0x97b1efa8],
+                            [0x91b8c27b, 0x257ff731, 0x1589d60d, 0xcb2b3de9],
+                            [0x819d3677, 0xa6afca81, 0x3d2b4ba9, 0xba8cc70f],
+                            [0xfb2c67fa, 0x75af7785, 0xde6133b0, 0x1bb59f2c],
+                            [0xceb72cd4, 0x8c581ccb, 0x803233f2, 0xb88a174b],
+                            [0xe2811f64, 0xa488d42c, 0x3a62a574, 0x918df881],
+                            [0x95a66cf8, 0x0529a646, 0x3bc15b00, 0xfb0eedc9],
+                            [0x1e90f3ce, 0xa8f81b7f, 0x13d5445c, 0xc969a914],
+                            [0x25287783, 0x19869a3d, 0x93672c2a, 0x07a57f5e],
+                            [0x44dfacc0, 0x528ae192, 0x141721a9, 0x85b2a3d9],
+                            [0x45f13c20, 0x90b07bb5, 0x9a155a2f, 0x3933fb77],
+                            [0x40531c62, 0x437c14b6, 0xc03c8d39, 0x35f5ae87],
+                            [0x32e58909, 0xdb068147, 0xa967c6cf, 0x33d9416a],
+                            [0xa8c44523, 0x12a89332, 0xddd09ccf, 0x7b04c0d2],
+                            [0xae00b8b4, 0x589efb18, 0xf8c1dec1, 0xfd9d867f],
+                            [0xe2fc1828, 0x5f7a3b28, 0x72de1c32, 0xc01e6ea6],
+                            [0x8be4c525, 0xcde70d98, 0xd7f5f5a1, 0xf39faadf],
+                            [0x9c744944, 0x00a491f4, 0x665707a9, 0xa93fad9d],
+                            [0x036f2525, 0x827ddd36, 0x989c99db, 0x6b9455fc],
+                            [0x52c6b5d2, 0xfd4e23f9, 0xb620b0da, 0x462d7566],
+                            [0x00ba54e6, 0xfe9021ae, 0xa8c65c37, 0xda979c78],
+                            [0x6e11dca0, 0x41887539, 0x2b9781af, 0x94e6b930],
+                            [0x086be7db, 0xcce50438, 0x2d94bc75, 0x00f4ebfe],
+                            [0xd2216f7c, 0x33321d48, 0x8ce0f144, 0x34c1fd4f],
+                            [0x9083c0fc, 0x6cb46451, 0xd8202b2f, 0xae5db326],
+                            [0xe894be71, 0x0e1b6c67, 0x70d5e81f, 0x2075d5ff],
+                            [0x7f9f10f7, 0x0a8df81d, 0x406cb9cc, 0x524879b5],
+                            [0x4c329904, 0x6f939b2c, 0xd49f8bba, 0xad54aee5],
+                            [0x92d68b43, 0x2c631f71, 0x98329455, 0x91971f7f],
+                            [0x1b06289e, 0x4879af78, 0xc66d7c82, 0xda19e863],
+                            [0x399741da, 0xd362b007, 0x8f94e50c, 0xcdd23209],
+                            [0xa2063194, 0xc67f368a, 0x83462433, 0xe719c2db],
+                            [0x9da0bfd1, 0x8977f90e, 0x7f2f4172, 0xab5213ff],
+                            [0x82823c8f, 0xd7cdd62e, 0xac3a59ba, 0x17ef0fb9],
+                            [0xb3e51375, 0xfebb3ad3, 0x54ffdda4, 0xfbf44cf9],
+                            [0x261f8183, 0x8328012b, 0x47d7e527, 0xc19cca15],
+                            [0xef25bfc7, 0x79460e21, 0xeb65f2ef, 0x63731f9f],
+                            [0xd14fc8f5, 0x209123ea, 0xf5f1cf21, 0x93f84381],
+                            [0xf5375f67, 0x0846d9a1, 0x07aaf802, 0xe753fa08],
+                            [0x65a56edd, 0x4ea28e39, 0x10d17a7b, 0xa9445d87],
+                            [0xbeb8eb53, 0xd01b9c94, 0xd1d15e41, 0x639307cc],
+                            [0xc2272546, 0xd1701452, 0x2fe76cbd, 0xe1dd7697],
+                            [0xff6c09f6, 0x1d7804c2, 0x1ca3a2f8, 0x3fffb67b],
+                            [0xfe48f3fd, 0x0046ec25, 0x1ed4401a, 0xd67f4ed6],
+                            [0x46c3c72f, 0x8398b8c1, 0xe26aff08, 0x0dd1ecbb],
+                            [0xc7f49f94, 0xca32d87c, 0x2e063788, 0x0229c6c0],
+                            [0xa9ec4820, 0x576c7877, 0xc21211c3, 0x502af3d3]]));
     }
 }
     }
 }