diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-12-08 11:53:54 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-07-02 09:35:41 +0200 |
commit | e78e5b735fd559bc7aa3f5a01e9c8d37dc2ec6d8 (patch) | |
tree | baa5e3b3f35f307390edad3bf1ae380d6be1f8ca /libswscale/input.c | |
parent | b7c5f885233a7b8692140c920d9f43220dc830d9 (diff) |
swscale: add P010 input support
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libswscale/input.c')
-rw-r--r-- | libswscale/input.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libswscale/input.c b/libswscale/input.c index e806bce661..9a4fd77f1c 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -496,6 +496,44 @@ static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV, nvXXtoUV_c(dstV, dstU, src1, width); } +static void p010LEToY_c(uint8_t *dst, const uint8_t *src, int width, uint32_t *unused) +{ + int i; + for (i = 0; i < width; i++) { + AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> 6); + } +} + +static void p010BEToY_c(uint8_t *dst, const uint8_t *src, int width, uint32_t *unused) +{ + int i; + for (i = 0; i < width; i++) { + AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> 6); + } +} + +static void p010LEToUV_c(uint8_t *dstU, uint8_t *dstV, + const uint8_t *src1, const uint8_t *src2, + int width, uint32_t *unused) +{ + int i; + for (i = 0; i < width; i++) { + AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> 6); + AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> 6); + } +} + +static void p010BEToUV_c(uint8_t *dstU, uint8_t *dstV, + const uint8_t *src1, const uint8_t *src2, + int width, uint32_t *unused) +{ + int i; + for (i = 0; i < width; i++) { + AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> 6); + AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> 6); + } +} + #define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos)) static void bgr24ToY_c(uint8_t *dst, const uint8_t *src, @@ -813,6 +851,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) c->chrToYV12 = bswap16UV_c; break; #endif + case AV_PIX_FMT_P010LE: + c->chrToYV12 = p010LEToUV_c; + break; + case AV_PIX_FMT_P010BE: + c->chrToYV12 = p010BEToUV_c; + break; } if (c->chrSrcHSubSample) { switch (srcFormat) { @@ -1128,6 +1172,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_BGR48LE: c->lumToYV12 = bgr48LEToY_c; break; + case AV_PIX_FMT_P010LE: + c->lumToYV12 = p010LEToY_c; + break; + case AV_PIX_FMT_P010BE: + c->lumToYV12 = p010BEToY_c; + break; } if (c->alpPixBuf) { switch (srcFormat) { |