Created
August 29, 2016 15:41
-
-
Save BtbN/14cd93969c084c303f127436388aaab3 to your computer and use it in GitHub Desktop.
stdin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libswscale/output.c b/libswscale/output.c | |
index f340c53..24631ff 100644 | |
--- a/libswscale/output.c | |
+++ b/libswscale/output.c | |
@@ -311,6 +311,44 @@ static void yuv2nv12cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterS | |
} | |
} | |
+static void yuv2p010cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize, | |
+ const int16_t **chrUSrc, const int16_t **chrVSrc, | |
+ uint8_t *dest8, int chrDstW) | |
+{ | |
+ enum AVPixelFormat dstFormat = c->dstFormat; | |
+ uint16_t *dest = (uint16_t*)dest8; | |
+ int shift = 17; | |
+ int i, j; | |
+ | |
+ if (dstFormat == AV_PIX_FMT_P010LE) { | |
+ for (i = 0; i < chrDstW; i++) { | |
+ int u = 1 << (shift - 1); | |
+ int v = 1 << (shift - 1); | |
+ | |
+ for (j = 0; j < chrFilterSize; j++) { | |
+ u += chrUSrc[j][i] * chrFilter[j]; | |
+ v += chrVSrc[j][i] * chrFilter[j]; | |
+ } | |
+ | |
+ AV_WL16(dest + 2*i , av_clip_uintp2(u >> shift, 10) << 6); | |
+ AV_WL16(dest + 2*i + 1, av_clip_uintp2(v >> shift, 10) << 6); | |
+ } | |
+ } else { | |
+ for (i = 0; i < chrDstW; i++) { | |
+ int u = 1 << (shift - 1); | |
+ int v = 1 << (shift - 1); | |
+ | |
+ for (j = 0; j < chrFilterSize; j++) { | |
+ u += chrUSrc[j][i] * chrFilter[j]; | |
+ v += chrVSrc[j][i] * chrFilter[j]; | |
+ } | |
+ | |
+ AV_WB16(dest + 2*i , av_clip_uintp2(u >> shift, 10) << 6); | |
+ AV_WB16(dest + 2*i + 1, av_clip_uintp2(v >> shift, 10) << 6); | |
+ } | |
+ } | |
+} | |
+ | |
#define accumulate_bit(acc, val) \ | |
acc <<= 1; \ | |
acc |= (val) >= 234 | |
@@ -2095,6 +2133,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, | |
} else if (desc->comp[0].depth == 10) { | |
*yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c; | |
*yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c; | |
+ if (dstFormat == AV_PIX_FMT_P010LE || dstFormat == AV_PIX_FMT_P010BE) | |
+ *yuv2nv12cX = yuv2p010cX_c; | |
} else if (desc->comp[0].depth == 12) { | |
*yuv2planeX = isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c; | |
*yuv2plane1 = isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c; | |
diff --git a/libswscale/utils.c b/libswscale/utils.c | |
index 576d8f0..0aef672 100644 | |
--- a/libswscale/utils.c | |
+++ b/libswscale/utils.c | |
@@ -246,8 +246,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { | |
[AV_PIX_FMT_XYZ12BE] = { 1, 1, 1 }, | |
[AV_PIX_FMT_XYZ12LE] = { 1, 1, 1 }, | |
[AV_PIX_FMT_AYUV64LE] = { 1, 1}, | |
- [AV_PIX_FMT_P010LE] = { 1, 0 }, | |
- [AV_PIX_FMT_P010BE] = { 1, 0 }, | |
+ [AV_PIX_FMT_P010LE] = { 1, 1 }, | |
+ [AV_PIX_FMT_P010BE] = { 1, 1 }, | |
}; | |
int sws_isSupportedInput(enum AVPixelFormat pix_fmt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment