[FFmpeg-cvslog] swscale/input: Fix GBRAP16 input

Michael Niedermayer git at videolan.org
Thu Apr 28 05:29:16 CEST 2016


ffmpeg | branch: release/2.7 | Michael Niedermayer <michael at niedermayer.cc> | Tue Feb 23 23:14:03 2016 +0100| [19257891d176b9862f30d0b300a9cec73141c99b] | committer: Michael Niedermayer

swscale/input: Fix GBRAP16 input

Fixes part of Ticket5264

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit df36257a53561a51af969a6ea6319dd2579509b9)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libswscale/input.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index 1f04fc2..3c4e0cd 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -818,6 +818,19 @@ static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_sr
     }
 }
 
+static av_always_inline void planar_rgb16_to_a(uint8_t *_dst, const uint8_t *_src[4],
+                                               int width, int bpc, int is_be, int32_t *rgb2yuv)
+{
+    int i;
+    const uint16_t **src = (const uint16_t **)_src;
+    uint16_t *dst        = (uint16_t *)_dst;
+    int shift = bpc < 16 ? bpc : 14;
+
+    for (i = 0; i < width; i++) {
+        dst[i] = rdpx(src[3] + i) << (14 - shift);
+    }
+}
+
 static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV,
                                                 const uint8_t *_src[4], int width,
                                                 int bpc, int is_be, int32_t *rgb2yuv)
@@ -846,6 +859,11 @@ static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *s
 {                                                                                                   \
     planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv);                                         \
 }                                                                                                   \
+static void planar_rgb##nbits##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4],              \
+                                                  int w, int32_t *rgb2yuv)                          \
+{                                                                                                   \
+    planar_rgb16_to_a(dst, src, w, nbits, endian, rgb2yuv);                                         \
+}                                                                                                   \
 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV,                    \
                                                    const uint8_t *src[4], int w, int32_t *rgb2yuv)  \
 {                                                                                                   \
@@ -1172,6 +1190,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
         c->readLumPlanar = planar_rgb14le_to_y;
         break;
     case AV_PIX_FMT_GBRAP16LE:
+        c->readAlpPlanar = planar_rgb16le_to_a;
     case AV_PIX_FMT_GBRP16LE:
         c->readLumPlanar = planar_rgb16le_to_y;
         break;
@@ -1188,6 +1207,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
         c->readLumPlanar = planar_rgb14be_to_y;
         break;
     case AV_PIX_FMT_GBRAP16BE:
+        c->readAlpPlanar = planar_rgb16be_to_a;
     case AV_PIX_FMT_GBRP16BE:
         c->readLumPlanar = planar_rgb16be_to_y;
         break;



More information about the ffmpeg-cvslog mailing list