[FFmpeg-devel] [PATCH] sws/output: init A1/A2 so that rgba64 ends with 0xffff in the absence of alpha input

Michael Niedermayer michaelni at gmx.at
Wed May 15 19:20:33 CEST 2013


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libswscale/output.c                 |    9 +++++----
 tests/ref/fate/filter-pixdesc       |    4 ++--
 tests/ref/fate/filter-pixfmts-copy  |    4 ++--
 tests/ref/fate/filter-pixfmts-field |    4 ++--
 tests/ref/fate/filter-pixfmts-hflip |    4 ++--
 tests/ref/fate/filter-pixfmts-il    |    4 ++--
 tests/ref/fate/filter-pixfmts-null  |    4 ++--
 tests/ref/fate/filter-pixfmts-scale |    4 ++--
 tests/ref/fate/filter-pixfmts-vflip |    4 ++--
 tests/ref/lavf/dpx                  |    4 ++--
 10 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index 9c7284b..c9af23b 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -682,9 +682,10 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
                        int y, enum AVPixelFormat target, int hasAlpha)
 {
     int i;
+    int A1 = 0xffff<<14, A2 = 0xffff<<14;
 
     for (i = 0; i < ((dstW + 1) >> 1); i++) {
-        int j, A1 = 0, A2 = 0;
+        int j;
         int Y1 = -0x40000000;
         int Y2 = -0x40000000;
         int U  = -128 << 23; // 19
@@ -762,7 +763,7 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2],
     int  yalpha1 = 4096 - yalpha;
     int uvalpha1 = 4096 - uvalpha;
     int i;
-    int A1 = 0, A2 = 0; // Init to avoid compiler warnings
+    int A1 = 0xffff<<14, A2 = 0xffff<<14;
 
     for (i = 0; i < ((dstW + 1) >> 1); i++) {
         int Y1 = (buf0[i * 2]     * yalpha1  + buf1[i * 2]     * yalpha) >> 14;
@@ -810,6 +811,7 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
 {
     const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
     int i;
+    int A1 = 0xffff<<14, A2= 0xffff<<14;
 
     if (uvalpha < 2048) {
         for (i = 0; i < ((dstW + 1) >> 1); i++) {
@@ -818,7 +820,6 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
             int U  = (ubuf0[i] + (-128 << 11)) >> 2;
             int V  = (vbuf0[i] + (-128 << 11)) >> 2;
             int R, G, B;
-            int A1, A2;
 
             Y1 -= c->yuv2rgb_y_offset;
             Y2 -= c->yuv2rgb_y_offset;
@@ -851,13 +852,13 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
         }
     } else {
         const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
+        int A1 = 0xffff<<14, A2 = 0xffff<<14;
         for (i = 0; i < ((dstW + 1) >> 1); i++) {
             int Y1 = (buf0[i * 2]    ) >> 2;
             int Y2 = (buf0[i * 2 + 1]) >> 2;
             int U  = (ubuf0[i] + ubuf1[i] + (-128 << 12)) >> 3;
             int V  = (vbuf0[i] + vbuf1[i] + (-128 << 12)) >> 3;
             int R, G, B;
-            int A1, A2;
 
             Y1 -= c->yuv2rgb_y_offset;
             Y2 -= c->yuv2rgb_y_offset;
diff --git a/tests/ref/fate/filter-pixdesc b/tests/ref/fate/filter-pixdesc
index 1ab928b..d0d2890 100644
--- a/tests/ref/fate/filter-pixdesc
+++ b/tests/ref/fate/filter-pixdesc
@@ -45,8 +45,8 @@ rgb565be            bc123b962629ead1a06af0c18cbb6e5f
 rgb565le            20757fafe4756e62d845b2ab4c0b8f93
 rgb8                e01614f5416dcc8ad365ad7a57afc9fb
 rgba                53796fa4c392a1b2659595b6a284f8c4
-rgba64be            d5729f8c76250a9b18cb149b396f1bfb
-rgba64le            fae0a6afdaee94cb98e3ab9a702c8ecc
+rgba64be            c05fbb1ada1b48fb1eb192fc200af2b6
+rgba64le            1b826cc613666f545274e8a7799d69f1
 uyvy422             3f411f947e3ac8f842c88e717d68bd9a
 yuv410p             7dcf3f4770c8b494290ceacd2c2ce6db
 yuv411p             9461b188dab6f8b90d9a27e353a89f58
diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy
index dba8fec..284ba78 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -46,8 +46,8 @@ rgb565be            bc123b962629ead1a06af0c18cbb6e5f
 rgb565le            20757fafe4756e62d845b2ab4c0b8f93
 rgb8                e01614f5416dcc8ad365ad7a57afc9fb
 rgba                53796fa4c392a1b2659595b6a284f8c4
-rgba64be            d5729f8c76250a9b18cb149b396f1bfb
-rgba64le            fae0a6afdaee94cb98e3ab9a702c8ecc
+rgba64be            c05fbb1ada1b48fb1eb192fc200af2b6
+rgba64le            1b826cc613666f545274e8a7799d69f1
 uyvy422             3f411f947e3ac8f842c88e717d68bd9a
 xyz12be             e1e6718ae1c83e904fbdf903d62e5808
 xyz12le             24e8a22c1bd7d637edb731d10b7c54d0
diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field
index c1c7ea7..a1b6c53 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -46,8 +46,8 @@ rgb565be            e8f3ebcbb9a5fff000eca8a312f89782
 rgb565le            53bbd558fb0dcd82f1fad83ea855c3ad
 rgb8                67bfdd4fa88b1ab9be876f42dfc75683
 rgba                d0ebdf1495bc6b7e9d3bfbe2813a9d16
-rgba64be            963f5e716b6de4cacf06c3ca9d02bee0
-rgba64le            b333503ba90d51d0cd21ff7e60acd492
+rgba64be            53363baf266592e0ac02b3f8242ec4fb
+rgba64le            a630eaa38545b2be741f000ab58451e5
 uyvy422             a6a52504a16f09b8f2ec2405bc8190b5
 xyz12be             9d904fb640dd024e668acb9dc7b3f11f
 xyz12le             7f93c7d2981f1976108e941afa1363f8
diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip
index 84a3519..83dc3f4 100644
--- a/tests/ref/fate/filter-pixfmts-hflip
+++ b/tests/ref/fate/filter-pixfmts-hflip
@@ -44,8 +44,8 @@ rgb565be            6727e71974c8e5dad157925c10ee1532
 rgb565le            b0a2b4817775289cfc415bb951f9ae0c
 rgb8                22fdbd14ce296c1afa9bb4a6ea09b3fe
 rgba                a37789c4df73c3bd8648ad1fe9d3f991
-rgba64be            d5562166a3fef8a65c15898b8e792300
-rgba64le            babf9eb683b2886289562cf465da6738
+rgba64be            286067334e4bca33fba7ebb1706890a2
+rgba64le            2a8b3dd5045df299259636d8e6b62589
 xyz12be             4738d2cb5321376d5eed70930f47a953
 xyz12le             51288f3440c8584406b332545d69c5a9
 yuv410p             a1280c2b9b562dba3c2d35a1e5fc4b23
diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il
index 5e7dc5f..b45ad53 100644
--- a/tests/ref/fate/filter-pixfmts-il
+++ b/tests/ref/fate/filter-pixfmts-il
@@ -45,8 +45,8 @@ rgb565be            077604cc5dc91008b018264db73c8f0c
 rgb565le            a97549f25e63dd0dd404db41bbe05c07
 rgb8                a35d3c3b9b87261c7417076a8b18fdb8
 rgba                8ca9c8db589615ebbaa964be4ce62d08
-rgba64be            ca82ddd3f4182c21f8708cbe5368b57a
-rgba64le            53236255cdc370f549484008f61c04e8
+rgba64be            576dfc2fd1937f9e594c4004fafd83f2
+rgba64le            7938eccc1f05f13710ec351767b47a36
 uyvy422             8be40aded4b407ff66305911ba5ce2ce
 xyz12be             1cbb1f72c6875934e66f50f499a62cc3
 xyz12le             ba8c6eab49e58eace392ef0aeedbf677
diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null
index dba8fec..284ba78 100644
--- a/tests/ref/fate/filter-pixfmts-null
+++ b/tests/ref/fate/filter-pixfmts-null
@@ -46,8 +46,8 @@ rgb565be            bc123b962629ead1a06af0c18cbb6e5f
 rgb565le            20757fafe4756e62d845b2ab4c0b8f93
 rgb8                e01614f5416dcc8ad365ad7a57afc9fb
 rgba                53796fa4c392a1b2659595b6a284f8c4
-rgba64be            d5729f8c76250a9b18cb149b396f1bfb
-rgba64le            fae0a6afdaee94cb98e3ab9a702c8ecc
+rgba64be            c05fbb1ada1b48fb1eb192fc200af2b6
+rgba64le            1b826cc613666f545274e8a7799d69f1
 uyvy422             3f411f947e3ac8f842c88e717d68bd9a
 xyz12be             e1e6718ae1c83e904fbdf903d62e5808
 xyz12le             24e8a22c1bd7d637edb731d10b7c54d0
diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale
index b354ddd..dd3e9fa 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -46,8 +46,8 @@ rgb565be            5168b66e69c25351948085e5fc51bb3a
 rgb565le            301a4d41f0db3aaed341d812ed0d7927
 rgb8                8e5786e83099bc89d2e38a76e6dfcc52
 rgba                de6a65b8c01bdad84e575202ca8b66a0
-rgba64be            fdc6467660a45d6e9dad59339be2ec4c
-rgba64le            b208b8fdd403c1a24bbef0473a89d978
+rgba64be            5ce6f591ac8be4edcf5c3350d2d2d3f5
+rgba64le            12baab5162019de2053db39a3bfca868
 uyvy422             479105bc4c7fbb4a33ca8745aa8c2de8
 xyz12be             e9be06091b6dd0b67598eaf8bd86a78e
 xyz12le             05a9bbd16d81183ef3db04447648e3b1
diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip
index 70f5d5d..1c2c8e6 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -46,8 +46,8 @@ rgb565be            c70d86afbd68a073f2d4fe0eee3a9832
 rgb565le            991576c5d3308a73068a826543b3e7af
 rgb8                42230235c5a2a66c0f9a2fcd20f9f5cd
 rgba                a6973a2940a378d2a8284194da26eec0
-rgba64be            d438e49304f65a5b7c5f09fcc1b979df
-rgba64le            9acbefa0f25441491d780b57aac11346
+rgba64be            52ee01b66ee3d52e4726a12fbb819950
+rgba64le            60541d81afcea71a27629c4e5d137dcb
 uyvy422             21c48162379321bb83ec2399535f9253
 xyz12be             7070af64e30fa689e3627b1dde7506f4
 xyz12le             4c4b31100b836638e7e61181997c49e1
diff --git a/tests/ref/lavf/dpx b/tests/ref/lavf/dpx
index ddf9a2b..7bedde3 100644
--- a/tests/ref/lavf/dpx
+++ b/tests/ref/lavf/dpx
@@ -13,6 +13,6 @@
 b9f22728f8ff393bf30cf6cbd624fa95 *./tests/data/images/dpx/02.dpx
 ./tests/data/images/dpx/%02d.dpx CRC=0xb6310a70
 407168 ./tests/data/images/dpx/02.dpx
-b3058eff9f0862a8e91747b8f5e5bd51 *./tests/data/images/dpx/02.dpx
-./tests/data/images/dpx/%02d.dpx CRC=0x4630c023
+545603630f30dec2768c8ae8d12eb8ea *./tests/data/images/dpx/02.dpx
+./tests/data/images/dpx/%02d.dpx CRC=0xe72ce131
 812672 ./tests/data/images/dpx/02.dpx
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list