summaryrefslogtreecommitdiff
path: root/libswscale/yuv2rgb.c
diff options
context:
space:
mode:
Diffstat (limited to 'libswscale/yuv2rgb.c')
-rw-r--r--libswscale/yuv2rgb.c46
1 files changed, 42 insertions, 4 deletions
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 8ea41af79b..f8365ef567 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -6,20 +6,20 @@
* 1,4,8bpp support and context / deglobalize stuff
* by Michael Niedermayer (michaelni@gmx.at)
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -99,6 +99,16 @@ const int *sws_getCoefficients(int colorspace)
dst[12*i+ 8] = dst[12*i+ 9] = g[Y]; \
dst[12*i+10] = dst[12*i+11] = b[Y];
+#define PUTBGR48(dst,src,i) \
+ Y = src[2*i]; \
+ dst[12*i+ 0] = dst[12*i+ 1] = b[Y]; \
+ dst[12*i+ 2] = dst[12*i+ 3] = g[Y]; \
+ dst[12*i+ 4] = dst[12*i+ 5] = r[Y]; \
+ Y = src[2*i+1]; \
+ dst[12*i+ 6] = dst[12*i+ 7] = b[Y]; \
+ dst[12*i+ 8] = dst[12*i+ 9] = g[Y]; \
+ dst[12*i+10] = dst[12*i+11] = r[Y];
+
#define YUV2RGBFUNC(func_name, dst_type, alpha) \
static int func_name(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, \
int srcSliceH, uint8_t* dst[], int dstStride[]) \
@@ -175,6 +185,32 @@ ENDYUV2RGBLINE(48)
PUTRGB48(dst_1,py_1,1);
ENDYUV2RGBFUNC()
+YUV2RGBFUNC(yuv2rgb_c_bgr48, uint8_t, 0)
+ LOADCHROMA(0);
+ PUTBGR48(dst_1,py_1,0);
+ PUTBGR48(dst_2,py_2,0);
+
+ LOADCHROMA(1);
+ PUTBGR48(dst_2,py_2,1);
+ PUTBGR48(dst_1,py_1,1);
+
+ LOADCHROMA(2);
+ PUTBGR48(dst_1,py_1,2);
+ PUTBGR48(dst_2,py_2,2);
+
+ LOADCHROMA(3);
+ PUTBGR48(dst_2,py_2,3);
+ PUTBGR48(dst_1,py_1,3);
+ENDYUV2RGBLINE(48)
+ LOADCHROMA(0);
+ PUTBGR48(dst_1,py_1,0);
+ PUTBGR48(dst_2,py_2,0);
+
+ LOADCHROMA(1);
+ PUTBGR48(dst_2,py_2,1);
+ PUTBGR48(dst_1,py_1,1);
+ENDYUV2RGBFUNC()
+
YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0)
LOADCHROMA(0);
PUTRGB(dst_1,py_1,0);
@@ -568,6 +604,8 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
av_log(c, AV_LOG_WARNING, "No accelerated colorspace conversion found from %s to %s.\n", sws_format_name(c->srcFormat), sws_format_name(c->dstFormat));
switch (c->dstFormat) {
+ case PIX_FMT_BGR48BE:
+ case PIX_FMT_BGR48LE: return yuv2rgb_c_bgr48;
case PIX_FMT_RGB48BE:
case PIX_FMT_RGB48LE: return yuv2rgb_c_48;
case PIX_FMT_ARGB: