summaryrefslogtreecommitdiff
path: root/libswscale/swscale_template.c
diff options
context:
space:
mode:
Diffstat (limited to 'libswscale/swscale_template.c')
-rw-r--r--libswscale/swscale_template.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c
index 234e61871b..81a8d66277 100644
--- a/libswscale/swscale_template.c
+++ b/libswscale/swscale_template.c
@@ -225,6 +225,32 @@ static inline void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
nvXXtoUV_c(dstV, dstU, src1, width);
}
+// FIXME Maybe dither instead.
+#define YUV_NBPS(depth) \
+static inline void yuv ## depth ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
+ const uint8_t *_srcU, const uint8_t *_srcV, \
+ long width, uint32_t *unused) \
+{ \
+ int i; \
+ const uint16_t *srcU = (const uint16_t*)_srcU; \
+ const uint16_t *srcV = (const uint16_t*)_srcV; \
+ for (i = 0; i < width; i++) { \
+ dstU[i] = srcU[i]>>(depth-8); \
+ dstV[i] = srcV[i]>>(depth-8); \
+ } \
+} \
+\
+static inline void yuv ## depth ## ToY_c(uint8_t *dstY, const uint8_t *_srcY, long width, uint32_t *unused) \
+{ \
+ int i; \
+ const uint16_t *srcY = (const uint16_t*)_srcY; \
+ for (i = 0; i < width; i++) \
+ dstY[i] = srcY[i]>>(depth-8); \
+} \
+
+YUV_NBPS( 9)
+YUV_NBPS(10)
+
static inline void bgr24ToY_c(uint8_t *dst, const uint8_t *src,
long width, uint32_t *unused)
{
@@ -790,6 +816,10 @@ static void sws_init_swScale_c(SwsContext *c)
case PIX_FMT_PAL8 :
case PIX_FMT_BGR4_BYTE:
case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV; break;
+ case PIX_FMT_YUV420P9BE:
+ case PIX_FMT_YUV420P9LE: c->chrToYV12 = yuv9ToUV_c; break;
+ case PIX_FMT_YUV420P10BE:
+ case PIX_FMT_YUV420P10LE: c->chrToYV12 = yuv10ToUV_c; break;
case PIX_FMT_YUV420P16BE:
case PIX_FMT_YUV422P16BE:
case PIX_FMT_YUV444P16BE: c->chrToYV12 = BEToUV_c; break;
@@ -836,6 +866,10 @@ static void sws_init_swScale_c(SwsContext *c)
c->lumToYV12 = NULL;
c->alpToYV12 = NULL;
switch (srcFormat) {
+ case PIX_FMT_YUV420P9BE:
+ case PIX_FMT_YUV420P9LE: c->lumToYV12 = yuv9ToY_c; break;
+ case PIX_FMT_YUV420P10BE:
+ case PIX_FMT_YUV420P10LE: c->lumToYV12 = yuv10ToY_c; break;
case PIX_FMT_YUYV422 :
case PIX_FMT_YUV420P16BE:
case PIX_FMT_YUV422P16BE: