[FFmpeg-cvslog] swscale: fix 16-bit horizontal scaling underflow.

Ronald S. Bultje git at videolan.org
Sun Jul 10 04:33:39 CEST 2011


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Fri Jul  8 14:54:31 2011 -0700| [f44d50a94c120135faeba6b4a1e5551b4397810f] | committer: Ronald S. Bultje

swscale: fix 16-bit horizontal scaling underflow.

When using e.g. lanczos scaling, values can drop below 0, so they
should never be unsigned.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f44d50a94c120135faeba6b4a1e5551b4397810f
---

 libswscale/swscale.c          |    2 +-
 tests/ref/lavfi/pixdesc       |    4 ++--
 tests/ref/lavfi/pixfmts_copy  |    4 ++--
 tests/ref/lavfi/pixfmts_hflip |    4 ++--
 tests/ref/lavfi/pixfmts_null  |    4 ++--
 tests/ref/lavfi/pixfmts_scale |   24 ++++++++++++------------
 tests/ref/lavfi/pixfmts_vflip |    4 ++--
 7 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 14807fd..a302373 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1854,7 +1854,7 @@ static void hScale16_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_s
     for (i = 0; i < dstW; i++) {
         int j;
         int srcPos = filterPos[i];
-        unsigned int val = 0;
+        int val = 0;
 
         for (j = 0; j < filterSize; j++) {
             val += src[srcPos + j] * filter[filterSize * i + j];
diff --git a/tests/ref/lavfi/pixdesc b/tests/ref/lavfi/pixdesc
index ee28c4b..76d845a 100644
--- a/tests/ref/lavfi/pixdesc
+++ b/tests/ref/lavfi/pixdesc
@@ -42,8 +42,8 @@ yuv422p16be         86ad3447f97969ce095afeef81fa9abf
 yuv422p16le         a53a9b451f4a81eeae33362c1bbd07f8
 yuv440p             5a064afe2b453bb52cdb3f176b1aa1cf
 yuv444p             0a98447b78fd476aa39686da6a74fa2e
-yuv444p16be         12554ba5f143126dc5e886b9a8be37e9
-yuv444p16le         35872903aefd0f545255a4452ccc262e
+yuv444p16be         2a8e2bddfe4c208df4119aaa7dc5db28
+yuv444p16le         f2117fc9cf66d3a832183e159ff71803
 yuva420p            a29884f3f3dfe1e00b961bc17bef3d47
 yuvj420p            32eec78ba51857b16ce9b813a49b7189
 yuvj422p            0dfa0ed434f73be51428758c69e082cb
diff --git a/tests/ref/lavfi/pixfmts_copy b/tests/ref/lavfi/pixfmts_copy
index ee28c4b..76d845a 100644
--- a/tests/ref/lavfi/pixfmts_copy
+++ b/tests/ref/lavfi/pixfmts_copy
@@ -42,8 +42,8 @@ yuv422p16be         86ad3447f97969ce095afeef81fa9abf
 yuv422p16le         a53a9b451f4a81eeae33362c1bbd07f8
 yuv440p             5a064afe2b453bb52cdb3f176b1aa1cf
 yuv444p             0a98447b78fd476aa39686da6a74fa2e
-yuv444p16be         12554ba5f143126dc5e886b9a8be37e9
-yuv444p16le         35872903aefd0f545255a4452ccc262e
+yuv444p16be         2a8e2bddfe4c208df4119aaa7dc5db28
+yuv444p16le         f2117fc9cf66d3a832183e159ff71803
 yuva420p            a29884f3f3dfe1e00b961bc17bef3d47
 yuvj420p            32eec78ba51857b16ce9b813a49b7189
 yuvj422p            0dfa0ed434f73be51428758c69e082cb
diff --git a/tests/ref/lavfi/pixfmts_hflip b/tests/ref/lavfi/pixfmts_hflip
index 7710252..4a32e35 100644
--- a/tests/ref/lavfi/pixfmts_hflip
+++ b/tests/ref/lavfi/pixfmts_hflip
@@ -33,8 +33,8 @@ yuv422p16be         9dbe0af0eb877987611cf04bfa577202
 yuv422p16le         2d8f37231110177cc5e1b61c8cb4b163
 yuv440p             a99e2b57ed601f39852715c9d675d0d3
 yuv444p             947e47f7bb5fdccc659d19b7df2b6fc3
-yuv444p16be         cdc7bfb08b8286d05d6a639d1bfc0d26
-yuv444p16le         969caecaaca795477874420540d21e8b
+yuv444p16be         38cdb28061ebb8e7aa3797238615e77f
+yuv444p16le         80d654986d6f3754e924310a045fdb24
 yuva420p            d83ec0c01498189f179ec574918185f1
 yuvj420p            df3aaaec3bb157c3bde5f0365af30f4f
 yuvj422p            d113871528d510a192797af59df9c05c
diff --git a/tests/ref/lavfi/pixfmts_null b/tests/ref/lavfi/pixfmts_null
index ee28c4b..76d845a 100644
--- a/tests/ref/lavfi/pixfmts_null
+++ b/tests/ref/lavfi/pixfmts_null
@@ -42,8 +42,8 @@ yuv422p16be         86ad3447f97969ce095afeef81fa9abf
 yuv422p16le         a53a9b451f4a81eeae33362c1bbd07f8
 yuv440p             5a064afe2b453bb52cdb3f176b1aa1cf
 yuv444p             0a98447b78fd476aa39686da6a74fa2e
-yuv444p16be         12554ba5f143126dc5e886b9a8be37e9
-yuv444p16le         35872903aefd0f545255a4452ccc262e
+yuv444p16be         2a8e2bddfe4c208df4119aaa7dc5db28
+yuv444p16le         f2117fc9cf66d3a832183e159ff71803
 yuva420p            a29884f3f3dfe1e00b961bc17bef3d47
 yuvj420p            32eec78ba51857b16ce9b813a49b7189
 yuvj422p            0dfa0ed434f73be51428758c69e082cb
diff --git a/tests/ref/lavfi/pixfmts_scale b/tests/ref/lavfi/pixfmts_scale
index 0cb27ef..14c748f 100644
--- a/tests/ref/lavfi/pixfmts_scale
+++ b/tests/ref/lavfi/pixfmts_scale
@@ -11,8 +11,8 @@ bgr565le            3a514a298c6161a071ddf9963c06509d
 bgr8                7f007fa6c153a16e808a9c51605a4016
 bgra                a5e7040f9a80cccd65e5acf2ca09ace5
 gray                d7786a7d9d99ac74230cc045cab5632c
-gray16be            bba98532da29a31599df2feec3b08e3e
-gray16le            30267f127d5734c4767f3944f1729a33
+gray16be            b554d6c1cc8da23967445be4dd3e4a86
+gray16le            715a33aa1c19cb26b14f5cc000e7a3d1
 monob               88c4c050758e64d120f50c7eff694381
 monow               d31772ebaa877fc2a78565937f7f9673
 nv12                4676d59db43d657dc12841f6bc3ab452
@@ -31,19 +31,19 @@ uyvy422             314bd486277111a95d9369b944fa0400
 yuv410p             7df8f6d69b56a8dcb6c7ee908e5018b5
 yuv411p             1143e7c5cc28fe0922b051b17733bc4c
 yuv420p             fdad2d8df8985e3d17e73c71f713cb14
-yuv420p10be         2343beaf83fccc2ab23a590b2049d38b
-yuv420p10le         94d511d783d175f573e7be5cce75ba4d
-yuv420p16be         f6ef3ba90f238b467c7e72ade927083d
-yuv420p16le         faf6aab3b1c16e8afbe160686dd360e0
-yuv420p9be          fdafb9ad473a559246c4cb0a1f416cd8
-yuv420p9le          fccfd3c3941da635b13739f579819b5a
+yuv420p10be         aad747a7634ba4ed48f149cdfc78792e
+yuv420p10le         46547f19a7f58638dff73657477b11b9
+yuv420p16be         d7270efce54eb59c7b01c14157a1b890
+yuv420p16le         e85abf00bad940a922b623c91c9026d7
+yuv420p9be          a073b2d93b2a7dce2069ba252bc43175
+yuv420p9le          b67233c3c7d93763d07d88f697c145e1
 yuv422p             918e37701ee7377d16a8a6c119c56a40
-yuv422p16be         837945d3a771366a5a72a4ed095a4f53
-yuv422p16le         b8292ae9b52eb7afc3d8b93e8fd895b4
+yuv422p16be         5cd8fe1da161d21b65bf75bf4cb50c75
+yuv422p16le         3b545317b1f5e627751525fb2958d88e
 yuv440p             461503fdb9b90451020aa3b25ddf041c
 yuv444p             81b2eba962d12e8d64f003ac56f6faf2
-yuv444p16be         fe2c4a3708c4f44a2d91f3c413f33caf
-yuv444p16le         1b4fce808e546cd75ef01cdb91da26b5
+yuv444p16be         2bd3e992d1533f8e0978a8e0c7008243
+yuv444p16le         daee5a461ae3bc53295c392e423aa1d7
 yuva420p            8673a9131fb47de69788863f93a50eb7
 yuvj420p            30427bd6caf5bda93a173dbebe759e09
 yuvj422p            fc8288f64fd149573f73cf8da05d8e6d
diff --git a/tests/ref/lavfi/pixfmts_vflip b/tests/ref/lavfi/pixfmts_vflip
index acead3d..b440efa 100644
--- a/tests/ref/lavfi/pixfmts_vflip
+++ b/tests/ref/lavfi/pixfmts_vflip
@@ -42,8 +42,8 @@ yuv422p16be         8cdfbddf2dd4c44c3efef4ee00170eba
 yuv422p16le         a2f421f6a1af950544081c1797de01ae
 yuv440p             876385e96165acf51271b20e5d85a416
 yuv444p             9c3c667d1613b72d15bc6d851c5eb8f7
-yuv444p16be         c73d2f57f90060d4126241aba04876d3
-yuv444p16le         c9ab60ec1ae3ff50da524e83e3553add
+yuv444p16be         bb86de32c67dd49469989ac184b89592
+yuv444p16le         64b899f52d820b14d05ff95954c15790
 yuva420p            c705d1cf061d8c6580ac690b55f92276
 yuvj420p            41fd02b204da0ab62452cd14b595e2e4
 yuvj422p            7f6ca9bc1812cde02036d7d29a7cce43



More information about the ffmpeg-cvslog mailing list