From f6a9c20a52d67df2cd1cdbe3d2c58f336666b7d4 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Fri, 10 Jun 2016 13:01:26 +0200 Subject: [PATCH] swscale: Add input support for gbrap10 pixel format Signed-off-by: Paul B Mahol --- libswscale/input.c | 16 ++++++++++++++++ libswscale/utils.c | 3 +++ 2 files changed, 19 insertions(+) diff --git a/libswscale/input.c b/libswscale/input.c index d8560a1f2b..761776c1ce 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -699,11 +699,21 @@ static void planar_rgb10le_to_y(uint8_t *dst, const uint8_t *src[4], int w) planar_rgb16_to_y(dst, src, w, 10, 0); } +static void planar_rgb10le_to_a(uint8_t *dst, const uint8_t *src[4], int w) +{ + planar_rgb16_to_a(dst, src, w, 10, 0); +} + static void planar_rgb10be_to_y(uint8_t *dst, const uint8_t *src[4], int w) { planar_rgb16_to_y(dst, src, w, 10, 1); } +static void planar_rgb10be_to_a(uint8_t *dst, const uint8_t *src[4], int w) +{ + planar_rgb16_to_a(dst, src, w, 10, 1); +} + static void planar_rgb12le_to_y(uint8_t *dst, const uint8_t *src[4], int w) { planar_rgb16_to_y(dst, src, w, 12, 0); @@ -842,6 +852,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_GBRP9LE: c->readChrPlanar = planar_rgb9le_to_uv; break; + case AV_PIX_FMT_GBRAP10LE: case AV_PIX_FMT_GBRP10LE: c->readChrPlanar = planar_rgb10le_to_uv; break; @@ -856,6 +867,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_GBRP9BE: c->readChrPlanar = planar_rgb9be_to_uv; break; + case AV_PIX_FMT_GBRAP10BE: case AV_PIX_FMT_GBRP10BE: c->readChrPlanar = planar_rgb10be_to_uv; break; @@ -1073,6 +1085,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_GBRP9LE: c->readLumPlanar = planar_rgb9le_to_y; break; + case AV_PIX_FMT_GBRAP10LE: + c->readAlpPlanar = planar_rgb10le_to_a; case AV_PIX_FMT_GBRP10LE: c->readLumPlanar = planar_rgb10le_to_y; break; @@ -1089,6 +1103,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_GBRP9BE: c->readLumPlanar = planar_rgb9be_to_y; break; + case AV_PIX_FMT_GBRAP10BE: + c->readAlpPlanar = planar_rgb10be_to_a; case AV_PIX_FMT_GBRP10BE: c->readLumPlanar = planar_rgb10be_to_y; break; diff --git a/libswscale/utils.c b/libswscale/utils.c index 6034b70465..3a5c779ea3 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -191,6 +191,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_GBRP16LE] = { 1, 0 }, [AV_PIX_FMT_GBRP16BE] = { 1, 0 }, [AV_PIX_FMT_GBRAP] = { 1, 1 }, + [AV_PIX_FMT_GBRAP10LE] = { 1, 0 }, + [AV_PIX_FMT_GBRAP10BE] = { 1, 0 }, [AV_PIX_FMT_GBRAP12LE] = { 1, 1 }, [AV_PIX_FMT_GBRAP12BE] = { 1, 1 }, [AV_PIX_FMT_GBRAP16LE] = { 1, 0 }, @@ -1021,6 +1023,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, srcFormat != AV_PIX_FMT_RGB4_BYTE && srcFormat != AV_PIX_FMT_BGR4_BYTE && srcFormat != AV_PIX_FMT_GBRP9BE && srcFormat != AV_PIX_FMT_GBRP9LE && srcFormat != AV_PIX_FMT_GBRP10BE && srcFormat != AV_PIX_FMT_GBRP10LE && + srcFormat != AV_PIX_FMT_GBRAP10BE && srcFormat != AV_PIX_FMT_GBRAP10LE && srcFormat != AV_PIX_FMT_GBRP12BE && srcFormat != AV_PIX_FMT_GBRP12LE && srcFormat != AV_PIX_FMT_GBRP16BE && srcFormat != AV_PIX_FMT_GBRP16LE && ((dstW >> c->chrDstHSubSample) <= (srcW >> 1) ||