[FFmpeg-cvslog] sws/output: remove offset/coef for alpha in rgba64

Michael Niedermayer git at videolan.org
Sun May 12 22:10:31 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun May 12 22:01:18 2013 +0200| [145e644aeed44ed22bcb37afe9209d2d42b60e00] | committer: Michael Niedermayer

sws/output: remove offset/coef for alpha in rgba64

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libswscale/output.c |   38 ++++++++++----------------------------
 1 file changed, 10 insertions(+), 28 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index c82b04b..37219a6 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -707,16 +707,10 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
                 A1 += alpSrc[j][i * 2]     * (unsigned)lumFilter[j];
                 A2 += alpSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
             }
-            A1 >>= 14; // 10
-            A1 += 0x10000;
-            A2 >>= 14;
-            A2 += 0x10000;
-            A1 -= c->yuv2rgb_y_offset;
-            A2 -= c->yuv2rgb_y_offset;
-            A1 *= c->yuv2rgb_y_coeff;
-            A2 *= c->yuv2rgb_y_coeff;
-            A1 += 1 << 13; // 21
-            A2 += 1 << 13;
+            A1 >>= 1;
+            A1 += 0x20002000;
+            A2 >>= 1;
+            A2 += 0x20002000;
         }
 
         // 8bit: 12+15=27; 16-bit: 12+19=31
@@ -789,13 +783,9 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2],
         B =                            U * c->yuv2rgb_u2b_coeff;
 
         if (hasAlpha) {
-            A1 = (abuf0[i * 2    ] * yalpha1 + abuf1[i * 2    ] * yalpha) >> 14;
-            A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 14;
+            A1 = (abuf0[i * 2    ] * yalpha1 + abuf1[i * 2    ] * yalpha) >> 1;
+            A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 1;
 
-            A1 -= c->yuv2rgb_y_offset;
-            A2 -= c->yuv2rgb_y_offset;
-            A1 *= c->yuv2rgb_y_coeff;
-            A2 *= c->yuv2rgb_y_coeff;
             A1 += 1 << 13;
             A2 += 1 << 13;
         }
@@ -838,13 +828,9 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
             Y2 += 1 << 13;
 
             if (hasAlpha) {
-                A1 = abuf0[i * 2    ] >> 2;
-                A2 = abuf0[i * 2 + 1] >> 2;
+                A1 = abuf0[i * 2    ] << 11;
+                A2 = abuf0[i * 2 + 1] << 11;
 
-                A1 -= c->yuv2rgb_y_offset;
-                A2 -= c->yuv2rgb_y_offset;
-                A1 *= c->yuv2rgb_y_coeff;
-                A2 *= c->yuv2rgb_y_coeff;
                 A1 += 1 << 13;
                 A2 += 1 << 13;
             }
@@ -881,13 +867,9 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
             Y2 += 1 << 13;
 
             if (hasAlpha) {
-                A1 = abuf0[i * 2    ] >> 2;
-                A2 = abuf0[i * 2 + 1] >> 2;
+                A1 = abuf0[i * 2    ] << 11;
+                A2 = abuf0[i * 2 + 1] << 11;
 
-                A1 -= c->yuv2rgb_y_offset;
-                A2 -= c->yuv2rgb_y_offset;
-                A1 *= c->yuv2rgb_y_coeff;
-                A2 *= c->yuv2rgb_y_coeff;
                 A1 += 1 << 13;
                 A2 += 1 << 13;
             }



More information about the ffmpeg-cvslog mailing list