diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c index c7fb6e3f38..1b8e408210 100644 --- a/libavfilter/vf_delogo.c +++ b/libavfilter/vf_delogo.c @@ -61,7 +61,7 @@ static void apply_delogo(uint8_t *dst, int dst_linesize, unsigned int band, int show, int direct) { int x, y; - uint64_t interp, weightl, weightr, weightt, weightb; + uint64_t interp, weightl, weightr, weightt, weightb, weight; uint8_t *xdst, *xsrc; uint8_t *topleft, *botleft, *topright; @@ -125,7 +125,8 @@ static void apply_delogo(uint8_t *dst, int dst_linesize, (botleft[x-logo_x1] + botleft[x-logo_x1-1] + botleft[x-logo_x1+1]) * weightb; - interp /= (weightl + weightr + weightt + weightb) * 3U; + weight = (weightl + weightr + weightt + weightb) * 3U; + interp = ROUNDED_DIV(interp, weight); if (y >= logo_y+band && y < logo_y+logo_h-band && x >= logo_x+band && x < logo_x+logo_w-band) { diff --git a/tests/ref/fate/filter-delogo b/tests/ref/fate/filter-delogo index a39bdc553f..bf2b7513f4 100644 --- a/tests/ref/fate/filter-delogo +++ b/tests/ref/fate/filter-delogo @@ -1,110 +1,110 @@ #tb 0: 32768/982057 -0, 0, 0, 1, 126720, 0xd975ec13 -0, 1, 1, 1, 126720, 0xae91ecb1 -0, 2, 2, 1, 126720, 0xae91ecb1 -0, 3, 3, 1, 126720, 0xae91ecb1 -0, 4, 4, 1, 126720, 0x6b51ecf3 -0, 5, 5, 1, 126720, 0x3015f463 -0, 6, 6, 1, 126720, 0x68eaf4a3 -0, 7, 7, 1, 126720, 0xd68bf483 -0, 8, 8, 1, 126720, 0xa8c0b7e3 -0, 9, 9, 1, 126720, 0x1bf4b8a3 -0, 10, 10, 1, 126720, 0x1546b8e3 -0, 11, 11, 1, 126720, 0x9ac0b8c7 -0, 12, 12, 1, 126720, 0x7de8b913 -0, 13, 13, 1, 126720, 0xfd78bb83 -0, 14, 14, 1, 126720, 0x5bd9bc03 -0, 15, 15, 1, 126720, 0xa6eebba7 -0, 16, 16, 1, 126720, 0x42e4b8f3 -0, 17, 17, 1, 126720, 0xd97fadf0 -0, 18, 18, 1, 126720, 0xf28299ce -0, 19, 19, 1, 126720, 0x9843a809 -0, 20, 20, 1, 126720, 0x619aba40 -0, 21, 21, 1, 126720, 0xe216a860 -0, 22, 22, 1, 126720, 0xe2ccab69 -0, 23, 23, 1, 126720, 0x4e2caa85 -0, 24, 24, 1, 126720, 0x11c9bca0 -0, 25, 25, 1, 126720, 0xc13da72d -0, 26, 26, 1, 126720, 0x894fed60 -0, 27, 27, 1, 126720, 0xa3f0b765 -0, 28, 28, 1, 126720, 0x645d06eb -0, 29, 29, 1, 126720, 0xfcfd88a8 -0, 30, 30, 1, 126720, 0xe73704a2 -0, 31, 31, 1, 126720, 0xa548bdf5 -0, 32, 32, 1, 126720, 0x2b0207b7 -0, 33, 33, 1, 126720, 0x8fd6d84c -0, 34, 34, 1, 126720, 0x1c1fde83 -0, 35, 35, 1, 126720, 0x1b69afd3 -0, 36, 36, 1, 126720, 0x8c487b48 -0, 37, 37, 1, 126720, 0x0e0fb90a -0, 38, 38, 1, 126720, 0x0b6ba745 -0, 39, 39, 1, 126720, 0xfe09d22e -0, 40, 40, 1, 126720, 0x686bff72 -0, 41, 41, 1, 126720, 0x5b7e4f75 -0, 42, 42, 1, 126720, 0x8fa61ee2 -0, 43, 43, 1, 126720, 0xa26462ef -0, 44, 44, 1, 126720, 0x362d6606 -0, 45, 45, 1, 126720, 0x53faca36 -0, 46, 46, 1, 126720, 0xc0cacf66 -0, 47, 47, 1, 126720, 0xd3cbe8d2 -0, 48, 48, 1, 126720, 0x2eb48a4c -0, 49, 49, 1, 126720, 0x2d209870 -0, 50, 50, 1, 126720, 0x416c8ed3 -0, 51, 51, 1, 126720, 0x6f01b114 -0, 52, 52, 1, 126720, 0x90b997d8 -0, 53, 53, 1, 126720, 0x7ec89b01 -0, 54, 54, 1, 126720, 0xe0409cab -0, 55, 55, 1, 126720, 0xb919d2e5 -0, 56, 56, 1, 126720, 0xffd04880 -0, 57, 57, 1, 126720, 0x96d18686 -0, 58, 58, 1, 126720, 0x7c038101 -0, 59, 59, 1, 126720, 0x1c21af69 -0, 60, 60, 1, 126720, 0x24c56040 -0, 61, 61, 1, 126720, 0x0e9bf22d -0, 62, 62, 1, 126720, 0xc3ead681 -0, 63, 63, 1, 126720, 0xad8df3c2 -0, 64, 64, 1, 126720, 0x5aa9d7ba -0, 65, 65, 1, 126720, 0xf19b3400 -0, 66, 66, 1, 126720, 0xf87e3604 -0, 67, 67, 1, 126720, 0x2ca02d20 -0, 68, 68, 1, 126720, 0xa28fbbd3 -0, 69, 69, 1, 126720, 0xe19ceb00 -0, 70, 70, 1, 126720, 0xfb4745d7 -0, 71, 71, 1, 126720, 0x49390fda -0, 72, 72, 1, 126720, 0xf96cd182 -0, 73, 73, 1, 126720, 0xd9ba5903 -0, 74, 74, 1, 126720, 0x2b733180 -0, 75, 75, 1, 126720, 0x853df361 -0, 76, 76, 1, 126720, 0x8e550793 -0, 77, 77, 1, 126720, 0x38ad1eba -0, 78, 78, 1, 126720, 0x97061e8d -0, 79, 79, 1, 126720, 0x555247d1 -0, 80, 80, 1, 126720, 0xfc51abde -0, 81, 81, 1, 126720, 0x63dd56bd -0, 82, 82, 1, 126720, 0xf7841010 -0, 83, 83, 1, 126720, 0x1f5c0aa0 -0, 84, 84, 1, 126720, 0xce64ed63 -0, 85, 85, 1, 126720, 0x03930478 -0, 86, 86, 1, 126720, 0x7aea387f -0, 87, 87, 1, 126720, 0xfc6f2e64 -0, 88, 88, 1, 126720, 0x7bdce1d1 -0, 89, 89, 1, 126720, 0x2a4913dc -0, 90, 90, 1, 126720, 0x7ad90d87 -0, 91, 91, 1, 126720, 0x55480e14 -0, 92, 92, 1, 126720, 0xbecc87f4 -0, 93, 93, 1, 126720, 0x78bdd1f8 -0, 94, 94, 1, 126720, 0x8ee9a460 -0, 95, 95, 1, 126720, 0x2448194c -0, 96, 96, 1, 126720, 0x641a8bd0 -0, 97, 97, 1, 126720, 0x82dc27ff -0, 98, 98, 1, 126720, 0x25fee625 -0, 99, 99, 1, 126720, 0x8156f7c0 -0, 100, 100, 1, 126720, 0x724bbb10 -0, 101, 101, 1, 126720, 0xd0cabc9a -0, 102, 102, 1, 126720, 0x7a769176 -0, 103, 103, 1, 126720, 0xf2ee0c0c -0, 104, 104, 1, 126720, 0xccabeac0 -0, 105, 105, 1, 126720, 0x8fb96efc -0, 106, 106, 1, 126720, 0x67d5583c -0, 107, 107, 1, 126720, 0xcdc65fff -0, 108, 108, 1, 126720, 0x7d241678 +0, 0, 0, 1, 126720, 0xcefaec47 +0, 1, 1, 1, 126720, 0xa416ece5 +0, 2, 2, 1, 126720, 0xa416ece5 +0, 3, 3, 1, 126720, 0xa416ece5 +0, 4, 4, 1, 126720, 0x60d6ed27 +0, 5, 5, 1, 126720, 0x259af497 +0, 6, 6, 1, 126720, 0x5e6ff4d7 +0, 7, 7, 1, 126720, 0xcc10f4b7 +0, 8, 8, 1, 126720, 0x2811b819 +0, 9, 9, 1, 126720, 0x9b36b8d9 +0, 10, 10, 1, 126720, 0x9488b919 +0, 11, 11, 1, 126720, 0x316cb902 +0, 12, 12, 1, 126720, 0xfd2ab949 +0, 13, 13, 1, 126720, 0x7cc9bbb9 +0, 14, 14, 1, 126720, 0xdb1bbc39 +0, 15, 15, 1, 126720, 0x3d9abbe2 +0, 16, 16, 1, 126720, 0xc226b929 +0, 17, 17, 1, 126720, 0x3623ae2e +0, 18, 18, 1, 126720, 0x8aff9a0d +0, 19, 19, 1, 126720, 0x7c85a832 +0, 20, 20, 1, 126720, 0xbe2fba7e +0, 21, 21, 1, 126720, 0xb4eea89c +0, 22, 22, 1, 126720, 0x2ce0ab91 +0, 23, 23, 1, 126720, 0x5808aace +0, 24, 24, 1, 126720, 0x6e5ebcde +0, 25, 25, 1, 126720, 0x9202a769 +0, 26, 26, 1, 126720, 0x7df4eed2 +0, 27, 27, 1, 126720, 0x4763b8e7 +0, 28, 28, 1, 126720, 0x06970809 +0, 29, 29, 1, 126720, 0xf30189d0 +0, 30, 30, 1, 126720, 0x4a6b05c1 +0, 31, 31, 1, 126720, 0x5caebf3d +0, 32, 32, 1, 126720, 0x640d08d4 +0, 33, 33, 1, 126720, 0x4b72d969 +0, 34, 34, 1, 126720, 0xbfe8df9d +0, 35, 35, 1, 126720, 0xfc26b0f5 +0, 36, 36, 1, 126720, 0x142b7c58 +0, 37, 37, 1, 126720, 0x1b5dba4c +0, 38, 38, 1, 126720, 0x5fcea883 +0, 39, 39, 1, 126720, 0xd9f7d365 +0, 40, 40, 1, 126720, 0xb8a300aa +0, 41, 41, 1, 126720, 0x675650a6 +0, 42, 42, 1, 126720, 0xf06d2016 +0, 43, 43, 1, 126720, 0x4ee56425 +0, 44, 44, 1, 126720, 0x98ec6723 +0, 45, 45, 1, 126720, 0x80d4cb5b +0, 46, 46, 1, 126720, 0x8d1cd091 +0, 47, 47, 1, 126720, 0xaca8e9fe +0, 48, 48, 1, 126720, 0x1ae18b52 +0, 49, 49, 1, 126720, 0xe53d997a +0, 50, 50, 1, 126720, 0xcb4b8ff3 +0, 51, 51, 1, 126720, 0x9682b249 +0, 52, 52, 1, 126720, 0xf4e19918 +0, 53, 53, 1, 126720, 0x28849c20 +0, 54, 54, 1, 126720, 0xe4b89dda +0, 55, 55, 1, 126720, 0xe981d407 +0, 56, 56, 1, 126720, 0x73ad4998 +0, 57, 57, 1, 126720, 0x346387bd +0, 58, 58, 1, 126720, 0xa07c822f +0, 59, 59, 1, 126720, 0xd911b08b +0, 60, 60, 1, 126720, 0x7a1b6161 +0, 61, 61, 1, 126720, 0xa451f33f +0, 62, 62, 1, 126720, 0xb9aed79d +0, 63, 63, 1, 126720, 0x50c6f4e5 +0, 64, 64, 1, 126720, 0x6ed9d8e3 +0, 65, 65, 1, 126720, 0xea6d352a +0, 66, 66, 1, 126720, 0xb8f4373b +0, 67, 67, 1, 126720, 0xf5a52e4c +0, 68, 68, 1, 126720, 0xf8dbbd01 +0, 69, 69, 1, 126720, 0x7395ec3c +0, 70, 70, 1, 126720, 0x1249470b +0, 71, 71, 1, 126720, 0xf12a1105 +0, 72, 72, 1, 126720, 0xef38d2ba +0, 73, 73, 1, 126720, 0xa1325a34 +0, 74, 74, 1, 126720, 0xc38232b1 +0, 75, 75, 1, 126720, 0x08f9f498 +0, 76, 76, 1, 126720, 0xf6f208c5 +0, 77, 77, 1, 126720, 0x694b1fed +0, 78, 78, 1, 126720, 0xac811fc2 +0, 79, 79, 1, 126720, 0x2f2b4903 +0, 80, 80, 1, 126720, 0x4a4aad01 +0, 81, 81, 1, 126720, 0xce4557e3 +0, 82, 82, 1, 126720, 0x257a1145 +0, 83, 83, 1, 126720, 0x94580be2 +0, 84, 84, 1, 126720, 0x2422ee8a +0, 85, 85, 1, 126720, 0x801905b7 +0, 86, 86, 1, 126720, 0x4de639ba +0, 87, 87, 1, 126720, 0x24d22fa8 +0, 88, 88, 1, 126720, 0xbb38e309 +0, 89, 89, 1, 126720, 0xb8ec150d +0, 90, 90, 1, 126720, 0xc9fb0eb7 +0, 91, 91, 1, 126720, 0xb6e40f48 +0, 92, 92, 1, 126720, 0xd7028922 +0, 93, 93, 1, 126720, 0x3a24d332 +0, 94, 94, 1, 126720, 0x06b2a598 +0, 95, 95, 1, 126720, 0xf2041a92 +0, 96, 96, 1, 126720, 0xc58a8d10 +0, 97, 97, 1, 126720, 0x0d99293d +0, 98, 98, 1, 126720, 0x7b72e768 +0, 99, 99, 1, 126720, 0x0c62f900 +0, 100, 100, 1, 126720, 0xcdb7bc31 +0, 101, 101, 1, 126720, 0x04d3bdc2 +0, 102, 102, 1, 126720, 0x0355928e +0, 103, 103, 1, 126720, 0x84310d32 +0, 104, 104, 1, 126720, 0xc202ebe6 +0, 105, 105, 1, 126720, 0x0cf2703a +0, 106, 106, 1, 126720, 0xe4c95979 +0, 107, 107, 1, 126720, 0x4f846144 +0, 108, 108, 1, 126720, 0x3f1a17a4